Changeset 8216 for trunk/qt/prefs.cc


Ignore:
Timestamp:
Apr 11, 2009, 6:25:12 PM (13 years ago)
Author:
charles
Message:

(qt) better integration of sort & filter modes into the preferences mechanism

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/prefs.cc

    r8197 r8216  
    2323#include <libtransmission/utils.h>
    2424#include "prefs.h"
     25#include "types.h"
    2526
    2627/***
     
    4142    { TRASH_ORIGINAL, "trash-original-torrent-files", QVariant::Bool },
    4243    { ASKQUIT, "prompt-before-exit", QVariant::Bool },
    43     { SORT_MODE, "sort-mode", QVariant::String },
     44    { SORT_MODE, "sort-mode", TrTypes::SortModeType },
    4445    { SORT_REVERSED, "sort-reversed", QVariant::Bool },
    4546    { MINIMAL_VIEW, "minimal-view", QVariant::Bool },
     
    5556    { MAIN_WINDOW_X, "main-window-x", QVariant::Int },
    5657    { MAIN_WINDOW_Y, "main-window-y", QVariant::Int },
    57     { FILTER_MODE, "filter-mode", QVariant::String },
     58    { FILTER_MODE, "filter-mode", TrTypes::FilterModeType },
    5859
    5960    /* libtransmission settings */
     
    135136                    myValues[i].setValue( qlonglong(intVal) );
    136137                break;
     138            case TrTypes::SortModeType:
     139                if( tr_bencGetStr( b, &str ) )
     140                    myValues[i] = QVariant::fromValue( SortMode( str ) );
     141                break;
     142            case TrTypes::FilterModeType:
     143                if( tr_bencGetStr( b, &str ) )
     144                    myValues[i] = QVariant::fromValue( FilterMode( str ) );
     145                break;
    137146            case QVariant::String:
    138147                if( tr_bencGetStr( b, &str ) )
     
    179188            case QVariant::Int:
    180189                tr_bencDictAddInt( &top, key, val.toInt() );
     190                break;
     191            case TrTypes::SortModeType:
     192                tr_bencDictAddStr( &top, key, val.value<SortMode>().name().toUtf8().constData() );
     193                break;
     194            case TrTypes::FilterModeType:
     195                tr_bencDictAddStr( &top, key, val.value<FilterMode>().name().toUtf8().constData() );
    181196                break;
    182197            case QVariant::String:
Note: See TracChangeset for help on using the changeset viewer.