summaryrefslogtreecommitdiffstats
path: root/shemov.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-05-22 16:53:14 +0200
committerArno <am@disconnect.de>2010-05-22 16:53:14 +0200
commit1ec8aa7048416a3267ee3ff654d078739644296c (patch)
tree8b36d12eaf8c244fca1c7afc83606a61a29bf111 /shemov.cpp
parent4ec6696968f7536e067e3a728ffdb423f985ef5a (diff)
downloadSheMov-1ec8aa7048416a3267ee3ff654d078739644296c.tar.gz
SheMov-1ec8aa7048416a3267ee3ff654d078739644296c.tar.bz2
SheMov-1ec8aa7048416a3267ee3ff654d078739644296c.zip
Use singletons for models
Created singletons for the ListModel* and MovieModel*. There should only be one of each and they were passed around quite a lot.
Diffstat (limited to 'shemov.cpp')
-rw-r--r--shemov.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/shemov.cpp b/shemov.cpp
index 2e3ab90..2bfe8c0 100644
--- a/shemov.cpp
+++ b/shemov.cpp
@@ -42,6 +42,8 @@
#include "coverarchiveeditor.h"
#include "statisticsdialog.h"
#include "filesystemfileproxy.h"
+#include "moviemodelsingleton.h"
+#include "listmodelsingleton.h"
SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags), mOpenWithGroupFS(0), mOpenWithGroupAV(0) {
qApp->setWindowIcon(QIcon(":/shemov.png"));
@@ -60,9 +62,9 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla
QMessageBox::critical(this, tr("Error"), tr("Could not open database. Please configure the database and restart the program"));
}
- mMovieModel = new MovieModel(this);
- mGenreModel = new ListModel("genre", this);
- mActorModel = new ListModel("actor", this);
+ mMovieModel = MovieModelSingleton::instance();
+ mGenreModel = ListModelSingleton::instance()->model("genre");
+ mActorModel = ListModelSingleton::instance()->model("actor");
mFSWidget = new FilesystemWidget;
setWindowTitle(mFSWidget->windowTitle());
@@ -73,8 +75,7 @@ SheMov::SheMov(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, fla
mTab->addTab(mAVWidget, tr("Archive"));
connect(mAVWidget, SIGNAL(windowTitle(const QString &)), this, SLOT(newWindowTitle(const QString &)));
- mAEdit = new ArchiveEditDialog(mGenreModel, mActorModel, this);
- mAEdit->setMovieModel(mMovieModel);
+ mAEdit = new ArchiveEditDialog(this);
mFSWidget->setArchiveDialog(mAEdit);
mAItemEdit = new EditArchiveItemDialog(mGenreModel, mActorModel, mMovieModel, this);