Use constructor initialization lists where possible.

This commit is contained in:
Felix Geyer 2012-07-19 13:57:55 +02:00
parent 4152e93bb7
commit 308d3ad84b
9 changed files with 31 additions and 38 deletions

View File

@ -29,10 +29,9 @@ Entry::Entry()
: m_attributes(new EntryAttributes(this)) : m_attributes(new EntryAttributes(this))
, m_attachments(new EntryAttachments(this)) , m_attachments(new EntryAttachments(this))
, m_autoTypeAssociations(new AutoTypeAssociations(this)) , m_autoTypeAssociations(new AutoTypeAssociations(this))
, m_tmpHistoryItem(Q_NULLPTR)
, m_updateTimeinfo(true)
{ {
m_updateTimeinfo = true;
m_tmpHistoryItem = Q_NULLPTR;
m_data.iconNumber = DefaultIconNumber; m_data.iconNumber = DefaultIconNumber;
m_data.autoTypeEnabled = true; m_data.autoTypeEnabled = true;
m_data.autoTypeObfuscation = 0; m_data.autoTypeObfuscation = 0;

View File

@ -25,13 +25,12 @@
const int Group::DefaultIconNumber = 48; const int Group::DefaultIconNumber = 48;
Group::Group() Group::Group()
: m_iconNumber(DefaultIconNumber)
, m_isExpanded(true)
, m_autoTypeEnabled(Inherit)
, m_searchingEnabled(Inherit)
, m_updateTimeinfo(true)
{ {
m_iconNumber = DefaultIconNumber;
m_isExpanded = true;
m_autoTypeEnabled = Inherit;
m_searchingEnabled = Inherit;
m_updateTimeinfo = true;
} }
Group::~Group() Group::~Group()

View File

@ -26,15 +26,21 @@ const int Metadata::DefaultHistoryMaxSize = 6 * 1024 * 1024;
Metadata::Metadata(QObject* parent) Metadata::Metadata(QObject* parent)
: QObject(parent) : QObject(parent)
, m_generator("KeePassX")
, m_maintenanceHistoryDays(365)
, m_protectTitle(false)
, m_protectUsername(false)
, m_protectPassword(true)
, m_protectUrl(false)
, m_protectNotes(false)
// , m_autoEnableVisualHiding(false)
, m_recycleBinEnabled(true)
, m_masterKeyChangeRec(-1)
, m_masterKeyChangeForce(-1)
, m_historyMaxItems(DefaultHistoryMaxItems)
, m_historyMaxSize(DefaultHistoryMaxSize)
, m_updateDatetime(true)
{ {
m_generator = "KeePassX";
m_maintenanceHistoryDays = 365;
m_recycleBinEnabled = true;
m_masterKeyChangeRec = -1;
m_masterKeyChangeForce = -1;
m_historyMaxItems = DefaultHistoryMaxItems;
m_historyMaxSize = DefaultHistoryMaxSize;
QDateTime now = Tools::currentDateTimeUtc(); QDateTime now = Tools::currentDateTimeUtc();
m_nameChanged = now; m_nameChanged = now;
m_descriptionChanged = now; m_descriptionChanged = now;
@ -42,15 +48,6 @@ Metadata::Metadata(QObject* parent)
m_recycleBinChanged = now; m_recycleBinChanged = now;
m_entryTemplatesGroupChanged = now; m_entryTemplatesGroupChanged = now;
m_masterKeyChanged = now; m_masterKeyChanged = now;
m_protectTitle = false;
m_protectUsername = false;
m_protectPassword = true;
m_protectUrl = false;
m_protectNotes = false;
// m_autoEnableVisualHiding = false;
m_updateDatetime = true;
} }
template <class P, class V> bool Metadata::set(P& property, const V& value) template <class P, class V> bool Metadata::set(P& property, const V& value)

View File

@ -20,10 +20,9 @@
#include "core/Tools.h" #include "core/Tools.h"
TimeInfo::TimeInfo() TimeInfo::TimeInfo()
: m_expires(false)
, m_usageCount(0)
{ {
m_expires = false;
m_usageCount = 0;
QDateTime now = Tools::currentDateTimeUtc(); QDateTime now = Tools::currentDateTimeUtc();
m_lastModificationTime = now; m_lastModificationTime = now;
m_creationTime = now; m_creationTime = now;

View File

@ -40,7 +40,7 @@ private Q_SLOTS:
void dragSwitchTab(); void dragSwitchTab();
private: private:
QTimer* m_tabSwitchTimer; QTimer* const m_tabSwitchTimer;
int m_tabSwitchIndex; int m_tabSwitchIndex;
}; };

View File

@ -34,14 +34,13 @@ IconStruct::IconStruct()
EditWidgetIcons::EditWidgetIcons(QWidget* parent) EditWidgetIcons::EditWidgetIcons(QWidget* parent)
: QWidget(parent) : QWidget(parent)
, m_ui(new Ui::EditWidgetIcons()) , m_ui(new Ui::EditWidgetIcons())
, m_defaultIconModel(new DefaultIconModel(this))
, m_customIconModel(new CustomIconModel(this))
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
m_defaultIconModel = new DefaultIconModel(this);
m_ui->defaultIconsView->setModel(m_defaultIconModel); m_ui->defaultIconsView->setModel(m_defaultIconModel);
m_customIconModel = new CustomIconModel(this);
m_ui->customIconsView->setModel(m_customIconModel); m_ui->customIconsView->setModel(m_customIconModel);
connect(m_ui->defaultIconsView, SIGNAL(clicked(QModelIndex)), connect(m_ui->defaultIconsView, SIGNAL(clicked(QModelIndex)),

View File

@ -62,8 +62,8 @@ private:
const QScopedPointer<Ui::EditWidgetIcons> m_ui; const QScopedPointer<Ui::EditWidgetIcons> m_ui;
Database* m_database; Database* m_database;
Uuid m_currentUuid; Uuid m_currentUuid;
DefaultIconModel* m_defaultIconModel; DefaultIconModel* const m_defaultIconModel;
CustomIconModel* m_customIconModel; CustomIconModel* const m_customIconModel;
Q_DISABLE_COPY(EditWidgetIcons) Q_DISABLE_COPY(EditWidgetIcons)
}; };

View File

@ -26,8 +26,8 @@
LineEdit::LineEdit(QWidget* parent) LineEdit::LineEdit(QWidget* parent)
: QLineEdit(parent) : QLineEdit(parent)
, m_clearButton(new QToolButton(this))
{ {
m_clearButton = new QToolButton(this);
m_clearButton->setObjectName("clearButton"); m_clearButton->setObjectName("clearButton");
QIcon icon; QIcon icon;

View File

@ -40,7 +40,7 @@ private Q_SLOTS:
void updateCloseButton(const QString& text); void updateCloseButton(const QString& text);
private: private:
QToolButton* m_clearButton; QToolButton* const m_clearButton;
}; };
#endif // KEEPASSX_LINEEDIT_H #endif // KEEPASSX_LINEEDIT_H