PDA

View Full Version : SImple QT Desktop Widget to display battery level and percentage in Extras-devel now


krk969
12-29-2009, 05:15 PM
Folks, here it is a deskop widget to display the battery level as a percentage.

Its in the desktop section as batlevel.
You need t enable extras-devel repository.

One thing I havent figured out completely is how to add it to the desktop add widgets menu, currenly it will appear in add shortcut as an app but when started it will open as a desktop widget.
It seems deskop widgets need to be libraries and mine is a binary, while i figure out the technicalities related to this feel free to play with this and discuss any bugs/improvements.

This is a very simple display, I will try adding more functional/eye-candy stuff if I dont get busy with some other projects. But Id like to hear your ideas.
just to let you know Im currently working on making it look more like a battery than a progress bar :D

Three ways to start it.

1. from X terminal run the command
run_batlevel

2. from the desktop , click add a shortcut , choose batlevel, and then click on the shortcut ( the shortcut can be deleted later as the widget will appear on the desktop )

3. The usual way, go to the applications menu and run the installed app.

Last but not the least, maemo fellow members have been most helpful in helping create this app . Hope the maemo spirit lives on and grows stronger , ok enough of the emotions now :p Ill let you guys develop more on this.

cheers,

krk969
12-29-2009, 05:21 PM
I guess I posted this in the wrong thread nstead of applications.
Mods pls feel free to move if not appropriate, but the app is specifically for N900 so maybe its ok to be here .
Sorry I couldnt find an option to move it.:p

reycat
12-29-2009, 06:04 PM
Just tried it, it seems to work. 8 MB, I guess it's optified, isn't it? :)

Thank you very much, I was looking forward to something like this.

OrangeBox
12-29-2009, 06:06 PM
8 MB for this??? To see the battery level on the desktop that I see already in the status area? Another useless widget.

krk969
12-29-2009, 06:08 PM
Just tried it, it seems to work. 8 MB, I guess it's optified, isn't it? :)

Thank you very much, I was looking forward to something like this.

8 MB did you say ?

anyways the app itself is abt 17K only, maybe you had to download a list of other dependencies that werent on your N900.
Yes the app behaved well so far on my N900 past couple of days, doesnt use too much memory or cpu.
rest we will know soon when the others also try ;)

to know the dependencies you can run this command on your N900

apt-cache showpkg batlevel

alternatively you can also see it when you are about to download the app from the application manager, it lists the dependencies in the details tab.

cheers

pr0xyfl00d3r
12-29-2009, 06:23 PM
Not workin for me, just get a black screen, and at top the loading icon

krk969
12-29-2009, 06:29 PM
Not workin for me, just get a black screen, and at top the loading icon


just minimize that screen( clicking on the top left hand corner ), you will see the widget on your desktop and that window just closes on its own immediately.
not sure why that window pops up and stays though I run the app int he background.
will be working on it :).

gabbre
12-29-2009, 06:38 PM
Nice widget!I hope there will be an improvement of the interface in future:)
Good luck for future releases!
PS sorry for my bad english:)

maxximuscool
12-29-2009, 06:43 PM
7.59MB wtf...

Crashdamage
12-29-2009, 06:52 PM
8 MB for this??? To see the battery level on the desktop that I see already in the status area? Another useless widget.
krk969 deserves thanks for sharing his efforts with everyone - for FREE! If you don't want/like it, don't use it. But don't ***** about it. He doesn't deserve taking your crap for his work.

maxximuscool
12-29-2009, 06:54 PM
not working.. Got the same Black screen and when minimize it just it just closed immediately. And it's 7.59MB for your information.

That One Guy
12-29-2009, 07:02 PM
And I bet if you look back at your desktop, you'll see the battery bar.

I agree, almost 8 megs does seem a little excessive. But nevertheless, thank you, Dev. At least you did something and created an app for this purpose.

krk969
12-29-2009, 07:05 PM
not working.. Got the same Black screen and when minimize it just it just closed immediately. And it's 7.59MB for your information.

guys, I think the huge size is due to the dependencies, the library this app is using qtsysteminfo is based on the new QT Mobility API Technology Preview 2, it depends on a lot of other qt libraries like libqt4-maemo5-core, libqt4-maemo5-dbus etc.
Im sure you would have seen this getting installed.

