kwin Library API Documentation

config.cpp

00001 /*
00002  * $Id: config.cpp,v 1.2 2002/09/01 22:50:34 fredrik Exp $
00003  * 
00004  * Keramik KWin client configuration module
00005  *
00006  * Copyright (C) 2002 Fredrik Höglund <fredrik@kde.org>
00007  *
00008  * Based on the Quartz configuration module,
00009  *     Copyright (c) 2001 Karol Szwed <gallium@kde.org>
00010  * 
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the license, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; see the file COPYING.  If not, write to
00023  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00024  * Boston, MA 02111-1307, USA.
00025  */
00026  
00027 #include <kglobal.h>
00028 #include <klocale.h>
00029 
00030 #include <qcheckbox.h>
00031 
00032 #include "config.h"
00033 #include "config.moc"
00034 
00035 extern "C"
00036 {
00037     QObject* allocate_config( KConfig* conf, QWidget* parent )
00038     {
00039         return ( new KeramikConfig( conf, parent ) );
00040     }
00041 }
00042 
00043 
00044 /* NOTE: 
00045  * 'conf'   is a pointer to the kwindecoration modules open kwin config,
00046  *          and is by default set to the "Style" group.
00047  *
00048  * 'parent' is the parent of the QObject, which is a VBox inside the
00049  *          Configure tab in kwindecoration
00050  */
00051 
00052 KeramikConfig::KeramikConfig( KConfig* conf, QWidget* parent )
00053     : QObject( parent )
00054 {
00055     KGlobal::locale()->insertCatalogue("kwin_keramik_config");
00056     c = new KConfig( "kwinkeramikrc" );
00057     
00058     ui = new KeramikConfigUI( parent );
00059     connect( ui->showAppIcons,    SIGNAL(clicked()), SIGNAL(changed()) );
00060     connect( ui->smallCaptions,   SIGNAL(clicked()), SIGNAL(changed()) );
00061     connect( ui->largeGrabBars,   SIGNAL(clicked()), SIGNAL(changed()) );
00062     connect( ui->useShadowedText, SIGNAL(clicked()), SIGNAL(changed()) );
00063 
00064     load( conf );
00065     ui->show();
00066 }
00067 
00068 
00069 KeramikConfig::~KeramikConfig()
00070 {
00071     delete ui;
00072     delete c;
00073 }
00074 
00075 
00076 // Loads the configurable options from the kwinrc config file
00077 // It is passed the open config from kwindecoration to improve efficiency
00078 void KeramikConfig::load( KConfig* )
00079 {
00080     c->setGroup("General");
00081     ui->showAppIcons->setChecked( c->readBoolEntry("ShowAppIcons", true) );
00082     ui->smallCaptions->setChecked( c->readBoolEntry("SmallCaptionBubbles", false) );
00083     ui->largeGrabBars->setChecked( c->readBoolEntry("LargeGrabBars", true) );
00084     ui->useShadowedText->setChecked( c->readBoolEntry("UseShadowedText", true) );
00085 }
00086 
00087 
00088 // Saves the configurable options to the kwinrc config file
00089 void KeramikConfig::save( KConfig* )
00090 {
00091     c->setGroup( "General" );
00092     c->writeEntry( "ShowAppIcons", ui->showAppIcons->isChecked() );
00093     c->writeEntry( "SmallCaptionBubbles", ui->smallCaptions->isChecked() );
00094     c->writeEntry( "LargeGrabBars", ui->largeGrabBars->isChecked() );
00095     c->writeEntry( "UseShadowedText", ui->useShadowedText->isChecked() );
00096     c->sync();
00097 }
00098 
00099 
00100 // Sets UI widget defaults which must correspond to style defaults
00101 void KeramikConfig::defaults()
00102 {
00103     ui->showAppIcons->setChecked( true );
00104     ui->smallCaptions->setChecked( false );
00105     ui->largeGrabBars->setChecked( true );
00106     ui->useShadowedText->setChecked( true );
00107     
00108     emit changed();
00109 }
00110 
00111 // vim: set noet ts=4 sw=4:
KDE Logo
This file is part of the documentation for kwin Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 29 21:20:49 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003