summaryrefslogtreecommitdiffstats
path: root/src/plugins/resourcepolicy/resourcepolicyint.h
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@jollamobile.com>2014-07-22 18:23:47 +0200
committerRobin Burchell <robin+qt@viroteck.net>2014-08-04 13:02:22 +0200
commit1c5ea9561ac2686fb01ebd87b2d2b990a27dddad (patch)
treeb20fb0fe73430f18f9cdbe021872d969d15f6ad4 /src/plugins/resourcepolicy/resourcepolicyint.h
parent0ed18d846c0b425b0c50a2fefd7cc0fc148832c2 (diff)
Implement more full resource policy features.
* Handle released by manager properly. Signal resourcesReleasedByManager is different from signal handleResourcesLost and needs to be handled separately. Signal handleResourcesLost means some other client has acquired the resources, thus the resources are lost from us, but if the other client frees the resources, we will automatically get the resources back. With resourcesReleasedByManager we lose the resources, and resource manager releases them as well (same as if client would call release()), so only way to re-acquire resources in latter case is calling acquire() again. This distinction is useful for example in cases where user is listening to music with headphones connected and removes the headphones, then the music player shouldn't continue playback until user requests so. But if user is listening to music when phone call is received, it is convenient to resume the playback automatically after the call. * Implement availability changed. Availability changed is information whether resources the client is interested in are available (no higher priority resource classes have acquired the resources). * Implement missing resources released. Emit resourcesReleased signal when receiving corresponding signal from libresource-qt. * Add mechanism to change used resource class. Check for environment for special variable, and if the variable has proper data, use that as the resource class. Can be set with for example qputenv("NEMO_RESOURCE_CLASS_OVERRIDE", "game"); Change-Id: I8e92f40cc5c01b6b94f54c3fa0f7a07775e87df0 Done-with: Juho Hämäläinen <juho.hamalainen@tieto.com> Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
Diffstat (limited to 'src/plugins/resourcepolicy/resourcepolicyint.h')
-rw-r--r--src/plugins/resourcepolicy/resourcepolicyint.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/plugins/resourcepolicy/resourcepolicyint.h b/src/plugins/resourcepolicy/resourcepolicyint.h
index 39882b527..6290c7540 100644
--- a/src/plugins/resourcepolicy/resourcepolicyint.h
+++ b/src/plugins/resourcepolicy/resourcepolicyint.h
@@ -46,6 +46,8 @@
#include <QObject>
#include <QMap>
+#include <policy/resource-set.h>
+#include <policy/resource.h>
#include <private/qmediaresourceset_p.h>
#include "resourcepolicyimpl.h"
@@ -86,14 +88,20 @@ public:
private slots:
void handleResourcesGranted();
void handleResourcesDenied();
+ void handleResourcesReleased();
void handleResourcesLost();
+ void handleResourcesReleasedByManager();
+ void handleResourcesBecameAvailable(const QList<ResourcePolicy::ResourceType> &resources);
private:
+ void availabilityChanged(bool available);
+
QMap<const ResourcePolicyImpl*, clientEntry> m_clients;
int m_acquired;
ResourceStatus m_status;
int m_video;
+ bool m_available;
ResourcePolicy::ResourceSet *m_resourceSet;
};