You will be needing all this in your N900 sooner or later to be able to have QT applications so I dont see it as an issue. Feel free to correct me QT gurus.

The app as such is only 16K. the memory footprint is negligible too.

hope ive answered the questions around the 8MB download.
can clarify more if needed, PM me.

cheers


EDIT:

the additional dependent libs are installed in
/opt/qt4-maemo5 ( QT4.6 stuff which is unlikely to exist on your N900 if you havent installed any QT apps that depend on them )
and ive configured qtsysteminfo libs to install in /usr/lib

tissot
12-29-2009, 07:05 PM
Working great for me and something i was looking for.

bsving
12-29-2009, 07:36 PM
Working nice for me too. Only one thing. I uninstallet it, but the widget was still there. I then manually deleted the widget from the homescreen, but is it really deleted now, I mean uninstalled? And 8 MB, it is optified (you didn't answer that question earlier)?

w00t
12-29-2009, 07:39 PM
Guys, yet again: the application itself *is not* 8mb.

That 8mb figure includes libraries (Qt, specifically), and whether or not that is optified is certainly not in the control of an external application developer.

To the developer -
Great job. I've been wanting something like this for a while, and will test it out when I get a chance.

YoDude
12-29-2009, 08:20 PM
7.59MB wtf...

It is in the Extra-developers repository isn't it?

Wtf, I can't find your app in there. :confused:

***

Nice effort krk969. It does not stay resident after a reboot but I'm sure you know that. I'm looking forward to seeing it widgetized. Perhaps it can be incorporated in the existing status widget like the simple brightness app is. :)

Techtertainment
12-29-2009, 08:23 PM
good job..

i am a trainee developer on a graduate programm with a major airline company.. i been doing java and just started learning C++. was thing about doing something small like this to get me started as a developer for maemo but looks like u go there 1st.

quick question. how did you get started setting up and using QT and would it be possible to look at the souce code (hopefully with detailed comments) as a little training for me?

bsving
12-29-2009, 08:23 PM
That 8mb figure includes libraries (Qt, specifically), and whether or not that is optified is certainly not in the control of an external application developer.

I don't think anyone is blaming anyone for anything. A yes or no from the developer will be sufficient. It is a simple question.

kabu
12-29-2009, 10:09 PM
so,but it couldn't like other widget autoboot,add widget fron menu

krk969
12-30-2009, 03:01 AM
I don't think anyone is blaming anyone for anything. A yes or no from the developer will be sufficient. It is a simple question.

already answered :) ==>
http://talk.maemo.org/showpost.php?p=445986&postcount=13

bsving
12-30-2009, 04:07 AM
already answered :)

Not a very good answer to the question in that case :) Anyway, looking through my files, I see a new qt directory in /opt. This is qt 4.6.1 as opposed to the qt 4.5 already in the /usr directory.

timoph
12-30-2009, 04:45 AM
Not a very good answer to the question in that case :) Anyway, looking through my files, I see a new qt directory in /opt. This is qt 4.6.1 as opposed to the qt 4.5 already in the /usr directory.

Well, the widget uses Qt 4.6 and those libs install to /opt

Qt 4.5 in /usr is currently the default version of Qt and it's going to be replaced by 4.6 some time in the future.

For those complaining about the size. The widget itself is small but if you haven't installed any apps that depend on Qt 4.6, those libs are installed also. If you look at the package details in the application manager you will see that packages that are going to be installed. The libraries are only installed once so next time you install some Qt application it doesn't appear as big.

Regarding the "black screen" -issue. The blank application screen appear because the widget isn't a shared object like the other widgets are (and are supposed to be). Because the widget is a normal application binary it's started as one (just close the application window and it works). In order to fix this the widget needs to be compiled differently and it has to have some interfaces implemented in it that don't exist in the current version. This obviously needs to be studied how it's done with Qt and so on.

The widget is still a work in progress and that why it's in extras-devel and further more there's a reason why normal users should stay away from extras-devel.

Anyway nice work krk969

Fargus
12-30-2009, 04:54 AM
guys, I think the huge size is due to the dependencies, the library this app is using qtsysteminfo is based on the new QT Mobility API Technology Preview 2, it depends on a lot of other qt libraries like libqt4-maemo5-core, libqt4-maemo5-dbus etc.
Im sure you would have seen this getting installed.

