2001-05-26 02:34:47 +00:00
|
|
|
/*
|
2001-06-04 09:51:23 +00:00
|
|
|
*
|
|
|
|
* This file contains the quartz configuration widget
|
|
|
|
*
|
|
|
|
* Copyright (c) 2001
|
|
|
|
* Karol Szwed <gallium@kde.org>
|
|
|
|
* http://gallium.n3.net/
|
|
|
|
*/
|
2001-05-26 02:34:47 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
2001-07-15 12:14:54 +00:00
|
|
|
#include <kglobal.h>
|
2001-05-26 02:34:47 +00:00
|
|
|
#include <qwhatsthis.h>
|
|
|
|
#include <klocale.h>
|
|
|
|
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
2005-01-08 22:25:07 +00:00
|
|
|
KDE_EXPORT QObject* allocate_config( KConfig* conf, QWidget* parent )
|
2001-05-26 02:34:47 +00:00
|
|
|
{
|
|
|
|
return(new QuartzConfig(conf, parent));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-04 09:51:23 +00:00
|
|
|
/* NOTE:
|
|
|
|
* 'conf' is a pointer to the kwindecoration modules open kwin config,
|
|
|
|
* and is by default set to the "Style" group.
|
|
|
|
*
|
|
|
|
* 'parent' is the parent of the QObject, which is a VBox inside the
|
|
|
|
* Configure tab in kwindecoration
|
|
|
|
*/
|
2001-05-26 02:34:47 +00:00
|
|
|
|
|
|
|
QuartzConfig::QuartzConfig( KConfig* conf, QWidget* parent )
|
|
|
|
: QObject( parent )
|
|
|
|
{
|
2001-06-04 09:51:23 +00:00
|
|
|
quartzConfig = new KConfig("kwinquartzrc");
|
2004-09-20 11:20:12 +00:00
|
|
|
KGlobal::locale()->insertCatalogue("kwin_clients");
|
2003-06-30 08:16:28 +00:00
|
|
|
gb = new QVBox( parent );
|
2001-06-04 09:51:23 +00:00
|
|
|
cbColorBorder = new QCheckBox(
|
|
|
|
i18n("Draw window frames using &titlebar colors"), gb );
|
|
|
|
QWhatsThis::add( cbColorBorder,
|
|
|
|
i18n("When selected, the window decoration borders "
|
2004-09-21 11:12:01 +00:00
|
|
|
"are drawn using the titlebar colors; otherwise, they are "
|
2001-06-04 09:51:23 +00:00
|
|
|
"drawn using normal border colors instead.") );
|
2001-05-26 02:34:47 +00:00
|
|
|
// Load configuration options
|
|
|
|
load( conf );
|
|
|
|
|
|
|
|
// Ensure we track user changes properly
|
|
|
|
connect( cbColorBorder, SIGNAL(clicked()), this, SLOT(slotSelectionChanged()) );
|
|
|
|
|
|
|
|
// Make the widgets visible in kwindecoration
|
|
|
|
gb->show();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QuartzConfig::~QuartzConfig()
|
|
|
|
{
|
|
|
|
delete gb;
|
2001-06-04 09:51:23 +00:00
|
|
|
delete quartzConfig;
|
2001-05-26 02:34:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QuartzConfig::slotSelectionChanged()
|
|
|
|
{
|
|
|
|
emit changed();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Loads the configurable options from the kwinrc config file
|
|
|
|
// It is passed the open config from kwindecoration to improve efficiency
|
2002-08-27 15:31:58 +00:00
|
|
|
void QuartzConfig::load( KConfig* /*conf*/ )
|
2001-05-26 02:34:47 +00:00
|
|
|
{
|
2001-06-04 09:51:23 +00:00
|
|
|
quartzConfig->setGroup("General");
|
|
|
|
bool override = quartzConfig->readBoolEntry( "UseTitleBarBorderColors", true );
|
2001-05-26 02:34:47 +00:00
|
|
|
cbColorBorder->setChecked( override );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Saves the configurable options to the kwinrc config file
|
2002-08-27 15:31:58 +00:00
|
|
|
void QuartzConfig::save( KConfig* /*conf*/ )
|
2001-05-26 02:34:47 +00:00
|
|
|
{
|
2001-06-04 09:51:23 +00:00
|
|
|
quartzConfig->setGroup("General");
|
|
|
|
quartzConfig->writeEntry( "UseTitleBarBorderColors", cbColorBorder->isChecked() );
|
|
|
|
// Ensure others trying to read this config get updated
|
|
|
|
quartzConfig->sync();
|
2001-05-26 02:34:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Sets UI widget defaults which must correspond to style defaults
|
|
|
|
void QuartzConfig::defaults()
|
|
|
|
{
|
|
|
|
cbColorBorder->setChecked( true );
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "config.moc"
|
|
|
|
// vim: ts=4
|