Merge lp:~larryprice/acolyterm/standalone-command into lp:acolyterm

Proposed by Larry Price
Status: Merged
Approved by: Larry Price
Approved revision: 211
Merged at revision: 211
Proposed branch: lp:~larryprice/acolyterm/standalone-command
Merge into: lp:acolyterm
Diff against target: 233 lines (+39/-90)
6 files modified
src/app/main.cpp (+22/-44)
src/app/qml/TabsModel.qml (+9/-5)
src/app/qml/TabsPage.qml (+2/-6)
src/app/qml/TerminalComponent.qml (+4/-0)
src/app/qml/TerminalPage.qml (+2/-1)
src/app/qml/acolyterm.qml (+0/-34)
To merge this branch: bzr merge lp:~larryprice/acolyterm/standalone-command
Reviewer Review Type Date Requested Status
Larry Price Approve
Libertine CI Bot continuous-integration Approve
Review via email: mp+297788@code.launchpad.net

Commit message

Implement CLI for running a single command.

Description of the change

Implement CLI for running a single command.

To post a comment you must log in.
Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
211. By Larry Price

merge

Revision history for this message
Libertine CI Bot (libertine-ci-bot) wrote :

PASSED: Continuous integration, rev:211
https://jenkins.canonical.com/libertine/job/lp-acolyterm-ci/24/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/libertine/job/build/70
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=autopilot/45
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=autopilot/45
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=vivid+overlay,testname=autopilot/45
    SUCCESS: https://jenkins.canonical.com/libertine/job/test-0-autopkgtest/label=i386,release=xenial+overlay,testname=autopilot/45
    None: https://jenkins.canonical.com/libertine/job/lp-generic-update-mp/61/console
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-0-fetch/71
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-1-sourcepkg/release=vivid+overlay/61
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-1-sourcepkg/release=xenial+overlay/61
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=vivid+overlay/54
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=vivid+overlay/54/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/54
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=amd64,release=xenial+overlay/54/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=vivid+overlay/54
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=vivid+overlay/54/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/54
        deb: https://jenkins.canonical.com/libertine/job/build-2-binpkg/arch=i386,release=xenial+overlay/54/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/libertine/job/lp-acolyterm-ci/24/rebuild

review: Approve (continuous-integration)
Revision history for this message
Larry Price (larryprice) wrote :

