@@ -1,162 +0,0 @@
2− * Copyright (C) 2015 Canonical, Ltd.
4− * This program is free software: you can redistribute it and/or modify it under
5− * the terms of the GNU Lesser General Public License version 3, as published by
6− * the Free Software Foundation.
8− * This program is distributed in the hope that it will be useful, but WITHOUT
9− * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10− * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11− * Lesser General Public License for more details.
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/>.
20−#include <QAbstractListModel>
22−#include <QQmlListProperty>
26−class Screens : public QAbstractListModel
30− Q_PROPERTY(int count READ count NOTIFY countChanged)
34− ScreenRole = Qt::UserRole + 1,
72− explicit Screens(QObject *parent = 0);
73− virtual ~Screens() noexcept;
75− /* QAbstractItemModel */
76− QHash<int, QByteArray> roleNames() const override;
77− QVariant data(const QModelIndex &index, int role = ScreenRole) const override;
78− int rowCount(const QModelIndex &parent = QModelIndex()) const override;
83− void activateScreen(int index);
87− void screenAdded(QScreen *screen);
88− void screenRemoved(QScreen *screen);
91− QList<Screen *> m_screenList;
94−class ScreenMode : public QObject
97− Q_PROPERTY(qreal refreshRate MEMBER refreshRate CONSTANT)
98− Q_PROPERTY(QSize size MEMBER size CONSTANT)
101− ScreenMode(qreal refreshRate, QSize size):refreshRate(refreshRate),size(size) {}
102− ScreenMode(const ScreenMode& other)
104− refreshRate{other.refreshRate},size{other.size}
111−class Screen : public QObject
115− Q_PROPERTY(bool active MEMBER m_active NOTIFY activeChanged)
117− Q_PROPERTY(bool used MEMBER m_used NOTIFY usedChanged)
118− Q_PROPERTY(QString name MEMBER m_name NOTIFY nameChanged)
119− Q_PROPERTY(Screens::OutputTypes outputType MEMBER m_outputType NOTIFY outputTypeChanged)
120− Q_PROPERTY(float scale MEMBER m_scale NOTIFY scaleChanged)
121− Q_PROPERTY(Screens::FormFactor formFactor MEMBER m_formFactor NOTIFY formFactorChanged)
122− Q_PROPERTY(QPoint position MEMBER m_position NOTIFY positionChanged)
123− Q_PROPERTY(uint currentModeIndex MEMBER m_currentModeIndex NOTIFY currentModeIndexChanged)
124− Q_PROPERTY(QQmlListProperty<ScreenMode> availableModes READ availableModes NOTIFY availableModesChanged)
125− Q_PROPERTY(QSizeF physicalSize MEMBER m_physicalSize NOTIFY physicalSizeChanged)
127− Screen(QObject* parent = 0);
130− QQmlListProperty<ScreenMode> availableModes();
132− Q_INVOKABLE Screen* beginConfiguration();
133− Q_INVOKABLE void applyConfiguration();
136− void activeChanged();
139− void outputTypeChanged();
140− void scaleChanged();
141− void formFactorChanged();
142− void positionChanged();
143− void currentModeIndexChanged();
144− void availableModesChanged();
145− void physicalSizeChanged();
148− bool m_active{false};
151− Screens::OutputTypes m_outputType{Screens::Unknown};
153− Screens::FormFactor m_formFactor{Screens::FormFactorMonitor};
155− uint m_currentModeIndex{0};
156− QList<ScreenMode*> m_sizes;
157− QSizeF m_physicalSize;
160−Q_DECLARE_METATYPE(ScreenMode)