CGeneratePropertyNamesDialog: Make use of in-class initializers where applicable

This commit is contained in:
Lioncash 2020-06-28 03:21:07 -04:00
parent 69f8ff1200
commit 963b6ccd08
2 changed files with 10 additions and 14 deletions

View File

@ -10,10 +10,8 @@
CGeneratePropertyNamesDialog::CGeneratePropertyNamesDialog(QWidget* pParent) CGeneratePropertyNamesDialog::CGeneratePropertyNamesDialog(QWidget* pParent)
: QDialog(pParent) : QDialog(pParent)
, mpUI( new Ui::CGeneratePropertyNamesDialog ) , mpUI(std::make_unique<Ui::CGeneratePropertyNamesDialog>())
, mFutureWatcher( this ) , mFutureWatcher(this)
, mRunningNameGeneration( false )
, mCanceledNameGeneration( false )
{ {
mpUI->setupUi(this); mpUI->setupUi(this);
mNotifier.SetProgressBar( mpUI->ProgressBar ); mNotifier.SetProgressBar( mpUI->ProgressBar );
@ -41,10 +39,7 @@ CGeneratePropertyNamesDialog::CGeneratePropertyNamesDialog(QWidget* pParent)
QtConcurrent::run(&mGenerator, &CPropertyNameGenerator::Warmup); QtConcurrent::run(&mGenerator, &CPropertyNameGenerator::Warmup);
} }
CGeneratePropertyNamesDialog::~CGeneratePropertyNamesDialog() CGeneratePropertyNamesDialog::~CGeneratePropertyNamesDialog() = default;
{
delete mpUI;
}
/** Add a property to the ID pool */ /** Add a property to the ID pool */
void CGeneratePropertyNamesDialog::AddToIDPool(IProperty* pProperty) void CGeneratePropertyNamesDialog::AddToIDPool(IProperty* pProperty)

View File

@ -13,6 +13,7 @@
#include <QScopedPointer> #include <QScopedPointer>
#include <QTimer> #include <QTimer>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <memory>
using CNameCasingComboBox = TEnumComboBox<ENameCasing>; using CNameCasingComboBox = TEnumComboBox<ENameCasing>;
@ -26,7 +27,7 @@ class CGeneratePropertyNamesDialog;
class CGeneratePropertyNamesDialog : public QDialog class CGeneratePropertyNamesDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
Ui::CGeneratePropertyNamesDialog* mpUI; std::unique_ptr<Ui::CGeneratePropertyNamesDialog> mpUI;
/** The name generator */ /** The name generator */
CPropertyNameGenerator mGenerator; CPropertyNameGenerator mGenerator;
@ -51,13 +52,13 @@ class CGeneratePropertyNamesDialog : public QDialog
QVector<QTreeWidgetItem*> mCheckedItems; QVector<QTreeWidgetItem*> mCheckedItems;
/** Whether name generation is running */ /** Whether name generation is running */
bool mRunningNameGeneration; bool mRunningNameGeneration = false;
/** Whether name generation has been canceled */ /** Whether name generation has been canceled */
bool mCanceledNameGeneration; bool mCanceledNameGeneration = false;
public: public:
explicit CGeneratePropertyNamesDialog(QWidget *pParent = 0); explicit CGeneratePropertyNamesDialog(QWidget *pParent = nullptr);
~CGeneratePropertyNamesDialog(); ~CGeneratePropertyNamesDialog();
/** Add a property to the ID pool */ /** Add a property to the ID pool */
@ -71,10 +72,10 @@ public:
public slots: public slots:
/** Show event override */ /** Show event override */
virtual void showEvent(QShowEvent* pEvent); void showEvent(QShowEvent* pEvent) override;
/** Close event override */ /** Close event override */
virtual void closeEvent(QCloseEvent* pEvent); void closeEvent(QCloseEvent* pEvent) override;
/** Add an item to the suffix list */ /** Add an item to the suffix list */
void AddSuffix(); void AddSuffix();