#ifndef INTRODUCTIONVIEW_H
#define INTRODUCTIONVIEW_H_H

#include <QObject>
#include <QDialog>
#include <QPushButton>
#include <QLayout>
#include <QLabel>
#include <QWidget>
#include <QPainter>
#include <QLinearGradient>
#include <QLineEdit>
#include <QTextEdit>
#include <QPalette>
#include <QDebug>
#include <QScrollArea>
#include <QScrollBar>
#include <QTextBrowser>
#include <QCoreApplication>
#include <QTimer>
#include <QApplication>

#include <ukuistylehelper/ukuistylehelper.h>
#include "global/kaglobal.h"
#include <windowmanager/windowmanager.h>
#include <QSvgRenderer>


class InnerWidget : public QWidget{
    Q_OBJECT

public:
    InnerWidget(QWidget * parent = nullptr);

protected:
    void paintEvent(QPaintEvent *event) override;
    void resizeEvent(QResizeEvent *event) override;

};

class IntroductionContent : public QWidget{
    Q_OBJECT

public:
    IntroductionContent(QWidget * parent);
    void initChild();
    void initLayout();
    void initConnection();    
    bool hasLocalModel();

public slots:
    void showFirst();
    void showSecond();
    void showAgreement();  // 新增：显示用户协议页面

private slots:
    void onAgreeClicked();    // 新增：处理“同意并继续”点击事件
    void onDisagreeClicked(); // 新增：处理“不同意”点击事件

protected:
    void paintEvent(QPaintEvent *event) override;

private:
    // 原有成员
    QLabel * m_icon = nullptr;
    QLabel * m_shortcut = nullptr;
    QLabel * m_addModel = nullptr;
    InnerWidget * m_winCWid = nullptr;
    InnerWidget * m_winAltCWid = nullptr;
    InnerWidget * setPageWid = nullptr;
    QPushButton *m_nextBtn = nullptr;
    QPushButton *m_previousBtn = nullptr;
    QPushButton *m_acceptBtn = nullptr;
    QPushButton *m_closeBtn = nullptr;
    QPushButton *m_useNowBtn = nullptr;
    QWidget *contentWid = nullptr;

    // 新增：用户协议页面相关成员
    QWidget     *m_agreementPageWid   = nullptr; // 整个用户协议页容器
    QLabel      *m_agreementTitle   = nullptr;  // 用户协议标题
    QTextBrowser *m_agreementContent = nullptr;  // 用户协议正文内容
    QPushButton *m_agreeBtn         = nullptr;  // “同意并继续”按钮
    QPushButton *m_disagreeBtn      = nullptr;  // “不同意”按钮

    InnerWidget * m_agreementInnerWid = nullptr; // 用户协议正文白色圆角框
    QScrollArea *m_agreementScroll =nullptr;

};

class IntroductionView : public QDialog
{
    Q_OBJECT

public:
    IntroductionView(QWidget * parent = nullptr);
    void showView();
    void hideView();
    void closeView();
    bool isClosed() const;

public:
    bool m_isClosed = true;

signals:
    void showSettingPage();
    void openUKUIControlCenterView();

private:
    IntroductionContent * m_content = nullptr;
};

#endif // INTRODUCTIONVIEW_H_H
