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

View File

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

View File

@ -63,11 +63,22 @@
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelMessage">
<property name="text">
<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>
</layout>
</widget>