Merge lp:~nikwen/ubuntu-terminal-app/layout-i18n into lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot

Proposed by Niklas Wenzel
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 106
Merged at revision: 112
Proposed branch: lp:~nikwen/ubuntu-terminal-app/layout-i18n
Merge into: lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot
Diff against target: 776 lines (+298/-75)
11 files modified
po/com.ubuntu.terminal.pot (+93/-1)
src/app/qml/KeyboardRows/JsonTranslator.qml (+115/-0)
src/app/qml/KeyboardRows/KeyboardLayout.qml (+31/-9)
src/app/qml/KeyboardRows/Layouts/ControlKeys.json (+1/-7)
src/app/qml/KeyboardRows/Layouts/FunctionKeys.json (+14/-27)
src/app/qml/KeyboardRows/Layouts/Nano.json (+0/-12)
src/app/qml/KeyboardRows/Layouts/ScrollKeys.json (+8/-9)
src/app/qml/KeyboardRows/Layouts/SimpleCommands.json (+1/-2)
src/app/qml/KeyboardRows/jsonParser.js (+22/-6)
src/app/qml/TerminalSettings.qml (+8/-2)
src/app/qml/ubuntu-terminal-app.qml (+5/-0)
To merge this branch: bzr merge lp:~nikwen/ubuntu-terminal-app/layout-i18n
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Review via email: mp+264620@code.launchpad.net

Commit message

Add the ability to translate strings from json profiles

Description of the change

Add the ability to translate strings from json profiles

To post a comment you must log in.
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Just found something while looking through the diff. Will fix it. :)

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Should be fixed now. :)

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Looks good, thanks Niklas!

review: Approve
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Looks like a couple of merge conflicts.

Revision history for this message
Niklas Wenzel (nikwen) wrote :

I'll get to them. Thank you for reviewing this one as well. :)

104. By Niklas Wenzel

Merge master

105. By Niklas Wenzel

Update JsonTranslator to the new UITK as well

Revision history for this message
Niklas Wenzel (nikwen) wrote :

I resolved the conflicts. Should be ready for merging now. :)

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Oh no! I found a bug!

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
106. By Niklas Wenzel

Fix error due to which the layout descriptions would not appear in the KeyboardBar

Revision history for this message
Niklas Wenzel (nikwen) wrote :

Fixed now. :)

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Niklas Wenzel (nikwen) wrote :

