From b762123ba32da90a7b8e787c666e83a1ccd310c4 Mon Sep 17 00:00:00 2001 From: Simon Rit Date: Mon, 30 May 2011 10:08:48 +0200 Subject: [PATCH] Corrected tooltip with absolute file path --- vv/vvMainWindow.cxx | 8 ++++---- vv/vvSlicerManager.cxx | 30 ++++++++++++++++++++++++++++++ vv/vvSlicerManager.h | 1 + 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index 43dcff1..8a0bd24 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -865,7 +865,7 @@ void vvMainWindow::LoadImages(std::vector files, vvImageReader::Loa item->setData(0,Qt::UserRole,files[i].c_str()); QFileInfo fileinfo(imageManager->GetFileName().c_str()); //Do not show the path item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName()); - item->setToolTip(COLUMN_IMAGE_NAME,fileinfo.absoluteFilePath()); + item->setToolTip(COLUMN_IMAGE_NAME, imageManager->GetListOfAbsoluteFilePathInOneString("image").c_str()); qApp->processEvents(); //Create the buttons for reload and close @@ -1816,7 +1816,7 @@ void vvMainWindow::AddOverlayImage(int index, QString file) item->setData(1,Qt::UserRole,tr("overlay")); QFileInfo fileinfo(file); //Do not show the path item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName()); - item->setToolTip(COLUMN_IMAGE_NAME,fileinfo.absoluteFilePath()); + item->setToolTip(COLUMN_IMAGE_NAME, mSlicerManagers[index]->GetListOfAbsoluteFilePathInOneString("overlay").c_str()); qApp->processEvents(); for (int j = 1; j <= 4; j++) { @@ -1938,7 +1938,7 @@ void vvMainWindow::AddFusionImage(int index, QString file) item->setData(1,Qt::UserRole,tr("fusion")); QFileInfo fileinfo(filename.c_str()); //Do not show the path item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName()); - item->setToolTip(COLUMN_IMAGE_NAME,fileinfo.absoluteFilePath()); + item->setToolTip(COLUMN_IMAGE_NAME, mSlicerManagers[index]->GetListOfAbsoluteFilePathInOneString("fusion").c_str()); qApp->processEvents(); for (int j = 1; j <= 4; j++) { @@ -2023,7 +2023,7 @@ void vvMainWindow::AddFieldEntry(QString filename,int index,bool from_disk) item->setData(1,Qt::UserRole,tr("vector")); QFileInfo fileinfo(filename); //Do not show the path item->setData(COLUMN_IMAGE_NAME,Qt::DisplayRole,fileinfo.fileName()); - item->setToolTip(COLUMN_IMAGE_NAME,fileinfo.absoluteFilePath()); + item->setToolTip(COLUMN_IMAGE_NAME, mSlicerManagers[index]->GetListOfAbsoluteFilePathInOneString("vector").c_str()); qApp->processEvents(); for (int j = 1; j <= 4; j++) { diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 87c4ae3..7bf8ed6 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -40,6 +40,8 @@ #include #include +#include + //---------------------------------------------------------------------------- vvSlicerManager::vvSlicerManager(int numberOfSlicers) { @@ -121,6 +123,34 @@ void vvSlicerManager::ToggleContourSuperposition() } //---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +std::string vvSlicerManager::GetListOfAbsoluteFilePathInOneString(const std::string &actorType) +{ + vvImageReader *reader = NULL; + + if(actorType=="image") + reader = mReader; + else if(actorType=="overlay") + reader = mOverlayReader; + else if(actorType=="fusion") + reader = mFusionReader; + else if(actorType=="vector") + reader = mVectorReader; + + if(!reader) + return ""; + + std::string list; + for(unsigned int i=0; iGetInputFilenames().size(); i++){ + QFileInfo fileinfo(reader->GetInputFilenames()[i].c_str()); //Do not show the path + if(i) + list += '\n'; + list += fileinfo.absoluteFilePath().toStdString(); + } + return list; +} +//---------------------------------------------------------------------------- + //---------------------------------------------------------------------------- bool vvSlicerManager::SetImage(std::string filename, vvImageReader::LoadedImageType type, int n, unsigned int slice) diff --git a/vv/vvSlicerManager.h b/vv/vvSlicerManager.h index cb6cb32..680a59b 100644 --- a/vv/vvSlicerManager.h +++ b/vv/vvSlicerManager.h @@ -80,6 +80,7 @@ class vvSlicerManager : public QObject { std::string GetVFName() { return mVFName; } std::string GetOverlayName() { return mOverlayName; } std::string GetFusionName() { return mFusionName; } + std::string GetListOfAbsoluteFilePathInOneString(const std::string &actorType); ///Switch between nearest neighbor and linear interpolation void ToggleInterpolation(); -- 2.45.1