Show nice "loading" gif icon.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-05-06 17:31:28 +03:00
parent fcbb301004
commit c98aa9487e
5 changed files with 19 additions and 4 deletions

View File

@ -33,10 +33,11 @@
#include <QMessageBox>
#include <QPushButton>
#include <QtSvgDepends>
//---------------------------------------------------------------------------------------------------------------------
DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
:QDialog(parent), ui(new Ui::DialogLayoutProgress), maxCount(count)
:QDialog(parent), ui(new Ui::DialogLayoutProgress), maxCount(count), movie(nullptr)
{
ui->setupUi(this);
@ -45,7 +46,11 @@ DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
ui->progressBar->setMaximum(maxCount);
ui->progressBar->setValue(0);
ui->labelMessage->setText(tr("Arranged: %1 from %2").arg(0).arg(count));
ui->labelMessage->setText(tr("Arranged workpieces: %1 from %2").arg(0).arg(count));
movie = new QMovie("://icon/16x16/progress.gif");
ui->labelProgress->setMovie (movie);
movie->start ();
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCancel != nullptr);
@ -59,6 +64,7 @@ DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
DialogLayoutProgress::~DialogLayoutProgress()
{
delete ui;
delete movie;
}
//---------------------------------------------------------------------------------------------------------------------
@ -71,7 +77,7 @@ void DialogLayoutProgress::Start()
void DialogLayoutProgress::Arranged(int count)
{
ui->progressBar->setValue(count);
ui->labelMessage->setText(tr("Arranged: %1 from %2").arg(count).arg(maxCount));
ui->labelMessage->setText(tr("Arranged workpieces: %1 from %2").arg(count).arg(maxCount));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -59,7 +59,8 @@ public slots:
private:
Q_DISABLE_COPY(DialogLayoutProgress)
Ui::DialogLayoutProgress *ui;
int maxCount;
const int maxCount;
QMovie *movie;
};
#endif // DIALOGLAYOUTPROGRESS_H

View File

@ -64,6 +64,13 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelProgress">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelMessage">
<property name="text">

View File

@ -59,5 +59,6 @@
<file>icon/24x24/fx.png</file>
<file>icon/16x16/fx.png</file>
<file>icon/16x16/roll.png</file>
<file>icon/16x16/progress.gif</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB