add more spacing
[personal-kdebase.git] / workspace / kwin / clients / quartz / config / config.cpp
blobebc0f88f3460484363718e12706392795dd28cf1
1 /********************************************************************
3 This file contains the quartz configuration widget
5 Copyright (c) 2001
6 Karol Szwed <gallium@kde.org>
7 http://gallium.n3.net/
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************/
23 #include "config.h"
24 #include <kglobal.h>
25 #include <kconfiggroup.h>
26 #include <klocale.h>
27 #include <kvbox.h>
30 extern "C"
32 KDE_EXPORT QObject* allocate_config( KConfig* conf, QWidget* parent )
34 return(new QuartzConfig(conf, parent));
39 /* NOTE:
40 * 'conf' is a pointer to the kwindecoration modules open kwin config,
41 * and is by default set to the "Style" group.
43 * 'parent' is the parent of the QObject, which is a VBox inside the
44 * Configure tab in kwindecoration
47 QuartzConfig::QuartzConfig( KConfig* conf, QWidget* parent )
48 : QObject( parent )
50 quartzConfig = new KConfig("kwinquartzrc");
51 KConfigGroup cg(quartzConfig, "General");
52 KGlobal::locale()->insertCatalog("kwin_clients");
53 gb = new KVBox( parent );
54 cbColorBorder = new QCheckBox(
55 i18n("Draw window frames using &titlebar colors"), gb );
56 cbColorBorder->setWhatsThis(
57 i18n("When selected, the window decoration borders "
58 "are drawn using the titlebar colors; otherwise, they are "
59 "drawn using normal border colors instead.") );
60 cbExtraSmall = new QCheckBox( i18n("Quartz &extra slim"), gb );
61 cbExtraSmall->setWhatsThis(
62 i18n("Quartz window decorations with extra-small title bar.") );
63 // Load configuration options
64 load( cg );
66 // Ensure we track user changes properly
67 connect( cbColorBorder, SIGNAL(clicked()), this, SLOT(slotSelectionChanged()) );
68 connect( cbExtraSmall, SIGNAL(clicked()), this, SLOT(slotSelectionChanged()) );
70 // Make the widgets visible in kwindecoration
71 gb->show();
75 QuartzConfig::~QuartzConfig()
77 delete gb;
78 delete quartzConfig;
82 void QuartzConfig::slotSelectionChanged()
84 emit changed();
88 // Loads the configurable options from the kwinrc config file
89 // It is passed the open config from kwindecoration to improve efficiency
90 void QuartzConfig::load( const KConfigGroup& /*conf*/ )
92 KConfigGroup cg(quartzConfig, "General");
93 bool override = cg.readEntry( "UseTitleBarBorderColors", true);
94 cbColorBorder->setChecked( override );
95 override = cg.readEntry( "UseQuartzExtraSlim", false);
96 cbExtraSmall->setChecked( override );
100 // Saves the configurable options to the kwinrc config file
101 void QuartzConfig::save( KConfigGroup& /*conf*/ )
103 KConfigGroup cg(quartzConfig, "General");
104 cg.writeEntry( "UseTitleBarBorderColors", cbColorBorder->isChecked() );
105 cg.writeEntry( "UseQuartzExtraSlim", cbExtraSmall->isChecked() );
106 // Ensure others trying to read this config get updated
107 quartzConfig->sync();
111 // Sets UI widget defaults which must correspond to style defaults
112 void QuartzConfig::defaults()
114 cbColorBorder->setChecked( true );
115 cbExtraSmall->setChecked( false );
118 #include "config.moc"
119 // vim: ts=4