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

« back to all changes in this revision

Viewing changes to libs/kephal/service/xrandroutputs.h

  • 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
#ifndef KEPHAL_XRANDROUTPUTS_H
 
22
#define KEPHAL_XRANDROUTPUTS_H
 
23
 
 
24
#include "backendoutputs.h"
 
25
#include "xrandr12/randrdisplay.h"
 
26
 
 
27
 
 
28
namespace Kephal {
 
29
 
 
30
    class XRandROutputs;
 
31
 
 
32
    /**
 
33
     * Maps RandROutput class to Kephal::Output
 
34
     */
 
35
    class XRandROutput : public BackendOutput {
 
36
        Q_OBJECT
 
37
        public:
 
38
            XRandROutput(XRandROutputs * parent, RROutput rrId);
 
39
 
 
40
            QString id() const;
 
41
 
 
42
            QSize size() const;
 
43
            QSize preferredSize() const;
 
44
            QList<QSize> availableSizes() const;
 
45
            QPoint position() const;
 
46
            bool isConnected() const;
 
47
            bool isActivated() const;
 
48
            QString vendor() const;
 
49
            int productId() const;
 
50
            unsigned int serialNumber() const;
 
51
            Rotation rotation() const;
 
52
            bool reflectX() const;
 
53
            bool reflectY() const;
 
54
            float rate() const;
 
55
            QList<float> availableRates() const;
 
56
 
 
57
            bool applyGeom(const QRect & rect, float rate);
 
58
            bool applyOrientation(Rotation rotation, bool reflectX, bool reflectY);
 
59
 
 
60
            //void _revert();
 
61
            void deactivate();
 
62
            //void _activate();
 
63
            RROutput _id() const;
 
64
 
 
65
            void resize(const QSize & size);
 
66
 
 
67
            void rotate(Rotation rotation);
 
68
 
 
69
            void setReflectX(bool reflect);
 
70
 
 
71
            void setReflectY(bool reflect);
 
72
 
 
73
            void changeRate(double rate);
 
74
 
 
75
        public Q_SLOTS:
 
76
            void outputChanged(RROutput id, int changes);
 
77
 
 
78
        Q_SIGNALS:
 
79
            void outputConnected(Kephal::Output * o);
 
80
            void outputDisconnected(Kephal::Output * o);
 
81
            void outputActivated(Kephal::Output * o);
 
82
            void outputDeactivated(Kephal::Output * o);
 
83
            void outputResized(Kephal::Output * o, QSize oldSize, QSize newSize);
 
84
            void outputMoved(Kephal::Output * o, QPoint oldPosition, QPoint newPosition);
 
85
            void outputRateChanged(Kephal::Output * o, float oldRate, float newRate);
 
86
            void outputRotated(Kephal::Output * o, Kephal::Rotation oldRotation, Kephal::Rotation newRotation);
 
87
            void outputReflected(Kephal::Output * o, bool oldX, bool oldY, bool newX, bool newY);
 
88
 
 
89
        private:
 
90
            RandROutput * output() const;
 
91
            void parseEdid();
 
92
            void saveAsPrevious();
 
93
 
 
94
            XRandROutputs * m_outputs;
 
95
            RROutput m_rrId;
 
96
            QString m_vendor;
 
97
            int m_productId;
 
98
            unsigned int m_serialNumber;
 
99
            QRect m_previousGeom;
 
100
            bool m_previousConnected;
 
101
            bool m_previousActivated;
 
102
            Rotation m_previousRotation;
 
103
            float m_previousRate;
 
104
            bool m_previousReflectX;
 
105
            bool m_previousReflectY;
 
106
    };
 
107
 
 
108
 
 
109
    /**
 
110
     * Maps RandRDisplay to Kephal::Outputs
 
111
     */
 
112
    class XRandROutputs : public BackendOutputs {
 
113
        Q_OBJECT
 
114
        public:
 
115
            XRandROutputs(QObject * parent, RandRDisplay * display);
 
116
 
 
117
            QList<Output *> outputs();
 
118
 
 
119
            RandROutput * output(RROutput rrId);
 
120
            using Outputs::output;
 
121
            RandRDisplay * display();
 
122
 
 
123
        private:
 
124
            void init();
 
125
 
 
126
            RandRDisplay * m_display;
 
127
            QMap<QString, XRandROutput *> m_outputs;
 
128
    };
 
129
 
 
130
}
 
131
 
 
132
 
 
133
#endif // KEPHAL_XRANDROUTPUTS_H
 
134