Convert private static vars into member vars

* CSV Import and Entry Model
This commit is contained in:
Jonathan White 2018-09-08 17:05:37 -04:00
parent 53a17c2355
commit b74fb3e208
No known key found for this signature in database
GPG Key ID: 440FC65F2E0C6E01
4 changed files with 10 additions and 18 deletions

View File

@ -28,16 +28,8 @@
#include "gui/MessageWidget.h"
// I wanted to make the CSV import GUI future-proof, so if one day you need a new field,
// all you have to do is uncomment a row or two here, and the GUI will follow:
// all you have to do is add a field to m_columnHeader, and the GUI will follow:
// dynamic generation of comboBoxes, labels, placement and so on. Try it for immense fun!
const QStringList CsvImportWidget::m_columnHeader =
QStringList() << QObject::tr("Group") << QObject::tr("Title") << QObject::tr("Username") << QObject::tr("Password")
<< QObject::tr("URL") << QObject::tr("Notes") << QObject::tr("Last Modified")
<< QObject::tr("Created")
// << QObject::tr("Future field1")
// << QObject::tr("Future field2")
// << QObject::tr("Future field3")
;
CsvImportWidget::CsvImportWidget(QWidget* parent)
: QWidget(parent)
@ -45,6 +37,10 @@ CsvImportWidget::CsvImportWidget(QWidget* parent)
, m_parserModel(new CsvParserModel(this))
, m_comboModel(new QStringListModel(this))
, m_comboMapper(new QSignalMapper(this))
, m_columnHeader(QStringList() << QObject::tr("Group") << QObject::tr("Title") << QObject::tr("Username")
<< QObject::tr("Password") << QObject::tr("URL") << QObject::tr("Notes")
<< QObject::tr("Last Modified") << QObject::tr("Created")
/* << QObject::tr("Future field1") */ )
{
m_ui->setupUi(this);

View File

@ -66,7 +66,7 @@ private:
QList<QComboBox*> m_combos;
Database* m_db;
static const QStringList m_columnHeader;
const QStringList m_columnHeader;
QStringList m_fieldSeparatorList;
void configParser();
void updateTableview();

View File

@ -30,17 +30,13 @@
#include "core/Group.h"
#include "core/Metadata.h"
// String being displayed when hiding content
const QString EntryModel::HiddenContentDisplay(QString("\u25cf").repeated(6));
// Format used to display dates
const Qt::DateFormat EntryModel::DateFormat = Qt::DefaultLocaleShortDate;
EntryModel::EntryModel(QObject* parent)
: QAbstractTableModel(parent)
, m_group(nullptr)
, m_hideUsernames(false)
, m_hidePasswords(true)
, HiddenContentDisplay(QString("\u25cf").repeated(6))
, DateFormat(Qt::DefaultLocaleShortDate)
{
}

View File

@ -100,8 +100,8 @@ private:
QPixmap m_paperClipPixmap;
static const QString HiddenContentDisplay;
static const Qt::DateFormat DateFormat;
const QString HiddenContentDisplay;
const Qt::DateFormat DateFormat;
};
#endif // KEEPASSX_ENTRYMODEL_H