You will be needing all this in your N900 sooner or later to be able to have QT applications so I dont see it as an issue. Feel free to correct me QT gurus.

The app as such is only 16K. the memory footprint is negligible too.

hope ive answered the questions around the 8MB download.
can clarify more if needed, PM me.

cheers

Well to be honest this still seems smaller than the Python payload that a lot of people use without any issues.

jcompagner
12-30-2009, 05:15 AM
i think there are now a few more widgets that appear as applications, egg timer, FM RDS Notify widget and so on.
They all have the same behavior, so i guess a wiki page needs to be clear what exactly must be done to create/compile a widget...

krk969
12-30-2009, 05:28 AM
Well, the widget uses Qt 4.6 and those libs install to /opt

Qt 4.5 in /usr is currently the default version of Qt and it's going to be replaced by 4.6 some time in the future.

For those complaining about the size. The widget itself is small but if you haven't installed any apps that depend on Qt 4.6, those libs are installed also. If you look at the package details in the application manager you will see that packages that are going to be installed. The libraries are only installed once so next time you install some Qt application it doesn't appear as big.

Regarding the "black screen" -issue. The blank application screen appear because the widget isn't a shared object like the other widgets are (and are supposed to be). Because the widget is a normal application binary it's started as one (just close the application window and it works). In order to fix this the widget needs to be compiled differently and it has to have some interfaces implemented in it that don't exist in the current version. This obviously needs to be studied how it's done with Qt and so on.

The widget is still a work in progress and that why it's in extras-devel and further more there's a reason why normal users should stay away from extras-devel.

Anyway nice work krk969

I presume most desktop widgets out there that appear in the desktop add widget menu are gtk based.
so one way is to figure out how its done in gtk and make a dummy gtk to call my code ( compiled as a lib )

I havent found a way yet to make a QT widget appear in the desktop widget menu.
will most certainly work on it as I think its something we all cannot do without :)
if anybody has any info please share.

for those that didnt know you can get the source of my code using
apt-get source batlevel

ceefour
12-30-2009, 06:13 AM
guys, I think the huge size is due to the dependencies, the library this app is using qtsysteminfo is based on the new QT Mobility API Technology Preview 2, it depends on a lot of other qt libraries like libqt4-maemo5-core, libqt4-maemo5-dbus etc.

Congrats krk969 for getting your Maemo + Qt Mobility widget done!

Some questions for you krk969:


Will the second installed Qt widget use another 8 MB, or just marginal memory usage? (since Qt library is already loaded)
A bunch of OOT questions: What's your personal opinion regarding Maemo vs Symbian? Should Nokia kill Symbian and boost Maemo, or the other way around? Is Maemo in the same ground as iPhone, Android, WebOS... or is it superior/inferior? (I'm definitely expecting subjective answers here)

krk969
12-30-2009, 06:56 AM
Congrats krk969 for getting your Maemo + Qt Mobility widget done!

Some questions for you krk969:


Will the second installed Qt widget use another 8 MB, or just marginal memory usage? (since Qt library is already loaded)
A bunch of OOT questions: What's your personal opinion regarding Maemo vs Symbian? Should Nokia kill Symbian and boost Maemo, or the other way around? Is Maemo in the same ground as iPhone, Android, WebOS... or is it superior/inferior? (I'm definitely expecting subjective answers here)


Once the dependent QT libs are installed , any other app that might need them wont be carrying this payload, so you can expect the next app to be much smalller if it doesnt have any dependencies other than the ones installed.
normal unix/linux stuff nothing different for maemo.

about my opinion on your OOT questions I have PM'ed you , else it will hijack the thread ;)

funpig
12-30-2009, 07:41 AM
good job..
quick question. how did you get started setting up and using QT and would it be possible to look at the souce code (hopefully with detailed comments) as a little training for me?

i think if you install Qt SDK, you could found so many example with source code. as this thread http://qt.nokia.com/developer/getting-started/getting-started#qt-tutorials, you could get start for learn QT.

from http://qt.gitorious.org/, you could see all of source code for QT.

please enjoy QT!!!

bsving
12-30-2009, 07:51 AM
about my opinion on your OOT questions I have PM'ed you , else it will hijack the thread ;)

