2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Use Window::Controller to manage MainWindow.

This commit is contained in:
John Preston
2019-06-06 14:20:21 +03:00
parent a547f80ae9
commit dd68c7e90d
18 changed files with 229 additions and 61 deletions

View File

@@ -18,7 +18,7 @@ class MainWindow : public Window::MainWindow {
Q_OBJECT
public:
MainWindow();
explicit MainWindow(not_null<Window::Controller*> controller);
void psFirstShow();
void psInitSysMenu();
@@ -37,7 +37,7 @@ public:
~MainWindow();
class Private;
void updateWindowIcon() override;
public slots:
void psShowTrayMenu();
@@ -56,7 +56,6 @@ protected:
void handleActiveChangedHook() override;
void stateChangedHook(Qt::WindowState state) override;
void initHook() override;
void updateWindowIcon() override;
void titleVisibilityChangedHook() override;
void unreadCounterChangedHook() override;
@@ -83,13 +82,15 @@ protected:
void closeWithoutDestroy() override;
private:
class Private;
friend class Private;
void initTouchBar();
void hideAndDeactivate();
void createGlobalMenu();
void updateTitleCounter();
void updateIconCounters();
friend class Private;
std::unique_ptr<Private> _private;
mutable bool psIdle;

View File

@@ -381,8 +381,9 @@ MainWindow::Private::~Private() {
[_observer release];
}
MainWindow::MainWindow()
: _private(std::make_unique<Private>(this)) {
MainWindow::MainWindow(not_null<Window::Controller*> controller)
: Window::MainWindow(controller)
, _private(std::make_unique<Private>(this)) {
#ifndef OS_MAC_OLD
auto forceOpenGL = std::make_unique<QOpenGLWidget>(this);
#endif // !OS_MAC_OLD