2010-11-27 19:41:58 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// LameXP - Audio Encoder Front-End
|
2012-01-02 00:52:27 +01:00
|
|
|
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
|
2010-11-27 19:41:58 +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>
|
|
|
|
|
2010-11-28 22:18:07 +01:00
|
|
|
class UpdateInfo;
|
2010-11-29 20:36:27 +01:00
|
|
|
class SettingsModel;
|
2011-03-24 15:37:49 +01:00
|
|
|
class QMovie;
|
2010-11-28 22:18:07 +01:00
|
|
|
|
2012-12-09 22:39:17 +01:00
|
|
|
//UIC forward declartion
|
|
|
|
namespace Ui {
|
|
|
|
class UpdateDialog;
|
|
|
|
}
|
|
|
|
|
|
|
|
//UpdateDialog class
|
|
|
|
class UpdateDialog : public QDialog
|
2010-11-27 19:41:58 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2010-11-29 20:36:27 +01:00
|
|
|
UpdateDialog(SettingsModel *settings, QWidget *parent = 0);
|
2010-11-27 19:41:58 +01:00
|
|
|
~UpdateDialog(void);
|
|
|
|
|
2010-11-29 20:36:27 +01:00
|
|
|
bool getSuccess(void) { return m_success; }
|
2011-02-18 00:53:36 +01:00
|
|
|
bool updateReadyToInstall(void) { return m_updateReadyToInstall; }
|
2010-11-29 20:36:27 +01:00
|
|
|
|
2010-11-27 19:41:58 +01:00
|
|
|
private slots:
|
2010-11-28 22:18:07 +01:00
|
|
|
void updateInit(void);
|
|
|
|
void checkForUpdates(void);
|
|
|
|
void linkActivated(const QString &link);
|
|
|
|
void applyUpdate(void);
|
2010-11-29 20:36:27 +01:00
|
|
|
void logButtonClicked(void);
|
2011-02-25 13:40:45 +01:00
|
|
|
void progressBarValueChanged(int value);
|
2010-11-27 19:41:58 +01:00
|
|
|
|
|
|
|
protected:
|
2012-01-24 02:46:29 +01:00
|
|
|
virtual void showEvent(QShowEvent *event);
|
|
|
|
virtual void closeEvent(QCloseEvent *event);
|
|
|
|
virtual void keyPressEvent(QKeyEvent *e);
|
|
|
|
virtual bool winEvent(MSG *message, long *result);
|
|
|
|
virtual bool event(QEvent *e);
|
2010-11-27 19:41:58 +01:00
|
|
|
|
2011-05-03 14:28:06 +02:00
|
|
|
const bool m_betaUpdates;
|
|
|
|
|
2010-11-27 19:41:58 +01:00
|
|
|
private:
|
2012-12-09 22:39:17 +01:00
|
|
|
Ui::UpdateDialog *ui; //for Qt UIC
|
|
|
|
|
2010-11-28 22:18:07 +01:00
|
|
|
bool tryUpdateMirror(UpdateInfo *updateInfo, const QString &url);
|
2011-12-02 20:05:23 +01:00
|
|
|
bool getFile(const QString &url, const QString &outFile, unsigned int maxRedir = 5, bool *httpOk = NULL);
|
2010-11-28 22:18:07 +01:00
|
|
|
bool checkSignature(const QString &file, const QString &signature);
|
|
|
|
bool parseVersionInfo(const QString &file, UpdateInfo *updateInfo);
|
2011-12-01 22:16:06 +01:00
|
|
|
void testKnownWebSites(void);
|
2010-11-28 22:18:07 +01:00
|
|
|
|
|
|
|
UpdateInfo *m_updateInfo;
|
2010-11-29 20:36:27 +01:00
|
|
|
QStringList *m_logFile;
|
|
|
|
SettingsModel *m_settings;
|
2011-03-24 15:37:49 +01:00
|
|
|
QMovie *m_animator;
|
2010-11-28 22:18:07 +01:00
|
|
|
|
|
|
|
const QString m_binaryWGet;
|
|
|
|
const QString m_binaryGnuPG;
|
|
|
|
const QString m_binaryUpdater;
|
|
|
|
const QString m_binaryKeys;
|
2012-01-24 02:46:29 +01:00
|
|
|
unsigned long m_updaterProcess;
|
2010-11-29 20:36:27 +01:00
|
|
|
|
|
|
|
bool m_success;
|
2011-02-18 00:53:36 +01:00
|
|
|
bool m_updateReadyToInstall;
|
2012-04-11 00:44:40 +02:00
|
|
|
bool m_firstShow;
|
2010-11-27 19:41:58 +01:00
|
|
|
};
|