mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: Use AddDive instead of clear dive
No need to clear the dives when adding a new one. Signed-off-by: Grace Karanja <gracie.karanja89@gmail.com>
This commit is contained in:
parent
a734a2ee19
commit
5a7dbf0225
3 changed files with 8 additions and 4 deletions
|
@ -129,7 +129,8 @@ void QMLManager::saveChanges()
|
||||||
|
|
||||||
void QMLManager::addDive()
|
void QMLManager::addDive()
|
||||||
{
|
{
|
||||||
DiveListModel::instance()->clearDives();
|
showMessage("Adding new dive.");
|
||||||
|
DiveListModel::instance()->startAddDive();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QMLManager::saveCloudPassword() const
|
bool QMLManager::saveCloudPassword() const
|
||||||
|
|
|
@ -338,9 +338,12 @@ QHash<int, QByteArray> DiveListModel::roleNames() const
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiveListModel::clearDives()
|
void DiveListModel::startAddDive()
|
||||||
{
|
{
|
||||||
m_dives.clear();
|
struct dive *d;
|
||||||
|
d = alloc_dive();
|
||||||
|
add_single_dive(get_divenr(d), d);
|
||||||
|
addDive(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
DiveListModel *DiveListModel::instance()
|
DiveListModel *DiveListModel::instance()
|
||||||
|
|
|
@ -128,7 +128,7 @@ public:
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||||
QHash<int, QByteArray> roleNames() const;
|
QHash<int, QByteArray> roleNames() const;
|
||||||
void clearDives();
|
void startAddDive();
|
||||||
private:
|
private:
|
||||||
QList<MobileDive> m_dives;
|
QList<MobileDive> m_dives;
|
||||||
static DiveListModel *m_instance;
|
static DiveListModel *m_instance;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue