Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
separate the layoutbar from the symbolshiftkey
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuseteam committed May 1, 2020
1 parent 45f1b71 commit f022da5
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 40 deletions.
5 changes: 2 additions & 3 deletions plugins/en@flick/qml/Keyboard_en@flick.qml
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ KeyPad {
anchors.bottom:parent.bottom
spacing: 0

SymbolShiftKey {
id: symShiftKey;
label: Languages.languageIdToName(maliit_input_method.activeLanguage);
LayoutBar {
id: layoutBar;
leaves: ["abc", "àþç", "", "😃", ""];
width: parent.width;
height:layout.height-layout.height*0.5;
Expand Down
5 changes: 2 additions & 3 deletions plugins/en@flick/qml/Keyboard_en@flick_email.qml
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ KeyPad {
anchors.bottom:parent.bottom
spacing: 0

SymbolShiftKey {
id: symShiftKey;
label: Languages.languageIdToName(maliit_input_method.activeLanguage);
LayoutBar {
id: layoutBar;
leaves: ["abc", "àþç", "", "😃", ""];
width: parent.width;
height:layout.height-layout.height*0.5;
Expand Down
5 changes: 2 additions & 3 deletions plugins/en@flick/qml/Keyboard_en@flick_url.qml
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ KeyPad {
anchors.bottom:parent.bottom
spacing: 0

SymbolShiftKey {
id: symShiftKey;
label: Languages.languageIdToName(maliit_input_method.activeLanguage);
LayoutBar {
id: layoutBar;
leaves: ["abc", "àþç", "", "😃", ""];
width: parent.width;
height:layout.height-layout.height*0.5;
Expand Down
5 changes: 2 additions & 3 deletions plugins/en@flick/qml/Keyboard_en@flick_url_search.qml
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ KeyPad {
anchors.bottom:parent.bottom
spacing: 0

SymbolShiftKey {
id: symShiftKey;
label: Languages.languageIdToName(maliit_input_method.activeLanguage);
LayoutBar {
id: layoutBar;
leaves: ["abc", "àþç", "", "😃", ""];
width: parent.width;
height:layout.height-layout.height*0.5;
Expand Down
49 changes: 49 additions & 0 deletions qml/keys/LayoutBar.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 2013 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.4

import "key_constants.js" as UI
import "languages.js" as Languages

FlickActionKey {
iconNormal:["", "", "", "", ""]
iconShifted:["", "", "", "", ""]
iconCapsLock:["", "", "", "", ""]
leaves: ["?123", "", "", "😃", ""]
label: Languages.languageIdToName(maliit_input_method.activeLanguage)
leavesFontSize: 30;
overridePressArea: true;
onReleased: {
if (index == 0) {
panel.state = panel.state == "CHARACTERS" ? "SYMBOLS" : "CHARACTERS";
} else if (index == 1) {
panel.state = panel.state == "SYMBOLS" ? "CHARACTERS" : "SYMBOLS";
} else if (index == 2) {
panel.state = panel.state == "SYMBOLS" ? "CHARACTERS" : "SYMBOLS";
} else if (index == 3) {
panel.state = panel.state == "EMOJI" ? "CHARACTERS" : "EMOJI";
}
}
onPressed: {
if (maliit_input_method.useAudioFeedback)
audioFeedback.play();

if (maliit_input_method.useHapticFeedback)
pressEffect.start();

}
}
27 changes: 10 additions & 17 deletions qml/keys/SymbolShiftKey.qml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,24 @@
import QtQuick 2.4

import "key_constants.js" as UI
import "languages.js" as Languages

FlickActionKey {
label: "?123"
shifted:"?123"
leaves: ["abc", "", "?123", "😃", ""]
leavesFontSize: 30;
ActionKey {
label: "?123";
shifted: "?123";
action: "symbols";

overridePressArea: true;
onReleased: {
if (index == 0) {
panel.state = panel.state == "CHARACTERS" ? "SYMBOLS" : "CHARACTERS";
} else if (index == 1) {
panel.state = panel.state == "SYMBOLS" ? "CHARACTERS" : "SYMBOLS";
} else if (index == 2) {
panel.state = panel.state == "SYMBOLS" ? "CHARACTERS" : "SYMBOLS";
} else if (index == 3) {
panel.state = panel.state == "EMOJI" ? "CHARACTERS" : "EMOJI";
}
}

onPressed: {
if (maliit_input_method.useAudioFeedback)
audioFeedback.play();

if (maliit_input_method.useHapticFeedback)
pressEffect.start();

if (panel.state == "CHARACTERS")
panel.state = "SYMBOLS";
else
panel.state = "CHARACTERS";
}
}
1 change: 1 addition & 0 deletions qml/keys/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ FlickPopKey 1.0 FlickPopKey.qml
CursorKey 1.0 CursorKey.qml
StringKey 1.0 StringKey.qml
CategoryKey 1.0 CategoryKey.qml
LayoutBar 1.0 LayoutBar.qml
5 changes: 2 additions & 3 deletions qml/languages/Keyboard_accents.qml
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ KeyPad {
anchors.bottom:parent.bottom
spacing: 0

SymbolShiftKey {
id: symShiftKey;
label: Languages.languageIdToName(maliit_input_method.activeLanguage);
LayoutBar {
id: layoutBar;
leaves: ["abc", "abc", "", "😃", ""];
width: parent.width;
height:layout.height-layout.height*0.5;
Expand Down
16 changes: 8 additions & 8 deletions qml/languages/Keyboard_emoji.qml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ KeyPad {
chars = recentEmoji.concat(Emoji.emoji);

for (var i = 0; i < chars.length; i++) {
c1.model.append({char: chars[i]});
c1.model.append({char: chars[i]});
}

rs = tx.executeSql('SELECT contentX, visibleIndex FROM State');
Expand Down Expand Up @@ -100,7 +100,7 @@ KeyPad {
// If the list is full remove the last emoji before inserting
if (recentEmoji.length >= maxRecent || recentEmoji[recentEmoji.length - 1] == "") {
recentEmoji.splice(recentEmoji.length - 1, 1);
}
}

recentEmoji.unshift(emoji);

Expand All @@ -127,7 +127,7 @@ KeyPad {
tx.executeSql('DELETE FROM Recent ORDER BY time ASC LIMIT ?', rs.rows.item(0).totalRecent - maxRecent);
}
}
);
);
}
}

Expand Down Expand Up @@ -211,9 +211,9 @@ KeyPad {
SymbolShiftKey {
id: symShiftKey;
label: "ABC";
leaves: ["ABC", "", "?123", "ABC", ""];
shifted: label;
height: parent.height;
padding: 0;
height: parent.height;
}

CategoryKey {
Expand All @@ -226,11 +226,11 @@ KeyPad {
pressEffect.start();
internal.jumpTo(0);
}
}
}

CategoryKey {
label: "😀"
highlight: (c1.midVisibleIndex >= internal.recentEmoji.length
highlight: (c1.midVisibleIndex >= internal.recentEmoji.length
&& c1.midVisibleIndex < 540 + internal.recentEmoji.length
&& !recentCat.highlight)
|| c1.midVisibleIndex == -1
Expand Down

0 comments on commit f022da5

Please sign in to comment.