#include "kaconventionpage.h"
#include "global/kaglobal.h"
#include "libukcc/widgets/SettingWidget/settinggroup.h"

#include <QLabel>
#include <QSharedPointer>

// #include "kswitchbutton.h"

// using namespace kdk;

class KAConventionPage::Private
{
public:
    QLabel *mShortcutsTitleLabel = nullptr;
    UkccFrame *mEnableFrame = nullptr;
    // KSwitchButton *mEnableBtn =nullptr;  // 允许启用快捷键
    QLabel *mEnableLabel = nullptr;
    QLabel *mShortcutsLabel = nullptr;
};

KAConventionPage::KAConventionPage(QWidget *parent)
    : QWidget{parent},
      d_ptr(make_shared<Private>())
{
    initLayout();
}

KAConventionPage::~KAConventionPage()
{

}

void KAConventionPage::initLayout()
{
    QVBoxLayout *base_vlayout = new QVBoxLayout(this);

    d_ptr->mShortcutsTitleLabel = new QLabel(this);
    d_ptr->mShortcutsTitleLabel->setText(tr("Keyboard Shortcuts"));
    d_ptr->mShortcutsTitleLabel->setContentsMargins(20, 0, 0, 0);
    QFont font("Noto Sans CJK SC", 11, QFont::DemiBold, false);
    d_ptr->mShortcutsTitleLabel->setFont(font);
    base_vlayout->addWidget(d_ptr->mShortcutsTitleLabel);

    d_ptr->mEnableFrame = new UkccFrame(this);
    d_ptr->mEnableFrame->setMinimumSize(QSize(490, 60));
    d_ptr->mEnableFrame->setMaximumSize(QSize(16777215, 60));
    d_ptr->mEnableFrame->setFrameShape(QFrame::Box);
    d_ptr->mEnableFrame->setObjectName(QString("enableFrame"));

    QHBoxLayout *enableHLayout = new QHBoxLayout(d_ptr->mEnableFrame);
    enableHLayout->setContentsMargins(20, 10, 20, 10);

    d_ptr->mEnableLabel = new QLabel(tr("Enable shortcut keys to wake up"), this);
    d_ptr->mEnableLabel->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
    enableHLayout->addWidget(d_ptr->mEnableLabel);
    enableHLayout->addStretch();
    // d_ptr->mEnableBtn = new KSwitchButton(this);
    // d_ptr->mEnableBtn->setObjectName("enable");
    // enableHLayout->addWidget(d_ptr->mEnableBtn);
    d_ptr->mShortcutsLabel = new QLabel(tr("Win + C"), this);
    enableHLayout->addWidget(d_ptr->mShortcutsLabel);
    d_ptr->mShortcutsLabel->setStyleSheet("QLabel{"
                                          "font-family: Noto Sans CJK SC;"
                                          "font-size: 14px;"
                                          "font-weight: 400;"
                                          "line-height: 20px;"
                                          "text-align: left;"
                                          "}");
    d_ptr->mShortcutsLabel->setStyleSheet("QLabel{"
                                          "color: rgba(38, 38, 38, 0.55);"
                                          "font-family: Noto Sans CJK SC;"
                                          "font-size: 14px;"
                                          "font-weight: 400;"
                                          "line-height: 20px;"
                                          "text-align: left;"
                                          "}");

    base_vlayout->addWidget(d_ptr->mShortcutsTitleLabel);
    base_vlayout->setSpacing(8);
    base_vlayout->addWidget(d_ptr->mEnableFrame);
    base_vlayout->addStretch();
}

void KAConventionPage::initConnection()
{


}
