#ifndef LEFT_WIDGET_H
#define LEFT_WIDGET_H

#include <QObject>
#include <QLayout>
#include <QScrollArea>
#include <QWidget>
#include <QLayout>
#include <QList>
#include "logo_icon_title_bar.h"
#include "device_list_button.h"


class LeftWidget : public QWidget
{
    Q_OBJECT
public:
    explicit LeftWidget(QWidget *parent = nullptr);

    DeviceListButton *getCurrentSelectPrinter() const;
    void setQSSFontSize(QFont curFont);
protected:
    void paintEvent(QPaintEvent *) override;
signals:
    void printerIsSelected(const UkuiUsbPrinter&);
    void noBtnIsChecked();
    void addDevice();
    void delDevice(QString);
public slots:
    void updateListSector(const QList<UkuiUsbPrinter>& printersVector,const UkuiUsbPrinter& currentPrinter);
    
private slots:
    void updateBtnConnections(DeviceListButton*);
    void delDeviceSlot();
    void addPrinterToListSector(const UkuiUsbPrinter& printersVector);
    void updateDefaultPrinter(QString printerName);
private:

    QList<UkuiUsbPrinter> m_printersVector;
    QLabel      *m_deviceLabel;
    QPushButton *m_addDeviceBtn;
    QPushButton *m_removeDeviceBtn;

    QList<DeviceListButton*> m_deviceList;

    QVBoxLayout *m_VLayoutNavigator;
    LogoIconTitleBar *m_titleBar;
    QHBoxLayout *m_HLayoutLogoName;
    QHBoxLayout *m_HLayoutDeviceOP;
    QHBoxLayout *m_HLayoutDeviceList;

    QVBoxLayout *m_VLayoutDeviceBtnList;

    QWidget *m_deviceListWidget;
    QWidget *m_mainWin;
    QScrollArea *m_ScrollArea;

    void initDeviceOperateSector();
    void initDeviceListSector();

    void updateDeviceList();

    DeviceListButton *m_currentSelectBtn;

    bool m_isUpdatingFlag;
    QFont m_font14;
};

#endif // LEFT_WIDGET_H
