Some improvements to the updater dialog.

This commit is contained in:
LoRd_MuldeR 2013-11-23 15:20:07 +01:00
parent e860efa3e0
commit 50bd16dc80
6 changed files with 625 additions and 460 deletions

View File

@ -652,7 +652,7 @@
<normaloff>:/buttons/update.png</normaloff>:/buttons/update.png</iconset> <normaloff>:/buttons/update.png</normaloff>:/buttons/update.png</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Check for Updates</string> <string>Check for new Updates</string>
</property> </property>
</action> </action>
</widget> </widget>

View File

@ -9,8 +9,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>458</width> <width>410</width>
<height>255</height> <height>273</height>
</rect> </rect>
</property> </property>
<property name="palette"> <property name="palette">
@ -78,13 +78,18 @@
</palette> </palette>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Autoupdate</string> <string>Web-Update</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="../res/resources.qrc"> <iconset resource="../res/resources.qrc">
<normaloff>:/buttons/update.png</normaloff>:/buttons/update.png</iconset> <normaloff>:/buttons/update.png</normaloff>:/buttons/update.png</iconset>
</property> </property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -93,14 +98,14 @@
<widget class="QLabel" name="logo"> <widget class="QLabel" name="logo">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>72</width>
<height>80</height> <height>72</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>80</width> <width>72</width>
<height>80</height> <height>72</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
@ -139,7 +144,7 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>18</width> <width>32</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -183,7 +188,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/hourglass.png</pixmap> <pixmap resource="../res/resources.qrc">:/buttons/clock.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
@ -229,7 +234,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>6</height> <height>10</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -254,7 +259,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/hourglass.png</pixmap> <pixmap resource="../res/resources.qrc">:/buttons/clock.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
@ -300,7 +305,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>6</height> <height>10</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -325,7 +330,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/hourglass.png</pixmap> <pixmap resource="../res/resources.qrc">:/buttons/clock.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
@ -360,6 +365,22 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>6</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<spacer name="verticalSpacer_6"> <spacer name="verticalSpacer_6">
<property name="orientation"> <property name="orientation">
@ -383,7 +404,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>40</width>
<height>20</height> <height>0</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -394,7 +415,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/update.png</pixmap> <pixmap resource="../res/resources.qrc">:/buttons/transmit.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
@ -414,7 +435,7 @@
<string/> <string/>
</property> </property>
<property name="pixmap"> <property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/setup.png</pixmap> <pixmap resource="../res/resources.qrc">:/buttons/computer.png</pixmap>
</property> </property>
</widget> </widget>
</item> </item>
@ -426,7 +447,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>40</width>
<height>20</height> <height>0</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -436,7 +457,7 @@
<item> <item>
<widget class="QLabel" name="labelInfo"> <widget class="QLabel" name="labelInfo">
<property name="text"> <property name="text">
<string>Info:</string> <string>More information available at:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -485,7 +506,7 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>http://www.example.com/info.hmtl</string> <string>http://www.example.com/update_info.html</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -505,6 +526,10 @@
</property> </property>
</spacer> </spacer>
</item> </item>
</layout>
</item>
</layout>
</item>
<item> <item>
<widget class="QFrame" name="frame"> <widget class="QFrame" name="frame">
<property name="frameShape"> <property name="frameShape">
@ -539,7 +564,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Download &amp; Install</string> <string>Download &amp;&amp; Install</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../res/resources.qrc"> <iconset resource="../res/resources.qrc">
@ -548,7 +573,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="pushButton"> <widget class="QPushButton" name="buttonRetry">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>88</width> <width>88</width>
@ -573,7 +598,7 @@
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>Cancel</string> <string>Discard</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../res/resources.qrc"> <iconset resource="../res/resources.qrc">
@ -586,8 +611,6 @@
</layout> </layout>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
<resources> <resources>
<include location="../res/resources.qrc"/> <include location="../res/resources.qrc"/>

