summaryrefslogtreecommitdiff
path: root/libresourceqt
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 /libresourceqt
parent5e7214d0fce9b9214a076d01b9e318d097aa41b4 (diff)
downloadlibresourceqt-3f7ebe2f161b0d18f55d547b530f5a999488e03f.tar.gz
merging with the swp.plcy-357-harmattan branch
Diffstat (limited to 'libresourceqt')
-rw-r--r--libresourceqt/include/qt4/policy/resource-set.h1
-rw-r--r--libresourceqt/include/qt4/policy/resource.h1
-rw-r--r--libresourceqt/include/qt4/policy/resources.h11
-rw-r--r--libresourceqt/libresourceqt1.pc2
-rw-r--r--libresourceqt/src/resource-engine.cpp7
-rw-r--r--libresourceqt/src/resource-set.cpp31
-rw-r--r--libresourceqt/src/resources.cpp20
7 files changed, 58 insertions, 15 deletions
diff --git a/libresourceqt/include/qt4/policy/resource-set.h b/libresourceqt/include/qt4/policy/resource-set.h
index ad5aa44..b3da922 100644
--- a/libresourceqt/include/qt4/policy/resource-set.h
+++ b/libresourceqt/include/qt4/policy/resource-set.h
@@ -242,6 +242,7 @@ private:
bool pendingAcquire;
bool pendingUpdate;
bool pendingAudioProperties;
+ bool haveAudioProperties;
void registerAudioProperties();
diff --git a/libresourceqt/include/qt4/policy/resource.h b/libresourceqt/include/qt4/policy/resource.h
index 4f9b02e..7f10b97 100644
--- a/libresourceqt/include/qt4/policy/resource.h
+++ b/libresourceqt/include/qt4/policy/resource.h
@@ -23,6 +23,7 @@ enum ResourceType {
ScaleButtonType, ///< The scale (zoom) button
SnapButtonType, ///< Use this if you are a camera application
LensCoverType,
+ HeadsetButtonsType, ///< Use this to reserve the headset buttons
NumberOfTypes
};
diff --git a/libresourceqt/include/qt4/policy/resources.h b/libresourceqt/include/qt4/policy/resources.h
index c0d0eab..acd816f 100644
--- a/libresourceqt/include/qt4/policy/resources.h
+++ b/libresourceqt/include/qt4/policy/resources.h
@@ -120,6 +120,17 @@ public:
virtual ResourceType type() const;
};
+
+class HeadsetButtonsResource: public Resource
+{
+public:
+ HeadsetButtonsResource();
+ HeadsetButtonsResource(const HeadsetButtonsResource &other);
+ virtual ~HeadsetButtonsResource();
+
+ virtual ResourceType type() const;
+};
+
}
#endif
diff --git a/libresourceqt/libresourceqt1.pc b/libresourceqt/libresourceqt1.pc
index d4e36c8..80e4b07 100644
--- a/libresourceqt/libresourceqt1.pc
+++ b/libresourceqt/libresourceqt1.pc
@@ -5,7 +5,7 @@ includedir=${prefix}/include/resource/qt4
Name: libresourceqt1
Description: Maemo resource management Qt API
-Version: 1.8
+Version: 1.10
Libs: -L${libdir} -lresourceqt
Cflags: -I${includedir}
Requires: dbus-1 libdbus-qeventloop1 libresource0
diff --git a/libresourceqt/src/resource-engine.cpp b/libresourceqt/src/resource-engine.cpp
index 711669b..7687b8f 100644
--- a/libresourceqt/src/resource-engine.cpp
+++ b/libresourceqt/src/resource-engine.cpp
@@ -237,7 +237,7 @@ bool ResourceEngine::connectToManager()
resourceMessage.record.rset.all = allResources;
resourceMessage.record.rset.opt = optionalResources;
resourceMessage.record.rset.share = 0;
- resourceMessage.record.rset.mask = connectionMode;
+ resourceMessage.record.rset.mask = 0;
QByteArray ba = resourceSet->applicationClass().toLatin1();
resourceMessage.record.klass = ba.data();
@@ -325,6 +325,8 @@ quint32 ResourcePolicy::resourceTypeToLibresourceType(ResourceType type)
return RESMSG_SNAP_BUTTON;
case LensCoverType:
return RESMSG_LENS_COVER;
+ case HeadsetButtonsType:
+ return RESMSG_HEADSET_BUTTONS;
default:
return 0;
}
@@ -492,7 +494,7 @@ bool ResourceEngine::updateResources()
message.record.rset.all = allResources;
message.record.rset.opt = optionalResources;
message.record.rset.share = 0;
- message.record.rset.mask = connectionMode;
+ message.record.rset.mask = 0;
QByteArray ba = resourceSet->applicationClass().toLatin1();
message.record.klass = ba.data();
@@ -548,6 +550,7 @@ bool ResourceEngine::registerAudioProperties(const QString &audioGroup, quint32
qDebug("ResourceEngine(%d) - audio %u:%u", identifier, resourceSet->id(), requestId);
int success = resproto_send_message(libresourceSet, &message, statusCallbackHandler);
+ qDebug("ResourceEngine(%d) - resproto_send_message returned %d", identifier, success);
if(!success)
return false;
diff --git a/libresourceqt/src/resource-set.cpp b/libresourceqt/src/resource-set.cpp
index 7dfd5d7..8ddb54b 100644
--- a/libresourceqt/src/resource-set.cpp
+++ b/libresourceqt/src/resource-set.cpp
@@ -84,7 +84,7 @@ void ResourceSet::addResourceObject(Resource *resource)
}
else if (audioResource->audioGroupIsSet()) {
qDebug("ResourceSet::%s().... %d registering audio proprerties later", __FUNCTION__, __LINE__);
- pendingAudioProperties = true;
+ pendingAudioProperties = true;
}
}
}
@@ -129,6 +129,9 @@ bool ResourceSet::addResource(ResourceType type)
case LensCoverType:
resource = new LensCoverResource;
break;
+ case HeadsetButtonsType:
+ resource = new HeadsetButtonsResource;
+ break;
default:
return false;
}
@@ -290,14 +293,9 @@ void ResourceSet::registerAudioProperties()
qDebug("%s(): initializing...", __FUNCTION__);
pendingAudioProperties = true;
initialize();
+ return;
}
- if (!resourceEngine->isConnectedToManager() && !resourceEngine->isConnectingToManager()) {
- qDebug("%s(): Connecting to Manager...", __FUNCTION__);
-
- pendingAudioProperties = true;
- resourceEngine->connectToManager();
- }
- else {
+ else if (resourceEngine->isConnectedToManager()) {
qDebug("Registering new audio settings:");
qDebug() << "\taudio group: " << audioResource->audioGroup();
qDebug() << "\tPID: " << audioResource->processID();
@@ -306,12 +304,21 @@ void ResourceSet::registerAudioProperties()
if((audioResource->processID() > 0) && audioResource->streamTagName() != "media.name") {
qWarning() << "streamTagName should be 'media.name' it is '" << audioResource->streamTagName() << "'";
}
- resourceEngine->registerAudioProperties(audioResource->audioGroup(),
- audioResource->processID(),
- audioResource->streamTagName(),
- audioResource->streamTagValue());
+ bool r = resourceEngine->registerAudioProperties(audioResource->audioGroup(),
+ audioResource->processID(),
+ audioResource->streamTagName(),
+ audioResource->streamTagValue());
+ qDebug("resourceEngine->registerAudioProperties returned %s", r?"true":"false");
+
pendingAudioProperties = false;
}
+ else { //if (!resourceEngine->isConnectedToManager() && !resourceEngine->isConnectingToManager()) {
+ qDebug("%s(): Connecting to Manager...", __FUNCTION__);
+
+ pendingAudioProperties = true;
+ resourceEngine->connectToManager();
+ return;
+ }
}
void ResourceSet::handleGranted(quint32 bitmaskOfGrantedResources)
diff --git a/libresourceqt/src/resources.cpp b/libresourceqt/src/resources.cpp
index d0ac8f0..404d634 100644
--- a/libresourceqt/src/resources.cpp
+++ b/libresourceqt/src/resources.cpp
@@ -210,3 +210,23 @@ ResourceType LensCoverResource::type() const
{
return LensCoverType;
}
+
+HeadsetButtonsResource::HeadsetButtonsResource()
+ : Resource()
+{
+}
+
+HeadsetButtonsResource::HeadsetButtonsResource(const HeadsetButtonsResource &other)
+ : Resource(other)
+{
+}
+
+HeadsetButtonsResource::~HeadsetButtonsResource()
+{
+}
+
+ResourceType HeadsetButtonsResource::type() const
+{
+ return HeadsetButtonsType;
+}
+