diff options
author | Arno <am@disconnect.de> | 2010-06-25 21:17:37 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2010-06-25 21:17:37 +0200 |
commit | 1a976e1ec94183023e3b330368f2860a504fe403 (patch) | |
tree | f57594191c7148c60a3df93d22ed6dfa187b1626 /smmodelsingleton.cpp | |
parent | c5125a0cdb79d13169f44fcfd03e517e7dd557d6 (diff) | |
download | SheMov-1a976e1ec94183023e3b330368f2860a504fe403.tar.gz SheMov-1a976e1ec94183023e3b330368f2860a504fe403.tar.bz2 SheMov-1a976e1ec94183023e3b330368f2860a504fe403.zip |
New model: MappingTableModel
Implemented new Model for Mapping tables. This model is intended to
replace the old ListModel and Singleton. MappingTableModel is derived
from SmTreeModel and can be accessed using SmModelSingleton.
It's quite dynamic building its queries, and has yet to be tested.
Hopefully I got it right the first time :)
Diffstat (limited to 'smmodelsingleton.cpp')
-rw-r--r-- | smmodelsingleton.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/smmodelsingleton.cpp b/smmodelsingleton.cpp index 08cbbba..2ee5623 100644 --- a/smmodelsingleton.cpp +++ b/smmodelsingleton.cpp @@ -12,6 +12,7 @@ #include "smmodelsingleton.h" #include "seriestreemodel.h" #include "filestreemodel.h" +#include "mappingtablemodel.h" SmModelSingleton *SmModelSingleton::mInstance = 0; @@ -50,6 +51,18 @@ QAbstractItemModel *SmModelSingleton::model(const QString &which){ FilesTreeModel *model = new FilesTreeModel(headers); mModels.insert(which, model); } + }else if(which == "ActorsModel"){ + if(!mModels.contains(which)){ + QStringList headers = QStringList() << tr("Actor") << tr("Id"); + MappingTableModel *model = new MappingTableModel(headers, "actors"); + mModels.insert(which, model); + } + }else if(which == "GenresModel"){ + if(!mModels.contains(which)){ + QStringList headers = QStringList() << tr("Genre") << tr("Id"); + MappingTableModel *model = new MappingTableModel(headers, "genres"); + mModels.insert(which, model); + } } - return mModels.contains(which) ? mModels.value(which ) : 0; + return mModels.contains(which) ? mModels.value(which) : 0; } |