X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fqtui.h;h=9a00ef4e4e4684bb0e35743e05a01b8c480d63de;hp=2c1156f706c54d9914ef5c31643ba53be34ed27d;hb=d0e9b9ff20a9b8e41b7983c6601aa4e04a50062f;hpb=4df7862b00b2113dabdf52342b2c15560313f476 diff --git a/src/qtui/qtui.h b/src/qtui/qtui.h index 2c1156f7..9a00ef4e 100644 --- a/src/qtui/qtui.h +++ b/src/qtui/qtui.h @@ -21,12 +21,16 @@ #ifndef QTUI_H #define QTUI_H -#include "qtuistyle.h" #include "quasselui.h" +#include "abstractnotificationbackend.h" +#include "mainwin.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 +46,28 @@ 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"); + inline AbstractActionProvider *actionProvider() const; + + /* 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 +77,17 @@ protected slots: void disconnectedFromCore(); private: - MainWin *mainWin; + AbstractActionProvider *_actionProvider; + + static QPointer _mainWin; + static QHash _actionCollections; static QtUiStyle *_style; + static QList _notificationBackends; + static QList _notifications; }; +QtUiStyle *QtUi::style() { return _style; } +MainWin *QtUi::mainWindow() { return _mainWin; } +AbstractActionProvider *QtUi::actionProvider() const { return _actionProvider; } + #endif