[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:27:55 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=07e0b6f
The following commit has been merged in the master branch:
commit 07e0b6fc4ea3150ca1099391b55956bc4f7c220f
Author: Albert Vaca <albertvaka at gmail.com>
Date: Wed Sep 17 16:41:48 2014 +0200
Added separate options to mute and/or pause players during a call.
Bug: 338951
---
plugins/pausemusic/pausemusic_config.cpp | 15 ++++++----
plugins/pausemusic/pausemusic_config.ui | 50 ++++++++++++++++++++------------
plugins/pausemusic/pausemusicplugin.cpp | 28 ++++++++++++------
plugins/pausemusic/pausemusicplugin.h | 1 +
4 files changed, 61 insertions(+), 33 deletions(-)
diff --git a/plugins/pausemusic/pausemusic_config.cpp b/plugins/pausemusic/pausemusic_config.cpp
index 7833c21..dc24b27 100644
--- a/plugins/pausemusic/pausemusic_config.cpp
+++ b/plugins/pausemusic/pausemusic_config.cpp
@@ -53,6 +53,7 @@ void PauseMusicConfig::defaults()
KCModule::defaults();
m_ui->rad_talking->setChecked(false);
m_ui->rad_ringing->setChecked(true);
+ m_ui->check_pause->setChecked(true);
m_ui->check_mute->setChecked(false);
Q_EMIT changed(true);
}
@@ -61,19 +62,23 @@ void PauseMusicConfig::defaults()
void PauseMusicConfig::load()
{
KCModule::load();
- bool talking = m_cfg->group("pause_condition").readEntry("talking_only", false);
+ bool talking = m_cfg->group("condition").readEntry("talking_only", false);
m_ui->rad_talking->setChecked(talking);
m_ui->rad_ringing->setChecked(!talking);
- bool use_mute = m_cfg->group("use_mute").readEntry("use_mute", false);
- m_ui->check_mute->setChecked(use_mute);
+
+ bool pause = m_cfg->group("actions").readEntry("pause", true);
+ bool mute = m_cfg->group("actions").readEntry("mute", false);
+ m_ui->check_pause->setChecked(pause);
+ m_ui->check_mute->setChecked(mute);
Q_EMIT changed(false);
}
void PauseMusicConfig::save()
{
- m_cfg->group("pause_condition").writeEntry("talking_only", m_ui->rad_talking->isChecked());
- m_cfg->group("use_mute").writeEntry("use_mute", m_ui->check_mute->isChecked());
+ m_cfg->group("condition").writeEntry("talking_only", m_ui->rad_talking->isChecked());
+ m_cfg->group("actions").writeEntry("pause", m_ui->check_pause->isChecked());
+ m_cfg->group("actions").writeEntry("mute", m_ui->check_mute->isChecked());
KCModule::save();
Q_EMIT changed(false);
diff --git a/plugins/pausemusic/pausemusic_config.ui b/plugins/pausemusic/pausemusic_config.ui
index 8b05073..04d870b 100644
--- a/plugins/pausemusic/pausemusic_config.ui
+++ b/plugins/pausemusic/pausemusic_config.ui
@@ -9,14 +9,17 @@
<rect>
<x>0</x>
<y>0</y>
- <width>406</width>
- <height>155</height>
+ <width>368</width>
+ <height>241</height>
</rect>
</property>
<property name="windowTitle">
<string>Pause music plugin</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout_2">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <property name="spacing">
+ <number>20</number>
+ </property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
@@ -26,7 +29,7 @@
</sizepolicy>
</property>
<property name="title">
- <string>Pause condition</string>
+ <string>Condition</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@@ -47,23 +50,32 @@
</widget>
</item>
<item>
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- </spacer>
- </item>
- <item>
- <widget class="QCheckBox" name="check_mute">
- <property name="text">
- <string>Mute system instead of pause</string>
+ <property name="title">
+ <string>Actions</string>
</property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="check_pause">
+ <property name="text">
+ <string>Pause media players</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="check_mute">
+ <property name="text">
+ <string>Mute system sound</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
<item>
diff --git a/plugins/pausemusic/pausemusicplugin.cpp b/plugins/pausemusic/pausemusicplugin.cpp
index cf0d359..c0e1859 100644
--- a/plugins/pausemusic/pausemusicplugin.cpp
+++ b/plugins/pausemusic/pausemusicplugin.cpp
@@ -59,6 +59,7 @@ int PauseMusicPlugin::isKMixMuted() {
PauseMusicPlugin::PauseMusicPlugin(QObject* parent, const QVariantList& args)
: KdeConnectPlugin(parent, args)
+ , muted(false)
{
QDBusInterface kmixInterface("org.kde.kmix", "/kmix/KMixWindow/actions/mute", "org.qtproject.Qt.QAction");
}
@@ -67,7 +68,7 @@ bool PauseMusicPlugin::receivePackage(const NetworkPackage& np)
{
//FIXME: There should be a better way to listen to changes in the config file instead of reading the value each time
KSharedConfigPtr config = KSharedConfig::openConfig("kdeconnect/plugins/pausemusic");
- bool pauseOnlyWhenTalking = config->group("pause_condition").readEntry("talking_only", false);
+ bool pauseOnlyWhenTalking = config->group("condition").readEntry("talking_only", false);
if (pauseOnlyWhenTalking) {
if (np.get<QString>("event") != "talking") {
@@ -80,16 +81,21 @@ bool PauseMusicPlugin::receivePackage(const NetworkPackage& np)
}
bool pauseConditionFulfilled = !np.get<bool>("isCancel");
- bool use_mute = config->group("use_mute").readEntry("use_mute", false);
+
+ bool pause = config->group("actions").readEntry("pause", true);
+ bool mute = config->group("actions").readEntry("mute", false);
if (pauseConditionFulfilled) {
- if (use_mute) {
+
+ if (mute) {
QDBusInterface kmixInterface("org.kde.kmix", "/kmix/KMixWindow/actions/mute", "org.qtproject.Qt.QAction");
if (isKMixMuted() == 0) {
- pausedSources.insert("mute"); //Fake source
+ muted = true;
kmixInterface.call("trigger");
}
- } else {
+ }
+
+ if (pause) {
//Search for interfaces currently playing
QStringList interfaces = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
Q_FOREACH (const QString& iface, interfaces) {
@@ -109,14 +115,18 @@ bool PauseMusicPlugin::receivePackage(const NetworkPackage& np)
}
}
}
+
} else {
- if (pausedSources.empty()) return false;
- if (use_mute) {
+
+ if (mute && muted) {
QDBusInterface kmixInterface("org.kde.kmix", "/kmix/KMixWindow/actions/mute", "org.qtproject.Qt.QAction");
if (isKMixMuted() > 0) {
kmixInterface.call("trigger");
}
- } else {
+ muted = false;
+ }
+
+ if (pause && !pausedSources.empty()) {
Q_FOREACH (const QString& iface, pausedSources) {
QDBusInterface mprisInterface(iface, "/org/mpris/MediaPlayer2", "org.mpris.MediaPlayer2.Player");
//Calling play does not work for Spotify
@@ -126,8 +136,8 @@ bool PauseMusicPlugin::receivePackage(const NetworkPackage& np)
mprisInterface.asyncCall("PlayPause");
//End of workaround
}
+ pausedSources.clear();
}
- pausedSources.clear();
}
diff --git a/plugins/pausemusic/pausemusicplugin.h b/plugins/pausemusic/pausemusicplugin.h
index 8bfa09c..aba9eb5 100644
--- a/plugins/pausemusic/pausemusicplugin.h
+++ b/plugins/pausemusic/pausemusicplugin.h
@@ -46,6 +46,7 @@ public Q_SLOTS:
private:
QSet<QString> pausedSources;
+ bool muted;
};
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list