subsurface/subsurface-core/windowtitleupdate.cpp
Dirk Hohndel 878c05afed Don't crash if we have no WindowTitleUpdater registered
Subsurface-mobile doesn't have a window title with the name of our file
name at this point, so simply don't try to trigger the update.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-11-07 09:53:17 -08:00

32 lines
601 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();
if (wt)
wt->emitSignal();
}