Reply
Thread Tools
Posts: 39 | Thanked: 4 times | Joined on Nov 2009
#11
I dont suppose you can get qt 4.6 working? I know it is not as detailed as hal but just asking...

"# System Information API - access and notification of changes in underlying system information (e.g. battery status). "

http://www.allaboutsymbian.com/news/...t_now_avai.php

http://doc.trolltech.com/qtmobility-...eviceinfo.html

QSystemDeviceInfo Class Reference

The QSystemDeviceInfo class provides access to device information from the system. More...

#include <QSystemDeviceInfo>

Inherits QObject.

* List of all members, including inherited members

Public Types
enum BatteryStatus { NoBatteryLevel, BatteryCritical, BatteryVeryLow, BatteryLow, BatteryNormal }
enum InputMethod { Keys, Keypad, Keyboard, SingleTouch, MultiTouch, Mouse }
flags InputMethodFlags
enum PowerState { UnknownPower, BatteryPower, WallPower, WallPowerChargingBattery }
enum Profile { UnknownProfile, SilentProfile, NormalProfile, LoudProfile, ..., CustomProfile }
enum SimStatus { SimNotAvailable, SingleSimAvailable, DualSimAvailable, SimLocked }
Properties

*
batteryLevel : const int
*
batteryStatus : const BatteryStatus
*
currentPowerState : const PowerState
*
currentProfile : const Profile
*
imei : const QString
*
imsi : const QString



*
inputMethodType : const InputMethodFlags
*
isDeviceLocked : const bool
*
manufacturer : const QString
*
model : const QString
*
productName : const QString
*
simStatus : const SimStatus

Last edited by n900_ag; 2009-12-21 at 12:28.
 

The Following 2 Users Say Thank You to n900_ag For This Useful Post:
Posts: 233 | Thanked: 170 times | Joined on Nov 2009 @ Finland
#12
Originally Posted by krk969 View Post
]Problem 3:[/COLOR][/B] Im not able to get the output of "lshal | grep percentage" system command using QProcess.
Warning: lshal | grep percentage will put about 40% cpu load on your cpu if you do it continuously. I wouldn't do it any more often than once a minute.
__________________
Read about my N900 experiences from my blog.
 
Posts: 3,319 | Thanked: 5,610 times | Joined on Aug 2008 @ Finland
#13
In general, polling should be avoided whenever possible, one minute or not.
__________________
Blogging about mobile linux - The Penguin Moves!
Maintainer of PyQt (see introduction and docs), AppWatch, QuickBrownFox, etc
 
Posts: 90 | Thanked: 4 times | Joined on Dec 2009 @ Leicester,UK
#14
has this app been created yet or is it stil in progress?
 
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#15
Originally Posted by ashyk36 View Post
has this app been created yet or is it stil in progress?
working on it.
Ive got the progress indicator working

im at the moment checking out other options to probe the battery level.
Options I have in mind are :

1. poll (using a configurable interval) using lshal | grep percentage, but members have suggested its not the best option . this is my last resort.

2. as n900_ag suggested above use QT mobility API's , QSystemDeviceInfo class which is the most appropriate method I think. I can probe various battery info using this including level.
But Ive been having tough time compiling this package
thread ==> http://talk.maemo.org/showthread.php?t=38117

3. use DBus libs for getting the battery level info. still need to check this one in detail.

i hope i can sort this out before my xmas holidays run out
any ideas and suggestions are most welcome.

cheers.

Last edited by krk969; 2009-12-25 at 14:19.
 
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#16
OK finally !

Ive been able to make an app that reports the battery percentage and using QT mobility api's.

I will post more details about this asap and the steps to follow to build using Qt Mobility api's, seems like there is a bug in the .pro files that comes along with it, I had to manually tweak them to get the builds working.

Now for some quick unit testing and hopefully Ill have something for us to look out for on the boxing day !

in the meanwhile if anybody knows about a link or info related to creating an applet in the task bar please let me know.

cheers

Last edited by krk969; 2009-12-25 at 23:52.
 

The Following User Says Thank You to krk969 For This Useful Post:
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#17
ok the desktop widget is now ready.

but i have some issues where I might need some help again.

1. How can I add this as a desktop widget.
I followed the instructions in the development guide and wiki to create a .desktop file and place it in /usr/share/applications/hildon/.
This didnt work.

my .desktop file looks like this

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=batlevel
Exec=/usr/bin/run_batlevel
Icon=batlevel
X-HildonDesk-ShowInToolbar=true
X-Osso-Type=application/x-executable



the only way I can run it now is using the command line or creating a shortcut to my app.
But the latter, although it puts the widget on the desktop, it opens a new app window that closes automatically after a while or when its minimized ( dont know why that happens as well )

Anyways the above two ways are just a workaround till I can figure how how to add it as a desktop widget from the menu.

2. how can I display a picture as a stylesheet for my QProgressBar ?

Ive copied a .png file in my src directory and have done the following in my code

Widget w;
w.setStyleSheet(QString("QWidget#gui {background-image:url(batlevel.png);}"));

where WIdget is a class inherited from QProgressBar.

I even tried implementing the paintEvent method as Ive read in some places that only QWidget has it implemented, for classes derived from it we need to implement.
so Ive taken an example implementation

void Widget :: paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}


oh btw the Widget has been created as a window that is of type
_HILDON_WM_WINDOW_TYPE_HOME_APPLET which is what makes it a desktop applet.

Atom homeAppletAto = XInternAtom(QX11Info::display(), "_HILDON_WM_WINDOW_TYPE_HOME_APPLET", false);


Im not able to display the png file instead of the normal QProgressBar display.

any help appreciated so I can make this applet look like a battery and not some progress bar .

cheers.

Last edited by krk969; 2009-12-27 at 12:35.
 
Posts: 415 | Thanked: 732 times | Joined on Jan 2009 @ Finland
#18
download qt-example-hildondesktopwidget sources for example. The package is in extras-devel.

Code:
apt-get source qt-example-hildondesktopwidget
 

The Following User Says Thank You to timoph For This Useful Post:
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#19
Originally Posted by timoph View Post
download qt-example-hildondesktopwidget sources for example. The package is in extras-devel.

Code:
apt-get source qt-example-hildondesktopwidget
thanks timoph
but i have done that already. didnt help much.
and even that app doesnt show up in the widget list. It works exacly in the same way as I described in my previous post .

Have you tried this app ? did it work for you ?
 
Posts: 415 | Thanked: 732 times | Joined on Jan 2009 @ Finland
#20
Originally Posted by krk969 View Post
thanks timoph
but i have done that already. didnt help much.
and even that app doesnt show up in the widget list. It works exacly in the same way as I described in my previous post .

Have you tried this app ? did it work for you ?
I tried it and It sort of works. You have to launch it from applications menu and it doesn't come up in the widget list.

I had a quick look at it and noticed 2 things that may prevent it from working correctly. 1) It installs the desktop file in the wrong path (should be in /usr/share/applications/hildon-home/) and 2) it's not compliled as shared object like the other desktop widgets.

Changing the install file path alone didn't fix the problem so I recompiled the example as using lib template and edited the desktop file according to documentation here. The widget is now listed in the widget menu but it cannot be started (Error loading module). I'm thinking it needs some changes in the code in order to get it working as a proper desktop widget (I haven't looked how it's implemented yet). I'll try to get it working some time this week if I have some free time to spare.

I suggest that you join the maemo qt4-devel mailing list. You can get answers to development related questions faster there.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 00:58.