summaryrefslogtreecommitdiff
path: root/resourceqt-client
diff options
context:
space:
mode:
authorJanos Kovacs <janos.f.kovacs@nokia.com>2010-06-28 14:08:00 +0300
committerJanos Kovacs <janos.f.kovacs@nokia.com>2010-06-28 14:08:00 +0300
commit3f7ebe2f161b0d18f55d547b530f5a999488e03f (patch)
tree012b4edfcee65785ca752f4bc0a8e90f881f8170 /resourceqt-client
parent5e7214d0fce9b9214a076d01b9e318d097aa41b4 (diff)
merging with the swp.plcy-357-harmattan branch
Diffstat (limited to 'resourceqt-client')
-rw-r--r--resourceqt-client/client.cpp24
-rw-r--r--resourceqt-client/client.h2
-rw-r--r--resourceqt-client/resourceqt-client.cpp1
3 files changed, 24 insertions, 3 deletions
diff --git a/resourceqt-client/client.cpp b/resourceqt-client/client.cpp
index 46fd8c9..5f1875b 100644
--- a/resourceqt-client/client.cpp
+++ b/resourceqt-client/client.cpp
@@ -52,6 +52,7 @@ uint32_t Client::parseResourceList(QString resourceListStr)
{ RES_SCALE_BUTTON , "ScaleButton" },
{ RES_SNAP_BUTTON , "SnapButton" },
{ RES_LENS_COVER , "LensCover" },
+ { RES_HEADSET_BUTTONS, "HeadsetButtons" },
{ 0 , NULL }
};
@@ -96,7 +97,7 @@ void Client::updateSet(uint32_t list, uint32_t optional, bool remove)
uint32_t resources[] = {
RES_AUDIO_PLAYBACK, RES_VIDEO_PLAYBACK, RES_AUDIO_RECORDING, RES_VIDEO_RECORDING,
RES_VIBRA, RES_LEDS, RES_BACKLIGHT, RES_SYSTEM_BUTTON, RES_LOCK_BUTTON,
- RES_SCALE_BUTTON, RES_SNAP_BUTTON, RES_LENS_COVER, 0
+ RES_SCALE_BUTTON, RES_SNAP_BUTTON, RES_LENS_COVER, RES_HEADSET_BUTTONS, 0
};
int pos = 0;
@@ -174,6 +175,9 @@ bool Client::initialize(uint32_t all, uint32_t optional, bool alwaysReply, bool
}
connect(resourceSet, SIGNAL(resourcesReleased()), this, SLOT(resourceReleasedHandler()));
+ connect(resourceSet, SIGNAL(resourcesBecameAvailable(const QList<ResourcePolicy::ResourceType> &)),
+ this, SLOT(resourcesBecameAvailableHandler(const QList<ResourcePolicy::ResourceType> &)));
+
showPrompt();
return true;
@@ -220,6 +224,9 @@ Resource* Client::allocateResource(ResourceType resource, bool optional)
case LensCoverType:
retValue = new LensCoverResource();
break;
+ case HeadsetButtonsType:
+ retValue = new HeadsetButtonsResource();
+ break;
case NumberOfTypes:
return NULL;
}
@@ -261,6 +268,8 @@ ResourceType Client::getResourceType(uint32_t resource)
return SnapButtonType;
case RES_LENS_COVER:
return LensCoverType;
+ case RES_HEADSET_BUTTONS:
+ return HeadsetButtonsType;
}
return NumberOfTypes;
@@ -271,7 +280,7 @@ void Client::showResources(const QList<ResourceType> resList)
const char* resTypes[] = {
"AudioPlayback", "VideoPlayback", "AudioRecorder", "VideoRecorder", "Vibra",
"Leds", "Backlight", "SystemButton", "LockButton", "ScaleButton", "SnapButton",
- "LensCover"
+ "LensCover", "HeadsetButtons"
};
for (int i = 0; i < resList.count(); i++) {
@@ -284,7 +293,7 @@ void Client::showResources(const QList<Resource*> resList)
const char* resTypes[] = {
"AudioPlayback", "VideoPlayback", "AudioRecorder", "VideoRecorder", "Vibra",
"Leds", "Backlight", "SystemButton", "LockButton", "ScaleButton", "SnapButton",
- "LensCover"
+ "LensCover", "HeadsetButtons"
};
for (int i = 0; i < resList.count(); i++) {
@@ -343,6 +352,14 @@ void Client::resourceReleasedHandler()
showPrompt();
}
+void Client::resourcesBecameAvailableHandler(const QList<ResourcePolicy::ResourceType> &availableResources)
+{
+ printf("\nManager advice: These resources are available:\n");
+ printf("Resource set:\n");
+ showResources(availableResources);
+ showPrompt();
+}
+
void Client::timerEvent(QTimerEvent*)
{
bool quitFlag = false;
@@ -530,3 +547,4 @@ void Client::timerEvent(QTimerEvent*)
}
}
}
+
diff --git a/resourceqt-client/client.h b/resourceqt-client/client.h
index c61a74c..3100160 100644
--- a/resourceqt-client/client.h
+++ b/resourceqt-client/client.h
@@ -19,6 +19,7 @@
#define RES_SCALE_BUTTON (1<<9)
#define RES_SNAP_BUTTON (1<<10)
#define RES_LENS_COVER (1<<11)
+#define RES_HEADSET_BUTTONS (1<<12)
class TimeStat
{
@@ -94,6 +95,7 @@ private slots:
void resourceDeniedHandler();
void resourceLostHandler();
void resourceReleasedHandler();
+ void resourcesBecameAvailableHandler(const QList<ResourcePolicy::ResourceType> &availableResources);
protected:
void timerEvent(QTimerEvent *e);
diff --git a/resourceqt-client/resourceqt-client.cpp b/resourceqt-client/resourceqt-client.cpp
index 02bfbc3..522ce8d 100644
--- a/resourceqt-client/resourceqt-client.cpp
+++ b/resourceqt-client/resourceqt-client.cpp
@@ -178,6 +178,7 @@ private:
printf("\t\tScaleButton\n");
printf("\t\tSnapButton\n");
printf("\t\tLensCover\n");
+ printf("\t\tHeadsetButtons\n");
printf("\t no whitespace allowed in the resource list.\n");
printf("\tmodes:\n");
printf("\t comma separated list of the following modes\n");