File indexing completed on 2024-04-21 11:40:56

0001 //
0002 // C++ Interface: cstatusvar
0003 //
0004 // Description: One variable entry in the status bar
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 #ifndef CSTATUSVAR_H
0023 #define CSTATUSVAR_H
0024 
0025 #include "csaveablefield.h"
0026 
0027 /**
0028 This class represents one variable entry in the status bar.
0029 
0030 @author Tomas Mecir
0031 */
0032 class cStatusVar : public cSaveableField
0033 {
0034  public:
0035   /** constructor */
0036   cStatusVar (int _sess);
0037   /** destructor */
0038   ~cStatusVar() override;
0039 
0040   /** creates a new instance of the class */
0041   cSaveableField *newInstance () override;
0042 
0043     /** load data from a config file*/
0044   void load (KConfig *config, const QString &group) override;
0045 
0046   /** returns type of item (light-weight RTTI) */
0047   int itemType () override { return TYPE_STATUSVAR; };
0048  
0049   const QString &variable () { return _variable; };
0050   const QString &maxVariable () { return _maxvariable; };
0051   const QString &caption () { return _caption; };
0052   bool percentage () { return _percentage; };
0053   bool hidden () { return _hidden; };
0054 
0055   void setVariable (const QString &val);
0056   void setMaxVariable (const QString &val);
0057   void setCaption (const QString &val);
0058   void setPercentage (bool percent);
0059   void setHidden (bool h);
0060 
0061   int varValue () { return varvalue; };
0062   int maxVarValue () { return maxvarvalue; };
0063   
0064  protected:
0065   QString _variable, _maxvariable, _caption;
0066   int varvalue, maxvarvalue;
0067   bool _percentage, _hidden;
0068 
0069   int sess;
0070 };
0071 
0072 #endif