mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-02 23:20:20 +00:00
0fa0eb2879
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>
31 lines
591 B
C++
31 lines
591 B
C++
#include "windowtitleupdate.h"
|
|
|
|
WindowTitleUpdate *WindowTitleUpdate::m_instance = NULL;
|
|
|
|
WindowTitleUpdate::WindowTitleUpdate(QObject *parent) : QObject(parent)
|
|
{
|
|
Q_ASSERT_X(m_Instance == NULL, "WindowTitleUpdate", "WindowTitleUpdate recreated!");
|
|
|
|
m_instance = this;
|
|
}
|
|
|
|
WindowTitleUpdate *WindowTitleUpdate::instance()
|
|
{
|
|
return m_instance;
|
|
}
|
|
|
|
WindowTitleUpdate::~WindowTitleUpdate()
|
|
{
|
|
m_instance = NULL;
|
|
}
|
|
|
|
void WindowTitleUpdate::emitSignal()
|
|
{
|
|
emit updateTitle();
|
|
}
|
|
|
|
extern "C" void updateWindowTitle()
|
|
{
|
|
WindowTitleUpdate *wt = WindowTitleUpdate::instance();
|
|
wt->emitSignal();
|
|
}
|