summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorChristian Heimlich <chris@pcserenity.com>2020-09-24 10:18:25 -0400
committerChristian Heimlich <chris@pcserenity.com>2020-10-05 01:46:28 +0000
commit041868964d61100c32ce2ac65da5f723b2ed7fb9 (patch)
tree05b2dbf5e7ed369061ab6c8510fc3daf6545c416 /src/widgets
parentc82f73666d87549e5884ddcd253ec3561d840b9b (diff)
Group, cleanup, and consolidate QProgressDialogPrivate member variables
Members grouped and reordered for better alignment, all booleans initialized in the constructor's member initialization list, and snake case names changed to camel case for consistency. Change-Id: Ib59ed770a3d4e307296722270cd991a9a53c72ce Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index 485e5cae49..d0645a4e8a 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -69,14 +69,17 @@ class QProgressDialogPrivate : public QDialogPrivate
public:
QProgressDialogPrivate() : label(nullptr), cancel(nullptr), bar(nullptr),
- shown_once(false),
- cancellation_flag(false),
- setValue_called(false),
- processingEvents(false),
- showTime(defaultShowTime),
-#ifndef QT_NO_SHORTCUT
+ #ifndef QT_NO_SHORTCUT
escapeShortcut(nullptr),
-#endif
+ #endif
+ showTime(defaultShowTime),
+ processingEvents(false),
+ shownOnce(false),
+ autoClose(true),
+ autoReset(true),
+ forceHide(false),
+ cancellationFlag(false),
+ setValueCalled(false),
useDefaultCancelText(false)
{
}
@@ -93,21 +96,21 @@ public:
QPushButton *cancel;
QProgressBar *bar;
QTimer *forceTimer;
- bool shown_once;
- bool cancellation_flag;
- bool setValue_called;
- bool processingEvents;
+#ifndef QT_NO_SHORTCUT
+ QShortcut *escapeShortcut;
+#endif
+ QPointer<QObject> receiverToDisconnectOnClose;
QElapsedTimer starttime;
+ QByteArray memberToDisconnectOnClose;
int showTime;
+ bool processingEvents;
+ bool shownOnce;
bool autoClose;
bool autoReset;
bool forceHide;
-#ifndef QT_NO_SHORTCUT
- QShortcut *escapeShortcut;
-#endif
+ bool cancellationFlag;
+ bool setValueCalled;
bool useDefaultCancelText;
- QPointer<QObject> receiverToDisconnectOnClose;
- QByteArray memberToDisconnectOnClose;
};
void QProgressDialogPrivate::init(const QString &labelText, const QString &cancelText,
@@ -119,9 +122,6 @@ void QProgressDialogPrivate::init(const QString &labelText, const QString &cance
bar->setRange(min, max);
int align = q->style()->styleHint(QStyle::SH_ProgressDialog_TextLabelAlignment, nullptr, q);
label->setAlignment(Qt::Alignment(align));
- autoClose = true;
- autoReset = true;
- forceHide = false;
QObject::connect(q, SIGNAL(canceled()), q, SLOT(cancel()));
forceTimer = new QTimer(q);
QObject::connect(forceTimer, SIGNAL(timeout()), q, SLOT(forceShow()));
@@ -523,7 +523,7 @@ void QProgressDialogPrivate::ensureSizeIsAtLeastSizeHint()
bool QProgressDialog::wasCanceled() const
{
Q_D(const QProgressDialog);
- return d->cancellation_flag;
+ return d->cancellationFlag;
}
@@ -601,9 +601,9 @@ void QProgressDialog::reset()
if (d->autoClose || d->forceHide)
hide();
d->bar->reset();
- d->cancellation_flag = false;
- d->shown_once = false;
- d->setValue_called = false;
+ d->cancellationFlag = false;
+ d->shownOnce = false;
+ d->setValueCalled = false;
d->forceTimer->stop();
/*
@@ -627,7 +627,7 @@ void QProgressDialog::cancel()
d->forceHide = true;
reset();
d->forceHide = false;
- d->cancellation_flag = true;
+ d->cancellationFlag = true;
}
@@ -657,24 +657,24 @@ int QProgressDialog::value() const
void QProgressDialog::setValue(int progress)
{
Q_D(QProgressDialog);
- if (d->setValue_called && progress == d->bar->value())
+ if (d->setValueCalled && progress == d->bar->value())
return;
d->bar->setValue(progress);
- if (d->shown_once) {
+ if (d->shownOnce) {
if (isModal() && !d->processingEvents) {
const QScopedValueRollback guard(d->processingEvents, true);
QCoreApplication::processEvents();
}
} else {
- if ((!d->setValue_called && progress == 0 /* for compat with Qt < 5.4 */) || progress == minimum()) {
+ if ((!d->setValueCalled && progress == 0 /* for compat with Qt < 5.4 */) || progress == minimum()) {
d->starttime.start();
d->forceTimer->start(d->showTime);
- d->setValue_called = true;
+ d->setValueCalled = true;
return;
} else {
- d->setValue_called = true;
+ d->setValueCalled = true;
bool need_show;
int elapsed = d->starttime.elapsed();
if (elapsed >= d->showTime) {
@@ -697,7 +697,7 @@ void QProgressDialog::setValue(int progress)
if (need_show) {
d->ensureSizeIsAtLeastSizeHint();
show();
- d->shown_once = true;
+ d->shownOnce = true;
}
}
}
@@ -856,11 +856,11 @@ void QProgressDialog::forceShow()
{
Q_D(QProgressDialog);
d->forceTimer->stop();
- if (d->shown_once || d->cancellation_flag)
+ if (d->shownOnce || d->cancellationFlag)
return;
show();
- d->shown_once = true;
+ d->shownOnce = true;
}
/*!