Skip to content

Commit

Permalink
Fix mostly Qt incompatabilites and MITK berry updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbolt committed May 16, 2024
1 parent ec3724c commit 14a3611
Show file tree
Hide file tree
Showing 47 changed files with 393 additions and 308 deletions.
2 changes: 1 addition & 1 deletion Code/Source/Application/SimVascular_Init_py.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

#include "SimVascular_Init_py.h"

#include "vtkToolkits.h"
//dp #include "vtkToolkits.h"

#include "Geometry_PyModule.h"
#include "Imaging_PyModule.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <QmitkModulesDialog.h>
#include <mitkVersion.h>
#include <itkConfigure.h>
#include <vtkConfigure.h>
//dp #include <vtkConfigure.h>
#include <QPushButton>
#include <vtkVersionMacros.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
#include <QApplication>

#include <berryPlatform.h>
#include <berryIPreferences.h>
#include <berryIPreferencesService.h>
#include <mitkIPreferences.h>
#include <mitkIPreferencesService.h>

#include <mitkProgressBar.h>
#include <mitkStatusBar.h>
Expand Down Expand Up @@ -111,21 +111,22 @@ void sv4guiFileOpenProjectAction::Run()

mitk::DataStorage::Pointer dataStorage = dsRef->GetDataStorage();

berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
berry::IPreferences::Pointer prefs;
mitk::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
mitk::IPreferences* prefs;

if (prefService)
{
prefs = prefService->GetSystemPreferences()->Node("/General");
}
else
{
prefs = berry::IPreferences::Pointer(0);
prefs = nullptr;
}

QString lastSVProjPath="";
if(prefs.IsNotNull())
if(prefs != nullptr)
{
lastSVProjPath = prefs->Get("LastSVProjPath", prefs->Get("LastSVProjCreatParentPath", ""));
lastSVProjPath = QString::fromStdString(prefs->Get("LastSVProjPath", prefs->Get("LastSVProjCreatParentPath", "")));
}

if(lastSVProjPath=="")
Expand Down Expand Up @@ -157,9 +158,10 @@ void sv4guiFileOpenProjectAction::Run()
mitk::ProgressBar::GetInstance()->Progress(2);
mitk::StatusBar::GetInstance()->DisplayText("SV project loaded.");
QApplication::restoreOverrideCursor();
if(prefs.IsNotNull())

if(prefs != nullptr)
{
prefs->Put("LastSVProjPath", lastSVProjPath);
prefs->Put("LastSVProjPath", lastSVProjPath.toStdString());
prefs->Flush();
}
}else{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
#include <berryPlatform.h>
#include <berryPlatformUI.h>
#include <berryISelectionService.h>
#include <berryIPreferencesService.h>
#include <berryIPreferences.h>
#include <mitkIPreferencesService.h>
#include <mitkIPreferences.h>

#include <mitkProgressBar.h>
#include <mitkStatusBar.h>
Expand Down Expand Up @@ -128,16 +128,16 @@ void sv4guiFileSaveProjectAsAction::Run()

std::list< mitk::DataNode::Pointer > selectedList = nodeSelection->GetSelectedDataNodes();

berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
berry::IPreferences::Pointer prefs;
mitk::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
mitk::IPreferences* prefs;

if (prefService)
{
prefs = prefService->GetSystemPreferences()->Node("/General");
}
else
{
prefs = berry::IPreferences::Pointer(0);
prefs = nullptr;
}


Expand All @@ -154,9 +154,9 @@ void sv4guiFileSaveProjectAsAction::Run()
}

QString lastSVProjPath="";
if(prefs.IsNotNull())
if(prefs != nullptr)
{
lastSVProjPath = prefs->Get("LastSVProjPath", prefs->Get("LastSVProjCreatParentPath", ""));
lastSVProjPath = QString::fromStdString(prefs->Get("LastSVProjPath", prefs->Get("LastSVProjCreatParentPath", "")));
}

