Code cleanup: implement window title update via signal

This seems quite convoluted to me but I can't seem to make a more straight
forward implementation work. The idea is that core code should never
directly call into the UI.

So instead the core code (this is C code) calls a helper function. That
helper function calls a member function of a class which in return emits a
signal. The UI code connects to that signal and acts accordingly when it
is received.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-06-16 06:04:34 -07:00
parent c593dea119
commit 0fa0eb2879
6 changed files with 63 additions and 6 deletions

View file

@ -14,6 +14,7 @@
#include "ui_mainwindow.h"
#include "notificationwidget.h"
#include "windowtitleupdate.h"
struct DiveList;
class QSortFilterProxyModel;
@ -171,6 +172,7 @@ slots:
void on_actionConfigure_Dive_Computer_triggered();
void enableDiveSiteEdit(uint32_t id);
void setDefaultState();
void setAutomaticTitle();
protected:
void closeEvent(QCloseEvent *);
@ -228,6 +230,7 @@ private:
};
QHash<QByteArray, WidgetForQuadrant> applicationState;
QByteArray currentApplicationState;
WindowTitleUpdate *wtu;
};
#endif // MAINWINDOW_H