File indexing completed on 2024-04-14 05:46:47

0001 /*
0002 
0003    Copyright (C) 2005-2006 Tom Albers <toma@kde.org>
0004    Copyright (C) 2011 Aurélien Gâteau <agateau@kde.org>
0005 
0006    The base was copied from ksynaptics:
0007       Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
0008 
0009    This program is free software; you can redistribute it and/or
0010    modify it under the terms of the GNU General Public
0011    License as published by the Free Software Foundation; either
0012    version 2 of the License, or (at your option) any later version.
0013 
0014    This program is distributed in the hope that it will be useful,
0015    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017    General Public License for more details.
0018 
0019    You should have received a copy of the GNU General Public License
0020    along with this program; if not, write to the Free Software
0021    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0022 */
0023 
0024 #ifndef RSIDOCK_H
0025 #define RSIDOCK_H
0026 
0027 #include <kstatusnotifieritem.h>
0028 
0029 class QDialog;
0030 class KHelpMenu;
0031 
0032 class RSIStatWidget;
0033 
0034 /**
0035  * @class RSIDock
0036  * This class is responsible for putting rsibreak in the system tray
0037  * and provide a proper menu when right clicked on the icon.
0038  *
0039  * Originally this file was copied from KSynaptics
0040  * @author Nadeem Hasan <nhasan@kde.org>
0041  * @author Tom Albers <toma.org>
0042  * @author Aurélien Gâteau <agateau@kde.org>
0043  */
0044 class RSIDock : public KStatusNotifierItem
0045 {
0046     Q_OBJECT
0047 
0048 public:
0049     explicit RSIDock(QObject *parent);
0050 
0051     /**
0052      * Destructor
0053      */
0054     ~RSIDock();
0055 
0056     void doResume();
0057     void doSuspend();
0058 
0059 public slots:
0060     void setCounters(int tiny_left, int big_left);
0061 
0062 signals:
0063     /**
0064      * This signal is emitted when the user has left
0065      * the settings.
0066      */
0067     void configChanged();
0068 
0069     /**
0070      * This signal is emitted when the user enters a dialog
0071      * this can be an about X screen or the settings.
0072      */
0073     void dialogEntered();
0074 
0075     /**
0076      * This signal is emitted when the user leaves one of the
0077      * about X dialogs, it will not beemitted when the settings
0078      * dialog is left, the configChanged() is emitted.
0079      */
0080     void dialogLeft();
0081 
0082     /**
0083      * This signal is emitted when the user wishes to see all
0084      * debug timing info. Needs a --enable-debug compiled RSIBreak
0085      */
0086     void debugRequest();
0087 
0088     /**
0089      * Suspend RSIBreak on user's request.
0090      */
0091     void suspend(bool);
0092 
0093 private slots:
0094     void slotConfigure();
0095     void slotConfigureNotifications();
0096     void slotToggleSuspend();
0097     void slotShowStatistics();
0098     void slotResetStats();
0099 
0100 private:
0101     KHelpMenu *m_help;
0102 
0103     QAction *m_suspendItem;
0104     bool m_suspended;
0105 
0106     QDialog *m_statsDialog;
0107     RSIStatWidget *m_statsWidget;
0108 };
0109 
0110 #endif // RSIDOCK_H