Some improvements to Working Banner: Now use a pointer member variable for the UI. Also update Taskbar progress indicator.

This commit is contained in:
LoRd_MuldeR 2013-11-25 13:58:21 +01:00
parent f3ae451b32
commit f641ddd9f0
7 changed files with 48 additions and 23 deletions

View File

@ -3476,12 +3476,12 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/Dialog_Update.cpp" line="423"/> <location filename="../../src/Dialog_Update.cpp" line="424"/>
<source>Update ready to install. Applicaion will quit...</source> <source>Update ready to install. Applicaion will quit...</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../../src/Dialog_Update.cpp" line="431"/> <location filename="../../src/Dialog_Update.cpp" line="432"/>
<source>Update failed. Please try again or download manually!</source> <source>Update failed. Please try again or download manually!</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>

View File

@ -3513,12 +3513,12 @@
<translation type="unfinished">Pobieranie aktualizacji w toku, prosze czekać...</translation> <translation type="unfinished">Pobieranie aktualizacji w toku, prosze czekać...</translation>
</message> </message>
<message> <message>
<location filename="../../src/Dialog_Update.cpp" line="423"/> <location filename="../../src/Dialog_Update.cpp" line="424"/>
<source>Update ready to install. Applicaion will quit...</source> <source>Update ready to install. Applicaion will quit...</source>
<translation type="unfinished">Aktualizacja gotowa do instalacji. Teraz program zostanie zamknięty...</translation> <translation type="unfinished">Aktualizacja gotowa do instalacji. Teraz program zostanie zamknięty...</translation>
</message> </message>
<message> <message>
<location filename="../../src/Dialog_Update.cpp" line="431"/> <location filename="../../src/Dialog_Update.cpp" line="432"/>
<source>Update failed. Please try again or download manually!</source> <source>Update failed. Please try again or download manually!</source>
<translation type="unfinished">Aktualizacja zakończona niepowodzeniem. Prosze spróbować ponownie lub zainstalować ręcznie!</translation> <translation type="unfinished">Aktualizacja zakończona niepowodzeniem. Prosze spróbować ponownie lub zainstalować ręcznie!</translation>
</message> </message>

View File

