7#include <QtCore/QTimer>
8#include <QtCore/QProcess>
9#include <QtWidgets/QListView>
10#include <QtWidgets/QMenu>
11#include <QtGui/QStandardItemModel>
12#include <QtGui/QStandardItem>
15#include <imod/CMultiModelDispatcherBase.h>
16#include <ilog/IMessageConsumer.h>
17#include <iqtgui/TDesignerGuiCompBase.h>
18#include <ibase/ICommandsProvider.h>
19#include <iprm/ISelectionParam.h>
20#include <iqtgui/CHierarchicalCommand.h>
21#include <iqtgui/TRestorableGuiWrap.h>
22#include <iqtgui/IDialog.h>
23#include <imeas/INumericValue.h>
24#include <iauth/ILogin.h>
25#include <iauth/IRightsProvider.h>
28#include <imtgui/IWidgetProvider.h>
29#include <imtgui/IPageNavigationController.h>
30#include <imtgui/CThumbPageItemGuiDelegate.h>
31#include <GeneratedFiles/imtgui/ui_CThumbnailDecoratorGuiComp.h>
38 class CCollectionInfo;
46class CThumbnailDecoratorGuiCompAttr:
47 public iqtgui::TRestorableGuiWrap<iqtgui::TDesignerGuiCompBase<Ui::CThumbnailDecoratorGuiComp>>
50 typedef iqtgui::TRestorableGuiWrap<
51 iqtgui::TDesignerGuiCompBase<Ui::CThumbnailDecoratorGuiComp>> BaseClass;
53 I_BEGIN_BASE_COMPONENT(CThumbnailDecoratorGuiCompAttr);
54 I_ASSIGN(m_horizontalItemsViewAttrPtr,
"HorizontalItemsView",
"Count of visual items in horizontal row",
false, 1);
55 I_ASSIGN(m_verticalItemsViewAttrPtr,
"VerticalItemsView",
"Count of visual items in vertical column",
false, 1);
56 I_ASSIGN(m_horizontalSpacingAttrPtr,
"HorizontalSpacing",
"Horizontal spacing of items on view",
false, 15);
57 I_ASSIGN(m_verticalSpacingAttrPtr,
"VerticalSpacing",
"Vertical spacing of items on view",
false, 15);
58 I_ASSIGN(m_horizontalFrameMarginAttrPtr,
"HorizontalFrameMargin",
"Horizontal (left&right) side margin of thumbnail frame",
false, 15);
59 I_ASSIGN(m_verticalFrameMarginAttrPtr,
"VerticalFrameMargin",
"Vertical (top&bottom) side margin of thumbnail frame",
false, 15);
60 I_ASSIGN(m_maximumFrameWidthAttrPtr,
"MaximumFrameWidth",
"Maximum width of thumbnail frame",
false, 320);
61 I_ASSIGN(m_maximumFrameHeightAttrPtr,
"MaximumFrameHeight",
"Maximum height of thumbnail frame",
false, 240);
62 I_ASSIGN(m_autoLogoutMinutesAttrPtr,
"AutoLogoutMinutes",
"Time intervall for the automatic logout",
false, 60);
63 I_ASSIGN(m_defaultPageIndexAttrPtr,
"DefaultPageIndex",
"Index of the default (start) page",
false, -1);
64 I_ASSIGN(m_welcomeTextAttrPtr,
"WelcomeText",
"Welcome text on the start page",
true,
"Welcome");
65 I_ASSIGN(m_closeRightIdAttrPtr,
"CloseRightId",
"ID of the user right to close the application",
false,
"Close");
66 I_ASSIGN_MULTI_0(m_disablePageListViewIndexesAttrPtr,
"DisablePageListViewIndexes",
"List of page indexes where the page list view is not shown",
false);
67 I_ASSIGN(m_showPageTitlesAttrPtr,
"ShowPageTitles",
"Show title of the current page in the main tool bar",
true,
true);
68 I_ASSIGN(m_loginGuiCompPtr,
"LoginGui",
"Login gui",
false,
"StandardLoginGui");
72 I_ATTR(
int, m_horizontalItemsViewAttrPtr);
73 I_ATTR(
int, m_verticalItemsViewAttrPtr);
74 I_ATTR(
int, m_horizontalSpacingAttrPtr);
75 I_ATTR(
int, m_verticalSpacingAttrPtr);
76 I_ATTR(
int, m_horizontalFrameMarginAttrPtr);
77 I_ATTR(
int, m_verticalFrameMarginAttrPtr);
78 I_ATTR(
int, m_maximumFrameWidthAttrPtr);
79 I_ATTR(
int, m_maximumFrameHeightAttrPtr);
80 I_ATTR(
int, m_autoLogoutMinutesAttrPtr);
81 I_ATTR(
int, m_defaultPageIndexAttrPtr);
82 I_TEXTATTR(m_welcomeTextAttrPtr);
83 I_ATTR(QByteArray, m_closeRightIdAttrPtr);
84 I_MULTIATTR(
int, m_disablePageListViewIndexesAttrPtr);
85 I_ATTR(
bool, m_showPageTitlesAttrPtr);
86 I_REF(iqtgui::IGuiObject, m_loginGuiCompPtr);
90class CThumbnailDecoratorGuiCompAttr2:
public CThumbnailDecoratorGuiCompAttr
93 typedef CThumbnailDecoratorGuiCompAttr BaseClass;
95 I_BEGIN_BASE_COMPONENT(CThumbnailDecoratorGuiCompAttr2);
96 I_ASSIGN(m_hideMenuPanelOnHomePageAttrPtr,
"HideMenuPanelOnHomePage",
"Hide menu panel when home page is active",
true,
true);
97 I_ASSIGN(m_hideCommandButtonAttrPtr,
"HideCommandButton",
"Hide command button",
true,
true);
98 I_ASSIGN(m_hideHomeButtonAttrPtr,
"HideHomeButton",
"Hide home button",
true,
false);
99 I_ASSIGN(m_accountMenuCompPtr,
"AccountMenu",
"Menu for logged account",
false,
"AccountMenu");
100 I_ASSIGN(m_viewPageNavigationAttrPtr,
"ViewPageNavigation",
"View page navigation",
true,
true);
101 I_ASSIGN(m_quitDialogIgnoredAttrPtr,
"QuitDialogIgnored",
"If true, exit application without dialog",
true,
false);
102 I_ASSIGN(m_additionalCommandsProviderCompPtr,
"AdditionalCommands",
"Additional tool commands showed on the right side of the main tool bar",
false,
"AdditionalCommands");
103 I_ASSIGN_TO(m_additionalCommandsProviderModelCompPtr, m_additionalCommandsProviderCompPtr,
false);
104 I_ASSIGN_MULTI_0(m_additionalCommandIdsAttrPtr,
"AdditionalCommandIds",
"Additional command IDs",
false);
105 I_ASSIGN_MULTI_0(m_additionalCommandActivatorsCompPtr,
"AdditionalCommandActivators",
"Additional command activators that allow the display of commands",
false);
106 I_ASSIGN(m_rightsCommandsCompPtr,
"RightsCommands",
"Additional tool commands showed on the right side of the login button",
false,
"RightsCommands");
107 I_ASSIGN(m_fullscreenCommandCompPtr,
"FullscreenCommand",
"Tool command to switch an application to full screen mode",
false,
"FullscreenCommand");
108 I_ASSIGN(m_appLogoPathAttrPtr,
"AppLogoPath",
"Path to the application logo in resources",
true,
"");
112 I_ATTR(
bool, m_hideMenuPanelOnHomePageAttrPtr);
113 I_ATTR(
bool, m_hideHomeButtonAttrPtr);
114 I_ATTR(
bool, m_hideCommandButtonAttrPtr);
115 I_REF(iqtgui::IGuiObject, m_accountMenuCompPtr);
116 I_ATTR(
bool, m_viewPageNavigationAttrPtr);
117 I_ATTR(
bool, m_quitDialogIgnoredAttrPtr);
118 I_REF(ibase::ICommandsProvider, m_additionalCommandsProviderCompPtr);
119 I_REF(imod::IModel, m_additionalCommandsProviderModelCompPtr);
120 I_MULTIATTR(QByteArray, m_additionalCommandIdsAttrPtr);
121 I_MULTIREF(iprm::IEnableableParam, m_additionalCommandActivatorsCompPtr);
122 I_REF(ibase::ICommandsProvider, m_rightsCommandsCompPtr);
123 I_REF(ibase::ICommandsProvider, m_fullscreenCommandCompPtr);
124 I_ATTR(QString, m_appLogoPathAttrPtr);
128class CThumbnailDecoratorGuiComp:
129 public CThumbnailDecoratorGuiCompAttr2,
130 public virtual ibase::ICommandsProvider,
131 virtual public IWidgetProvider
136 typedef CThumbnailDecoratorGuiCompAttr2 BaseClass;
138 I_BEGIN_COMPONENT(CThumbnailDecoratorGuiComp);
139 I_REGISTER_INTERFACE(ibase::ICommandsProvider);
140 I_REGISTER_INTERFACE(IWidgetProvider);
141 I_ASSIGN(m_menuPanelVisibilityCompPtr,
"MenuPanelVisibility",
"Menu panel visibility status",
false,
"MenuPanelVisibility");
142 I_ASSIGN(m_pagesWidgetCompPtr,
"PageUiContainer",
"UI component containing all application pages",
true,
"PageUiContainer");
143 I_ASSIGN(m_pagesCompPtr,
"PageModel",
"Data model describing the used pages",
true,
"PageModel");
144 I_ASSIGN_TO(m_pagesModelCompPtr, m_pagesCompPtr,
true);
145 I_ASSIGN(m_commandsProviderCompPtr,
"Commands",
"Provider of the commands showed in the main tool bar",
false,
"Commands");
146 I_ASSIGN_TO(m_commandsProviderModelCompPtr, m_commandsProviderCompPtr,
false);
147 I_ASSIGN(m_loginCompPtr,
"Login",
"Login logic component",
false,
"Login");
148 I_ASSIGN_TO(m_loginModelCompPtr, m_loginCompPtr,
false);
149 I_ASSIGN(m_rightsCompPtr,
"Rights",
"User rights for the application",
false,
"Rights");
150 I_ASSIGN_TO(m_rightsModelCompPtr, m_rightsCompPtr,
false);
151 I_ASSIGN(m_autoLogoutMinutesCompPtr,
"AutoLogoutTime",
"Parameter to control automatical logout interval. Setting of this parameter overrides 'AutoLogoutMinutes' value",
false,
"AutoLogoutTime");
152 I_ASSIGN(m_leftMenuPanelGuiCompPtr,
"LeftMenuPanel",
"Left menu panel",
false,
"LeftMenuPanel");
153 I_ASSIGN(m_pageNavigationControllerCompPtr,
"NavigationController",
"Page navigation controller",
false,
"NavigationController");
154 I_ASSIGN(m_dashboardGuiCompPtr,
"Dashboard",
"Dashboard UI",
false,
"Dashboard");
155 I_ASSIGN(m_preferencesDialogCompPtr,
"PreferencesDialog",
"Preferences dialog",
false,
"Preferences");
180 UA_APPLICATION_EXIT = 0,
181 UA_LOGIN_CONTROL_ENABLED,
186 CThumbnailDecoratorGuiComp();
190 virtual QWidget* GetWidgetPtr(
const QByteArray& widgetId)
const override;
193 virtual const ibase::IHierarchicalCommand* GetCommands()
const override;
196 virtual bool eventFilter(QObject* watched, QEvent* event)
override;
200 virtual void OnRestoreSettings(
const QSettings& settings)
override;
201 virtual void OnSaveSettings(QSettings& settings)
const override;
204 virtual void OnGuiCreated()
override;
205 virtual void OnGuiDestroyed()
override;
206 virtual void OnGuiRetranslate()
override;
207 virtual void OnTryClose(
bool* ignoredPtr =
nullptr)
override;
208 virtual void OnGuiDesignChanged();
211 virtual void OnComponentCreated()
override;
212 virtual void OnComponentDestroyed()
override;
215 void on_PageList_clicked(
const QModelIndex& index);
216 void on_ExitButton_clicked();
217 void on_SubPages_itemSelectionChanged();
218 void on_HomeButton_clicked();
219 void on_LoginControlButton_clicked();
220 void on_LoginCancelButton_clicked();
221 void on_CommandsMenuButton_clicked();
222 void OnAutoLogoutTimer();
223 void OnCheckIsFullScreenTimer();
224 void on_BackPageButton_clicked();
225 void on_NextPageButton_clicked();
226 void on_DashboardButton_clicked();
227 void on_PreferencesButton_clicked();
228 void UpdateCommands();
231 void EmitUpdateCommands();
234 void ShowLoginPage();
236 void SwitchToPage(
int index);
237 void UpdateLoginButtonsState();
238 void CreatePages(
const iprm::ISelectionParam* selectionPtr);
239 void CreateMenu(
const iprm::ISelectionParam* selectionPtr, QTreeWidgetItem* parentItemPtr);
240 void UpdatePageState();
241 void UpdateAdditionalCommandsEnabled();
242 LoginMode GetLoginMode();
243 int GetAutoLogoutTime()
const;
244 void ProcessLogout();
245 bool IsUserActionAllowed(UserAction action);
246 void ExitApplication();
247 bool IsHomePageEnabled()
const;
248 const ibase::IHierarchicalCommand* FindCommand(
const ibase::IHierarchicalCommand* commandPtr,
const QByteArray& commandId)
const;
255 void GetMenuLayout(
const int count);
256 void SetLayoutProperties(
const int count);
257 void UpdateSettings(
const int count);
258 void UpdateSpacing();
259 void UpdateMargins();
260 void UpdateMaxSize();
261 void UpdateMinSize();
262 void UpdateAdditionalCommands();
263 int SetupCommandsMenu(
const iqtgui::CHierarchicalCommand& command, QMenu& result,
int& prevGroupId);
264 void UpdateMenuVisibility();
269 :selectionPtr(nullptr),
274 iprm::ISelectionParam* selectionPtr;
278 typedef QMap<QStandardItem*, ItemInfo> ItemInfoMap;
279 ItemInfoMap m_itemInfoMap;
281 typedef QMap<QTreeWidgetItem*, ItemInfo> MenuItemInfoMap;
282 MenuItemInfoMap m_subPageItemMap;
285 class CommandsObserver:
public imod::CMultiModelDispatcherBase
288 typedef imod::CMultiModelDispatcherBase BaseClass;
290 explicit CommandsObserver(CThumbnailDecoratorGuiComp& parent);
293 virtual void OnModelChanged(
int modelId,
const istd::IChangeable::ChangeSet& changeSet)
override;
296 CThumbnailDecoratorGuiComp& m_parent;
299 class AdditionalCommandsObserver:
public imod::CMultiModelDispatcherBase
302 typedef imod::CMultiModelDispatcherBase BaseClass;
304 explicit AdditionalCommandsObserver(CThumbnailDecoratorGuiComp& parent);
307 virtual void OnModelChanged(
int modelId,
const istd::IChangeable::ChangeSet& changeSet)
override;
310 CThumbnailDecoratorGuiComp& m_parent;
314 class PageModelObserver:
public imod::CMultiModelDispatcherBase
317 explicit PageModelObserver(CThumbnailDecoratorGuiComp& parent);
320 virtual void OnModelChanged(
int modelId,
const istd::IChangeable::ChangeSet& changeSet)
override;
323 CThumbnailDecoratorGuiComp& m_parent;
327 class LoginObserver:
public imod::CMultiModelDispatcherBase
330 explicit LoginObserver(CThumbnailDecoratorGuiComp& parent);
333 virtual void OnModelChanged(
int modelId,
const istd::IChangeable::ChangeSet& changeSet)
override;
336 CThumbnailDecoratorGuiComp& m_parent;
340 class PageVisualStatusObserver:
public imod::CMultiModelDispatcherBase
343 explicit PageVisualStatusObserver(CThumbnailDecoratorGuiComp& parent);
346 virtual void OnModelChanged(
int modelId,
const istd::IChangeable::ChangeSet& changeSet)
override;
349 CThumbnailDecoratorGuiComp& m_parent;
353 class AdditionalCommendActivatorsObserver:
public imod::CMultiModelDispatcherBase
356 explicit AdditionalCommendActivatorsObserver(CThumbnailDecoratorGuiComp& parent);
359 virtual void OnModelChanged(
int modelId,
const istd::IChangeable::ChangeSet& changeSet)
override;
362 CThumbnailDecoratorGuiComp& m_parent;
366 CommandsObserver m_commandsObserver;
367 AdditionalCommandsObserver m_additionalCommandsObserver;
368 PageModelObserver m_pageModelObserver;
369 LoginObserver m_loginObserver;
370 PageVisualStatusObserver m_pageVisualStatusObserver;
371 AdditionalCommendActivatorsObserver m_additionalCommandActivatorsObserver;
373 QStandardItemModel m_menuItemModel;
377 iqtgui::CHierarchicalCommand m_rootCommands;
378 iqtgui::CHierarchicalCommand m_commands;
381 int m_horizontalSpacing;
382 int m_verticalSpacing;
383 int m_horizontalFrameMargin;
384 int m_verticalFrameMargin;
390 I_REF(iprm::IEnableableParam, m_menuPanelVisibilityCompPtr);
391 I_REF(iqtgui::IGuiObject, m_pagesWidgetCompPtr);
392 I_REF(iprm::ISelectionParam, m_pagesCompPtr);
393 I_REF(imod::IModel, m_pagesModelCompPtr);
394 I_REF(ibase::ICommandsProvider, m_commandsProviderCompPtr);
395 I_REF(imod::IModel, m_commandsProviderModelCompPtr);
396 I_REF(iauth::ILogin, m_loginCompPtr);
397 I_REF(imod::IModel, m_loginModelCompPtr);
398 I_REF(iauth::IRightsProvider, m_rightsCompPtr);
399 I_REF(imod::IModel, m_rightsModelCompPtr);
400 I_REF(imeas::INumericValue, m_autoLogoutMinutesCompPtr);
401 I_REF(iqtgui::IGuiObject, m_leftMenuPanelGuiCompPtr);
402 I_REF(imtgui::IPageNavigationController, m_pageNavigationControllerCompPtr);
403 I_REF(iqtgui::IGuiObject, m_dashboardGuiCompPtr);
404 I_REF(iqtgui::IDialog, m_preferencesDialogCompPtr);
406 QToolBar* m_mainToolBar;
407 QToolBar* m_additionalCommandsToolBar;
408 QToolBar* m_rightsCommandsToolBar;
409 QToolBar* m_fullscreenCommandToolBar;
410 QTimer m_autoLogoutTimer;
411 QTimer m_checkIsFullScreenTimer;
413 QMenu m_commandsMenu;
415 istd::TDelPtr<QProcess> m_keyboardProcessPtr;
416 QString m_winKeyboardPath;
418 int m_lastPageIndexForLoggedUser;
419 bool m_isExitProcess;
421 QSet<int> m_supportedEvents;