works for now - i may weed out a few of these command line flags

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/main.cpp'
2--- src/app/main.cpp 2016-06-16 20:27:27 +0000
3+++ src/app/main.cpp 2016-06-21 18:15:28 +0000
4@@ -84,19 +84,32 @@
5
6 QStringList args = a.arguments();
7 if (args.contains("-h") || args.contains("--help")) {
8- qDebug() << "usage: " + args.at(0) + " [--workdir <dir>] [-h|--help] [-I <path>]";
9- qDebug() << " --forceAuth <true|false> Force authentication on or off.";
10- qDebug() << " -h|--help Print this help.";
11- qDebug() << " -I <path> Give a path for an additional QML import directory. May be used multiple times.";
12- qDebug() << " -q <qmlfile> Give an alternative location for the main qml file.";
13- qDebug() << " --workdir <dir> Change working directory to 'dir'";
14+ qDebug() << "usage: " + args.at(0) + " [--workdir <dir>] [-h|--help] [-I <path>] [-c <command> [-- <args>]]";
15+ qDebug() << " --forceAuth Force authentication on or off.";
16+ qDebug() << " -h|--help Print this help.";
17+ qDebug() << " -I <path> Give a path for an additional QML import directory. May be used multiple times.";
18+ qDebug() << " -q <qmlfile> Give an alternative location for the main qml file.";
19+ qDebug() << " --workdir <dir> Change working directory to 'dir'";
20+ qDebug() << " -c <command> -- <args> Command to be executed. Everything after -- will be considered args to command.";
21 return 0;
22 }
23
24+ auto command = getNamedArgument(args, "-c", "");
25+ view.engine()->rootContext()->setContextProperty("command", command);
26+ view.engine()->rootContext()->setContextProperty("disableTabs", QVariant(!command.isEmpty()));
27+
28+ QStringList commandArguments;
29+ auto cmdArgsIdx = args.indexOf("--");
30+ if (cmdArgsIdx != -1)
31+ {
32+ commandArguments = args.mid(cmdArgsIdx+1);
33+ }
34+ view.engine()->rootContext()->setContextProperty("commandArguments", commandArguments);
35+
36 //Dynamic folder home
37 view.engine()->rootContext()->setContextProperty("workdir", getNamedArgument(args, "--workdir", "$HOME"));
38
39- // Desktop doesn't have yet Unity8 and so no unity greeter either. Consequently it doesn't
40+ // Desktop doesn't have Unity8 and so no unity greeter either. Consequently it doesn't
41 // also have any "PIN code" or "Password" extra authentication. Don't require any extra
42 // authentication there by default
43 if (qgetenv("QT_QPA_PLATFORM") != "ubuntumirclient")
44@@ -127,43 +140,8 @@
45 }
46 else if (args.at(i) == "--forceAuth" && args.count() > i + 1)
47 {
48- QString value = args.at(i+1);
49- if (value == "true")
50- {
51- qDebug() << Q_FUNC_INFO << "Forcing authentication on";
52- view.engine()->rootContext()->setContextProperty("noAuthentication", QVariant(false));
53- }
54- else if (value == "false")
55- {
56- qDebug() << Q_FUNC_INFO << "Forcing authentication off";
57- view.engine()->rootContext()->setContextProperty("noAuthentication", QVariant(true));
58- }
59- else
60- {
61- qWarning() << Q_FUNC_INFO << "Invalid forceAuth option '" << value << "', keeping default";
62- }
63- }
64- }
65-
66- if (args.contains(QLatin1String("-testability")) || getenv("QT_LOAD_TESTABILITY"))
67- {
68- QLibrary testLib(QLatin1String("qttestability"));
69- if (testLib.load())
70- {
71- typedef void (*TasInitialize)(void);
72- TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
73- if (initFunction)
74- {
75- initFunction();
76- }
77- else
78- {
79- qCritical("Library qttestability resolve failed!");
80- }
81- }
82- else
83- {
84- qCritical("Library qttestability load failed!");
85+ qDebug() << Q_FUNC_INFO << "Forcing authentication on";
86+ view.engine()->rootContext()->setContextProperty("noAuthentication", QVariant(false));
87 }
88 }
89
90
91=== modified file 'src/app/qml/TabsModel.qml'
92--- src/app/qml/TabsModel.qml 2016-06-16 20:27:27 +0000
93+++ src/app/qml/TabsModel.qml 2016-06-21 18:15:28 +0000
94@@ -22,13 +22,15 @@
95
96 ListModel {
97 property int selectedIndex: 0
98- property int maxTabs: 8
99+ property int maxTabs: disableTabs ? 1 : 8
100
101 id: tabsModel
102
103 function addTab() {
104- if (count >= 8)
105+ if (count >= maxTabs)
106+ {
107 return;
108+ }
109
110 var termObject = terminalComponent.createObject(terminalPage.terminalContainer);
111 tabsModel.append({terminal: termObject});
112@@ -51,9 +53,11 @@
113 }
114
115 function selectTab(index) {
116- __disableTerminal(get(selectedIndex).terminal);
117- __enableTerminal(get(index).terminal);
118- selectedIndex = index;
119+ if (get(selectedIndex) && get(index)) {
120+ __disableTerminal(get(selectedIndex).terminal);
121+ __enableTerminal(get(index).terminal);
122+ selectedIndex = index;
123+ }
124 }
125
126 function removeTabWithSession(session) {
127
128=== modified file 'src/app/qml/TabsPage.qml'
129--- src/app/qml/TabsPage.qml 2016-06-16 20:27:27 +0000
130+++ src/app/qml/TabsPage.qml 2016-06-21 18:15:28 +0000
131@@ -47,11 +47,7 @@
132 model: tabsModel
133 anchors.margins: units.gu(1)
134 cellWidth: (parent.width - units.gu(2)) * 0.5
135- cellHeight: cellWidth * (terminalPage.terminalContainer.height / terminalPage.terminalContainer.width)
136-
137- // add: Transition {
138- // NumberAnimation { properties: "x,y"; duration: 200 }
139- // }
140+ cellHeight: cellWidth * terminalPage.terminalContainer.height / terminalPage.terminalContainer.width
141
142 removeDisplaced: Transition {
143 NumberAnimation { properties: "x,y"; duration: 200 }
144@@ -105,7 +101,7 @@
145
146 Label {
147 anchors { fill: blackRect; margins: units.dp(2) }
148- text: tabsModel.get(index).terminal.session.title
149+ text: tabsModel.get(index) ? tabsModel.get(index).terminal.session.title : ""
150 wrapMode: Text.Wrap
151 color: "white"
152 }
153
154=== modified file 'src/app/qml/TerminalComponent.qml'
155--- src/app/qml/TerminalComponent.qml 2016-06-16 20:27:27 +0000
156+++ src/app/qml/TerminalComponent.qml 2016-06-21 18:15:28 +0000
157@@ -62,6 +62,10 @@
158 }
159
160 Component.onCompleted: {
161+ if (command !== "") {
162+ terminalSession.setShellProgram(command);
163+ terminalSession.setArgs(commandArguments);
164+ }
165 terminalSession.startShellProgram();
166 forceActiveFocus();
167 }
168
169=== modified file 'src/app/qml/TerminalPage.qml'
170--- src/app/qml/TerminalPage.qml 2016-06-16 20:27:27 +0000
171+++ src/app/qml/TerminalPage.qml 2016-06-21 18:15:28 +0000
172@@ -80,7 +80,7 @@
173 property real wheelValue: 40
174
175 // This is needed to fake a "flickable" scrolling.
176- swipeDelta: terminal.fontMetrics.height
177+ swipeDelta: terminal ? terminal.fontMetrics.height : 1;
178
179 // Mouse actions
180 onMouseMoveDetected: terminal.simulateMouseMove(x, y, button, buttons, modifiers);
181@@ -234,6 +234,7 @@
182
183 CircularTransparentButton {
184 id: tabsButton
185+ visible: disableTabs !== true
186
187 anchors {top: settingsButton.bottom; right: parent.right; margins: units.gu(1)}
188
189
190=== modified file 'src/app/qml/acolyterm.qml'
191--- src/app/qml/acolyterm.qml 2016-06-16 20:27:27 +0000
192+++ src/app/qml/acolyterm.qml 2016-06-21 18:15:28 +0000
193@@ -86,40 +86,6 @@
194
195 TerminalPage {
196 id: terminalPage
197-
198- // TODO: decide between the expandable button or the two buttons.
199-// ExpandableButton {
200-// size: units.gu(6)
201-// anchors {right: parent.right; top: parent.top; margins: units.gu(1);}
202-// rotation: 1
203-// childComponent: Component {
204-// Rectangle {
205-// color: "#99000000" // Transparent black
206-// radius: width * 0.5
207-// border.color: UbuntuColors.orange;
208-// border.width: units.dp(3)
209-// }
210-// }
211-
212-// Icon {
213-// width: units.gu(3)
214-// height: width
215-// anchors.centerIn: parent
216-// name: "settings"
217-// color: "Grey"
218-// }
219-
220-// actions: [
221-// Action {
222-// iconName: "settings"
223-// onTriggered: pageStack.push(settingsPage)
224-// },
225-// Action {
226-// iconName: "browser-tabs"
227-// onTriggered: pageStack.push(tabsPage)
228-// }
229-// ]
230-// }
231 }
232
233 TabsPage {

Subscribers

People subscribed via source and target branches

to all changes: