From 84a80191d51b0774f89d849cb9095b0ee907f12a Mon Sep 17 00:00:00 2001 From: Martin Wolf Date: Fri, 12 Feb 2010 18:20:11 +0200 Subject: Added Qt resource client --- resourceqt-client/client.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 resourceqt-client/client.h (limited to 'resourceqt-client/client.h') diff --git a/resourceqt-client/client.h b/resourceqt-client/client.h new file mode 100644 index 0000000..3399d02 --- /dev/null +++ b/resourceqt-client/client.h @@ -0,0 +1,62 @@ +#ifndef _CLIENT_H_ +#define _CLIENT_H_ + +#include +#include + +#include + +using namespace ResourcePolicy; + +#define RES_AUDIO_PLAYBACK (1<<0) +#define RES_VIDEO_PLAYBACK (1<<1) +#define RES_AUDIO_RECORDING (1<<2) +#define RES_VIDEO_RECORDING (1<<3) +#define RES_VIBRA (1<<4) +#define RES_LEDS (1<<5) +#define RES_BACKLIGHT (1<<6) +#define RES_SYSTEM_BUTTON (1<<7) +#define RES_LOCK_BUTTON (1<<8) +#define RES_SCALE_BUTTON (1<<9) +#define RES_SNAP_BUTTON (1<<10) +#define RES_LENS_COVER (1<<11) + +class Client : public QObject +{ + Q_OBJECT + +public: + Client(QString appClass); + ~Client(); + + bool initialize(uint32_t all, uint32_t optional); + static uint32_t parseResourceList(QString resourceListStr); + +private slots: + void resourceAcquiredHandler(const QList& resList); + void resourceDeniedHandler(); + void resourceLostHandler(); + +protected: + void timerEvent(QTimerEvent *e); + +private: + QTextStream* standardInput; + int mainTimerID; + + uint32_t resourcesAll; + uint32_t resourcesOptional; + QString applicationClass; + + ResourceSet* resourceSet; + + Resource* allocateResource(ResourceType resource, bool optional); + ResourceType getResourceType(uint32_t resource); + + void showPrompt(); + void showResources(const QList resList); + void showResources(const QList resList); + void updateSet(uint32_t list, uint32_t optional, bool remove); +}; + +#endif -- cgit v1.2.3