@ -3496,12 +3496,12 @@
<translation>Uppdatering laddas ner, vänta...</translation> <translation>Uppdatering laddas ner, vänta...</translation>
</message> </message>
<message> <message>
<location filename="../../src/Dialog_Update.cpp" line="423"/> <location filename="../../src/Dialog_Update.cpp" line="424"/>
<source>Update ready to install. Applicaion will quit...</source> <source>Update ready to install. Applicaion will quit...</source>
<translation>Uppdatering klar att installeras. Programmet kommer att avslutas...</translation> <translation>Uppdatering klar att installeras. Programmet kommer att avslutas...</translation>
</message> </message>
<message> <message>
<location filename="../../src/Dialog_Update.cpp" line="431"/> <location filename="../../src/Dialog_Update.cpp" line="432"/>
<source>Update failed. Please try again or download manually!</source> <source>Update failed. Please try again or download manually!</source>
<translation>Uppdateringen misslyckades. Försök igen, eller ladda ner manuellt!</translation> <translation>Uppdateringen misslyckades. Försök igen, eller ladda ner manuellt!</translation>
</message> </message>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -35,7 +35,7 @@
#define VER_LAMEXP_MINOR_LO 9 #define VER_LAMEXP_MINOR_LO 9
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 8 #define VER_LAMEXP_PATCH 8
#define VER_LAMEXP_BUILD 1473 #define VER_LAMEXP_BUILD 1475
#define VER_LAMEXP_CONFG 1348 #define VER_LAMEXP_CONFG 1348
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -21,6 +21,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#include "Dialog_WorkingBanner.h" #include "Dialog_WorkingBanner.h"
#include "../tmp/UIC_WorkingBanner.h"
#include "Global.h" #include "Global.h"
#include "WinSevenTaskbar.h" #include "WinSevenTaskbar.h"
@ -75,16 +76,16 @@ static inline void UPDATE_MARGINS(QWidget *control, int l = 0, int r = 0, int t
WorkingBanner::WorkingBanner(QWidget *parent) WorkingBanner::WorkingBanner(QWidget *parent)
: :
QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint), QDialog(parent, Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint),
m_metrics(NULL), m_working(NULL) ui(new Ui::WorkingBanner()), m_metrics(NULL), m_working(NULL)
{ {
//Init the dialog, from the .ui file //Init the dialog, from the .ui file
setupUi(this); ui->setupUi(this);
setModal(true); setModal(true);
//Enable the "sheet of glass" effect //Enable the "sheet of glass" effect
if(lamexp_sheet_of_glass(this)) if(lamexp_sheet_of_glass(this))
{ {
SET_TEXT_COLOR(labelStatus, lamexp_system_color(lamexp_syscolor_caption)); SET_TEXT_COLOR(ui->labelStatus, lamexp_system_color(lamexp_syscolor_caption));
} }
else else
{ {
@ -92,7 +93,7 @@ WorkingBanner::WorkingBanner(QWidget *parent)
m_working = new QMovie(":/images/Busy.gif"); m_working = new QMovie(":/images/Busy.gif");
m_working->setSpeed(75); m_working->setSpeed(75);
m_working->setCacheMode(QMovie::CacheAll); m_working->setCacheMode(QMovie::CacheAll);
labelWorking->setMovie(m_working); ui->labelWorking->setMovie(m_working);
m_working->start(); m_working->start();
} }
@ -103,7 +104,7 @@ WorkingBanner::WorkingBanner(QWidget *parent)
setCursor(Qt::WaitCursor); setCursor(Qt::WaitCursor);
//Clear label //Clear label
labelStatus->clear(); ui->labelStatus->clear();
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -119,6 +120,7 @@ WorkingBanner::~WorkingBanner(void)
} }
LAMEXP_DELETE(m_metrics); LAMEXP_DELETE(m_metrics);
delete ui;
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -134,8 +136,9 @@ void WorkingBanner::show(const QString &text)
setText(text); setText(text);
//Reset progress //Reset progress
progressBar->setMaximum(0); ui->progressBar->setMinimum(0);
progressBar->setValue(-1); ui->progressBar->setMaximum(0);
ui->progressBar->setValue(-1);
} }
void WorkingBanner::show(const QString &text, QThread *thread) void WorkingBanner::show(const QString &text, QThread *thread)
@ -249,34 +252,47 @@ void WorkingBanner::setText(const QString &text)
{ {
if(!m_metrics) if(!m_metrics)
{ {
m_metrics = new QFontMetrics(labelStatus->font()); m_metrics = new QFontMetrics(ui->labelStatus->font());
} }
if(m_metrics->width(text) <= labelStatus->width() - 8) if(m_metrics->width(text) <= ui->labelStatus->width() - 8)
{ {
labelStatus->setText(text); ui->labelStatus->setText(text);
} }
else else
{ {
QString choppedText = text.simplified().append("..."); QString choppedText = text.simplified().append("...");
while((m_metrics->width(choppedText) > labelStatus->width() - 8) && (choppedText.length() > 8)) while((m_metrics->width(choppedText) > ui->labelStatus->width() - 8) && (choppedText.length() > 8))
{ {
choppedText.chop(4); choppedText.chop(4);
choppedText = choppedText.trimmed(); choppedText = choppedText.trimmed();
choppedText.append("..."); choppedText.append("...");
} }
labelStatus->setText(choppedText); ui->labelStatus->setText(choppedText);
} }
} }
void WorkingBanner::setProgressMax(unsigned int max) void WorkingBanner::setProgressMax(unsigned int max)
{ {
progressBar->setMaximum(max); ui->progressBar->setMaximum(max);
if(ui->progressBar->maximum() > ui->progressBar->minimum())
{
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarNoState);
WinSevenTaskbar::setTaskbarProgress(dynamic_cast<QWidget*>(this->parent()), ui->progressBar->value(), ui->progressBar->maximum());
}
else
{
WinSevenTaskbar::setTaskbarState(dynamic_cast<QWidget*>(this->parent()), WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
}
} }
void WorkingBanner::setProgressVal(unsigned int val) void WorkingBanner::setProgressVal(unsigned int val)
{ {
progressBar->setValue(val); ui->progressBar->setValue(val);
if(ui->progressBar->maximum() > ui->progressBar->minimum())
{
WinSevenTaskbar::setTaskbarProgress(dynamic_cast<QWidget*>(this->parent()), ui->progressBar->value(), ui->progressBar->maximum());
}
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -22,13 +22,20 @@
#pragma once #pragma once
#include "../tmp/UIC_WorkingBanner.h" #include <QDialog>
namespace Ui
{
class WorkingBanner;
}
class QEventLoop;
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Splash Frame // Splash Frame
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
class WorkingBanner: public QDialog, private Ui::WorkingBanner class WorkingBanner: public QDialog
{ {
Q_OBJECT Q_OBJECT
@ -41,6 +48,8 @@ public:
void show(const QString &text, QEventLoop *loop); void show(const QString &text, QEventLoop *loop);
private: private:
Ui::WorkingBanner *const ui;
QMovie *m_working; QMovie *m_working;
bool m_canClose; bool m_canClose;