From ad322157891cec53a7b660629d7c244e75df81d5 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 24 Jul 2010 17:15:00 +0200 Subject: Act on doubleClick in FileTreeWidget When doubleclicking a picture in FileTreeWidget the pictureViewer is shown. Doubleclicking a movie file launches the default movie player. Since PictureViewer is now used in FileSystemWidget and ArchiveTreeView a global instance is needed. The appropriate place for this is a singleton. Since we already had a singleton for QAbstractItemModels I renamed it to SmGlobals and added a function to return a PictureViewer object. Renaming it was quite easy thanks to QtCreator's ability to rename variable names. --- filesystemwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'filesystemwidget.cpp') diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp index 4959a66..67facb9 100644 --- a/filesystemwidget.cpp +++ b/filesystemwidget.cpp @@ -30,6 +30,7 @@ #include "helper.h" #include "messagedialog.h" #include "pictureviewer.h" +#include "smglobals.h" FilesystemWidget::FilesystemWidget(QWidget *parent) : QWidget(parent) { mModel = new QFileSystemModel; @@ -62,7 +63,7 @@ FilesystemWidget::FilesystemWidget(QWidget *parent) : QWidget(parent) { mFileView->setSelectionMode(QAbstractItemView::ExtendedSelection); mFileView->setEditTriggers(QAbstractItemView::NoEditTriggers); - mPicViewer = new PictureViewer; + mPicViewer = SmGlobals::instance()->pictureViewer(); QString title = QString(tr("%1 - Rename file")).arg(qApp->applicationName()); mRenameDialog = new MessageDialog(tr("Rename dummy to:"), title, this); -- cgit v1.2.3-70-g09d2