KWin
Loading...
Searching...
No Matches
tilemanager.h
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2022 Marco Martin <mart@kde.org>
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9
10#pragma once
11
12#include "customtile.h"
13#include "quicktile.h"
14#include "scripting/tilemodel.h"
15#include "tile.h"
16#include "utils/common.h"
17#include <kwin_export.h>
18
19#include <QAbstractItemModel>
20#include <QObject>
21#include <QRectF>
22
23#include <QJsonValue>
24
25class QTimer;
26
27namespace KWin
28{
29
30class Output;
31class Tile;
32class TileModel;
33
37class KWIN_EXPORT TileManager : public QObject
38{
39 Q_OBJECT
40 Q_PROPERTY(KWin::Tile *rootTile READ rootTile CONSTANT)
41 Q_PROPERTY(TileModel *model READ model CONSTANT)
42
43public:
44 explicit TileManager(Output *parent = nullptr);
45 ~TileManager() override;
46
47 Output *output() const;
48
49 KWin::Tile *bestTileForPosition(const QPointF &pos);
50 Q_INVOKABLE KWin::Tile *bestTileForPosition(qreal x, qreal y); // For scripting
51 CustomTile *rootTile() const;
52 KWin::Tile *quickTile(QuickTileMode mode) const;
53
54 TileModel *model() const;
55
56Q_SIGNALS:
57 void tileRemoved(KWin::Tile *tile);
58
60 void readSettings();
61 void saveSettings();
62 QJsonObject tileToJSon(CustomTile *parentTile);
63 CustomTile *parseTilingJSon(const QJsonValue &val, const QRectF &availableArea, CustomTile *parentTile);
64
65 Q_DISABLE_COPY(TileManager)
66
67 Output *m_output = nullptr;
68 std::unique_ptr<QTimer> m_saveTimer;
69 std::unique_ptr<CustomTile> m_rootTile = nullptr;
70 std::unique_ptr<QuickRootTile> m_quickRootTile = nullptr;
71 std::unique_ptr<TileModel> m_tileModel = nullptr;
72 friend class CustomTile;
73};
74
75KWIN_EXPORT QDebug operator<<(QDebug debug, const TileManager *tileManager);
76
77} // namespace KWin
#define private
#define explicit