| 1 | // -*- c-basic-offset: 2 -*- |
|---|
| 2 | /* |
|---|
| 3 | * This file is part of Licq, an instant messaging client for UNIX. |
|---|
| 4 | * Copyright (C) 2000-2006 Licq developers |
|---|
| 5 | * |
|---|
| 6 | * Licq is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * Licq is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with Licq; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | #ifndef DOCKICON_H |
|---|
| 22 | #define DOCKICON_H |
|---|
| 23 | |
|---|
| 24 | #include <QObject> |
|---|
| 25 | |
|---|
| 26 | class QPixmap; |
|---|
| 27 | |
|---|
| 28 | class ICQOwner; |
|---|
| 29 | |
|---|
| 30 | namespace LicqQtGui |
|---|
| 31 | { |
|---|
| 32 | class DockIconWidget; |
|---|
| 33 | |
|---|
| 34 | /** |
|---|
| 35 | * Base class for dock icons |
|---|
| 36 | * Only holds state and common functions needed by dock icon implementations |
|---|
| 37 | */ |
|---|
| 38 | class DockIcon : public QObject |
|---|
| 39 | { |
|---|
| 40 | Q_OBJECT |
|---|
| 41 | |
|---|
| 42 | public: |
|---|
| 43 | /** |
|---|
| 44 | * Constructor |
|---|
| 45 | */ |
|---|
| 46 | DockIcon(); |
|---|
| 47 | |
|---|
| 48 | /** |
|---|
| 49 | * Destructor |
|---|
| 50 | */ |
|---|
| 51 | virtual ~DockIcon(); |
|---|
| 52 | |
|---|
| 53 | /** |
|---|
| 54 | * Update status from daemon |
|---|
| 55 | * Will fetch status and update status variables |
|---|
| 56 | */ |
|---|
| 57 | virtual void updateIconStatus(); |
|---|
| 58 | |
|---|
| 59 | /** |
|---|
| 60 | * Update number of unread events |
|---|
| 61 | * Will update message variables |
|---|
| 62 | * |
|---|
| 63 | * @param newMsg Number of unread user events |
|---|
| 64 | * @param sysMsg Number of unread system events |
|---|
| 65 | */ |
|---|
| 66 | virtual void updateIconMessages(int newMsg, int sysMsg); |
|---|
| 67 | |
|---|
| 68 | /** |
|---|
| 69 | * Popup message from system tray |
|---|
| 70 | * |
|---|
| 71 | * @param title Popup title text |
|---|
| 72 | * @param message Message text |
|---|
| 73 | * @param icon Icon to display in the popup |
|---|
| 74 | * @param timeout Time before hiding popup |
|---|
| 75 | */ |
|---|
| 76 | virtual void popupMessage(QString title, QString message, const QPixmap& icon, int timeout) = 0; |
|---|
| 77 | |
|---|
| 78 | signals: |
|---|
| 79 | /** |
|---|
| 80 | * User has clicked on dock icon |
|---|
| 81 | */ |
|---|
| 82 | void clicked(); |
|---|
| 83 | |
|---|
| 84 | /** |
|---|
| 85 | * User has middle clicked on dock icon |
|---|
| 86 | */ |
|---|
| 87 | void middleClicked(); |
|---|
| 88 | |
|---|
| 89 | /** |
|---|
| 90 | * New tooltip is available |
|---|
| 91 | * Emitted when myIcon isn't set |
|---|
| 92 | */ |
|---|
| 93 | void newToolTip(QString tooltip); |
|---|
| 94 | |
|---|
| 95 | protected slots: |
|---|
| 96 | /** |
|---|
| 97 | * Updated the icon for current status |
|---|
| 98 | */ |
|---|
| 99 | virtual void updateStatusIcon(); |
|---|
| 100 | |
|---|
| 101 | /** |
|---|
| 102 | * Updated the icon for current event |
|---|
| 103 | */ |
|---|
| 104 | virtual void updateEventIcon(); |
|---|
| 105 | |
|---|
| 106 | /** |
|---|
| 107 | * Update configuration for dock icon |
|---|
| 108 | */ |
|---|
| 109 | virtual void updateConfig() = 0; |
|---|
| 110 | |
|---|
| 111 | protected: |
|---|
| 112 | /** |
|---|
| 113 | * Update tool tip text for dock icon |
|---|
| 114 | */ |
|---|
| 115 | void updateToolTip(); |
|---|
| 116 | |
|---|
| 117 | /** |
|---|
| 118 | * Connects signals from myIcon onto this |
|---|
| 119 | */ |
|---|
| 120 | void relayDockIconSignals(); |
|---|
| 121 | |
|---|
| 122 | DockIconWidget* myIcon; |
|---|
| 123 | int myNewMsg; |
|---|
| 124 | int mySysMsg; |
|---|
| 125 | unsigned long myFullStatus; |
|---|
| 126 | unsigned short myStatus; |
|---|
| 127 | bool myInvisible; |
|---|
| 128 | QPixmap* myStatusIcon; |
|---|
| 129 | QPixmap* myEventIcon; |
|---|
| 130 | |
|---|
| 131 | private: |
|---|
| 132 | QString myId; |
|---|
| 133 | unsigned long myPpid; |
|---|
| 134 | }; |
|---|
| 135 | |
|---|
| 136 | } // namespace LicqQtGui |
|---|
| 137 | |
|---|
| 138 | #endif |
|---|