Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/outTheWindow into lp:ubuntu-ui-toolkit/staging

Proposed by Cris Dywan
Status: Merged
Approved by: Zsombor Egri
Approved revision: 2063
Merged at revision: 2155
Proposed branch: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/outTheWindow
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 790 lines (+606/-11)
15 files modified
src/UbuntuToolkit/UbuntuToolkit.pro (+3/-0)
src/UbuntuToolkit/ubuntutoolkitmodule.cpp (+2/-0)
src/UbuntuToolkit/ucmainviewbase.cpp (+1/-0)
src/UbuntuToolkit/ucmainwindow.cpp (+215/-0)
src/UbuntuToolkit/ucmainwindow_p.h (+73/-0)
src/UbuntuToolkit/ucmainwindow_p_p.h (+47/-0)
src/UbuntuToolkit/ucunits.cpp (+32/-6)
src/UbuntuToolkit/ucunits_p.h (+5/-0)
tests/autopilot/ubuntuuitoolkit/tests/test_launcher.mainwindow.qml (+12/-5)
tests/autopilot/ubuntuuitoolkit/tests/test_launcher.py (+12/-0)
tests/autopilot/ubuntuuitoolkit/tests/test_launcher.window.qml (+43/-0)
tests/unit/mainwindow/AppName.qml (+28/-0)
tests/unit/mainwindow/mainwindow.pro (+5/-0)
tests/unit/mainwindow/tst_mainwindow.cpp (+127/-0)
tests/unit/unit.pro (+1/-0)
To merge this branch: bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/outTheWindow
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Zsombor Egri Approve
Loïc Molinari (community) Approve
Review via email: mp+301278@code.launchpad.net

Commit message

Add MainWindow to Ubuntu.Components.Labs

To post a comment you must log in.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2042. By Cris Dywan

Merge lp:ubuntu-ui-toolkit/staging

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

install -m 644 -p /tmp/buildd/ubuntu-ui-toolkit-1.3.2030+16.10.20160726.2/src/Ubuntu/Components/Themes/Ambiance/1.3/HighlightMagnifier.qml /tmp/buildd/ubuntu-ui-toolkit-1.3.2030+16.10.20160726.2/debian/tmp/usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/Themes/Ambiance/1.3/
Aborted (core dumped)

2043. By Cris Dywan

Merge lp:ubuntu-ui-toolkit/staging

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Aborted (core dumped)
Makefile:357: recipe for target '/tmp/buildd/ubuntu-ui-toolkit-1.3.2030+16.10.20160726.2/qml/Ubuntu/Components/Labs/plugins.qmltypes' failed

2044. By Cris Dywan

Pass parent to UbuntuI18n/UCUnits::instance in constructor

2045. By Cris Dywan

Add Labs dependency so it's available to AP

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

Don't we need more tests?

review: Needs Fixing
Revision history for this message
Zsombor Egri (zsombi) wrote :

Also, forgot to ask for this inline.

review: Needs Information
Revision history for this message
Cris Dywan (kalikiana) wrote :

> > + qml-module-ubuntu-components-labs,
> Why is this required here?
Because I'm using MainWindow in the AutoPilot test case.

> You need also an ActionManager instance,
> into which the context must be registered.

As discussed elsewhere, it's not needed.

Note to self: adding test cases so they don't need to be done once the component is promoted to supported API.

2046. By Cris Dywan

Units instance per MainWindow and unit tests

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

> Why do you derive from PageTreeNode?
An oversight indeed. Thanks for noticing.

> For now this is OK. But in general, as next step, the window should have its own units instance
Between said discussion and now the goal seems to have changed from starting with a proof of concept to having a full implementation including tests - fine by me, I was starting to think about it as well, but just to point out that this is changing the plan :-D

Revision history for this message
Zsombor Egri (zsombi) wrote :

> > Why do you derive from PageTreeNode?
> An oversight indeed. Thanks for noticing.
>
> > For now this is OK. But in general, as next step, the window should have its
> own units instance
> Between said discussion and now the goal seems to have changed from starting
> with a proof of concept to having a full implementation including tests - fine
> by me, I was starting to think about it as well, but just to point out that
> this is changing the plan :-D

We can have proof of concepts, of course. This component however seemed to me like a complete one, but yes, we can leave the tests for now, and add them once we move them into the main module.

Revision history for this message
Zsombor Egri (zsombi) wrote :

Why do you move this to the main module? Why haven't you let it stay in Labs?

We discussed some time ago that we need a Window component which exports the units (and a hidden PopupContext), and derive the MainWindow from it, which adds MainView specific things (theme, applicationName, etc). I see you moved the component to main, and these haven't been addressed.

It can go into Labs without this but in the mains would mean API break if we do the super class change. Let's chat about it.

review: Needs Information
Revision history for this message
Zsombor Egri (zsombi) wrote :

Oh, just seen that you've exported as labs 1.3 Perhaps we go for 1.0 with this one, the module has just been introduced, and all the other components are exported in 1,0 version. Let's keep it that way.

