#ifndef ACTIVECONNECTIONWIDGET_H
#define ACTIVECONNECTIONWIDGET_H

#include <QIcon>
#include <QLabel>
#include <QTimer>
#include <QObject>
#include <QWidget>
#include <QPainter>
#include <QGSettings>
#include <QPushButton>
#include <QApplication>
#include <QDesktopWidget>
#include <QKeyEvent>

class ActiveConnectionWidget : public QWidget
{
    Q_OBJECT
public:
    explicit ActiveConnectionWidget(QString address, QString name, QString type, int rssi);
    ~ActiveConnectionWidget();
private:
    double scale;

    int devRSSI;
    int pressCnt = 0;

    QString devAddr;
    QString devName;
    QString devType;

    QGSettings  *settings     = nullptr;

    QLabel      *window_icon  = nullptr;
    QLabel      *window_title = nullptr;
    QLabel      *tip_txt      = nullptr;

    QPushButton *window_close = nullptr;
    QPushButton *connect_btn  = nullptr;
    QPushButton *cancel_btn   = nullptr;
    QPushButton *selectedBtn  = nullptr;

    QPushButton *getButton();

private slots:
    void onClick_close_btn();
    void onClick_connect_btn();
    void onClick_cancel_btn();
    void GSettingsChanges(const QString &key);

signals:
    void replyActiveConnection(QString,bool);

protected:
    void paintEvent(QPaintEvent *event);
    void keyPressEvent(QKeyEvent *event);
};

#endif // ACTIVECONNECTIONWIDGET_H
