Active Topics

 


Reply
Thread Tools
Venemo's Avatar
Posts: 1,296 | Thanked: 1,773 times | Joined on Aug 2009 @ Budapest, Hungary
#1
Hey Everyone,

Today I got envious of all the apps that create those shiny notifications, so I decided to put together an app in Qt to see how to do it.

Unfortunately the QMaemo5InformationBox doesn't display the style of notifications I needed.

So, I went to IRC and asked the good people in #qt-maemo, and they said that Qt doesn't have an abstraction of this particular UI element. They pointed me to this guide on Forum Nokia, which almost did it. Unfortunately it doesn't work with MADDE.

After hours of suffering and pain I successfully overcame the limitations of MADDE (again, thanks to the good people at #qt-maemo), and I put together a small example in the repo of my project.

Here it goes:
  • Check out this SVN repo or download the sources
  • Copy-paste my QMaemo5Notification class (header and cpp file)
  • Make sure you have added all the necessary libraries to your .pro file's INCLUDEPATH and LIBS. (See the example .pro file)
  • it is necessary to put "CONFIG += no_keywords" into the .pro file because the headers required contain keywords that are otherwise reserved by Qt.
    If you would use them in your own code, I recommend you to put QMaemo5Notification into its own project file (or .pri file)

That's it.
Now you can just do this:

Code:
#include "qmaemo5notification.hpp"
...

QMaemo5Notification::information("Hey, this is a note!");
Of course it has some tasty overloads to exploit libnotify's functionality.

I hope I could spare some people the pain I went through, so I decided to share this with the community.

Last edited by Venemo; 2010-06-01 at 16:59.
 

The Following 10 Users Say Thank You to Venemo For This Useful Post:
Posts: 190 | Thanked: 129 times | Joined on Mar 2010 @ Bavaria, Germany
#2
Already thought of implementing this, but you were faster

It would be nice if you could ask the libQxt developers if they want to integrate this into their library (or another common library).
So someone could package libQxt for maemo and everyone could use those features
 
Venemo's Avatar
Posts: 1,296 | Thanked: 1,773 times | Joined on Aug 2009 @ Budapest, Hungary
#3
Originally Posted by gri View Post
Already thought of implementing this, but you were faster

It would be nice if you could ask the libQxt developers if they want to integrate this into their library (or another common library).
So someone could package libQxt for maemo and everyone could use those features
Everyone can use these features, just download my source code.
BTW, you can ask them yourself on freenode.
 
Posts: 26 | Thanked: 0 times | Joined on Apr 2010
#4
Thx for your thread and sources and I'am starting to develop with Qt.
 
Venemo's Avatar
Posts: 1,296 | Thanked: 1,773 times | Joined on Aug 2009 @ Budapest, Hungary
#5
Bump.

Okay, I successfully added some new functionality to this stuff, namely this: when the user clicks on the notification, you can now add a D-Bus call that is executed.

(Very much like when you hit the SMS notification, the SMS app appears.)
It is now also possible to set "hints" for the notifications.

A big thanks for the great people who made nowplayingd (I got the idea of how to do this from their code), and also another big thanks to w00t and Frals who helped me very much with troubleshooting and advices on IRC.

To exploit this functionality, you'll need a D-Bus method to call or to expose your app to D-Bus as described here.
(I also found out that adding X-Osso-Service to the .desktop file and creating a .service file is not required for basic usage.)

Head over to the repo (header file, source file), and grab your copy!

You can find a pretty good example on how to use it in my app, namely in this file.

Good luck!

EDIT:
If you are cunning enough, you may also find out from my sources how to blink the notification LED when these notifications appear!

Last edited by Venemo; 2010-06-13 at 13:59.
 

The Following 3 Users Say Thank You to Venemo For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 16:33.