(trunk qt) #4235 "allow transmission-qt to specify download dir for remote sessions" -- patch added from taem
This commit is contained in:
parent
1d1017534b
commit
b72c58e34f
|
@ -29,6 +29,7 @@
|
|||
#include <QSet>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/bencode.h>
|
||||
|
@ -110,14 +111,15 @@ Options :: Options( Session& session, const Prefs& prefs, const AddData& addme,
|
|||
l->setBuddy( p );
|
||||
connect( p, SIGNAL(clicked(bool)), this, SLOT(onFilenameClicked()));
|
||||
|
||||
const QFileIconProvider iconProvider;
|
||||
const QIcon folderIcon = iconProvider.icon( QFileIconProvider::Folder );
|
||||
const QPixmap folderPixmap = folderIcon.pixmap( iconSize );
|
||||
|
||||
l = new QLabel( tr( "&Destination folder:" ) );
|
||||
layout->addWidget( l, ++row, 0, Qt::AlignLeft );
|
||||
|
||||
if( session.isLocal( ) )
|
||||
{
|
||||
const QFileIconProvider iconProvider;
|
||||
const QIcon folderIcon = iconProvider.icon( QFileIconProvider::Folder );
|
||||
const QPixmap folderPixmap = folderIcon.pixmap( iconSize );
|
||||
|
||||
l = new QLabel( tr( "&Destination folder:" ) );
|
||||
layout->addWidget( l, ++row, 0, Qt::AlignLeft );
|
||||
myDestination.setPath( prefs.getString( Prefs :: DOWNLOAD_DIR ) );
|
||||
p = myDestinationButton = new QPushButton;
|
||||
p->setIcon( folderPixmap );
|
||||
|
@ -127,6 +129,13 @@ Options :: Options( Session& session, const Prefs& prefs, const AddData& addme,
|
|||
l->setBuddy( p );
|
||||
connect( p, SIGNAL(clicked(bool)), this, SLOT(onDestinationClicked()));
|
||||
}
|
||||
else
|
||||
{
|
||||
QLineEdit * e = myDestinationEdit = new QLineEdit;
|
||||
e->setText( prefs.getString( Prefs :: DOWNLOAD_DIR ) );
|
||||
layout->addWidget( e, row, 1 );
|
||||
l->setBuddy( e );
|
||||
}
|
||||
|
||||
myTree = new FileTreeView;
|
||||
layout->addWidget( myTree, ++row, 0, 1, 2 );
|
||||
|
@ -319,10 +328,14 @@ Options :: onAccepted( )
|
|||
tr_bencDictAddStr( &top, "method", "torrent-add" );
|
||||
tr_bencDictAddInt( &top, "tag", tag );
|
||||
tr_benc * args( tr_bencDictAddDict( &top, "arguments", 10 ) );
|
||||
QString downloadDir;
|
||||
|
||||
// "download-dir"
|
||||
if( myDestinationButton )
|
||||
tr_bencDictAddStr( args, "download-dir", myDestination.absolutePath().toUtf8().constData() );
|
||||
downloadDir = myDestination.absolutePath();
|
||||
else
|
||||
downloadDir = myDestinationEdit->text();
|
||||
tr_bencDictAddStr( args, "download-dir", downloadDir.toUtf8().constData() );
|
||||
|
||||
// "metainfo"
|
||||
switch( myAdd.type )
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <QCryptographicHash>
|
||||
#include <QFile>
|
||||
#include <QTimer>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include "add-data.h" // AddData
|
||||
#include "file-tree.h" // FileList
|
||||
|
@ -82,6 +83,7 @@ class Options: public QDialog
|
|||
QComboBox * myPriorityCombo;
|
||||
QPushButton * myFileButton;
|
||||
QPushButton * myDestinationButton;
|
||||
QLineEdit * myDestinationEdit;
|
||||
QPushButton * myVerifyButton;
|
||||
QVector<int> myPriorities;
|
||||
QVector<bool> myWanted;
|
||||
|
|
Loading…
Reference in New Issue