#include "DownloadView.h"
#include "SeedView.h"
+#include "PreferencesDialog.h"
#include "MainWindow.h"
tabWidget_(NULL),
dlView_(NULL),
seedView_(NULL),
+ preferencesDialog_(NULL),
+ settings_(),
btSession_()
{
// MENUBAR
QAction *openAction = tempMenu->addAction(tr("&Open"));
QAction *quitAction = tempMenu->addAction(tr("&Quit"));
+ tempMenu = menuBar->addMenu(tr("&Settings"));
+ QAction *preferencesAction = tempMenu->addAction(tr("&Preferences"));
+
tempMenu = menuBar->addMenu(tr("&Help"));
QAction *aboutAction = tempMenu->addAction(tr("&About"));
QAction *aboutQtAction = tempMenu->addAction(tr("About &Qt"));
setMenuBar(menuBar);
connect(openAction, SIGNAL(triggered()), this, SLOT(on_openAction_clicked()));
connect(quitAction, SIGNAL(triggered()), this, SLOT(on_quitAction_clicked()));
+ connect(preferencesAction, SIGNAL(triggered()), this, SLOT(on_preferencesAction_clicked()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(on_aboutAction_clicked()));
connect(aboutQtAction, SIGNAL(triggered()), this, SLOT(on_aboutQtAction_clicked()));
-
// TABWIDGET (central widget)
tabWidget_ = new QTabWidget();
close();
}
+void MainWindow::on_preferencesAction_clicked()
+{
+ if (!preferencesDialog_) {
+ preferencesDialog_ = new PreferencesDialog(this);
+ }
+ preferencesDialog_->show();
+ preferencesDialog_->raise();
+ preferencesDialog_->activateWindow();
+}
void MainWindow::on_aboutAction_clicked()
{
}
// Otherwise add torrent
- /*
// For params, see: http://www.rasterbar.com/products/libtorrent/manual.html#add-torrent
AddTorrentParams addParams;
- addParams.ti = torrent_info(boost::filesystem::path const& filename);
- addParams.save_path = "/home/vaatala/Downloads"; // The only mandatory parameter, rest are optional.
+ boost::intrusive_ptr<libtorrent::torrent_info> tiTmp =
+ new libtorrent::torrent_info(boost::filesystem::path(file.toStdString()));
+ addParams.ti = tiTmp;
+ addParams.save_path = boost::filesystem::path(settings_.value("download/directory").toString().toStdString()); // The only mandatory parameter, rest are optional.
//addParams.storage_mode = libtorrent::storage_mode_allocate;
- btSession_.addTorrent();
- */
+ btSession_.addTorrent(addParams);
}