2
* Copyright (c) 2007 Gustavo Pichorim Boiko <gustavo.boiko@kdemail.net>
3
* Copyright (c) 2002,2003 Hamish Rodda <rodda@kde.org>
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.
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.
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.
20
#ifndef __LEGACYRANDRSCREEN_H__
21
#define __LEGACYRANDRSCREEN_H__
33
class LegacyRandRScreen : public QObject
37
LegacyRandRScreen(int screenIndex);
46
* @returns false if the user did not confirm in time, or canceled, or the change failed
48
bool applyProposedAndConfirm();
50
Window rootWindow() const;
53
QString changedMessage() const;
55
bool changedFromOriginal() const;
56
void proposeOriginal();
58
bool proposedChanged() const;
60
QString currentRotationDescription() const;
62
int rotationIndexToDegree(int rotation) const;
63
int rotationDegreeToIndex(int degree) const;
66
* Refresh rate functions.
68
RateList refreshRates(int size) const;
70
QString refreshRateDirectDescription(int rate) const;
71
QString refreshRateIndirectDescription(int size, int index) const;
72
QString refreshRateDescription(int size, int index) const;
74
int refreshRate() const;
75
QString currentRefreshRateDescription() const;
77
// Refresh rate hz <==> index conversion
78
int refreshRateHzToIndex(int size, int hz) const;
79
int refreshRateIndexToHz(int size, int index) const;
82
* Screen size functions.
85
const QSize& pixelSize(int index) const;
86
const QSize& mmSize(int index) const;
87
int pixelCount(int index) const;
89
SizeList pixelSizes() const;
92
* Retrieve the index of a screen size with a specified pixel size.
94
* @param pixelSize dimensions of the screen in pixels
95
* @returns the index of the requested screen size
97
int sizeIndex(const QSize &pixelSize) const;
99
int rotations() const;
102
* Current setting functions.
104
const QSize& currentPixelSize() const;
106
int rotation() const;
110
* Proposed setting functions.
112
int proposedSize() const;
113
bool proposeSize(int newSize);
115
int proposedRotation() const;
116
void proposeRotation(int newRotation);
118
int proposedRefreshRate() const;
120
* Propose a refresh rate.
121
* Please note that you must propose the target size first for this to work.
123
* @param index the index of the refresh rate (not a refresh rate in hz!)
124
* @returns true if successful, false otherwise.
126
bool proposeRefreshRate(int index);
129
* Configuration functions.
131
void load(KConfig& config);
132
void save(KConfig& config) const;
133
QStringList startupCommands() const;
136
XRRScreenConfiguration* m_config;
140
SizeList m_pixelSizes;
144
int m_originalRotation;
146
int m_originalRefreshRate;
148
int m_currentRotation;
150
int m_currentRefreshRate;
152
int m_proposedRotation;
154
int m_proposedRefreshRate;
156
KTimerDialog* m_shownDialog;