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

This class encapsulates Quassel's Qt-based GUI. More...

#include </tmp/quassel/src/qtui/qtui.h>

Inheritance diagram for QtUi:
Collaboration diagram for QtUi:

Public Slots

virtual void init ()
uint invokeNotification (BufferId bufId, AbstractNotificationBackend::NotificationType type, const QString &sender, const QString &text)
void closeNotification (uint notificationId)
void closeNotifications (BufferId bufferId=BufferId())

Signals

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

Public Member Functions

 QtUi ()
 ~QtUi ()
MessageModelcreateMessageModel (QObject *parent)
AbstractMessageProcessorcreateMessageProcessor (QObject *parent)

Static Public Member Functions

static QtUiinstance ()
static QtUiStylestyle ()
static MainWinmainWindow ()
static bool haveSystemTray ()
static void registerNotificationBackend (AbstractNotificationBackend *)
static void unregisterNotificationBackend (AbstractNotificationBackend *)
static void unregisterAllNotificationBackends ()
static const QList
< AbstractNotificationBackend * > & 
notificationBackends ()
static const QList
< AbstractNotificationBackend::Notification > & 
activeNotifications ()
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

void connectedToCore ()
void disconnectedFromCore ()
void notificationActivated (uint notificationId)
void bufferMarkedAsRead (BufferId)

Protected Member Functions

virtual void minimizeRestore (bool show)
 Minimize to or restore main widget.
virtual bool isHidingMainWidgetAllowed () const
 Whether it is allowed to hide the mainWidget.
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.
void setContextMenuActionProvider (ContextMenuActionProvider *)
void setToolBarActionProvider (ToolBarActionProvider *)
void setUiStyle (UiStyle *)
virtual bool eventFilter (QObject *obj, QEvent *event)

Private Slots

void useSystemTrayChanged (const QVariant &)

Private Attributes

bool _useSystemTray

Static Private Attributes

static QtUi_instance = 0
static MainWin_mainWin = 0
static QList
< AbstractNotificationBackend * > 
_notificationBackends
static QList
< AbstractNotificationBackend::Notification
_notifications

Detailed Description

This class encapsulates Quassel's Qt-based GUI.

This is basically a wrapper around MainWin, which is necessary because we cannot derive MainWin from both QMainWindow and AbstractUi (because of multiple inheritance of QObject).

Definition at line 37 of file qtui.h.

Constructor & Destructor Documentation

~QtUi ( )

Definition at line 70 of file qtui.cpp.

References _instance, _mainWin, and unregisterAllNotificationBackends().

Member Function Documentation

MessageModel * createMessageModel ( QObject *  parent)
virtual

Implements AbstractUi.

Definition at line 89 of file qtui.cpp.

AbstractMessageProcessor * createMessageProcessor ( QObject *  parent)
virtual

Implements AbstractUi.

Definition at line 95 of file qtui.cpp.

QtUi * instance ( )
inlinestatic

Reimplemented from GraphicalUi.

Definition at line 92 of file qtui.h.

References _instance, and QtUi().

Referenced by haveSystemTray(), MainWin::messagesInserted(), and registerNotificationBackend().

bool haveSystemTray ( )
static
void registerNotificationBackend ( AbstractNotificationBackend backend)
static
void unregisterNotificationBackend ( AbstractNotificationBackend backend)
static

Definition at line 165 of file qtui.cpp.

References _notificationBackends.

Referenced by SnoreNotificationBackend::setSnoreBackend().

void unregisterAllNotificationBackends ( )
static

Definition at line 171 of file qtui.cpp.

References _notificationBackends.

Referenced by ~QtUi().

const QList< AbstractNotificationBackend * > & notificationBackends ( )
static

Definition at line 177 of file qtui.cpp.

References _notificationBackends.

Referenced by NotificationsSettingsPage::NotificationsSettingsPage().

const QList< AbstractNotificationBackend::Notification > & activeNotifications ( )
static

Definition at line 223 of file qtui.cpp.

References _notifications.

void init ( )
virtualslot

Definition at line 79 of file qtui.cpp.

References _mainWin, MainWin::init(), Settings::initAndNotify(), and useSystemTrayChanged().

Referenced by QtUiApplication::init().

