Stellarium 0.13.0
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  void setUpdatesMessage(bool hasUpdates, QString version="");
66  QString getUpdatesMessage();
67 
68 public slots:
69  void retranslate();
72  void updateJSON(void);
73 
74 protected:
76  virtual void createDialogContent();
77 
78  Ui_helpDialogForm* ui;
79 
80 signals:
83 
84 private slots:
86  void showShortcutsWindow();
87 
89  void updateLog(int);
90 
92  void refreshLog();
93 
94  void changePage(QListWidgetItem *current, QListWidgetItem *previous);
95 
99  void updateDownloadComplete(QNetworkReply* reply);
100 
101 private:
103  QString getHelpText(void);
104 
107  void updateText(void);
108 
110  void restoreDefaultJsonFile(void);
111 
113  void readJsonFile(void);
114 
115  // variables and functions for the updater
116  UpdateState updateState;
117  QSettings* conf;
118  QNetworkAccessManager* downloadMgr;
119  QString updateUrl;
120  bool updatesEnabled;
121  QString jsonDataPath;
122  QString currentVersion;
123  QString updatesMessage;
124 };
125 
126 #endif /*_HELPDIALOG_HPP_*/
127 
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
Definition: HelpDialog.hpp:34
Other error.
Definition: HelpDialog.hpp:45
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