#ifndef KEYBOARDUI_H
#define KEYBOARDUI_H

#include <QWidget>
#include <QHBoxLayout>
#include <QPushButton>

#include "settinggroup.h"
#include "titlelabel.h"
#include "switchwidget.h"
#include "sliderwidget.h"
#include "lineeditwidget.h"

class KeyboardUi : public QWidget
{
    Q_OBJECT
public:
    explicit KeyboardUi(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
    virtual ~KeyboardUi();

public:
    inline SwitchWidget *keyRepeatFrame()
    {
        return mKeyRepeatFrame;
    }

    inline SliderWidget *delayFrame()
    {
        return mDelayFrame;
    }

    inline SliderWidget *speedFrame()
    {
        return mSpeedFrame;
    }

    inline LineEditWidget *inputTestFrame()
    {
        return mInputTestFrame;
    }

    inline SwitchWidget *keyTipsFrame()
    {
        return mKeyTipsFrame;
    }

    inline QPushButton *inputMethodPushButton()
    {
        return mInputMethodSetBtn;
    }

private:
    QVBoxLayout *mVlayout = nullptr;

    SettingGroup *mKeyboardFrame = nullptr;
    TitleLabel *mKeyboardSetTitleLabel = nullptr;

    SwitchWidget *mKeyRepeatFrame = nullptr;        //按键重复
    SliderWidget *mDelayFrame = nullptr;            //延迟
    SliderWidget *mSpeedFrame = nullptr;            //速度
    LineEditWidget *mInputTestFrame = nullptr;        //输入测试
    SwitchWidget *mKeyTipsFrame = nullptr;          //按键提示
    QPushButton *mInputMethodSetBtn = nullptr;    //输入法设置

private:
    void initUI();
    void setKeyRepeatFrame();
    void setDelayFrame();
    void setSpeedFrame();
    void setInputTestFrame();
    void setKeyTipsFrame();
    void setInputMethodFrame();

};

#endif // KEYBOARDUI_H
