Lomiri
Loading...
Searching...
No Matches
displaycutoutsmodel.h
1/*
2 * Copyright (C) 2026 UBports Foundation.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#pragma once
18
19#include <QObject>
20#include <QAbstractListModel>
21#include <QRect>
22
23class DisplayCutoutsModel: public QAbstractListModel
24{
25 Q_OBJECT
26 Q_PROPERTY(bool expanded WRITE setExpanded)
27 Q_PROPERTY(Qt::ScreenOrientation orientation WRITE setOrientation)
28 Q_PROPERTY(bool enabled WRITE setEnabled)
29 Q_PROPERTY(bool lightMode WRITE setLightMode)
30
31public:
32 DisplayCutoutsModel(QObject *parent = nullptr);
33 ~DisplayCutoutsModel() = default;
34
35 void setExpanded(bool value);
36 void setOrientation(Qt::ScreenOrientation value);
37 void setEnabled(bool value);
38 void setLightMode(bool lightMode);
39
40 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
41 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
42
43public Q_SLOTS:
44 void reloadConfig();
45
46private:
47 bool m_expanded{false};
48 bool m_enabled{true};
49 bool m_lightMode{false};
50 QList<QRect> m_expandedCutouts;
51 QList<QRect> m_collapsedCutouts;
52 QList<QRect> m_collapsedLightCutouts;
53 Qt::ScreenOrientation m_orientation;
54
55 void loadConfig();
56};