Merge lp://staging/~jpakkane/unity-notifications/simpleqml into lp://staging/unity-notifications

Proposed by Jussi Pakkanen
Status: Needs review
Proposed branch: lp://staging/~jpakkane/unity-notifications/simpleqml
Merge into: lp://staging/unity-notifications
Diff against target: 196 lines (+110/-28)
5 files modified
include/SimpleQmlSender.h (+50/-0)
include/notify-backend.h.in (+1/-14)
src/CMakeLists.txt (+2/-2)
src/NotificationClientPlugin.cpp (+13/-12)
src/SimpleQmlSender.cpp (+44/-0)
To merge this branch: bzr merge lp://staging/~jpakkane/unity-notifications/simpleqml
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Needs Fixing
PS Jenkins bot (community) continuous-integration Approve
Antti Kaijanmäki (community) Needs Fixing
Michał Sawicz Pending
Review via email: mp+172478@code.staging.launchpad.net

Commit message

Added simple Qml notification sender.

Description of the change

Made a simple QML plugin for fire-and-forget notifications. Also a few other cleanups and fixes.

To post a comment you must log in.
170. By Jussi Pakkanen

Made SimpleQmlSender final.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

136 + SimpleQmlSender *cl = new SimpleQmlSender(engine);
137 + engine->rootContext()->setContextProperty("unity.notifications", cl);

I probably mentioned this before, but IMO our QML components should not mess with the QML engine directly if at all possible, but this is just my opinion. You might want to sync with the SDK team and ask if this is OK for them.

173 + QString app_name("client");
178 + QString app_icon;

So, there is no way for the app developer to set the app_name of app_icon? I guess these will not be visible on the notification bubble then.

Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

183 + if(!result.isValid()) {
184 + fprintf(stderr, "Sending notification failed.\n");
185 + }

Please, use qWarning() or qCritical(). This way the application which loads this component can get the messages redirected by setting the logger handlers if needed.

review: Needs Fixing
Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

> 183 + if(!result.isValid()) {
> 184 + fprintf(stderr, "Sending notification failed.\n");
> 185 + }
>
> Please, use qWarning() or qCritical(). This way the application which loads
> this component can get the messages redirected by setting the logger handlers
> if needed.

Also, provide the reply.error().name() and reply.error().message() as part of the error message.

If you include <QDebug> you also get operator<< for the qWarning(), qCritical(), etc. which makes your life a lot easier:

    qCritical() << "Sending notification failed:" << reply.error().name() << reply.error().message();

I havent tested, but it's possible that you can even do:

    qCritical() << "Sending notification failed:" << reply.error();

171. By Jussi Pakkanen

Use qCritical for logging.

172. By Jussi Pakkanen

Have user specify app name.

173. By Jussi Pakkanen

Made sender a singleton rather than modifying root context.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Fixed. App icon is still not settable and will not be.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

132 - qmlRegisterUncreatableType<NotificationClient>(uri, 1, 0, "NotificationClient", "");
133 + qmlRegisterSingletonType<SimpleQmlSender>(uri, 1, 0, "unity.notifications", senderProvider);

Why this? QML types are supposed to be uppercase and the . is really confusing (if it works at all) because usually its the delimiter for named imports.

=====

I'd fancy a test :)

review: Needs Fixing

Unmerged revisions

173. By Jussi Pakkanen

Made sender a singleton rather than modifying root context.

172. By Jussi Pakkanen

Have user specify app name.

171. By Jussi Pakkanen

Use qCritical for logging.

170. By Jussi Pakkanen

Made SimpleQmlSender final.

169. By Jussi Pakkanen

Configure header cleanup.

168. By Jussi Pakkanen

Clarification and removeification.

167. By Jussi Pakkanen

Provide a simple notification sender plugin for Qml.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: