File indexing completed on 2024-04-28 09:49:39
0001 /* 0002 SPDX-FileCopyrightText: 2005 Bram Schoenmakers <bramschoenmakers@kde.nl> 0003 SPDX-FileCopyrightText: 2010 Tom Albers <toma@kde.org> 0004 SPDX-FileCopyrightText: 2010 Juan Luis Baptiste <juan.baptiste@gmail.com> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef RSIRELAXPOPUP_H 0010 #define RSIRELAXPOPUP_H 0011 0012 #include <QLabel> 0013 #include <passivepopup.h> 0014 0015 class QLabel; 0016 class QPushButton; 0017 class QProgressBar; 0018 0019 /** 0020 * @class RSIRelaxPopup 0021 * This is a KPassivePopup which some extra features. 0022 * It's shown when the user should relax for a couple of seconds. 0023 * @author Bram Schoenmakers <bramschoenmakers@kde.nl> 0024 */ 0025 class RSIRelaxPopup : public QObject 0026 { 0027 Q_OBJECT 0028 public: 0029 /** Constructor */ 0030 explicit RSIRelaxPopup(QWidget *parent); 0031 /** Destructor */ 0032 ~RSIRelaxPopup(); 0033 0034 public slots: 0035 /** 0036 Shows this popup with the message that the user should rest @p n seconds. 0037 @param n Amount of seconds to relax 0038 @param bigBreakNext If true, it shows a warning that the next break will be 0039 a big break. 0040 */ 0041 void relax(int n, bool bigBreakNext); 0042 0043 /** 0044 Reread config 0045 */ 0046 void slotReadConfig(); 0047 0048 /** Hides the skip button **/ 0049 void setSkipButtonHidden(bool); 0050 0051 /** Hides the lock button **/ 0052 void setLockButtonHidden(bool); 0053 0054 /** Hides the postpone break button **/ 0055 void setPostponeButtonHidden(bool); 0056 0057 /** Hides/Shows the popup */ 0058 void setSuspended(bool suspended); 0059 0060 signals: 0061 /** Ask the main widget to lock down the desktop. */ 0062 void lock(); 0063 0064 /** Ask the main widget to skip the break. */ 0065 void skip(); 0066 0067 /** Ask the main widget to postpone the break. */ 0068 void postpone(); 0069 0070 protected: 0071 /** 0072 Changes the background color for 0.5 second. The background is restored 0073 with unflash() 0074 */ 0075 void flash(); 0076 0077 protected slots: 0078 /** Restores background color after a flash() */ 0079 void unflash(); 0080 0081 private: 0082 void readSettings(); 0083 bool m_useFlash; 0084 bool m_wasShown; 0085 PassivePopup *m_popup; 0086 QLabel *m_message; 0087 QProgressBar *m_progress; 0088 QPushButton *m_lockbutton; 0089 QPushButton *m_skipbutton; 0090 QPushButton *m_postponebutton; 0091 }; 0092 0093 #endif /* RSIRELAXPOPUP_H */