File: simpleoutput.cpp

package info (click to toggle)
kde-workspace 4:4.11.13-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 67,756 kB
  • ctags: 47,705
  • sloc: cpp: 358,638; ansic: 34,695; xml: 5,231; perl: 1,598; sh: 1,307; ruby: 1,135; python: 651; asm: 566; makefile: 37
file content (206 lines) | stat: -rw-r--r-- 4,897 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/*
 *   Copyright 2008 Aike J Sommer <dev@aikesommer.name>
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as
 *   published by the Free Software Foundation; either version 2,
 *   or (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details
 *
 *   You should have received a copy of the GNU Library General Public
 *   License along with this program; if not, write to the
 *   Free Software Foundation, Inc.,
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */


#include "simpleoutput.h"


namespace Kephal {

    SimpleOutput::SimpleOutput(QObject * parent, QString id, QSize size, QPoint position, bool connected, bool activated)
        : Output(parent),
        m_productId(-1),
        m_serialNumber(0),
        m_rotation(RotateNormal),
        m_reflectX(false),
        m_reflectY(false),
        m_rate(0)
    {
        m_id = id;
        m_size = size;
        m_position = position;
        m_connected = connected;
        m_activated = activated;
    }

    SimpleOutput::SimpleOutput(QObject * parent)
        : Output(parent),
        m_size(0, 0),
        m_position(0, 0),
        m_connected(false),
        m_activated(false)
        m_productId(-1),
        m_serialNumber(0),
        m_rotation(RotateNormal),
        m_reflectX(false),
        m_reflectY(false),
        m_rate(0)
    {
    }

    SimpleOutput::SimpleOutput(QObject * parent, Output * output)
        : Output(parent),
        m_productId(-1),
        m_serialNumber(0),
        m_rotation(RotateNormal),
        m_reflectX(false),
        m_reflectY(false),
        m_rate(0)
    {
        m_id = output->id();
        m_size = output->size();
        m_position = output->position();
        m_connected = output->isConnected();
        m_activated = output->isActivated();
    }


    QString SimpleOutput::id() const
    {
        return m_id;
    }

    QSize SimpleOutput::size() const {
        return m_size;
    }

    QList<QSize> SimpleOutput::availableSizes() const {
        if (m_availableSizes.empty()) {
            QList<QSize> result;
            result.append(size());
            return result;
        }
        return m_availableSizes;
    }

    QPoint SimpleOutput::position() const {
        return m_position;
    }

#if 0
    void SimpleOutput::_setId(const QString & id) {
        m_id = id;
    }

    void SimpleOutput::_setSize(const QSize & size) {
        m_size = size;
    }

    void SimpleOutput::_setAvailableSizes(const QList<QSize> & sizes) {
        m_availableSizes = sizes;
    }

    void SimpleOutput::_setPosition(const QPoint & position) {
        m_position = position;
    }

    void SimpleOutput::_setConnected(bool connected) {
        m_connected = connected;
    }

    void SimpleOutput::_setActivated(bool activated) {
        m_activated = activated;
    }

    bool SimpleOutput::isConnected() {
        return m_connected;
    }

    bool SimpleOutput::isActivated() {
        return m_connected && m_activated;
    }

    void SimpleOutput::_setVendor(const QString & vendor) {
        m_vendor = vendor;
    }

    QString SimpleOutput::vendor() {
        return m_vendor;
    }

    void SimpleOutput::_setProductId(int productId) {
        m_productId = productId;
    }

    int SimpleOutput::productId() {
        return m_productId;
    }

    void SimpleOutput::_setSerialNumber(unsigned int serialNumber) {
        m_serialNumber = serialNumber;
    }

    unsigned int SimpleOutput::serialNumber() {
        return m_serialNumber;
    }

    QSize SimpleOutput::preferredSize() {
        return m_preferredSize;
    }

    void SimpleOutput::_setPreferredSize(const QSize & size) {
        m_preferredSize = size;
    }

    void SimpleOutput::_setRotation(Rotation rotation) {
        m_rotation = rotation;
    }

    void SimpleOutput::_setReflectX(bool reflect) {
        m_reflectX = reflect;
    }

    void SimpleOutput::_setReflectY(bool reflect) {
        m_reflectY = reflect;
    }

    void SimpleOutput::_setRate(float rate) {
        m_rate = rate;
    }

    void SimpleOutput::_setAvailableRates(const QList<float> & rates) {
        m_rates = rates;
    }
#endif
    Rotation SimpleOutput::rotation() const
    {
        return m_rotation;
    }

    bool SimpleOutput::xReflected() const
    {
        return m_reflectX;
    }

    bool SimpleOutput::yReflected() const
    {
        return m_reflectY;
    }

    float SimpleOutput::rate() const
    {
        return m_rate;
    }

    QList<float> SimpleOutput::availableRates() const
    {
        return m_rates;
    }

}