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 #include "krandrmodule.h"
21 #include "legacyrandrconfig.h"
22 #include <QTextStream>
23 #include "legacyrandrscreen.h"
24 #include "randrdisplay.h"
25 #include "randrconfig.h"
27 #include <KPluginFactory>
28 #include <KPluginLoader>
30 #include <config-randr.h>
34 // DLL Interface for kcontrol
35 K_PLUGIN_FACTORY(KSSFactory
, registerPlugin
<KRandRModule
>();)
36 K_EXPORT_PLUGIN(KSSFactory("krandr"))
38 KRandRModule::KRandRModule(QWidget
*parent
, const QVariantList
&)
39 : KCModule(KSSFactory::componentData(), parent
)
41 m_display
= new RandRDisplay();
42 if (!m_display
->isValid())
44 QVBoxLayout
*topLayout
= new QVBoxLayout(this);
46 new QLabel(i18n("Your X server does not support resizing and "
47 "rotating the display. Please update to version 4.3 "
48 "or greater. You need the X Resize, Rotate, and Reflect "
49 "extension (RANDR) version 1.1 or greater to use this "
52 label
->setWordWrap(true);
53 topLayout
->addWidget(label
);
54 kWarning() << "Error: " << m_display
->errorCode() ;
58 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
59 topLayout
->setMargin(0);
60 topLayout
->setSpacing(KDialog::spacingHint());
65 m_config
= new RandRConfig(this, m_display
);
66 connect(m_config
, SIGNAL(changed(bool)), SIGNAL(changed(bool)));
67 topLayout
->addWidget(m_config
);
72 m_legacyConfig
= new LegacyRandRConfig(this, m_display
);
73 connect(m_legacyConfig
, SIGNAL(changed(bool)), SIGNAL(changed(bool)));
74 topLayout
->addWidget(m_legacyConfig
);
77 //topLayout->addStretch(1);
79 setButtons(KCModule::Apply
);
82 KRandRModule::~KRandRModule(void)
87 void KRandRModule::defaults()
94 m_legacyConfig
->defaults();
97 void KRandRModule::load()
99 kDebug() << "Loading KRandRModule...";
106 m_legacyConfig
->load();
111 void KRandRModule::save()
118 m_legacyConfig
->save();
122 void KRandRModule::apply()
129 m_legacyConfig
->apply();
133 #include "krandrmodule.moc"