Thanks for merging. :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'po/com.ubuntu.terminal.pot'
--- po/com.ubuntu.terminal.pot 2015-08-02 13:04:57 +0000
+++ po/com.ubuntu.terminal.pot 2015-08-09 14:25:46 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: \n"9"Project-Id-Version: \n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2015-08-02 15:04+0200\n"11"POT-Creation-Date: 2015-08-09 16:01+0200\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -57,6 +57,98 @@
57msgid "Change Keyboard"57msgid "Change Keyboard"
58msgstr ""58msgstr ""
5959
60#. TRANSLATORS: This a keyboard layout name
61#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:18
62msgid "Control Keys"
63msgstr ""
64
65#. TRANSLATORS: This a keyboard layout name
66#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:21
67msgid "Function Keys"
68msgstr ""
69
70#. TRANSLATORS: This a keyboard layout name
71#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:24
72msgid "Scroll Keys"
73msgstr ""
74
75#. TRANSLATORS: This a keyboard layout name
76#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:27
77msgid "Command Keys"
78msgstr ""
79
80#. TRANSLATORS: This the short display name of a keyboard layout. It should be no longer than 4 characters!
81#. TRANSLATORS: This is the name of the Control key. All letters should be uppercase!
82#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:35
83#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:61
84msgid "CTRL"
85msgstr ""
86
87#. TRANSLATORS: This the short display name of a keyboard layout. It should be no longer than 4 characters!
88#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:38
89msgid "FNS"
90msgstr ""
91
92#. TRANSLATORS: This the short display name of a keyboard layout. It should be no longer than 4 characters!
93#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:41
94msgid "SCR"
95msgstr ""
96
97#. TRANSLATORS: This the short display name of a keyboard layout. It should be no longer than 4 characters!
98#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:44
99msgid "CMD"
100msgstr ""
101
102#. TRANSLATORS: This is the name of the Alt key. All letters should be uppercase!
103#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:64
104msgid "ALT"
105msgstr ""
106
107#. TRANSLATORS: This is the name of the Shift key. All letters should be uppercase!
108#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:67
109msgid "SHIFT"
110msgstr ""
111
112#. TRANSLATORS: This is the name of the Escape key. All letters should be uppercase!
113#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:80
114msgid "ESC"
115msgstr ""
116
117#. TRANSLATORS: This is the name of the Page Up key. All letters should be uppercase!
118#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:83
119msgid "PG_UP"
120msgstr ""
121
122#. TRANSLATORS: This is the name of the Page Down key. All letters should be uppercase!
123#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:86
124msgid "PG_DN"
125msgstr ""
126
127#. TRANSLATORS: This is the name of the Delete key. All letters should be uppercase!
128#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:89
129msgid "DEL"
130msgstr ""
131
132#. TRANSLATORS: This is the name of the Home key. All letters should be uppercase!
133#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:92
134msgid "HOME"
135msgstr ""
136
137#. TRANSLATORS: This is the name of the End key. All letters should be uppercase!
138#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:95
139msgid "END"
140msgstr ""
141
142#. TRANSLATORS: This is the name of the Tab key. All letters should be uppercase!
143#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:98
144msgid "TAB"
145msgstr ""
146
147#. TRANSLATORS: This is the name of the Enter key. All letters should be uppercase!
148#: ../src/app/qml/KeyboardRows/JsonTranslator.qml:101
149msgid "ENTER"
150msgstr ""
151
60#: ../src/app/qml/LayoutsPage.qml:27 ../src/app/qml/SettingsPage.qml:36152#: ../src/app/qml/LayoutsPage.qml:27 ../src/app/qml/SettingsPage.qml:36
61msgid "Layouts"153msgid "Layouts"
62msgstr ""154msgstr ""
63155
=== added file 'src/app/qml/KeyboardRows/JsonTranslator.qml'
--- src/app/qml/KeyboardRows/JsonTranslator.qml 1970-01-01 00:00:00 +0000
+++ src/app/qml/KeyboardRows/JsonTranslator.qml 2015-08-09 14:25:46 +0000
@@ -0,0 +1,115 @@
1import QtQuick 2.4
2import Ubuntu.Components 1.2
3
4Item {
5
6 // Enum for translation types
7 readonly property int name: 0
8 readonly property int shortName: 1
9 readonly property int modifier: 2
10 readonly property int key: 3
11
12 // The first parameter has to be one of the readonly properties above
13 function getTranslatedNameById(type, id) {
14 switch(type) {
15 case name:
16 if (id === "ctrl_keys") {
17 // TRANSLATORS: This a keyboard layout name
18 return i18n.tr("Control Keys");
19 } else if (id === "fn_keys") {
20 // TRANSLATORS: This a keyboard layout name
21 return i18n.tr("Function Keys");
22 } else if (id === "scroll_keys") {
23 // TRANSLATORS: This a keyboard layout name
24 return i18n.tr("Scroll Keys");
25 } else if (id === "simple_cmds") {
26 // TRANSLATORS: This a keyboard layout name
27 return i18n.tr("Command Keys");
28 }
29
30 return "";
31 case shortName:
32 var translation = "";
33 if (id === "ctrl_keys") {
34 // TRANSLATORS: This the short display name of a keyboard layout. It should be no longer than 4 characters!
35 translation = i18n.tr("CTRL");
36 } else if (id === "fn_keys") {
37 // TRANSLATORS: This the short display name of a keyboard layout. It should be no longer than 4 characters!
38 translation = i18n.tr("FNS");
39 } else if (id === "scroll_keys") {
40 // TRANSLATORS: This the short display name of a keyboard layout. It should be no longer than 4 characters!
41 translation = i18n.tr("SCR");
42 } else if (id === "simple_cmds") {
43 // TRANSLATORS: This the short display name of a keyboard layout. It should be no longer than 4 characters!
44 translation = i18n.tr("CMD");
45 }
46
47 if (translation !== "") {
48 // Shorten the string if the translation is longer than 4 characters
49 if (translation.length <= 4) {
50 return translation;
51 } else {
52 return translation.substring(0, 4);
53 }
54 }
55
56 return "";
57 case modifier:
58 var translation = "";
59 if (id === "Control") {
60 // TRANSLATORS: This is the name of the Control key. All letters should be uppercase!
61 translation = i18n.tr("CTRL");
62 } else if (id === "Alt") {
63 // TRANSLATORS: This is the name of the Alt key. All letters should be uppercase!
64 translation = i18n.tr("ALT");
65 } else if (id === "Shift") {
66 // TRANSLATORS: This is the name of the Shift key. All letters should be uppercase!
67 translation = i18n.tr("SHIFT");
68 }
69
70 if (translation !== "") {
71 // Always return the translation in uppercase letters
72 return translation.toUpperCase();
73 }
74
75 return id;
76 case key:
77 var translation = "";
78 if (id === "esc_key") {
79 // TRANSLATORS: This is the name of the Escape key. All letters should be uppercase!
80 translation = i18n.tr("ESC");
81 } else if (id === "pg_up_key") {
82 // TRANSLATORS: This is the name of the Page Up key. All letters should be uppercase!
83 translation = i18n.tr("PG_UP");
84 } else if (id === "pg_dn_key") {
85 // TRANSLATORS: This is the name of the Page Down key. All letters should be uppercase!
86 translation = i18n.tr("PG_DN");
87 } else if (id === "del_key") {
88 // TRANSLATORS: This is the name of the Delete key. All letters should be uppercase!
89 translation = i18n.tr("DEL");
90 } else if (id === "home_key") {
91 // TRANSLATORS: This is the name of the Home key. All letters should be uppercase!
92 translation = i18n.tr("HOME");
93 } else if (id === "end_key") {
94 // TRANSLATORS: This is the name of the End key. All letters should be uppercase!
95 translation = i18n.tr("END");
96 } else if (id === "tab_key") {
97 // TRANSLATORS: This is the name of the Tab key. All letters should be uppercase!
98 translation = i18n.tr("TAB");
99 } else if (id === "enter_key") {
100 // TRANSLATORS: This is the name of the Enter key. All letters should be uppercase!
101 translation = i18n.tr("ENTER");
102 }
103
104 if (translation !== "") {
105 // Always return the translation in uppercase letters
106 return translation.toUpperCase();
107 }
108
109 return id;
110 default:
111 return "";
112 }
113 }
114
115}
0116
=== modified file 'src/app/qml/KeyboardRows/KeyboardLayout.qml'
--- src/app/qml/KeyboardRows/KeyboardLayout.qml 2015-07-13 20:25:21 +0000
+++ src/app/qml/KeyboardRows/KeyboardLayout.qml 2015-08-09 14:25:46 +0000
@@ -7,6 +7,8 @@
7 id: keyboardRow7 id: keyboardRow
8 keyWidth: units.gu(5)8 keyWidth: units.gu(5)
99
10 readonly property variant modifiers: ["Control", "Alt", "Shift"]
11
10 // This label is used to compute the maximum width of all the controls.12 // This label is used to compute the maximum width of all the controls.
11 Label {13 Label {
12 id: hiddenLabel14 id: hiddenLabel
@@ -23,7 +25,7 @@
23 function createActionString(action) {25 function createActionString(action) {
24 switch(action.type){26 switch(action.type){
25 case "key":27 case "key":
26 return createKeyActionString(action.key, action.mod, action.text);28 return createKeyActionString(action.key, action.mod, action.text, action.id);
27 case "string":29 case "string":
28 return createStringActionString(action.string, action.text);30 return createStringActionString(action.string, action.text);
29 }31 }
@@ -42,12 +44,11 @@
42 return result + "]";44 return result + "]";
43 }45 }
4446
45 function createKeyActionString(key, mod, text) {47 function createKeyActionString(key, mod, text, id) {
46 if (["Control", "Alt", "Shift"].indexOf(mod) === -1)48 if (modifiers.indexOf(mod) === -1)
47 mod = "No";49 mod = "No";
4850
49 var textString = text ? "text: \"" + text + "\";" : "";51 return "Action { text: \"" + createKeyText(key, mod, text, id) + "\"; onTriggered: simulateKey(Qt.Key_"+ key + ", Qt." + mod + "Modifier); }";
50 return "Action { " + textString + " onTriggered: simulateKey(Qt.Key_"+ key + ", Qt." + mod + "Modifier); }";
51 }52 }
5253
53 function createStringActionString(string, text) {54 function createStringActionString(string, text) {
@@ -68,6 +69,17 @@
68 return objectString;69 return objectString;
69 }70 }
7071
72 function createKeyText(key, mod, text, id) {
73 if (id) {
74 return translator.getTranslatedNameById(translator.key, id);
75 } else if (text) {
76 return text;
77 } else if (key) {
78 return ((mod && modifiers.indexOf(mod) !== -1) ? translator.getTranslatedNameById(translator.modifier, mod) + "+" : "") + key;
79 } else
80 return "";
81 }
82
71 function loadProfile(profileObject) {83 function loadProfile(profileObject) {
72 dropProfile();84 dropProfile();
7385
@@ -76,28 +88,38 @@
76 // This function might raise exceptions which are handled in KeyboardBar.qml88 // This function might raise exceptions which are handled in KeyboardBar.qml
77 var profile = profileObject;89 var profile = profileObject;
7890
79 name = profile.name;91 name = "";
80 short_name = profile.short_name;92 short_name = "";
93 if (profile.id) {
94 name = translator.getTranslatedNameById(translator.name, profile.id);
95 short_name = translator.getTranslatedNameById(translator.shortName, profile.id);
96 }
97 if (name === "")
98 name = profile.name;
99 if (short_name === "")
100 short_name = profile.short_name;
81101
82 var layoutModel = []102 var layoutModel = []
83 for (var i = 0; i < profile.buttons.length; i++) {103 for (var i = 0; i < profile.buttons.length; i++) {
84 var button = profile.buttons[i];104 var button = profile.buttons[i];
105 var keyText = createKeyText(button.main_action.key, button.main_action.mod, button.main_action.text, button.main_action.id);
85 var mainActionString = createActionString(button.main_action);106 var mainActionString = createActionString(button.main_action);
86107
87 var otherActionsString = button.other_actions108 var otherActionsString = button.other_actions
88 ? createOtherActionsString(button.other_actions)109 ? createOtherActionsString(button.other_actions)
89 : "[]";110 : "[]";
90111
91 var entryString = createEntryString(button.main_action.text, mainActionString, otherActionsString);112 var entryString = createEntryString(keyText, mainActionString, otherActionsString);
92113
93 layoutModel.push(Qt.createQmlObject(entryString, keyboardRow));114 layoutModel.push(Qt.createQmlObject(entryString, keyboardRow));
94115
95 hiddenLabel.text = button.main_action.text;116 hiddenLabel.text = keyText;
96 maxWidth = Math.max(hiddenLabel.width, maxWidth);117 maxWidth = Math.max(hiddenLabel.width, maxWidth);
97 }118 }
98119
99 keyWidth = maxWidth + units.gu(3);120 keyWidth = maxWidth + units.gu(3);
100 model = layoutModel;121 model = layoutModel;
101 }122 }
123
102 Component.onDestruction: dropProfile();124 Component.onDestruction: dropProfile();
103}125}
104126
=== modified file 'src/app/qml/KeyboardRows/Layouts/ControlKeys.json'
--- src/app/qml/KeyboardRows/Layouts/ControlKeys.json 2015-04-21 09:44:54 +0000
+++ src/app/qml/KeyboardRows/Layouts/ControlKeys.json 2015-08-09 14:25:46 +0000
@@ -1,12 +1,10 @@
1{1{
2 "name" : "Control Keys",2 "id" : "ctrl_keys",
3 "short_name" : "CTRL",
43
5 "buttons": [4 "buttons": [
6 {5 {
7 "main_action" : {6 "main_action" : {
8 "type": "key",7 "type": "key",
9 "text" : "CTRL+R",
10 "key" : "R",8 "key" : "R",
11 "mod" : "Control"9 "mod" : "Control"
12 }10 }
@@ -14,7 +12,6 @@
14 {12 {
15 "main_action" : {13 "main_action" : {
16 "type": "key",14 "type": "key",
17 "text" : "CTRL+C",
18 "key" : "C",15 "key" : "C",
19 "mod" : "Control"16 "mod" : "Control"
20 }17 }
@@ -22,7 +19,6 @@
22 {19 {
23 "main_action" : {20 "main_action" : {
24 "type": "key",21 "type": "key",
25 "text" : "CTRL+A",
26 "key" : "A",22 "key" : "A",
27 "mod" : "Control"23 "mod" : "Control"
28 }24 }
@@ -30,7 +26,6 @@
30 {26 {
31 "main_action" : {27 "main_action" : {
32 "type": "key",28 "type": "key",
33 "text" : "CTRL+Z",
34 "key" : "Z",29 "key" : "Z",
35 "mod" : "Control"30 "mod" : "Control"
36 }31 }
@@ -38,7 +33,6 @@
38 {33 {
39 "main_action" : {34 "main_action" : {
40 "type": "key",35 "type": "key",
41 "text" : "CTRL+D",
42 "key" : "D",36 "key" : "D",
43 "mod" : "Control"37 "mod" : "Control"
44 }38 }
4539
=== modified file 'src/app/qml/KeyboardRows/Layouts/FunctionKeys.json'
--- src/app/qml/KeyboardRows/Layouts/FunctionKeys.json 2015-02-03 21:43:38 +0000
+++ src/app/qml/KeyboardRows/Layouts/FunctionKeys.json 2015-08-09 14:25:46 +0000
@@ -1,96 +1,83 @@
1{1{
2 "name" : "Function Keys",2 "id" : "fn_keys",
3 "short_name" : "FNS",
43
5 "buttons": [4 "buttons": [
6 {5 {
7 "main_action" : {6 "main_action" : {
8 "type": "key",7 "type": "key",
9 "text" : "ESC",8 "id" : "esc_key",
10 "key" : "Escape"9 "key" : "Escape"
11 }10 }
12 },11 },
13 {12 {
14 "main_action" : {13 "main_action" : {
15 "type": "key",14 "type": "key",
16 "text" : "F1",
17 "key" : "F1"15 "key" : "F1"
18 }16 }
19 },17 },
20 {18 {
21 "main_action" : {19 "main_action" : {
22 "type": "key",20 "type": "key",
23 "text" : "F2",
24 "key" : "F2"21 "key" : "F2"
25 }22 }
26 },23 },
27 {24 {
28 "main_action" : {25 "main_action" : {
29 "type": "key",26 "type": "key",
30 "text" : "F3",
31 "key" : "F3"27 "key" : "F3"
32 }28 }
33 },29 },
34 {30 {
35 "main_action" : {31 "main_action" : {
36 "type": "key",32 "type": "key",
37 "text" : "F4",
38 "key" : "F4"33 "key" : "F4"
39 }34 }
40 },35 },
41 {36 {
42 "main_action" : {37 "main_action" : {
43 "type": "key",38 "type": "key",
44 "text" : "F5",
45 "key" : "F5"39 "key" : "F5"
46 }40 }
47 },41 },
48 {42 {
49 "main_action" : {43 "main_action" : {
50 "type": "key",44 "type": "key",
51 "text" : "F6",
52 "key" : "F6"45 "key" : "F6"
53 }46 }
54 },47 },
55 {48 {
56 "main_action" : {49 "main_action" : {
57 "type": "key",50 "type": "key",
58 "text" : "F7",
59 "key" : "F7"51 "key" : "F7"
60 }52 }
61 },53 },
62 {54 {
63 "main_action" : {55 "main_action" : {
64 "type": "key",56 "type": "key",
65 "text" : "F8",
66 "key" : "F8"57 "key" : "F8"
67 }58 }
68 },59 },
69 {60 {
70 "main_action" : {61 "main_action" : {
71 "type": "key",62 "type": "key",
72 "text" : "F9",
73 "key" : "F9"63 "key" : "F9"
74 }64 }
75 },65 },
76 {66 {
77 "main_action" : {67 "main_action" : {
78 "type": "key",68 "type": "key",
79 "text" : "F10",69 "key" : "F10"
80 "key" : "F10"70 }
81 }71 },
82 },72 {
83 {73 "main_action" : {
84 "main_action" : {74 "type": "key",
85 "type": "key",75 "key" : "F10"
86 "text" : "F10",76 }
87 "key" : "F10"77 },
88 }78 {
89 },79 "main_action" : {
90 {80 "type": "key",
91 "main_action" : {
92 "type": "key",
93 "text" : "F11",
94 "key" : "F11"81 "key" : "F11"
95 }82 }
96 }83 }
9784
=== modified file 'src/app/qml/KeyboardRows/Layouts/Nano.json'
--- src/app/qml/KeyboardRows/Layouts/Nano.json 2015-03-25 21:08:22 +0000
+++ src/app/qml/KeyboardRows/Layouts/Nano.json 2015-08-09 14:25:46 +0000
@@ -6,7 +6,6 @@
6 {6 {
7 "main_action" : {7 "main_action" : {
8 "type": "key",8 "type": "key",
9 "text" : "CTRL+G",
10 "key" : "G",9 "key" : "G",
11 "mod" : "Control"10 "mod" : "Control"
12 }11 }
@@ -14,7 +13,6 @@
14 {13 {
15 "main_action" : {14 "main_action" : {
16 "type": "key",15 "type": "key",
17 "text" : "CTRL+O",
18 "key" : "O",16 "key" : "O",
19 "mod" : "Control"17 "mod" : "Control"
20 }18 }
@@ -22,7 +20,6 @@
22 {20 {
23 "main_action" : {21 "main_action" : {
24 "type": "key",22 "type": "key",
25 "text" : "CTRL+R",
26 "key" : "R",23 "key" : "R",
27 "mod" : "Control"24 "mod" : "Control"
28 }25 }
@@ -30,7 +27,6 @@
30 {27 {
31 "main_action" : {28 "main_action" : {
32 "type": "key",29 "type": "key",
33 "text" : "CTRL+Y",
34 "key" : "Y",30 "key" : "Y",
35 "mod" : "Control"31 "mod" : "Control"
36 }32 }
@@ -38,7 +34,6 @@
38 {34 {
39 "main_action" : {35 "main_action" : {
40 "type": "key",36 "type": "key",
41 "text" : "CTRL+K",
42 "key" : "K",37 "key" : "K",
43 "mod" : "Control"38 "mod" : "Control"
44 }39 }
@@ -46,7 +41,6 @@
46 {41 {
47 "main_action" : {42 "main_action" : {
48 "type": "key",43 "type": "key",
49 "text" : "CTRL+C",
50 "key" : "C",44 "key" : "C",
51 "mod" : "Control"45 "mod" : "Control"
52 }46 }
@@ -55,7 +49,6 @@
55 {49 {
56 "main_action" : {50 "main_action" : {
57 "type": "key",51 "type": "key",
58 "text" : "CTRL+X",
59 "key" : "X",52 "key" : "X",
60 "mod" : "Control"53 "mod" : "Control"
61 }54 }
@@ -63,7 +56,6 @@
63 {56 {
64 "main_action" : {57 "main_action" : {
65 "type": "key",58 "type": "key",
66 "text" : "CTRL+J",
67 "key" : "J",59 "key" : "J",
68 "mod" : "Control"60 "mod" : "Control"
69 }61 }
@@ -71,7 +63,6 @@
71 {63 {
72 "main_action" : {64 "main_action" : {
73 "type": "key",65 "type": "key",
74 "text" : "CTRL+W",
75 "key" : "W",66 "key" : "W",
76 "mod" : "Control"67 "mod" : "Control"
77 }68 }
@@ -79,7 +70,6 @@
79 {70 {
80 "main_action" : {71 "main_action" : {
81 "type": "key",72 "type": "key",
82 "text" : "CTRL+V",
83 "key" : "V",73 "key" : "V",
84 "mod" : "Control"74 "mod" : "Control"
85 }75 }
@@ -87,7 +77,6 @@
87 {77 {
88 "main_action" : {78 "main_action" : {
89 "type": "key",79 "type": "key",
90 "text" : "CTRL+U",
91 "key" : "U",80 "key" : "U",
92 "mod" : "Control"81 "mod" : "Control"
93 }82 }
@@ -95,7 +84,6 @@
95 {84 {
96 "main_action" : {85 "main_action" : {
97 "type": "key",86 "type": "key",
98 "text" : "CTRL+T",
99 "key" : "T",87 "key" : "T",
100 "mod" : "Control"88 "mod" : "Control"
101 }89 }
10290
=== modified file 'src/app/qml/KeyboardRows/Layouts/ScrollKeys.json'
--- src/app/qml/KeyboardRows/Layouts/ScrollKeys.json 2015-06-02 09:49:00 +0000
+++ src/app/qml/KeyboardRows/Layouts/ScrollKeys.json 2015-08-09 14:25:46 +0000
@@ -1,54 +1,53 @@
1{1{
2 "name" : "Scroll Keys",2 "id" : "scroll_keys",
3 "short_name" : "SCR",
43
5 "buttons": [4 "buttons": [
6 {5 {
7 "main_action" : {6 "main_action" : {
8 "type": "key",7 "type": "key",
9 "text" : "PG_UP",8 "id" : "pg_up_key",
10 "key" : "PageUp"9 "key" : "PageUp"
11 }10 }
12 },11 },
13 {12 {
14 "main_action" : {13 "main_action" : {
15 "type": "key",14 "type": "key",
16 "text" : "PG_DN",15 "id" : "pg_dn_key",
17 "key" : "PageDown"16 "key" : "PageDown"
18 }17 }
19 },18 },
20 {19 {
21 "main_action" : {20 "main_action" : {
22 "type": "key",21 "type": "key",
23 "text" : "DEL",22 "id" : "del_key",
24 "key" : "Delete"23 "key" : "Delete"
25 }24 }
26 },25 },
27 {26 {
28 "main_action" : {27 "main_action" : {
29 "type": "key",28 "type": "key",
30 "text" : "HOME",29 "id" : "home_key",
31 "key" : "Home"30 "key" : "Home"
32 }31 }
33 },32 },
34 {33 {
35 "main_action" : {34 "main_action" : {
36 "type": "key",35 "type": "key",
37 "text" : "END",36 "id" : "end_key",
38 "key" : "End"37 "key" : "End"
39 }38 }
40 },39 },
41 {40 {
42 "main_action" : {41 "main_action" : {
43 "type": "key",42 "type": "key",
44 "text" : "TAB",43 "id" : "tab_key",
45 "key" : "Tab"44 "key" : "Tab"
46 }45 }
47 },46 },
48 {47 {
49 "main_action" : {48 "main_action" : {
50 "type": "key",49 "type": "key",
51 "text" : "ENTER",50 "id" : "enter_key",
52 "key" : "Enter"51 "key" : "Enter"
53 }52 }
54 },53 },
5554
=== modified file 'src/app/qml/KeyboardRows/Layouts/SimpleCommands.json'
--- src/app/qml/KeyboardRows/Layouts/SimpleCommands.json 2015-03-06 11:05:22 +0000
+++ src/app/qml/KeyboardRows/Layouts/SimpleCommands.json 2015-08-09 14:25:46 +0000
@@ -1,6 +1,5 @@
1{1{
2 "name" : "Commands Key",2 "id" : "simple_cmds",
3 "short_name" : "CMD",
43
5 "buttons": [4 "buttons": [
6 {5 {
76
=== modified file 'src/app/qml/KeyboardRows/jsonParser.js'
--- src/app/qml/KeyboardRows/jsonParser.js 2015-02-14 12:46:38 +0000
+++ src/app/qml/KeyboardRows/jsonParser.js 2015-08-09 14:25:46 +0000
@@ -27,8 +27,16 @@
27 raiseException("type is missing in", actionObject);27 raiseException("type is missing in", actionObject);
28 if (!isAllowed(actionObject.type, ["key", "string"]))28 if (!isAllowed(actionObject.type, ["key", "string"]))
29 raiseException("type must be either key or string in", actionObject);29 raiseException("type must be either key or string in", actionObject);
30 if (!actionObject.text)30 if (!(actionObject.type === "key" ? actionObject.key : actionObject.string))
31 raiseException("text is missing in", actionObject);31 raiseException(actionObject.type + " is missing in", actionObject);
32 if (actionObject.id && actionObject.text)
33 raiseException("Should not define id and text together in", actionObject);
34 if (!actionObject.id && !actionObject.text && !(actionObject.type === "key" && actionObject.key)) // We can also build the text from the key
35 raiseException("text or id is missing in", actionObject);
36
37
38 // No need to check for "if (!actionObject.id && !actionObject.text)" as we will
39 // build the displayed text from the keys in that case
3240
33 switch (actionObject.type) {41 switch (actionObject.type) {
34 case "key":42 case "key":
@@ -58,10 +66,18 @@
58}66}
5967
60function validateLayout(layoutObject) {68function validateLayout(layoutObject) {
61 if (!layoutObject.name)69 if (!layoutObject.id) {
62 raiseException("name is missing in ", layoutObject);70 if (!layoutObject.name)
63 if (!layoutObject.short_name)71 raiseException("name or id is missing in", layoutObject);
64 raiseException("short_name is missing in", layoutObject);72 if (!layoutObject.short_name)
73 raiseException("short_name or id is missing in", layoutObject);
74 } else {
75 if (layoutObject.name)
76 raiseException("Should not define id and name together in", layoutObject);
77 if (layoutObject.short_name)
78 raiseException("Should not define id and short_name together in", layoutObject);
79 }
80
65 if (!layoutObject.buttons)81 if (!layoutObject.buttons)
66 raiseException("buttons is missing in", layoutObject);82 raiseException("buttons is missing in", layoutObject);
6783
6884
=== modified file 'src/app/qml/TerminalSettings.qml'
--- src/app/qml/TerminalSettings.qml 2015-07-13 20:25:21 +0000
+++ src/app/qml/TerminalSettings.qml 2015-08-09 14:25:46 +0000
@@ -50,7 +50,7 @@
50 } catch (e) {}50 } catch (e) {}
5151
52 function isProfileVisible(profilePath) {52 function isProfileVisible(profilePath) {
53 return !(visibleProfiles[profilePath] == false);53 return !(visibleProfiles[profilePath] === false);
54 }54 }
5555
56 for (var i = 0; i < keyboardLayouts.length; i++) {56 for (var i = 0; i < keyboardLayouts.length; i++) {
@@ -60,12 +60,18 @@
60 try {60 try {
61 var profileObject = Parser.parseJson(fileIO.read(filePath));61 var profileObject = Parser.parseJson(fileIO.read(filePath));
6262
63 var name = "";
64 if (profileObject.id)
65 name = translator.getTranslatedNameById(translator.name, profileObject.id);
66 if (name === "")
67 name = profileObject.name;
68
63 profilesList.append(69 profilesList.append(
64 {70 {
65 file: filePath,71 file: filePath,
66 profileVisible: isVisible,72 profileVisible: isVisible,
67 object: profileObject,73 object: profileObject,
68 name: profileObject.name74 name: name
69 });75 });
70 } catch (e) {76 } catch (e) {
71 console.error("Error in profile", filePath);77 console.error("Error in profile", filePath);
7278
=== modified file 'src/app/qml/ubuntu-terminal-app.qml'
--- src/app/qml/ubuntu-terminal-app.qml 2015-07-13 20:25:21 +0000
+++ src/app/qml/ubuntu-terminal-app.qml 2015-08-09 14:25:46 +0000
@@ -1,6 +1,7 @@
1import QtQuick 2.41import QtQuick 2.4
2import QtGraphicalEffects 1.02import QtGraphicalEffects 1.0
3import Ubuntu.Components 1.23import Ubuntu.Components 1.2
4import "KeyboardRows"
45
5import QMLTermWidget 1.06import QMLTermWidget 1.0
67
@@ -31,6 +32,10 @@
31 Component.onCompleted: addTab();32 Component.onCompleted: addTab();
32 }33 }
3334
35 JsonTranslator {
36 id: translator
37 }
38
34 PageStack {39 PageStack {
35 id: pageStack40 id: pageStack
36 Component.onCompleted: push(terminalPage)41 Component.onCompleted: push(terminalPage)

Subscribers

People subscribed via source and target branches