Skip to content

Commit

Permalink
feat: add dock settings instance
Browse files Browse the repository at this point in the history
Change-Id: I8d09c2d0e986de1493ad9dc43a2eeaffe3014746
  • Loading branch information
haruyukilxz committed Jul 30, 2018
1 parent 0e0663f commit 4dcb1d9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions frame/util/docksettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion frame/util/docksettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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<QRect> &otherScreens) const;
void calculateWindowConfig();
void gtkIconThemeChanged();
Expand Down
2 changes: 1 addition & 1 deletion frame/window/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 4dcb1d9

Please sign in to comment.