review: Needs Fixing
Revision history for this message
Cris Dywan (kalikiana) wrote :

> Oh, just seen that you've exported as labs 1.3 Perhaps we go for 1.0

Does it make any difference if it's 5.5 or 0.3? We're not going to support it anyway so I went for 1.3 so one doesn't have to think about the import at all. Any version should work for the sake of convenience.

Revision history for this message
Cris Dywan (kalikiana) wrote :

Filed bug 1615591 with regard to eventually moving MainWindow out of Labs and adding more tests.

2047. By Cris Dywan

Merge lp:ubuntu-ui-toolkit/staging

2048. By Cris Dywan

Move MainWindow to Ubuntu.Components.Labs 1.0

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2049. By Cris Dywan

Remove redundant MainWindow test bits and handle errors better

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2050. By Cris Dywan

Merge lp:ubuntu-ui-toolkit/staging

2051. By Cris Dywan

mainwindow seems to require x11

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2052. By Cris Dywan

Use custom_qpa for mainwindow unit test

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2053. By Cris Dywan

Merge lp:ubuntu-ui-toolkit/staging

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2054. By Cris Dywan

Include test-include.pri so custom_qpa actually works

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Loïc Molinari (loic.molinari) wrote :

Hi Christian.

I'm not going to comment on the change in itself but on the header inclusion part that I recently tried to fix and standardise. Everything is explained in the CODING file at the root of the project, it's mostly Qt rules plus a few things. I hope not to be too picky but I think we should try to respect these rules as best as possible to keep it clean and usable outside of the UITK.

I added the comments inline.

review: Needs Fixing
2055. By Cris Dywan

Touch up include files to conform to guidelines

2056. By Cris Dywan

Add CONFIG before include

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Loïc Molinari (loic.molinari) wrote :

Thanks dude!

review: Approve
2057. By Cris Dywan

