Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
qtui.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2015 by the Quassel Project *
3  * devel@quassel-irc.org *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) version 3. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef QTUI_H
22 #define QTUI_H
23 
24 #include "graphicalui.h"
25 
27 #include "qtuistyle.h"
28 
29 class MainWin;
30 class MessageModel;
32 
34 
37 class QtUi : public GraphicalUi
38 {
39  Q_OBJECT
40 
41 public:
42  QtUi();
43  ~QtUi();
44 
45  MessageModel *createMessageModel(QObject *parent);
47 
48  inline static QtUi *instance();
49  inline static QtUiStyle *style();
50  inline static MainWin *mainWindow();
51 
52  static bool haveSystemTray();
53 
54  /* Notifications */
55 
59  static const QList<AbstractNotificationBackend *> &notificationBackends();
60  static const QList<AbstractNotificationBackend::Notification> &activeNotifications();
61 
62 public slots:
63  virtual void init();
64 
65  uint invokeNotification(BufferId bufId, AbstractNotificationBackend::NotificationType type, const QString &sender, const QString &text);
66  void closeNotification(uint notificationId);
67  void closeNotifications(BufferId bufferId = BufferId());
68 
69 protected slots:
70  void connectedToCore();
71  void disconnectedFromCore();
72  void notificationActivated(uint notificationId);
74 
75 protected:
76  virtual void minimizeRestore(bool show);
77  virtual bool isHidingMainWidgetAllowed() const;
78 
79 private slots:
80  void useSystemTrayChanged(const QVariant &);
81 
82 private:
83  static QtUi *_instance;
84  static MainWin *_mainWin;
85  static QList<AbstractNotificationBackend *> _notificationBackends;
86  static QList<AbstractNotificationBackend::Notification> _notifications;
87 
89 };
90 
91 
92 QtUi *QtUi::instance() { return _instance ? _instance : new QtUi(); }
93 QtUiStyle *QtUi::style() { return qobject_cast<QtUiStyle *>(uiStyle()); }
95 
96 #endif