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

« back to all changes in this revision

Viewing changes to kcontrol/randr/legacyrandrscreen.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 (c) 2007      Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
 
3
 * Copyright (c) 2002,2003 Hamish Rodda <rodda@kde.org>
 
4
 *
 
5
 *  This program is free software; you can redistribute it and/or modify
 
6
 *  it under the terms of the GNU General Public License as published by
 
7
 *  the Free Software Foundation; either version 2 of the License, or
 
8
 *  (at your option) any later version.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
18
 */
 
19
 
 
20
#ifndef __LEGACYRANDRSCREEN_H__
 
21
#define __LEGACYRANDRSCREEN_H__
 
22
 
 
23
#include <QObject>
 
24
//Added by qt3to4:
 
25
#include <QPixmap>
 
26
 
 
27
#include <kcmodule.h>
 
28
#include <kconfig.h>
 
29
#include "randr.h"
 
30
 
 
31
class KTimerDialog;
 
32
 
 
33
class LegacyRandRScreen : public QObject
 
34
{
 
35
        Q_OBJECT
 
36
public:
 
37
        LegacyRandRScreen(int screenIndex);
 
38
        ~LegacyRandRScreen();
 
39
 
 
40
        void loadSettings();
 
41
        void setOriginal();
 
42
 
 
43
        bool applyProposed();
 
44
 
 
45
        /**
 
46
         * @returns false if the user did not confirm in time, or canceled, or the change failed
 
47
         */
 
48
        bool applyProposedAndConfirm();
 
49
 
 
50
        Window rootWindow() const;
 
51
 
 
52
public:
 
53
        QString changedMessage() const;
 
54
 
 
55
        bool changedFromOriginal() const;
 
56
        void proposeOriginal();
 
57
 
 
58
        bool proposedChanged() const;
 
59
 
 
60
        QString currentRotationDescription() const;
 
61
 
 
62
        int rotationIndexToDegree(int rotation) const;
 
63
        int rotationDegreeToIndex(int degree) const;
 
64
 
 
65
        /**
 
66
         * Refresh rate functions.
 
67
         */
 
68
        RateList refreshRates(int size) const;
 
69
 
 
70
        QString refreshRateDirectDescription(int rate) const;
 
71
        QString refreshRateIndirectDescription(int size, int index) const;
 
72
        QString refreshRateDescription(int size, int index) const;
 
73
 
 
74
        int refreshRate() const;
 
75
        QString currentRefreshRateDescription() const;
 
76
 
 
77
        // Refresh rate hz <==> index conversion
 
78
        int refreshRateHzToIndex(int size, int hz) const;
 
79
        int refreshRateIndexToHz(int size, int index) const;
 
80
 
 
81
        /**
 
82
         * Screen size functions.
 
83
         */
 
84
        int numSizes() const;
 
85
        const QSize& pixelSize(int index) const;
 
86
        const QSize& mmSize(int index) const;
 
87
        int pixelCount(int index) const;
 
88
 
 
89
        SizeList pixelSizes() const;
 
90
 
 
91
        /**
 
92
         * Retrieve the index of a screen size with a specified pixel size.
 
93
         *
 
94
         * @param pixelSize dimensions of the screen in pixels
 
95
         * @returns the index of the requested screen size
 
96
         */
 
97
        int sizeIndex(const QSize &pixelSize) const;
 
98
 
 
99
        int rotations() const;
 
100
 
 
101
        /**
 
102
         * Current setting functions.
 
103
         */
 
104
        const QSize& currentPixelSize() const;
 
105
 
 
106
        int rotation() const;
 
107
        int size() const;
 
108
 
 
109
        /**
 
110
         * Proposed setting functions.
 
111
         */
 
112
        int proposedSize() const;
 
113
        bool proposeSize(int newSize);
 
114
 
 
115
        int proposedRotation() const;
 
116
        void proposeRotation(int newRotation);
 
117
 
 
118
        int proposedRefreshRate() const;
 
119
        /**
 
120
         * Propose a refresh rate.
 
121
         * Please note that you must propose the target size first for this to work.
 
122
         *
 
123
         * @param index the index of the refresh rate (not a refresh rate in hz!)
 
124
         * @returns true if successful, false otherwise.
 
125
         */
 
126
        bool proposeRefreshRate(int index);
 
127
 
 
128
        /**
 
129
         * Configuration functions.
 
130
         */
 
131
        void load(KConfig& config);
 
132
        void save(KConfig& config) const;
 
133
        QStringList startupCommands() const;
 
134
 
 
135
private:
 
136
        XRRScreenConfiguration* m_config;
 
137
 
 
138
        int m_screen;
 
139
 
 
140
        SizeList m_pixelSizes;
 
141
        SizeList m_mmSizes;
 
142
        int m_rotations;
 
143
 
 
144
        int m_originalRotation;
 
145
        int m_originalSize;
 
146
        int m_originalRefreshRate;
 
147
 
 
148
        int m_currentRotation;
 
149
        int m_currentSize;
 
150
        int m_currentRefreshRate;
 
151
 
 
152
        int m_proposedRotation;
 
153
        int m_proposedSize;
 
154
        int m_proposedRefreshRate;
 
155
 
 
156
        KTimerDialog* m_shownDialog;
 
157
 
 
158
};
 
159
 
 
160
#endif