Merge lp://staging/~laney/ubuntu-system-settings/reset-api into lp://staging/ubuntu-system-settings
- reset-api
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Sebastien Bacher |
Approved revision: | 504 |
Merged at revision: | 863 |
Proposed branch: | lp://staging/~laney/ubuntu-system-settings/reset-api |
Merge into: | lp://staging/ubuntu-system-settings |
Diff against target: |
541 lines (+268/-30) 17 files modified
debian/control (+2/-0) lib/SystemSettings/plugin-interface.h (+9/-0) plugins/battery/plugin/battery-plugin.h (+3/-3) plugins/brightness/plugin/brightness-plugin.h (+3/-3) plugins/reset/ResetAllSettings.qml (+4/-2) plugins/system-update/plugin/update-plugin.h (+4/-3) src/plugin-manager.cpp (+12/-0) src/plugin-manager.h (+1/-0) src/plugin.cpp (+63/-5) src/plugin.h (+2/-0) tests/CMakeLists.txt (+4/-0) tests/data/phone.settings (+9/-0) tests/test-plugin.cpp (+18/-10) tests/test-plugin.h (+3/-3) tests/test-plugin2.cpp (+44/-0) tests/test-plugin2.h (+41/-0) tests/tst_plugins.cpp (+46/-1) |
To merge this branch: | bzr merge lp://staging/~laney/ubuntu-system-settings/reset-api |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Sebastien Bacher (community) | Needs Fixing | ||
Alberto Mardegan | Needs Fixing | ||
Review via email: mp+208661@code.staging.launchpad.net |
Commit message
Add a 'reset' API so that plugins can reset their settings to default. They can do this in one of two ways: by providing a function 'bool reset()' in their 'plugin' which returns true or by providing a top-level javascript function 'reset' in their page component.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:496
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Alberto Mardegan (mardy) wrote : | # |
On 02/27/2014 07:55 PM, Iain Lane wrote:
> + // Try to use the plugin's reset method
> + if (d->m_plugin2 && d->m_plugin2-
> + return;
> +
> + // Otherwise, try to use one from the page component
> + QQmlComponent *component = pageComponent();
I'd suggest adding this (to avoid the need of changing the Online
Accounts panel at the same time):
/* If the plugin implements version 1 of the interface but not version
* 2, we assume that we won't find a "reset()" method in the
* pageComponent either.
*/
if (d->m_plugin && !d->m_plugin2)
return;
Iain Lane (laney) wrote : | # |
On Fri, Feb 28, 2014 at 08:15:32AM -0000, Alberto Mardegan wrote:
> On 02/27/2014 07:55 PM, Iain Lane wrote:
> > + // Try to use the plugin's reset method
> > + if (d->m_plugin2 && d->m_plugin2-
> > + return;
> > +
> > + // Otherwise, try to use one from the page component
> > + QQmlComponent *component = pageComponent();
>
> I'd suggest adding this (to avoid the need of changing the Online
> Accounts panel at the same time):
>
> /* If the plugin implements version 1 of the interface but not version
> * 2, we assume that we won't find a "reset()" method in the
> * pageComponent either.
> */
> if (d->m_plugin && !d->m_plugin2)
> return;
I did consider that, but I came to the conclusion that I think it should
still be valid to continue to use interface version 1 and provide
resetting via the PageComponent.
--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]
Iain Lane (laney) wrote : | # |
Hold on, I'm going to write some tests / examples
Iain Lane (laney) wrote : | # |
ok, tests added, see what you think now please
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:497
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:498
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Alberto Mardegan (mardy) wrote : | # |
L149: better delete the component here (though it's not leaked because it has the Plugin as its parent, so it's not a big issue)
L284,L285: indent the QML code one space more
L291: is this really needed? If it is, then maybe we should have this code in src/plugin.cpp, and not just in the test plugin.
All the rest looks fine to me, though I'd really like to see the addition of the code I suggested in the previous comment. :-)
Iain Lane (laney) wrote : | # |
On Mon, Mar 03, 2014 at 09:45:11AM -0000, Alberto Mardegan wrote:
> Review: Needs Fixing
>
> L149: better delete the component here (though it's not leaked because it has the Plugin as its parent, so it's not a big issue)
>
> L284,L285: indent the QML code one space more
Fixing, thanks - actually 284 is redundant now so I'll delete that.
> L291: is this really needed? If it is, then maybe we should have this code in src/plugin.cpp, and not just in the test plugin.
Something is broken here. I was trying to see if it worked on the CI,
but it doesn't as you can see; will try to fix some other way soon.
QWARN : PluginsTest:
INFO : PluginsTest:
FAIL! : PluginsTest:
& my last revision just makes it hang altogether. I guess it probably
/should/ be in plugin.cpp though, yeah, if it's generally possible that
the returned component is not ready (which I suppose is true).
>
> All the rest looks fine to me, though I'd really like to see the addition of the code I suggested in the previous comment. :-)
I'll let Seb or another reviewer adjudicate. I gave my reasons already,
but I'm happy to defer if I get outvoted. :-)
--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:500
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:502
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Sebastien Bacher (seb128) wrote : | # |
> though I'd really like to see the addition of the code I suggested in the previous comment. :-)
what is going to happen without that code if we don't land -online at the same time? it seems the code is checking for a reset() and handle it not being there, so it shouldn't be an issue?
Iain Lane (laney) wrote : | # |
On Mon, Mar 03, 2014 at 02:12:14PM -0000, Sebastien Bacher wrote:
> > though I'd really like to see the addition of the code I suggested in the previous comment. :-)
>
> what is going to happen without that code if we don't land -online at the same time? it seems the code is checking for a reset() and handle it not being there, so it shouldn't be an issue?
Because online accounts does something weird when you ask for its page
component - it unconditionally shows itself. So if you invoke the reset
action then the online accounts panel pops up.
Alberto's solution avoids this because online accounts doesn't implement
the '2' interface, so we would just skip resetting it completely.
--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]
Sebastien Bacher (seb128) wrote : | # |
thanks for the explanation, to me it looks like that check is low cost and makes things a bit more robust, so +1 for including it (though in practice it's likely only online-account is going to have the issue and we can batch those so it doesn't really matter much easier way)
Alberto Mardegan (mardy) wrote : | # |
If that extra code bothers you, we can add it now and remove it later. :-)
Iain Lane (laney) wrote : | # |
On Mon, Mar 03, 2014 at 02:46:35PM -0000, Sebastien Bacher wrote:
> thanks for the explanation, to me it looks like that check is low cost and makes things a bit more robust, so +1 for including it (though in practice it's likely only online-account is going to have the issue and we can batch those so it doesn't really matter much easier way)
OK then. I'll have to upgrade the plugins we provide to 2, and we need
to make sure that any future ones are 2, otherwise they won't be able to
be reset via qml/js.
I think it'll be a bit confusing and hard to debug if that ever happens,
so try to keep it in mind.
--
Iain Lane [ <email address hidden> ]
Debian Developer [ <email address hidden> ]
Ubuntu Developer [ <email address hidden> ]
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:503
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Jonas G. Drange (jonas-drange) wrote : | # |
This looks great, thanks.
Sebastien Bacher (seb128) wrote : | # |
needs to be rebased on trunk
Iain Lane (laney) wrote : | # |
merged, fyi
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:504
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
FAILED: Continuous integration, rev:496 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- ci/665/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty- touch/3176 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- trusty- amd64-ci/ 181 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- trusty- armhf-ci/ 169 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- trusty- i386-ci/ 168 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/3178 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- armhf/3178/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/5562 s-jenkins. ubuntu- ci:8080/ job/touch- flash-device/ 4349
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- system- settings- ci/665/ rebuild
http://