Cleanup: turn DiveListModel into standard singleton

DiveListModel was one of those "special" singletons that could
be created explicitly with new. This would make sense if a
parameter were passed to the constructor. We only passed null,
so one might as well turn that into a classical singleton with
default constructor.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-09-28 23:05:49 +02:00 committed by Dirk Hohndel
parent 2560734624
commit 36d42a6a57
3 changed files with 5 additions and 10 deletions

View file

@ -140,11 +140,9 @@ QString DiveListSortModel::tripShortDate(const QString &section)
return QStringLiteral("%1\n'%2").arg(firstMonth,firstTime.toString("yy"));
}
DiveListModel *DiveListModel::m_instance = NULL;
DiveListModel::DiveListModel(QObject *parent) : QAbstractListModel(parent)
DiveListModel::DiveListModel()
{
m_instance = this;
LOG_STP("run_ui diveListModel started");
}
void DiveListModel::insertDive(int i)
@ -297,7 +295,8 @@ QString DiveListModel::startAddDive()
DiveListModel *DiveListModel::instance()
{
return m_instance;
static DiveListModel self;
return &self;
}
struct dive *DiveListModel::getDive(int i)