aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/completionmodels.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-05-28 14:40:07 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-29 14:07:54 -0700
commit338c0f22aabefcfd5a5e87fceb4c82e73af3f5a9 (patch)
tree2e7723c95fcd73a0936c97fa8d1f7632b10b5fb2 /qt-ui/completionmodels.cpp
parent29e7459d6bd922043eb0d6ed0445d28e2f6ed10f (diff)
downloadsubsurface-338c0f22aabefcfd5a5e87fceb4c82e73af3f5a9.tar.gz
Move the models to its own folder
This is an attempt to help share code between the desktop version of Subsurface and the mobile version. More code will be moved around and the models will be split in a way that will help recompile times and also creation of different interfaces for different form-factors. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/completionmodels.cpp')
-rw-r--r--qt-ui/completionmodels.cpp69
1 files changed, 0 insertions, 69 deletions
diff --git a/qt-ui/completionmodels.cpp b/qt-ui/completionmodels.cpp
deleted file mode 100644
index f2e70afd1..000000000
--- a/qt-ui/completionmodels.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-#include "completionmodels.h"
-#include "dive.h"
-#include "mainwindow.h"
-
-#define CREATE_UPDATE_METHOD(Class, diveStructMember) \
- void Class::updateModel() \
- { \
- QStringList list; \
- struct dive *dive; \
- int i = 0; \
- for_each_dive (i, dive) \
- { \
- QString buddy(dive->diveStructMember); \
- if (!list.contains(buddy)) { \
- list.append(buddy); \
- } \
- } \
- std::sort(list.begin(), list.end()); \
- setStringList(list); \
- }
-
-#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()); \
- } \
- } \
- QStringList setList = set.toList(); \
- std::sort(setList.begin(), setList.end()); \
- setStringList(setList); \
- }
-
-CREATE_CSV_UPDATE_METHOD(BuddyCompletionModel, buddy);
-CREATE_CSV_UPDATE_METHOD(DiveMasterCompletionModel, divemaster);
-CREATE_UPDATE_METHOD(SuitCompletionModel, suit);
-
-void LocationCompletionModel::updateModel()
-{
- QStringList list;
- struct dive_site *ds;
- int i = 0;
- for_each_dive_site(i, ds) {
- if (!list.contains(ds->name))
- list.append(ds->name);
- }
- std::sort(list.begin(), list.end());
- setStringList(list);
-}
-
-void TagCompletionModel::updateModel()
-{
- if (g_tag_list == NULL)
- return;
- QStringList list;
- struct tag_entry *current_tag_entry = g_tag_list->next;
- while (current_tag_entry != NULL) {
- list.append(QString(current_tag_entry->tag->name));
- current_tag_entry = current_tag_entry->next;
- }
- setStringList(list);
-}