OSDN Git Service

Small improvement to UpdateDialog.
[lamexp/LameXP.git] / src / Dialog_Update.h
index 53998bc..f7ce6cc 100644 (file)
@@ -1,11 +1,12 @@
 ///////////////////////////////////////////////////////////////////////////////
 // LameXP - Audio Encoder Front-End
-// Copyright (C) 2004-2011 LoRd_MuldeR <MuldeR2@GMX.de>
+// Copyright (C) 2004-2020 LoRd_MuldeR <MuldeR2@GMX.de>
 //
 // 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
+// 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.
+// (at your option) any later version; always including the non-optional
+// LAMEXP GNU GENERAL PUBLIC LICENSE ADDENDUM. See "License.txt" file!
 //
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 #pragma once
 
-#include "..\tmp\UIC_UpdateDialog.h"
-
 #include <QDialog>
 
-class UpdateInfo;
 class SettingsModel;
+class QMovie;
+
+//MUtils forward declaration
+namespace MUtils
+{
+       class UpdateChecker;
+       class Taskbar7;
+}
+
+//UIC forward declartion
+namespace Ui
+{
+       class UpdateDialog;
+}
 
-class UpdateDialog : public QDialog, private Ui::UpdateDialog
+//UpdateDialog class
+class UpdateDialog : public QDialog
 {
        Q_OBJECT
 
 public:
-       UpdateDialog(SettingsModel *settings, QWidget *parent = 0);
+       UpdateDialog(const SettingsModel *const settings, QWidget *parent = 0);
        ~UpdateDialog(void);
 
        bool getSuccess(void) { return m_success; }
+       bool updateReadyToInstall(void) { return m_updateReadyToInstall; }
+       bool haveNewVersion(void) { return m_haveNewVersion; }
 
 private slots:
        void updateInit(void);
@@ -44,26 +59,42 @@ private slots:
        void linkActivated(const QString &link);
        void applyUpdate(void);
        void logButtonClicked(void);
+       void progressBarValueChanged(int value);
+
+       void threadStatusChanged(const int status);
+       void threadProgressChanged(const int progress);
+       void threadMessageLogged(const QString &message);
+       void threadFinished(void);
 
 protected:
-       void showEvent(QShowEvent *event);
-       void closeEvent(QCloseEvent *event);
-       void keyPressEvent(QKeyEvent *e);
+       virtual void showEvent(QShowEvent *event);
+       virtual void closeEvent(QCloseEvent *event);
+       virtual void keyPressEvent(QKeyEvent *e);
+       virtual bool event(QEvent *e);
+
+       const bool m_betaUpdates;
 
 private:
-       bool tryUpdateMirror(UpdateInfo *updateInfo, const QString &url);
-       bool getFile(const QString &url, const QString &outFile);
-       bool checkSignature(const QString &file, const QString &signature);
-       bool parseVersionInfo(const QString &file, UpdateInfo *updateInfo);
-
-       UpdateInfo *m_updateInfo;
-       QStringList *m_logFile;
-       SettingsModel *m_settings;
-       
-       const QString m_binaryWGet;
+       Ui::UpdateDialog *const ui; //for Qt UIC
+       const SettingsModel *const m_settings;
+
+       const QString m_binaryCurl;
        const QString m_binaryGnuPG;
-       const QString m_binaryUpdater;
        const QString m_binaryKeys;
+       const QString m_binaryUpdater;
+
+       QScopedPointer<MUtils::Taskbar7> m_taskbar;
+       QScopedPointer<MUtils::UpdateChecker> m_thread;
+       QScopedPointer<QStringList> m_logFile;
+       QScopedPointer<QMovie> m_animator;
+
+       unsigned long m_updaterProcess;
 
        bool m_success;
+       bool m_haveNewVersion;
+       bool m_updateReadyToInstall;
+       bool m_firstShow;
+       
+       void testKnownHosts(void);
+
 };