/*
 * Copyright (C) 2020, KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
#include "conventionpage.h"
#include "global/kaglobal.h"
#include "libukcc/widgets/SettingWidget/settinggroup.h"

#include <QLabel>
#include <QSharedPointer>

// #include "kswitchbutton.h"

// using namespace kdk;

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

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

ConventionPage::~ConventionPage()
{

}

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

    d_ptr->mShortcutsTitleLabel = new QLabel(this);
    d_ptr->mShortcutsTitleLabel->setAccessibleName("kylin-aiassistant_QLabel_d_ptr->mShortcutsTitleLabel");
    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->setAccessibleName("kylin-aiassistant_UkccFrame_d_ptr->mEnableFrame");
    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->setAccessibleName("kylin-aiassistant_QLabel_d_ptr->mEnableLabel");
    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);
    d_ptr->mShortcutsLabel->setAccessibleName("kylin-aiassistant_QLabel_d_ptr->mShortcutsLabel");
    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 ConventionPage::initConnection()
{


}
