Changeset 13381


Ignore:
Timestamp:
Jul 9, 2012, 11:18:40 PM (8 years ago)
Author:
jordan
Message:

(trunk qt) #4235 "allow transmission-qt to specify download dir for remote sessions" -- patch added from taem

Location:
trunk/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/options.cc

    r12697 r13381  
    3030#include <QVBoxLayout>
    3131#include <QWidget>
     32#include <QLineEdit>
    3233
    3334#include <libtransmission/transmission.h>
     
    111112    connect( p, SIGNAL(clicked(bool)), this, SLOT(onFilenameClicked()));
    112113
     114    const QFileIconProvider iconProvider;
     115    const QIcon folderIcon = iconProvider.icon( QFileIconProvider::Folder );
     116    const QPixmap folderPixmap = folderIcon.pixmap( iconSize );
     117
     118    l = new QLabel( tr( "&Destination folder:" ) );
     119    layout->addWidget( l, ++row, 0, Qt::AlignLeft );
     120
    113121    if( session.isLocal( ) )
    114122    {
    115         const QFileIconProvider iconProvider;
    116         const QIcon folderIcon = iconProvider.icon( QFileIconProvider::Folder );
    117         const QPixmap folderPixmap = folderIcon.pixmap( iconSize );
    118 
    119         l = new QLabel( tr( "&Destination folder:" ) );
    120         layout->addWidget( l, ++row, 0, Qt::AlignLeft );
    121123        myDestination.setPath( prefs.getString( Prefs :: DOWNLOAD_DIR ) );
    122124        p = myDestinationButton = new QPushButton;
     
    127129        l->setBuddy( p );
    128130        connect( p, SIGNAL(clicked(bool)), this, SLOT(onDestinationClicked()));
     131    }
     132    else
     133    {
     134        QLineEdit * e = myDestinationEdit = new QLineEdit;
     135        e->setText( prefs.getString( Prefs :: DOWNLOAD_DIR ) );
     136        layout->addWidget( e, row, 1 );
     137        l->setBuddy( e );
    129138    }
    130139
     
    320329    tr_bencDictAddInt( &top, "tag", tag );
    321330    tr_benc * args( tr_bencDictAddDict( &top, "arguments", 10 ) );
     331    QString downloadDir;
    322332
    323333    // "download-dir"
    324334    if( myDestinationButton )
    325         tr_bencDictAddStr( args, "download-dir", myDestination.absolutePath().toUtf8().constData() );
     335        downloadDir = myDestination.absolutePath();
     336    else
     337        downloadDir = myDestinationEdit->text();
     338    tr_bencDictAddStr( args, "download-dir", downloadDir.toUtf8().constData() );
    326339
    327340    // "metainfo"
  • trunk/qt/options.h

    r11092 r13381  
    2828#include <QFile>
    2929#include <QTimer>
     30#include <QLineEdit>
    3031
    3132#include "add-data.h" // AddData
     
    8384        QPushButton * myFileButton;
    8485        QPushButton * myDestinationButton;
     86        QLineEdit * myDestinationEdit;
    8587        QPushButton * myVerifyButton;
    8688        QVector<int> myPriorities;
Note: See TracChangeset for help on using the changeset viewer.