summaryrefslogtreecommitdiff
path: root/libresourceqt/include/qt4
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-17 11:40:38 +0200
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-17 11:40:38 +0200
commit28aaf4eb7d89bba113d27a9a39fc787a03a05e31 (patch)
tree67f353cda2b44b419d108f5c91e0cf5d1fa27f7a /libresourceqt/include/qt4
parente288abf93cc33ce7f6d535e1e5d887e8f9628119 (diff)
downloadlibresourceqt-28aaf4eb7d89bba113d27a9a39fc787a03a05e31.tar.gz
Implemented release, update and related callbacks (grant, release, lost
resources). Initial implementation of audio (group only at this stage).
Diffstat (limited to 'libresourceqt/include/qt4')
-rw-r--r--libresourceqt/include/qt4/policy/audio-resource.h42
-rw-r--r--libresourceqt/include/qt4/policy/resource-set.h26
-rw-r--r--libresourceqt/include/qt4/policy/resources.h35
3 files changed, 64 insertions, 39 deletions
diff --git a/libresourceqt/include/qt4/policy/audio-resource.h b/libresourceqt/include/qt4/policy/audio-resource.h
new file mode 100644
index 0000000..1736fdb
--- /dev/null
+++ b/libresourceqt/include/qt4/policy/audio-resource.h
@@ -0,0 +1,42 @@
+#ifndef AUDIO_RESOURCE_H
+#define AUDIO_RESOURCE_H
+
+#include <QObject>
+#include <QString>
+#include <policy/resource.h>
+
+namespace ResourcePolicy
+{
+
+class AudioResource: public QObject, public Resource
+{
+ Q_OBJECT
+public:
+ AudioResource(const QString &audioGroup = QString());
+ AudioResource(const AudioResource &other);
+ virtual ~AudioResource();
+
+ QString audioGroup() const;
+ void setAudioGroup(const QString & newGroup);
+
+ quint32 processID() const;
+ void setProcessID(quint32 newPID);
+
+ QString streamTag() const;
+ void setStreamTag(const QString & newStreamTag);
+
+ virtual ResourceType type() const;
+ virtual Resource * clone() const;
+private:
+ QString group;
+ quint32 pid;
+ QString stream;
+signals:
+ void pidChanged(quint32 newPid);
+ void audioGroupChanged(const QString &newGroup);
+ void streamTagChanged(const QString &newTag);
+};
+}
+
+#endif
+
diff --git a/libresourceqt/include/qt4/policy/resource-set.h b/libresourceqt/include/qt4/policy/resource-set.h
index 447dc8b..1f38c11 100644
--- a/libresourceqt/include/qt4/policy/resource-set.h
+++ b/libresourceqt/include/qt4/policy/resource-set.h
@@ -6,6 +6,7 @@
#include <QVector>
#include <QList>
#include <policy/resources.h>
+#include <policy/audio-resource.h>
/**
* \mainpage Resource Policy Library
@@ -88,7 +89,7 @@ public:
* \param resource The resource to add to the set. A copy of this object
* is stored in the Set.
*/
- void addResource(const Resource *resource);
+ void addResource(Resource *resource);
/**
* This method adds all resources in the list to the set.
* A set contains only a single instance of a given resource. If the
@@ -193,10 +194,14 @@ signals:
*/
void resourcesDenied();
/**
+ * This signal is emited as a response to the release() request.
+ */
+ void resourcesReleased();
+ /**
* This signal is emited when some other program with a higher priority
- * superseeds us, and as a result we loose our resources.
+ * superseeds us, and as a result we loose (some of) our resources.
* It is very important to connect to this signal as it is signaling when
- * the acquired resources can't be used anymore.
+ * the acquired resources shouldn't be used anymore.
*/
void lostResources();
@@ -208,16 +213,27 @@ private:
const QString resourceClass;
Resource* resourceSet[NumberOfTypes];
ResourceEngine *resourceEngine;
+ AudioResource *audioResource;
bool autoRelease;
bool alwaysReply;
bool initialized;
bool pendingAcquire;
+ bool pendingUpdate;
+ bool pendingAudioGroup;
+ bool pendingAudioStream;
+ bool pendingAudioPid;
private slots:
void connectedHandler();
- void handleAcquire(quint32);
+ void handleGranted(quint32);
void handleDeny();
-
+ void handleReleased();
+ void handleResourcesLost(quint32);
+ void handleResourcesBecameAvailable(quint32);
+
+ void handleAudioPidChange(quint32 newPid);
+ void handleAudioGroupChange(const QString &newGroup);
+ void handleAudioStreamTagChanged(const QString &newGroup);
};
}
diff --git a/libresourceqt/include/qt4/policy/resources.h b/libresourceqt/include/qt4/policy/resources.h
index f00cc2e..26ce014 100644
--- a/libresourceqt/include/qt4/policy/resources.h
+++ b/libresourceqt/include/qt4/policy/resources.h
@@ -8,46 +8,13 @@
namespace ResourcePolicy
{
-class AudioResource: public Resource
-{
-public:
- AudioResource(const QString &audioGroup = QString());
- AudioResource(const AudioResource &other);
- virtual ~AudioResource();
-
- QString audioGroup() const;
- void setAudioGroup(const QString & newGroup);
-
- quint32 processID() const;
- void setProcessID(quint32 newPID);
-
- QString streamTag() const;
- void setStreamTag(const QString & newStreamTag);
-
- virtual ResourceType type() const;
- virtual Resource * clone() const;
-private:
- QString group;
- quint32 pid;
- QString stream;
-};
-
class AudioRecorderResource: public Resource
{
public:
- AudioRecorderResource(const QString & audioGroup = QString());
+ AudioRecorderResource();
AudioRecorderResource(const AudioRecorderResource &other);
virtual ~AudioRecorderResource();
- QString audioGroup() const;
- void setAudioGroup(const QString & newGroup);
-
- quint32 processID() const;
- void setProcessID(quint32 newPID);
-
- QString streamTag() const;
- void setStreamTag(const QString & newStreamTag);
-
virtual ResourceType type() const;
virtual Resource * clone() const;
private: