19 #include <QStringList>
25 #include <ctkCmdLineModuleDescription.h>
26 #include <ctkCmdLineModuleReference.h>
27 #include <ctkCmdLineModuleManager.h>
31 : ctkMenuComboBox(parent)
32 , m_ModuleManager(nullptr)
34 qRegisterMetaType<ctkCmdLineModuleReference>();
48 if (m_ModuleManager !=
nullptr)
50 QObject::disconnect(manager,
nullptr,
this,
nullptr);
53 m_ModuleManager = manager;
55 connect(m_ModuleManager, SIGNAL(moduleRegistered(
const ctkCmdLineModuleReference&)),
this, SLOT(OnModuleRegistered(
const ctkCmdLineModuleReference&)));
56 connect(m_ModuleManager, SIGNAL(moduleUnregistered(
const ctkCmdLineModuleReference&)),
this, SLOT(OnModuleUnRegistered(
const ctkCmdLineModuleReference&)));
63 return m_ModuleManager;
68 void QmitkCmdLineModuleMenuComboBox::OnModuleRegistered(
const ctkCmdLineModuleReference&)
75 void QmitkCmdLineModuleMenuComboBox::OnModuleUnRegistered(
const ctkCmdLineModuleReference&)
82 void QmitkCmdLineModuleMenuComboBox::AddName(
83 QList< QHash<QString, QMenu*>* >& listOfHashMaps,
89 if (depth >= listOfHashMaps.size())
91 int need = depth - listOfHashMaps.size();
92 for (
int i = 0; i <= need; i++)
94 auto newHashMap =
new QHash<QString, QMenu*>();
95 listOfHashMaps.push_back(newHashMap);
98 listOfHashMaps[depth]->insert(name, menu);
103 void QmitkCmdLineModuleMenuComboBox::RebuildMenu()
105 if (m_ModuleManager ==
nullptr)
107 qDebug() <<
"QmitkCmdLineModuleMenuComboBox::RebuildMenu(): Module Manager is NULL? Surely a bug?";
114 auto menu =
new QMenu();
115 QStringList listOfModules;
117 QList<ctkCmdLineModuleReference> references = m_ModuleManager->moduleReferences();
120 for (
int i = 0; i < references.size(); i++)
122 ctkCmdLineModuleReference reference = references[i];
123 ctkCmdLineModuleDescription description = reference.description();
124 QString title = description.title();
125 QString category = description.category();
126 QString fullName = category +
"." + title;
127 listOfModules << fullName;
131 listOfModules.sort();
134 QList< QHash<QString, QMenu*>* > list;
137 foreach (QString fullName, listOfModules)
140 QMenu *currentMenu =
menu;
143 QStringList nameParts = fullName.split(
".", QString::SkipEmptyParts);
146 for (
int i = 0; i < nameParts.size(); i++)
148 QString part = nameParts[i];
150 if (i != nameParts.size() - 1)
153 if (list.size() <= i || list[i] ==
nullptr || !list[i]->contains(part))
155 auto newMenu =
new QMenu(part);
156 currentMenu->addMenu(newMenu);
157 currentMenu = newMenu;
161 this->AddName(list, i, part, newMenu);
165 currentMenu = list[i]->value(part);
171 QAction *action = currentMenu->addAction(part);
176 action->setObjectName(fullName);
182 for (
int i = 0; i < list.size(); i++)
The custom viewer plugin implements simple viewer functionality presented in a customized look and feel It was developed to demonstrate extensibility and customizability of the blueberry application framework As an example for the GUI customization capabilities provided by the BlueBerry application the custom viewer plugin was developed It features simple viewer functionality presented in a customized look and feel The custom viewer consists of two i e a viewer perspective and a DICOM perspective As part of the viewer an instance of QmitkDataManagerView allows for data selection Visualization of the selected data is then performed by a simple render window view According data can either be directly loaded from file or be imported as DICOM data DICOM import functionality is accessible from the DICOM perspective incorporating the QmitkDicomExternalDataWidget The customization of Qt Stylesheets is used to give the application a non native look and feel This is further emphasized by a Tab Widget like unification of the perspectives with the according perspective bar In addition to an absence of menu