2013-11-22 17:01:13 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Simple x264 Launcher
|
2016-01-01 23:59:55 +01:00
|
|
|
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
2013-11-22 17:01:13 +01:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
|
|
// with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
//
|
|
|
|
// http://www.gnu.org/licenses/gpl-2.0.txt
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QDialog>
|
2015-02-01 21:05:17 +01:00
|
|
|
#include <QMap>
|
2013-11-22 17:01:13 +01:00
|
|
|
|
2013-11-23 15:20:07 +01:00
|
|
|
class QMovie;
|
2014-02-12 19:34:14 +01:00
|
|
|
class SysinfoModel;
|
2013-11-23 15:20:07 +01:00
|
|
|
|
2013-11-22 17:01:13 +01:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
class UpdaterDialog;
|
|
|
|
}
|
|
|
|
|
2015-02-01 21:05:17 +01:00
|
|
|
namespace MUtils
|
|
|
|
{
|
|
|
|
class UpdateChecker;
|
|
|
|
}
|
|
|
|
|
2013-11-22 17:01:13 +01:00
|
|
|
class UpdaterDialog : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2014-04-20 19:40:59 +02:00
|
|
|
UpdaterDialog(QWidget *parent, const SysinfoModel *sysinfo, const char *const updateUrl);
|
2013-11-22 17:01:13 +01:00
|
|
|
~UpdaterDialog(void);
|
|
|
|
|
2014-04-21 16:39:54 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const char* name;
|
|
|
|
const char* hash;
|
|
|
|
const bool exec;
|
|
|
|
}
|
|
|
|
binary_t;
|
|
|
|
|
2013-12-14 22:30:19 +01:00
|
|
|
static const int READY_TO_INSTALL_UPDATE = 42;
|
2014-04-21 16:39:54 +02:00
|
|
|
static const binary_t BINARIES[];
|
2013-12-14 22:30:19 +01:00
|
|
|
|
|
|
|
inline bool getSuccess(void) { return m_success; }
|
|
|
|
|
2013-11-23 15:20:07 +01:00
|
|
|
protected:
|
2013-12-13 15:25:36 +01:00
|
|
|
virtual bool event(QEvent *e);
|
2013-11-23 15:20:07 +01:00
|
|
|
virtual void showEvent(QShowEvent *event);
|
|
|
|
virtual void closeEvent(QCloseEvent *e);
|
2013-12-11 15:50:26 +01:00
|
|
|
virtual void keyPressEvent(QKeyEvent *event);
|
2013-11-23 15:20:07 +01:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void initUpdate(void);
|
2013-12-09 22:19:32 +01:00
|
|
|
void checkForUpdates(void);
|
|
|
|
void threadStatusChanged(int status);
|
2013-12-11 15:50:26 +01:00
|
|
|
void threadMessageLogged(const QString &message);
|
|
|
|
void threadFinished(void);
|
2013-12-14 22:30:19 +01:00
|
|
|
void updateFinished(void);
|
2013-12-11 15:50:26 +01:00
|
|
|
void openUrl(const QString &url);
|
|
|
|
void installUpdate(void);
|
2013-11-23 15:20:07 +01:00
|
|
|
|
2013-11-22 17:01:13 +01:00
|
|
|
private:
|
|
|
|
Ui::UpdaterDialog *const ui;
|
2013-11-23 15:20:07 +01:00
|
|
|
|
2013-12-11 15:50:26 +01:00
|
|
|
bool checkBinaries(QString &wgetBin, QString &gpgvBin);
|
2013-12-09 20:42:02 +01:00
|
|
|
bool checkFileHash(const QString &filePath, const char *expectedHash);
|
2015-02-01 21:05:17 +01:00
|
|
|
void cleanFiles(void);
|
2013-12-09 20:42:02 +01:00
|
|
|
|
2014-02-12 19:34:14 +01:00
|
|
|
const SysinfoModel *const m_sysinfo;
|
2014-04-20 19:40:59 +02:00
|
|
|
const char *const m_updateUrl;
|
2014-02-12 19:34:14 +01:00
|
|
|
|
2013-11-23 15:20:07 +01:00
|
|
|
bool m_firstShow;
|
2013-12-14 22:30:19 +01:00
|
|
|
bool m_success;
|
2014-02-12 19:34:14 +01:00
|
|
|
|
2015-02-01 21:05:17 +01:00
|
|
|
QScopedPointer<QMovie> m_animator;
|
|
|
|
QScopedPointer<MUtils::UpdateChecker> m_thread;
|
|
|
|
|
2013-12-13 15:25:36 +01:00
|
|
|
unsigned long m_updaterProcess;
|
2013-12-11 15:50:26 +01:00
|
|
|
QStringList m_logFile;
|
2015-02-01 21:05:17 +01:00
|
|
|
QMap<QString,QString> m_binaries;
|
2013-12-11 15:50:26 +01:00
|
|
|
int m_status;
|
2013-11-22 17:01:13 +01:00
|
|
|
};
|