uint invokeNotification ( BufferId  bufId,
AbstractNotificationBackend::NotificationType  type,
const QString &  sender,
const QString &  text 
)
slot
void closeNotification ( uint  notificationId)
slot
void closeNotifications ( BufferId  bufferId = BufferId())
slot
void connectedToCore ( )
protectedslot

Definition at line 101 of file qtui.cpp.

References _mainWin, and MainWin::connectedToCore().

void disconnectedFromCore ( )
protectedslot

Definition at line 107 of file qtui.cpp.

References _mainWin, and MainWin::disconnectedFromCore().

void notificationActivated ( uint  notificationId)
protectedslot
void bufferMarkedAsRead ( BufferId  bufferId)
protectedslot

Definition at line 249 of file qtui.cpp.

References closeNotifications(), and SignedId::isValid().

Referenced by QtUi().

void minimizeRestore ( bool  show)
protectedvirtual

Minimize to or restore main widget.

Reimplemented from GraphicalUi.

Definition at line 141 of file qtui.cpp.

References _useSystemTray, mainWindow(), SystemTray::setVisible(), and MainWin::systemTray().

bool isHidingMainWidgetAllowed ( ) const
protectedvirtual

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 from GraphicalUi.

Definition at line 135 of file qtui.cpp.

References haveSystemTray().

void useSystemTrayChanged ( const QVariant &  v)
privateslot
ActionCollection * actionCollection ( const QString &  category = "General",
const QString &  translatedCategory = QString() 
)
staticinherited

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 GraphicalUi::_actionCollections, GraphicalUi::_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 ( )
staticinherited
void loadShortcuts ( )
staticinherited

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 GraphicalUi::actionCollections(), and ActionCollection::readSettings().

Referenced by MainWin::init().

void saveShortcuts ( )
staticinherited
ToolBarActionProvider * toolBarActionProvider ( )
inlinestaticinherited

Definition at line 129 of file graphicalui.h.

References GraphicalUi::_toolBarActionProvider.

Referenced by MainWin::setupToolBars().

UiStyle * uiStyle ( )
inlinestaticinherited
void activateMainWidget ( )
staticinherited

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 GraphicalUi::_onAllDesktops, and GraphicalUi::mainWidget().

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

void hideMainWidget ( )
staticinherited
bool isMainWidgetVisible ( )
staticinherited

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

Definition at line 250 of file graphicalui.cpp.

References GraphicalUi::checkMainWidgetVisibility(), and GraphicalUi::instance().

Referenced by SystemTray::trayMenuAboutToShow().

void setMainWidget ( QWidget *  widget)
protectedinherited

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

Definition at line 106 of file graphicalui.cpp.

References GraphicalUi::_mainWidget.

Referenced by QtUi().

bool checkMainWidgetVisibility ( bool  performToggle)
protectedinherited

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 GraphicalUi::mainWidget(), and GraphicalUi::minimizeRestore().

Referenced by GraphicalUi::isMainWidgetVisible(), and GraphicalUi::toggleMainWidget().

void setContextMenuActionProvider ( ContextMenuActionProvider provider)
protectedinherited

Definition at line 112 of file graphicalui.cpp.

References GraphicalUi::_contextMenuActionProvider.

Referenced by QtUi().

void setToolBarActionProvider ( ToolBarActionProvider provider)
protectedinherited

Definition at line 118 of file graphicalui.cpp.

References GraphicalUi::_toolBarActionProvider.

Referenced by QtUi().

void setUiStyle ( UiStyle style)
protectedinherited

Definition at line 124 of file graphicalui.cpp.

References GraphicalUi::_uiStyle.

Referenced by QtUi().

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

Definition at line 138 of file graphicalui.cpp.

References GraphicalUi::mainWidget().

void connectToCore ( const QVariantMap &  connInfo)
signalinherited

Referenced by QtUi().

void disconnectFromCore ( )
signalinherited

Referenced by QtUi().

Member Data Documentation

QtUi * _instance = 0
staticprivate

Definition at line 83 of file qtui.h.

Referenced by instance(), QtUi(), and ~QtUi().

MainWin * _mainWin = 0
staticprivate

Definition at line 84 of file qtui.h.

Referenced by connectedToCore(), disconnectedFromCore(), init(), mainWindow(), QtUi(), and ~QtUi().

bool _useSystemTray
private

Definition at line 88 of file qtui.h.

Referenced by haveSystemTray(), minimizeRestore(), and useSystemTrayChanged().


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