not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kwin / clients / keramik / config / config.cpp
blob9641a52a7e87c11670eeaf5ab687d1b160771ad8
1 /*
2 *
3 * Keramik KWin client configuration module
5 * Copyright (C) 2002 Fredrik Höglund <fredrik@kde.org>
7 * Based on the Quartz configuration module,
8 * Copyright (c) 2001 Karol Szwed <gallium@kde.org>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the license, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; see the file COPYING. If not, write to
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA.
26 #include "config.h"
28 #include <kglobal.h>
29 #include <klocale.h>
31 #include <QCheckBox>
33 #include "config.moc"
35 extern "C"
37 KDE_EXPORT QObject* allocate_config( KConfig* conf, QWidget* parent )
39 return ( new KeramikConfig( conf, parent ) );
44 /* NOTE:
45 * 'conf' is a pointer to the kwindecoration modules open kwin config,
46 * and is by default set to the "Style" group.
48 * 'parent' is the parent of the QObject, which is a VBox inside the
49 * Configure tab in kwindecoration
52 KeramikConfig::KeramikConfig( KConfig* conf, QWidget* parent )
53 : QObject( parent )
55 KGlobal::locale()->insertCatalog("kwin_clients");
56 c = new KConfig( "kwinkeramikrc" );
57 KConfigGroup cg(c, "General");
58 ui = new KeramikConfigUI( parent );
59 connect( ui->showAppIcons, SIGNAL(clicked()), SIGNAL(changed()) );
60 connect( ui->smallCaptions, SIGNAL(clicked()), SIGNAL(changed()) );
61 connect( ui->largeGrabBars, SIGNAL(clicked()), SIGNAL(changed()) );
62 connect( ui->useShadowedText, SIGNAL(clicked()), SIGNAL(changed()) );
64 load( cg );
65 ui->show();
69 KeramikConfig::~KeramikConfig()
71 delete ui;
72 delete c;
76 // Loads the configurable options from the kwinrc config file
77 // It is passed the open config from kwindecoration to improve efficiency
78 void KeramikConfig::load( const KConfigGroup& )
80 KConfigGroup cg(c, "General");
81 ui->showAppIcons->setChecked( cg.readEntry("ShowAppIcons", true) );
82 ui->smallCaptions->setChecked( cg.readEntry("SmallCaptionBubbles", false) );
83 ui->largeGrabBars->setChecked( cg.readEntry("LargeGrabBars", true) );
84 ui->useShadowedText->setChecked( cg.readEntry("UseShadowedText", true) );
88 // Saves the configurable options to the kwinrc config file
89 void KeramikConfig::save( KConfigGroup& )
91 KConfigGroup cg(c, "General");
92 cg.writeEntry( "ShowAppIcons", ui->showAppIcons->isChecked() );
93 cg.writeEntry( "SmallCaptionBubbles", ui->smallCaptions->isChecked() );
94 cg.writeEntry( "LargeGrabBars", ui->largeGrabBars->isChecked() );
95 cg.writeEntry( "UseShadowedText", ui->useShadowedText->isChecked() );
96 c->sync();
100 // Sets UI widget defaults which must correspond to style defaults
101 void KeramikConfig::defaults()
103 ui->showAppIcons->setChecked( true );
104 ui->smallCaptions->setChecked( false );
105 ui->largeGrabBars->setChecked( true );
106 ui->useShadowedText->setChecked( true );
108 emit changed();
111 // vim: set noet ts=4 sw=4: