X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fclient%2FMainWindow.cpp;h=36d3081c86c6c5b6fdf1eaabbef7c48aa8dccad9;hb=5e2c71d43ef7d91dbde62ee5a507e570d7619d1b;hp=b589dc36ada9e38c1c7f849fb2013213d13d5e4b;hpb=e27002978511dc6be46ebb3ea35851a17bf19e93;p=qtrapids diff --git a/src/client/MainWindow.cpp b/src/client/MainWindow.cpp index b589dc3..36d3081 100644 --- a/src/client/MainWindow.cpp +++ b/src/client/MainWindow.cpp @@ -58,6 +58,8 @@ MainWindow::MainWindow() : dlView_(NULL), seedView_(NULL), searchWidget_(NULL), + startDaemonAction_(NULL), + stopDaemonAction_(NULL), preferencesDialog_(NULL), settings_(QCoreApplication::organizationName() , QCoreApplication::applicationName()), @@ -77,9 +79,12 @@ MainWindow::MainWindow() : QAction *openAction = tempMenu->addAction(tr("&Open")); QAction *removeAction = tempMenu->addAction(tr("&Remove")); removeAction->setEnabled(false); - QAction *quitAction = tempMenu->addAction(tr("&Quit")); - QAction *stopDaemonAction = tempMenu->addAction(tr("Stop &daemon")); + startDaemonAction_ = tempMenu->addAction(tr("S&tart daemon")); + stopDaemonAction_ = tempMenu->addAction(tr("Sto&p daemon")); + startDaemonAction_->setEnabled(false); + + QAction *quitAction = tempMenu->addAction(tr("&Quit")); tempMenu = menuBar->addMenu(tr("&View")); QAction *columnsAction = tempMenu->addAction(tr("&Columns")); @@ -96,7 +101,8 @@ MainWindow::MainWindow() : connect(removeAction, SIGNAL(triggered()), this, SLOT(on_removeAction_clicked())); connect(this, SIGNAL(itemSelected(bool)), removeAction, SLOT(setEnabled(bool))); connect(quitAction, SIGNAL(triggered()), this, SLOT(on_quitAction_clicked())); - connect(stopDaemonAction, SIGNAL(triggered()), this, SLOT(on_stopDaemonAction_clicked())); + connect(startDaemonAction_, SIGNAL(triggered()), this, SLOT(on_startDaemonAction_clicked())); + connect(stopDaemonAction_, SIGNAL(triggered()), this, SLOT(on_stopDaemonAction_clicked())); connect(columnsAction, SIGNAL(triggered()), this, SLOT(on_columnsAction_clicked())); connect(preferencesAction, SIGNAL(triggered()), this, SLOT(on_preferencesAction_clicked())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(on_aboutAction_clicked())); @@ -135,7 +141,9 @@ MainWindow::MainWindow() : connect(&server_, SIGNAL(alert(qtrapids::TorrentState, qtrapids::ParamsMap_t)), this, SLOT(on_alert(qtrapids::TorrentState, qtrapids::ParamsMap_t))); - + + connect(&server_, SIGNAL(sessionTerminated()), this, SLOT(on_serverTerminated())); + // connect(&btSession_, SIGNAL(alert(std::auto_ptr)), // this, SLOT(on_alert(std::auto_ptr))); @@ -346,12 +354,28 @@ void MainWindow::on_quitAction_clicked() } +void MainWindow::on_startDaemonAction_clicked() +{ + server_.getState(); + /// @todo create signal that signals server startup and + /// enable controls in the handler slot + stopDaemonAction_->setEnabled(true); + startDaemonAction_->setEnabled(false); +} + + void MainWindow::on_stopDaemonAction_clicked() { server_.terminateSession(); } +void MainWindow::on_serverTerminated() +{ + stopDaemonAction_->setEnabled(false); + startDaemonAction_->setEnabled(true); +} + void MainWindow::on_columnsAction_clicked() { ColumnSelectorDialog *dialog = new ColumnSelectorDialog(dlView_);