diff --git a/frame/util/docksettings.cpp b/frame/util/docksettings.cpp index 288fb19a1..ab9166c69 100644 --- a/frame/util/docksettings.cpp +++ b/frame/util/docksettings.cpp @@ -152,6 +152,12 @@ DockSettings::DockSettings(QWidget *parent) resetFrontendGeometry(); } +DockSettings &DockSettings::Instance() +{ + static DockSettings settings; + return settings; +} + const QSize DockSettings::panelSize() const { switch (m_position) diff --git a/frame/util/docksettings.h b/frame/util/docksettings.h index c5d8e9edc..9f310561f 100644 --- a/frame/util/docksettings.h +++ b/frame/util/docksettings.h @@ -57,7 +57,7 @@ class DockSettings : public QObject Q_OBJECT public: - explicit DockSettings(QWidget *parent = 0); + static DockSettings& Instance(); inline DisplayMode displayMode() const { return m_displayMode; } inline HideMode hideMode() const { return m_hideMode; } @@ -106,6 +106,10 @@ private slots: void updateForbidPostions(); private: + DockSettings(QWidget *parent = 0); + DockSettings(DockSettings const &) = delete; + DockSettings operator =(DockSettings const &) = delete; + bool test(const Position pos, const QList &otherScreens) const; void calculateWindowConfig(); void gtkIconThemeChanged(); diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index f9482bcc2..ccb1780bd 100644 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -103,7 +103,7 @@ MainWindow::MainWindow(QWidget *parent) m_platformWindowHandle.setShadowOffset(QPoint(0, 0)); m_platformWindowHandle.setShadowRadius(0); - m_settings = new DockSettings(this); + m_settings = &DockSettings::Instance(); m_xcbMisc->set_window_type(winId(), XcbMisc::Dock); initComponents();