OSDN Git Service

Now using UpdateChecker and KeccakHash from the MUtils library. Removed obsolete...
[lamexp/LameXP.git] / src / Dialog_Update.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2014 LoRd_MuldeR <MuldeR2@GMX.de>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version, but always including the *additional*
9 // restrictions defined in the "License.txt" file.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with this program; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 //
20 // http://www.gnu.org/licenses/gpl-2.0.txt
21 ///////////////////////////////////////////////////////////////////////////////
22
23 #pragma once
24
25 #include <QDialog>
26
27 class SettingsModel;
28 class QMovie;
29
30 //MUtils forward declaration
31 namespace MUtils
32 {
33         class UpdateChecker;
34 }
35
36 //UIC forward declartion
37 namespace Ui {
38         class UpdateDialog;
39 }
40
41 //UpdateDialog class
42 class UpdateDialog : public QDialog
43 {
44         Q_OBJECT
45
46 public:
47         UpdateDialog(SettingsModel *settings, QWidget *parent = 0);
48         ~UpdateDialog(void);
49
50         bool getSuccess(void) { return m_success; }
51         bool updateReadyToInstall(void) { return m_updateReadyToInstall; }
52
53 private slots:
54         void updateInit(void);
55         void checkForUpdates(void);
56         void linkActivated(const QString &link);
57         void applyUpdate(void);
58         void logButtonClicked(void);
59         void progressBarValueChanged(int value);
60
61         void threadStatusChanged(const int status);
62         void threadProgressChanged(const int progress);
63         void threadMessageLogged(const QString &message);
64         void threadFinished(void);
65
66 protected:
67         virtual void showEvent(QShowEvent *event);
68         virtual void closeEvent(QCloseEvent *event);
69         virtual void keyPressEvent(QKeyEvent *e);
70         virtual bool winEvent(MSG *message, long *result);
71         virtual bool event(QEvent *e);
72
73         const bool m_betaUpdates;
74
75 private:
76         Ui::UpdateDialog *ui; //for Qt UIC
77
78         const QString m_binaryWGet;
79         const QString m_binaryGnuPG;
80         const QString m_binaryKeys;
81         const QString m_binaryUpdater;
82
83         MUtils::UpdateChecker *m_thread;
84         QStringList *m_logFile;
85         SettingsModel *m_settings;
86         QMovie *m_animator;
87
88         unsigned long m_updaterProcess;
89
90         bool m_success;
91         bool m_updateReadyToInstall;
92         bool m_firstShow;
93         
94         void testKnownHosts(void);
95
96 };