From 1ec8aa7048416a3267ee3ff654d078739644296c Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 22 May 2010 16:53:14 +0200 Subject: 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. --- archivefilewidget.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'archivefilewidget.cpp') diff --git a/archivefilewidget.cpp b/archivefilewidget.cpp index 8ddad26..818ac43 100644 --- a/archivefilewidget.cpp +++ b/archivefilewidget.cpp @@ -24,8 +24,14 @@ #include "helper.h" #include "actorwidget.h" #include "fileinfomodel.h" - -ArchiveFileWidget::ArchiveFileWidget(MovieModel *model, QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) , mModel(model){ +#include "listmodelsingleton.h" +#include "moviemodelsingleton.h" + +ArchiveFileWidget::ArchiveFileWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f){ + //setup + mModel = MovieModelSingleton::instance(); + mGenreModel = ListModelSingleton::instance()->model("genre"); + mActorsModel = ListModelSingleton::instance()->model("actor"); QVBoxLayout *mainLayout = new QVBoxLayout; //selected files @@ -89,19 +95,6 @@ ArchiveFileWidget::ArchiveFileWidget(MovieModel *model, QWidget *parent, Qt::Win setMinimumWidth(600); } -void ArchiveFileWidget::setMovieModel(MovieModel *model){ - mModel = model; -} - -void ArchiveFileWidget::setGenreModel(ListModel *model){ - mGenreModel = model; - mGenre->setModel(mGenreModel); -} - -void ArchiveFileWidget::setActorsModel(ListModel *model){ - mActorsModel = model; -} - void ArchiveFileWidget::setFiles(const QStringList &files){ mFileList = files; mInfoModel->clear(); -- cgit v1.2.3-70-g09d2