#ifndef PROGPANEL_H
#define PROGPANEL_H

#include "base/loqtreewidget.h"
#include "program/progitem.h"
#include "basedlg.h"
#include <QPushButton>
#include <QSettings>
#include <QTableWidget>

class ProgPanel : public QWidget {
    Q_OBJECT
public:
    explicit ProgPanel(QSettings &settings, QWidget *parent = nullptr);

    QTreeWidgetItem *m_headerItem = nullptr;
    LoQTreeWidget *mProgTree = nullptr;
protected:
    void changeEvent(QEvent *) override;
    void transUi();
    bool checkIfNameRepeated(const QString &name, QTreeWidgetItem *skip = nullptr);

public slots:
    void onEditClicked(bool f);
    void onDeleteClicked(bool f);
    void onCreateNewProgramOnOpenEditProgramWidget(QString name, QSize res, QString remarks, QList<int> &, int);
    void FilterProgram(const QString &strtemp);

private slots:
    void OnClickColumn(int iColumn);

private:
    QString mProgsDir;
    QList<ProgItem *> m_pwPorgramItemList;
    QPushButton *bnNew = nullptr;
    QPushButton *bnEdit = nullptr;
    QPushButton *bnDelete = nullptr;
    QPushButton *bnImport, *bnExport;
    QPushButton *bnSend, *btnPlay;
};

class ProgPortDlg : public BaseDlg {
    Q_OBJECT
public:
    ProgPortDlg(QWidget *parent, QString title);

    QTableWidget *table{0};
    QPushButton *bnOK, *bnClose;
};

#endif // PROGPANEL_H
