OSDN Git Service

Improved Russian & Spanish translations for the installer
[lamexp/LameXP.git] / src / Dialog_Update.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // LameXP - Audio Encoder Front-End
3 // Copyright (C) 2004-2015 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         class Taskbar7;
35 }
36
37 //UIC forward declartion
38 namespace Ui
39 {
40         class UpdateDialog;
41 }
42
43 //UpdateDialog class
44 class UpdateDialog : public QDialog
45 {
46         Q_OBJECT
47
48 public:
49         UpdateDialog(const SettingsModel *const settings, QWidget *parent = 0);
50         ~UpdateDialog(void);
51
52         bool getSuccess(void) { return m_success; }
53         bool updateReadyToInstall(void) { return m_updateReadyToInstall; }
54
55 private slots:
56         void updateInit(void);
57         void checkForUpdates(void);
58         void linkActivated(const QString &link);
59         void applyUpdate(void);
60         void logButtonClicked(void);
61         void progressBarValueChanged(int value);
62
63         void threadStatusChanged(const int status);
64         void threadProgressChanged(const int progress);
65         void threadMessageLogged(const QString &message);
66         void threadFinished(void);
67
68 protected:
69         virtual void showEvent(QShowEvent *event);
70         virtual void closeEvent(QCloseEvent *event);
71         virtual void keyPressEvent(QKeyEvent *e);
72         virtual bool event(QEvent *e);
73
74         const bool m_betaUpdates;
75
76 private:
77         Ui::UpdateDialog *const ui; //for Qt UIC
78         const SettingsModel *const m_settings;
79
80         const QString m_binaryWGet;
81         const QString m_binaryGnuPG;
82         const QString m_binaryKeys;
83         const QString m_binaryUpdater;
84
85         QScopedPointer<MUtils::Taskbar7> m_taskbar;
86         QScopedPointer<MUtils::UpdateChecker> m_thread;
87         QScopedPointer<QStringList> m_logFile;
88         QScopedPointer<QMovie> m_animator;
89
90         unsigned long m_updaterProcess;
91
92         bool m_success;
93         bool m_updateReadyToInstall;
94         bool m_firstShow;
95         
96         void testKnownHosts(void);
97
98 };