mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Populate divemaster completion model using CSV
Split divemaster field value using comma and populate completion list. Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c8807c2ad2
commit
9faf52dd43
1 changed files with 15 additions and 13 deletions
|
@ -32,21 +32,23 @@ void Class::updateModel() \
|
|||
setStringList(list); \
|
||||
}
|
||||
|
||||
void BuddyCompletionModel::updateModel()
|
||||
{
|
||||
QSet<QString> set;
|
||||
struct dive* dive;
|
||||
int i = 0;
|
||||
for_each_dive(i, dive) {
|
||||
QString buddy(dive->buddy);
|
||||
foreach (const QString &value, buddy.split(",", QString::SkipEmptyParts)) {
|
||||
set.insert(value.trimmed());
|
||||
}
|
||||
}
|
||||
setStringList(set.toList());
|
||||
#define CREATE_CSV_UPDATE_METHOD(Class, diveStructMember) \
|
||||
void Class::updateModel() \
|
||||
{ \
|
||||
QSet<QString> set; \
|
||||
struct dive* dive; \
|
||||
int i = 0; \
|
||||
for_each_dive(i, dive) { \
|
||||
QString buddy(dive->diveStructMember); \
|
||||
foreach (const QString &value, buddy.split(",", QString::SkipEmptyParts)) { \
|
||||
set.insert(value.trimmed()); \
|
||||
} \
|
||||
} \
|
||||
setStringList(set.toList()); \
|
||||
}
|
||||
|
||||
CREATE_UPDATE_METHOD(DiveMasterCompletionModel, divemaster);
|
||||
CREATE_CSV_UPDATE_METHOD(BuddyCompletionModel, buddy);
|
||||
CREATE_CSV_UPDATE_METHOD(DiveMasterCompletionModel, divemaster);
|
||||
CREATE_UPDATE_METHOD(LocationCompletionModel, location);
|
||||
CREATE_UPDATE_METHOD(SuitCompletionModel, suit);
|
||||
|
||||
|
|
Loading…
Reference in a new issue