Merge lp:~mhall119/ubuntu-terminal-app/konsole-and-settings into lp:ubuntu-terminal-app

Proposed by Michael Hall
Status: Merged
Approved by: Michael Hall
Approved revision: 6
Merged at revision: 4
Proposed branch: lp:~mhall119/ubuntu-terminal-app/konsole-and-settings
Merge into: lp:ubuntu-terminal-app
Diff against target: 341 lines (+219/-47)
7 files modified
.bzrignore (+1/-1)
Configs.qml (+79/-0)
config/DbEngine.qml (+59/-0)
config/JsConfig.qml (+30/-0)
debian/ubuntu-terminal-app.install (+1/-0)
terminal.qmlproject (+1/-1)
ubuntu-terminal-app.qml (+48/-45)
To merge this branch: bzr merge lp:~mhall119/ubuntu-terminal-app/konsole-and-settings
Reviewer Review Type Date Requested Status
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Michael Hall Approve
Review via email: mp+161764@code.launchpad.net

Commit message

Include the Konsole plugin and settings page

Description of the change

Includes all of Dmitry's work to include the Konsole plugin and settings page

To post a comment you must log in.
Revision history for this message
Michael Hall (mhall119) wrote :

self-approving the branch, but it's mostly all Dmitry's code

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-04-04 11:05:43 +0000
3+++ .bzrignore 2013-05-01 01:33:24 +0000
4@@ -1,6 +1,6 @@
5 *.qmlproject.user
6
7 debian/files
8-debian/app-template/
9+debian/ubuntu-terminal-app/
10 debian/*.debhelper.log
11 debian/*.substvars
12
13=== added file 'Configs.qml'
14--- Configs.qml 1970-01-01 00:00:00 +0000
15+++ Configs.qml 2013-05-01 01:33:24 +0000
16@@ -0,0 +1,79 @@
17+import QtQuick 2.0
18+import Ubuntu.Components 0.1
19+import Ubuntu.Components.ListItems 0.1 as ListItem
20+import "config"
21+
22+Page {
23+ JsConfig{id: jsConf }
24+
25+ property bool configChanged: false;
26+ property int headerHeight: units.gu(10);
27+
28+ width: units.gu(50)
29+ height: units.gu(75)
30+
31+ Component.onCompleted: {
32+ liSchemes.values = kterm.availableColorSchemes();
33+ liSchemes.selectedIndex = liSchemes.setValue(jsConf.getColorSheme());
34+
35+ slFont.value = jsConf.getFontSize();
36+ }
37+
38+ Column {
39+ anchors {
40+ fill: parent
41+ top: parent.top
42+ topMargin: headerHeight
43+ }
44+ spacing: units.gu(1)
45+
46+ ListItem.ValueSelector {
47+ id: liSchemes
48+ width: parent.width
49+
50+ function setValue(val) {
51+ for (var k in values) {
52+ var v = values[k];
53+ if(v == val) return k;
54+ }
55+ }
56+
57+ text: i18n.tr("Color scheme") + ":"
58+ onSelectedIndexChanged: {
59+ var val = values[selectedIndex];
60+ kterm.scheme = val;
61+ jsConf.setColorScheme(val);
62+ }
63+ }
64+
65+ Label {
66+ anchors {
67+ left: parent.left
68+ leftMargin: units.gu(2)
69+ }
70+
71+ text: i18n.tr("Font size") + ":"
72+ }
73+
74+ Slider{
75+ id: slFont
76+ anchors {
77+ left: parent.left
78+ leftMargin: units.gu(2)
79+ right: parent.right
80+ rightMargin: units.gu(2)
81+ }
82+ minimumValue: 8;
83+ maximumValue: 32;
84+ onValueChanged: {
85+ kterm.font.pointSize = value
86+ jsConf.setFontSize(value);
87+ }
88+ }
89+
90+ ListItem.ThinDivider { }
91+
92+ }
93+
94+
95+}
96
97=== added directory 'config'
98=== added file 'config/DbEngine.qml'
99--- config/DbEngine.qml 1970-01-01 00:00:00 +0000
100+++ config/DbEngine.qml 2013-05-01 01:33:24 +0000
101@@ -0,0 +1,59 @@
102+import QtQuick 2.0
103+import QtQuick.LocalStorage 2.0
104+
105+//Database Helper Functions
106+Item{
107+ id:dbEngine;
108+
109+ Component.onCompleted: {
110+ initialize();
111+ }
112+
113+ function initialize() {
114+
115+ var db = getDatabase();
116+
117+ db.transaction( function(tx) {
118+ tx.executeSql('CREATE TABLE IF NOT EXISTS config(item TEXT UNIQUE, value TEXT)');
119+ });
120+ }
121+
122+ function getDatabase() {
123+
124+ var db = LocalStorage.openDatabaseSync("UbuntuTerminalDB", "1.0", "Terminal Database", 1000000);
125+
126+ return db;
127+ }
128+
129+ function setConfig( item, value ) {
130+
131+ var db = getDatabase();
132+ var res = 0;
133+
134+ db.transaction(function(tx) {
135+ var rs = tx.executeSql('INSERT OR REPLACE INTO config VALUES (?,?);', [item, value]);
136+ //console.log(rs.rowsAffected)
137+ res = rs.rowsAffected > 0;
138+ });
139+
140+ return res;
141+ }
142+
143+ function getConfig( item ) {
144+ var db = getDatabase();
145+ var res = "";
146+
147+ db.transaction(function(tx) {
148+ var rs = tx.executeSql('SELECT value FROM config WHERE item=?;', [item]);
149+ if (rs.rows.length > 0) {
150+ res = rs.rows.item(0).value;
151+ } else {
152+ res = "UNKNOWN";
153+ }
154+ });
155+
156+ return res
157+ }
158+
159+
160+}
161
162=== added file 'config/JsConfig.qml'
163--- config/JsConfig.qml 1970-01-01 00:00:00 +0000
164+++ config/JsConfig.qml 2013-05-01 01:33:24 +0000
165@@ -0,0 +1,30 @@
166+import QtQuick 2.0
167+import QtQuick.LocalStorage 2.0
168+
169+Item{
170+ DbEngine{id: dbEngine}
171+
172+ //ColorSchemes
173+ function getColorSheme(){
174+ var res = dbEngine.getConfig("colorScheme");
175+ if( res === "UNKNOWN" ) return "DarkPastels";
176+ return res;
177+ }
178+
179+ function setColorScheme(scheme){
180+ dbEngine.setConfig("colorScheme",scheme);
181+ }
182+
183+
184+ //FontSize
185+ function getFontSize(){
186+ var res = dbEngine.getConfig("fontSize");
187+ if( res === "UNKNOWN" ) return "12";
188+ return res;
189+ }
190+
191+ function setFontSize(size){
192+ dbEngine.setConfig("fontSize",size);
193+ }
194+
195+}
196
197=== modified file 'debian/ubuntu-terminal-app.install'
198--- debian/ubuntu-terminal-app.install 2013-04-11 21:26:07 +0000
199+++ debian/ubuntu-terminal-app.install 2013-05-01 01:33:24 +0000
200@@ -2,3 +2,4 @@
201 ubuntu-terminal-app.desktop usr/share/applications/
202 *.qml usr/share/ubuntu-terminal-app/
203 *.png usr/share/ubuntu-terminal-app/
204+config usr/share/ubuntu-terminal-app/
205
206=== modified file 'terminal.qmlproject'
207--- terminal.qmlproject 2013-02-12 16:28:19 +0000
208+++ terminal.qmlproject 2013-05-01 01:33:24 +0000
209@@ -3,7 +3,7 @@
210 import QmlProject 1.1
211
212 Project {
213- mainFile: "terminal.qml"
214+ mainFile: "ubuntu-terminal-app.qml"
215
216 /* Include .qml, .js, and image files from current directory and subdirectories */
217 QmlFiles {
218
219=== modified file 'ubuntu-terminal-app.qml'
220--- ubuntu-terminal-app.qml 2013-04-11 21:26:07 +0000
221+++ ubuntu-terminal-app.qml 2013-05-01 01:33:24 +0000
222@@ -1,11 +1,8 @@
223 import QtQuick 2.0
224 import Ubuntu.Components 0.1
225+import org.kde.konsole 0.1
226+import "config"
227
228-/*!
229- \brief MainView with Tabs element.
230- First Tab has a single Label and
231- second Tab has a single ToolbarAction.
232-*/
233
234 MainView {
235 // objectName for functional testing purposes (autopilot-qt5)
236@@ -14,59 +11,65 @@
237
238 width: units.gu(50)
239 height: units.gu(75)
240-
241+
242+ JsConfig{id: jsConf }
243+
244 Tabs {
245 id: tabs
246 anchors.fill: parent
247
248- // First tab begins here
249 Tab {
250 objectName: "Tab1"
251-
252 title: i18n.tr("Terminal")
253-
254- // Tab content begins here
255 page: Page {
256- Column {
257- anchors.centerIn: parent
258- Label {
259- text: i18n.tr("Swipe from right to left to change tab.")
260+ Flickable {
261+ id: flickable
262+ anchors.fill: parent
263+ contentHeight: kterm.height
264+ contentWidth: kterm.width
265+ clip: true
266+
267+ KTerminal {
268+ id: kterm
269+
270+ //////////////////////////////////////
271+ /// FONT SIZE = 24 (FINE FOR GNEXUS)
272+ /// FONT SIZE = 12 (FINE FOR DESKTOP)
273+ //////////////////////////////////////
274+ font.family: "Ubuntu Mono"
275+ font.pointSize: jsConf.getFontSize() //units.gu(1.5)
276+
277+ lines: 160
278+ columns: 80
279+ scheme: jsConf.getColorSheme() //"DarkPastels"
280+ // THIS IS NOT CORRECT; USE UNITS.GU() INSTEAD
281+ width: 1600 //units.gu(120)
282+ height: 1400 //units.gu(60)
283+
284+ session: KSession {
285+ id: ksession
286+ }
287 }
288- }
289+
290+ }
291+
292+ Scrollbar {
293+ flickableItem: flickable
294+ align: Qt.AlignTrailing
295+ }
296+ Scrollbar {
297+ flickableItem: flickable
298+ align: Qt.AlignBottom
299+ }
300+
301 }
302 }
303-
304- // Second tab begins here
305+
306 Tab {
307 objectName: "Tab2"
308-
309- title: i18n.tr("Optional Screen")
310- page: Page {
311- anchors.margins: units.gu(2)
312-
313- tools: ToolbarActions {
314- Action {
315- objectName: "action"
316-
317- iconSource: Qt.resolvedUrl("avatar.png")
318- text: i18n.tr("Tap me!")
319-
320- onTriggered: {
321- label.text = i18n.tr("Toolbar tapped")
322- }
323- }
324- }
325-
326- Column {
327- anchors.centerIn: parent
328- Label {
329- id: label
330- objectName: "label"
331-
332- text: i18n.tr("Swipe from bottom to up to reveal the toolbar.")
333- }
334- }
335- }
336+ title: i18n.tr("Settings")
337+ page: Configs { id: pgConf }
338 }
339+
340 }
341 }

Subscribers

People subscribed via source and target branches