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>
</property>
<property name="text">
<string>Check for Updates</string>
<string>Check for new Updates</string>
</property>
</action>
</widget>

View File

@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>458</width>
<height>255</height>
<width>410</width>
<height>273</height>
</rect>
</property>
<property name="palette">
@ -78,510 +78,533 @@
</palette>
</property>
<property name="windowTitle">
<string>Autoupdate</string>
<string>Web-Update</string>
</property>
<property name="windowIcon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/update.png</normaloff>:/buttons/update.png</iconset>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="logo">
<property name="minimumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>80</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/images/update.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="logo">
<property name="minimumSize">
<size>
<width>72</width>
<height>72</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>72</width>
<height>72</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/images/update.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
<width>32</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<spacer name="verticalSpacer_3">
<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>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="icon_phase1">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/clock.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_phase1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Check Internet connection</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_4">
<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>10</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="icon_phase2">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/clock.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_phase2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Download update-information from web-server</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_5">
<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>10</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="icon_phase3">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/clock.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_phase3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Examine the installed version</string>
</property>
</widget>
</item>
</layout>
</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>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelLoadingLeft">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/transmit.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelLoadingCenter">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/images/loading.gif</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelLoadingRight">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/computer.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="labelInfo">
<property name="text">
<string>More information available at:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelUrl">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>http://www.example.com/update_info.html</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::HLine</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>18</width>
<height>20</height>
</size>
</property>
</spacer>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<spacer name="verticalSpacer_3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>6</height>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="icon_phase1">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/hourglass.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_phase1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Check Internet connection</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<widget class="QPushButton" name="buttonDownload">
<property name="minimumSize">
<size>
<width>20</width>
<height>6</height>
<width>128</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="icon_phase2">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/hourglass.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_phase2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Download update-information from web-server</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_5">
<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>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="icon_phase3">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/hourglass.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_phase3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Examine the installed version</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelLoadingLeft">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/update.png</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelLoadingCenter">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/images/loading.gif</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelLoadingRight">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/resources.qrc">:/buttons/setup.png</pixmap>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="labelInfo">
<property name="text">
<string>Info:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelUrl">
<property name="palette">
<palette>
<active>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="WindowText">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>120</red>
<green>120</green>
<blue>120</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="font">
<font>
<underline>true</underline>
</font>
</property>
<property name="text">
<string>http://www.example.com/info.hmtl</string>
<string>Download &amp;&amp; Install</string>
</property>
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/shield_admin.png</normaloff>:/buttons/shield_admin.png</iconset>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<widget class="QPushButton" name="buttonRetry">
<property name="minimumSize">
<size>
<width>20</width>
<height>40</height>
<width>88</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::HLine</enum>
<property name="text">
<string>Retry</string>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/restart.png</normaloff>:/buttons/restart.png</iconset>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonDownload">
<property name="minimumSize">
<size>
<width>128</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Download &amp; Install</string>
</property>
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/shield_admin.png</normaloff>:/buttons/shield_admin.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="minimumSize">
<size>
<width>88</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Retry</string>
</property>
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/restart.png</normaloff>:/buttons/restart.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonCancel">
<property name="minimumSize">
<size>
<width>88</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Cancel</string>
</property>
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/cross.png</normaloff>:/buttons/cross.png</iconset>
</property>
</widget>
</item>
</layout>
<widget class="QPushButton" name="buttonCancel">
<property name="minimumSize">
<size>
<width>88</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Discard</string>
</property>
<property name="icon">
<iconset resource="../res/resources.qrc">
<normaloff>:/buttons/cross.png</normaloff>:/buttons/cross.png</iconset>
</property>
</widget>
</item>
</layout>
</item>

View File

@ -7,9 +7,11 @@
<file>buttons/bomb.png</file>
<file>buttons/book_open.png</file>
<file>buttons/cancel.png</file>
<file>buttons/clock.png</file>
<file>buttons/clock_pause.png</file>
<file>buttons/clock_play.png</file>
<file>buttons/clock_stop.png</file>
<file>buttons/computer.png</file>
<file>buttons/control_pause.png</file>
<file>buttons/cross.png</file>
<file>buttons/disk.png</file>
@ -34,7 +36,11 @@
<file>buttons/restart.png</file>
<file>buttons/setup.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/transmit.png</file>
<file>buttons/trash.png</file>
<file>buttons/update.png</file>
<file>buttons/world_link.png</file>

View File

@ -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

View File

@ -23,6 +23,27 @@
#include "uic_win_updater.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
@ -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;
}
}

View File

@ -23,6 +23,8 @@
#include <QDialog>
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;
};