#ifndef CTRLADVANCEDPANEL_H
#define CTRLADVANCEDPANEL_H

#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include <QTextEdit>
#include <QJsonObject>
#include <QGroupBox>
#include <QRadioButton>
#include <QCheckBox>
#include <QFile>
#include <QThread>
#include <QComboBox>

class CtrlAdvancedPanel : public QWidget {
    Q_OBJECT
public:
    explicit CtrlAdvancedPanel(QWidget *parent = nullptr);
protected:
    void showEvent(QShowEvent *event) override;
    void init();
    void changeEvent(QEvent *) override;
    void transUi();

    void keyReleaseEvent(QKeyEvent *) override;
    void mouseReleaseEvent(QMouseEvent *) override;

private:
    bool isPassed{false};

    QLabel *lbTitle;
    QLabel *lbScreenWidth;
    QLineEdit *fdScreenWidth;
    QLabel *lbScreenHeight;
    QLineEdit *fdScreenHeight;
    QPushButton *btnScreenSet;
    QLabel *lbAlias;
    QLineEdit *fdAlias;
    QPushButton *btnAliasSet;
    QLabel *labelWebServer;
    QComboBox *fdWebServerAddr;
    QLabel *lbCompanyId;
    QLineEdit *fdCompanyId;
    QPushButton *btnWebServerSet;
    QLabel *label;
    QComboBox *fdRealtimeServer;
    QPushButton *btnRealtimeServerSet;
    QPushButton *btnRealtimeClear;
    QPushButton *btnWareUpdate;
    QLabel *lbWareTip;
    QPushButton *btnApkCheck;
    QComboBox *fdPkg;
    QPushButton *fdUninstall;
    QPushButton *btnIsRunning;
    QPushButton *btnRestart;
    QPushButton *btnClearProg;
    QPushButton *btnGetLog;
    QPushButton *btnSetBack, *btnPlayerBackSet, *btnPlayerBackClear;

    QLabel *lbTimingReboot;
    QPushButton *btnTimingRebootSet, *btnTimingRebootGet;

    QGroupBox *grpM80, *grpY50;
    QComboBox *fdM80Resolu, *fdDisMode;
    QPushButton *btnM80Set, *btnY50Set;
    QPushButton *btnM80Refresh;
    QPushButton *btnM80Restore;

    QLabel *lbDisMode;
    QPushButton *btnDisModeSet, *btnDisModeGet;
    QLabel *lbScreenPos, *lbScreenOff;
    QPushButton *btnScreenOffSet, *btnScreenOffGet;

    QGroupBox *grpHighForBusy;
    QRadioButton *fdHighForBusy;
    QRadioButton *fdTopLevelLH;
    QPushButton *btnHighForBusySet;
    QPushButton *btnGetTopLevel;
    QPushButton *btnLedSet3;
    QPushButton *btnLedSet4;
    QPushButton *btnBindTaxiIc;

    QGroupBox *grpMinMaxBrightness;
    QLabel *lbMinBright;
    QLineEdit *fdMinBright;
    QPushButton *btnMinBrightGet;
    QPushButton *btnMinBrightSet;
    QLabel *label_3;
    QLineEdit *fdMaxBright;
    QPushButton *btnMaxBrightGet;
    QPushButton *btnMaxBrightSet;

    QGroupBox *grpBoxHiddenSettings;
    QPushButton *btnSysUpd, *btnMcuUpd, *btnMcuGet;
    QLabel *lbRotate, *lbBaudCfg, *lbBaudModel, *lbUart, *lbBaud;
    QPushButton *btnBaudSet, *btnBaudGet;
    QCheckBox *fdIsOpenADB;
    QLabel *lbCustomJson;
    QTextEdit *fdCustomJson;
    QPushButton *btnSendCustomJson;

    QLabel *lbTraficProtocol, *lbCardMode, *lbTraficPort;
    QComboBox *fdServerType;
    QPushButton *btnTraficProtSet, *btnTraficProtGet, *btnTraficSet, *btnTraficGet;
};

class PlayerBackSendThread : public QThread {
    Q_OBJECT
public:
    PlayerBackSendThread(const QString &file, const QString &ip);
    QString file, ip;
    QString err;
protected:
    void run();
signals:
    void emErr(QString);
};

#endif // CTRLADVANCEDPANEL_H
