45
50
inline static ContextMenuActionProvider *contextMenuActionProvider();
46
51
inline static ToolBarActionProvider *toolBarActionProvider();
47
52
inline static UiStyle *uiStyle();
53
inline static QWidget *mainWidget();
55
//! Force the main widget to the front and focus it (may not work in all window systems)
56
static void activateMainWidget();
58
//! Hide main widget (storing the current desktop if possible)
59
static void hideMainWidget();
61
//! Toggle main widget
62
static void toggleMainWidget();
64
//! Check if the main widget if (fully, in KDE) visible
65
static bool isMainWidgetVisible();
50
68
//! This is the widget we associate global actions with, typically the main window
51
69
void setMainWidget(QWidget *);
71
//! Check if the mainWidget is visible and optionally toggle its visibility
72
/** With KDE integration, we check if the mainWidget is (partially) obscured in order to determine if
73
* it should be activated or hidden. Without KDE, we need to resort to checking the current state
74
* as Qt knows it, ignoring windows covering it.
75
* @param performToggle If true, toggle the window's state in addition to checking visibility
76
* @return True, if the window is currently *not* visible (needs activation)
78
bool checkMainWidgetVisibility(bool performToggle);
80
//! Minimize to or restore main widget
81
virtual void minimizeRestore(bool show);
83
//! Whether it is allowed to hide the mainWidget
84
/** The default implementation returns false, meaning that we won't hide the mainWidget even
85
* if requested. This is to prevent hiding in case we don't have a tray icon to restore from.
87
virtual inline bool isHidingMainWidgetAllowed() const;
53
89
void setContextMenuActionProvider(ContextMenuActionProvider *);
54
90
void setToolBarActionProvider(ToolBarActionProvider *);
55
91
void setUiStyle(UiStyle *);
93
virtual bool eventFilter(QObject *obj, QEvent *event);
96
static inline GraphicalUi *instance();
98
static GraphicalUi *_instance;
58
99
static QWidget *_mainWidget;
59
100
static QHash<QString, ActionCollection *> _actionCollections;
60
101
static ContextMenuActionProvider *_contextMenuActionProvider;
61
102
static ToolBarActionProvider *_toolBarActionProvider;
62
103
static UiStyle *_uiStyle;
104
static bool _onAllDesktops;
65
ContextMenuActionProvider *GraphicalUi::contextMenuActionProvider() {
66
return _contextMenuActionProvider;
69
ToolBarActionProvider *GraphicalUi::toolBarActionProvider() {
70
return _toolBarActionProvider;
73
UiStyle *GraphicalUi::uiStyle() {
114
GraphicalUi *GraphicalUi::instance() { return _instance; }
115
ContextMenuActionProvider *GraphicalUi::contextMenuActionProvider() { return _contextMenuActionProvider; }
116
ToolBarActionProvider *GraphicalUi::toolBarActionProvider() { return _toolBarActionProvider; }
117
UiStyle *GraphicalUi::uiStyle() { return _uiStyle; }
118
QWidget *GraphicalUi::mainWidget() { return _mainWidget; }
119
bool GraphicalUi::isHidingMainWidgetAllowed() const { return false; }