summaryrefslogtreecommitdiffstats
path: root/src/plugins/resourcepolicy/resourcepolicyimpl.cpp
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/resourcepolicyimpl.cpp
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/resourcepolicyimpl.cpp')
-rw-r--r--src/plugins/resourcepolicy/resourcepolicyimpl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/resourcepolicy/resourcepolicyimpl.cpp b/src/plugins/resourcepolicy/resourcepolicyimpl.cpp
index 3ad92fa1f..b3c370f67 100644
--- a/src/plugins/resourcepolicy/resourcepolicyimpl.cpp
+++ b/src/plugins/resourcepolicy/resourcepolicyimpl.cpp
@@ -61,7 +61,8 @@ ResourcePolicyImpl::ResourcePolicyImpl(QObject *parent)
ResourcePolicyImpl::~ResourcePolicyImpl()
{
ResourcePolicyInt *set = globalResourcePolicyInt;
- set->removeClient(this);
+ if (!globalResourcePolicyInt.isDestroyed())
+ set->removeClient(this);
}
bool ResourcePolicyImpl::isVideoEnabled() const