1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
/***************************************************************************
* Copyright (C) 2003 by Sandro Giessl *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include <tdeconfig.h>
#include <tdelocale.h>
#include <tdeglobal.h>
#include <tqcheckbox.h>
#include <tqslider.h>
#include <tqspinbox.h>
#include <tqcombobox.h>
#include <tqwhatsthis.h>
#include "malloryconfig.h"
#include "configdialog.h"
MalloryConfig::MalloryConfig(TDEConfig* config, TQWidget* parent)
: TQObject(parent), m_config(0), m_dialog(0)
{
// Create the configuration object.
m_config = new TDEConfig("twinmalloryrc");
TDEGlobal::locale()->insertCatalogue("twin_mallory_config");
// Create and show the configuration dialog.
m_dialog = new ConfigDialog(parent);
m_dialog->show();
// Load the configuration.
load(config);
// Setup the connections.
connect(m_dialog->m_borderSize, TQ_SIGNAL(valueChanged(int)), this, TQ_SIGNAL(changed()));
connect(m_dialog->m_titleSize, TQ_SIGNAL(valueChanged(int)), this, TQ_SIGNAL(changed()));
connect(m_dialog->m_buttonSize, TQ_SIGNAL(valueChanged(int)), this, TQ_SIGNAL(changed()));
connect(m_dialog->m_lessRounded, TQ_SIGNAL(toggled(bool)), this, TQ_SIGNAL(changed()));
connect(m_dialog->m_buttonStyle, TQ_SIGNAL(activated(int)), this, TQ_SIGNAL(changed()));
connect(m_dialog->m_resizeHandle, TQ_SIGNAL(toggled(bool)), this, TQ_SIGNAL(changed()));
connect(m_dialog->m_superSize, TQ_SIGNAL(toggled(bool)), this, TQ_SIGNAL(changed()));
connect(m_dialog->m_titleShadow, TQ_SIGNAL(toggled(bool)), this, TQ_SIGNAL(changed()));
connect(m_dialog->m_titleShadowSize, TQ_SIGNAL(valueChanged(int)), this, TQ_SIGNAL(changed()));
}
MalloryConfig::~MalloryConfig()
{
if (m_dialog) delete m_dialog;
if (m_config) delete m_config;
}
void MalloryConfig::load(TDEConfig*)
{
m_config->setGroup("General");
int borderSize = m_config->readNumEntry("BorderSize", 5);
m_dialog->m_borderSize->setValue(borderSize);
int buttonSize = m_config->readNumEntry("ButtonSize", 18);
m_dialog->m_buttonSize->setValue(buttonSize);
int titleSize = m_config->readNumEntry("TitleSize", 22);
m_dialog->m_titleSize->setValue(titleSize);
bool lessRounded = m_config->readBoolEntry("LessRounded", false);
m_dialog->m_lessRounded->setChecked(lessRounded);
int buttonStyle = m_config->readNumEntry("ButtonStyle", 0);
m_dialog->m_buttonStyle->setCurrentItem(buttonStyle);
bool resizeHandle = m_config->readBoolEntry("ResizeHandle", true);
m_dialog->m_resizeHandle->setChecked(resizeHandle);
bool superSize = m_config->readBoolEntry("SuperSize", true);
m_dialog->m_superSize->setChecked(superSize);
bool titleShadow = m_config->readBoolEntry("TitleShadow", true);
m_dialog->m_titleShadow->setChecked(titleShadow);
int titleShadowSize = m_config->readNumEntry("TitleShadowSize", 2);
m_dialog->m_titleShadowSize->setValue(titleShadowSize);
}
void MalloryConfig::save(TDEConfig*)
{
m_config->setGroup("General");
m_config->writeEntry("ButtonSize", m_dialog->m_buttonSize->value());
m_config->writeEntry("TitleSize", m_dialog->m_titleSize->value());
m_config->writeEntry("BorderSize", m_dialog->m_borderSize->value());
m_config->writeEntry("LessRounded", m_dialog->m_lessRounded->isChecked());
m_config->writeEntry("ButtonStyle", m_dialog->m_buttonStyle->currentItem());
m_config->writeEntry("ResizeHandle", m_dialog->m_resizeHandle->isChecked());
m_config->writeEntry("SuperSize", m_dialog->m_superSize->isChecked());
m_config->writeEntry("TitleShadow", m_dialog->m_titleShadow->isChecked());
m_config->writeEntry("TitleShadowSize", m_dialog->m_titleShadowSize->value());
m_config->sync();
}
void MalloryConfig::defaults()
{
m_dialog->m_titleSize->setValue(22);
m_dialog->m_buttonSize->setValue(18);
m_dialog->m_borderSize->setValue(5);
m_dialog->m_lessRounded->setChecked(false);
m_dialog->m_buttonStyle->setCurrentItem(0);
m_dialog->m_resizeHandle->setChecked(true);
m_dialog->m_superSize->setChecked(true);
m_dialog->m_titleShadow->setChecked(true);
m_dialog->m_titleShadowSize->setValue(2);
}
//////////////////////////////////////////////////////////////////////////////
// Plugin Stuff //
//////////////////////////////////////////////////////////////////////////////
extern "C"
{
TQObject* allocate_config(TDEConfig* config, TQWidget* parent) {
return (new MalloryConfig(config, parent));
}
}
#include "malloryconfig.moc"
|