Changeset 9330


Ignore:
Timestamp:
Oct 19, 2009, 5:25:50 AM (13 years ago)
Author:
charles
Message:

(trunk) #1483: move completed torrents to a user-specified directory

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/rpc-spec.txt

    r9259 r9330  
    391391   "blocklist-enabled"        | boolean    true means enabled
    392392   "blocklist-size"           | number     number of rules in the blocklist
     393   "download-dir"             | string     default path to download torrents
    393394   "dht-enabled"              | boolean    true means allow dht in public torrents
    394395   "encryption"               | string     "required", "preferred", "tolerated"
    395    "download-dir"             | string     default path to download torrents
     396   "incomplete-dir"           | string     path for incomplete torrents, when enabled
     397   "incomplete-dir-enabled"   | boolean    true means keep torrents in incomplete-dir until done
    396398   "peer-limit-global"        | number     maximum global number of peers
    397399   "peer-limit-per-torrent"   | number     maximum global number of peers
     
    560562         |         |        NO | torrent-get    | removed arg "seeders"
    561563         |         |        NO | torrent-get    | removed arg "timesCompleted"
    562          |         | yes    NO | torrent-get    | new arg "trackerStats"
    563 
    564 
     564         |         | yes       | torrent-get    | new arg "trackerStats"
     565         |         | yes       | session-set    | new arg "incomplete-dir"
     566         |         | yes       | session-set    | new arg "incomplete-dir-enabled"
     567
     568
  • trunk/libtransmission/rpcimpl.c

    r9259 r9330  
    11471147    if( tr_bencDictFindStr( args_in, TR_PREFS_KEY_DOWNLOAD_DIR, &str ) )
    11481148        tr_sessionSetDownloadDir( session, str );
     1149    if( tr_bencDictFindStr( args_in, TR_PREFS_KEY_INCOMPLETE_DIR, &str ) )
     1150        tr_sessionSetIncompleteDir( session, str );
     1151    if( tr_bencDictFindBool( args_in, TR_PREFS_KEY_INCOMPLETE_DIR_ENABLED, &boolVal ) )
     1152        tr_sessionSetIncompleteDirEnabled( session, boolVal );
    11491153    if( tr_bencDictFindInt( args_in, TR_PREFS_KEY_PEER_LIMIT_GLOBAL, &i ) )
    11501154        tr_sessionSetPeerLimit( session, i );
     
    12561260    tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_LIMIT_GLOBAL, tr_sessionGetPeerLimit( s ) );
    12571261    tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_LIMIT_TORRENT, tr_sessionGetPeerLimitPerTorrent( s ) );
     1262    tr_bencDictAddStr ( d, TR_PREFS_KEY_INCOMPLETE_DIR, tr_sessionGetIncompleteDir( s ) );
     1263    tr_bencDictAddBool( d, TR_PREFS_KEY_INCOMPLETE_DIR_ENABLED, tr_sessionGetIncompleteDirEnabled( s ) );
    12581264    tr_bencDictAddBool( d, TR_PREFS_KEY_PEX_ENABLED, tr_sessionIsPexEnabled( s ) );
    12591265    tr_bencDictAddBool( d, TR_PREFS_KEY_DHT_ENABLED, tr_sessionIsDHTEnabled( s ) );
     
    12611267    tr_bencDictAddInt ( d, TR_PREFS_KEY_PEER_PORT_RANDOM_ON_START, tr_sessionGetPeerPortRandomOnStart( s ) );
    12621268    tr_bencDictAddBool( d, TR_PREFS_KEY_PORT_FORWARDING, tr_sessionIsPortForwardingEnabled( s ) );
    1263     tr_bencDictAddInt ( d, "rpc-version", 6 );
     1269    tr_bencDictAddInt ( d, "rpc-version", 7 );
    12641270    tr_bencDictAddInt ( d, "rpc-version-minimum", 1 );
    12651271    tr_bencDictAddReal( d, "seedRatioLimit", tr_sessionGetRatioLimit( s ) );
  • trunk/qt/prefs-dialog.cc

    r9247 r9330  
    487487
    488488void
     489PrefsDialog :: onIncompleteClicked( void )
     490{
     491    const QString title = tr( "Select Incomplete Directory" );
     492    const QString path = myPrefs.getString( Prefs::INCOMPLETE_DIR );
     493    QFileDialog * d = new QFileDialog( this, title, path );
     494    d->setFileMode( QFileDialog::Directory );
     495    connect( d, SIGNAL(filesSelected(const QStringList&)),
     496             this, SLOT(onIncompleteSelected(const QStringList&)) );
     497    d->show( );
     498}
     499
     500void
     501PrefsDialog :: onIncompleteSelected( const QStringList& list )
     502{
     503    if( list.size() == 1 )
     504        myPrefs.set( Prefs::INCOMPLETE_DIR, list.first( ) );
     505}
     506
     507
     508void
    489509PrefsDialog :: onWatchClicked( void )
    490510{
    491     QFileDialog * d = new QFileDialog( this,
    492                                        tr( "Select Watch Directory" ),
    493                                        myPrefs.getString( Prefs::DIR_WATCH ) );
     511    const QString title = tr( "Select Watch Directory" );
     512    const QString path = myPrefs.getString( Prefs::DIR_WATCH );
     513    QFileDialog * d = new QFileDialog( this, title, path );
    494514    d->setFileMode( QFileDialog::Directory );
    495     connect( d, SIGNAL(filesSelected(const QStringList&)), this, SLOT(onWatchSelected(const QStringList&)) );
     515    connect( d, SIGNAL(filesSelected(const QStringList&)),
     516             this, SLOT(onWatchSelected(const QStringList&)) );
    496517    d->show( );
    497518}
     
    507528PrefsDialog :: onDestinationClicked( void )
    508529{
    509     QFileDialog * d = new QFileDialog( this,
    510                                        tr( "Select Destination" ),
    511                                        myPrefs.getString( Prefs::DOWNLOAD_DIR ) );
     530    const QString title = tr( "Select Destination" );
     531    const QString path = myPrefs.getString( Prefs::DOWNLOAD_DIR );
     532    QFileDialog * d = new QFileDialog( this, title, path );
    512533    d->setFileMode( QFileDialog::Directory );
    513     connect( d, SIGNAL(filesSelected(const QStringList&)), this, SLOT(onDestinationSelected(const QStringList&)) );
     534    connect( d, SIGNAL(filesSelected(const QStringList&)),
     535             this, SLOT(onDestinationSelected(const QStringList&)) );
    514536    d->show( );
    515537}
  • trunk/qt/prefs-dialog.h

    r8763 r9330  
    5353        void onWatchClicked( );
    5454        void onWatchSelected( const QStringList& );
     55        void onIncompleteClicked( );
     56        void onIncompleteSelected( const QStringList& );
    5557        void onDestinationClicked( );
    5658        void onDestinationSelected( const QStringList& );
     
    9597        QPushButton * myPortButton;
    9698        QPushButton * myWatchButton;
     99        QPushButton * myIncompleteButton;
    97100        QPushButton * myDestinationButton;
    98101        QWidgetList myWebWidgets;
  • trunk/qt/prefs.cc

    r9237 r9330  
    7878    { DOWNLOAD_DIR, TR_PREFS_KEY_DOWNLOAD_DIR, QVariant::String },
    7979    { ENCRYPTION, TR_PREFS_KEY_ENCRYPTION, QVariant::Int },
     80    { INCOMPLETE_DIR, TR_PREFS_KEY_INCOMPLETE_DIR, QVariant::String },
     81    { INCOMPLETE_DIR_ENABLED, TR_PREFS_KEY_INCOMPLETE_DIR_ENABLED, QVariant::Bool },
    8082    { LAZY_BITFIELD, TR_PREFS_KEY_LAZY_BITFIELD, QVariant::Bool },
    8183    { MSGLEVEL, TR_PREFS_KEY_MSGLEVEL, QVariant::Int },
  • trunk/qt/prefs.h

    r9237 r9330  
    8282            DOWNLOAD_DIR,
    8383            ENCRYPTION,
     84            INCOMPLETE_DIR,
     85            INCOMPLETE_DIR_ENABLED,
    8486            LAZY_BITFIELD,
    8587            MSGLEVEL,
  • trunk/qt/session.cc

    r9328 r9330  
    123123        case Prefs :: DHT_ENABLED:
    124124        case Prefs :: DOWNLOAD_DIR:
     125        case Prefs :: INCOMPLETE_DIR:
     126        case Prefs :: INCOMPLETE_DIR_ENABLED:
    125127        case Prefs :: PEER_LIMIT_GLOBAL:
    126128        case Prefs :: PEER_LIMIT_TORRENT:
Note: See TracChangeset for help on using the changeset viewer.