add more spacing
[personal-kdebase.git] / workspace / libs / kephal / screens / configuration / configurationscreens.cpp
blob2a1f5ee44474acdb704c78f762bdc3963c1bebe9
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 #include "configurationscreens.h"
23 #include "kephal/configurations.h"
24 #include "configurations/backendconfigurations.h"
26 #include "QDebug"
28 namespace Kephal {
30 ConfigurationScreens::ConfigurationScreens(QObject * parent)
31 : OutputScreens(parent)
33 connect(Configurations::self(), SIGNAL(configurationActivated(Kephal::Configuration *)), this, SLOT(configurationActivated(Kephal::Configuration *)));
36 void ConfigurationScreens::configurationActivated(Configuration * configuration) {
37 Q_UNUSED(configuration)
38 qDebug() << "ConfigurationScreens::configurationActivated";
39 triggerRebuildScreens();
42 void ConfigurationScreens::prepareScreens(QMap<int, OutputScreen *> & screens) {
43 BackendConfiguration * config = BackendConfigurations::self()->activeBackendConfiguration();
44 if (! config) {
45 return;
48 if (config->name() == "external") {
49 screens.clear();
50 return;
53 QMap<int, QRect> layout = config->realLayout();
54 for (QMap<int, QRect>::const_iterator i = layout.constBegin(); i != layout.constEnd(); ++i) {
55 if (screens.contains(i.key())) {
56 screens[i.key()]->_setGeom(i.value());
57 } else {
58 OutputScreen * screen = new OutputScreen(this);
59 screen->_setId(i.key());
60 screen->_setGeom(i.value());
61 screens.insert(screen->id(), screen);
65 for (QMap<int, OutputScreen *>::iterator i = screens.begin(); i != screens.end();) {
66 if (! layout.contains(i.key())) {
67 i = screens.erase(i);
68 } else {
69 ++i;