#ifndef PROGPANEL_H
#define PROGPANEL_H

#include <QWidget>
#include <QStyleOption>
#include <QPainter>
#include <QFile>
#include <QAction>
#include <QTreeWidgetItem>
#include <QCheckBox>
#include <QPushButton>
#include <QDebug>
#include <QLabel>
#include <QDateTime>
#include <QList>
#include <QDir>
#include <QFile>
#include <QStandardPaths>
#include <QStringList>
#include <QJsonObject>
#include <QJsonDocument>
#include <QSettings>

#include "cfg.h"
#include <base/loqtreewidget.h>
#include <wProgramManager/progcreatedlg.h>
#include <wProgramManager/progeditorwin.h>
#include "wProgramManager/progitem.h"

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 onExportClicked(bool f);
    void onCreateNewProgramOnOpenEditProgramWidget(QString name, QSize res, QString remarks, int);
    void onImportProgram(QString strImportDir,QString strTip1);
    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;
};

#endif // PROGPANEL_H
