From 41e4e5968abded153edb40afd136b3321b760646 Mon Sep 17 00:00:00 2001 From: APTX Date: Thu, 14 Jun 2012 19:37:15 +0200 Subject: [PATCH] Show some basic task info in management-gui --- management-gui/mainwindow.cpp | 16 ++++++++++++++++ management-gui/mainwindow.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/management-gui/mainwindow.cpp b/management-gui/mainwindow.cpp index 8057509..7aefa91 100644 --- a/management-gui/mainwindow.cpp +++ b/management-gui/mainwindow.cpp @@ -21,6 +21,11 @@ MainWindow::MainWindow(QWidget *parent) : ui(new Ui::MainWindow) { ui->setupUi(this); + taskCountLabel = new QLabel(this); + ui->statusBar->addPermanentWidget(taskCountLabel); + connect(MyList::instance(), SIGNAL(taskCountChanged()), this, SLOT(taskCountChanged())); + taskCountChanged(); + QString startLabel = MyList::instance()->database()->isConnected() ? "Connected" : "Disconnected"; databaseConnectionStatusIndicator = new QLabel(startLabel, this); ui->statusBar->addPermanentWidget(databaseConnectionStatusIndicator); @@ -28,6 +33,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(MyList::instance()->database(), SIGNAL(connected()), this, SLOT(dbConnected())); connect(MyList::instance()->database(), SIGNAL(disconnected()), this, SLOT(dbDisconnected())); connect(MyList::instance()->database(), SIGNAL(newPendingRequest()), this, SLOT(handleNotification())); + connect(MyList::instance(), SIGNAL(allTasksFinished()), this, SLOT(allTasksFinished())); MyList::instance()->loadLocalSettings(); MyList::instance()->saveLocalSettings(); @@ -75,6 +81,16 @@ void MainWindow::handleNotification() ui->statusBar->showMessage("New Pending Request added!"); } +void MainWindow::taskCountChanged() +{ + taskCountLabel->setText(tr("Running tasks: %1").arg(MyList::instance()->runningTaskCount())); +} + +void MainWindow::allTasksFinished() +{ + ui->statusBar->showMessage(tr("All tasks finished.")); +} + void MainWindow::on_actionScanDirectory_triggered() { QString dir = QFileDialog::getExistingDirectory(this, tr("Scan Directory")); diff --git a/management-gui/mainwindow.h b/management-gui/mainwindow.h index ec2f439..34d3c74 100644 --- a/management-gui/mainwindow.h +++ b/management-gui/mainwindow.h @@ -29,6 +29,9 @@ private slots: void handleNotification(); + void taskCountChanged(); + void allTasksFinished(); + void on_actionDisconnect_triggered(); void on_actionScanDirectory_triggered(); void on_actionImportMyList_triggered(); @@ -52,6 +55,7 @@ private: Ui::MainWindow *ui; QLabel *databaseConnectionStatusIndicator; + QLabel *taskCountLabel; LocalMyList::MyListModel *animeModel; }; -- 2.52.0