~ubuntu-branches/ubuntu/saucy/quassel/saucy-proposed

« back to all changes in this revision

Viewing changes to src/uisupport/graphicalui.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-02-17 12:49:50 UTC
  • mto: This revision was merged to the branch mainline in revision 59.
  • Revision ID: james.westby@ubuntu.com-20100217124950-v9hajw5d2xa6fszn
Tags: upstream-0.6~beta1
ImportĀ upstreamĀ versionĀ 0.6~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
class ToolBarActionProvider;
29
29
class UiStyle;
30
30
 
 
31
#ifdef Q_WS_WIN
 
32
#  include <windows.h>
 
33
#endif
 
34
 
31
35
class GraphicalUi : public AbstractUi {
32
36
  Q_OBJECT
33
37
 
34
38
public:
35
39
  GraphicalUi(QObject *parent = 0);
 
40
  virtual void init();
36
41
 
37
42
  //! Access global ActionCollections.
38
43
  /** These ActionCollections are associated with the main window, i.e. they contain global
45
50
  inline static ContextMenuActionProvider *contextMenuActionProvider();
46
51
  inline static ToolBarActionProvider *toolBarActionProvider();
47
52
  inline static UiStyle *uiStyle();
 
53
  inline static QWidget *mainWidget();
 
54
 
 
55
  //! Force the main widget to the front and focus it (may not work in all window systems)
 
56
  static void activateMainWidget();
 
57
 
 
58
  //! Hide main widget (storing the current desktop if possible)
 
59
  static void hideMainWidget();
 
60
 
 
61
  //! Toggle main widget
 
62
  static void toggleMainWidget();
 
63
 
 
64
  //! Check if the main widget if (fully, in KDE) visible
 
65
  static bool isMainWidgetVisible();
48
66
 
49
67
protected:
50
68
  //! This is the widget we associate global actions with, typically the main window
51
69
  void setMainWidget(QWidget *);
52
70
 
 
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)
 
77
   */
 
78
  bool checkMainWidgetVisibility(bool performToggle);
 
79
 
 
80
  //! Minimize to or restore main widget
 
81
  virtual void minimizeRestore(bool show);
 
82
 
 
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.
 
86
   */
 
87
  virtual inline bool isHidingMainWidgetAllowed() const;
 
88
 
53
89
  void setContextMenuActionProvider(ContextMenuActionProvider *);
54
90
  void setToolBarActionProvider(ToolBarActionProvider *);
55
91
  void setUiStyle(UiStyle *);
56
92
 
 
93
  virtual bool eventFilter(QObject *obj, QEvent *event);
 
94
 
57
95
private:
 
96
  static inline GraphicalUi *instance();
 
97
 
 
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;
 
105
 
 
106
#ifdef Q_WS_WIN
 
107
  DWORD _dwTickCount;
 
108
#endif
 
109
 
63
110
};
64
111
 
65
 
ContextMenuActionProvider *GraphicalUi::contextMenuActionProvider() {
66
 
  return _contextMenuActionProvider;
67
 
}
68
 
 
69
 
ToolBarActionProvider *GraphicalUi::toolBarActionProvider() {
70
 
  return _toolBarActionProvider;
71
 
}
72
 
 
73
 
UiStyle *GraphicalUi::uiStyle() {
74
 
  return _uiStyle;
75
 
}
 
112
// inlines
 
113
 
 
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; }
76
120
 
77
121
#endif