16 #include <QStringList> 22 #include <ctkCmdLineModuleDescription.h> 23 #include <ctkCmdLineModuleReference.h> 24 #include <ctkCmdLineModuleManager.h> 28 : ctkMenuComboBox(parent)
29 , m_ModuleManager(nullptr)
31 qRegisterMetaType<ctkCmdLineModuleReference>();
45 if (m_ModuleManager !=
nullptr)
47 QObject::disconnect(manager,
nullptr,
this,
nullptr);
50 m_ModuleManager = manager;
52 connect(m_ModuleManager, SIGNAL(moduleRegistered(
const ctkCmdLineModuleReference&)),
this, SLOT(OnModuleRegistered(
const ctkCmdLineModuleReference&)));
53 connect(m_ModuleManager, SIGNAL(moduleUnregistered(
const ctkCmdLineModuleReference&)),
this, SLOT(OnModuleUnRegistered(
const ctkCmdLineModuleReference&)));
60 return m_ModuleManager;
65 void QmitkCmdLineModuleMenuComboBox::OnModuleRegistered(
const ctkCmdLineModuleReference&)
72 void QmitkCmdLineModuleMenuComboBox::OnModuleUnRegistered(
const ctkCmdLineModuleReference&)
79 void QmitkCmdLineModuleMenuComboBox::AddName(
80 QList< QHash<QString, QMenu*>* >& listOfHashMaps,
86 if (depth >= listOfHashMaps.size())
88 int need = depth - listOfHashMaps.size();
89 for (
int i = 0; i <= need; i++)
91 auto newHashMap =
new QHash<QString, QMenu*>();
92 listOfHashMaps.push_back(newHashMap);
95 listOfHashMaps[depth]->insert(name, menu);
100 void QmitkCmdLineModuleMenuComboBox::RebuildMenu()
102 if (m_ModuleManager ==
nullptr)
104 qDebug() <<
"QmitkCmdLineModuleMenuComboBox::RebuildMenu(): Module Manager is nullptr? Surely a bug?";
111 auto menu =
new QMenu();
112 QStringList listOfModules;
114 QList<ctkCmdLineModuleReference> references = m_ModuleManager->moduleReferences();
117 for (
int i = 0; i < references.size(); i++)
119 ctkCmdLineModuleReference reference = references[i];
120 ctkCmdLineModuleDescription description = reference.description();
121 QString title = description.title();
122 QString category = description.category();
123 QString fullName = category +
"." + title;
124 listOfModules << fullName;
128 listOfModules.sort();
131 QList< QHash<QString, QMenu*>* > list;
134 foreach (QString fullName, listOfModules)
137 QMenu *currentMenu =
menu;
140 QStringList nameParts = fullName.split(
".", QString::SkipEmptyParts);
143 for (
int i = 0; i < nameParts.size(); i++)
145 QString part = nameParts[i];
147 if (i != nameParts.size() - 1)
150 if (list.size() <= i || list[i] ==
nullptr || !list[i]->contains(part))
152 auto newMenu =
new QMenu(part);
153 currentMenu->addMenu(newMenu);
154 currentMenu = newMenu;
158 this->AddName(list, i, part, newMenu);
162 currentMenu = list[i]->value(part);
168 QAction *action = currentMenu->addAction(part);
173 action->setObjectName(fullName);
179 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