Some fixes for updater dialog.

This commit is contained in:
LoRd_MuldeR 2013-12-16 22:58:21 +01:00
parent 7ab5a7eb64
commit 8420e7e311
2 changed files with 139 additions and 122 deletions

View File

@ -9,7 +9,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>428</width> <width>418</width>
<height>247</height> <height>247</height>
</rect> </rect>
</property> </property>
@ -355,22 +355,6 @@
</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>8</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<spacer name="verticalSpacer_6"> <spacer name="verticalSpacer_6">
<property name="orientation"> <property name="orientation">
@ -385,96 +369,117 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_7"> <spacer name="verticalSpacer_8">
<item> <property name="orientation">
<spacer name="horizontalSpacer_6"> <enum>Qt::Vertical</enum>
<property name="orientation"> </property>
<enum>Qt::Horizontal</enum> <property name="sizeHint" stdset="0">
</property> <size>
<property name="sizeHint" stdset="0"> <width>20</width>
<size> <height>0</height>
<width>40</width> </size>
<height>0</height> </property>
</size> </spacer>
</property> </item>
</spacer> <item>
</item> <widget class="QFrame" name="frameAnimation">
<item> <property name="lineWidth">
<widget class="QLabel" name="labelLoadingLeft"> <number>0</number>
<property name="text"> </property>
<string/> <layout class="QHBoxLayout" name="horizontalLayout_7">
</property> <property name="margin">
<property name="pixmap"> <number>0</number>
<pixmap resource="../res/resources.qrc">:/buttons/transmit.png</pixmap> </property>
</property> <item>
</widget> <spacer name="horizontalSpacer_6">
</item> <property name="orientation">
<item> <enum>Qt::Horizontal</enum>
<spacer name="horizontalSpacer_8"> </property>
<property name="orientation"> <property name="sizeHint" stdset="0">
<enum>Qt::Horizontal</enum> <size>
</property> <width>40</width>
<property name="sizeType"> <height>0</height>
<enum>QSizePolicy::Fixed</enum> </size>
</property> </property>
<property name="sizeHint" stdset="0"> </spacer>
<size> </item>
<width>3</width> <item>
<height>20</height> <widget class="QLabel" name="labelLoadingLeft">
</size> <property name="text">
</property> <string/>
</spacer> </property>
</item> <property name="pixmap">
<item> <pixmap resource="../res/resources.qrc">:/buttons/transmit.png</pixmap>
<widget class="QLabel" name="labelLoadingCenter"> </property>
<property name="text"> </widget>
<string/> </item>
</property> <item>
<property name="pixmap"> <spacer name="horizontalSpacer_8">
<pixmap resource="../res/resources.qrc">:/images/loading.gif</pixmap> <property name="orientation">
</property> <enum>Qt::Horizontal</enum>
</widget> </property>
</item> <property name="sizeType">
<item> <enum>QSizePolicy::Fixed</enum>
<spacer name="horizontalSpacer_9"> </property>
<property name="orientation"> <property name="sizeHint" stdset="0">
<enum>Qt::Horizontal</enum> <size>
</property> <width>5</width>
<property name="sizeType"> <height>20</height>
<enum>QSizePolicy::Fixed</enum> </size>
</property> </property>
<property name="sizeHint" stdset="0"> </spacer>
<size> </item>
<width>3</width> <item>
<height>20</height> <widget class="QLabel" name="labelLoadingCenter">
</size> <property name="text">
</property> <string/>
</spacer> </property>
</item> <property name="pixmap">
<item> <pixmap resource="../res/resources.qrc">:/images/loading.gif</pixmap>
<widget class="QLabel" name="labelLoadingRight"> </property>
<property name="text"> </widget>
<string/> </item>
</property> <item>
<property name="pixmap"> <spacer name="horizontalSpacer_9">
<pixmap resource="../res/resources.qrc">:/buttons/computer.png</pixmap> <property name="orientation">
</property> <enum>Qt::Horizontal</enum>
</widget> </property>
</item> <property name="sizeType">
<item> <enum>QSizePolicy::Fixed</enum>
<spacer name="horizontalSpacer_7"> </property>
<property name="orientation"> <property name="sizeHint" stdset="0">
<enum>Qt::Horizontal</enum> <size>
</property> <width>5</width>
<property name="sizeHint" stdset="0"> <height>20</height>
<size> </size>
<width>40</width> </property>
<height>0</height> </spacer>
</size> </item>
</property> <item>
</spacer> <widget class="QLabel" name="labelLoadingRight">
</item> <property name="text">
</layout> <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>
</widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="labelBuildNo"> <widget class="QLabel" name="labelBuildNo">
@ -494,13 +499,10 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>10</height> <height>0</height>
</size> </size>
</property> </property>
</spacer> </spacer>

