From 9ab5fef7ee91a788a9010b7f7fc64ded928201c2 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Thu, 27 Feb 2020 18:50:59 +0000 Subject: sleepinhibitor: disable inhibition on pause git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9251 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/sleepinhibitor/sleepinhibitor.cpp | 9 +++++---- src/plugins/General/sleepinhibitor/sleepinhibitor.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/General/sleepinhibitor/sleepinhibitor.cpp b/src/plugins/General/sleepinhibitor/sleepinhibitor.cpp index 7e28e7d7d..93120df85 100644 --- a/src/plugins/General/sleepinhibitor/sleepinhibitor.cpp +++ b/src/plugins/General/sleepinhibitor/sleepinhibitor.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Ilya Kotov * + * Copyright (C) 2019-2020 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -40,7 +40,7 @@ void SleepInhibitor::onStateChanged(Qmmp::State state) { if(state == Qmmp::Playing) inhibit(); - else if(state == Qmmp::Stopped) + else if(state != Qmmp::Buffering) uninhibit(); } @@ -49,11 +49,12 @@ void SleepInhibitor::inhibit() if(m_lock) return; + static const QString method = QStringLiteral("Inhibit"); static const QString what = QStringLiteral("sleep:idle"); - static const QString who = QStringLiteral("fly-music"); + static const QString who = QStringLiteral("qmmp"); static const QString why = QStringLiteral("Playing audio"); static const QString mode = QStringLiteral("block"); - QDBusReply fd = m_interface->call(QStringLiteral("Inhibit"), what, who, why, mode); + QDBusReply fd = m_interface->call(method, what, who, why, mode); m_lock.reset(new QDBusUnixFileDescriptor(fd)); } diff --git a/src/plugins/General/sleepinhibitor/sleepinhibitor.h b/src/plugins/General/sleepinhibitor/sleepinhibitor.h index 7d8fa0907..81652a606 100644 --- a/src/plugins/General/sleepinhibitor/sleepinhibitor.h +++ b/src/plugins/General/sleepinhibitor/sleepinhibitor.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2019 by Ilya Kotov * + * Copyright (C) 2019-2020 by Ilya Kotov * * forkotov02@ya.ru * * * * This program is free software; you can redistribute it and/or modify * -- cgit v1.2.3-13-gbd6f