Currently when we want to show/raise the window in reaction to the tray icon/notification being clicked etc we do this by emitting a signal on the controller. This is connected to in main.qml, which does some things, then calls back to controller to do more things. This is quite convoluted. Instead introduce a new class WindowController that is responsible for all things window, in particular showing/raising and config saving
27 lines
510 B
C++
27 lines
510 B
C++
// SPDX-FileCopyrightText: 2022 Nicolas Fella <nicolas.fella@gmx.de>
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QWindow>
|
|
|
|
class WindowController : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
static WindowController &instance();
|
|
|
|
void setWindow(QWindow *window);
|
|
|
|
void restoreGeometry();
|
|
void saveGeometry();
|
|
void showAndRaiseWindow(const QString &xdgActivationToken);
|
|
|
|
private:
|
|
WindowController() = default;
|
|
|
|
QWindow *m_window = nullptr;
|
|
};
|