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: mp+217840@code.launchpad.net |
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
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
And you're missing https:/
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?
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.
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://
Albert Astals Cid (aacid) wrote : Posted in a previous version of this proposal | # |
In case you're confused by all the failings → whitespace issues
Michał Sawicz (saviq) wrote : Posted in a previous version of this proposal | # |
src/main.cpp: bad whitespace in lines 67, 84
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)
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?
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://
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.
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.
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://
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://
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://
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
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.
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://
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
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://
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://
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)
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://
Michał Sawicz (saviq) wrote : | # |
Please strip tags: http://
Do the same on your local checkout(s), too!
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
Josh Arenson (josharenson) wrote : | # |
> Please strip tags:
> http://
>
> Do the same on your local checkout(s), too!
Done
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 | { |
6 | Q_OBJECT |
7 | public: |
8 | - ApplicationArguments(const QStringList& args) { |
9 | - if (args.contains(QLatin1String("-windowgeometry")) && args.size() > args.indexOf(QLatin1String("-windowgeometry")) + 1) { |
10 | - QStringList geometryArg = args.at(args.indexOf(QLatin1String("-windowgeometry")) + 1).split('x'); |
11 | - if (geometryArg.size() == 2) { |
12 | - m_size.rwidth() = geometryArg.at(0).toInt(); |
13 | - m_size.rheight() = geometryArg.at(1).toInt(); |
14 | - } |
15 | - } |
16 | + // Not exposed to the app as setSize isn't invokable |
17 | + void setSize(int width, int height) { |
18 | + m_size.rwidth() = width; |
19 | + m_size.rheight() = height; |
20 | } |
21 | |
22 | Q_INVOKABLE bool hasGeometry() const { return m_size.isValid(); } |
23 | |
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 | */ |
29 | |
30 | // Qt |
31 | +#include <QCommandLineParser> |
32 | #include <QtQuick/QQuickView> |
33 | #include <QtGui/QGuiApplication> |
34 | #include <QtQml/QQmlEngine> |
35 | @@ -43,6 +44,32 @@ |
36 | |
37 | QGuiApplication::setApplicationName("Unity 8"); |
38 | QGuiApplication *application; |
39 | + |
40 | + QCommandLineParser parser; |
41 | + parser.setApplicationDescription("Description: Unity 8 Shell"); |
42 | + parser.addHelpOption(); |
43 | + |
44 | + QCommandLineOption fullscreenOption("fullscreen", |
45 | + "Run in fullscreen"); |
46 | + parser.addOption(fullscreenOption); |
47 | + |
48 | + QCommandLineOption framelessOption("frameless", |
49 | + "Run without window borders"); |
50 | + parser.addOption(framelessOption); |
51 | + |
52 | + QCommandLineOption mousetouchOption("mousetouch", |
53 | + "Allow the mouse to provide touch input"); |
54 | + parser.addOption(mousetouchOption); |
55 | + |
56 | + QCommandLineOption windowGeometryOption(QStringList() << "windowgeometry", |
57 | + "Specify the window geometry as [<width>x<height>]", "windowgeometry", "1"); |
58 | + parser.addOption(windowGeometryOption); |
59 | + |
60 | + QCommandLineOption testabilityOption("testability", |
61 | + "DISCOURAGED: Please set QT_LOAD_TESTABILITY instead. \n \ |
62 | +Load the testability driver"); |
63 | + parser.addOption(testabilityOption); |
64 | + |
65 | if (isUbuntuMirServer) { |
66 | QLibrary unityMir("unity-mir", 1); |
67 | unityMir.load(); |
68 | @@ -59,6 +86,11 @@ |
69 | application = new QGuiApplication(argc, (char**)argv); |
70 | } |
71 | |
72 | + // Treat args with single dashes the same as arguments with two dashes |
73 | + // Ex: -fullscreen == --fullscreen |
74 | + parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions); |
75 | + parser.process(*application); |
76 | + |
77 | QString indicatorProfile = qgetenv("UNITY_INDICATOR_PROFILE"); |
78 | if (indicatorProfile.isEmpty()) { |
79 | indicatorProfile = "phone"; |
80 | @@ -66,12 +98,17 @@ |
81 | |
82 | resolveIconTheme(); |
83 | |
84 | - QStringList args = application->arguments(); |
85 | - ApplicationArguments qmlArgs(args); |
86 | + ApplicationArguments qmlArgs; |
87 | + if (parser.isSet(windowGeometryOption) && |
88 | + parser.value(windowGeometryOption).split('x').size() == 2) |
89 | + { |
90 | + QStringList geom = parser.value(windowGeometryOption).split('x'); |
91 | + qmlArgs.setSize(geom.at(0).toInt(), geom.at(1).toInt()); |
92 | + } |
93 | |
94 | // The testability driver is only loaded by QApplication but not by QGuiApplication. |
95 | // However, QApplication depends on QWidget which would add some unneeded overhead => Let's load the testability driver on our own. |
96 | - if (args.contains(QLatin1String("-testability")) || getenv("QT_LOAD_TESTABILITY")) { |
97 | + if (parser.isSet(testabilityOption) || getenv("QT_LOAD_TESTABILITY")) { |
98 | QLibrary testLib(QLatin1String("qttestability")); |
99 | if (testLib.load()) { |
100 | typedef void (*TasInitialize)(void); |
101 | @@ -94,14 +131,14 @@ |
102 | view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory())); |
103 | view->rootContext()->setContextProperty("applicationArguments", &qmlArgs); |
104 | view->rootContext()->setContextProperty("indicatorProfile", indicatorProfile); |
105 | - if (args.contains(QLatin1String("-frameless"))) { |
106 | + if (parser.isSet(framelessOption)) { |
107 | view->setFlags(Qt::FramelessWindowHint); |
108 | } |
109 | |
110 | // You will need this if you want to interact with touch-only components using a mouse |
111 | // Needed only when manually testing on a desktop. |
112 | MouseTouchAdaptor *mouseTouchAdaptor = 0; |
113 | - if (args.contains(QLatin1String("-mousetouch"))) { |
114 | + if (parser.isSet(mousetouchOption)) { |
115 | mouseTouchAdaptor = new MouseTouchAdaptor; |
116 | application->installNativeEventFilter(mouseTouchAdaptor); |
117 | } |
118 | @@ -125,7 +162,7 @@ |
119 | view->setSource(source); |
120 | view->setColor("transparent"); |
121 | |
122 | - if (qgetenv("QT_QPA_PLATFORM") == "ubuntu" || isUbuntuMirServer || args.contains(QLatin1String("-fullscreen"))) { |
123 | + if (qgetenv("QT_QPA_PLATFORM") == "ubuntu" || isUbuntuMirServer || parser.isSet(fullscreenOption)) { |
124 | view->showFullScreen(); |
125 | } else { |
126 | 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