Stellarium 0.13.1
HelpDialog.hpp
1 /*
2  * Stellarium
3  * Copyright (C) 2007 Matthew Gates
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 _HELPDIALOG_HPP_
21 #define _HELPDIALOG_HPP_
22 
23 #include <QString>
24 #include <QObject>
25 #include <QSettings>
26 
27 #include "StelDialog.hpp"
28 
29 class Ui_helpDialogForm;
30 class QListWidgetItem;
31 class QNetworkAccessManager;
32 class QNetworkReply;
33 
34 class HelpDialog : public StelDialog
35 {
36  Q_OBJECT
37 public:
40  enum UpdateState {
46  };
47 
48  HelpDialog(QObject* parent);
49  ~HelpDialog();
50 
52  void styleChanged();
53 
56  bool getUpdatesEnabled(void) {return updatesEnabled;}
59  void setUpdatesEnabled(bool b) {updatesEnabled=b;}
61  UpdateState getUpdateState(void) {return updateState;}
64  QString getLatestVersionFromJson(void);
65  int getRequiredOpenGLVersionFromJson(void);
66  void setUpdatesMessage(bool hasUpdates, QString version="", int OpenGL=0);
67  QString getUpdatesMessage();
68 
69 public slots:
70  void retranslate();
73  void updateJSON(void);
74 
75 protected:
77  virtual void createDialogContent();
78 
79  Ui_helpDialogForm* ui;
80 
81 signals:
84 
85 private slots:
87  void showShortcutsWindow();
88 
90  void updateLog(int);
91 
93  void refreshLog();
94 
95  void changePage(QListWidgetItem *current, QListWidgetItem *previous);
96 
100  void updateDownloadComplete(QNetworkReply* reply);
101 
102 private:
104  QString getHelpText(void);
105 
108  void updateText(void);
109 
111  void restoreDefaultJsonFile(void);
112 
114  void readJsonFile(void);
115 
116  // variables and functions for the updater
117  UpdateState updateState;
118  QSettings* conf;
119  QNetworkAccessManager* downloadMgr;
120  QString updateUrl;
121  bool updatesEnabled;
122  QString jsonDataPath;
123  QString currentVersion;
124  QString updatesMessage;
125 };
126 
127 #endif /*_HELPDIALOG_HPP_*/
128 
Update completed, there were updates.
Definition: HelpDialog.hpp:43
QString getLatestVersionFromJson(void)
Get the version from the "latestVersion" value in the updates.json file.
Error during download phase.
Definition: HelpDialog.hpp:44
Base class for all the GUI windows in Stellarium.
Definition: StelDialog.hpp:45
void updateJSON(void)
Download JSON from web recources described in the module section of the module.ini file and update th...
Update in progress.
Definition: HelpDialog.hpp:41
void setUpdatesEnabled(bool b)
set whether or not the plugin will try to update data from the internet
Definition: HelpDialog.hpp:59
bool getUpdatesEnabled(void)
get whether or not the plugin will try to update data from the internet
Definition: HelpDialog.hpp:56
void updateStateChanged(HelpDialog::UpdateState state)
virtual void createDialogContent()
Initialize the dialog widgets and connect the signals/slots.
Update completed, there we no updates.
Definition: HelpDialog.hpp:42
UpdateState
Used for keeping for track of the download/update status.
Definition: HelpDialog.hpp:40
void styleChanged()
Notify that the application style changed.
UpdateState getUpdateState(void)
Get the current updateState.
Definition: HelpDialog.hpp:61