mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
cleanup: fold ThemeInterface::setup() into constructor
There appears to be no reason for two-phase initialization. Let's keep things simple: let the constructor produce a functioning object. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
0e9bd27bae
commit
9d485f9626
3 changed files with 3 additions and 7 deletions
|
@ -50,11 +50,8 @@ ThemeInterface *ThemeInterface::instance()
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeInterface::setup(QQmlContext *ct)
|
ThemeInterface::ThemeInterface()
|
||||||
{
|
{
|
||||||
// Register interface class
|
|
||||||
ct->setContextProperty("subsurfaceTheme", this);
|
|
||||||
|
|
||||||
// get current theme
|
// get current theme
|
||||||
m_currentTheme = qPrefDisplay::theme();
|
m_currentTheme = qPrefDisplay::theme();
|
||||||
update_theme();
|
update_theme();
|
||||||
|
|
|
@ -36,7 +36,6 @@ class ThemeInterface : public QObject {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ThemeInterface *instance();
|
static ThemeInterface *instance();
|
||||||
void setup(QQmlContext *ct);
|
|
||||||
double currentScale();
|
double currentScale();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -66,7 +65,7 @@ signals:
|
||||||
void currentThemeChanged();
|
void currentThemeChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ThemeInterface() {}
|
ThemeInterface();
|
||||||
void update_theme();
|
void update_theme();
|
||||||
|
|
||||||
QColor m_backgroundColor;
|
QColor m_backgroundColor;
|
||||||
|
|
|
@ -199,7 +199,7 @@ void register_qml_types(QQmlEngine *engine)
|
||||||
|
|
||||||
// Register qml interface classes
|
// Register qml interface classes
|
||||||
QMLInterface::setup(ct);
|
QMLInterface::setup(ct);
|
||||||
ThemeInterface::instance()->setup(ct);
|
ct->setContextProperty("subsurfaceTheme", ThemeInterface::instance());
|
||||||
}
|
}
|
||||||
|
|
||||||
REGISTER_TYPE(QMLManager, "QMLManager");
|
REGISTER_TYPE(QMLManager, "QMLManager");
|
||||||
|
|
Loading…
Reference in a new issue