I think this would be interresting for lots of people. Could you perhaps make a new thread about that?

humble
12-30-2009, 09:00 AM
(My Beta testing):cool:

1 issue when battery is fully charged the widget displays 96%.(not sure what it maybe... maybe my device or your code but i havent seen anyone else complain about it yet)

BTW I just restarted and the widget displays 90%:(

Any who thank you for your time and your work.(I like the app it just needs some love)

krk969
12-30-2009, 09:29 AM
(My Beta testing):cool:

1 issue when battery is fully charged the widget displays 96%.(not sure what it maybe... maybe my device or your code but i havent seen anyone else complain about it yet)

BTW I just restarted and the widget displays 90%:(

Any who thank you for your time and your work.(I like the app it just needs some love)

Ive already reported this issue in my earlier thread
==> check it out here (http://talk.maemo.org/showpost.php?p=444296&postcount=22)

Ive also seen many threads discussing this, some of them are
here (http://talk.maemo.org/showthread.php?t=37139) , here (http://talk.maemo.org/showthread.php?p=442977) , and here (http://talk.maemo.org/showpost.php?p=434738&postcount=14)

think its something to do with the libhal implementation, but I cant be sure about it.
Was waiting for more inputs from other users, but I guess Ill go ahead and raise a bug in bugzilla if it doesnt exist there already.

cheers

tissot
12-30-2009, 09:42 AM
(My Beta testing):cool:

1 issue when battery is fully charged the widget displays 96%.(not sure what it maybe... maybe my device or your code but i havent seen anyone else complain about it yet)

BTW I just restarted and the widget displays 90%:(

Any who thank you for your time and your work.(I like the app it just needs some love)

I have these same problems. I'm not sure if it's the app or now when i'm seeing it in numbers, but my battery life seems to have gotten lot worse than before.

krk969
12-30-2009, 10:00 AM
I have these same problems. I'm not sure if it's the app or now when i'm seeing it in numbers, but my battery life seems to have gotten lot worse than before.

hopefully just the numbers :p ( and regarding the numbers being skewed, chk my previous post )
anyways my n900 lasts more or less the same amount of time without the widget for me.
last nite at 1145pm battery was at 14% and when i woke up at 7.30am it was 5% had the widget running.( emails on, wifi, bluetooth gps all on )

Anyways, the widget doesnt poll to get the battery info, its using a signal mechanism to where it recieves a signal when the battery level changes then it updates it on screen.

Im hopeful the qtmobility api's have taken into consideration the effect on battery, if not we will learn soon and do something abt it :)

humble
12-30-2009, 10:19 AM
Sry..:o (i found out about this app in this thread)
Next time will do more research.

rrdbala
12-30-2009, 10:26 AM
Hi All,

One quick question. I want to try this app, i did not see this app was not listed in the app manager in My N900. How do i install this on my phone?

Please excuse if it is a very sill question, i am very new to this env. :-)

krk969
12-30-2009, 10:50 AM
Hi All,

One quick question. I want to try this app, i did not see this app was not listed in the app manager in My N900. How do i install this on my phone?

Please excuse if it is a very sill question, i am very new to this env. :-)

try enabling the extras-devel repository in your application manager -> refresh -> search for batlevel

you can start ==> here (http://maemocentral.com/2009/12/29/how-to-enable-extras-extras-testing-extras-devel-repositories-on-the-n900-with-one-click/)

joppu
12-30-2009, 11:11 AM
Seems to be working fine for me. When you get the custom graphics working, just give me the required specs (resolution and such) and I'll work out the graphics as planned.

rkm
12-30-2009, 11:30 AM
I havent found a way yet to make a QT widget appear in the desktop widget menu.

I think you need to create a .desktop file in /usr/share/applications/hildon-home to get the widget to show up in the menu.

You can copy-paste one from the existing ones, but the file format is also documented somewhere in SDK docs.

krk969
12-30-2009, 11:46 AM
I think you need to create a .desktop file in /usr/share/applications/hildon-home to get the widget to show up in the menu.

You can copy-paste one from the existing ones, but the file format is also documented somewhere in SDK docs.

thanks.
if you have installed the app, you must have noticed the .desktop being installed in /usr/share/applications/hildon/ ( as per the maemo developer guide )
Ive even tried /usr/share/applications/hildon-home, doesnt work.

bolapara
12-30-2009, 01:55 PM
Doesn't work for me. The window disappears when I minimize it and I'm left without a widget.

DaSilva
01-01-2010, 08:28 AM
Is it possible to display the percentage not as a widget but in the bar of the system tray?
This widget eats too much power (1-4% of the CPU all the time!)

krk969
01-04-2010, 08:58 AM
bug raised ==> bug#7636 (https://bugs.maemo.org/show_bug.cgi?id=7636)

for the battery not showing 100% when full.
Please vote for it if you face the issue too.

412b
01-04-2010, 04:16 PM
bug raised ==> bug#7636 (https://bugs.maemo.org/show_bug.cgi?id=7636)

for the battery not showing 100% when full.
Please vote for it if you face the issue too.

IMO it's to be a WON'T FIX ;)
And there had never been 100% charge on N8x0.

krk969
01-04-2010, 05:43 PM
IMO it's to be a WON'T FIX ;)
And there had never been 100% charge on N8x0.

you were right ;)

mysticrokks
01-04-2010, 05:45 PM
what an ironic widget- use it to show ur power levels, yet is drains your battery hard.

DaSilva
01-05-2010, 01:46 AM
What has been changed with the last update?

krk969
01-05-2010, 03:08 AM
What has been changed with the last update?

the dependency qtsysteminfo was optified since it was around 2MB.
SO batlevel had to be pointed to the optified location.

the batlevel app as such is 16K so I didnt find the need for it to be optified so its installed in /usr/bin itself.

hope that helps

cheers

shadowjk
01-05-2010, 06:15 AM
So, I tested the behaviour on N800, whee we know how to talk to the bme daemon directly. I sampled current consumption and charger current every second, added them together and integrated.

Short story:
N800 charged to 976mAh from first battery low. I called that 100%.
It waited until 94.5%, then activatedcharging for a minute, bringing it up to 95.5%. It kept the charge level between 94.5 and 95.5 repeatedly.

We should probably be happy with libhal and hald-addon-bme on N900. On the previous N800 and N810 it reports a constant 100% until it thinks battery is 50% full, at which point it starts saying 75% :)

