~ubuntu-branches/ubuntu/wily/kscreen/wily

« back to all changes in this revision

Viewing changes to kcm/src/qmloutput.h

  • Committer: Package Import Robot
  • Author(s): Scarlett Clark, Scarlett Clark, Jonathan Riddell, Harald Sitter
  • Date: 2014-08-20 08:35:15 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20140820083515-i9lk9nyt0adwd2q5
Tags: 2.0.0~git20141114-0ubuntu1
[ Scarlett Clark ]
* Update packaging for frameworks branch
* Git snapshot of the frameworks branch

[ Jonathan Riddell ]
* Remove kscreen-console.1 manpage which is out of date

[ Harald Sitter ]
* switch to new pkg-kde-tools

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
    Copyright (C) 2012  Dan Vratil <dvratil@redhat.com>
3
 
 
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.
8
 
 
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.
13
 
 
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
17
 
*/
18
 
 
19
 
 
20
 
#ifndef QMLOUTPUT_H
21
 
#define QMLOUTPUT_H
22
 
 
23
 
#include <QDeclarativeItem>
24
 
#include <kscreen/mode.h>
25
 
 
26
 
class QStandardItemModel;
27
 
class QAbstractItemModel;
28
 
 
29
 
namespace KScreen {
30
 
class Output;
31
 
}
32
 
 
33
 
class QMLOutput : public QDeclarativeItem
34
 
{
35
 
    Q_OBJECT
36
 
 
37
 
    Q_PROPERTY(KScreen::Output* output READ output WRITE setOutput NOTIFY outputChanged)
38
 
    Q_PROPERTY(QMLOutput* cloneOf READ cloneOf WRITE setCloneOf NOTIFY cloneOfChanged)
39
 
 
40
 
    Q_PROPERTY(int currentOutputHeight READ currentOutputHeight NOTIFY currentOutputSizeChanged)
41
 
    Q_PROPERTY(int currentOutputWidth READ currentOutputWidth NOTIFY currentOutputSizeChanged)
42
 
 
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)
47
 
 
48
 
    Q_PROPERTY(float displayScale READ displayScale CONSTANT)
49
 
public:
50
 
    enum {
51
 
      ModeRole = Qt::UserRole,
52
 
      ModeIdRole,
53
 
      SizeRole,
54
 
      RefreshRateRole
55
 
    };
56
 
 
57
 
    QMLOutput();
58
 
    virtual ~QMLOutput();
59
 
 
60
 
    void setOutput(KScreen::Output* output);
61
 
    KScreen::Output* output() const;
62
 
 
63
 
    void setCloneOf(QMLOutput *other);
64
 
    QMLOutput* cloneOf() const;
65
 
 
66
 
    int currentOutputHeight() const;
67
 
    int currentOutputWidth() const;
68
 
 
69
 
    int outputX() const;
70
 
    void setOutputX(int x);
71
 
 
72
 
    int outputY() const;
73
 
    void setOutputY(int y);
74
 
 
75
 
    /**
76
 
     * Returns scale in which the output is drawn on the screen.
77
 
     *
78
 
     * @return Currently we use 1/6th scale
79
 
     */
80
 
    float displayScale() const;
81
 
 
82
 
    Q_INVOKABLE QAbstractItemModel* modesModel();
83
 
 
84
 
Q_SIGNALS:
85
 
    void changed();
86
 
 
87
 
    /* Property notifications */
88
 
    void outputChanged();
89
 
    void cloneOfChanged();
90
 
    void currentOutputSizeChanged();
91
 
 
92
 
private:
93
 
    /**
94
 
     * Returns the biggest resolution available assuming it's the preferred one
95
 
     */
96
 
    KScreen::Mode* bestMode() const;
97
 
 
98
 
    KScreen::Output *m_output;
99
 
    QMLOutput *m_cloneOf;
100
 
 
101
 
    QStandardItemModel *m_modesModel;
102
 
};
103
 
 
104
 
#endif // QMLOUTPUT_H
105