Skip to content

Commit

Permalink
[feat] global: add tray alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
bgallois committed Oct 11, 2021
1 parent e04ba4d commit eb09e0c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ void Batch::startTracking() {
ui->startButton->setDisabled(false);
ui->removePath->setDisabled(false);
ui->clearPath->setDisabled(false);
emit(status("Tracking finished"));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/batch.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ class Batch : public QWidget {
* @brief Emitted when a tracking analysis is finished.
*/
void next();

void log(QMap<QString, QString> log);
void status(QString messsage);
};

#endif // BATCH_H
4 changes: 3 additions & 1 deletion src/interactive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,8 @@ void Interactive::track() {
replayAction->setChecked(true);
logMap->insert("status", errorMessage);
emit(log(*logMap));
message(errorMessage);
emit(status("Tracking failed"));
emit(message(errorMessage));
});
connect(tracking, &Tracking::finished, thread, &QThread::quit);
connect(tracking, &Tracking::finished, this, [this, logMap]() {
Expand All @@ -924,6 +925,7 @@ void Interactive::track() {
replayAction->setChecked(true);
logMap->insert("status", "Done");
emit(log(*logMap));
emit(status("Tracking succeeded"));
});
connect(tracking, &Tracking::forceFinished, thread, &QThread::quit);
connect(tracking, &Tracking::forceFinished, tracking, &Tracking::deleteLater);
Expand Down
1 change: 1 addition & 0 deletions src/interactive.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,6 @@ class Interactive : public QMainWindow {
signals:
void message(QString message);
void log(QMap<QString, QString> log);
void status(QString messsage);
};
#endif // INTERACTIVE_H
6 changes: 6 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,15 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),

interactive = new Interactive(this);
ui->tabWidget->addTab(interactive, tr("Interactive tracking"));
connect(interactive, &Interactive::status, [this](QString message) {
trayIcon->showMessage("FastTrack", message, QSystemTrayIcon::Information, 3000);
});

batch = new Batch(this);
ui->tabWidget->addTab(batch, tr("Batch tracking"));
connect(batch, &Batch::status, [this](QString message) {
trayIcon->showMessage("FastTrack", message, QSystemTrayIcon::Information, 3000);
});

replay = new Replay(this);
ui->tabWidget->addTab(replay, tr("Tracking inspector"));
Expand Down

0 comments on commit eb09e0c

Please sign in to comment.