View File

@ -7,9 +7,11 @@
<file>buttons/bomb.png</file> <file>buttons/bomb.png</file>
<file>buttons/book_open.png</file> <file>buttons/book_open.png</file>
<file>buttons/cancel.png</file> <file>buttons/cancel.png</file>
<file>buttons/clock.png</file>
<file>buttons/clock_pause.png</file> <file>buttons/clock_pause.png</file>
<file>buttons/clock_play.png</file> <file>buttons/clock_play.png</file>
<file>buttons/clock_stop.png</file> <file>buttons/clock_stop.png</file>
<file>buttons/computer.png</file>
<file>buttons/control_pause.png</file> <file>buttons/control_pause.png</file>
<file>buttons/cross.png</file> <file>buttons/cross.png</file>
<file>buttons/disk.png</file> <file>buttons/disk.png</file>
@ -34,7 +36,11 @@
<file>buttons/restart.png</file> <file>buttons/restart.png</file>
<file>buttons/setup.png</file> <file>buttons/setup.png</file>
<file>buttons/shield_admin.png</file> <file>buttons/shield_admin.png</file>
<file>buttons/shield_error.png</file>
<file>buttons/shield_exclamation.png</file>
<file>buttons/shield_green.png</file>
<file>buttons/suspended.png</file> <file>buttons/suspended.png</file>
<file>buttons/transmit.png</file>
<file>buttons/trash.png</file> <file>buttons/trash.png</file>
<file>buttons/update.png</file> <file>buttons/update.png</file>
<file>buttons/world_link.png</file> <file>buttons/world_link.png</file>

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 2 #define VER_X264_MINOR 2
#define VER_X264_PATCH 7 #define VER_X264_PATCH 7
#define VER_X264_BUILD 642 #define VER_X264_BUILD 665
#define VER_X264_MINIMUM_REV 2363 #define VER_X264_MINIMUM_REV 2363
#define VER_X264_CURRENT_API 140 #define VER_X264_CURRENT_API 140

View File

@ -23,6 +23,27 @@
#include "uic_win_updater.h" #include "uic_win_updater.h"
#include "global.h" #include "global.h"
#include "checksum.h"
#include <QMovie>
#include <QCloseEvent>
#include <QTimer>
///////////////////////////////////////////////////////////////////////////////
#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 // Constructor & Destructor
@ -31,18 +52,49 @@
UpdaterDialog::UpdaterDialog(QWidget *parent) UpdaterDialog::UpdaterDialog(QWidget *parent)
: :
QDialog(parent), QDialog(parent),
ui(new Ui::UpdaterDialog()) ui(new Ui::UpdaterDialog()),
m_state(0),
m_firstShow(true)
{ {
//Init the dialog, from the .ui file //Init the dialog, from the .ui file
ui->setupUi(this); ui->setupUi(this);
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint)); setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
//Fix size //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) UpdaterDialog::~UpdaterDialog(void)
{ {
X264_DELETE(m_animator);
delete ui; delete ui;
} }
@ -54,11 +106,81 @@ UpdaterDialog::~UpdaterDialog(void)
// Events // 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 // 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;
}
}

View File

@ -23,6 +23,8 @@
#include <QDialog> #include <QDialog>
class QMovie;
namespace Ui namespace Ui
{ {
class UpdaterDialog; class UpdaterDialog;
@ -36,6 +38,18 @@ public:
UpdaterDialog(QWidget *parent); UpdaterDialog(QWidget *parent);
~UpdaterDialog(void); ~UpdaterDialog(void);
protected:
virtual void showEvent(QShowEvent *event);
virtual void closeEvent(QCloseEvent *e);
private slots:
void initUpdate(void);
void updateState(void);
private: private:
Ui::UpdaterDialog *const ui; Ui::UpdaterDialog *const ui;
bool m_firstShow;
QMovie *m_animator;
int m_state;
}; };