not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / libs / kephal / configurations / backendconfigurations.h
blobfa70e67b543523b310c68fa53ecfd647021ecd27
1 /*
2 * Copyright 2008 Aike J Sommer <dev@aikesommer.name>
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.
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
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.
21 #ifndef KEPHAL_BACKENDCONFIGURATIONS_H
22 #define KEPHAL_BACKENDCONFIGURATIONS_H
25 #include <QMap>
26 #include <QPoint>
27 #include <QRect>
29 #include "kephal/configurations.h"
32 namespace Kephal {
34 class BackendConfiguration : public Configuration {
35 Q_OBJECT
36 public:
37 BackendConfiguration(QObject * parent);
39 /**
40 * Returns the real layout, with screen-sizes
41 * taken from the actual Outputs.
43 * @param simpleLayout The layout as returned
44 * from layout().
45 * @param outputScreens A mapping of Outputs
46 * to Screens.
47 * @param outputSizes The sizes to use for the
48 * Outputs instead of the current ones.
50 QMap<int, QRect> realLayout(const QMap<int, QPoint> & simpleLayout, const QMap<Output *, int> & outputScreens, const QMap<Output *, QSize> & outputSizes);
52 /**
53 * Returns the real layout, with screen-sizes
54 * taken from the actual Outputs.
56 * @param simpleLayout The layout as returned
57 * from layout().
58 * @param outputScreens A mapping of Outputs
59 * to Screens.
61 QMap<int, QRect> realLayout(const QMap<int, QPoint> & simpleLayout, const QMap<Output *, int> & outputScreens);
63 /**
64 * Returns the real layout, with screen-sizes
65 * taken from the actual Outputs.
66 * This will calculate the layout by calling
67 * layout().
69 * @param outputScreens A mapping of Outputs
70 * to Screens.
72 QMap<int, QRect> realLayout(const QMap<Output *, int> & outputScreens);
74 /**
75 * Returns the real layout, with screen-sizes
76 * taken from the actual Outputs.
77 * This will calculate the layout by calling
78 * layout() and use the Output to Screen
79 * mapping as currently active if possible.
81 QMap<int, QRect> realLayout();
83 /**
84 * Returns a set of points covered in the
85 * layout returned by layout().
87 QSet<QPoint> positions();
89 /**
90 * Returns the positions as in positions
91 * to which the Screen can be cloned.
93 QSet<QPoint> clonePositions(int screen);
95 /**
96 * Returns the layout if the Screen screen
97 * was to be cloned to any of the other
98 * Screens.
100 QMap<int, QPoint> cloneLayout(int screen);
103 * Returns the possible positions as in
104 * positions() to move the Screen screen
105 * to.
107 QSet<QPoint> possiblePositions(int screen);
109 private:
110 void simpleToReal(QMap<int, QPoint> & simpleLayout, const QMap<int, QSize> & screenSizes, int index, QMap<int, QRect> & screens);
111 QList<QSet<QPoint> > partition(int screen);
112 QSet<QPoint> border(QSet<QPoint> screens);
117 class BackendConfigurations : public Configurations {
118 Q_OBJECT
119 public:
120 static BackendConfigurations * self();
122 BackendConfigurations(QObject * parent);
123 virtual ~BackendConfigurations();
126 * Find the Configuration for the currently
127 * connected Outputs.
129 virtual Configuration * findConfiguration() = 0;
132 * Apply Output-specific settings such as size,
133 * refresh-rate and rotation.
135 virtual void applyOutputSettings() = 0;
137 virtual BackendConfiguration * activeBackendConfiguration();
139 private:
140 static BackendConfigurations * m_instance;
146 #endif // KEPHAL_BACKENDCONFIGURATIONS_H