delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / runtime / kstyles / oxygen / config / oxygenconf.cpp
bloba9ffdab2d04bb5ff1040b1e0e54a920d2d5e4a45
1 /*
2 Copyright (C) 2003 Sandro Giessl <ceebx@users.sourceforge.net>
4 based on the Keramik configuration dialog:
5 Copyright (c) 2003 Maksim Orlovich <maksim.orlovich@kdemail.net>
7 Permission is hereby granted, free of charge, to any person obtaining a
8 copy of this software and associated documentation files (the "Software"),
9 to deal in the Software without restriction, including without limitation
10 the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 and/or sell copies of the Software, and to permit persons to whom the
12 Software is furnished to do so, subject to the following conditions:
14 The above copyright notice and this permission notice shall be included in
15 all copies or substantial portions of the Software.
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 DEALINGS IN THE SOFTWARE.
27 #include "oxygenconf.h"
29 #ifndef QT3_SUPPORT
30 #define QT3_SUPPORT
31 #endif
32 #include <QtGui/QCheckBox>
33 #include <QtGui/QLayout>
34 #include <khbox.h>
35 #include <QtGui/QColor>
36 #include <KGlobal>
37 #include <KLocale>
38 #include <KColorButton>
39 #include <KComponentData>
40 #include <KConfigGroup>
41 #include <kdemacros.h>
43 extern "C"
45 KDE_EXPORT QWidget* allocate_kstyle_config(QWidget* parent)
47 KGlobal::locale()->insertCatalog("kstyle_config");
48 return new OxygenStyleConfig(parent);
52 OxygenStyleConfig::OxygenStyleConfig(QWidget* parent): QWidget(parent)
54 config = KComponentData("oxygen").config();
55 //Should have no margins here, the dialog provides them
56 QVBoxLayout* layout = new QVBoxLayout(this);
57 layout->setMargin(0);
58 layout->setSpacing(0);
60 KGlobal::locale()->insertCatalog("kstyle_config");
62 //animateProgressBar = new QCheckBox(i18n("Animate progress bars"), this);
63 drawToolBarItemSeparator = new QCheckBox(i18n("Draw toolbar item separators"), this);
64 drawTriangularExpander = new QCheckBox(i18n("Triangular tree expander"), this);
65 drawTreeBranchLines = new QCheckBox(i18n("Draw tree branch lines"), this);
67 //layout->addWidget(animateProgressBar);
68 layout->addWidget(drawToolBarItemSeparator);
69 layout->addWidget(drawTriangularExpander);
70 layout->addWidget(drawTreeBranchLines);
71 layout->addStretch(1);
73 KConfigGroup cfg(config, "Style");
74 //origAnimProgressBar = cfg.readEntry("AnimateProgressBar", false);
75 //animateProgressBar->setChecked(origAnimProgressBar);
76 origDrawToolBarItemSeparator = cfg.readEntry("DrawToolBarItemSeparator", true);
77 drawToolBarItemSeparator->setChecked(origDrawToolBarItemSeparator);
78 origDrawTriangularExpander = cfg.readEntry("DrawTriangularExpander", false);
79 drawTriangularExpander->setChecked(origDrawTriangularExpander);
80 origDrawTreeBranchLines = cfg.readEntry("DrawTreeBranchLines", true);
81 drawTreeBranchLines->setChecked(origDrawTreeBranchLines);
83 //connect(animateProgressBar, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) );
84 connect(drawToolBarItemSeparator, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) );
85 connect(drawTriangularExpander, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) );
86 connect(drawTreeBranchLines, SIGNAL( toggled(bool) ), SLOT( updateChanged() ) );
89 OxygenStyleConfig::~OxygenStyleConfig()
94 void OxygenStyleConfig::save()
96 KConfigGroup cfg(config, "Style");
97 //s.writeEntry("AnimateProgressBar", animateProgressBar->isChecked() ? true : false);
98 cfg.writeEntry("DrawToolBarItemSeparator", drawToolBarItemSeparator->isChecked() ? true : false);
99 cfg.writeEntry("DrawTriangularExpander", drawTriangularExpander->isChecked() ? true : false);
100 cfg.writeEntry("DrawTreeBranchLines", drawTreeBranchLines->isChecked() ? true : false);
103 void OxygenStyleConfig::defaults()
105 // animateProgressBar->setChecked(true);
106 drawToolBarItemSeparator->setChecked(true);
107 drawTriangularExpander->setChecked(false);
108 drawTreeBranchLines->setChecked(true);
109 //updateChanged would be done by setChecked already
112 void OxygenStyleConfig::updateChanged()
114 if (
115 //(animateProgressBar->isChecked() == origAnimProgressBar) &&
116 (drawToolBarItemSeparator->isChecked() == origDrawToolBarItemSeparator) &&
117 (drawTriangularExpander->isChecked() == origDrawTriangularExpander) &&
118 (drawTreeBranchLines->isChecked() == origDrawTreeBranchLines)
120 emit changed(false);
121 else
122 emit changed(true);
125 #include "oxygenconf.moc"