2001-05-26 02:34:47 +00:00
|
|
|
/*
|
2001-06-04 09:51:23 +00:00
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* 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"
|
|
|
|
{
|
|
|
|
QObject* allocate_config( KConfig* conf, QWidget* parent )
|
|
|
|
{
|
|
|
|
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");
|
2001-07-15 12:14:54 +00:00
|
|
|
KGlobal::locale()->insertCatalogue("libkwinquartz_config");
|
2001-06-04 09:51:23 +00:00
|
|
|
gb = new QGroupBox( 1, Qt::Horizontal,
|
2001-06-10 11:05:15 +00:00
|
|
|
i18n("Decoration Settings"), 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 "
|
|
|
|
"are drawn using the titlebar colors. Otherwise, they are "
|
|
|
|
"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 cbColorBorder;
|
|
|
|
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
|
|
|
|
void QuartzConfig::load( KConfig* conf )
|
|
|
|
{
|
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
|
|
|
|
void QuartzConfig::save( KConfig* conf )
|
|
|
|
{
|
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
|