Merge lp:~julia-segal/cdts/ui_work into lp:cdts

Proposed by Julia Segal
Status: Merged
Merged at revision: 2231
Proposed branch: lp:~julia-segal/cdts/ui_work
Merge into: lp:cdts
Diff against target: 963 lines (+834/-24)
13 files modified
plainbox-gui/README.rst (+10/-0)
plainbox-gui/gui-ihv/gui-ihv.pro (+5/-1)
plainbox-gui/gui-ihv/main.cpp (+26/-0)
plainbox-gui/gui-ihv/qml/outline/BottomButtons.qml (+68/-0)
plainbox-gui/gui-ihv/qml/outline/MainButtons.qml (+88/-0)
plainbox-gui/gui-ihv/qml/outline/Progress.qml (+48/-0)
plainbox-gui/gui-ihv/qml/outline/SuiteListModel.qml (+45/-0)
plainbox-gui/gui-ihv/qml/outline/SuiteListView.qml (+84/-0)
plainbox-gui/gui-ihv/qml/outline/SuiteSelection.qml (+121/-0)
plainbox-gui/gui-ihv/qml/outline/WarningDialog.qml (+163/-0)
plainbox-gui/gui-ihv/qml/outline/gui-ihv.qml (+82/-23)
plainbox-gui/gui-ihv/testsuiteitem.cpp (+44/-0)
plainbox-gui/gui-ihv/testsuiteitem.h (+50/-0)
To merge this branch: bzr merge lp:~julia-segal/cdts/ui_work
Reviewer Review Type Date Requested Status
Daniel Manrique (community) Approve
Review via email: mp+173711@code.launchpad.net

Description of the change

The SuiteSelection UI is under development. This contains the building blocks for the main UI.
It is not complete, but shows the basics of what will be there.
To test, open in QT Creator and run it.

To post a comment you must log in.
Revision history for this message
Daniel Manrique (roadmr) wrote :

HI Julia, thanks for this!

I ran it through QT creator and it looks fine. I have a few comments:

- in SuiteListView.qml, line 55 looks like this:
text: i18n.tr(" " + testname)
  I notice the spaces are there to indent list sub-items. At the moment this is OK but down the line we should find a better way to do the indentation. Maybe QML supports a multi-level/tree list display natively. Again, not to worry about at this time but we should keep this in mind.

- I see a bunch of commented code in WarningDialog.qml. No problem, again, since this is work in progress, but I wonder if there's a way to uncomment this code and have a way to test the warning dialog.

- Now the only thing I'd like to actually see changed :) I had some trouble getting this to run, because I didn't follow the instructions. In my defense, there weren't any :) Could you please add some quick instructions on how to get this up and running in the already-existing README.rst file? (the one under plainbox-gui).

Something along the lines of:
1. Either run mk-venv or manually add the following PPAs and install qt-creator and ubuntu-sdk.
2. Apply all available updates as offered by update-manager. Things will break in weird ways if this is not done.
3. Load the .pro file in qtcreator, and either run or build it.

I'll set to "Needs Fixing", exclusively to get the addition of the extra content in the README file.

Please let me know if there are any problems or questions about the process of submitting a merge request.

Thanks!

review: Needs Fixing
Revision history for this message
Daniel Manrique (roadmr) wrote :

