diff options
author | Arno <am@disconnect.de> | 2010-05-22 16:53:14 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2010-05-22 16:53:14 +0200 |
commit | 1ec8aa7048416a3267ee3ff654d078739644296c (patch) | |
tree | 8b36d12eaf8c244fca1c7afc83606a61a29bf111 /shemov.cpp | |
parent | 4ec6696968f7536e067e3a728ffdb423f985ef5a (diff) | |
download | SheMov-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.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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); |