Phantasm
01-14-2010, 07:27 PM
What is the current status of the widget? Any idea when might it move into non-devel repository? And based on the weird starting method, does it make useless extra icon in the programs 'more' menu?

krk969
01-14-2010, 07:36 PM
What is the current status of the widget? Any idea when might it move into non-devel repository? And based on the weird starting method, does it make useless extra icon in the programs 'more' menu?

Currently it seems there is no way to add a QT app on the desktop through the add widget option.

The way to add a QT widget to your desktop is

1. create a shortcut to the app.
2. click on the app icon on the desktop.

( of course you could always start it from the command line using run_batlevel command )

I'll be working on adding it to status menu as QT starts opening up for api's to do the same.
Id prefer to promote to extras then as even I dont like the way its currently started :rolleyes:
but it works alright once on the desktop and reports accurately without consuming much battery , atleast for me. :)

kopte3
01-14-2010, 09:48 PM
Screen shot please? :)

nashith
01-14-2010, 10:19 PM
Nice widget. I have an idea on an improvement or more of a mod. A lot of people don't use watches anymore and we simply use our mobiles to tell time. The N900 displays time but not battery level on the lock screen. It would be awesome to have this widget show up on that screen. I know it's a bit off-topic but it's just an idea.

DaSilva
01-15-2010, 01:50 AM
It would be really nice if the battery level could be shown in the status area...

krk969
01-15-2010, 01:55 AM
Screen shot please? :)

i dont know who posts on this website, wasnt me, but here goes :) ==> LINK (http://my-maemo.com/software/applications.php?name=BatLevel&fldAuto=1098&faq=32)

krk969
01-15-2010, 02:00 AM
It would be really nice if the battery level could be shown in the status area...

As i said I'll begin working on this as QT provides something to do it.
At the moment it seems there are some convoluted ways to perform the same action, not sure if it works well though, some discussions for this are happening on the mailing lists, nothing concrete yet AFAIK.

currently spending more time on the londonTubeApp to enhance it with more functions, as i always get confused when using tubes in london :D