diff --git a/src/InputPanelIface.cpp b/src/InputPanelIface.cpp
index a9cc8f1..1a58488 100644
--- a/src/InputPanelIface.cpp
+++ b/src/InputPanelIface.cpp
@@ -11,6 +11,9 @@ struct InputPanelIface::InputPanelIfacePrivate {
QString shiftOnIcon{};
QString shiftOffIcon{};
QString hideKeyboardIcon{};
+ QString languageIcon{};
+ QStringList availableLanguageLayouts{};
+ QString languageLayout{};
};
InputPanelIface::InputPanelIface(QObject *parent)
@@ -122,3 +125,35 @@ void InputPanelIface::setHideKeyboardIcon(const QString &hideKeyboardIcon) {
emit hideKeyboardIconChanged();
}
}
+
+QString InputPanelIface::languageIcon() const { return pimpl->languageIcon; }
+
+void InputPanelIface::setLanguageIcon(const QString &languageIcon) {
+ if (pimpl->languageIcon != languageIcon) {
+ pimpl->languageIcon = languageIcon;
+ emit languageIconChanged();
+ }
+}
+
+QStringList InputPanelIface::availableLanguageLayouts() const {
+ return pimpl->availableLanguageLayouts;
+}
+
+void InputPanelIface::setAvailableLanguageLayouts(
+ const QStringList &availableLanguageLayouts) {
+ if (pimpl->availableLanguageLayouts != availableLanguageLayouts) {
+ pimpl->availableLanguageLayouts = availableLanguageLayouts;
+ emit availableLanguageLayoutsChanged();
+ }
+}
+
+QString InputPanelIface::languageLayout() const {
+ return pimpl->languageLayout;
+}
+
+void InputPanelIface::setLanguageLayout(const QString &languageLayout) {
+ if (pimpl->languageLayout != languageLayout) {
+ pimpl->languageLayout = languageLayout;
+ emit languageLayoutChanged();
+ }
+}
diff --git a/src/InputPanelIface.hpp b/src/InputPanelIface.hpp
index 5a46243..faf33df 100644
--- a/src/InputPanelIface.hpp
+++ b/src/InputPanelIface.hpp
@@ -22,6 +22,9 @@ class InputPanelIface : public QObject {
Q_PROPERTY(QString shiftOnIcon READ shiftOnIcon WRITE setShiftOnIcon NOTIFY shiftOnIconChanged)
Q_PROPERTY(QString shiftOffIcon READ shiftOffIcon WRITE setShiftOffIcon NOTIFY shiftOffIconChanged)
Q_PROPERTY(QString hideKeyboardIcon READ hideKeyboardIcon WRITE setHideKeyboardIcon NOTIFY hideKeyboardIconChanged)
+ Q_PROPERTY(QString languageIcon READ languageIcon WRITE setLanguageIcon NOTIFY languageIconChanged)
+ Q_PROPERTY(QStringList availableLanguageLayouts READ availableLanguageLayouts WRITE setAvailableLanguageLayouts NOTIFY availableLanguageLayoutsChanged)
+ Q_PROPERTY(QString languageLayout READ languageLayout WRITE setLanguageLayout NOTIFY languageLayoutChanged FINAL)
// clang-format on
public:
@@ -58,6 +61,15 @@ class InputPanelIface : public QObject {
QString hideKeyboardIcon() const;
void setHideKeyboardIcon(const QString &hideKeyboardIcon);
+ QString languageIcon() const;
+ void setLanguageIcon(const QString &languageIcon);
+
+ QStringList availableLanguageLayouts() const;
+ void setAvailableLanguageLayouts(const QStringList &availableLanguageLayouts);
+
+ QString languageLayout() const;
+ void setLanguageLayout(const QString &languageIcon);
+
signals:
void backgroundColorChanged();
void btnBackgroundColorChanged();
@@ -69,6 +81,9 @@ class InputPanelIface : public QObject {
void shiftOnIconChanged();
void shiftOffIconChanged();
void hideKeyboardIconChanged();
+ void languageIconChanged();
+ void availableLanguageLayoutsChanged();
+ void languageLayoutChanged();
private:
struct InputPanelIfacePrivate;
diff --git a/src/icons/language.png b/src/icons/language.png
new file mode 100644
index 0000000..69679a8
Binary files /dev/null and b/src/icons/language.png differ
diff --git a/src/qml/CsLayout.qml b/src/qml/CsLayout.qml
index 43a2eeb..8e703b8 100644
--- a/src/qml/CsLayout.qml
+++ b/src/qml/CsLayout.qml
@@ -77,7 +77,6 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}
-
}
RowLayout {
@@ -151,14 +150,12 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}
-
}
RowLayout {
property real keyWeight: 156
- ShiftKey {
- }
+ ShiftKey {}
Key {
btnKey: Qt.Key_Y
@@ -220,14 +217,18 @@ ColumnLayout {
ShiftKey {
weight: 204
}
-
}
RowLayout {
property real keyWeight: 154
SymbolKey {
- weight: 217
+ weight: availableLanguageLayouts.length === 1 ? 217 : 108.5
+ }
+
+ LanguageKey {
+ visible: availableLanguageLayouts.length > 1
+ weight: 108.5
}
SpaceKey {
@@ -245,7 +246,5 @@ ColumnLayout {
HideKey {
weight: 205
}
-
}
-
}
diff --git a/src/qml/DeLayout.qml b/src/qml/DeLayout.qml
index 5364b28..850ff13 100644
--- a/src/qml/DeLayout.qml
+++ b/src/qml/DeLayout.qml
@@ -76,7 +76,6 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}
-
}
RowLayout {
@@ -160,14 +159,12 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}
-
}
RowLayout {
property real keyWeight: 156
- ShiftKey {
- }
+ ShiftKey {}
Key {
btnKey: Qt.Key_Y
@@ -232,14 +229,18 @@ ColumnLayout {
ShiftKey {
weight: 204
}
-
}
RowLayout {
property real keyWeight: 154
SymbolKey {
- weight: 217
+ weight: availableLanguageLayouts.length === 1 ? 217 : 108.5
+ }
+
+ LanguageKey {
+ visible: availableLanguageLayouts.length > 1
+ weight: 108.5
}
SpaceKey {
@@ -257,7 +258,5 @@ ColumnLayout {
HideKey {
weight: 205
}
-
}
-
}
diff --git a/src/qml/ElLayout.qml b/src/qml/ElLayout.qml
index e0b87cb..a1ed519 100644
--- a/src/qml/ElLayout.qml
+++ b/src/qml/ElLayout.qml
@@ -1,496 +1,219 @@
-import QtQml 2.0
import QtQuick 2.0
import QtQuick.Layouts 1.12
-Loader {
+ColumnLayout {
property var inputPanel
- property bool latinKeyboard: false
-
- sourceComponent: latinKeyboard ? latinLayout : greekLayout
-
- Component {
- id: greekLayout
-
- ColumnLayout {
- RowLayout {
- property real keyWeight: 160
-
- Key {
- btnText: "ς"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "ε"
- alternativeKeys: "έ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "ρ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "τ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "ψ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "υ"
- alternativeKeys: "ύϋΰ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "θ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "ι"
- alternativeKeys: "ίϊΐ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "ο"
- alternativeKeys: "ό"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "π"
- inputPanelRef: inputPanel
- }
-
- BackspaceKey {
- inputPanelRef: inputPanel
- }
-
- }
-
- RowLayout {
- property real keyWeight: 160
-
- Key {
- weight: 56
- functionKey: true
- showPreview: false
- btnBackground: "transparent"
- }
-
- Key {
- btnText: "α"
- alternativeKeys: "ά"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "σ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "δ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "φ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "γ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "η"
- alternativeKeys: "ή"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "ξ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "κ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "λ"
- inputPanelRef: inputPanel
- }
-
- EnterKey {
- weight: 283
- inputPanelRef: inputPanel
- }
-
- }
-
- RowLayout {
- property real keyWeight: 156
-
- Key {
- btnDisplayedText: "ABC"
- showPreview: false
- inputPanelRef: inputPanel
- functionKey: true
- onClicked: latinKeyboard = true
- }
-
- Key {
- btnText: "ζ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "χ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "ψ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "ω"
- alternativeKeys: "ώ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "β"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "ν"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnText: "μ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_Comma
- btnText: ","
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_Period
- btnText: "."
- alternativeKeys: "!.;?"
- inputPanelRef: inputPanel
- }
-
- ShiftKey {
- weight: 204
- }
-
- }
-
- RowLayout {
- property real keyWeight: 154
-
- SymbolKey {
- weight: 217
- }
-
- SpaceKey {
- weight: 1168
- inputPanelRef: inputPanel
- btnDisplayedText: "Ελληνικός"
- }
-
- Key {
- btnKey: Qt.Key_Apostrophe
- btnText: "'"
- inputPanelRef: inputPanel
- }
-
- HideKey {
- weight: 205
- }
-
- }
+ RowLayout {
+ property real keyWeight: 160
+
+ Key {
+ btnText: "ς"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "ε"
+ alternativeKeys: "έ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "ρ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "τ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "ψ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "υ"
+ alternativeKeys: "ύϋΰ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "θ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "ι"
+ alternativeKeys: "ίϊΐ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "ο"
+ alternativeKeys: "ό"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "π"
+ inputPanelRef: inputPanel
}
+ BackspaceKey {
+ inputPanelRef: inputPanel
+ }
}
- Component {
- id: latinLayout
-
- ColumnLayout {
- RowLayout {
- property real keyWeight: 160
-
- Key {
- btnKey: Qt.Key_Q
- btnText: "q"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_W
- btnText: "w"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_E
- btnText: "e"
- alternativeKeys: "êëèé"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_R
- btnText: "r"
- alternativeKeys: "ŕř"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_T
- btnText: "t"
- alternativeKeys: "ţŧť"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_Y
- btnText: "y"
- alternativeKeys: "ÿýŷ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_U
- btnText: "u"
- alternativeKeys: "űūũûüùú"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_I
- btnText: "i"
- alternativeKeys: "îïīĩìí"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_O
- btnText: "o"
- alternativeKeys: "œøõôöòó"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_P
- btnText: "p"
- inputPanelRef: inputPanel
- }
-
- BackspaceKey {
- inputPanelRef: inputPanel
- }
-
- }
-
- RowLayout {
- property real keyWeight: 160
-
- Key {
- weight: 56
- functionKey: true
- showPreview: false
- btnBackground: "transparent"
- }
-
- Key {
- btnKey: Qt.Key_A
- btnText: "a"
- alternativeKeys: "äåãâàá"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_S
- btnText: "s"
- alternativeKeys: "šşś"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_D
- btnText: "d"
- alternativeKeys: "đď"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_F
- btnText: "f"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_G
- btnText: "g"
- alternativeKeys: "ġģĝğ"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_H
- btnText: "h"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_J
- btnText: "j"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_K
- btnText: "k"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_L
- btnText: "l"
- alternativeKeys: "ĺŀłļľ"
- inputPanelRef: inputPanel
- }
-
- EnterKey {
- weight: 283
- inputPanelRef: inputPanel
- }
-
- }
-
- RowLayout {
- property real keyWeight: 156
-
- Key {
- btnDisplayedText: "ΑΒΓ"
- showPreview: false
- inputPanelRef: inputPanel
- functionKey: true
- onClicked: latinKeyboard = false
- }
-
- Key {
- btnKey: Qt.Key_Z
- btnText: "z"
- alternativeKeys: "žż"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_X
- btnText: "x"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_C
- btnText: "c"
- alternativeKeys: "çċčć"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_V
- btnText: "v"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_B
- btnText: "b"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_N
- btnText: "n"
- alternativeKeys: "ņńň"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_M
- btnText: "m"
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_Comma
- btnText: ","
- inputPanelRef: inputPanel
- }
-
- Key {
- btnKey: Qt.Key_Period
- btnText: "."
- inputPanelRef: inputPanel
- }
-
- ShiftKey {
- weight: 204
- }
-
- }
-
- RowLayout {
- property real keyWeight: 154
-
- SymbolKey {
- weight: 217
- }
-
- SpaceKey {
- weight: 1168
- inputPanelRef: inputPanel
- btnDisplayedText: "Ελληνικός"
- }
-
- Key {
- btnKey: Qt.Key_Apostrophe
- btnText: "'"
- inputPanelRef: inputPanel
- }
-
- HideKey {
- weight: 205
- }
-
- }
+ RowLayout {
+ property real keyWeight: 160
+
+ Key {
+ weight: 56
+ functionKey: true
+ showPreview: false
+ btnBackground: "transparent"
+ }
+
+ Key {
+ btnText: "α"
+ alternativeKeys: "ά"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "σ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "δ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "φ"
+ inputPanelRef: inputPanel
+ }
+ Key {
+ btnText: "γ"
+ inputPanelRef: inputPanel
}
+ Key {
+ btnText: "η"
+ alternativeKeys: "ή"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "ξ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "κ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "λ"
+ inputPanelRef: inputPanel
+ }
+
+ EnterKey {
+ weight: 283
+ inputPanelRef: inputPanel
+ }
+ }
+
+ RowLayout {
+ property real keyWeight: 156
+
+ ShiftKey {}
+
+ Key {
+ btnText: "ζ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "χ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "ψ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "ω"
+ alternativeKeys: "ώ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "β"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "ν"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnText: "μ"
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnKey: Qt.Key_Comma
+ btnText: ","
+ inputPanelRef: inputPanel
+ }
+
+ Key {
+ btnKey: Qt.Key_Period
+ btnText: "."
+ alternativeKeys: "!.;?"
+ inputPanelRef: inputPanel
+ }
+
+ ShiftKey {
+ weight: 204
+ }
}
+ RowLayout {
+ property real keyWeight: 154
+
+ SymbolKey {
+ weight: availableLanguageLayouts.length === 1 ? 217 : 108.5
+ }
+
+ LanguageKey {
+ visible: availableLanguageLayouts.length > 1
+ weight: 108.5
+ }
+
+ SpaceKey {
+ weight: 1168
+ inputPanelRef: inputPanel
+ btnDisplayedText: "Ελληνικός"
+ }
+
+ Key {
+ btnKey: Qt.Key_Apostrophe
+ btnText: "'"
+ inputPanelRef: inputPanel
+ }
+
+ HideKey {
+ weight: 205
+ }
+ }
}
diff --git a/src/qml/EnLayout.qml b/src/qml/EnLayout.qml
index dddff59..d2bcd28 100644
--- a/src/qml/EnLayout.qml
+++ b/src/qml/EnLayout.qml
@@ -77,7 +77,6 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}
-
}
RowLayout {
@@ -153,14 +152,12 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}
-
}
RowLayout {
property real keyWeight: 156
- ShiftKey {
- }
+ ShiftKey {}
Key {
btnKey: Qt.Key_Z
@@ -222,14 +219,18 @@ ColumnLayout {
ShiftKey {
weight: 204
}
-
}
RowLayout {
property real keyWeight: 154
SymbolKey {
- weight: 217
+ weight: availableLanguageLayouts.length === 1 ? 217 : 108.5
+ }
+
+ LanguageKey {
+ visible: availableLanguageLayouts.length > 1
+ weight: 108.5
}
SpaceKey {
@@ -247,7 +248,5 @@ ColumnLayout {
HideKey {
weight: 205
}
-
}
-
}
diff --git a/src/qml/EsLayout.qml b/src/qml/EsLayout.qml
index 1d4c481..abfd1c0 100644
--- a/src/qml/EsLayout.qml
+++ b/src/qml/EsLayout.qml
@@ -74,7 +74,6 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}
-
}
RowLayout {
@@ -151,14 +150,12 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}
-
}
RowLayout {
property real keyWeight: 156
- ShiftKey {
- }
+ ShiftKey {}
Key {
btnKey: Qt.Key_Z
@@ -223,14 +220,18 @@ ColumnLayout {
ShiftKey {
weight: 204
}
-
}
RowLayout {
property real keyWeight: 154
SymbolKey {
- weight: 217
+ weight: availableLanguageLayouts.length === 1 ? 217 : 108.5
+ }
+
+ LanguageKey {
+ visible: availableLanguageLayouts.length > 1
+ weight: 108.5
}
SpaceKey {
@@ -248,7 +249,5 @@ ColumnLayout {
HideKey {
weight: 205
}
-
}
-
}
diff --git a/src/qml/FrLayout.qml b/src/qml/FrLayout.qml
index 2a11c13..81ee6ab 100644
--- a/src/qml/FrLayout.qml
+++ b/src/qml/FrLayout.qml
@@ -76,7 +76,6 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}
-
}
RowLayout {
@@ -153,14 +152,12 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}
-
}
RowLayout {
property real keyWeight: 156
- ShiftKey {
- }
+ ShiftKey {}
Key {
btnKey: Qt.Key_W
@@ -220,14 +217,18 @@ ColumnLayout {
ShiftKey {
weight: 204
}
-
}
RowLayout {
property real keyWeight: 154
SymbolKey {
- weight: 217
+ weight: availableLanguageLayouts.length === 1 ? 217 : 108.5
+ }
+
+ LanguageKey {
+ visible: availableLanguageLayouts.length > 1
+ weight: 108.5
}
SpaceKey {
@@ -245,7 +246,5 @@ ColumnLayout {
HideKey {
weight: 205
}
-
}
-
}
diff --git a/src/qml/InputPanel.qml b/src/qml/InputPanel.qml
index 7712631..8c268d3 100644
--- a/src/qml/InputPanel.qml
+++ b/src/qml/InputPanel.qml
@@ -17,28 +17,30 @@ Item {
property string shiftOnIcon: "qrc:/icons/caps-lock-on.png"
property string shiftOffIcon: "qrc:/icons/caps-lock-off.png"
property string hideKeyboardIcon: "qrc:/icons/hide-arrow.png"
+ property string languageIcon: "qrc:/icons/language.png"
+ property var availableLanguageLayouts: ["En"]
function showKeyPopup(keyButton) {
- keyPopup.popup(keyButton, root);
+ keyPopup.popup(keyButton, root)
}
function hideKeyPopup() {
- keyPopup.visible = false;
+ keyPopup.visible = false
}
function showAlternativesKeyPopup(keyButton) {
- alternativesKeyPopup.open(keyButton, root);
+ alternativesKeyPopup.open(keyButton, root)
}
function loadLettersLayout() {
if (InputEngine.inputLayoutValid(languageLayout))
layoutLoader.setSource(languageLayout + "Layout.qml", {
- "inputPanel": root
- });
+ "inputPanel": root
+ })
else
layoutLoader.setSource("EnLayout.qml", {
- "inputPanel": root
- });
+ "inputPanel": root
+ })
}
objectName: "inputPanel"
@@ -47,22 +49,27 @@ Item {
onYChanged: InputEngine.setKeyboardRectangle(Qt.rect(x, y, width, height))
onActiveChanged: {
if (alternativesKeyPopup.visible && !active)
- alternativesKeyPopup.visible = false;
-
+ alternativesKeyPopup.visible = false
}
onLanguageLayoutChanged: loadLettersLayout()
Component.onCompleted: {
- InputPanel.backgroundColor = backgroundColor;
- InputPanel.btnBackgroundColor = btnBackgroundColor;
- InputPanel.btnSpecialBackgroundColor = btnSpecialBackgroundColor;
- InputPanel.btnTextColor = btnTextColor;
- InputPanel.btnTextFontFamily = btnTextFontFamily;
- InputPanel.backspaceIcon = backspaceIcon;
- InputPanel.enterIcon = enterIcon;
- InputPanel.shiftOnIcon = shiftOnIcon;
- InputPanel.shiftOffIcon = shiftOffIcon;
- InputPanel.hideKeyboardIcon = hideKeyboardIcon;
- loadLettersLayout();
+ if (availableLanguageLayouts.length == 0) {
+ availableLanguageLayouts = ["En"]
+ }
+ InputPanel.backgroundColor = backgroundColor
+ InputPanel.btnBackgroundColor = btnBackgroundColor
+ InputPanel.btnSpecialBackgroundColor = btnSpecialBackgroundColor
+ InputPanel.btnTextColor = btnTextColor
+ InputPanel.btnTextFontFamily = btnTextFontFamily
+ InputPanel.backspaceIcon = backspaceIcon
+ InputPanel.enterIcon = enterIcon
+ InputPanel.shiftOnIcon = shiftOnIcon
+ InputPanel.shiftOffIcon = shiftOffIcon
+ InputPanel.hideKeyboardIcon = hideKeyboardIcon
+ InputPanel.languageIcon = languageIcon
+ InputPanel.availableLanguageLayouts = availableLanguageLayouts
+ InputPanel.languageLayout = languageLayout
+ loadLettersLayout()
}
KeyPopup {
@@ -109,21 +116,20 @@ Item {
fill: parent
margins: 5
}
-
}
Connections {
function refreshLayouts() {
if (InputEngine.symbolMode)
layoutLoader.setSource("SymbolLayout.qml", {
- "inputPanel": root
- });
+ "inputPanel": root
+ })
else if (InputEngine.inputMode === InputEngine.DigitsOnly)
layoutLoader.setSource("DigitsLayout.qml", {
- "inputPanel": root
- });
+ "inputPanel": root
+ })
else
- loadLettersLayout();
+ loadLettersLayout()
}
target: InputEngine
@@ -135,6 +141,12 @@ Item {
}
}
+ Connections {
+ target: InputPanel
+ onLanguageLayoutChanged: {
+ languageLayout = InputPanel.languageLayout
+ loadLettersLayout()
+ }
+ }
}
-
}
diff --git a/src/qml/ItLayout.qml b/src/qml/ItLayout.qml
index 49a9e73..8283d13 100644
--- a/src/qml/ItLayout.qml
+++ b/src/qml/ItLayout.qml
@@ -74,7 +74,6 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}
-
}
RowLayout {
@@ -146,14 +145,12 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}
-
}
RowLayout {
property real keyWeight: 156
- ShiftKey {
- }
+ ShiftKey {}
Key {
btnKey: Qt.Key_Z
@@ -212,14 +209,18 @@ ColumnLayout {
ShiftKey {
weight: 204
}
-
}
RowLayout {
property real keyWeight: 154
SymbolKey {
- weight: 217
+ weight: availableLanguageLayouts.length === 1 ? 217 : 108.5
+ }
+
+ LanguageKey {
+ visible: availableLanguageLayouts.length > 1
+ weight: 108.5
}
SpaceKey {
@@ -237,7 +238,5 @@ ColumnLayout {
HideKey {
weight: 205
}
-
}
-
}
diff --git a/src/qml/LanguageKey.qml b/src/qml/LanguageKey.qml
new file mode 100644
index 0000000..2c39a55
--- /dev/null
+++ b/src/qml/LanguageKey.qml
@@ -0,0 +1,26 @@
+import CuteKeyboard 1.0
+import QtQuick 2.0
+
+Key {
+ weight: 108.5
+ btnKey: Qt.Key_Context2
+ btnIcon: InputPanel.languageIcon
+ functionKey: true
+ showPreview: false
+ btnBackground: InputPanel.btnSpecialBackgroundColor
+ onClicked: {
+ var indx = InputPanel.availableLanguageLayouts.indexOf(
+ InputPanel.languageLayout)
+ if (indx != -1) {
+ var nextIndx = (indx + 1) % InputPanel.availableLanguageLayouts.length
+ var nextLangLayout = InputPanel.availableLanguageLayouts[nextIndx]
+ if (InputEngine.inputLayoutValid(nextLangLayout)) {
+ InputPanel.languageLayout = nextLangLayout
+ } else {
+ InputPanel.languageLayout = "En"
+ }
+ } else {
+ InputPanel.languageLayout = InputPanel.availableLanguageLayouts[0]
+ }
+ }
+}
diff --git a/src/qml/NlLayout.qml b/src/qml/NlLayout.qml
index 9776cfc..4ef5e20 100644
--- a/src/qml/NlLayout.qml
+++ b/src/qml/NlLayout.qml
@@ -77,7 +77,6 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}
-
}
RowLayout {
@@ -153,14 +152,12 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}
-
}
RowLayout {
property real keyWeight: 156
- ShiftKey {
- }
+ ShiftKey {}
Key {
btnKey: Qt.Key_Z
@@ -222,14 +219,18 @@ ColumnLayout {
ShiftKey {
weight: 204
}
-
}
RowLayout {
property real keyWeight: 154
SymbolKey {
- weight: 217
+ weight: availableLanguageLayouts.length === 1 ? 217 : 108.5
+ }
+
+ LanguageKey {
+ visible: availableLanguageLayouts.length > 1
+ weight: 108.5
}
SpaceKey {
@@ -247,7 +248,5 @@ ColumnLayout {
HideKey {
weight: 205
}
-
}
-
}
diff --git a/src/qml/PlLayout.qml b/src/qml/PlLayout.qml
index eade3ae..e30a4d6 100644
--- a/src/qml/PlLayout.qml
+++ b/src/qml/PlLayout.qml
@@ -72,7 +72,6 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}
-
}
RowLayout {
@@ -146,14 +145,12 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}
-
}
RowLayout {
property real keyWeight: 156
- ShiftKey {
- }
+ ShiftKey {}
Key {
btnKey: Qt.Key_Z
@@ -216,14 +213,18 @@ ColumnLayout {
ShiftKey {
weight: 204
}
-
}
RowLayout {
property real keyWeight: 154
SymbolKey {
- weight: 217
+ weight: availableLanguageLayouts.length === 1 ? 217 : 108.5
+ }
+
+ LanguageKey {
+ visible: availableLanguageLayouts.length > 1
+ weight: 108.5
}
SpaceKey {
@@ -241,7 +242,5 @@ ColumnLayout {
HideKey {
weight: 205
}
-
}
-
}
diff --git a/src/qml/PtLayout.qml b/src/qml/PtLayout.qml
index acdd9cd..5debd6c 100644
--- a/src/qml/PtLayout.qml
+++ b/src/qml/PtLayout.qml
@@ -74,7 +74,6 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}
-
}
RowLayout {
@@ -152,14 +151,12 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}
-
}
RowLayout {
property real keyWeight: 156
- ShiftKey {
- }
+ ShiftKey {}
Key {
btnKey: Qt.Key_Z
@@ -225,14 +222,18 @@ ColumnLayout {
ShiftKey {
weight: 204
}
-
}
RowLayout {
property real keyWeight: 154
SymbolKey {
- weight: 217
+ weight: availableLanguageLayouts.length === 1 ? 217 : 108.5
+ }
+
+ LanguageKey {
+ visible: availableLanguageLayouts.length > 1
+ weight: 108.5
}
SpaceKey {
@@ -250,7 +251,5 @@ ColumnLayout {
HideKey {
weight: 205
}
-
}
-
}
diff --git a/src/qml/QwertyLayout.qml b/src/qml/QwertyLayout.qml
index f253c39..77ab42f 100644
--- a/src/qml/QwertyLayout.qml
+++ b/src/qml/QwertyLayout.qml
@@ -70,7 +70,6 @@ ColumnLayout {
BackspaceKey {
inputPanelRef: inputPanel
}
-
}
RowLayout {
@@ -141,14 +140,12 @@ ColumnLayout {
weight: 283
inputPanelRef: inputPanel
}
-
}
RowLayout {
property real keyWeight: 156
- ShiftKey {
- }
+ ShiftKey {}
Key {
btnKey: Qt.Key_Z
@@ -207,14 +204,18 @@ ColumnLayout {
ShiftKey {
weight: 204
}
-
}
RowLayout {
property real keyWeight: 154
SymbolKey {
- weight: 217
+ weight: availableLanguageLayouts.length === 1 ? 217 : 108.5
+ }
+
+ LanguageKey {
+ visible: availableLanguageLayouts.length > 1
+ weight: 108.5
}
SpaceKey {
@@ -231,7 +232,5 @@ ColumnLayout {
HideKey {
weight: 205
}
-
}
-
}
diff --git a/src/resources.qrc b/src/resources.qrc
index d3d47f4..8ac254c 100644
--- a/src/resources.qrc
+++ b/src/resources.qrc
@@ -4,5 +4,6 @@
icons/caps-lock-off.png
icons/caps-lock-on.png
icons/hide-arrow.png
+ icons/language.png