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)));
// =========================== 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()
}
-void MainWindow::on_torrentFileSelected(const QString& file)
+void MainWindow::on_torrentFileSelected(QString file)
{
#ifdef QTRAPIDS_DEBUG
qDebug() << " MainWindow::on_torrentFileSelected(): " << file;
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);
// ======================== 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)"));
this, SLOT(on_downloadDirectorySelected(const QString&)));
dialog->show();
+ */
}
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.
private slots:
void on_browseDirButtonClicked();
void on_buttonClicked(QAbstractButton* button);
- void on_downloadDirectorySelected(const QString& directory);
+ void on_downloadDirectorySelected(QString directory);
private:
QLineEdit *dirLineEdit_;