merge changes from downstream (#56)
* keyboard: Rename some classes * keyboard: adapt some files from downstream
This commit is contained in:
parent
63795d21b0
commit
b497b776ae
@ -8,7 +8,7 @@
|
|||||||
#include "QskInputCompositionModel.h"
|
#include "QskInputCompositionModel.h"
|
||||||
#include "QskPinyinCompositionModel.h"
|
#include "QskPinyinCompositionModel.h"
|
||||||
|
|
||||||
#include <QskInputPanel.h>
|
#include <QskVirtualKeyboard.h>
|
||||||
#include <QskDialog.h>
|
#include <QskDialog.h>
|
||||||
#include <QskWindow.h>
|
#include <QskWindow.h>
|
||||||
#include <QskSetup.h>
|
#include <QskSetup.h>
|
||||||
@ -121,7 +121,7 @@ void QskInputContext::update( Qt::InputMethodQueries queries )
|
|||||||
{
|
{
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
m_inputCompositionModel.get(), &QskInputCompositionModel::groupsChanged,
|
m_inputCompositionModel.get(), &QskInputCompositionModel::groupsChanged,
|
||||||
m_inputPanel.data(), &QskInputPanel::setPreeditGroups );
|
m_inputPanel.data(), &QskVirtualKeyboard::setPreeditGroups );
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
m_inputCompositionModel.get(), &QskInputCompositionModel::candidatesChanged,
|
m_inputCompositionModel.get(), &QskInputCompositionModel::candidatesChanged,
|
||||||
this, &QskInputContext::handleCandidatesChanged );
|
this, &QskInputContext::handleCandidatesChanged );
|
||||||
@ -154,7 +154,7 @@ void QskInputContext::showInputPanel()
|
|||||||
{
|
{
|
||||||
if ( !m_inputPanel )
|
if ( !m_inputPanel )
|
||||||
{
|
{
|
||||||
setInputPanel( new QskInputPanel );
|
setInputPanel( new QskVirtualKeyboard );
|
||||||
|
|
||||||
if ( QskDialog::instance()->policy() == QskDialog::TopLevelWindow )
|
if ( QskDialog::instance()->policy() == QskDialog::TopLevelWindow )
|
||||||
{
|
{
|
||||||
@ -253,15 +253,15 @@ void QskInputContext::invokeAction( QInputMethod::Action action, int cursorPosit
|
|||||||
if ( !m_inputPanel )
|
if ( !m_inputPanel )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch ( static_cast< QskInputPanel::Action >( action ) )
|
switch ( static_cast< QskVirtualKeyboard::Action >( action ) )
|
||||||
{
|
{
|
||||||
case QskInputPanel::Compose:
|
case QskVirtualKeyboard::Compose:
|
||||||
m_inputCompositionModel->composeKey( static_cast< Qt::Key >( cursorPosition ) );
|
m_inputCompositionModel->composeKey( static_cast< Qt::Key >( cursorPosition ) );
|
||||||
break;
|
break;
|
||||||
case QskInputPanel::SelectGroup:
|
case QskVirtualKeyboard::SelectGroup:
|
||||||
m_inputCompositionModel->setGroupIndex( cursorPosition );
|
m_inputCompositionModel->setGroupIndex( cursorPosition );
|
||||||
break;
|
break;
|
||||||
case QskInputPanel::SelectCandidate:
|
case QskVirtualKeyboard::SelectCandidate:
|
||||||
m_inputCompositionModel->commitCandidate( cursorPosition );
|
m_inputCompositionModel->commitCandidate( cursorPosition );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -283,18 +283,18 @@ void QskInputContext::handleCandidatesChanged()
|
|||||||
m_inputPanel->setPreeditCandidates( candidates );
|
m_inputPanel->setPreeditCandidates( candidates );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputContext::setInputPanel( QskInputPanel* inputPanel )
|
void QskInputContext::setInputPanel( QskVirtualKeyboard* inputPanel )
|
||||||
{
|
{
|
||||||
if ( m_inputPanel == inputPanel )
|
if ( m_inputPanel == inputPanel )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( m_inputPanel )
|
if ( m_inputPanel )
|
||||||
{
|
{
|
||||||
QObject::disconnect( m_inputPanel.data(), &QskInputPanel::visibleChanged,
|
QObject::disconnect( m_inputPanel.data(), &QskVirtualKeyboard::visibleChanged,
|
||||||
this, &QskInputContext::emitInputPanelVisibleChanged );
|
this, &QskInputContext::emitInputPanelVisibleChanged );
|
||||||
QObject::disconnect( m_inputPanel.data(), &QskInputPanel::keyboardRectChanged,
|
QObject::disconnect( m_inputPanel.data(), &QskVirtualKeyboard::keyboardRectChanged,
|
||||||
this, &QskInputContext::emitKeyboardRectChanged );
|
this, &QskInputContext::emitKeyboardRectChanged );
|
||||||
QObject::disconnect( m_inputPanel.data(), &QskInputPanel::localeChanged,
|
QObject::disconnect( m_inputPanel.data(), &QskVirtualKeyboard::localeChanged,
|
||||||
this, &QskInputContext::emitLocaleChanged );
|
this, &QskInputContext::emitLocaleChanged );
|
||||||
if ( m_inputCompositionModel )
|
if ( m_inputCompositionModel )
|
||||||
m_inputPanel->disconnect( m_inputCompositionModel.get() );
|
m_inputPanel->disconnect( m_inputCompositionModel.get() );
|
||||||
@ -304,17 +304,17 @@ void QskInputContext::setInputPanel( QskInputPanel* inputPanel )
|
|||||||
if ( !m_inputPanel )
|
if ( !m_inputPanel )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QObject::connect( m_inputPanel.data(), &QskInputPanel::visibleChanged,
|
QObject::connect( m_inputPanel.data(), &QskVirtualKeyboard::visibleChanged,
|
||||||
this, &QskInputContext::emitInputPanelVisibleChanged );
|
this, &QskInputContext::emitInputPanelVisibleChanged );
|
||||||
QObject::connect( m_inputPanel.data(), &QskInputPanel::keyboardRectChanged,
|
QObject::connect( m_inputPanel.data(), &QskVirtualKeyboard::keyboardRectChanged,
|
||||||
this, &QskInputContext::emitKeyboardRectChanged );
|
this, &QskInputContext::emitKeyboardRectChanged );
|
||||||
QObject::connect( m_inputPanel.data(), &QskInputPanel::localeChanged,
|
QObject::connect( m_inputPanel.data(), &QskVirtualKeyboard::localeChanged,
|
||||||
this, &QskInputContext::emitLocaleChanged );
|
this, &QskInputContext::emitLocaleChanged );
|
||||||
if ( m_inputCompositionModel )
|
if ( m_inputCompositionModel )
|
||||||
{
|
{
|
||||||
QObject::connect(
|
QObject::connect(
|
||||||
m_inputCompositionModel.get(), &QskInputCompositionModel::groupsChanged,
|
m_inputCompositionModel.get(), &QskInputCompositionModel::groupsChanged,
|
||||||
m_inputPanel.data(), &QskInputPanel::setPreeditGroups );
|
m_inputPanel.data(), &QskVirtualKeyboard::setPreeditGroups );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class QskInputPanel;
|
class QskVirtualKeyboard;
|
||||||
class QskInputCompositionModel;
|
class QskInputCompositionModel;
|
||||||
|
|
||||||
class QskInputContext : public QPlatformInputContext
|
class QskInputContext : public QPlatformInputContext
|
||||||
@ -39,12 +39,12 @@ public:
|
|||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void emitAnimatingChanged();
|
void emitAnimatingChanged();
|
||||||
void handleCandidatesChanged();
|
void handleCandidatesChanged();
|
||||||
void setInputPanel( QskInputPanel* );
|
void setInputPanel( QskVirtualKeyboard* );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer< QObject > m_focusObject;
|
QPointer< QObject > m_focusObject;
|
||||||
QPointer< QQuickItem > m_inputItem;
|
QPointer< QQuickItem > m_inputItem;
|
||||||
QPointer< QskInputPanel > m_inputPanel;
|
QPointer< QskVirtualKeyboard > m_inputPanel;
|
||||||
std::unique_ptr< QskInputCompositionModel > m_inputCompositionModel;
|
std::unique_ptr< QskInputCompositionModel > m_inputCompositionModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include <SkinnyFont.h>
|
#include <SkinnyFont.h>
|
||||||
#include <SkinnyShortcut.h>
|
#include <SkinnyShortcut.h>
|
||||||
|
|
||||||
#include <QskInputPanel.h>
|
#include <QskVirtualKeyboard.h>
|
||||||
#include <QskDialog.h>
|
#include <QskDialog.h>
|
||||||
#include <QskFocusIndicator.h>
|
#include <QskFocusIndicator.h>
|
||||||
#include <QskLinearBox.h>
|
#include <QskLinearBox.h>
|
||||||
@ -44,7 +44,7 @@ public:
|
|||||||
textInput->setText( "I am a line edit. Press and edit Me." );
|
textInput->setText( "I am a line edit. Press and edit Me." );
|
||||||
|
|
||||||
#if LOCAL_PANEL
|
#if LOCAL_PANEL
|
||||||
auto* inputPanel = new QskInputPanel( this );
|
auto* inputPanel = new QskVirtualKeyboard( this );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
QskInputContext is connected to QskSetup::inputPanelChanged,
|
QskInputContext is connected to QskSetup::inputPanelChanged,
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <QskTabButton.h>
|
#include <QskTabButton.h>
|
||||||
#include <QskTabBar.h>
|
#include <QskTabBar.h>
|
||||||
#include <QskTabView.h>
|
#include <QskTabView.h>
|
||||||
#include <QskInputPanel.h>
|
#include <QskVirtualKeyboard.h>
|
||||||
#include <QskScrollView.h>
|
#include <QskScrollView.h>
|
||||||
#include <QskListView.h>
|
#include <QskListView.h>
|
||||||
#include <QskSubWindow.h>
|
#include <QskSubWindow.h>
|
||||||
@ -521,12 +521,12 @@ void QskMaterialSkin::initTabViewHints()
|
|||||||
void QskMaterialSkin::initInputPanelHints()
|
void QskMaterialSkin::initInputPanelHints()
|
||||||
{
|
{
|
||||||
using namespace QskAspect;
|
using namespace QskAspect;
|
||||||
using Q = QskKeyButton;
|
using Q = QskVirtualKeyboardButton;
|
||||||
|
|
||||||
const ColorPalette& pal = m_data->palette;
|
const ColorPalette& pal = m_data->palette;
|
||||||
|
|
||||||
// key panel
|
// key panel
|
||||||
setMargins( QskInputPanel::Panel | Margin, 2 );
|
setMargins( QskVirtualKeyboard::Panel | Margin, 2 );
|
||||||
|
|
||||||
setBoxShape( Q::Panel, 20.0, Qt::RelativeSize );
|
setBoxShape( Q::Panel, 20.0, Qt::RelativeSize );
|
||||||
setBoxBorderMetrics( Q::Panel, 2 );
|
setBoxBorderMetrics( Q::Panel, 2 );
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <QskTabButton.h>
|
#include <QskTabButton.h>
|
||||||
#include <QskTabBar.h>
|
#include <QskTabBar.h>
|
||||||
#include <QskTabView.h>
|
#include <QskTabView.h>
|
||||||
#include <QskInputPanel.h>
|
#include <QskVirtualKeyboard.h>
|
||||||
#include <QskScrollView.h>
|
#include <QskScrollView.h>
|
||||||
#include <QskListView.h>
|
#include <QskListView.h>
|
||||||
#include <QskSubWindow.h>
|
#include <QskSubWindow.h>
|
||||||
@ -554,13 +554,13 @@ void QskSquiekSkin::initTabViewHints()
|
|||||||
void QskSquiekSkin::initInputPanelHints()
|
void QskSquiekSkin::initInputPanelHints()
|
||||||
{
|
{
|
||||||
using namespace QskAspect;
|
using namespace QskAspect;
|
||||||
using Q = QskKeyButton;
|
using Q = QskVirtualKeyboardButton;
|
||||||
|
|
||||||
const ColorPalette& pal = m_data->palette;
|
const ColorPalette& pal = m_data->palette;
|
||||||
|
|
||||||
// key panel
|
// key panel
|
||||||
setMargins( QskInputPanel::Panel | Padding, 5 );
|
setMargins( QskVirtualKeyboard::Panel | Padding, 5 );
|
||||||
setPanel( QskInputPanel::Panel, Raised );
|
setPanel( QskVirtualKeyboard::Panel, Raised );
|
||||||
|
|
||||||
setButton( Q::Panel, Raised );
|
setButton( Q::Panel, Raised );
|
||||||
setButton( Q::Panel | Q::Pressed, Sunken );
|
setButton( Q::Panel | Q::Pressed, Sunken );
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "QskGradient.h"
|
#include "QskGradient.h"
|
||||||
#include "QskGraphicLabel.h"
|
#include "QskGraphicLabel.h"
|
||||||
#include "QskGridBox.h"
|
#include "QskGridBox.h"
|
||||||
#include "QskInputPanel.h"
|
#include "QskVirtualKeyboard.h"
|
||||||
#include "QskRgbValue.h"
|
#include "QskRgbValue.h"
|
||||||
#include "QskScrollView.h"
|
#include "QskScrollView.h"
|
||||||
#include "QskScrollArea.h"
|
#include "QskScrollArea.h"
|
||||||
@ -159,7 +159,7 @@ public:
|
|||||||
|
|
||||||
Q_PROPERTY( QStringList skinList READ skinList NOTIFY skinListChanged )
|
Q_PROPERTY( QStringList skinList READ skinList NOTIFY skinListChanged )
|
||||||
|
|
||||||
Q_PRIVATE_PROPERTY( setup(), QskInputPanel* inputPanel READ inputPanel
|
Q_PRIVATE_PROPERTY( setup(), QskVirtualKeyboard* inputPanel READ inputPanel
|
||||||
WRITE setInputPanel NOTIFY inputPanelChanged )
|
WRITE setInputPanel NOTIFY inputPanelChanged )
|
||||||
|
|
||||||
Q_PRIVATE_PROPERTY( setup(), QskSetupFlagsProvider controlFlags
|
Q_PRIVATE_PROPERTY( setup(), QskSetupFlagsProvider controlFlags
|
||||||
@ -253,7 +253,7 @@ void QskModule::registerTypes()
|
|||||||
|
|
||||||
QSK_REGISTER( QskControl, "Control" );
|
QSK_REGISTER( QskControl, "Control" );
|
||||||
QSK_REGISTER( QskGraphicLabel, "GraphicLabel" );
|
QSK_REGISTER( QskGraphicLabel, "GraphicLabel" );
|
||||||
QSK_REGISTER( QskInputPanel, "InputPanel" );
|
QSK_REGISTER( QskVirtualKeyboard, "InputPanel" );
|
||||||
QSK_REGISTER( QskTextLabel, "TextLabel" );
|
QSK_REGISTER( QskTextLabel, "TextLabel" );
|
||||||
QSK_REGISTER( QskTabButton, "TabButton" );
|
QSK_REGISTER( QskTabButton, "TabButton" );
|
||||||
QSK_REGISTER( QskTabBar, "TabBar" );
|
QSK_REGISTER( QskTabBar, "TabBar" );
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "QskSkinManager.h"
|
#include "QskSkinManager.h"
|
||||||
#include "QskGraphicProviderMap.h"
|
#include "QskGraphicProviderMap.h"
|
||||||
#include "QskControl.h"
|
#include "QskControl.h"
|
||||||
#include "QskInputPanel.h"
|
#include "QskVirtualKeyboard.h"
|
||||||
#include "QskWindow.h"
|
#include "QskWindow.h"
|
||||||
#include "QskObjectTree.h"
|
#include "QskObjectTree.h"
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ public:
|
|||||||
|
|
||||||
QskGraphicProviderMap graphicProviders;
|
QskGraphicProviderMap graphicProviders;
|
||||||
|
|
||||||
QPointer< QskInputPanel > inputPanel;
|
QPointer< QskVirtualKeyboard > inputPanel;
|
||||||
QskSetup::Flags controlFlags;
|
QskSetup::Flags controlFlags;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ QskGraphicProvider* QskSetup::graphicProvider( const QString& providerId ) const
|
|||||||
return m_data->graphicProviders.provider( providerId );
|
return m_data->graphicProviders.provider( providerId );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskSetup::setInputPanel( QskInputPanel* inputPanel )
|
void QskSetup::setInputPanel( QskVirtualKeyboard* inputPanel )
|
||||||
{
|
{
|
||||||
if ( m_data->inputPanel == inputPanel )
|
if ( m_data->inputPanel == inputPanel )
|
||||||
return;
|
return;
|
||||||
@ -271,7 +271,7 @@ void QskSetup::setInputPanel( QskInputPanel* inputPanel )
|
|||||||
Q_EMIT inputPanelChanged( m_data->inputPanel );
|
Q_EMIT inputPanelChanged( m_data->inputPanel );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskInputPanel* QskSetup::inputPanel()
|
QskVirtualKeyboard* QskSetup::inputPanel()
|
||||||
{
|
{
|
||||||
return m_data->inputPanel;
|
return m_data->inputPanel;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <qqml.h>
|
#include <qqml.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
class QskInputPanel;
|
class QskVirtualKeyboard;
|
||||||
class QskSkin;
|
class QskSkin;
|
||||||
class QskSkinlet;
|
class QskSkinlet;
|
||||||
class QskControl;
|
class QskControl;
|
||||||
@ -60,8 +60,8 @@ public:
|
|||||||
|
|
||||||
QskSkin* skin();
|
QskSkin* skin();
|
||||||
|
|
||||||
void setInputPanel( QskInputPanel* );
|
void setInputPanel( QskVirtualKeyboard* );
|
||||||
QskInputPanel* inputPanel();
|
QskVirtualKeyboard* inputPanel();
|
||||||
|
|
||||||
void addGraphicProvider( const QString& providerId, QskGraphicProvider* );
|
void addGraphicProvider( const QString& providerId, QskGraphicProvider* );
|
||||||
QskGraphicProvider* graphicProvider( const QString& providerId ) const;
|
QskGraphicProvider* graphicProvider( const QString& providerId ) const;
|
||||||
@ -76,7 +76,7 @@ public:
|
|||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void skinChanged( QskSkin* );
|
void skinChanged( QskSkin* );
|
||||||
void inputPanelChanged( QskInputPanel* );
|
void inputPanelChanged( QskVirtualKeyboard* );
|
||||||
void controlFlagsChanged();
|
void controlFlagsChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "QskInputPanel.h"
|
#include "QskVirtualKeyboard.h"
|
||||||
|
|
||||||
#include "QskAspect.h"
|
#include "QskAspect.h"
|
||||||
|
|
||||||
@ -24,25 +24,25 @@ namespace
|
|||||||
{
|
{
|
||||||
struct KeyTable
|
struct KeyTable
|
||||||
{
|
{
|
||||||
using Row = QskInputPanel::KeyData[ QskInputPanel::KeyCount ];
|
using Row = QskVirtualKeyboard::KeyData[ QskVirtualKeyboard::KeyCount ];
|
||||||
Row data[ QskInputPanel::RowCount ];
|
Row data[ QskVirtualKeyboard::RowCount ];
|
||||||
|
|
||||||
int indexOf( const QskInputPanel::KeyData* value ) const
|
int indexOf( const QskVirtualKeyboard::KeyData* value ) const
|
||||||
{
|
{
|
||||||
return int( intptr_t( value - data[0] ) );
|
return int( intptr_t( value - data[0] ) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
struct QskInputPanelLayouts
|
struct QskVirtualKeyboardLayouts
|
||||||
{
|
{
|
||||||
struct KeyCodes
|
struct KeyCodes
|
||||||
{
|
{
|
||||||
using Row = Qt::Key[ QskInputPanel::KeyCount ];
|
using Row = Qt::Key[ QskVirtualKeyboard::KeyCount ];
|
||||||
Row data[ QskInputPanel::RowCount ];
|
Row data[ QskVirtualKeyboard::RowCount ];
|
||||||
};
|
};
|
||||||
|
|
||||||
using Layout = KeyCodes[ QskInputPanel::ModeCount ];
|
using Layout = KeyCodes[ QskVirtualKeyboard::ModeCount ];
|
||||||
|
|
||||||
Layout bg; // Bulgarian
|
Layout bg; // Bulgarian
|
||||||
Layout cs; // Czech
|
Layout cs; // Czech
|
||||||
@ -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
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ static qreal qskKeyStretch( Qt::Key key )
|
|||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static qreal qskRowStretch( const QskInputPanel::KeyRow& keyRow )
|
static qreal qskRowStretch( const QskVirtualKeyboard::KeyRow& keyRow )
|
||||||
{
|
{
|
||||||
qreal stretch = 0;
|
qreal stretch = 0;
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ static qreal qskRowStretch( const QskInputPanel::KeyRow& keyRow )
|
|||||||
|
|
||||||
if( stretch == 0.0 )
|
if( stretch == 0.0 )
|
||||||
{
|
{
|
||||||
stretch = QskInputPanel::KeyCount;
|
stretch = QskVirtualKeyboard::KeyCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
return stretch;
|
return stretch;
|
||||||
@ -145,13 +145,13 @@ namespace
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
QSK_SUBCONTROL( QskInputPanel, Panel )
|
QSK_SUBCONTROL( QskVirtualKeyboard, Panel )
|
||||||
|
|
||||||
QSK_SUBCONTROL( QskKeyButton, Panel )
|
QSK_SUBCONTROL( QskVirtualKeyboardButton, Panel )
|
||||||
QSK_SUBCONTROL( QskKeyButton, Text )
|
QSK_SUBCONTROL( QskVirtualKeyboardButton, Text )
|
||||||
QSK_SUBCONTROL( QskKeyButton, TextCancelButton )
|
QSK_SUBCONTROL( QskVirtualKeyboardButton, TextCancelButton )
|
||||||
|
|
||||||
QskKeyButton::QskKeyButton( int keyIndex, QskInputPanel* inputPanel, QQuickItem* parent ) :
|
QskVirtualKeyboardButton::QskVirtualKeyboardButton( int keyIndex, QskVirtualKeyboard* inputPanel, QQuickItem* parent ) :
|
||||||
Inherited( parent ),
|
Inherited( parent ),
|
||||||
m_keyIndex( keyIndex ),
|
m_keyIndex( keyIndex ),
|
||||||
m_inputPanel( inputPanel )
|
m_inputPanel( inputPanel )
|
||||||
@ -174,36 +174,36 @@ QskKeyButton::QskKeyButton( int keyIndex, QskInputPanel* inputPanel, QQuickItem*
|
|||||||
|
|
||||||
updateText();
|
updateText();
|
||||||
|
|
||||||
connect( this, &QskKeyButton::pressed, this, [ this ]()
|
connect( this, &QskVirtualKeyboardButton::pressed, this, [ this ]()
|
||||||
{
|
{
|
||||||
m_inputPanel->handleKey( m_keyIndex );
|
m_inputPanel->handleKey( m_keyIndex );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
connect( m_inputPanel, &QskInputPanel::modeChanged, this, &QskKeyButton::updateText );
|
connect( m_inputPanel, &QskVirtualKeyboard::modeChanged, this, &QskVirtualKeyboardButton::updateText );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskAspect::Subcontrol QskKeyButton::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const
|
QskAspect::Subcontrol QskVirtualKeyboardButton::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const
|
||||||
{
|
{
|
||||||
if( subControl == QskPushButton::Panel )
|
if( subControl == QskPushButton::Panel )
|
||||||
{
|
{
|
||||||
return QskKeyButton::Panel;
|
return QskVirtualKeyboardButton::Panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( subControl == QskPushButton::Text )
|
if( subControl == QskPushButton::Text )
|
||||||
{
|
{
|
||||||
// ### we could also introduce a state to not always query the button
|
// ### we could also introduce a state to not always query the button
|
||||||
return isCancelButton() ? QskKeyButton::TextCancelButton : QskKeyButton::Text;
|
return isCancelButton() ? QskVirtualKeyboardButton::TextCancelButton : QskVirtualKeyboardButton::Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
return subControl;
|
return subControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int QskKeyButton::keyIndex() const
|
int QskVirtualKeyboardButton::keyIndex() const
|
||||||
{
|
{
|
||||||
return m_keyIndex;
|
return m_keyIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskKeyButton::updateText()
|
void QskVirtualKeyboardButton::updateText()
|
||||||
{
|
{
|
||||||
QString text = m_inputPanel->currentTextForKeyIndex( m_keyIndex );
|
QString text = m_inputPanel->currentTextForKeyIndex( m_keyIndex );
|
||||||
|
|
||||||
@ -218,19 +218,19 @@ void QskKeyButton::updateText()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskKeyButton::isCancelButton() const
|
bool QskVirtualKeyboardButton::isCancelButton() const
|
||||||
{
|
{
|
||||||
auto keyData = m_inputPanel->keyDataAt( m_keyIndex );
|
auto keyData = m_inputPanel->keyDataAt( m_keyIndex );
|
||||||
bool isCancel = ( keyData.key == 0x2716 );
|
bool isCancel = ( keyData.key == 0x2716 );
|
||||||
return isCancel;
|
return isCancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
class QskInputPanel::PrivateData
|
class QskVirtualKeyboard::PrivateData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PrivateData():
|
PrivateData():
|
||||||
currentLayout( nullptr ),
|
currentLayout( nullptr ),
|
||||||
mode( QskInputPanel::LowercaseMode ),
|
mode( QskVirtualKeyboard::LowercaseMode ),
|
||||||
selectedGroup( -1 ),
|
selectedGroup( -1 ),
|
||||||
candidateOffset( 0 ),
|
candidateOffset( 0 ),
|
||||||
buttonsBox( nullptr ),
|
buttonsBox( nullptr ),
|
||||||
@ -239,8 +239,8 @@ class QskInputPanel::PrivateData
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const QskInputPanelLayouts::Layout* currentLayout;
|
const QskVirtualKeyboardLayouts::Layout* currentLayout;
|
||||||
QskInputPanel::Mode mode;
|
QskVirtualKeyboard::Mode mode;
|
||||||
|
|
||||||
qint16 selectedGroup;
|
qint16 selectedGroup;
|
||||||
qint32 candidateOffset;
|
qint32 candidateOffset;
|
||||||
@ -254,11 +254,11 @@ class QskInputPanel::PrivateData
|
|||||||
KeyTable keyTable[ ModeCount ];
|
KeyTable keyTable[ ModeCount ];
|
||||||
|
|
||||||
QskLinearBox* buttonsBox;
|
QskLinearBox* buttonsBox;
|
||||||
QList< QskKeyButton* > keyButtons;
|
QList< QskVirtualKeyboardButton* > keyButtons;
|
||||||
bool isUIInitialized;
|
bool isUIInitialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
QskInputPanel::QskInputPanel( QQuickItem* parent ):
|
QskVirtualKeyboard::QskVirtualKeyboard( QQuickItem* parent ):
|
||||||
Inherited( parent ),
|
Inherited( parent ),
|
||||||
m_data( new PrivateData )
|
m_data( new PrivateData )
|
||||||
{
|
{
|
||||||
@ -269,15 +269,10 @@ QskInputPanel::QskInputPanel( 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,
|
||||||
this, &QskInputPanel::updateLocale );
|
this, &QskVirtualKeyboard::updateLocale );
|
||||||
|
|
||||||
setFlag( ItemIsFocusScope, true );
|
setFlag( ItemIsFocusScope, true );
|
||||||
|
|
||||||
@ -305,47 +300,47 @@ QskInputPanel::QskInputPanel( QQuickItem* parent ):
|
|||||||
}
|
}
|
||||||
|
|
||||||
int keyIndex = m_data->keyTable[ m_data->mode ].indexOf( &keyData );
|
int keyIndex = m_data->keyTable[ m_data->mode ].indexOf( &keyData );
|
||||||
QskKeyButton* button = new QskKeyButton( keyIndex, this, rowBox );
|
QskVirtualKeyboardButton* button = new QskVirtualKeyboardButton( keyIndex, this, rowBox );
|
||||||
rowBox->setRetainSizeWhenHidden( button, true );
|
rowBox->setRetainSizeWhenHidden( button, true );
|
||||||
|
|
||||||
m_data->keyButtons.append( button );
|
m_data->keyButtons.append( button );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
connect( this, &QskInputPanel::modeChanged, this, [ this ]() {
|
connect( this, &QskVirtualKeyboard::modeChanged, this, [ this ]() {
|
||||||
updateLayout();
|
updateLayout();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QskInputPanel::~QskInputPanel()
|
QskVirtualKeyboard::~QskVirtualKeyboard()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QskAspect::Subcontrol QskInputPanel::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const
|
QskAspect::Subcontrol QskVirtualKeyboard::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const
|
||||||
{
|
{
|
||||||
if( subControl == QskBox::Panel )
|
if( subControl == QskBox::Panel )
|
||||||
{
|
{
|
||||||
return QskInputPanel::Panel;
|
return QskVirtualKeyboard::Panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
return subControl;
|
return subControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QskInputPanel::Mode QskInputPanel::mode() const
|
QskVirtualKeyboard::Mode QskVirtualKeyboard::mode() const
|
||||||
{
|
{
|
||||||
return m_data->mode;
|
return m_data->mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QskInputPanel::KeyDataSet& QskInputPanel::keyData( Mode mode ) const
|
const QskVirtualKeyboard::KeyDataSet& QskVirtualKeyboard::keyData( Mode mode ) const
|
||||||
{
|
{
|
||||||
mode = mode == CurrentMode ? m_data->mode : mode;
|
mode = mode == CurrentMode ? m_data->mode : mode;
|
||||||
Q_ASSERT( mode >= 0 && mode < ModeCount );
|
Q_ASSERT( mode >= 0 && mode < ModeCount );
|
||||||
return m_data->keyTable[ mode ].data;
|
return m_data->keyTable[ mode ].data;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QskInputPanel::textForKey( int key ) const
|
QString QskVirtualKeyboard::textForKey( int key ) const
|
||||||
{
|
{
|
||||||
key &= ~KeyStates;
|
key &= ~KeyStates;
|
||||||
|
|
||||||
@ -393,7 +388,7 @@ QString QskInputPanel::textForKey( int key ) const
|
|||||||
return QChar( key );
|
return QChar( key );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QskInputPanel::displayLanguageName() const
|
QString QskVirtualKeyboard::displayLanguageName() const
|
||||||
{
|
{
|
||||||
const auto locale = this->locale();
|
const auto locale = this->locale();
|
||||||
|
|
||||||
@ -486,7 +481,7 @@ QString QskInputPanel::displayLanguageName() const
|
|||||||
return QLocale::languageToString( locale.language() );
|
return QLocale::languageToString( locale.language() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::setPreeditGroups( const QVector< Qt::Key >& groups )
|
void QskVirtualKeyboard::setPreeditGroups( const QVector< Qt::Key >& groups )
|
||||||
{
|
{
|
||||||
auto& topRow = m_data->keyTable[ LowercaseMode ].data[ 0 ];
|
auto& topRow = m_data->keyTable[ LowercaseMode ].data[ 0 ];
|
||||||
|
|
||||||
@ -505,7 +500,7 @@ void QskInputPanel::setPreeditGroups( const QVector< Qt::Key >& groups )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::setPreeditCandidates( const QVector< Qt::Key >& candidates )
|
void QskVirtualKeyboard::setPreeditCandidates( const QVector< Qt::Key >& candidates )
|
||||||
{
|
{
|
||||||
if( m_data->candidates == candidates )
|
if( m_data->candidates == candidates )
|
||||||
{
|
{
|
||||||
@ -516,7 +511,7 @@ void QskInputPanel::setPreeditCandidates( const QVector< Qt::Key >& candidates )
|
|||||||
setCandidateOffset( 0 );
|
setCandidateOffset( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::setCandidateOffset( int candidateOffset )
|
void QskVirtualKeyboard::setCandidateOffset( int candidateOffset )
|
||||||
{
|
{
|
||||||
m_data->candidateOffset = candidateOffset;
|
m_data->candidateOffset = candidateOffset;
|
||||||
|
|
||||||
@ -559,13 +554,13 @@ void QskInputPanel::setCandidateOffset( int candidateOffset )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::registerCompositionModelForLocale( const QLocale& locale,
|
void QskVirtualKeyboard::registerCompositionModelForLocale( const QLocale& locale,
|
||||||
QskInputCompositionModel* model )
|
QskInputCompositionModel* model )
|
||||||
{
|
{
|
||||||
Q_EMIT inputMethodRegistered( locale, model );
|
Q_EMIT inputMethodRegistered( locale, model );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::geometryChanged(
|
void QskVirtualKeyboard::geometryChanged(
|
||||||
const QRectF& newGeometry, const QRectF& oldGeometry )
|
const QRectF& newGeometry, const QRectF& oldGeometry )
|
||||||
{
|
{
|
||||||
Inherited::geometryChanged( newGeometry, oldGeometry );
|
Inherited::geometryChanged( newGeometry, oldGeometry );
|
||||||
@ -573,7 +568,7 @@ void QskInputPanel::geometryChanged(
|
|||||||
Q_EMIT keyboardRectChanged();
|
Q_EMIT keyboardRectChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::updateLayout()
|
void QskVirtualKeyboard::updateLayout()
|
||||||
{
|
{
|
||||||
if( geometry().isNull() )
|
if( geometry().isNull() )
|
||||||
return; // no need to calculate anything, will be called again
|
return; // no need to calculate anything, will be called again
|
||||||
@ -590,7 +585,7 @@ void QskInputPanel::updateLayout()
|
|||||||
const auto& rowChildren = rowBox->childItems();
|
const auto& rowChildren = rowBox->childItems();
|
||||||
for( auto keyItem : rowChildren )
|
for( auto keyItem : rowChildren )
|
||||||
{
|
{
|
||||||
auto button = qobject_cast< QskKeyButton* >( keyItem );
|
auto button = qobject_cast< QskVirtualKeyboardButton* >( keyItem );
|
||||||
QRectF keyRect = keyDataAt( button->keyIndex() ).rect;
|
QRectF keyRect = keyDataAt( button->keyIndex() ).rect;
|
||||||
qreal width = keyRect.width() * rect.width() - horizontalSpacing;
|
qreal width = keyRect.width() * rect.width() - horizontalSpacing;
|
||||||
qreal height = keyRect.height() * rect.height() - verticalSpacing;
|
qreal height = keyRect.height() * rect.height() - verticalSpacing;
|
||||||
@ -600,22 +595,22 @@ void QskInputPanel::updateLayout()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::updateUI()
|
void QskVirtualKeyboard::updateUI()
|
||||||
{
|
{
|
||||||
for( QskKeyButton* button : qskAsConst( m_data->keyButtons ) )
|
for( QskVirtualKeyboardButton* button : qskAsConst( m_data->keyButtons ) )
|
||||||
{
|
{
|
||||||
button->updateText();
|
button->updateText();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QskInputPanel::KeyData& QskInputPanel::keyDataAt( int keyIndex ) const
|
QskVirtualKeyboard::KeyData& QskVirtualKeyboard::keyDataAt( int keyIndex ) const
|
||||||
{
|
{
|
||||||
const auto row = keyIndex / KeyCount;
|
const auto row = keyIndex / KeyCount;
|
||||||
const auto col = keyIndex % KeyCount;
|
const auto col = keyIndex % KeyCount;
|
||||||
return m_data->keyTable[ m_data->mode ].data[ row ][ col ];
|
return m_data->keyTable[ m_data->mode ].data[ row ][ col ];
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::handleKey( int keyIndex )
|
void QskVirtualKeyboard::handleKey( int keyIndex )
|
||||||
{
|
{
|
||||||
KeyData keyData = keyDataAt( keyIndex );
|
KeyData keyData = keyDataAt( keyIndex );
|
||||||
const auto key = keyData.key & ~KeyStates;
|
const auto key = keyData.key & ~KeyStates;
|
||||||
@ -666,8 +661,8 @@ void QskInputPanel::handleKey( int keyIndex )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
case Qt::Key_Mode_switch: // Cycle through modes, but skip caps
|
case Qt::Key_Mode_switch: // Cycle through modes, but skip caps
|
||||||
setMode( static_cast< QskInputPanel::Mode >(
|
setMode( static_cast< QskVirtualKeyboard::Mode >(
|
||||||
m_data->mode ? ( ( m_data->mode + 1 ) % QskInputPanel::ModeCount )
|
m_data->mode ? ( ( m_data->mode + 1 ) % QskVirtualKeyboard::ModeCount )
|
||||||
: SpecialCharacterMode ) );
|
: SpecialCharacterMode ) );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -690,20 +685,20 @@ void QskInputPanel::handleKey( int keyIndex )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QskInputPanel::currentTextForKeyIndex( int keyIndex ) const
|
QString QskVirtualKeyboard::currentTextForKeyIndex( int keyIndex ) const
|
||||||
{
|
{
|
||||||
auto keyData = keyDataAt( keyIndex );
|
auto keyData = keyDataAt( keyIndex );
|
||||||
QString text = textForKey( keyData.key );
|
QString text = textForKey( keyData.key );
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::compose( int key )
|
void QskVirtualKeyboard::compose( int key )
|
||||||
{
|
{
|
||||||
QGuiApplication::inputMethod()->invokeAction(
|
QGuiApplication::inputMethod()->invokeAction(
|
||||||
static_cast< QInputMethod::Action >( Compose ), key );
|
static_cast< QInputMethod::Action >( Compose ), key );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::selectGroup( int index )
|
void QskVirtualKeyboard::selectGroup( int index )
|
||||||
{
|
{
|
||||||
auto& topRow = m_data->keyTable[ m_data->mode ].data[ 0 ];
|
auto& topRow = m_data->keyTable[ m_data->mode ].data[ 0 ];
|
||||||
|
|
||||||
@ -730,34 +725,34 @@ void QskInputPanel::selectGroup( int index )
|
|||||||
topRow[ m_data->selectedGroup ].key |= KeyLocked;
|
topRow[ m_data->selectedGroup ].key |= KeyLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::selectCandidate( int index )
|
void QskVirtualKeyboard::selectCandidate( int index )
|
||||||
{
|
{
|
||||||
QGuiApplication::inputMethod()->invokeAction(
|
QGuiApplication::inputMethod()->invokeAction(
|
||||||
static_cast< QInputMethod::Action >( SelectCandidate ), index );
|
static_cast< QInputMethod::Action >( SelectCandidate ), index );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::updateLocale( const QLocale& locale )
|
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 QskInputPanel::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 QskInputPanel::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();
|
||||||
@ -854,7 +854,7 @@ void QskInputPanel::updateLocale( const QLocale& locale )
|
|||||||
setMode( LowercaseMode );
|
setMode( LowercaseMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::updateKeyData()
|
void QskVirtualKeyboard::updateKeyData()
|
||||||
{
|
{
|
||||||
// Key data is in normalized coordinates
|
// Key data is in normalized coordinates
|
||||||
const auto keyHeight = 1.0f / RowCount;
|
const auto keyHeight = 1.0f / RowCount;
|
||||||
@ -889,11 +889,10 @@ void QskInputPanel::updateKeyData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskInputPanel::setMode( QskInputPanel::Mode mode )
|
void QskVirtualKeyboard::setMode( QskVirtualKeyboard::Mode mode )
|
||||||
{
|
{
|
||||||
m_data->mode = mode;
|
m_data->mode = mode;
|
||||||
Q_EMIT modeChanged( m_data->mode );
|
Q_EMIT modeChanged( m_data->mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "QskInputPanel.moc"
|
#include "moc_QskVirtualKeyboard.cpp"
|
||||||
#include "moc_QskInputPanel.cpp"
|
|
@ -3,8 +3,8 @@
|
|||||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef QSK_INPUT_PANEL_H
|
#ifndef QSK_VIRTUAL_KEYBOARD_H
|
||||||
#define QSK_INPUT_PANEL_H
|
#define QSK_VIRTUAL_KEYBOARD_H
|
||||||
|
|
||||||
#include "QskBox.h"
|
#include "QskBox.h"
|
||||||
#include "QskPushButton.h"
|
#include "QskPushButton.h"
|
||||||
@ -12,9 +12,9 @@
|
|||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
|
|
||||||
class QskInputCompositionModel;
|
class QskInputCompositionModel;
|
||||||
class QskInputPanel;
|
class QskVirtualKeyboard;
|
||||||
|
|
||||||
class QskKeyButton : public QskPushButton // ### rename to QskInputButton or so?
|
class QSK_EXPORT QskVirtualKeyboardButton : public QskPushButton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ class QskKeyButton : public QskPushButton // ### rename to QskInputButton or so?
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, Text, TextCancelButton )
|
QSK_SUBCONTROLS( Panel, Text, TextCancelButton )
|
||||||
QskKeyButton( int keyIndex, QskInputPanel* inputPanel, QQuickItem* parent = nullptr );
|
QskVirtualKeyboardButton( int keyIndex, QskVirtualKeyboard* inputPanel, QQuickItem* parent = nullptr );
|
||||||
|
|
||||||
virtual QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol subControl ) const override;
|
virtual QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol subControl ) const override;
|
||||||
|
|
||||||
@ -35,10 +35,10 @@ class QskKeyButton : public QskPushButton // ### rename to QskInputButton or so?
|
|||||||
bool isCancelButton() const;
|
bool isCancelButton() const;
|
||||||
|
|
||||||
const int m_keyIndex;
|
const int m_keyIndex;
|
||||||
QskInputPanel* m_inputPanel;
|
QskVirtualKeyboard* m_inputPanel;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QSK_EXPORT QskInputPanel : public QskBox
|
class QSK_EXPORT QskVirtualKeyboard : public QskBox
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -86,17 +86,17 @@ public:
|
|||||||
using KeyDataRow = KeyData[KeyCount];
|
using KeyDataRow = KeyData[KeyCount];
|
||||||
using KeyDataSet = KeyDataRow[RowCount];
|
using KeyDataSet = KeyDataRow[RowCount];
|
||||||
|
|
||||||
QskInputPanel( QQuickItem* parent = nullptr );
|
QskVirtualKeyboard( QQuickItem* parent = nullptr );
|
||||||
virtual ~QskInputPanel() override;
|
virtual ~QskVirtualKeyboard() override;
|
||||||
|
|
||||||
virtual QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol subControl ) const override;
|
virtual QskAspect::Subcontrol effectiveSubcontrol( QskAspect::Subcontrol subControl ) const override;
|
||||||
|
|
||||||
void updateLocale( const QLocale& locale );
|
void updateLocale( const QLocale& locale );
|
||||||
|
|
||||||
void setMode( QskInputPanel::Mode index );
|
void setMode( QskVirtualKeyboard::Mode index );
|
||||||
Mode mode() const;
|
Mode mode() const;
|
||||||
|
|
||||||
const KeyDataSet& keyData( QskInputPanel::Mode = CurrentMode ) const;
|
const KeyDataSet& keyData( QskVirtualKeyboard::Mode = CurrentMode ) const;
|
||||||
|
|
||||||
QString textForKey( int ) const;
|
QString textForKey( int ) const;
|
||||||
QString displayLanguageName() const;
|
QString displayLanguageName() const;
|
||||||
@ -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;
|
||||||
@ -136,14 +136,14 @@ Q_SIGNALS:
|
|||||||
void inputMethodRegistered( const QLocale& locale, QskInputCompositionModel* model );
|
void inputMethodRegistered( const QLocale& locale, QskInputCompositionModel* model );
|
||||||
void inputMethodEventReceived( QInputMethodEvent* inputMethodEvent );
|
void inputMethodEventReceived( QInputMethodEvent* inputMethodEvent );
|
||||||
void keyEventReceived( QKeyEvent* keyEvent );
|
void keyEventReceived( QKeyEvent* keyEvent );
|
||||||
void modeChanged( QskInputPanel::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;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_TYPEINFO( QskInputPanel::KeyData, Q_PRIMITIVE_TYPE );
|
Q_DECLARE_TYPEINFO( QskVirtualKeyboard::KeyData, Q_PRIMITIVE_TYPE );
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -135,7 +135,6 @@ HEADERS += \
|
|||||||
controls/QskGraphicLabel.h \
|
controls/QskGraphicLabel.h \
|
||||||
controls/QskGraphicLabelSkinlet.h \
|
controls/QskGraphicLabelSkinlet.h \
|
||||||
controls/QskHintAnimator.h \
|
controls/QskHintAnimator.h \
|
||||||
controls/QskInputPanel.h \
|
|
||||||
controls/QskListView.h \
|
controls/QskListView.h \
|
||||||
controls/QskListViewSkinlet.h \
|
controls/QskListViewSkinlet.h \
|
||||||
controls/QskObjectTree.h \
|
controls/QskObjectTree.h \
|
||||||
@ -181,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 += \
|
||||||
@ -199,7 +199,6 @@ SOURCES += \
|
|||||||
controls/QskGraphicLabel.cpp \
|
controls/QskGraphicLabel.cpp \
|
||||||
controls/QskGraphicLabelSkinlet.cpp \
|
controls/QskGraphicLabelSkinlet.cpp \
|
||||||
controls/QskHintAnimator.cpp \
|
controls/QskHintAnimator.cpp \
|
||||||
controls/QskInputPanel.cpp \
|
|
||||||
controls/QskListView.cpp \
|
controls/QskListView.cpp \
|
||||||
controls/QskListViewSkinlet.cpp \
|
controls/QskListViewSkinlet.cpp \
|
||||||
controls/QskObjectTree.cpp \
|
controls/QskObjectTree.cpp \
|
||||||
@ -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…
x
Reference in New Issue
Block a user