X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fqtui.h;h=4baded8985efcc69ebdd016c75e710e5b98949ec;hp=2c1156f706c54d9914ef5c31643ba53be34ed27d;hb=cccbcc53fb3bef7397d2c2cfb153303cee6326a2;hpb=4df7862b00b2113dabdf52342b2c15560313f476 diff --git a/src/qtui/qtui.h b/src/qtui/qtui.h index 2c1156f7..4baded89 100644 --- a/src/qtui/qtui.h +++ b/src/qtui/qtui.h @@ -21,12 +21,15 @@ #ifndef QTUI_H #define QTUI_H -#include "qtuistyle.h" #include "quasselui.h" +#include "abstractnotificationbackend.h" + +class ActionCollection; class MainWin; class MessageModel; class QtUiMessageProcessor; +class QtUiStyle; //! This class encapsulates Quassel's Qt-based GUI. /** This is basically a wrapper around MainWin, which is necessary because we cannot derive MainWin @@ -42,7 +45,27 @@ public: MessageModel *createMessageModel(QObject *parent); AbstractMessageProcessor *createMessageProcessor(QObject *parent); - inline static QtUiStyle *style() { return _style; } + inline static QtUiStyle *style(); + inline static MainWin *mainWindow(); + + //! 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 QtUi::actionCollection(cat)->add\(). + * @param category The category (default: "General") + */ + static ActionCollection *actionCollection(const QString &category = "General"); + + /* Notifications */ + + static void registerNotificationBackend(AbstractNotificationBackend *); + static void unregisterNotificationBackend(AbstractNotificationBackend *); + static void unregisterAllNotificationBackends(); + static const QList ¬ificationBackends(); + static uint invokeNotification(BufferId bufId, const QString &sender, const QString &text); + static void closeNotification(uint notificationId); + static void closeNotifications(BufferId bufferId = BufferId()); + static const QList &activeNotifications(); public slots: void init(); @@ -52,8 +75,14 @@ protected slots: void disconnectedFromCore(); private: - MainWin *mainWin; + static MainWin *_mainWin; + static QHash _actionCollections; static QtUiStyle *_style; + static QList _notificationBackends; + static QList _notifications; }; +QtUiStyle *QtUi::style() { return _style; } +MainWin *QtUi::mainWindow() { return _mainWin; } + #endif