Retain both MainWindow{ and Window { MainView { AP tests

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Program received signal SIGSEGV, Segmentation fault.
0xf68de251 in operator==(QString const&, QString const&) () from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
#0 0xf68de251 in operator==(QString const&, QString const&) () from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
#1 0xf7e3b88a in UCMainWindow::setApplicationName(QString) () from /tmp/buildd/ubuntu-ui-toolkit-gles-1.3.2085+16.10.20160915/lib/libUbuntuToolkit.so.5
#2 0xf7e3bbb6 in UCMainWindow::qt_metacall(QMetaObject::Call, int, void**) () from /tmp/buildd/ubuntu-ui-toolkit-gles-1.3.2085+16.10.20160915/lib/libUbuntuToolkit.so.5
#3 0xf6a93f82 in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
#10 0xf6f41c0a in QQmlComponentPrivate::beginCreate(QQmlContextData*) () from /usr/lib/i386-linux-gnu/libQt5Qml.so.5
#11 0xf6f42051 in QQmlComponent::create(QQmlContext*) () from /usr/lib/i386-linux-gnu/libQt5Qml.so.5
#12 0x08049ade in loadTest (document=..., this=<optimized out>) at tst_mainwindow.cpp:73
#13 testCase_AppName (this=<optimized out>) at tst_mainwindow.cpp:117
#14 tst_MainWindow::qt_static_metacall (_o=0xffffc484, _c=135136696, _id=2, _a=0xffffbc70) at .moc/tst_mainwindow.moc:76
#15 0xf6a960ac in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const () from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
#16 0xf6a9b007 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) () from /usr/lib/i386-linux-gnu/sse2/libQt5Core.so.5
#18 0xf71b2395 in QTest::qExec(QObject*, int, char**) () from /usr/lib/i386-linux-gnu/libQt5Test.so.5
#19 0x0804975c in main (argc=7, argv=0xffffc554) at tst_mainwindow.cpp:125

Revision history for this message
Gerry Boland (gerboland) wrote :

+ QObject::connect(UbuntuI18n::instance(this), SIGNAL(domainChanged()),
+ this, SIGNAL(i18nChanged()));
+ QObject::connect(UbuntuI18n::instance(this), SIGNAL(languageChanged()),
+ this, SIGNAL(i18nChanged()));
I see the newer style connects used further down, why the old style here?

Revision history for this message
Zsombor Egri (zsombi) wrote :

> + QObject::connect(UbuntuI18n::instance(this), SIGNAL(domainChanged()),
> + this, SIGNAL(i18nChanged()));
> + QObject::connect(UbuntuI18n::instance(this), SIGNAL(languageChanged()),
> + this, SIGNAL(i18nChanged()));
> I see the newer style connects used further down, why the old style here?

One reason I can see that the new style connect doesn't resolve the situation when the client overrides the i18nChanged signal in JS. For that the meta-method based connect is needed.

2058. By Cris Dywan

Merge lp:ubuntu-ui-toolkit/staging

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2059. By Cris Dywan

Add d_func()->init() to UCMainWindow constructor

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
2060. By Cris Dywan

Cf. applicationName to "" rather than empty like MainView

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2061. By Cris Dywan

Add debug statements to UCMainWindow for CI

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
2062. By Cris Dywan

Base MainWindowPrivate on QQuickWindowPrivate

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
2063. By Cris Dywan

Drop debug statements

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

All fine for now, let's get this in.

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/UbuntuToolkit/UbuntuToolkit.pro'
--- src/UbuntuToolkit/UbuntuToolkit.pro 2016-11-04 09:37:32 +0000
+++ src/UbuntuToolkit/UbuntuToolkit.pro 2017-01-12 02:42:37 +0000
@@ -106,6 +106,8 @@
106 $$PWD/uclistitemstyle_p.h \106 $$PWD/uclistitemstyle_p.h \
107 $$PWD/ucmainviewbase_p.h \107 $$PWD/ucmainviewbase_p.h \
108 $$PWD/ucmainviewbase_p_p.h \108 $$PWD/ucmainviewbase_p_p.h \
109 $$PWD/ucmainwindow_p.h \
110 $$PWD/ucmainwindow_p_p.h \
109 $$PWD/ucmargins_p.h \111 $$PWD/ucmargins_p.h \
110 $$PWD/ucmathutils_p.h \112 $$PWD/ucmathutils_p.h \
111 $$PWD/ucmouse_p.h \113 $$PWD/ucmouse_p.h \
@@ -203,6 +205,7 @@
203 $$PWD/uclistitemlayout.cpp \205 $$PWD/uclistitemlayout.cpp \
204 $$PWD/uclistitemstyle.cpp \206 $$PWD/uclistitemstyle.cpp \
205 $$PWD/ucmainviewbase.cpp \207 $$PWD/ucmainviewbase.cpp \
208 $$PWD/ucmainwindow.cpp \
206 $$PWD/ucmathutils.cpp \209 $$PWD/ucmathutils.cpp \
207 $$PWD/ucmousefilters.cpp \210 $$PWD/ucmousefilters.cpp \
208 $$PWD/ucpagetreenode.cpp \211 $$PWD/ucpagetreenode.cpp \
209212
=== modified file 'src/UbuntuToolkit/ubuntutoolkitmodule.cpp'
--- src/UbuntuToolkit/ubuntutoolkitmodule.cpp 2016-09-29 10:19:06 +0000
+++ src/UbuntuToolkit/ubuntutoolkitmodule.cpp 2017-01-12 02:42:37 +0000
@@ -39,6 +39,7 @@
39#include "inversemouseareatype_p.h"39#include "inversemouseareatype_p.h"
40#include "listener_p.h"40#include "listener_p.h"
41#include "livetimer_p.h"41#include "livetimer_p.h"
42#include "ucmainwindow_p.h"
42#include "menu_p.h"43#include "menu_p.h"
43#include "menubar_p.h"44#include "menubar_p.h"
44#include "menugroup_p.h"45#include "menugroup_p.h"
@@ -439,6 +440,7 @@
439 qmlRegisterType<SplitView>(uri, 1, 0, "SplitView");440 qmlRegisterType<SplitView>(uri, 1, 0, "SplitView");
440 qmlRegisterType<SplitViewLayout>(uri, 1, 0, "SplitViewLayout");441 qmlRegisterType<SplitViewLayout>(uri, 1, 0, "SplitViewLayout");
441 qmlRegisterType<ViewColumn>(uri, 1, 0, "ViewColumn");442 qmlRegisterType<ViewColumn>(uri, 1, 0, "ViewColumn");
443 qmlRegisterType<UCMainWindow>(uri, 1, 0, "MainWindow");
442 qmlRegisterType<Menu>(uri, 1, 0, "Menu");444 qmlRegisterType<Menu>(uri, 1, 0, "Menu");
443 qmlRegisterType<MenuBar>(uri, 1, 0, "MenuBar");445 qmlRegisterType<MenuBar>(uri, 1, 0, "MenuBar");
444 qmlRegisterType<MenuGroup>(uri, 1, 0, "MenuGroup");446 qmlRegisterType<MenuGroup>(uri, 1, 0, "MenuGroup");
445447
=== modified file 'src/UbuntuToolkit/ucmainviewbase.cpp'
--- src/UbuntuToolkit/ucmainviewbase.cpp 2016-09-12 09:03:50 +0000
+++ src/UbuntuToolkit/ucmainviewbase.cpp 2017-01-12 02:42:37 +0000
@@ -145,6 +145,7 @@
145void UCMainViewBase::setApplicationName(QString applicationName)145void UCMainViewBase::setApplicationName(QString applicationName)
146{146{
147 Q_D(UCMainViewBase);147 Q_D(UCMainViewBase);
148
148 if (d->m_applicationName == applicationName)149 if (d->m_applicationName == applicationName)
149 return;150 return;
150151
151152
=== added file 'src/UbuntuToolkit/ucmainwindow.cpp'
--- src/UbuntuToolkit/ucmainwindow.cpp 1970-01-01 00:00:00 +0000
+++ src/UbuntuToolkit/ucmainwindow.cpp 2017-01-12 02:42:37 +0000
@@ -0,0 +1,215 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "ucmainwindow_p_p.h"
18
19#include <QtCore/QCoreApplication>
20
21#include "ucactionmanager_p.h"
22#include "ucactioncontext_p.h"
23#include "ucapplication_p.h"
24#include "uctheme_p.h"
25#include "i18n_p.h"
26#include "quickutils_p.h"
27
28UT_NAMESPACE_BEGIN
29
30/*!
31 \internal
32 \qmlabstract MainWindow
33 \inqmlmodule Ubuntu.Components.Labs
34 \ingroup ubuntu
35 \brief MainWindow is an alternate window-based root Item providing \l units
36 and \l i18n as native properties, an \ actionContext and an \l applicationName.
37 Unlike \l MainView there is no built-in header.
38
39 The simplest way to use a MainWindow is to include a single \l Page object:
40 \qml
41 import QtQuick 2.4
42 import Ubuntu.Components 1.3
43 import Ubuntu.Components.Labs 1.3
44
45 MainWindow {
46 minimumWidth: units.gu(48)
47 minimumHeight: units.gu(60)
48
49 Page {
50 anchors.fill: parent
51 header: PageHeader {
52 title: "Simple page"
53 }
54 Button {
55 anchors {
56 horizontalCenter: parent.horizontalCenter
57 top: pageHeader.bottom
58 topMargin: units.gu(5)
59 }
60 width: units.gu(15)
61 text: "Push me"
62 onClicked: print("Click!")
63 }
64 }
65 }
66 \endqml
67 Anchors need to be set, there's no automatic fill like with \l MainView.
68
69 Do not include multiple Pages directly, but use \l AdaptivePageLayout
70 inside MainWindow to navigate between several Pages.
71
72 If the \l Page inside the MainWindow includes a Flickable, set the flickable property of
73 the PageHeader to automatically hide and show the header when the user scrolls up or down:
74 \qml
75 import QtQuick 2.4
76 import Ubuntu.Components 1.3
77 import Ubuntu.Components.Labs 1.3
78
79 MainWindow {
80 minimumWidth: units.gu(48)
81 maximumHeight: units.gu(60)
82
83 Page {
84 anchors.fill: parent
85 header: PageHeader {
86 title: "Page with Flickable"
87 flickable: myFlickable
88 }
89
90 Flickable {
91 id: myFlickable
92 anchors.fill: parent
93 contentHeight: column.height
94
95 Column {
96 id: column
97 Repeater {
98 model: 100
99 Label {
100 text: "line "+index
101 }
102 }
103 }
104 }
105 }
106 }
107 \endqml
108 The same header behavior is automatic when using a ListView instead of a Flickable in the above
109 example.
110
111 The examples above show how to include a single \l Page inside a MainWindow, but more
112 advanced application structures are possible using \l AdaptivePageLayout.
113**/
114UCMainWindowPrivate::UCMainWindowPrivate()
115 : m_actionContext(nullptr),
116 m_units(nullptr)
117{
118}
119
120void UCMainWindowPrivate::init()
121{
122 Q_Q(UCMainWindow);
123
124 //need to init here because the q pointer is null in constructor
125 m_actionContext = new UCPopupContext(q);
126
127 m_actionContext->setObjectName(QStringLiteral("RootContext"));
128 m_actionContext->setActive(true);
129}
130
131UCMainWindow::UCMainWindow(QWindow *parent)
132 : QQuickWindow(*(new UCMainWindowPrivate), parent)
133{
134 d_func()->init();
135
136 QObject::connect(UbuntuI18n::instance(this), SIGNAL(domainChanged()),
137 this, SIGNAL(i18nChanged()));
138 QObject::connect(UbuntuI18n::instance(this), SIGNAL(languageChanged()),
139 this, SIGNAL(i18nChanged()));
140}
141
142/*!
143 \qmlproperty string MainWindow::applicationName
144
145 The property holds the application's name, which must be the same as the
146 desktop file's name.
147 The name also sets the name of the QCoreApplication and defaults for data
148 and cache folders that work on the desktop and under confinement, as well as
149 the default gettext domain.
150 C++ code that writes files may use QStandardPaths::writableLocation with
151 QStandardPaths::DataLocation or QStandardPaths::CacheLocation.
152*/
153QString UCMainWindow::applicationName() const
154{
155 return d_func()->m_applicationName;
156}
157
158void UCMainWindow::setApplicationName(QString applicationName)
159{
160 Q_D(UCMainWindow);
161
162 if (d->m_applicationName == applicationName)
163 return;
164
165 d->m_applicationName = applicationName;
166
167 if (applicationName != QStringLiteral("")) {
168 UbuntuI18n::instance()->setDomain(applicationName);
169 UCApplication::instance()->setApplicationName(applicationName);
170 }
171 Q_EMIT applicationNameChanged(applicationName);
172}
173
174/*!
175 \qmlproperty Units MainWindow::units
176
177 Grid units for this particular window - unlike the global context property
178 by the same name.
179*/
180UCUnits* UCMainWindow::units()
181{
182 Q_D(UCMainWindow);
183
184 if (!d->m_units) {
185 d->m_units = new UCUnits(this);
186 QObject::connect(d->m_units, SIGNAL(gridUnitChanged()),
187 this, SIGNAL(unitsChanged()));
188 }
189 return d->m_units;
190}
191
192/*!
193 \qmlproperty Units MainWindow::i18n
194
195 The property holds its breath for documentation.
196*/
197UbuntuI18n* UCMainWindow::i18n() const
198{
199 return UbuntuI18n::instance();
200}
201
202/*!
203 \qmlproperty ActionContext MainWindow::actionContext
204 \readonly
205 \since Ubuntu.Components 1.3
206 The action context of the MainWindow.
207 */
208UCPopupContext *UCMainWindow::actionContext() const
209{
210 return d_func()->m_actionContext;
211}
212
213UT_NAMESPACE_END
214
215#include "moc_ucmainwindow_p.cpp"
0216
=== added file 'src/UbuntuToolkit/ucmainwindow_p.h'
--- src/UbuntuToolkit/ucmainwindow_p.h 1970-01-01 00:00:00 +0000
+++ src/UbuntuToolkit/ucmainwindow_p.h 2017-01-12 02:42:37 +0000
@@ -0,0 +1,73 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef UCMAINWINDOW_P_H
18#define UCMAINWINDOW_P_H
19
20#include <QtQuick/QQuickWindow>
21
22#include <UbuntuToolkit/private/i18n_p.h>
23#include <UbuntuToolkit/private/ucunits_p.h>
24
25UT_NAMESPACE_BEGIN
26
27class UCMainWindowPrivate;
28class UCPopupContext;
29class UCAction;
30
31class UBUNTUTOOLKIT_EXPORT UCMainWindow : public QQuickWindow
32{
33 Q_OBJECT
34 Q_PROPERTY(QString applicationName READ applicationName WRITE setApplicationName NOTIFY applicationNameChanged)
35#ifndef Q_QDOC
36 Q_PROPERTY(UT_PREPEND_NAMESPACE(UCUnits)* units READ units NOTIFY unitsChanged)
37 Q_PROPERTY(UT_PREPEND_NAMESPACE(UbuntuI18n)* i18n READ i18n NOTIFY i18nChanged)
38 Q_PROPERTY(UT_PREPEND_NAMESPACE(UCPopupContext)* actionContext READ actionContext NOTIFY actionContextChanged)
39#else
40 Q_PROPERTY(UCUnits* units READ units NOTIFY unitsChanged)
41 Q_PROPERTY(UbuntuI18n* i18n READ i18n NOTIFY i18nChanged)
42 Q_PROPERTY(UCPopupContext* actionContext READ actionContext NOTIFY actionContextChanged)
43#endif
44
45public:
46 UCMainWindow(QWindow *parent = nullptr);
47
48
49 QString applicationName() const;
50 void setApplicationName(QString applicationName);
51
52 UCUnits* units();
53 UbuntuI18n* i18n() const;
54
55 UCPopupContext* actionContext() const;
56
57Q_SIGNALS:
58 void applicationNameChanged(QString applicationName);
59 void i18nChanged();
60 void unitsChanged();
61#ifndef Q_QDOC
62 void actionContextChanged(UT_PREPEND_NAMESPACE(UCPopupContext)* actionContext);
63#else
64 void actionContextChanged(UCPopupContext* actionContext);
65#endif
66
67private:
68 Q_DECLARE_PRIVATE(UCMainWindow)
69};
70
71UT_NAMESPACE_END
72
73#endif // UCMAINWINDOW_P_H
074
=== added file 'src/UbuntuToolkit/ucmainwindow_p_p.h'
--- src/UbuntuToolkit/ucmainwindow_p_p.h 1970-01-01 00:00:00 +0000
+++ src/UbuntuToolkit/ucmainwindow_p_p.h 2017-01-12 02:42:37 +0000
@@ -0,0 +1,47 @@
1/*
2 * Copyright 2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef UCMAINWINDOW_P_P_H
18#define UCMAINWINDOW_P_P_H
19
20#include <UbuntuToolkit/private/ucmainwindow_p.h>
21
22#include <QtQml/QQmlProperty>
23
24#include <QtQuick/private/qquickwindow_p.h>
25
26UT_NAMESPACE_BEGIN
27
28class UCMainWindow;
29class UCPopupContext;
30
31class UCMainWindowPrivate : public QQuickWindowPrivate
32{
33 Q_DECLARE_PUBLIC(UCMainWindow)
34
35public:
36 UCMainWindowPrivate();
37 void init();
38
39 QString m_applicationName;
40 UCPopupContext* m_actionContext = nullptr;
41 UCUnits* m_units = nullptr;
42
43};
44
45UT_NAMESPACE_END
46
47#endif // UCMAINWINDOW_P_P_H
048
=== modified file 'src/UbuntuToolkit/ucunits.cpp'
--- src/UbuntuToolkit/ucunits.cpp 2016-09-12 09:03:50 +0000
+++ src/UbuntuToolkit/ucunits.cpp 2017-01-12 02:42:37 +0000
@@ -97,18 +97,44 @@
97 * isolated from Qt's own scaling concept.97 * isolated from Qt's own scaling concept.
98 */98 */
9999
100UCUnits::UCUnits(QWindow *parent) :
101 QObject(parent),
102 m_devicePixelRatio(parent->devicePixelRatio())
103{
104 m_gridUnit = getenvFloat(ENV_GRID_UNIT_PX, DEFAULT_GRID_UNIT_PX * m_devicePixelRatio);
105 QObject::connect(parent, &QWindow::screenChanged,
106 this, &UCUnits::screenChanged);
107 m_screen = parent->screen();
108 if (m_screen)
109 QObject::connect(m_screen, &QScreen::physicalDotsPerInchChanged,
110 this, &UCUnits::devicePixelRatioChanged);
111}
112
113void UCUnits::screenChanged(QScreen *screen)
114{
115 if (m_screen)
116 QObject::disconnect(m_screen, &QScreen::physicalDotsPerInchChanged,
117 this, &UCUnits::devicePixelRatioChanged);
118 m_screen = screen;
119 QObject::connect(m_screen, &QScreen::physicalDotsPerInchChanged,
120 this, &UCUnits::devicePixelRatioChanged);
121 m_devicePixelRatio = screen->devicePixelRatio();
122 setGridUnit(DEFAULT_GRID_UNIT_PX * m_devicePixelRatio);
123}
124
125void UCUnits::devicePixelRatioChanged(qreal dpi)
126{
127 m_devicePixelRatio = dpi;
128 setGridUnit(DEFAULT_GRID_UNIT_PX * m_devicePixelRatio);
129}
130
100UCUnits *UCUnits::m_units = nullptr;131UCUnits *UCUnits::m_units = nullptr;
101132
102UCUnits::UCUnits(QObject *parent) :133UCUnits::UCUnits(QObject *parent) :
103 QObject(parent),134 QObject(parent),
104 m_devicePixelRatio(qGuiApp->devicePixelRatio())135 m_devicePixelRatio(qGuiApp->devicePixelRatio())
105{136{
106 // If GRID_UNIT_PX set, always use it. If not, 1GU := DEFAULT_GRID_UNIT_PX * m_devicePixelRatio137 m_gridUnit = getenvFloat(ENV_GRID_UNIT_PX, DEFAULT_GRID_UNIT_PX * m_devicePixelRatio);
107 if (qEnvironmentVariableIsSet(ENV_GRID_UNIT_PX)) {
108 m_gridUnit = getenvFloat(ENV_GRID_UNIT_PX, DEFAULT_GRID_UNIT_PX);
109 } else {
110 m_gridUnit = DEFAULT_GRID_UNIT_PX * m_devicePixelRatio;
111 }
112138
113 auto nativeInterface = qGuiApp->platformNativeInterface();139 auto nativeInterface = qGuiApp->platformNativeInterface();
114 if (nativeInterface) {140 if (nativeInterface) {
115141
=== modified file 'src/UbuntuToolkit/ucunits_p.h'
--- src/UbuntuToolkit/ucunits_p.h 2016-09-09 17:49:07 +0000
+++ src/UbuntuToolkit/ucunits_p.h 2017-01-12 02:42:37 +0000
@@ -23,6 +23,7 @@
23#include <QtCore/QObject>23#include <QtCore/QObject>
24#include <QtCore/QString>24#include <QtCore/QString>
25#include <QtCore/QUrl>25#include <QtCore/QUrl>
26#include <QtGui/QWindow>
2627
27#include <UbuntuToolkit/ubuntutoolkitglobal.h>28#include <UbuntuToolkit/ubuntutoolkitglobal.h>
2829
@@ -48,6 +49,7 @@
48 }49 }
4950
50 explicit UCUnits(QObject *parent = 0);51 explicit UCUnits(QObject *parent = 0);
52 explicit UCUnits(QWindow *parent);
51 ~UCUnits();53 ~UCUnits();
52 Q_INVOKABLE float dp(float value);54 Q_INVOKABLE float dp(float value);
53 Q_INVOKABLE float gu(float value);55 Q_INVOKABLE float gu(float value);
@@ -68,10 +70,13 @@
6870
69private Q_SLOTS:71private Q_SLOTS:
70 void windowPropertyChanged(QPlatformWindow *window, const QString &propertyName);72 void windowPropertyChanged(QPlatformWindow *window, const QString &propertyName);
73 void screenChanged(QScreen *screen);
74 void devicePixelRatioChanged(qreal dpi);
7175
72private:76private:
73 static UCUnits *m_units;77 static UCUnits *m_units;
74 float m_devicePixelRatio;78 float m_devicePixelRatio;
79 QScreen *m_screen;
75 float m_gridUnit;80 float m_gridUnit;
76};81};
7782
7883
=== renamed file 'tests/autopilot/ubuntuuitoolkit/tests/test_launcher.window.qml' => 'tests/autopilot/ubuntuuitoolkit/tests/test_launcher.mainwindow.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/test_launcher.window.qml 2016-07-12 12:05:11 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/test_launcher.mainwindow.qml 2017-01-12 02:42:37 +0000
@@ -17,23 +17,30 @@
17import QtQuick 2.417import QtQuick 2.4
18import QtQuick.Window 2.2 // Not Ubuntu.Test18import QtQuick.Window 2.2 // Not Ubuntu.Test
19import Ubuntu.Components 1.319import Ubuntu.Components 1.3
20import Ubuntu.Components.Labs 1.3
2021
21Window {22MainWindow {
22 title: "Hello World"23 title: i18n.tr("Hello World")
23 minimumWidth: units.gu(30)24 minimumWidth: units.gu(30)
24 minimumHeight: units.gu(50)25 minimumHeight: units.gu(50)
25 maximumWidth: units.gu(90)26 maximumWidth: units.gu(90)
26 maximumHeight: units.gu(120)27 maximumHeight: units.gu(120)
27 MainView {28
29 Item {
30 anchors.fill: parent
28 objectName: "mainView"31 objectName: "mainView"
2932
30 Page {33 Page {
31 title: "Launcher/Window"34 anchors.fill: parent
35 header: PageHeader {
36 title: "Launcher/Window"
37 }
3238
33 Column {39 Column {
40 anchors.top: parent.header.bottom
34 Label {41 Label {
35 objectName: "label"42 objectName: "label"
36 text: "Lorem ipsum dolor sit amet"43 text: i18n.tr("Lorem ipsum dolor sit amet")
37 width: units.gu(25)44 width: units.gu(25)
38 height: units.gu(25)45 height: units.gu(25)
39 }46 }
4047
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_launcher.py'
--- tests/autopilot/ubuntuuitoolkit/tests/test_launcher.py 2016-07-12 12:05:11 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/test_launcher.py 2017-01-12 02:42:37 +0000
@@ -49,6 +49,18 @@
49 Eventually(Equals("Lorem ipsum dolor sit amet")))49 Eventually(Equals("Lorem ipsum dolor sit amet")))
5050
5151
52class LauncherMainWindowTestCase(tests.QMLFileAppTestCase):
53 path = os.path.abspath(__file__)
54 dir_path = os.path.dirname(path)
55 test_qml_file_path = os.path.join(
56 dir_path, 'test_launcher.mainwindow.qml')
57
58 def test_window_root_item(self):
59 label = self.main_view.select_single(objectName="label")
60 self.assertThat(label.text,
61 Eventually(Equals("Lorem ipsum dolor sit amet")))
62
63
52class LauncherQtTestTestCase(tests.QMLFileAppTestCase):64class LauncherQtTestTestCase(tests.QMLFileAppTestCase):
53 path = os.path.abspath(__file__)65 path = os.path.abspath(__file__)
54 dir_path = os.path.dirname(path)66 dir_path = os.path.dirname(path)
5567
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/test_launcher.window.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/test_launcher.window.qml 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/test_launcher.window.qml 2017-01-12 02:42:37 +0000
@@ -0,0 +1,43 @@
1/*
2 * Copyright 2014-2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import QtQuick.Window 2.2 // Not Ubuntu.Test
19import Ubuntu.Components 1.3
20
21Window {
22 title: "Hello World"
23 minimumWidth: units.gu(30)
24 minimumHeight: units.gu(50)
25 maximumWidth: units.gu(90)
26 maximumHeight: units.gu(120)
27 MainView {
28 objectName: "mainView"
29
30 Page {
31 title: "Launcher/Window"
32
33 Column {
34 Label {
35 objectName: "label"
36 text: "Lorem ipsum dolor sit amet"
37 width: units.gu(25)
38 height: units.gu(25)
39 }
40 }
41 }
42 }
43}
044
=== added directory 'tests/unit/mainwindow'
=== added file 'tests/unit/mainwindow/AppName.qml'
--- tests/unit/mainwindow/AppName.qml 1970-01-01 00:00:00 +0000
+++ tests/unit/mainwindow/AppName.qml 2017-01-12 02:42:37 +0000
@@ -0,0 +1,28 @@
1/*
2 * Copyright 2013-2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.4
18import Ubuntu.Components 1.3
19import Ubuntu.Components.Labs 1.0
20
21MainWindow {
22 objectName: "appName"
23 applicationName: "org.gnu.wildebeest"
24
25 Label {
26 text: "Lorem ipsum dolor sit amet"
27 }
28}
029
=== added file 'tests/unit/mainwindow/mainwindow.pro'
--- tests/unit/mainwindow/mainwindow.pro 1970-01-01 00:00:00 +0000
+++ tests/unit/mainwindow/mainwindow.pro 2017-01-12 02:42:37 +0000
@@ -0,0 +1,5 @@
1CONFIG += custom_qpa # needed by test to set device pixel ratio correctly
2include(../test-include.pri)
3
4QT += gui
5SOURCES += tst_mainwindow.cpp
06
=== added file 'tests/unit/mainwindow/tst_mainwindow.cpp'
--- tests/unit/mainwindow/tst_mainwindow.cpp 1970-01-01 00:00:00 +0000
+++ tests/unit/mainwindow/tst_mainwindow.cpp 2017-01-12 02:42:37 +0000
@@ -0,0 +1,127 @@
1/*
2 * Copyright 2012-2016 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Author: Christian Dywan <christian.dywan@canonical.com>
17 */
18
19#include <QtCore/QString>
20#include <QtCore/QTextCodec>
21#include <QtCore/QStandardPaths>
22#include <QtCore/QProcessEnvironment>
23#include <QtCore/QDebug>
24#include <QtTest/QTest>
25#include <QtTest/QSignalSpy>
26#include <QtCore/QCoreApplication>
27#include <QtQml/QQmlEngine>
28#include <QtQuick/QQuickView>
29#include <QtQuick/QQuickItem>
30#include <QtCore/QThread>
31#include <QtCore/QFileInfo>
32#include <QtCore/QDir>
33#include <QtCore/QCryptographicHash>
34#include <QtCore/QSettings>
35
36#include <QtQuick/QQuickItem>
37#include <QtQuick/QQuickView>
38#include <QtGui/QGuiApplication>
39#include <QtQml/QQmlEngine>
40#include <QtQml/QQmlContext>
41#include <QtQml/QQmlComponent>
42
43#include <UbuntuToolkit/ubuntutoolkitmodule.h>
44#include <UbuntuToolkit/private/ucapplication_p.h>
45#include <UbuntuToolkit/private/ucunits_p.h>
46
47UT_USE_NAMESPACE
48
49class tst_MainWindow : public QObject
50{
51 Q_OBJECT
52
53public:
54 tst_MainWindow()
55 {
56 }
57
58 QQuickWindow *loadTest(const QString &document)
59 {
60 // Can't use UbuntuTestCase: We need a Window root item
61 QPointer<QQmlEngine> engine(new QQmlEngine());
62 QString modulePath(UBUNTU_QML_IMPORT_PATH);
63 if (!QDir(modulePath).exists()) {
64 qWarning("'%s' doesn't exist", qPrintable(modulePath));
65 return 0;
66 }
67 engine->addImportPath(modulePath);
68 UbuntuToolkitModule::initializeContextProperties(engine);
69 QPointer<QQmlComponent> component(new QQmlComponent(engine));
70 component->loadUrl(QUrl::fromLocalFile(document), QQmlComponent::Asynchronous);
71 while (component->isLoading())
72 QCoreApplication::processEvents();
73 QObject *toplevel(component->create());
74 if (component->errorString() != "") {
75 qWarning("%s", qPrintable(component->errorString()));
76 return 0;
77 }
78 QQuickWindow* window(qobject_cast<QQuickWindow *>(toplevel));
79 if (window)
80 engine->setIncubationController(window->incubationController());
81 else {
82 QQuickItem *rootItem = qobject_cast<QQuickItem *>(toplevel);
83 if (rootItem) {
84 QQuickView *view(new QQuickView(engine, 0));
85 window = view;
86 view->setResizeMode(QQuickView::SizeRootObjectToView);
87 view->setContent(document, component, rootItem);
88 }
89 }
90 return window;
91 }
92
93 QQuickItem *testItem(QQuickItem *that, const QString &identifier)
94 {
95 if (that->property(identifier.toLocal8Bit()).isValid())
96 return that->property(identifier.toLocal8Bit()).value<QQuickItem*>();
97
98 QList<QQuickItem*> children = that->findChildren<QQuickItem*>(identifier);
99 return (children.count() > 0) ? children[0] : 0;
100 }
101
102private Q_SLOTS:
103
104 void initTestCase()
105 {
106 }
107
108 void cleanupTestCase()
109 {
110 }
111
112 // Note: tests/unit/mainview contains the UCApplication bits
113
114 void testCase_AppName()
115 {
116 QString applicationName("org.gnu.wildebeest");
117 QQuickWindow *mainWindow(loadTest("AppName.qml"));
118 QVERIFY(mainWindow);
119 QCOMPARE(applicationName, mainWindow->property("applicationName").toString());
120 QCOMPARE(applicationName, QCoreApplication::applicationName());
121 QCOMPARE(QString(""), QCoreApplication::organizationName());
122 }
123};
124
125QTEST_MAIN(tst_MainWindow)
126
127#include "tst_mainwindow.moc"
0128
=== modified file 'tests/unit/unit.pro'
--- tests/unit/unit.pro 2016-09-30 05:39:57 +0000
+++ tests/unit/unit.pro 2017-01-12 02:42:37 +0000
@@ -41,6 +41,7 @@
41 performance \41 performance \
42 mainview11 \42 mainview11 \
43 mainview13 \43 mainview13 \
44 mainwindow \
44 i18n \45 i18n \
45 arguments \46 arguments \
46 argument \47 argument \

Subscribers

People subscribed via source and target branches