Merge lp:~josharenson/unity8/doc_args into lp:unity8
- doc_args
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Albert Astals Cid |
Approved revision: | 863 |
Merged at revision: | 887 |
Proposed branch: | lp:~josharenson/unity8/doc_args |
Merge into: | lp:unity8 |
Prerequisite: | lp:~aacid/unity8/killqt51 |
Diff against target: |
126 lines (+47/-14) 2 files modified
src/ApplicationArguments.h (+4/-8) src/main.cpp (+43/-6) |
To merge this branch: | bzr merge lp:~josharenson/unity8/doc_args |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michał Sawicz | Abstain | ||
Albert Astals Cid (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Review via email:
|
This proposal supersedes a proposal from 2014-04-25.
Commit message
Implements usage-style documentation for unity8 executable.
Fixes lp:1269282
Description of the change
* Are there any related MPs required for this MP to build/function as expected? Please list.
lp:~aacid/unity8/killqt51
* Did you perform an exploratory manual test run of your code change and any related functionality?
Compiled code, verified new feature works as expected, and ran ctest
* Did you make sure that your branch does not contain spurious tags?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
Dependent branch does. This MP does not
* If you changed the UI, has there been a design review?
na
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
And you're missing https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
And finally, we don't support Qt translation system (we are using gettext) so for now i think we can just pretend we don't need to translate the commandline options and just drop the QCoreApplicatio
Saviq, what's your opinion?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
Yeah, let's leave the help in English. It's not like they're general-use.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:858
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
In case you're confused by all the failings → whitespace issues
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
src/main.cpp: bad whitespace in lines 67, 84
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
you probably want to merge lp:~aacid/unity8/killqt51 into here (you'll have to resubmit the MR setting a prerequisite branch)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Josh Arenson (josharenson) wrote : Posted in a previous version of this proposal | # |
> you probably want to merge lp:~aacid/unity8/killqt51 into here (you'll have
> to resubmit the MR setting a prerequisite branch)
So if I clean up my white space, depend on _your_ MP, and resubmit _this_ MP in the proper format, we should be good to go?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:859
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
You didn't merge Albert's branch into this one, and you didn't put it in the "prerequisite" field when resubmitting.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
I've resubmitted this for you, you can merge Albert's branch, but that's not necessary, since the other one will be merged before anyway.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:859
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:860
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:860
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
This breaks the -windowgeometry param, i.e.
./builddir/
Doesn't work anymore
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Josh Arenson (josharenson) wrote : Posted in a previous version of this proposal | # |
> This breaks the -windowgeometry param, i.e.
>
> ./builddir/
>
> Doesn't work anymore
Pushed a small hack to WAR this. Let me know if you have an idea for something more elegant.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:861
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
> > This breaks the -windowgeometry param, i.e.
> >
> > ./builddir/
> >
> > Doesn't work anymore
> Pushed a small hack to WAR this. Let me know if you have an idea for something
> more elegant.
I think i'd prefer if you move the parsing of the argument to main.cpp and only pass to ApplicationArgu
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:862
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:862
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : | # |
I'm confused about the auto_ptr use
Wouldn't
std::auto_
if (parser.
parser.
QStringList geom = parser.
appArgs.reset(new ApplicationArgu
} else {
appArgs.reset(new ApplicationArgu
}
ApplicationArgu
make more sense as
ApplicationArgu
if (parser.
parser.
QStringList geom = parser.
qmlArgs.
}
or if you don't want to expose setSize (which is indeed fine since if you don't make it a q_invokable it won't be available from the qml side)
QSize size;
if (parser.
parser.
QStringList geom = parser.
size = QSize(new ApplicationArgu
}
ApplicationArgu
?
Any of those two versions seem easier to read to me
// Note code not warranteed to compile :D
- 863. By Josh Arenson
-
Refactored ApplicationArgu
ments constructor(s)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:863
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michał Sawicz (saviq) wrote : | # |
Please strip tags: http://
Do the same on your local checkout(s), too!
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Albert Astals Cid (aacid) wrote : | # |
Code looks good to me now, please ping us once the tags are cleared so we can top approve
* Did you perform an exploratory manual test run of the code change and any related functionality?
Yes, works
* Did CI run pass?
No, qmluitests failed to even start for some reason, but qmluitests don't cover these changes anyway
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Josh Arenson (josharenson) wrote : | # |
> Please strip tags:
> http://
>
> Do the same on your local checkout(s), too!
Done
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Michał Sawicz (saviq) : | # |
Preview Diff
1 | === modified file 'src/ApplicationArguments.h' | |||
2 | --- src/ApplicationArguments.h 2014-03-19 15:29:35 +0000 | |||
3 | +++ src/ApplicationArguments.h 2014-05-05 22:46:16 +0000 | |||
4 | @@ -28,14 +28,10 @@ | |||
5 | 28 | { | 28 | { |
6 | 29 | Q_OBJECT | 29 | Q_OBJECT |
7 | 30 | public: | 30 | public: |
16 | 31 | ApplicationArguments(const QStringList& args) { | 31 | // Not exposed to the app as setSize isn't invokable |
17 | 32 | if (args.contains(QLatin1String("-windowgeometry")) && args.size() > args.indexOf(QLatin1String("-windowgeometry")) + 1) { | 32 | void setSize(int width, int height) { |
18 | 33 | QStringList geometryArg = args.at(args.indexOf(QLatin1String("-windowgeometry")) + 1).split('x'); | 33 | m_size.rwidth() = width; |
19 | 34 | if (geometryArg.size() == 2) { | 34 | m_size.rheight() = height; |
12 | 35 | m_size.rwidth() = geometryArg.at(0).toInt(); | ||
13 | 36 | m_size.rheight() = geometryArg.at(1).toInt(); | ||
14 | 37 | } | ||
15 | 38 | } | ||
20 | 39 | } | 35 | } |
21 | 40 | 36 | ||
22 | 41 | Q_INVOKABLE bool hasGeometry() const { return m_size.isValid(); } | 37 | Q_INVOKABLE bool hasGeometry() const { return m_size.isValid(); } |
23 | 42 | 38 | ||
24 | === modified file 'src/main.cpp' | |||
25 | --- src/main.cpp 2014-04-02 11:19:54 +0000 | |||
26 | +++ src/main.cpp 2014-05-05 22:46:16 +0000 | |||
27 | @@ -18,6 +18,7 @@ | |||
28 | 18 | */ | 18 | */ |
29 | 19 | 19 | ||
30 | 20 | // Qt | 20 | // Qt |
31 | 21 | #include <QCommandLineParser> | ||
32 | 21 | #include <QtQuick/QQuickView> | 22 | #include <QtQuick/QQuickView> |
33 | 22 | #include <QtGui/QGuiApplication> | 23 | #include <QtGui/QGuiApplication> |
34 | 23 | #include <QtQml/QQmlEngine> | 24 | #include <QtQml/QQmlEngine> |
35 | @@ -43,6 +44,32 @@ | |||
36 | 43 | 44 | ||
37 | 44 | QGuiApplication::setApplicationName("Unity 8"); | 45 | QGuiApplication::setApplicationName("Unity 8"); |
38 | 45 | QGuiApplication *application; | 46 | QGuiApplication *application; |
39 | 47 | |||
40 | 48 | QCommandLineParser parser; | ||
41 | 49 | parser.setApplicationDescription("Description: Unity 8 Shell"); | ||
42 | 50 | parser.addHelpOption(); | ||
43 | 51 | |||
44 | 52 | QCommandLineOption fullscreenOption("fullscreen", | ||
45 | 53 | "Run in fullscreen"); | ||
46 | 54 | parser.addOption(fullscreenOption); | ||
47 | 55 | |||
48 | 56 | QCommandLineOption framelessOption("frameless", | ||
49 | 57 | "Run without window borders"); | ||
50 | 58 | parser.addOption(framelessOption); | ||
51 | 59 | |||
52 | 60 | QCommandLineOption mousetouchOption("mousetouch", | ||
53 | 61 | "Allow the mouse to provide touch input"); | ||
54 | 62 | parser.addOption(mousetouchOption); | ||
55 | 63 | |||
56 | 64 | QCommandLineOption windowGeometryOption(QStringList() << "windowgeometry", | ||
57 | 65 | "Specify the window geometry as [<width>x<height>]", "windowgeometry", "1"); | ||
58 | 66 | parser.addOption(windowGeometryOption); | ||
59 | 67 | |||
60 | 68 | QCommandLineOption testabilityOption("testability", | ||
61 | 69 | "DISCOURAGED: Please set QT_LOAD_TESTABILITY instead. \n \ | ||
62 | 70 | Load the testability driver"); | ||
63 | 71 | parser.addOption(testabilityOption); | ||
64 | 72 | |||
65 | 46 | if (isUbuntuMirServer) { | 73 | if (isUbuntuMirServer) { |
66 | 47 | QLibrary unityMir("unity-mir", 1); | 74 | QLibrary unityMir("unity-mir", 1); |
67 | 48 | unityMir.load(); | 75 | unityMir.load(); |
68 | @@ -59,6 +86,11 @@ | |||
69 | 59 | application = new QGuiApplication(argc, (char**)argv); | 86 | application = new QGuiApplication(argc, (char**)argv); |
70 | 60 | } | 87 | } |
71 | 61 | 88 | ||
72 | 89 | // Treat args with single dashes the same as arguments with two dashes | ||
73 | 90 | // Ex: -fullscreen == --fullscreen | ||
74 | 91 | parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); | ||
75 | 92 | parser.process(*application); | ||
76 | 93 | |||
77 | 62 | QString indicatorProfile = qgetenv("UNITY_INDICATOR_PROFILE"); | 94 | QString indicatorProfile = qgetenv("UNITY_INDICATOR_PROFILE"); |
78 | 63 | if (indicatorProfile.isEmpty()) { | 95 | if (indicatorProfile.isEmpty()) { |
79 | 64 | indicatorProfile = "phone"; | 96 | indicatorProfile = "phone"; |
80 | @@ -66,12 +98,17 @@ | |||
81 | 66 | 98 | ||
82 | 67 | resolveIconTheme(); | 99 | resolveIconTheme(); |
83 | 68 | 100 | ||
86 | 69 | QStringList args = application->arguments(); | 101 | ApplicationArguments qmlArgs; |
87 | 70 | ApplicationArguments qmlArgs(args); | 102 | if (parser.isSet(windowGeometryOption) && |
88 | 103 | parser.value(windowGeometryOption).split('x').size() == 2) | ||
89 | 104 | { | ||
90 | 105 | QStringList geom = parser.value(windowGeometryOption).split('x'); | ||
91 | 106 | qmlArgs.setSize(geom.at(0).toInt(), geom.at(1).toInt()); | ||
92 | 107 | } | ||
93 | 71 | 108 | ||
94 | 72 | // The testability driver is only loaded by QApplication but not by QGuiApplication. | 109 | // The testability driver is only loaded by QApplication but not by QGuiApplication. |
95 | 73 | // However, QApplication depends on QWidget which would add some unneeded overhead => Let's load the testability driver on our own. | 110 | // However, QApplication depends on QWidget which would add some unneeded overhead => Let's load the testability driver on our own. |
97 | 74 | if (args.contains(QLatin1String("-testability")) || getenv("QT_LOAD_TESTABILITY")) { | 111 | if (parser.isSet(testabilityOption) || getenv("QT_LOAD_TESTABILITY")) { |
98 | 75 | QLibrary testLib(QLatin1String("qttestability")); | 112 | QLibrary testLib(QLatin1String("qttestability")); |
99 | 76 | if (testLib.load()) { | 113 | if (testLib.load()) { |
100 | 77 | typedef void (*TasInitialize)(void); | 114 | typedef void (*TasInitialize)(void); |
101 | @@ -94,14 +131,14 @@ | |||
102 | 94 | view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory())); | 131 | view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory())); |
103 | 95 | view->rootContext()->setContextProperty("applicationArguments", &qmlArgs); | 132 | view->rootContext()->setContextProperty("applicationArguments", &qmlArgs); |
104 | 96 | view->rootContext()->setContextProperty("indicatorProfile", indicatorProfile); | 133 | view->rootContext()->setContextProperty("indicatorProfile", indicatorProfile); |
106 | 97 | if (args.contains(QLatin1String("-frameless"))) { | 134 | if (parser.isSet(framelessOption)) { |
107 | 98 | view->setFlags(Qt::FramelessWindowHint); | 135 | view->setFlags(Qt::FramelessWindowHint); |
108 | 99 | } | 136 | } |
109 | 100 | 137 | ||
110 | 101 | // You will need this if you want to interact with touch-only components using a mouse | 138 | // You will need this if you want to interact with touch-only components using a mouse |
111 | 102 | // Needed only when manually testing on a desktop. | 139 | // Needed only when manually testing on a desktop. |
112 | 103 | MouseTouchAdaptor *mouseTouchAdaptor = 0; | 140 | MouseTouchAdaptor *mouseTouchAdaptor = 0; |
114 | 104 | if (args.contains(QLatin1String("-mousetouch"))) { | 141 | if (parser.isSet(mousetouchOption)) { |
115 | 105 | mouseTouchAdaptor = new MouseTouchAdaptor; | 142 | mouseTouchAdaptor = new MouseTouchAdaptor; |
116 | 106 | application->installNativeEventFilter(mouseTouchAdaptor); | 143 | application->installNativeEventFilter(mouseTouchAdaptor); |
117 | 107 | } | 144 | } |
118 | @@ -125,7 +162,7 @@ | |||
119 | 125 | view->setSource(source); | 162 | view->setSource(source); |
120 | 126 | view->setColor("transparent"); | 163 | view->setColor("transparent"); |
121 | 127 | 164 | ||
123 | 128 | if (qgetenv("QT_QPA_PLATFORM") == "ubuntu" || isUbuntuMirServer || args.contains(QLatin1String("-fullscreen"))) { | 165 | if (qgetenv("QT_QPA_PLATFORM") == "ubuntu" || isUbuntuMirServer || parser.isSet(fullscreenOption)) { |
124 | 129 | view->showFullScreen(); | 166 | view->showFullScreen(); |
125 | 130 | } else { | 167 | } else { |
126 | 131 | view->show(); | 168 | view->show(); |
Should increase the qt5 version number dependency in debian/control to 5.2 since QCommandLineParser is new for 5.2
Also probably in the find_package of CMakeListst.txt