View File

@ -42,14 +42,18 @@
#define UPDATE_TEXT(N, TEXT) ui->label_phase##N->setText((TEXT)) #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 UPDATE_ICON(N, ICON) ui->icon_phase##N->setPixmap(QIcon(":/buttons/" ICON ".png").pixmap(16, 16))
/*
ui->labelLoadingLeft->setVisible((FLAG)); \
ui->labelLoadingCenter->setVisible((FLAG)); \
ui->labelLoadingRight->setVisible((FLAG)); \
*/
#define SHOW_ANIMATION(FLAG) do \ #define SHOW_ANIMATION(FLAG) do \
{ \ { \
ui->labelLoadingLeft->setVisible((FLAG)); \ ui->frameAnimation->setVisible((FLAG)); \
ui->labelLoadingCenter->setVisible((FLAG)); \
ui->labelLoadingRight->setVisible((FLAG)); \
ui->labelBuildNo->setVisible(!(FLAG)); \
ui->labelInfo->setVisible(!(FLAG)); \ ui->labelInfo->setVisible(!(FLAG)); \
ui->labelUrl->setVisible(!(FLAG)); \ ui->labelUrl->setVisible(!(FLAG)); \
ui->labelBuildNo->setVisible(!(FLAG)); \
if((FLAG)) m_animator->start(); else m_animator->stop(); \ if((FLAG)) m_animator->start(); else m_animator->stop(); \
} \ } \
while(0) while(0)
@ -88,17 +92,14 @@ UpdaterDialog::UpdaterDialog(QWidget *parent, const QString &binDir)
//Init animation //Init animation
m_animator = new QMovie(":/images/loading.gif"); m_animator = new QMovie(":/images/loading.gif");
ui->labelLoadingCenter->setMovie(m_animator); ui->labelLoadingCenter->setMovie(m_animator);
m_animator->start();
//Init buttons //Init buttons
ui->buttonCancel->setEnabled(false); ui->buttonCancel->setEnabled(false);
ui->buttonRetry->hide(); ui->buttonRetry->hide();
ui->buttonDownload->hide(); ui->buttonDownload->hide();
//Hide labels //Start animation
ui->labelInfo->hide(); SHOW_ANIMATION(true);
ui->labelUrl->hide();
ui->labelBuildNo->hide();
} }
UpdaterDialog::~UpdaterDialog(void) UpdaterDialog::~UpdaterDialog(void)
@ -192,8 +193,21 @@ void UpdaterDialog::initUpdate(void)
{ {
ui->buttonCancel->setEnabled(true); ui->buttonCancel->setEnabled(true);
QMessageBox::critical(this, tr("File Error"), tr("At least one file required by web-update is missing or corrupted.<br>Please re-install this application and then try again!")); QMessageBox::critical(this, tr("File Error"), tr("At least one file required by web-update is missing or corrupted.<br>Please re-install this application and then try again!"));
close(); close(); return;
return; }
//Make sure user does have admin access
if(!x264_user_is_admin())
{
qWarning("User is not in the \"admin\" group, cannot update!");
QString message;
message += QString("<nobr>%1</nobr><br>").arg(tr("Sorry, but only users in the \"Administrators\" group can install updates."));
message += QString("<nobr>%1</nobr>").arg(tr("Please start application from an administrator account and try again!"));
if(QMessageBox::critical(this, this->windowTitle(), message, tr("Discard"), tr("Ignore")) != 1)
{
ui->buttonCancel->setEnabled(true);
close(); return;
}
} }
//Create and setup thread //Create and setup thread
@ -464,6 +478,7 @@ bool UpdaterDialog::checkBinaries(QString &wgetBin, QString &gpgvBin)
{ {
binaries.insert(FILE_INFO[i].name, binPath); binaries.insert(FILE_INFO[i].name, binPath);
} }
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
} }
if(okay) if(okay)