![]() |
2010-05-12
, 20:40
|
Posts: 44 |
Thanked: 186 times |
Joined on Apr 2010
@ Worthing, West Sussex, England
|
#2
|
public slots: void shutter_property_modified(int num_updates, QList<Property> updates); void focus_property_modified(int num_updates, QList<Property> updates);
struct Property { QString name; bool added; bool removed; };
Q_DECLARE_METATYPE(Property) Q_DECLARE_METATYPE(QList<Property>) const QDBusArgument & operator<<(QDBusArgument &arg, const Property &change) { arg.beginStructure(); arg << change.name << change.added << change.removed; arg.endStructure(); return arg; } const QDBusArgument & operator>>(const QDBusArgument &arg, Property &change) { arg.beginStructure(); arg >> change.name >> change.added >> change.removed; arg.endStructure(); return arg; }
qDBusRegisterMetaType< Property >(); qDBusRegisterMetaType< QList<Property> >();
#define DBUS_SHUTTER_RELEASE_BUTTON "/org/freedesktop/Hal/devices/platform_cam_launch" #define DBUS_FOCUS_BUTTON "/org/freedesktop/Hal/devices/platform_cam_focus" QDBusConnection::systemBus().connect( QString(), DBUS_SHUTTER_RELEASE_BUTTON, "org.freedesktop.Hal.Device", "PropertyModified", this, SLOT(shutter_property_modified(int, QList<Property>))); QDBusConnection::systemBus().connect( QString(), DBUS_FOCUS_BUTTON, "org.freedesktop.Hal.Device", "PropertyModified", this, SLOT(focus_property_modified(int, QList<Property>)));
void Camera::shutter_property_modified(int num_updates, QList<Property> updates) { QDBusInterface propertyInterface("org.freedesktop.Hal", DBUS_SHUTTER_RELEASE_BUTTON, "org.freedesktop.Hal.Device", QDBusConnection::systemBus()); bool pressed = propertyInterface.call("GetProperty", "button.state.value").arguments().at(0).toBool(); if (pressed) { capture_image(); } } void Camera::focus_property_modified(int num_updates, QList<Property> updates) { QDBusInterface propertyInterface("org.freedesktop.Hal", DBUS_FOCUS_BUTTON, "org.freedesktop.Hal.Device", QDBusConnection::systemBus()); bool pressed = propertyInterface.call("GetProperty", "button.state.value").arguments().at(0).toBool(); if (pressed) { focus(); } }
The Following 9 Users Say Thank You to fieldofcows For This Useful Post: | ||
![]() |
2010-05-13
, 03:43
|
Posts: 38 |
Thanked: 2 times |
Joined on Apr 2010
@ Novosibirsk, Russia
|
#3
|
![]() |
2010-05-13
, 07:16
|
Posts: 44 |
Thanked: 186 times |
Joined on Apr 2010
@ Worthing, West Sussex, England
|
#4
|
fieldofcows, I want to say 'Thanks' you 1 billion time! =) It was really awesome! I did not expect such complete solution, I was tuned in for a long brainstorming, but You have saved my brains! Thanks, thanks, thanks!!! =)
QProcess process; process.execute("/usr/sbin/dsmetool -k /usr/bin/camera-ui");
process.execute("/usr/sbin/dsmetool -t /usr/bin/camera-ui");
![]() |
2010-05-13
, 11:22
|
Posts: 38 |
Thanked: 2 times |
Joined on Apr 2010
@ Novosibirsk, Russia
|
#5
|
![]() |
2010-09-16
, 15:00
|
Posts: 23 |
Thanked: 0 times |
Joined on Mar 2010
|
#6
|
![]() |
2010-09-16
, 16:01
|
Posts: 26 |
Thanked: 3 times |
Joined on Aug 2010
@ Nigeria
|
#7
|
I have a problem, my camera button is too sensible, the camera is ON! Can anyone help me?
![]() |
2010-09-16
, 19:22
|
Posts: 23 |
Thanked: 0 times |
Joined on Mar 2010
|
#8
|
Hi Fifthelement,
Does this happen when the led of your camera is closed?
Cheers
![]() |
2011-01-18
, 21:30
|
Posts: 23 |
Thanked: 0 times |
Joined on Mar 2010
|
#10
|
Somebody knows how to work with camera button in my Qt application? My first thought is to somehow use DBus, I started investigate this solution but by this time no result had received.
Actually I have to know when button is half-pressed and full-pressed. I think it is implemented by some signal`s mechanism, but which one?
ADD:
Looked at DBus by
Last edited by Grinchman; 2010-05-12 at 08:15. Reason: Some features are found