if(lastSVProjPath=="")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
#include "sv4gui_ProjectManager.h"

#include <berryPlatform.h>
#include <berryIPreferences.h>
#include <berryIPreferencesService.h>
#include <mitkIPreferences.h>
#include <mitkIPreferencesService.h>

#include <QMessageBox>
#include <QFile>
Expand All @@ -53,20 +53,21 @@ sv4guiProjectCreate::sv4guiProjectCreate(mitk::DataStorage::Pointer dataStorage)
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(Cancel()));
connect(ui->btnBrowse, SIGNAL(clicked()), this, SLOT(ChoosePath()));

berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
berry::IPreferences::Pointer prefs;
mitk::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
mitk::IPreferences* prefs;

if (prefService)
{
prefs = prefService->GetSystemPreferences()->Node("/General");
}
else
{
prefs = berry::IPreferences::Pointer(0);
prefs = nullptr;
}

if(prefs.IsNotNull())
if(prefs != nullptr)
{
m_LastPath = prefs->Get("LastSVProjCreatParentPath", "");
m_LastPath = QString::fromStdString(prefs->Get("LastSVProjCreatParentPath", ""));
}

if(m_LastPath=="")
Expand All @@ -75,8 +76,6 @@ sv4guiProjectCreate::sv4guiProjectCreate(mitk::DataStorage::Pointer dataStorage)
ui->lineEditDir->setText(m_LastPath);
}



