From 093dca5acff7b2b046ac90bffab9f15bbe6c4714 Mon Sep 17 00:00:00 2001 From: kopla Date: Thu, 28 Jan 2010 10:03:44 +0000 Subject: [PATCH] Minor fixes git-svn-id: file:///svnroot/qtrapids/trunk@70 42ac0dd5-4c8c-4c71-bb3e-ecdfe252ffda --- src/client/MainWindow.cpp | 9 ++++++--- src/client/MainWindow.h | 2 +- src/client/PreferencesDialog.cpp | 7 ++++++- src/client/PreferencesDialog.h | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/client/MainWindow.cpp b/src/client/MainWindow.cpp index 36d3081..bf04650 100644 --- a/src/client/MainWindow.cpp +++ b/src/client/MainWindow.cpp @@ -131,7 +131,7 @@ MainWindow::MainWindow() : toolBar->addAction(tr("Open")); removeAction = toolBar->addAction(tr("Remove")); removeAction->setEnabled(false); - addToolBar(Qt::TopToolBarArea, toolBar); + addToolBar(Qt::BottomToolBarArea, toolBar); connect(this, SIGNAL(itemSelected(bool)), removeAction, SLOT(setEnabled(bool))); @@ -330,11 +330,14 @@ void MainWindow::StartTorrentFromBufferData(char const* data, int size) // =========================== PRIVATE SLOTS ================================= void MainWindow::on_openAction_clicked() { + QString filename = QFileDialog::getOpenFileName( this, tr("Open torrent file"), QString(), tr("Torrent files (*.torrent)") ); + on_torrentFileSelected(filename); + /* QFileDialog *dialog = new QFileDialog( this, "Open torrent file", QString(), tr("Torrent files (*.torrent)")); dialog->setFileMode(QFileDialog::ExistingFile); connect(dialog, SIGNAL(fileSelected(const QString&)), this, SLOT(on_torrentFileSelected(const QString&))); dialog->show(); - + */ } void MainWindow::on_removeAction_clicked() @@ -468,7 +471,7 @@ void MainWindow::handleToolBarAction(QAction* action) } -void MainWindow::on_torrentFileSelected(const QString& file) +void MainWindow::on_torrentFileSelected(QString file) { #ifdef QTRAPIDS_DEBUG qDebug() << " MainWindow::on_torrentFileSelected(): " << file; diff --git a/src/client/MainWindow.h b/src/client/MainWindow.h index d569caf..0eef21f 100644 --- a/src/client/MainWindow.h +++ b/src/client/MainWindow.h @@ -94,7 +94,7 @@ private slots: void on_downloadItemSelectionChanged(); void on_seedItemSelectionChanged(); void handleToolBarAction(QAction* action); - void on_torrentFileSelected(const QString& file); + void on_torrentFileSelected(QString file); void on_alert(qtrapids::TorrentState, qtrapids::ParamsMap_t); diff --git a/src/client/PreferencesDialog.cpp b/src/client/PreferencesDialog.cpp index f404336..0c0d327 100644 --- a/src/client/PreferencesDialog.cpp +++ b/src/client/PreferencesDialog.cpp @@ -104,6 +104,10 @@ PreferencesDialog::~PreferencesDialog() // ======================== SLOTS ======================== void PreferencesDialog::on_browseDirButtonClicked() { + QString dir = QFileDialog::getExistingDirectory(this, tr("Download directory"), QString(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + on_downloadDirectorySelected(dir); + + /* QFileDialog *dialog = new QFileDialog(this, "Download directory", QString(), tr("Torrent files (*.torrent)")); @@ -115,6 +119,7 @@ void PreferencesDialog::on_browseDirButtonClicked() this, SLOT(on_downloadDirectorySelected(const QString&))); dialog->show(); + */ } void PreferencesDialog::on_buttonClicked(QAbstractButton* button) @@ -138,7 +143,7 @@ void PreferencesDialog::on_buttonClicked(QAbstractButton* button) } } -void PreferencesDialog::on_downloadDirectorySelected(const QString& directory) +void PreferencesDialog::on_downloadDirectorySelected(QString directory) { qDebug() << "PreferencesDialog::on_downloadDirectorySelected(): " << directory; // Torrent filename empty, do nothing. diff --git a/src/client/PreferencesDialog.h b/src/client/PreferencesDialog.h index 653152f..c2aa812 100644 --- a/src/client/PreferencesDialog.h +++ b/src/client/PreferencesDialog.h @@ -48,7 +48,7 @@ public: private slots: void on_browseDirButtonClicked(); void on_buttonClicked(QAbstractButton* button); - void on_downloadDirectorySelected(const QString& directory); + void on_downloadDirectorySelected(QString directory); private: QLineEdit *dirLineEdit_; -- 1.7.9.5