keyboard: adapt some files from downstream
This commit is contained in:
parent
6910775d35
commit
69eb8e2101
|
@ -34,7 +34,7 @@ namespace
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
struct QskInputPanelLayouts
|
struct QskVirtualKeyboardLayouts
|
||||||
{
|
{
|
||||||
struct KeyCodes
|
struct KeyCodes
|
||||||
{
|
{
|
||||||
|
@ -72,9 +72,9 @@ struct QskInputPanelLayouts
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LOWER(x) Qt::Key(x + 32) // Convert an uppercase key to lowercase
|
#define LOWER(x) Qt::Key(x + 32) // Convert an uppercase key to lowercase
|
||||||
static constexpr const QskInputPanelLayouts qskInputPanelLayouts =
|
static constexpr const QskVirtualKeyboardLayouts qskKeyboardLayouts =
|
||||||
{
|
{
|
||||||
#include "QskInputPanelLayouts.cpp"
|
#include "QskVirtualKeyboardLayouts.cpp"
|
||||||
};
|
};
|
||||||
#undef LOWER
|
#undef LOWER
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ class QskVirtualKeyboard::PrivateData
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const QskInputPanelLayouts::Layout* currentLayout;
|
const QskVirtualKeyboardLayouts::Layout* currentLayout;
|
||||||
QskVirtualKeyboard::Mode mode;
|
QskVirtualKeyboard::Mode mode;
|
||||||
|
|
||||||
qint16 selectedGroup;
|
qint16 selectedGroup;
|
||||||
|
@ -269,11 +269,6 @@ QskVirtualKeyboard::QskVirtualKeyboard( QQuickItem* parent ):
|
||||||
|
|
||||||
initSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Expanding );
|
initSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Expanding );
|
||||||
|
|
||||||
setAutoFillBackground( true );
|
|
||||||
|
|
||||||
auto margins = marginsHint( Panel | QskAspect::Margin );
|
|
||||||
setMargins( margins );
|
|
||||||
|
|
||||||
updateLocale( locale() );
|
updateLocale( locale() );
|
||||||
|
|
||||||
QObject::connect( this, &QskControl::localeChanged,
|
QObject::connect( this, &QskControl::localeChanged,
|
||||||
|
@ -741,23 +736,23 @@ void QskVirtualKeyboard::updateLocale( const QLocale& locale )
|
||||||
switch( locale.language() )
|
switch( locale.language() )
|
||||||
{
|
{
|
||||||
case QLocale::Bulgarian:
|
case QLocale::Bulgarian:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.bg;
|
m_data->currentLayout = &qskKeyboardLayouts.bg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Czech:
|
case QLocale::Czech:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.cs;
|
m_data->currentLayout = &qskKeyboardLayouts.cs;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::German:
|
case QLocale::German:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.de;
|
m_data->currentLayout = &qskKeyboardLayouts.de;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Danish:
|
case QLocale::Danish:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.da;
|
m_data->currentLayout = &qskKeyboardLayouts.da;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Greek:
|
case QLocale::Greek:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.el;
|
m_data->currentLayout = &qskKeyboardLayouts.el;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::English:
|
case QLocale::English:
|
||||||
|
@ -768,11 +763,11 @@ void QskVirtualKeyboard::updateLocale( const QLocale& locale )
|
||||||
case QLocale::UnitedStates:
|
case QLocale::UnitedStates:
|
||||||
case QLocale::UnitedStatesMinorOutlyingIslands:
|
case QLocale::UnitedStatesMinorOutlyingIslands:
|
||||||
case QLocale::UnitedStatesVirginIslands:
|
case QLocale::UnitedStatesVirginIslands:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.en_US;
|
m_data->currentLayout = &qskKeyboardLayouts.en_US;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.en_GB;
|
m_data->currentLayout = &qskKeyboardLayouts.en_GB;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,72 +775,77 @@ void QskVirtualKeyboard::updateLocale( const QLocale& locale )
|
||||||
}
|
}
|
||||||
|
|
||||||
case QLocale::Spanish:
|
case QLocale::Spanish:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.es;
|
m_data->currentLayout = &qskKeyboardLayouts.es;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Finnish:
|
case QLocale::Finnish:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.fi;
|
m_data->currentLayout = &qskKeyboardLayouts.fi;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::French:
|
case QLocale::French:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.fr;
|
m_data->currentLayout = &qskKeyboardLayouts.fr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Hungarian:
|
case QLocale::Hungarian:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.hu;
|
m_data->currentLayout = &qskKeyboardLayouts.hu;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Italian:
|
case QLocale::Italian:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.it;
|
m_data->currentLayout = &qskKeyboardLayouts.it;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Japanese:
|
case QLocale::Japanese:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.ja;
|
m_data->currentLayout = &qskKeyboardLayouts.ja;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Latvian:
|
case QLocale::Latvian:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.lv;
|
m_data->currentLayout = &qskKeyboardLayouts.lv;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Lithuanian:
|
case QLocale::Lithuanian:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.lt;
|
m_data->currentLayout = &qskKeyboardLayouts.lt;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Dutch:
|
case QLocale::Dutch:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.nl;
|
m_data->currentLayout = &qskKeyboardLayouts.nl;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Portuguese:
|
case QLocale::Portuguese:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.pt;
|
m_data->currentLayout = &qskKeyboardLayouts.pt;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Romanian:
|
case QLocale::Romanian:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.ro;
|
m_data->currentLayout = &qskKeyboardLayouts.ro;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Russia:
|
case QLocale::Russia:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.ru;
|
m_data->currentLayout = &qskKeyboardLayouts.ru;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Slovenian:
|
case QLocale::Slovenian:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.sl;
|
m_data->currentLayout = &qskKeyboardLayouts.sl;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Slovak:
|
case QLocale::Slovak:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.sk;
|
m_data->currentLayout = &qskKeyboardLayouts.sk;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Turkish:
|
case QLocale::Turkish:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.tr;
|
m_data->currentLayout = &qskKeyboardLayouts.tr;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QLocale::Chinese:
|
case QLocale::Chinese:
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.zh;
|
m_data->currentLayout = &qskKeyboardLayouts.zh;
|
||||||
break;
|
break;
|
||||||
|
#if 1
|
||||||
|
case QLocale::C:
|
||||||
|
m_data->currentLayout = &qskKeyboardLayouts.en_US;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
qWarning() << "QskInputPanel: unsupported locale:" << locale;
|
qWarning() << "QskInputPanel: unsupported locale:" << locale;
|
||||||
m_data->currentLayout = &qskInputPanelLayouts.en_US;
|
m_data->currentLayout = &qskKeyboardLayouts.en_US;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT displayLanguageNameChanged();
|
Q_EMIT displayLanguageNameChanged();
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
class QskInputCompositionModel;
|
class QskInputCompositionModel;
|
||||||
class QskVirtualKeyboard;
|
class QskVirtualKeyboard;
|
||||||
|
|
||||||
class QskVirtualKeyboardButton : public QskPushButton
|
class QSK_EXPORT QskVirtualKeyboardButton : public QskPushButton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -107,14 +107,14 @@ public:
|
||||||
void registerCompositionModelForLocale( const QLocale& locale,
|
void registerCompositionModelForLocale( const QLocale& locale,
|
||||||
QskInputCompositionModel* model );
|
QskInputCompositionModel* model );
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
void setPreeditGroups( const QVector< Qt::Key >& );
|
|
||||||
void setPreeditCandidates( const QVector< Qt::Key >& );
|
|
||||||
|
|
||||||
void handleKey( int keyIndex );
|
void handleKey( int keyIndex );
|
||||||
KeyData& keyDataAt( int ) const;
|
KeyData& keyDataAt( int ) const;
|
||||||
QString currentTextForKeyIndex( int keyIndex ) const;
|
QString currentTextForKeyIndex( int keyIndex ) const;
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void setPreeditGroups( const QVector< Qt::Key >& );
|
||||||
|
void setPreeditCandidates( const QVector<Qt::Key> & );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void geometryChanged( const QRectF&, const QRectF& ) override;
|
virtual void geometryChanged( const QRectF&, const QRectF& ) override;
|
||||||
virtual void updateLayout() override;
|
virtual void updateLayout() override;
|
||||||
|
@ -139,7 +139,7 @@ Q_SIGNALS:
|
||||||
void modeChanged( QskVirtualKeyboard::Mode mode );
|
void modeChanged( QskVirtualKeyboard::Mode mode );
|
||||||
void cancelPressed();
|
void cancelPressed();
|
||||||
|
|
||||||
public:
|
private:
|
||||||
class PrivateData;
|
class PrivateData;
|
||||||
std::unique_ptr< PrivateData > m_data;
|
std::unique_ptr< PrivateData > m_data;
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,8 +48,7 @@ HEADERS += \
|
||||||
common/QskObjectCounter.h \
|
common/QskObjectCounter.h \
|
||||||
common/QskSizePolicy.h \
|
common/QskSizePolicy.h \
|
||||||
common/QskTextColors.h \
|
common/QskTextColors.h \
|
||||||
common/QskTextOptions.h \
|
common/QskTextOptions.h
|
||||||
controls/QskVirtualKeyboard.h
|
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
common/QskAspect.cpp \
|
common/QskAspect.cpp \
|
||||||
|
@ -66,8 +65,7 @@ SOURCES += \
|
||||||
common/QskObjectCounter.cpp \
|
common/QskObjectCounter.cpp \
|
||||||
common/QskSizePolicy.cpp \
|
common/QskSizePolicy.cpp \
|
||||||
common/QskTextColors.cpp \
|
common/QskTextColors.cpp \
|
||||||
common/QskTextOptions.cpp \
|
common/QskTextOptions.cpp
|
||||||
controls/QskVirtualKeyboard.cpp
|
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
graphic/QskColorFilter.h \
|
graphic/QskColorFilter.h \
|
||||||
|
@ -182,6 +180,7 @@ HEADERS += \
|
||||||
controls/QskTextLabel.h \
|
controls/QskTextLabel.h \
|
||||||
controls/QskTextLabelSkinlet.h \
|
controls/QskTextLabelSkinlet.h \
|
||||||
controls/QskVariantAnimator.h \
|
controls/QskVariantAnimator.h \
|
||||||
|
controls/QskVirtualKeyboard.h \
|
||||||
controls/QskWindow.h
|
controls/QskWindow.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
@ -245,6 +244,7 @@ SOURCES += \
|
||||||
controls/QskTextLabel.cpp \
|
controls/QskTextLabel.cpp \
|
||||||
controls/QskTextLabelSkinlet.cpp \
|
controls/QskTextLabelSkinlet.cpp \
|
||||||
controls/QskVariantAnimator.cpp \
|
controls/QskVariantAnimator.cpp \
|
||||||
|
controls/QskVirtualKeyboard.cpp \
|
||||||
controls/QskWindow.cpp
|
controls/QskWindow.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
|
|
Loading…
Reference in New Issue