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>
|
2005-07-28 14:59:42 +00:00
|
|
|
|
2001-05-26 02:34:47 +00:00
|
|
|
#include <klocale.h>
|
2005-09-18 14:52:14 +00:00
|
|
|
#include <kvbox.h>
|
2001-05-26 02:34:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
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");
|
2005-10-03 15:13:54 +00:00
|
|
|
KGlobal::locale()->insertCatalog("kwin_clients");
|
2005-09-18 14:52:14 +00:00
|
|
|
gb = new KVBox( parent );
|
2001-06-04 09:51:23 +00:00
|
|
|
cbColorBorder = new QCheckBox(
|
|
|
|
i18n("Draw window frames using &titlebar colors"), gb );
|
2005-07-28 14:59:42 +00:00
|
|
|
cbColorBorder->setWhatsThis(
|
2001-06-04 09:51:23 +00:00
|
|
|
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.") );
|
2005-01-14 17:56:02 +00:00
|
|
|
cbExtraSmall = new QCheckBox( i18n("Quartz &extra slim"), gb );
|
2005-07-28 14:59:42 +00:00
|
|
|
cbExtraSmall->setWhatsThis(
|
2005-01-17 12:54:08 +00:00
|
|
|
i18n("Quartz window decorations with extra-small title bar.") );
|
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()) );
|
2006-04-10 11:57:13 +00:00
|
|
|
connect( cbExtraSmall, SIGNAL(clicked()), this, SLOT(slotSelectionChanged()) );
|
2001-05-26 02:34:47 +00:00
|
|
|
|
|
|
|
// 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");
|
2006-01-03 14:01:15 +00:00
|
|
|
bool override = quartzConfig->readEntry( "UseTitleBarBorderColors", QVariant(true )).toBool();
|
2001-05-26 02:34:47 +00:00
|
|
|
cbColorBorder->setChecked( override );
|
2006-01-03 14:01:15 +00:00
|
|
|
override = quartzConfig->readEntry( "UseQuartzExtraSlim", QVariant(false )).toBool();
|
2005-01-14 17:56:02 +00:00
|
|
|
cbExtraSmall->setChecked( override );
|
2001-05-26 02:34:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 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() );
|
2005-01-14 17:56:02 +00:00
|
|
|
quartzConfig->writeEntry( "UseQuartzExtraSlim", cbExtraSmall->isChecked() );
|
2001-06-04 09:51:23 +00:00
|
|
|
// 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 );
|
2005-01-14 17:56:02 +00:00
|
|
|
cbExtraSmall->setChecked( false );
|
2001-05-26 02:34:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#include "config.moc"
|
|
|
|
// vim: ts=4
|