OSDN Git Service

Each encoder now can return an AbstractEncoderInfo object, which contains the support...
[x264-launcher/x264-launcher.git] / src / win_updater.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
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.
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 along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
21
22 #pragma once
23
24 #include <QDialog>
25
26 class QMovie;
27 class UpdateCheckThread;
28 class SysinfoModel;
29
30 namespace Ui
31 {
32         class UpdaterDialog;
33 }
34
35 class UpdaterDialog : public QDialog
36 {
37         Q_OBJECT
38
39 public:
40         UpdaterDialog(QWidget *parent, const SysinfoModel *sysinfo);
41         ~UpdaterDialog(void);
42
43         static const int READY_TO_INSTALL_UPDATE = 42;
44
45         inline bool getSuccess(void) { return m_success; }
46
47 protected:
48         virtual bool event(QEvent *e);
49         virtual void showEvent(QShowEvent *event);
50         virtual void closeEvent(QCloseEvent *e);
51         virtual void keyPressEvent(QKeyEvent *event);
52
53 private slots:
54         void initUpdate(void);
55         void checkForUpdates(void);
56         void threadStatusChanged(int status);
57         void threadMessageLogged(const QString &message);
58         void threadFinished(void);
59         void updateFinished(void);
60         void openUrl(const QString &url);
61         void installUpdate(void);
62
63 private:
64         Ui::UpdaterDialog *const ui;
65
66         bool checkBinaries(QString &wgetBin, QString &gpgvBin);
67         bool checkFileHash(const QString &filePath, const char *expectedHash);
68
69         const SysinfoModel *const m_sysinfo;
70
71         bool m_firstShow;
72         bool m_success;
73
74         QMovie *m_animator;
75         UpdateCheckThread *m_thread;
76         unsigned long m_updaterProcess;
77         QStringList m_logFile;
78         QString m_keysFile;
79         QString m_wupdFile;
80         int m_status;
81 };