sv4guiProjectCreate::~sv4guiProjectCreate()
{
delete ui;
Expand Down Expand Up @@ -117,19 +116,21 @@ void sv4guiProjectCreate::CreateNewProject()
sv4guiProjectManager::AddProject(m_DataStorage, projName,projParentDir,true);

m_LastPath=projParentDir;
berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
berry::IPreferences::Pointer prefs;
mitk::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
mitk::IPreferences* prefs;

if (prefService)
{
prefs = prefService->GetSystemPreferences()->Node("/General");
}
else
{
prefs = berry::IPreferences::Pointer(0);
prefs = nullptr;
}
if(prefs.IsNotNull())

if(prefs != nullptr)
{
prefs->Put("LastSVProjCreatParentPath", m_LastPath);
prefs->Put("LastSVProjCreatParentPath", m_LastPath.toStdString());
prefs->Flush();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
#include <berryIWorkbenchPage.h>
#include <berryIPerspectiveRegistry.h>
#include <berryWorkbenchPreferenceConstants.h>
#include <berryIPreferences.h>
#include <berryIPreferencesService.h>
#include <mitkIPreferences.h>
#include <mitkIPreferencesService.h>
#include <berryPlatform.h>

#include <berryIEditorReference.h>
Expand Down Expand Up @@ -78,7 +78,7 @@
sv4guiWorkbenchIntroPart::sv4guiWorkbenchIntroPart()
: m_Controls(nullptr)
{
berry::IPreferences::Pointer workbenchPrefs = sv4guiApplicationPluginActivator::GetDefault()->GetPreferencesService()->GetSystemPreferences();
mitk::IPreferences* workbenchPrefs = sv4guiApplicationPluginActivator::GetDefault()->GetPreferencesService()->GetSystemPreferences();
workbenchPrefs->PutBool(berry::WorkbenchPreferenceConstants::SHOW_INTRO, true);
workbenchPrefs->Flush();
}
Expand All @@ -88,13 +88,13 @@ sv4guiWorkbenchIntroPart::~sv4guiWorkbenchIntroPart()
// if the workbench is not closing (that means, welcome screen was closed explicitly), set "Show_intro" false
if (!this->GetIntroSite()->GetPage()->GetWorkbenchWindow()->GetWorkbench()->IsClosing())
{
berry::IPreferences::Pointer workbenchPrefs = sv4guiApplicationPluginActivator::GetDefault()->GetPreferencesService()->GetSystemPreferences();
mitk::IPreferences* workbenchPrefs = sv4guiApplicationPluginActivator::GetDefault()->GetPreferencesService()->GetSystemPreferences();
workbenchPrefs->PutBool(berry::WorkbenchPreferenceConstants::SHOW_INTRO, false);
workbenchPrefs->Flush();
}
else
{
berry::IPreferences::Pointer workbenchPrefs = sv4guiApplicationPluginActivator::GetDefault()->GetPreferencesService()->GetSystemPreferences();
mitk::IPreferences* workbenchPrefs = sv4guiApplicationPluginActivator::GetDefault()->GetPreferencesService()->GetSystemPreferences();
workbenchPrefs->PutBool(berry::WorkbenchPreferenceConstants::SHOW_INTRO, true);
workbenchPrefs->Flush();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
#include <berryIActionBarConfigurer.h>
#include <berryIWorkbenchWindow.h>
#include <berryIWorkbenchPage.h>
#include <berryIPreferencesService.h>
#include <mitkIPreferencesService.h>
#include <berryIPerspectiveRegistry.h>
#include <berryIPerspectiveDescriptor.h>
#include <berryIProduct.h>
Expand Down Expand Up @@ -106,7 +106,7 @@
#include <QmitkStdMultiWidget.h>

#include <itkConfigure.h>
#include <vtkConfigure.h>
//dp #include <vtkConfigure.h> what is this?
#include <vtkVersionMacros.h>

#include <mitkVersion.h>
Expand Down Expand Up @@ -581,15 +581,20 @@ void sv4guiWorkbenchWindowAdvisor::PostWindowCreate()
searchPaths.push_front( QString(":/org_mitk_icons/icons/") );
QIcon::setThemeSearchPaths( searchPaths );

berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
berry::IPreferences::Pointer stylePref = prefService->GetSystemPreferences()->Node(berry::QtPreferences::QT_STYLES_NODE);
//QString iconTheme = stylePref->Get(berry::QtPreferences::QT_ICON_THEME, "<<default>>");
QString iconTheme = stylePref->Get(berry::QtPreferences::QT_STYLES_NODE, "<<default>>");
if( iconTheme == QString( "<<default>>" ) )
mitk::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
mitk::IPreferences* stylePref = prefService->GetSystemPreferences()->Node(berry::QtPreferences::QT_STYLES_NODE);

auto iconTheme = stylePref->Get(berry::QtPreferences::QT_STYLES_NODE, "<<default>>");
//dp QString iconTheme = stylePref->Get(berry::QtPreferences::QT_STYLES_NODE, "<<default>>");

if( iconTheme == "<<default>>")
//dp if( iconTheme == QString( "<<default>>" ) )
{
iconTheme = QString( "tango" );
iconTheme = "tango";
//dp iconTheme = QString( "tango" );
}
QIcon::setThemeName( iconTheme );
QIcon::setThemeName( QString::fromStdString(iconTheme));
//dp QIcon::setThemeName( iconTheme );

// ==== Application menu ============================

Expand Down Expand Up @@ -1174,7 +1179,8 @@ void sv4guiWorkbenchWindowAdvisor::ShowSVView()
if(list.size()==0)
return;

QList<mitk::DataNode::Pointer> nodes=QList<mitk::DataNode::Pointer>::fromStdList(list);
auto nodes = QList<mitk::DataNode::Pointer>(list.begin(), list.end());
//dp QList<mitk::DataNode::Pointer> nodes=QList<mitk::DataNode::Pointer>::fromStdList(list);

if(nodes.size() < 1)
{
Expand Down Expand Up @@ -1541,7 +1547,8 @@ void sv4guiWorkbenchWindowAdvisor::RemoveSelectedNodes( bool )
if(list.size()==0)
return;

QList<mitk::DataNode::Pointer> nodes=QList<mitk::DataNode::Pointer>::fromStdList(list);
auto nodes = QList<mitk::DataNode::Pointer>(list.begin(), list.end());
//dp QList<mitk::DataNode::Pointer> nodes=QList<mitk::DataNode::Pointer>::fromStdList(list);

if(nodes.size() < 1)
{
Expand Down Expand Up @@ -1639,7 +1646,8 @@ void sv4guiWorkbenchWindowAdvisor::RenameSelectedNode( bool )
if(list.size()==0)
return;

QList<mitk::DataNode::Pointer> nodes=QList<mitk::DataNode::Pointer>::fromStdList(list);
auto nodes = QList<mitk::DataNode::Pointer>(list.begin(), list.end());
//dp QList<mitk::DataNode::Pointer> nodes=QList<mitk::DataNode::Pointer>::fromStdList(list);

if(nodes.size() < 1)
{
Expand Down Expand Up @@ -1713,7 +1721,8 @@ void sv4guiWorkbenchWindowAdvisor::CopyDataNode( bool )
if(list.size()==0)
return;

QList<mitk::DataNode::Pointer> nodes=QList<mitk::DataNode::Pointer>::fromStdList(list);
auto nodes = QList<mitk::DataNode::Pointer>(list.begin(), list.end());
//dp QList<mitk::DataNode::Pointer> nodes=QList<mitk::DataNode::Pointer>::fromStdList(list);

if(nodes.size() < 1)
{
Expand All @@ -1738,7 +1747,8 @@ void sv4guiWorkbenchWindowAdvisor::PasteDataNode( bool )
if(list.size()==0)
return;

QList<mitk::DataNode::Pointer> nodes=QList<mitk::DataNode::Pointer>::fromStdList(list);
auto nodes = QList<mitk::DataNode::Pointer>(list.begin(), list.end());
//dp QList<mitk::DataNode::Pointer> nodes=QList<mitk::DataNode::Pointer>::fromStdList(list);

if(nodes.size() < 1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#include <QLabel>
#include <QInputDialog>
#include <QLineEdit>
#include <QRegularExpression>

#include <ctkPluginException.h>
#include <service/event/ctkEventAdmin.h>
Expand All @@ -79,7 +80,7 @@
#include <berryIActionBarConfigurer.h>
#include <berryIWorkbenchWindow.h>
#include <berryIWorkbenchPage.h>
#include <berryIPreferencesService.h>
#include <mitkIPreferencesService.h>
#include <berryIPerspectiveRegistry.h>
#include <berryIPerspectiveDescriptor.h>
#include <berryIProduct.h>
Expand Down Expand Up @@ -108,7 +109,7 @@
#include <QmitkStdMultiWidget.h>

#include <itkConfigure.h>
#include <vtkConfigure.h>
//dp #include <vtkConfigure.h>
#include <vtkVersionMacros.h>

#include <mitkVersion.h>
Expand Down Expand Up @@ -256,8 +257,8 @@ void sv4guiWorkbenchWindowAdvisorHack::onIntro()
berry::PlatformUI::GetWorkbench()->GetIntroManager()->HasIntro();
if (!hasIntro)
{
QRegExp reg("(.*)<title>(\\n)*");
QRegExp reg2("(\\n)*</title>(.*)");
QRegularExpression reg("(.*)<title>(\\n)*");
QRegularExpression reg2("(\\n)*</title>(.*)");
QFile file(":/org.mitk.gui.qt.ext/index.html");
file.open(QIODevice::ReadOnly | QIODevice::Text); //text file only for reading

Expand Down Expand Up @@ -337,6 +338,7 @@ void sv4guiWorkbenchWindowAdvisorHack::onHelpOpenHelpPerspective()

void sv4guiWorkbenchWindowAdvisorHack::onAbout()
{
auto aboutDialog = new sv4guiAboutDialog(QApplication::activeWindow(),nullptr);
Qt::WindowFlags wflags = {};
auto aboutDialog = new sv4guiAboutDialog(QApplication::activeWindow(), wflags);
aboutDialog->open();
}
Loading

0 comments on commit 14a3611

Please sign in to comment.