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,7 +369,27 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QFrame" name="frameAnimation">
<property name="lineWidth">
<number>0</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7"> <layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="margin">
<number>0</number>
</property>
<item> <item>
<spacer name="horizontalSpacer_6"> <spacer name="horizontalSpacer_6">
<property name="orientation"> <property name="orientation">
@ -419,7 +423,7 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>3</width> <width>5</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -445,7 +449,7 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>3</width> <width>5</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -475,6 +479,7 @@
</spacer> </spacer>
</item> </item>
</layout> </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))
#define SHOW_ANIMATION(FLAG) do \ /*
{ \
ui->labelLoadingLeft->setVisible((FLAG)); \ ui->labelLoadingLeft->setVisible((FLAG)); \
ui->labelLoadingCenter->setVisible((FLAG)); \ ui->labelLoadingCenter->setVisible((FLAG)); \
ui->labelLoadingRight->setVisible((FLAG)); \ ui->labelLoadingRight->setVisible((FLAG)); \
ui->labelBuildNo->setVisible(!(FLAG)); \ */
#define SHOW_ANIMATION(FLAG) do \
{ \
ui->frameAnimation->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)