Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
GraphicalUi Class Reference

#include </tmp/quassel/src/uisupport/graphicalui.h>

Inheritance diagram for GraphicalUi:
Collaboration diagram for GraphicalUi:

Signals

void connectToCore (const QVariantMap &connInfo)
void disconnectFromCore ()

Public Member Functions

 GraphicalUi (QObject *parent=0)
virtual void init ()
virtual MessageModelcreateMessageModel (QObject *parent)=0
virtual AbstractMessageProcessorcreateMessageProcessor (QObject *parent)=0

Static Public Member Functions

static ActionCollectionactionCollection (const QString &category="General", const QString &translatedCategory=QString())
 Access global ActionCollections.
static QHash< QString,
ActionCollection * > 
actionCollections ()
static void loadShortcuts ()
 Load custom shortcuts from ShortcutSettings.
static void saveShortcuts ()
 Save custom shortcuts to ShortcutSettings.
static ContextMenuActionProvidercontextMenuActionProvider ()
static ToolBarActionProvidertoolBarActionProvider ()
static UiStyleuiStyle ()
static QWidget * mainWidget ()
static void activateMainWidget ()
 Force the main widget to the front and focus it (may not work in all window systems)
static void hideMainWidget ()
 Hide main widget (storing the current desktop if possible)
static void toggleMainWidget ()
 Toggle main widget.
static bool isMainWidgetVisible ()
 Check if the main widget if (fully, in KDE) visible.

Protected Slots

virtual void disconnectedFromCore ()
virtual void connectedToCore ()

Protected Member Functions

void setMainWidget (QWidget *)
 This is the widget we associate global actions with, typically the main window.
bool checkMainWidgetVisibility (bool performToggle)
 Check if the mainWidget is visible and optionally toggle its visibility.
virtual void minimizeRestore (bool show)
 Minimize to or restore main widget.
virtual bool isHidingMainWidgetAllowed () const
 Whether it is allowed to hide the mainWidget.
void setContextMenuActionProvider (ContextMenuActionProvider *)
void setToolBarActionProvider (ToolBarActionProvider *)
void setUiStyle (UiStyle *)
virtual bool eventFilter (QObject *obj, QEvent *event)

Static Private Member Functions

static GraphicalUiinstance ()

Static Private Attributes

static GraphicalUi_instance = 0
static QWidget * _mainWidget = 0
static QHash< QString,
ActionCollection * > 
_actionCollections
static ContextMenuActionProvider_contextMenuActionProvider = 0
static ToolBarActionProvider_toolBarActionProvider = 0
static UiStyle_uiStyle = 0
static bool _onAllDesktops = false

Detailed Description

Definition at line 35 of file graphicalui.h.

Constructor & Destructor Documentation

GraphicalUi ( QObject *  parent = 0)

Definition at line 47 of file graphicalui.cpp.

References _instance.

Member Function Documentation

void init ( )
virtual

Implements AbstractUi.

Definition at line 58 of file graphicalui.cpp.

References mainWidget().

ActionCollection * actionCollection ( const QString &  category = "General",
const QString &  translatedCategory = QString() 
)
static

Access global ActionCollections.

These ActionCollections are associated with the main window, i.e. they contain global actions (and thus, shortcuts). Widgets providing application-wide shortcuts should create appropriate Action objects using GraphicalUi::actionCollection(cat)->add<Action>().

Parameters
categoryThe category (default: "General")

Definition at line 66 of file graphicalui.cpp.

References _actionCollections, _mainWidget, and ActionCollection::addAssociatedWidget().

Referenced by BufferWidget::addActionsToMenu(), BufferWidget::BufferWidget(), ChatViewSearchBar::ChatViewSearchBar(), ChatScene::contextMenuEvent(), MultiLineEdit::event(), InputWidget::eventFilter(), TabCompleter::eventFilter(), SystemTray::init(), MainWin::init(), InputWidget::InputWidget(), MainWin::setConnectedState(), MainWin::setDisconnectedState(), MainWin::setupActions(), MainWin::setupMenus(), MainWin::setupStatusBar(), and TabCompleter::TabCompleter().

QHash< QString, ActionCollection * > actionCollections ( )
static

Definition at line 84 of file graphicalui.cpp.

References _actionCollections.

Referenced by loadShortcuts(), saveShortcuts(), and MainWin::showShortcutsDlg().

void loadShortcuts ( )
static

Load custom shortcuts from ShortcutSettings.

Note
This method assumes that all configurable actions are defined when being called

Definition at line 90 of file graphicalui.cpp.

References actionCollections(), and ActionCollection::readSettings().

Referenced by MainWin::init().

void saveShortcuts ( )
static

Save custom shortcuts to ShortcutSettings.

Definition at line 97 of file graphicalui.cpp.

References actionCollections(), ShortcutSettings::clear(), and ActionCollection::writeSettings().

Referenced by ShortcutsSettingsPage::save().

ToolBarActionProvider * toolBarActionProvider ( )
inlinestatic

Definition at line 129 of file graphicalui.h.

References _toolBarActionProvider.

Referenced by MainWin::setupToolBars().

