File indexing completed on 2024-03-03 04:11:16

0001 //
0002 // C++ Interface: cgaugelist
0003 //
0004 // Description: 
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 
0023 #ifndef CGAUGELIST_H
0024 #define CGAUGELIST_H
0025 
0026 #include "clist.h"
0027 
0028 #include <qcolor.h>
0029 #include <qstring.h>
0030 
0031 class cGauge;
0032 
0033 /**
0034 List of gauges.
0035 
0036 @author Tomas Mecir
0037 */
0038 class cGaugeList : public cList
0039 {
0040 public:
0041   cGaugeList ();
0042   ~cGaugeList () override;
0043 
0044   static cList *newList () { return new cGaugeList; };
0045   cListObject *newObject () override;
0046   QString objName () override { return "Gauge"; }
0047   cListEditor *editor (QWidget *parent) override;
0048   
0049   /** a gauge request, adds a new gauge, if there is no gauge already using the
0050   same base variable */
0051   bool requestGauge (const QString &var, const QString &maxvar, const QString &caption,
0052       const QColor &color, bool hidden);
0053   /** as above; *DELETES* the gauge if it can't accept it! */
0054   bool requestGauge (cGauge *gauge);
0055   
0056   /** handle the fact that a variable value has been changed */
0057   void variableChanged (const QString &varname);
0058  private:
0059   struct Private;
0060   Private *d;
0061   friend class cGauge;
0062 
0063   void listLoaded () override;
0064   
0065   void addGauge (cGauge *g);
0066   void removeGauge (cGauge *g);
0067 
0068   void updateGauges ();
0069   
0070   QString variableName () const;
0071 };
0072 
0073 #endif  //CGAUGELIST_H