#pragma once

#include <QMainWindow>



#include <QWidget>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QPushButton>
#include <QCheckBox>
#include <QGroupBox>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QToolBar>
#include <QAction>
#include <QComboBox>
#include <QDateTime>
#include <QDialog>
#include <QList>
#include <QTextEdit>
#include <QList>

class ManualLabelToolWidget;
class LampDataItem;
class QTreeTreeWidgetItem;

class LampDataManager : public QDialog
{
    Q_OBJECT

public:
    explicit LampDataManager(ManualLabelToolWidget* mainWidget,QWidget* parent = nullptr);
    ~LampDataManager();

    void loadFile(const QString& filePath);
    void clearCurrentFile();

public slots:
    void onLoadDataClicked();
    
    void showtreeWidgetBtnClicked();
    void showtextEditBtnClicked();
    void openRasterFile();
    void openLampWindDataFile();
    
    // 节点相关操作
    void AddDataNode(LampDataItem* item);
    
    // 软件
 
    void oncurrentItemChanged(QTreeWidgetItem* current, QTreeWidgetItem* previous);
    void removeNodeItem();
    void removeALLNodeItems();
    void onShowData();


public:
    void openLampWindFile(QString winddatapath);
    void LoadRasterFile(QString RasterPath);

public:
    

private:
    void setupUI();



signals:
    void dataLoaded(const QString& filePath, int bandIndex, bool grayscale, bool newView);
 
protected:
    // 重写关闭事件
    void closeEvent(QCloseEvent* event) override;
    // 重写reject槽函数以响应Esc键
    void reject() override;

private:
    ManualLabelToolWidget* mainWidget;

private:// UI 元素
    QVBoxLayout* layout;
    QToolBar* fileToolbar;
    QPushButton* showtreeWidgetBtn;
    QTreeWidget* datatreeWidget;
    QPushButton* showtextEditBtn;
    QTextEdit* textEdit;

    bool isShowTreeWidgetflag;
    bool isShowExtendWidgetflag;

private://fileToolbar
    //QAction* openFileAction;
    QAction* removeFileAction;
    QAction* removeAllFileAction;
    QAction* LoadFileAction;
    //QPushButton* LoadFileAction;


private:// datatreeWidget
    QList<LampDataItem*> dataitems;
     


};