Hi, I'll approve this now, thanks for getting the documentation started.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plainbox-gui/README.rst'
2--- plainbox-gui/README.rst 2013-07-04 17:00:33 +0000
3+++ plainbox-gui/README.rst 2013-07-11 13:17:29 +0000
4@@ -13,6 +13,16 @@
5
6 External Documentation Links
7 ============================
8+To test gui-ihv:
9+ Software Needed:
10+ QT Creator (2.7.0 or greater)
11+ Ubuntu.Components 0.1 - This is part of the Ubunutu distribution
12+ and gets updated
13+
14+1. Open QT Creator
15+2. File->Open Project->plainbox-gui.pro
16+3. Build->Run
17+4. Interact with the UI
18
19 TBD
20
21
22=== modified file 'plainbox-gui/gui-ihv/gui-ihv.pro'
23--- plainbox-gui/gui-ihv/gui-ihv.pro 2013-07-04 17:00:33 +0000
24+++ plainbox-gui/gui-ihv/gui-ihv.pro 2013-07-11 13:17:29 +0000
25@@ -26,9 +26,13 @@
26 # Additional import path used to resolve QML modules in Creator's code model
27 QML_IMPORT_PATH =
28
29-SOURCES += main.cpp
30+SOURCES += main.cpp \
31+ testsuiteitem.cpp
32
33 # Please do not modify the following two lines. Required for deployment.
34 include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
35 qtcAddDeployment()
36
37+HEADERS += \
38+ testsuiteitem.h
39+
40
41=== modified file 'plainbox-gui/gui-ihv/main.cpp'
42--- plainbox-gui/gui-ihv/main.cpp 2013-07-04 17:00:33 +0000
43+++ plainbox-gui/gui-ihv/main.cpp 2013-07-11 13:17:29 +0000
44@@ -23,12 +23,36 @@
45 #include <QPluginLoader>
46 #include <QQmlExtensionPlugin>
47 #include <QDir>
48+#include <QtQml>
49 #include "qtquick2applicationviewer.h"
50+#include "testsuiteitem.h"
51+
52+
53+// Load up test suites here (it can be moved to another file)
54+void LoadTestSuiteList(QtQuick2ApplicationViewer *viewer){
55+ QList<QObject*> list;
56+ list.append(new TestSuiteItem("One", "Test1"));
57+ list.append(new TestSuiteItem("One", "Test2"));
58+ list.append(new TestSuiteItem("Two", "Test1"));
59+ list.append(new TestSuiteItem("Two", "Test1"));
60+ list.append(new TestSuiteItem("Two", "Test2"));
61+ list.append(new TestSuiteItem("Two", "Test3"));
62+ list.append(new TestSuiteItem("Two", "Test4"));
63+ list.append(new TestSuiteItem("Three", "Test1"));
64+
65+
66+ viewer->rootContext()->setContextProperty("testSuiteModel", QVariant::fromValue(list));
67+}
68+
69+
70+
71
72 int main(int argc, char *argv[])
73 {
74 QGuiApplication app(argc, argv);
75
76+ qmlRegisterType<TestSuiteItem>("Ubuntu.IhvTest", 0, 1, "TestSuiteItem");
77+
78 QDir pluginsDir;
79 pluginsDir.setPath("../plugins");
80
81@@ -39,6 +63,8 @@
82 plugin->registerTypes("GuiEngine");
83
84 QtQuick2ApplicationViewer viewer;
85+ LoadTestSuiteList(&viewer);
86+
87 viewer.setMainQmlFile(QStringLiteral("qml/outline/gui-ihv.qml"));
88 viewer.showExpanded();
89
90
91=== added file 'plainbox-gui/gui-ihv/qml/outline/BottomButtons.qml'
92--- plainbox-gui/gui-ihv/qml/outline/BottomButtons.qml 1970-01-01 00:00:00 +0000
93+++ plainbox-gui/gui-ihv/qml/outline/BottomButtons.qml 2013-07-11 13:17:29 +0000
94@@ -0,0 +1,68 @@
95+/*
96+ * This file is part of plainbox-gui
97+ *
98+ * Copyright 2013 Canonical Ltd.
99+ *
100+ * Authors:
101+ * - Julia Segal <julia.segal@cellsoftware.co.uk>
102+ *
103+ * This program is free software; you can redistribute it and/or modify
104+ * it under the terms of the GNU General Public License as published by
105+ * the Free Software Foundation; version 3.
106+ *
107+ * This program is distributed in the hope that it will be useful,
108+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
109+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
110+ * GNU General Public License for more details.
111+ *
112+ * You should have received a copy of the GNU General Public License
113+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
114+ */
115+
116+import QtQuick 2.0
117+import Ubuntu.Components 0.1
118+
119+
120+
121+Row {
122+ id: bottombuttons
123+
124+ signal selectAll
125+ signal deselectAll
126+ signal startTesting
127+
128+
129+ width: parent.width - units.gu(20)
130+ spacing: (parent.width - (140*3))/5 // width - buttons / 5 spaces
131+
132+ Button {
133+ id:selectButton
134+ text: i18n.tr("Select All")
135+ color: UbuntuColors.warmGrey
136+ width: units.gu(16)
137+ onClicked: {
138+ bottombuttons.selectAll();
139+ }
140+ }
141+ Button {
142+ id: deselectButton
143+ text: i18n.tr("Deselect All")
144+ color: UbuntuColors.warmGrey
145+ width: units.gu(16)
146+ onClicked:{
147+ bottombuttons.deselectAll();
148+ }
149+
150+ }
151+ Button {
152+ id: startTesting
153+ text: i18n.tr("Start Testing")
154+ color: UbuntuColors.lightAubergine
155+ width: units.gu(16)
156+ onClicked:{
157+ bottombuttons.startTesting();
158+ }
159+ }
160+
161+
162+}
163
164=== added file 'plainbox-gui/gui-ihv/qml/outline/MainButtons.qml'
165--- plainbox-gui/gui-ihv/qml/outline/MainButtons.qml 1970-01-01 00:00:00 +0000
166+++ plainbox-gui/gui-ihv/qml/outline/MainButtons.qml 2013-07-11 13:17:29 +0000
167@@ -0,0 +1,88 @@
168+/*
169+ * This file is part of plainbox-gui
170+ *
171+ * Copyright 2013 Canonical Ltd.
172+ *
173+ * Authors:
174+ * - Julia Segal <julia.segal@cellsoftware.co.uk>
175+ *
176+ * This program is free software; you can redistribute it and/or modify
177+ * it under the terms of the GNU General Public License as published by
178+ * the Free Software Foundation; version 3.
179+ *
180+ * This program is distributed in the hope that it will be useful,
181+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
182+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
183+ * GNU General Public License for more details.
184+ *
185+ * You should have received a copy of the GNU General Public License
186+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
187+ */
188+
189+import QtQuick 2.0
190+import Ubuntu.Components 0.1
191+
192+
193+
194+Row {
195+ id: buttons
196+ state: "SELECTION"
197+
198+ signal actionChanged(string actionState)
199+
200+ width: parent.width - units.gu(20)
201+ spacing: (parent.width - (140*3))/5 // width - buttons / 5 spaces
202+
203+ Button {
204+ id:selectionButton
205+ text: i18n.tr("selection")
206+ width: units.gu(16)
207+ onClicked: {
208+ buttons.state = "SELECTION";
209+ buttons.actionChanged(buttons.state);
210+ }
211+ }
212+ Button {
213+ id: runButton
214+ text: i18n.tr("run")
215+ width: units.gu(16)
216+ onClicked:{
217+ buttons.state = "RUN";
218+ buttons.actionChanged(buttons.state);
219+ }
220+
221+ }
222+ Button {
223+ id: resultsButton
224+ text: i18n.tr("results")
225+ width: units.gu(16)
226+ onClicked:{
227+ buttons.state = "RESULTS"
228+ buttons.actionChanged(buttons.state);
229+ }
230+ }
231+
232+ states: [
233+ State {
234+ name: "SELECTION"
235+ PropertyChanges { target: selectionButton; color: UbuntuColors.orange}
236+ PropertyChanges { target: runButton; color: UbuntuColors.warmGrey}
237+ PropertyChanges { target: resultsButton; color: UbuntuColors.warmGrey}
238+ },
239+ State {
240+ name: "RUN"
241+ PropertyChanges { target: selectionButton; color: UbuntuColors.warmGrey}
242+ PropertyChanges { target: runButton; color: UbuntuColors.orange}
243+ PropertyChanges { target: resultsButton; color: UbuntuColors.warmGrey}
244+
245+ },
246+ State {
247+ name: "RESULTS"
248+ PropertyChanges { target: selectionButton; color: UbuntuColors.warmGrey}
249+ PropertyChanges { target: runButton; color: UbuntuColors.warmGrey}
250+ PropertyChanges { target: resultsButton; color: UbuntuColors.orange}
251+ }
252+
253+ ]
254+
255+}
256
257=== added file 'plainbox-gui/gui-ihv/qml/outline/Progress.qml'
258--- plainbox-gui/gui-ihv/qml/outline/Progress.qml 1970-01-01 00:00:00 +0000
259+++ plainbox-gui/gui-ihv/qml/outline/Progress.qml 2013-07-11 13:17:29 +0000
260@@ -0,0 +1,48 @@
261+/*
262+ * This file is part of plainbox-gui
263+ *
264+ * Copyright 2013 Canonical Ltd.
265+ *
266+ * Authors:
267+ * - Julia Segal <julia.segal@cellsoftware.co.uk>
268+ *
269+ * This program is free software; you can redistribute it and/or modify
270+ * it under the terms of the GNU General Public License as published by
271+ * the Free Software Foundation; version 3.
272+ *
273+ * This program is distributed in the hope that it will be useful,
274+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
275+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
276+ * GNU General Public License for more details.
277+ *
278+ * You should have received a copy of the GNU General Public License
279+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
280+ */
281+
282+
283+import QtQuick 2.0
284+import Ubuntu.Components 0.1
285+
286+Item {
287+ property alias title: progresslabel.text
288+ property alias indeterminate: progressbar.indeterminate
289+ property alias value: progressbar.value
290+
291+ Label {
292+ id: progresslabel
293+ text: i18n.tr("System Testing");
294+ anchors.left: parent.left
295+ }
296+
297+ ProgressBar {
298+ id: progressbar
299+ width: parent.width
300+ anchors.top: progresslabel.bottom
301+ anchors.topMargin: units.gu(1)
302+ indeterminate: false
303+ minimumValue: 0
304+ maximumValue: 100
305+ value: 50
306+ anchors.left: parent.left
307+ }
308+}
309
310=== added file 'plainbox-gui/gui-ihv/qml/outline/SuiteListModel.qml'
311--- plainbox-gui/gui-ihv/qml/outline/SuiteListModel.qml 1970-01-01 00:00:00 +0000
312+++ plainbox-gui/gui-ihv/qml/outline/SuiteListModel.qml 2013-07-11 13:17:29 +0000
313@@ -0,0 +1,45 @@
314+/*
315+ * This file is part of plainbox-gui
316+ *
317+ * Copyright 2013 Canonical Ltd.
318+ *
319+ * Authors:
320+ * - Julia Segal <julia.segal@cellsoftware.co.uk>
321+ *
322+ * This program is free software; you can redistribute it and/or modify
323+ * it under the terms of the GNU General Public License as published by
324+ * the Free Software Foundation; version 3.
325+ *
326+ * This program is distributed in the hope that it will be useful,
327+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
328+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
329+ * GNU General Public License for more details.
330+ *
331+ * You should have received a copy of the GNU General Public License
332+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
333+ */
334+
335+import QtQuick 2.0
336+import Ubuntu.Components 0.1
337+import Ubuntu.IhvTest 0.1
338+
339+
340+ListModel {
341+ id: testSuiteModel
342+
343+ ListElement { name: "Orange"; type: "Fruit"}
344+ ListElement { name: "Apple"; type: "Fruit" }
345+ ListElement { name: "Tomato"; type: "Fruit" }
346+ ListElement { name: "Banana"; type: "Fruit"}
347+ ListElement { name: "Cherry"; type: "Fruit" }
348+ ListElement { name: "Apricot"; type: "Fruit" }
349+ ListElement { name: "Potato"; type: "Vegetable" }
350+ ListElement { name: "Carrot"; type: "Vegetable" }
351+ ListElement { name: "Celery"; type: "Vegetable" }
352+ ListElement { name: "Cucumber"; type: "Vegetable" }
353+ ListElement { name: "Pepper"; type: "Vegetable" }
354+ ListElement { name: "Onion"; type: "Vegetable" }
355+
356+
357+
358+}
359
360=== added file 'plainbox-gui/gui-ihv/qml/outline/SuiteListView.qml'
361--- plainbox-gui/gui-ihv/qml/outline/SuiteListView.qml 1970-01-01 00:00:00 +0000
362+++ plainbox-gui/gui-ihv/qml/outline/SuiteListView.qml 2013-07-11 13:17:29 +0000
363@@ -0,0 +1,84 @@
364+/*
365+ * This file is part of plainbox-gui
366+ *
367+ * Copyright 2013 Canonical Ltd.
368+ *
369+ * Authors:
370+ * - Julia Segal <julia.segal@cellsoftware.co.uk>
371+ *
372+ * This program is free software; you can redistribute it and/or modify
373+ * it under the terms of the GNU General Public License as published by
374+ * the Free Software Foundation; version 3.
375+ *
376+ * This program is distributed in the hope that it will be useful,
377+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
378+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
379+ * GNU General Public License for more details.
380+ *
381+ * You should have received a copy of the GNU General Public License
382+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
383+ */
384+
385+
386+import QtQuick 2.0
387+import Ubuntu.Components 0.1
388+import Ubuntu.Components.ListItems 0.1 as ListItem
389+import "."
390+
391+Rectangle {
392+ color: "white"
393+ height: parent.height
394+
395+ SuiteListModel{
396+ id: suiteModel
397+ }
398+
399+ Flickable {
400+ id: listflick
401+ anchors.fill: parent
402+ height: parent.height
403+ width: parent.width
404+ clip: true
405+ contentHeight: groupedList.height
406+ boundsBehavior : Flickable.StopAtBounds
407+
408+
409+ ListView {
410+ id: groupedList
411+ model: testSuiteModel
412+ width: parent.width
413+ height: units.gu(8) * groupedList.count + units.gu(10)
414+ interactive: false
415+
416+
417+ delegate: ListItem.Standard {
418+ text: i18n.tr(" " + testname)
419+ control: CheckBox {
420+ anchors.verticalCenter: parent.verticalCenter
421+ checked: true
422+ }
423+
424+ }
425+
426+ section.property: "group"
427+ section.criteria: ViewSection.FullString
428+ section.delegate: ListItem.Standard {
429+ text: i18n.tr(section)
430+ control: CheckBox {
431+ anchors.verticalCenter: parent.verticalCenter
432+ checked: true
433+ }
434+
435+ }
436+
437+ }
438+ }
439+
440+ Scrollbar {
441+ flickableItem: listflick
442+ align: Qt.AlignTrailing
443+ }
444+
445+}
446+
447+
448
449=== added file 'plainbox-gui/gui-ihv/qml/outline/SuiteSelection.qml'
450--- plainbox-gui/gui-ihv/qml/outline/SuiteSelection.qml 1970-01-01 00:00:00 +0000
451+++ plainbox-gui/gui-ihv/qml/outline/SuiteSelection.qml 2013-07-11 13:17:29 +0000
452@@ -0,0 +1,121 @@
453+/*
454+ * This file is part of plainbox-gui
455+ *
456+ * Copyright 2013 Canonical Ltd.
457+ *
458+ * Authors:
459+ * - Julia Segal <julia.segal@cellsoftware.co.uk>
460+ *
461+ * This program is free software; you can redistribute it and/or modify
462+ * it under the terms of the GNU General Public License as published by
463+ * the Free Software Foundation; version 3.
464+ *
465+ * This program is distributed in the hope that it will be useful,
466+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
467+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
468+ * GNU General Public License for more details.
469+ *
470+ * You should have received a copy of the GNU General Public License
471+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
472+ */
473+
474+
475+import QtQuick 2.0
476+import GuiEngine 1.0
477+import Ubuntu.Components 0.1
478+import Ubuntu.Components.Popups 0.1
479+import Ubuntu.Layouts 0.1
480+import Ubuntu.Components.ListItems 0.1 as ListItem
481+import "."
482+
483+
484+
485+MainView {
486+ width: units.gu(80)
487+ height: units.gu(90)
488+
489+ Page {
490+ title: "IHV Driver Testing"
491+ Progress {
492+ id: progress
493+ title: i18n.tr("Testing...")
494+ width: parent.width - units.gu(10)
495+ anchors.horizontalCenter: parent.horizontalCenter
496+ }
497+
498+ // Rectangle {
499+ // id: rectangle
500+ // anchors.centerIn: parent
501+ // width: parent.width
502+ // height: parent.height
503+ //color: UbuntuColors.coolGrey
504+ // }
505+
506+ MainButtons {
507+ id: actionbuttons
508+ anchors.horizontalCenter: parent.horizontalCenter
509+ anchors.top: progress.bottom
510+ anchors.topMargin: units.gu(8)
511+
512+ onActionChanged: {
513+ switch (actionState){
514+ case "SELECTION":
515+ console.log("SELECTION selected")
516+ progress.title = "Getting tests..."
517+ progress.value = 0
518+ progress.indeterminate = false;
519+ progress.visible = true
520+ break;
521+ case "RUN":
522+ console.log("RUN selected")
523+ progress.title = "Running..."
524+ progress.visible = true
525+ progress.indeterminate = true
526+ progress.value = 100
527+ break;
528+ case "RESULTS":
529+ console.log("RESULTS selected")
530+ progress.visible = false
531+ break;
532+ default:
533+ console.log("default")
534+ progress.visible = true
535+ actionsbuttons.state = "SELECTION"
536+
537+ }
538+
539+ }
540+ }
541+
542+
543+ SuiteListView {
544+ id: suitelist
545+ height: units.gu(43)
546+ width: parent.width - units.gu(10)
547+
548+ anchors.horizontalCenter: parent.horizontalCenter
549+ anchors.top: actionbuttons.bottom
550+ anchors.topMargin: units.gu(5)
551+ }
552+
553+
554+ BottomButtons {
555+ anchors.horizontalCenter: parent.horizontalCenter
556+ anchors.top: suitelist.bottom
557+ anchors.topMargin: units.gu(5)
558+
559+ onSelectAll:{
560+ console.log("Select All")
561+ }
562+
563+ onDeselectAll: {
564+ console.log("Delselect All")
565+ }
566+
567+ onStartTesting: {
568+ console.log("Start Testing")
569+ }
570+ }
571+ }
572+}
573+
574
575=== added file 'plainbox-gui/gui-ihv/qml/outline/WarningDialog.qml'
576--- plainbox-gui/gui-ihv/qml/outline/WarningDialog.qml 1970-01-01 00:00:00 +0000
577+++ plainbox-gui/gui-ihv/qml/outline/WarningDialog.qml 2013-07-11 13:17:29 +0000
578@@ -0,0 +1,163 @@
579+/*
580+ * This file is part of plainbox-gui
581+ *
582+ * Copyright 2013 Canonical Ltd.
583+ *
584+ * Authors:
585+ * - Julia Segal <julia.segal@cellsoftware.co.uk>
586+ *
587+ * This program is free software; you can redistribute it and/or modify
588+ * it under the terms of the GNU General Public License as published by
589+ * the Free Software Foundation; version 3.
590+ *
591+ * This program is distributed in the hope that it will be useful,
592+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
593+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
594+ * GNU General Public License for more details.
595+ *
596+ * You should have received a copy of the GNU General Public License
597+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
598+ */
599+
600+
601+import QtQuick 2.0
602+import Ubuntu.Components 0.1
603+import Ubuntu.Components.Popups 0.1
604+
605+/*!
606+ \qmltype WarningDialog
607+ \inherits Dialog
608+ \inqmlmodule
609+ \ingroup
610+ \brief The Dialog This Dialog shows a Warning Dialog.
611+ Turn on/off before showing:
612+ ok, showOK
613+ cancel, showCancel
614+ continue, showContinue
615+ 'do not show warning' checkbox, showCheckbox
616+ Signals: onOK, onCancel, onCont (continue)
617+ Property: isChecked returns if the user checked 'do not show warning'
618+
619+ Example:
620+ \qml
621+ import Ubuntu.Components 0.1
622+ import Ubuntu.Components.Popups 0.1
623+ import "."
624+
625+ Item {
626+ Component {
627+ id: warning_dialog
628+
629+ WarningDialog{
630+ text: i18n.tr("The hoopla met the poopla and we all could no longer do as we want. Would you like me to try again?")
631+ showOK: false
632+ showCheckbox: true
633+
634+ onCont: {
635+ checkIfChecked();
636+ console.log("continue clicked");
637+ }
638+
639+ onCancel: {
640+ checkIfChecked();
641+ console.log("cancel clicked");
642+ }
643+
644+ function checkIfChecked(){
645+ if (isChecked)
646+ console.log("do not warn again!");
647+ else
648+ console.log("warn again");
649+ }
650+
651+ }
652+ }
653+ Button {
654+ id: warning_button
655+ color: "yellow"
656+ text: "warning..."
657+ width: 100
658+ onClicked:{
659+ PopupUtils.open(warning_dialog, warning_button);
660+ }
661+ }
662+ }
663+ \endqml
664+*/
665+
666+Dialog {
667+ id: dialog
668+ signal ok
669+ signal cancel
670+ signal cont
671+
672+ property alias title: dialog.title
673+ property alias text: dialog.text
674+ property alias showOK: okButton.visible
675+ property alias showContinue: continueButton.visible
676+ property alias showCancel: cancelButton.visible
677+ property alias showCheckbox: checkboxitem.visible
678+ property alias isChecked: checkbox.checked
679+
680+
681+ title: i18n.tr("Warning!")
682+ text: i18n.tr("Change me to a real warning.")
683+
684+
685+ Item {
686+ id: checkboxitem
687+ width: childrenRect.width
688+ height: childrenRect.height
689+
690+ CheckBox {
691+ id: checkbox
692+ }
693+
694+ Label {
695+ id: checkbox_label
696+ text: i18n.tr("Do not show this warning again.")
697+ fontSize: "small"
698+ color: "white"
699+ anchors.left: checkbox.right
700+ anchors.leftMargin: 8
701+ anchors.verticalCenter: checkbox.verticalCenter
702+ }
703+
704+ }
705+
706+ Button {
707+ id: okButton
708+ text: i18n.tr("OK")
709+ color: UbuntuColors.orange
710+ onClicked: {
711+ ok();
712+ PopupUtils.close(dialog);
713+ }
714+ }
715+ Button {
716+ id: continueButton
717+ text: i18n.tr("Continue")
718+ color: UbuntuColors.orange
719+ onClicked: {
720+ cont()
721+ PopupUtils.close(dialog)
722+ }
723+ }
724+ Button {
725+ id: cancelButton
726+ text: i18n.tr("Cancel")
727+ color: UbuntuColors.warmGrey
728+ onClicked: {
729+ cancel()
730+ PopupUtils.close(dialog)
731+ }
732+ }
733+}
734+
735+
736+
737+
738+
739+
740+
741+
742
743=== modified file 'plainbox-gui/gui-ihv/qml/outline/gui-ihv.qml'
744--- plainbox-gui/gui-ihv/qml/outline/gui-ihv.qml 2013-07-04 17:00:33 +0000
745+++ plainbox-gui/gui-ihv/qml/outline/gui-ihv.qml 2013-07-11 13:17:29 +0000
746@@ -18,31 +18,90 @@
747 * You should have received a copy of the GNU General Public License
748 * along with this program. If not, see <http://www.gnu.org/licenses/>.
749 */
750-
751+
752 import QtQuick 2.0
753 import GuiEngine 1.0
754-
755-Rectangle {
756- id: gui_ihv
757- color: "light green"
758- width: 640; height: 120
759-
760- Text{
761- id: gui_ihv_title
762- anchors.centerIn: parent
763- text: "Plainbox IHV - prototype interface. Click here to exit Plainbox service"
764- }
765-
766- GuiEngine {
767- id: guiengineobj
768- }
769-
770- MouseArea {
771- id: gui_ihv_mouse_area
772- anchors.fill: parent
773- onClicked: {
774- // Just call a simple Plainbox function to exit (proof of concept)
775- guiengineobj.Dummy_CallPlainbox_Exit();
776+import Ubuntu.Components 0.1
777+import Ubuntu.Components.Popups 0.1
778+import "."
779+
780+SuiteSelection {
781+ id: mainview
782+ height: units.gu(90)
783+
784+
785+ // Below is test code, shows how to put up a warning dialog
786+ // TODO == move this to WarningDialog.qml
787+ Component {
788+ id: warning_dialog
789+ WarningDialog{
790+ text: i18n.tr("What you are about to do will take a long time. Are you sure you want to continue?")
791+ showOK: true
792+ showContinue: false
793+ showCheckbox: true
794+
795+ onCont: {
796+ checkIfChecked();
797+ console.log("continue clicked");
798+ }
799+
800+ onCancel: {
801+ checkIfChecked();
802+ console.log("cancel clicked");
803+ }
804+
805+ function checkIfChecked(){
806+ if (isChecked)
807+ console.log("do not warn again!");
808+ else
809+ console.log("warn again");
810+ }
811+
812+ }
813+ }
814+
815+
816+
817+ Row {
818+ visible: false
819+ spacing: 2
820+ anchors.horizontalCenter: parent.horizontalCenter
821+ anchors.bottom: parent.bottom
822+ anchors.bottomMargin: units.gu(2)
823+ Button {
824+ id: warning_button
825+ color: "yellow"
826+ text: "warning..."
827+ width: 100
828+ onClicked:{
829+ PopupUtils.open(warning_dialog, warning_button);
830+ }
831+ }
832+
833+
834+ Button {
835+ color: "pink"
836+ text: "failed..."
837+ width: 100
838+ onClicked:{
839+ var warningDlg = Qt.createComponent("WarningDialog.qml");
840+ if (warningDlg.status == Component.Ready) {
841+ var warningObj = warningDlg.createObject(parent, {"title": "Failed!",
842+ "text": "Oh man!",
843+ "showOK": true,
844+ "showContinue": false,
845+ "showCancel": false,
846+ "showCheckbox" :true
847+ });
848+ warningObj.show();
849+
850+ // need call this when object is closed (not sure how yet)
851+ if (warningObj.isChecked)
852+ console.log("do not warn again!");
853+ else
854+ console.log("warn AGAIN!")
855+ }
856+ }
857 }
858 }
859 }
860
861=== added file 'plainbox-gui/gui-ihv/testsuiteitem.cpp'
862--- plainbox-gui/gui-ihv/testsuiteitem.cpp 1970-01-01 00:00:00 +0000
863+++ plainbox-gui/gui-ihv/testsuiteitem.cpp 2013-07-11 13:17:29 +0000
864@@ -0,0 +1,44 @@
865+/*
866+ * This file is part of plainbox-gui
867+ *
868+ * Copyright 2013 Canonical Ltd.
869+ *
870+ * Authors:
871+ * - Julia Segal <julia.segal@cellsoftware.co.uk>
872+ *
873+ * This program is free software; you can redistribute it and/or modify
874+ * it under the terms of the GNU General Public License as published by
875+ * the Free Software Foundation; version 3.
876+ *
877+ * This program is distributed in the hope that it will be useful,
878+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
879+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
880+ * GNU General Public License for more details.
881+ *
882+ * You should have received a copy of the GNU General Public License
883+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
884+ */
885+
886+#include "testsuiteitem.h"
887+
888+TestSuiteItem::TestSuiteItem(const QString &groupName, const QString &testName, QObject * parent ) :
889+ QObject( parent ),
890+ m_group(groupName),
891+ m_testName(testName)
892+{
893+}
894+
895+void TestSuiteItem::setGroup(const QString &groupName){
896+ if ( groupName != m_group ) {
897+ m_group = groupName;
898+ emit groupChanged();
899+ }
900+}
901+
902+void TestSuiteItem::setTestname(const QString &testName){
903+ if ( testName != m_testName ) {
904+ m_testName = testName;
905+ emit testnameChanged();
906+ } }
907+
908+
909
910=== added file 'plainbox-gui/gui-ihv/testsuiteitem.h'
911--- plainbox-gui/gui-ihv/testsuiteitem.h 1970-01-01 00:00:00 +0000
912+++ plainbox-gui/gui-ihv/testsuiteitem.h 2013-07-11 13:17:29 +0000
913@@ -0,0 +1,50 @@
914+/*
915+ * This file is part of plainbox-gui
916+ *
917+ * Copyright 2013 Canonical Ltd.
918+ *
919+ * Authors:
920+ * - Julia Segal <julia.segal@cellsoftware.co.uk>
921+ *
922+ * This program is free software; you can redistribute it and/or modify
923+ * it under the terms of the GNU General Public License as published by
924+ * the Free Software Foundation; version 3.
925+ *
926+ * This program is distributed in the hope that it will be useful,
927+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
928+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
929+ * GNU General Public License for more details.
930+ *
931+ * You should have received a copy of the GNU General Public License
932+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
933+ */
934+
935+#include <QObject>
936+
937+
938+class TestSuiteItem : public QObject
939+{
940+ Q_OBJECT
941+ Q_PROPERTY(QString group READ group WRITE setGroup NOTIFY groupChanged)
942+ Q_PROPERTY(QString testname READ testname WRITE setTestname NOTIFY testnameChanged)
943+
944+public:
945+ TestSuiteItem(QObject * parent = 0 ) : QObject(parent){}
946+ TestSuiteItem(const QString &groupName, const QString &testname, QObject * parent = 0 );
947+
948+ inline QString group() const { return m_group; }
949+ void setGroup(const QString &groupName);
950+
951+ inline QString testname() const { return m_testName; }
952+ void setTestname(const QString &testName);
953+
954+signals:
955+ void groupChanged();
956+ void testnameChanged();
957+
958+private:
959+ QString m_group;
960+ QString m_testName;
961+
962+};
963+

Subscribers

People subscribed via source and target branches