File indexing completed on 2024-10-06 09:45:55
0001 // 0002 // C++ Implementation: cgauge 0003 // 0004 // Description: One gauge (no GUI) 0005 // 0006 /* 0007 Copyright 2004-2011 Tomas Mecir <kmuddy@kmuddy.com> 0008 0009 This program is free software; you can redistribute it and/or 0010 modify it under the terms of the GNU General Public License as 0011 published by the Free Software Foundation; either version 2 of 0012 the License, or (at your option) any later version. 0013 0014 This program is distributed in the hope that it will be useful, 0015 but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 GNU General Public License for more details. 0018 0019 You should have received a copy of the GNU General Public License 0020 along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 */ 0022 #include "cgauge.h" 0023 0024 #include <kconfig.h> 0025 #include <kconfiggroup.h> 0026 0027 cGauge::cGauge (int _sess) : sess(_sess) 0028 { 0029 varvalue = maxvarvalue = 0; 0030 _hidden = false; 0031 _color = Qt::white; 0032 } 0033 0034 cGauge::~cGauge() 0035 { 0036 } 0037 0038 cSaveableField *cGauge::newInstance () 0039 { 0040 return new cGauge (sess); 0041 } 0042 0043 void cGauge::setVariable (const QString &val) 0044 { 0045 _variable = val; 0046 varvalue = 0; 0047 } 0048 0049 void cGauge::setMaxVariable (const QString &val) 0050 { 0051 _maxvariable = val; 0052 maxvarvalue = 0; 0053 } 0054 0055 void cGauge::setCaption (const QString &val) 0056 { 0057 _caption = val; 0058 } 0059 0060 void cGauge::setColor (const QColor &c) 0061 { 0062 _color = c; 0063 } 0064 0065 void cGauge::setHidden (bool h) 0066 { 0067 _hidden = h; 0068 } 0069 0070 void cGauge::load (KConfig *config, const QString &group) 0071 { 0072 KConfigGroup g = config->group (group); 0073 0074 setVariable (g.readEntry ("Variable", QString())); 0075 setMaxVariable (g.readEntry ("Max variable", QString())); 0076 setCaption (g.readEntry ("Caption", QString())); 0077 setColor (g.readEntry ("Color", (QColor) Qt::white)); 0078 setHidden (g.readEntry ("Hidden", false)); 0079 } 0080