ImagingTools Core SDK
CApplicationSwitchCommandComp.h
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ImtCore-Commercial
2#pragma once
3
4
5// ACF includes
6#include <imod/CMultiModelDispatcherBase.h>
7#include <icomp/CComponentBase.h>
8#include <ibase/ICommandsProvider.h>
9#include <ifile/IFileNameParam.h>
10#include <iqtgui/IIconProvider.h>
11#include <iqtgui/CHierarchicalCommand.h>
12#include <iqtgui/TMakeIconProviderCompWrap.h>
13#include <ibase/TLocalizableWrap.h>
14#include <iprm/IEnableableParam.h>
15#include <iprm/INameParam.h>
16
17
18namespace imtgui
19{
20
21
27 public QObject,
28 public iqtgui::TMakeIconProviderCompWrap<ibase::TLocalizableWrap<icomp::CComponentBase> >,
29 public imod::CMultiModelDispatcherBase,
30 virtual public ibase::ICommandsProvider
31{
32 Q_OBJECT
33
34public:
35 typedef iqtgui::TMakeIconProviderCompWrap<ibase::TLocalizableWrap<icomp::CComponentBase> > BaseClass;
36 typedef imod::CMultiModelDispatcherBase BaseClass2;
37
38 I_BEGIN_COMPONENT(CApplicationSwitchCommandComp);
39 I_REGISTER_INTERFACE(ibase::ICommandsProvider);
40 I_ASSIGN(m_actionIconAttrPtr, "ActionIcon", "Icon used for command menu", true, ":/Icons");
41 I_ASSIGN(m_actionShortcutAttrPtr, "ActionShortcut", "Keyboard shortcut", false, "");
42 I_ASSIGN(m_menuNameAttrPtr, "MenuName", "Name of the menu for the action group", true, "Application Switch");
43 I_ASSIGN(m_menuDescriptionAttrPtr, "MenuDescription", "Description for the action group", true, "Swtich between applications");
44 I_ASSIGN(m_rootMenuNameAttrPtr, "RootMenu", "Name of the root command", true, "");
45 I_ASSIGN(m_executablePathCompPtr, "ExecutablePath", "Path to process exectuable", true, "ExecutablePath");
46 I_ASSIGN_TO(m_executablePathModelCompPtr, m_executablePathCompPtr, true);
47 I_ASSIGN(m_menuItemVisibilityCompPtr, "MenuItemVisibility", "Visibility of menu item (true = visibile)", false, "MenuItemVisibility");
48 I_ASSIGN_TO(m_menuItemVisibilityModelCompPtr, m_menuItemVisibilityCompPtr, true);
49 I_ASSIGN(m_parametersCompPtr, "Parameters", "List of parameters to pass to the application split by ;", false, "");
50 I_END_COMPONENT;
51
52 enum ModelIds
53 {
54 MI_EXECUTABLE_PATH,
55 MI_VISIBILITY,
56 MI_NAME
57 };
58
60
61 // reimplemented (imod::CMultiModelDispatcherBase)
62 virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet& changeSet) override;
63
64 // reimpemented (ibase::ICommandsProvider)
65 virtual const ibase::IHierarchicalCommand* GetCommands() const override;
66
67 // reimpemented (icomp::IComponent)
68 virtual void OnComponentCreated() override;
69 virtual void OnComponentDestroyed() override;
70
71protected:
72 // reimpemented (ibase::TLocalizableWrap)
73 virtual void OnLanguageChanged() override;
74 virtual void OnDesignSchemaChanged(const QByteArray& themeId) override;
75
76private Q_SLOTS:
77 void OnCommandActivated();
78
79protected:
80 I_ATTR(QByteArray, m_actionIconAttrPtr);
81 I_TEXTATTR(m_menuNameAttrPtr);
82 I_TEXTATTR(m_menuDescriptionAttrPtr);
83 I_TEXTATTR(m_rootMenuNameAttrPtr);
84 I_TEXTATTR(m_actionShortcutAttrPtr);
85 I_REF(ifile::IFileNameParam, m_executablePathCompPtr);
86 I_REF(imod::IModel, m_executablePathModelCompPtr);
87 I_REF(iprm::IEnableableParam, m_menuItemVisibilityCompPtr);
88 I_REF(imod::IModel, m_menuItemVisibilityModelCompPtr);
89 I_REF(iprm::INameParam, m_parametersCompPtr);
90
91 iqtgui::CHierarchicalCommand m_rootMenuCommand;
92 iqtgui::CHierarchicalCommand m_mainMenuCommand;
93 iqtgui::CHierarchicalCommand m_switchCommand;
94};
95
96
97} // namespace imtgui
98
99