~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to libs/kephal/kephal/simpleoutput.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *   Copyright 2008 Aike J Sommer <dev@aikesommer.name>
 
3
 *
 
4
 *   This program is free software; you can redistribute it and/or modify
 
5
 *   it under the terms of the GNU General Public License as
 
6
 *   published by the Free Software Foundation; either version 2,
 
7
 *   or (at your option) any later version.
 
8
 *
 
9
 *   This program 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
 
12
 *   GNU General Public License for more details
 
13
 *
 
14
 *   You should have received a copy of the GNU Library General Public
 
15
 *   License along with this program; if not, write to the
 
16
 *   Free Software Foundation, Inc.,
 
17
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
18
 */
 
19
 
 
20
 
 
21
#include "simpleoutput.h"
 
22
 
 
23
 
 
24
namespace Kephal {
 
25
 
 
26
    SimpleOutput::SimpleOutput(QObject * parent, QString id, QSize size, QPoint position, bool connected, bool activated)
 
27
        : Output(parent)
 
28
    {
 
29
        m_id = id;
 
30
        m_size = size;
 
31
        m_position = position;
 
32
        m_connected = connected;
 
33
        m_activated = activated;
 
34
    }
 
35
 
 
36
    SimpleOutput::SimpleOutput(QObject * parent)
 
37
        : Output(parent),
 
38
        m_size(0, 0),
 
39
        m_position(0, 0),
 
40
        m_connected(false),
 
41
        m_activated(false)
 
42
    {
 
43
    }
 
44
 
 
45
    SimpleOutput::SimpleOutput(QObject * parent, Output * output)
 
46
        : Output(parent)
 
47
    {
 
48
        m_id = output->id();
 
49
        m_size = output->size();
 
50
        m_position = output->position();
 
51
        m_connected = output->isConnected();
 
52
        m_activated = output->isActivated();
 
53
    }
 
54
 
 
55
 
 
56
    QString SimpleOutput::id() const
 
57
    {
 
58
        return m_id;
 
59
    }
 
60
 
 
61
    QSize SimpleOutput::size() const {
 
62
        return m_size;
 
63
    }
 
64
 
 
65
    QList<QSize> SimpleOutput::availableSizes() const {
 
66
        if (m_availableSizes.empty()) {
 
67
            QList<QSize> result;
 
68
            result.append(size());
 
69
            return result;
 
70
        }
 
71
        return m_availableSizes;
 
72
    }
 
73
 
 
74
    QPoint SimpleOutput::position() const {
 
75
        return m_position;
 
76
    }
 
77
 
 
78
#if 0
 
79
    void SimpleOutput::_setId(const QString & id) {
 
80
        m_id = id;
 
81
    }
 
82
 
 
83
    void SimpleOutput::_setSize(const QSize & size) {
 
84
        m_size = size;
 
85
    }
 
86
 
 
87
    void SimpleOutput::_setAvailableSizes(const QList<QSize> & sizes) {
 
88
        m_availableSizes = sizes;
 
89
    }
 
90
 
 
91
    void SimpleOutput::_setPosition(const QPoint & position) {
 
92
        m_position = position;
 
93
    }
 
94
 
 
95
    void SimpleOutput::_setConnected(bool connected) {
 
96
        m_connected = connected;
 
97
    }
 
98
 
 
99
    void SimpleOutput::_setActivated(bool activated) {
 
100
        m_activated = activated;
 
101
    }
 
102
 
 
103
    bool SimpleOutput::isConnected() {
 
104
        return m_connected;
 
105
    }
 
106
 
 
107
    bool SimpleOutput::isActivated() {
 
108
        return m_connected && m_activated;
 
109
    }
 
110
 
 
111
    void SimpleOutput::_setVendor(const QString & vendor) {
 
112
        m_vendor = vendor;
 
113
    }
 
114
 
 
115
    QString SimpleOutput::vendor() {
 
116
        return m_vendor;
 
117
    }
 
118
 
 
119
    void SimpleOutput::_setProductId(int productId) {
 
120
        m_productId = productId;
 
121
    }
 
122
 
 
123
    int SimpleOutput::productId() {
 
124
        return m_productId;
 
125
    }
 
126
 
 
127
    void SimpleOutput::_setSerialNumber(unsigned int serialNumber) {
 
128
        m_serialNumber = serialNumber;
 
129
    }
 
130
 
 
131
    unsigned int SimpleOutput::serialNumber() {
 
132
        return m_serialNumber;
 
133
    }
 
134
 
 
135
    QSize SimpleOutput::preferredSize() {
 
136
        return m_preferredSize;
 
137
    }
 
138
 
 
139
    void SimpleOutput::_setPreferredSize(const QSize & size) {
 
140
        m_preferredSize = size;
 
141
    }
 
142
 
 
143
    void SimpleOutput::_setRotation(Rotation rotation) {
 
144
        m_rotation = rotation;
 
145
    }
 
146
 
 
147
    void SimpleOutput::_setReflectX(bool reflect) {
 
148
        m_reflectX = reflect;
 
149
    }
 
150
 
 
151
    void SimpleOutput::_setReflectY(bool reflect) {
 
152
        m_reflectY = reflect;
 
153
    }
 
154
 
 
155
    void SimpleOutput::_setRate(float rate) {
 
156
        m_rate = rate;
 
157
    }
 
158
 
 
159
    void SimpleOutput::_setAvailableRates(const QList<float> & rates) {
 
160
        m_rates = rates;
 
161
    }
 
162
#endif
 
163
    Rotation SimpleOutput::rotation() const
 
164
    {
 
165
        return m_rotation;
 
166
    }
 
167
 
 
168
    bool SimpleOutput::xReflected() const
 
169
    {
 
170
        return m_reflectX;
 
171
    }
 
172
 
 
173
    bool SimpleOutput::yReflected() const
 
174
    {
 
175
        return m_reflectY;
 
176
    }
 
177
 
 
178
    float SimpleOutput::rate() const
 
179
    {
 
180
        return m_rate;
 
181
    }
 
182
 
 
183
    QList<float> SimpleOutput::availableRates() const
 
184
    {
 
185
        return m_rates;
 
186
    }
 
187
 
 
188
}