Show label with information in progress dialog.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-05-06 15:49:27 +03:00
parent b0e0f73aa3
commit 84661014e8
3 changed files with 23 additions and 8 deletions

View File

@ -36,15 +36,17 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent) DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
:QDialog(parent), ui(new Ui::DialogLayoutProgress) :QDialog(parent), ui(new Ui::DialogLayoutProgress), maxCount(count)
{ {
ui->setupUi(this); ui->setupUi(this);
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C)); qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
ui->progressBar->setMaximum(count); ui->progressBar->setMaximum(maxCount);
ui->progressBar->setValue(0); ui->progressBar->setValue(0);
ui->labelMessage->setText(tr("Arranged: %1 from %2").arg(0).arg(count));
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel); QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCancel != nullptr); SCASSERT(bCancel != nullptr);
connect(bCancel, &QPushButton::clicked, this, &DialogLayoutProgress::StopWorking); connect(bCancel, &QPushButton::clicked, this, &DialogLayoutProgress::StopWorking);
@ -69,6 +71,7 @@ void DialogLayoutProgress::Start()
void DialogLayoutProgress::Arranged(int count) void DialogLayoutProgress::Arranged(int count)
{ {
ui->progressBar->setValue(count); ui->progressBar->setValue(count);
ui->labelMessage->setText(tr("Arranged: %1 from %2").arg(count).arg(maxCount));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -43,7 +43,7 @@ class DialogLayoutProgress : public QDialog
Q_OBJECT Q_OBJECT
public: public:
explicit DialogLayoutProgress(int count, QWidget *parent = 0); DialogLayoutProgress(int count, QWidget *parent = 0);
~DialogLayoutProgress(); ~DialogLayoutProgress();
signals: signals:
@ -59,6 +59,7 @@ public slots:
private: private:
Q_DISABLE_COPY(DialogLayoutProgress) Q_DISABLE_COPY(DialogLayoutProgress)
Ui::DialogLayoutProgress *ui; Ui::DialogLayoutProgress *ui;
int maxCount;
}; };
#endif // DIALOGLAYOUTPROGRESS_H #endif // DIALOGLAYOUTPROGRESS_H

View File

@ -63,11 +63,22 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="standardButtons"> <item>
<set>QDialogButtonBox::Cancel</set> <widget class="QLabel" name="labelMessage">
</property> <property name="text">
</widget> <string notr="true">Arranged:</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>