KStyles
highcontrastconfig.cpp
Go to the documentation of this file.00001 /* 00002 Copyright (c) 2005 Luciano Montanaro <mikelima@cirulla.net> 00003 00004 based on the Keramick configuration dialog 00005 Copyright (c) 2003 Maksim Orlovich <maksim.orlovich@kdemail.net> 00006 00007 Permission is hereby granted, free of charge, to any person obtaining a 00008 copy of this software and associated documentation files (the "Software"), 00009 to deal in the Software without restriction, including without limitation 00010 the rights to use, copy, modify, merge, publish, distribute, sublicense, 00011 and/or sell copies of the Software, and to permit persons to whom the 00012 Software is furnished to do so, subject to the following conditions: 00013 00014 The above copyright notice and this permission notice shall be included in 00015 all copies or substantial portions of the Software. 00016 00017 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00018 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00019 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00020 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00021 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00022 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00023 DEALINGS IN THE SOFTWARE. 00024 00025 */ 00026 00027 #include "highcontrastconfig.h" 00028 00029 #include <QtGui/QCheckBox> 00030 #include <QtGui/QLayout> 00031 #include <QtCore/QSettings> 00032 #include <kdialog.h> 00033 #include <kglobal.h> 00034 #include <klocale.h> 00035 00036 extern "C" KDE_EXPORT QWidget* 00037 allocate_kstyle_config(QWidget* parent) 00038 { 00039 return new HighContrastStyleConfig(parent); 00040 } 00041 00042 HighContrastStyleConfig::HighContrastStyleConfig( 00043 QWidget* parent): QWidget(parent) 00044 { 00045 // Should have no margins here, the dialog provides them 00046 QVBoxLayout* layout = new QVBoxLayout(this, 0, 0); 00047 KGlobal::locale()->insertCatalog("kstyle_config"); 00048 00049 wideLinesBox = new QCheckBox(i18n("Use wider lines"), this); 00050 00051 layout->add(wideLinesBox); 00052 layout->addStretch(1); 00053 00054 QSettings s; 00055 00056 originalWideLinesState = s.readBoolEntry( 00057 "/highcontraststyle/Settings/wideLines", false); 00058 wideLinesBox->setChecked(originalWideLinesState); 00059 00060 connect(wideLinesBox, SIGNAL(toggled(bool)), SLOT(updateChanged())); 00061 } 00062 00063 HighContrastStyleConfig::~HighContrastStyleConfig() 00064 { 00065 KGlobal::locale()->removeCatalog("kstyle_config"); 00066 } 00067 00068 00069 void 00070 HighContrastStyleConfig::save() 00071 { 00072 QSettings s; 00073 s.writeEntry("/highcontraststyle/Settings/wideLines", 00074 wideLinesBox->isChecked()); 00075 } 00076 00077 void 00078 HighContrastStyleConfig::defaults() 00079 { 00080 wideLinesBox->setChecked(false); 00081 // updateChanged would be done by setChecked already 00082 } 00083 00084 void 00085 HighContrastStyleConfig::updateChanged() 00086 { 00087 if ((wideLinesBox->isChecked() == originalWideLinesState)) { 00088 emit changed(false); 00089 } else { 00090 emit changed(true); 00091 } 00092 } 00093 00094 #include "highcontrastconfig.moc"