From 199bf012a87ace47044627189012b854570e3970 Mon Sep 17 00:00:00 2001 From: Arno Date: Mon, 24 May 2010 14:14:00 +0200 Subject: Implemented PictureViewer class Don't call an external program for showing a picture. When an image is doubleclicked a new windows shows the picture. Pictures can still be opened in an exteral program by using the "Open with..." context menu item. --- filesystemwidget.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'filesystemwidget.cpp') diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp index 8e27928..48516df 100644 --- a/filesystemwidget.cpp +++ b/filesystemwidget.cpp @@ -30,6 +30,7 @@ #include "helper.h" #include "messagedialog.h" #include "archiveeditdialog.h" +#include "pictureviewer.h" FilesystemWidget::FilesystemWidget(QWidget *parent) : QWidget(parent) { mModel = new QFileSystemModel; @@ -62,6 +63,8 @@ FilesystemWidget::FilesystemWidget(QWidget *parent) : QWidget(parent) { mFileView->setSelectionMode(QAbstractItemView::ExtendedSelection); mFileView->setEditTriggers(QAbstractItemView::NoEditTriggers); + mPicViewer = new PictureViewer; + QString title = QString(tr("%1 - Rename file")).arg(qApp->applicationName()); mRenameDialog = new MessageDialog(tr("Rename dummy to:"), title, this); connect(mRenameDialog, SIGNAL(accepted()), this, SLOT(doRenameFile())); @@ -153,13 +156,8 @@ void FilesystemWidget::fileViewActivated(const QModelIndex &idx){ programArgs = data.second; } if(mt.toLower().startsWith("image")){ - QPair data = programData("pictureviewer", QString()); - if(data.first.isEmpty()){ - QMessageBox::critical(this, tr("Error"), tr("No picture viewer configured.")); - return; - } - program = data.first; - programArgs = data.second; + mPicViewer->showPic(path); + return; } programArgs << path; QProcess::startDetached(program, programArgs); -- cgit v1.2.3-70-g09d2