#ifndef MDEVICEMANAGER_H
#define MDEVICEMANAGER_H

#include <QWidget>
#include <QFile>
#include <QStyleOption>
#include <QPainter>
#include <QStyledItemDelegate>
#include <communication/network.h>
#include <QTreeWidgetItem>
#include <QCheckBox>
#include <wDevicesManager/wdevicesitem.h>
#include <mdevicesetting.h>
#include <wDevicesManager/devicescontrollwidget.h>
#include <wDevicesManager/controlbrightnesswidget.h>

namespace Ui {
class mDeviceManager;
}

class mDeviceManager : public QWidget
{
    Q_OBJECT

public:
    explicit mDeviceManager(QWidget *parent = nullptr);
    ~mDeviceManager();
    void refreshLable();
    NetComm *pNetComm;
    void OnRefreshDevicesListStatusInfo();
//    void refreshDevicesList(QStringList strIpList,QString strIdList);
private:
    virtual void paintEvent(QPaintEvent *);


protected slots:
    void onAddLedCard(LedCard * p);
    void onClearHeartbeatFlagByUdp(LedCard * p);
    void onCheckStateChanged(int f);
//    void onLedCardChanged(LedCard * p);
    void onsigwDeviceItemHttpPost(LedCard * p);
    void onSpecialIpPro();
    void OnRefreshButtonPro();
    void FilterProgram(const QString &strtemp);
    void ShowDevicesInfoOrControlWidget(int index);
    void OnStopAllItemPostHeartBeat(bool b);
    void onSwitchControlWidget(int index);
    //控制命令槽函数
    void OnControlSendJson(QJsonObject &json,QString strFanYi);
    void OnControlTcpSend(int iProgramIndex);

    void OnOutputInfo(QString);

    void OnSpecialGetLedcardIp(LedCard *p);
signals:
    void sigShowDevicesInfoOrControlWidget(int index);
     void sigSelectedDeviceList(QList<LedCard *> *);
     void sigChangeLanguage();
private:
    Ui::mDeviceManager *ui;
    QTreeWidgetItem *m_headerItem=nullptr;
    QList<wDevicesItem *> m_pwDeviceItemList;
    mDeviceSetting *m_wDeviceSetting=nullptr;
    DevicesControllWidget *m_pDevicesControlWidget=nullptr;
    int m_intIndexFlagOfInfoOrControl=0;
    int GetScreenWidth();
    int GetSelectDeviceNum();
    QList<LedCard *> SelectedLedCardList;

};

#endif // MDEVICEMANAGER_H
