80 lines
1.8 KiB
C++
80 lines
1.8 KiB
C++
#ifndef KEYBOARD_H
|
|
#define KEYBOARD_H
|
|
|
|
#include <QWidget>
|
|
#include <QShowEvent>
|
|
#include <QKeyEvent>
|
|
#include <QListWidgetItem>
|
|
#include <QPropertyAnimation>
|
|
|
|
#include "InputModeMenu.h"
|
|
#include "KeyButton.h"
|
|
|
|
namespace Ui
|
|
{
|
|
class Keyboard;
|
|
}
|
|
|
|
class InputMethod;
|
|
class SpellStringWatcher;
|
|
class InputModeMenu;
|
|
|
|
class Keyboard : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit Keyboard(QWidget* aParent = nullptr);
|
|
~Keyboard();
|
|
|
|
void setEdit(QWidget* aEdit);
|
|
|
|
public slots:
|
|
void hideKeyboard();
|
|
|
|
signals:
|
|
void keyboardHided();
|
|
|
|
private:
|
|
void switchInputMode(InputMode aMode);
|
|
void getCandidateList(const QString& aSpellString);
|
|
bool isSingleChar(const QString& aSpellString);
|
|
void initializeStyle();
|
|
void initializeHandWriteWidget();
|
|
void initializeInputModeMenu();
|
|
void initializeStaticButton();
|
|
void initializeAnimation();
|
|
|
|
void handleFirstCandidateString(QStringList& aCandidateList);
|
|
void updateButtonShift(bool aIsCaps);
|
|
|
|
protected slots:
|
|
void showEvent(QShowEvent* aEvent);
|
|
void handleKeyButtonPressed(int aKey, const QString& aValue);
|
|
void handleBackspacePressed(int aKey, const QString& aValue);
|
|
void handleStaticButtonPressed(int aKey, const QString& aValue);
|
|
|
|
private slots:
|
|
void candidateListItemClicked(QListWidgetItem* item);
|
|
|
|
private:
|
|
Ui::Keyboard* mUI;
|
|
InputMode mInputMode;
|
|
InputMethod* mInputMethod;
|
|
InputModeMenu* mInputModeMenu;
|
|
QWidget* mCurrentWidget;
|
|
QList<KeyButton*> mKeyButtonList;
|
|
|
|
QStringList mButtonValueListLow;
|
|
QStringList mButtonValueListCapital;
|
|
QStringList mButtonValueListMark;
|
|
|
|
QList<Qt::Key> mKeyListNormal;
|
|
QList<Qt::Key> mKeyListMark;
|
|
SpellStringWatcher* mSpellStringWatcher;
|
|
QPropertyAnimation* mShowAnimation;
|
|
QPropertyAnimation* mHideAnimation;
|
|
};
|
|
|
|
#endif // KEYBOARD_H
|