Stellarium 0.15.2
StelProgressController.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2013 Fabien Chereau
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18  */
19 
20 #ifndef _STELPROGRESSCONTROLLER_HPP_
21 #define _STELPROGRESSCONTROLLER_HPP_
22 
23 #include <QString>
24 #include <QObject>
25 
27 class StelProgressController : public QObject
28 {
29  Q_OBJECT
30 
31 public:
32  StelProgressController(QObject* parent = NULL) : QObject(parent), format("%p%"), min(0), max(100), value(0) {;}
33 
39  void setFormat(const QString& fmt) {format = fmt;}
40  void setRange(int amin, int amax) {min = amin; max = amax;}
41  void setValue(int val) {value=val; emit changed();}
42 
43  int getValue() const {return value;}
44  int getMin() const {return min;}
45  int getMax() const {return max;}
46  QString getFormat() const {return format;}
47 
48 signals:
49  void changed();
50 
51 private:
52  friend class StelApp;
54  QString format;
55  int min;
56  int max;
57  int value;
58 };
59 
60 
61 #endif // _STELPROGRESSCONTROLLER_HPP_
void setFormat(const QString &fmt)
This property holds the string used to generate the current text.
Maintain the state of a progress bar.
Singleton main Stellarium application class.
Definition: StelApp.hpp:68