Changeset 8194 for trunk/qt/mainwin.cc


Ignore:
Timestamp:
Apr 10, 2009, 3:48:19 AM (13 years ago)
Author:
charles
Message:

(trunk qt) remember sorting & filtering mode between sessions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/mainwin.cc

    r8188 r8194  
    286286             << Prefs :: SORT_REVERSED
    287287             << Prefs :: SORT_MODE
     288             << Prefs :: FILTER_MODE
    288289             << Prefs :: FILTERBAR
    289290             << Prefs :: STATUSBAR
     
    514515TrMainWindow :: setShowMode( TorrentFilter :: ShowMode mode )
    515516{
    516     ui.filterAll->setChecked( mode == TorrentFilter::SHOW_ALL );
    517     ui.filterActive->setChecked( mode == TorrentFilter::SHOW_ACTIVE );
    518     ui.filterDownloading->setChecked( mode == TorrentFilter::SHOW_DOWNLOADING );
    519     ui.filterSeeding->setChecked( mode == TorrentFilter::SHOW_SEEDING );
    520     ui.filterPaused->setChecked( mode == TorrentFilter::SHOW_PAUSED );
     517    ui.filterAll->setChecked         ( mode == TorrentFilter :: SHOW_ALL );
     518    ui.filterActive->setChecked      ( mode == TorrentFilter :: SHOW_ACTIVE );
     519    ui.filterDownloading->setChecked ( mode == TorrentFilter :: SHOW_DOWNLOADING );
     520    ui.filterSeeding->setChecked     ( mode == TorrentFilter :: SHOW_SEEDING );
     521    ui.filterPaused->setChecked      ( mode == TorrentFilter :: SHOW_PAUSED );
    521522
    522523    myFilterModel.setShowMode( mode );
     
    611612{
    612613    bool b;
     614    int i;
    613615    QString str;
    614616
     
    629631
    630632        case Prefs::SORT_MODE:
    631             str = myPrefs.getString( key );
    632             ui.action_SortByActivity->setChecked ( str == "sort-by-activity" );
    633             ui.action_SortByAge->setChecked      ( str == "sort-by-age" );
    634             ui.action_SortByETA->setChecked      ( str == "sort-by-eta" );
    635             ui.action_SortByName->setChecked     ( str == "sort-by-name" );
    636             ui.action_SortByProgress->setChecked ( str == "sort-by-progress" );
    637             ui.action_SortByRatio->setChecked    ( str == "sort-by-ratio" );
    638             ui.action_SortBySize->setChecked     ( str == "sort-by-size" );
    639             ui.action_SortByState->setChecked    ( str == "sort-by-state" );
    640             ui.action_SortByTracker->setChecked  ( str == "sort-by-tracker" );
    641             break;
     633            i = myFilterModel.getSortModeFromName( myPrefs.getString( key ) );
     634            ui.action_SortByActivity->setChecked ( i == TorrentFilter::SORT_BY_ACTIVITY );
     635            ui.action_SortByAge->setChecked      ( i == TorrentFilter::SORT_BY_AGE );
     636            ui.action_SortByETA->setChecked      ( i == TorrentFilter::SORT_BY_ETA );
     637            ui.action_SortByName->setChecked     ( i == TorrentFilter::SORT_BY_NAME );
     638            ui.action_SortByProgress->setChecked ( i == TorrentFilter::SORT_BY_PROGRESS );
     639            ui.action_SortByRatio->setChecked    ( i == TorrentFilter::SORT_BY_RATIO );
     640            ui.action_SortBySize->setChecked     ( i == TorrentFilter::SORT_BY_SIZE );
     641            ui.action_SortByState->setChecked    ( i == TorrentFilter::SORT_BY_STATE );
     642            ui.action_SortByTracker->setChecked  ( i == TorrentFilter::SORT_BY_TRACKER );
     643            break;
     644
     645        case Prefs::FILTER_MODE:
     646            i = myFilterModel.getShowModeFromName( myPrefs.getString( key ) );
     647            ui.filterAll->setChecked         ( i == TorrentFilter::SHOW_ALL );
     648            ui.filterActive->setChecked      ( i == TorrentFilter::SHOW_ACTIVE );
     649            ui.filterDownloading->setChecked ( i == TorrentFilter::SHOW_DOWNLOADING );
     650            ui.filterSeeding->setChecked     ( i == TorrentFilter::SHOW_SEEDING );
     651            ui.filterPaused->setChecked      ( i == TorrentFilter::SHOW_PAUSED );
     652            break;
     653
    642654
    643655        case Prefs::FILTERBAR:
Note: See TracChangeset for help on using the changeset viewer.