File indexing completed on 2024-04-28 15:40:16

0001 // SPDX-FileCopyrightText: 2014-2022 Jesper K. Pedersen <blackie@kde.org>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 #ifndef REMOTECONTROL_CONNECTIONINDICATOR_H
0006 #define REMOTECONTROL_CONNECTIONINDICATOR_H
0007 
0008 #include <QLabel>
0009 
0010 class QTimer;
0011 
0012 namespace RemoteControl
0013 {
0014 
0015 class ConnectionIndicator : public QLabel
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit ConnectionIndicator(QWidget *parent = 0);
0020 
0021     void mouseReleaseEvent(QMouseEvent *ev) override;
0022     void contextMenuEvent(QContextMenuEvent *ev) override;
0023 private Q_SLOTS:
0024     void on();
0025     void off();
0026     void wait();
0027     void waitingAnimation();
0028 
0029 private:
0030     enum State { Off,
0031                  Connecting,
0032                  On };
0033     State m_state;
0034     QTimer *m_timer;
0035 };
0036 
0037 } // namespace RemoteControl
0038 
0039 #endif // REMOTECONTROL_CONNECTIONINDICATOR_H