UiStyle * uiStyle ( )
inlinestatic
QWidget * mainWidget ( )
inlinestatic
void activateMainWidget ( )
static

Force the main widget to the front and focus it (may not work in all window systems)

Definition at line 265 of file graphicalui.cpp.

References _onAllDesktops, and mainWidget().

Referenced by minimizeRestore(), and QtUi::notificationActivated().

void hideMainWidget ( )
static

Hide main widget (storing the current desktop if possible)

Definition at line 310 of file graphicalui.cpp.

References _onAllDesktops, instance(), isHidingMainWidgetAllowed(), and mainWidget().

Referenced by MainWin::closeEvent(), minimizeRestore(), and MainWin::restoreStateFromSettings().

void toggleMainWidget ( )
static
bool isMainWidgetVisible ( )
static

Check if the main widget if (fully, in KDE) visible.

Definition at line 250 of file graphicalui.cpp.

References checkMainWidgetVisibility(), and instance().

Referenced by SystemTray::trayMenuAboutToShow().

void setMainWidget ( QWidget *  widget)
protected

This is the widget we associate global actions with, typically the main window.

Definition at line 106 of file graphicalui.cpp.

References _mainWidget.

Referenced by QtUi::QtUi().

bool checkMainWidgetVisibility ( bool  performToggle)
protected

Check if the mainWidget is visible and optionally toggle its visibility.

With KDE integration, we check if the mainWidget is (partially) obscured in order to determine if it should be activated or hidden. Without KDE, we need to resort to checking the current state as Qt knows it, ignoring windows covering it.

Parameters
performToggleIf true, toggle the window's state in addition to checking visibility
Returns
True, if the window is currently not visible (needs activation)

Definition at line 154 of file graphicalui.cpp.

References mainWidget(), and minimizeRestore().

Referenced by isMainWidgetVisible(), and toggleMainWidget().

void minimizeRestore ( bool  show)
protectedvirtual

Minimize to or restore main widget.

Reimplemented in QtUi.

Definition at line 256 of file graphicalui.cpp.

References activateMainWidget(), and hideMainWidget().

Referenced by checkMainWidgetVisibility().

bool isHidingMainWidgetAllowed ( ) const
inlineprotectedvirtual

Whether it is allowed to hide the mainWidget.

The default implementation returns false, meaning that we won't hide the mainWidget even if requested. This is to prevent hiding in case we don't have a tray icon to restore from.

Reimplemented in QtUi.

Definition at line 132 of file graphicalui.h.

Referenced by hideMainWidget().

void setContextMenuActionProvider ( ContextMenuActionProvider provider)
protected

Definition at line 112 of file graphicalui.cpp.

References _contextMenuActionProvider.

Referenced by QtUi::QtUi().

void setToolBarActionProvider ( ToolBarActionProvider provider)
protected

Definition at line 118 of file graphicalui.cpp.

References _toolBarActionProvider.

Referenced by QtUi::QtUi().

void setUiStyle ( UiStyle style)
protected

Definition at line 124 of file graphicalui.cpp.

References _uiStyle.

Referenced by QtUi::QtUi().

bool eventFilter ( QObject *  obj,
QEvent *  event 
)
protectedvirtual

Definition at line 138 of file graphicalui.cpp.

References mainWidget().

void disconnectedFromCore ( )
protectedvirtualslot
GraphicalUi * instance ( )
inlinestaticprivate

Reimplemented in QtUi.

Definition at line 127 of file graphicalui.h.

References _instance.

Referenced by hideMainWidget(), isMainWidgetVisible(), and toggleMainWidget().

virtual MessageModel* createMessageModel ( QObject *  parent)
pure virtualinherited

Implemented in QtUi.

Referenced by Client::init().

virtual AbstractMessageProcessor* createMessageProcessor ( QObject *  parent)
pure virtualinherited

Implemented in QtUi.

Referenced by Client::init().

virtual void connectedToCore ( )
inlineprotectedvirtualslotinherited

Definition at line 48 of file abstractui.h.

void connectToCore ( const QVariantMap &  connInfo)
signalinherited

Referenced by QtUi::QtUi().

void disconnectFromCore ( )
signalinherited

Referenced by QtUi::QtUi().

Member Data Documentation

GraphicalUi * _instance = 0
staticprivate

Definition at line 111 of file graphicalui.h.

Referenced by GraphicalUi(), and instance().

QWidget * _mainWidget = 0
staticprivate

Definition at line 112 of file graphicalui.h.

Referenced by actionCollection(), mainWidget(), and setMainWidget().

QHash< QString, ActionCollection * > _actionCollections
staticprivate

Definition at line 113 of file graphicalui.h.

Referenced by actionCollection(), and actionCollections().

ContextMenuActionProvider * _contextMenuActionProvider = 0
staticprivate
ToolBarActionProvider * _toolBarActionProvider = 0
staticprivate
UiStyle * _uiStyle = 0
staticprivate

Definition at line 116 of file graphicalui.h.

Referenced by setUiStyle(), and uiStyle().

bool _onAllDesktops = false
staticprivate

Definition at line 117 of file graphicalui.h.

Referenced by activateMainWidget(), and hideMainWidget().


The documentation for this class was generated from the following files: