diff --git a/gui/win_main.ui b/gui/win_main.ui index b894a09..5720f72 100644 --- a/gui/win_main.ui +++ b/gui/win_main.ui @@ -652,7 +652,7 @@ :/buttons/update.png:/buttons/update.png - Check for Updates + Check for new Updates diff --git a/gui/win_updater.ui b/gui/win_updater.ui index 3df22ac..db97974 100644 --- a/gui/win_updater.ui +++ b/gui/win_updater.ui @@ -9,8 +9,8 @@ 0 0 - 458 - 255 + 410 + 273 @@ -78,510 +78,533 @@ - Autoupdate + Web-Update :/buttons/update.png:/buttons/update.png + + true + - + - + - - - - 80 - 80 - - - - - 80 - 80 - - - - - - - :/images/update.png - - - true - - + + + + + + 72 + 72 + + + + + 72 + 72 + + + + + + + :/images/update.png + + + true + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + - + - Qt::Vertical + Qt::Horizontal + + + QSizePolicy::Fixed - 0 - 0 + 32 + 20 + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 6 + + + + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + + + + :/buttons/clock.png + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + + 0 + 0 + + + + Check Internet connection + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + + + + :/buttons/clock.png + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + + 0 + 0 + + + + Download update-information from web-server + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + + + 16 + 16 + + + + + 16 + 16 + + + + + + + :/buttons/clock.png + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + + 0 + 0 + + + + Examine the installed version + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 6 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 0 + + + + + + + + + + + :/buttons/transmit.png + + + + + + + + + + :/images/loading.gif + + + + + + + + + + :/buttons/computer.png + + + + + + + Qt::Horizontal + + + + 40 + 0 + + + + + + + + + + More information available at: + + + + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 0 + 0 + 255 + + + + + + + + + 120 + 120 + 120 + + + + + + + + + true + + + + http://www.example.com/update_info.html + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + - - - Qt::Horizontal + + + QFrame::HLine - - QSizePolicy::Fixed + + QFrame::Raised - - - 18 - 20 - - - + - + - + - Qt::Vertical - - - QSizePolicy::Fixed + Qt::Horizontal - 20 - 6 + 40 + 20 - - - - - - 16 - 16 - - - - - 16 - 16 - - - - - - - :/buttons/hourglass.png - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - 0 - 0 - - - - Check Internet connection - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - + + - 20 - 6 + 128 + 0 - - - - - - - - - 16 - 16 - - - - - 16 - 16 - - - - - - - :/buttons/hourglass.png - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - 0 - 0 - - - - Download update-information from web-server - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 6 - - - - - - - - - - - 16 - 16 - - - - - 16 - 16 - - - - - - - :/buttons/hourglass.png - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - 0 - 0 - - - - Examine the installed version - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - :/buttons/update.png - - - - - - - - - - :/images/loading.gif - - - - - - - - - - :/buttons/setup.png - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Info: - - - - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 0 - 0 - 255 - - - - - - - - - 120 - 120 - 120 - - - - - - - - - true - - - http://www.example.com/info.hmtl + Download && Install + + + + :/buttons/shield_admin.png:/buttons/shield_admin.png - - - Qt::Vertical - - - QSizePolicy::Expanding - - + + - 20 - 40 + 88 + 0 - - - - - - QFrame::HLine + + Retry - - QFrame::Raised + + + :/buttons/restart.png:/buttons/restart.png - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 128 - 0 - - - - Download & Install - - - - :/buttons/shield_admin.png:/buttons/shield_admin.png - - - - - - - - 88 - 0 - - - - Retry - - - - :/buttons/restart.png:/buttons/restart.png - - - - - - - - 88 - 0 - - - - Cancel - - - - :/buttons/cross.png:/buttons/cross.png - - - - + + + + 88 + 0 + + + + Discard + + + + :/buttons/cross.png:/buttons/cross.png + + diff --git a/res/resources.qrc b/res/resources.qrc index 20c517f..b66230e 100644 --- a/res/resources.qrc +++ b/res/resources.qrc @@ -7,9 +7,11 @@ buttons/bomb.png buttons/book_open.png buttons/cancel.png + buttons/clock.png buttons/clock_pause.png buttons/clock_play.png buttons/clock_stop.png + buttons/computer.png buttons/control_pause.png buttons/cross.png buttons/disk.png @@ -34,7 +36,11 @@ buttons/restart.png buttons/setup.png buttons/shield_admin.png + buttons/shield_error.png + buttons/shield_exclamation.png + buttons/shield_green.png buttons/suspended.png + buttons/transmit.png buttons/trash.png buttons/update.png buttons/world_link.png diff --git a/src/version.h b/src/version.h index 9b8951b..53efe10 100644 --- a/src/version.h +++ b/src/version.h @@ -26,7 +26,7 @@ #define VER_X264_MAJOR 2 #define VER_X264_MINOR 2 #define VER_X264_PATCH 7 -#define VER_X264_BUILD 642 +#define VER_X264_BUILD 665 #define VER_X264_MINIMUM_REV 2363 #define VER_X264_CURRENT_API 140 diff --git a/src/win_updater.cpp b/src/win_updater.cpp index cfa0cb8..b300a51 100644 --- a/src/win_updater.cpp +++ b/src/win_updater.cpp @@ -23,6 +23,27 @@ #include "uic_win_updater.h" #include "global.h" +#include "checksum.h" + +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////////// + +#define UPDATE_TEXT(N, TEXT) ui->label_phase##N->setText((TEXT)) +#define UPDATE_ICON(N, ICON) ui->icon_phase##N->setPixmap(QIcon(":/buttons/" ICON ".png").pixmap(16, 16)) + +#define SHOW_ANIMATION(FLAG) do \ +{ \ + ui->labelLoadingLeft->setVisible((FLAG)); \ + ui->labelLoadingCenter->setVisible((FLAG)); \ + ui->labelLoadingRight->setVisible((FLAG)); \ + ui->labelInfo->setVisible(!(FLAG)); \ + ui->labelUrl->setVisible(!(FLAG)); \ +} \ +while(0) + /////////////////////////////////////////////////////////////////////////////// // Constructor & Destructor @@ -31,18 +52,49 @@ UpdaterDialog::UpdaterDialog(QWidget *parent) : QDialog(parent), - ui(new Ui::UpdaterDialog()) + ui(new Ui::UpdaterDialog()), + m_state(0), + m_firstShow(true) { //Init the dialog, from the .ui file ui->setupUi(this); setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); //Fix size - setMinimumSize(size()); + setFixedSize(size()); + + //Init animation + m_animator = new QMovie(":/images/loading.gif"); + ui->labelLoadingCenter->setMovie(m_animator); + m_animator->start(); + + //Init buttons + ui->buttonCancel->setEnabled(false); + ui->buttonRetry->hide(); + ui->buttonDownload->hide(); + + //Hide labels + ui->labelInfo->hide(); + ui->labelUrl->hide(); + + //TEST + QBlake2Checksum checksum; + checksum.update("The quick brown fox jumps over the lazy dog"); + qWarning("Result: %s\n", checksum.finalize().constData()); + + //TEST + QBlake2Checksum checksum2; + QFile file(""); + if(file.open(QIODevice::ReadOnly)) + { + checksum2.update(file); + qWarning("Result: %s\n", checksum2.finalize().constData()); + } } UpdaterDialog::~UpdaterDialog(void) { + X264_DELETE(m_animator); delete ui; } @@ -54,11 +106,81 @@ UpdaterDialog::~UpdaterDialog(void) // Events /////////////////////////////////////////////////////////////////////////////// -/*None*/ +void UpdaterDialog::showEvent(QShowEvent *event) +{ + if(m_firstShow) + { + m_firstShow = false; + QTimer::singleShot(0, this, SLOT(initUpdate())); + } +} + +void UpdaterDialog::closeEvent(QCloseEvent *e) +{ + if(!ui->buttonCancel->isEnabled()) + { + e->ignore(); + } +} /////////////////////////////////////////////////////////////////////////////// // Slots /////////////////////////////////////////////////////////////////////////////// -/*None*/ +void UpdaterDialog::initUpdate(void) +{ + //Restet text + ui->retranslateUi(this); + //Init buttons + ui->buttonCancel->setEnabled(false); + ui->buttonRetry->hide(); + ui->buttonDownload->hide(); + + //Hide labels + ui->labelInfo->hide(); + ui->labelUrl->hide(); + + //Reset icons + UPDATE_ICON(1, "clock"); + UPDATE_ICON(2, "clock"); + UPDATE_ICON(3, "clock"); + + //Show animation + SHOW_ANIMATION(true); + + //Begin updater test run + m_state = 0; + QTimer::singleShot(333, this, SLOT(updateState())); +} + +void UpdaterDialog::updateState(void) +{ + switch(m_state++) + { + case 0: + UPDATE_ICON(1, "play"); + QTimer::singleShot(6666, this, SLOT(updateState())); + break; + case 1: + UPDATE_ICON(1, "shield_green"); + UPDATE_TEXT(1, tr("Internet connection is working.")); + UPDATE_ICON(2, "play"); + QTimer::singleShot(6666, this, SLOT(updateState())); + break; + case 2: + UPDATE_ICON(2, "shield_green"); + UPDATE_TEXT(2, tr("Update-information was received successfully.")); + UPDATE_ICON(3, "play"); + QTimer::singleShot(6666, this, SLOT(updateState())); + break; + case 3: + UPDATE_ICON(3, "shield_exclamation"); + UPDATE_TEXT(3, tr("A newer version is available!")); + QTimer::singleShot(6666, this, SLOT(updateState())); + SHOW_ANIMATION(false); + ui->buttonCancel->setEnabled(true); + ui->buttonDownload->show(); + break; + } +} diff --git a/src/win_updater.h b/src/win_updater.h index 4d4c54d..a68f481 100644 --- a/src/win_updater.h +++ b/src/win_updater.h @@ -23,6 +23,8 @@ #include +class QMovie; + namespace Ui { class UpdaterDialog; @@ -36,6 +38,18 @@ public: UpdaterDialog(QWidget *parent); ~UpdaterDialog(void); +protected: + virtual void showEvent(QShowEvent *event); + virtual void closeEvent(QCloseEvent *e); + +private slots: + void initUpdate(void); + void updateState(void); + private: Ui::UpdaterDialog *const ui; + + bool m_firstShow; + QMovie *m_animator; + int m_state; };