2
Copyright (C) 2012 Dan Vratil <dvratil@redhat.com>
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Lesser General Public
6
License as published by the Free Software Foundation; either
7
version 2.1 of the License, or (at your option) any later version.
9
This library is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
Lesser General Public License for more details.
14
You should have received a copy of the GNU Lesser General Public
15
License along with this library; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
#include <QDeclarativeItem>
24
#include <kscreen/mode.h>
26
class QStandardItemModel;
27
class QAbstractItemModel;
33
class QMLOutput : public QDeclarativeItem
37
Q_PROPERTY(KScreen::Output* output READ output WRITE setOutput NOTIFY outputChanged)
38
Q_PROPERTY(QMLOutput* cloneOf READ cloneOf WRITE setCloneOf NOTIFY cloneOfChanged)
40
Q_PROPERTY(int currentOutputHeight READ currentOutputHeight NOTIFY currentOutputSizeChanged)
41
Q_PROPERTY(int currentOutputWidth READ currentOutputWidth NOTIFY currentOutputSizeChanged)
43
/* Workaround for possible QML bug when calling output.pos.y = VALUE works,
44
* but output.pos.x = VALUE has no effect */
45
Q_PROPERTY(int outputX READ outputX WRITE setOutputX)
46
Q_PROPERTY(int outputY READ outputY WRITE setOutputY)
48
Q_PROPERTY(float displayScale READ displayScale CONSTANT)
51
ModeRole = Qt::UserRole,
60
void setOutput(KScreen::Output* output);
61
KScreen::Output* output() const;
63
void setCloneOf(QMLOutput *other);
64
QMLOutput* cloneOf() const;
66
int currentOutputHeight() const;
67
int currentOutputWidth() const;
70
void setOutputX(int x);
73
void setOutputY(int y);
76
* Returns scale in which the output is drawn on the screen.
78
* @return Currently we use 1/6th scale
80
float displayScale() const;
82
Q_INVOKABLE QAbstractItemModel* modesModel();
87
/* Property notifications */
89
void cloneOfChanged();
90
void currentOutputSizeChanged();
94
* Returns the biggest resolution available assuming it's the preferred one
96
KScreen::Mode* bestMode() const;
98
KScreen::Output *m_output;
101
QStandardItemModel *m_modesModel;
104
#endif // QMLOUTPUT_H