[Pkg-mpd-commits] [qmpdclient] 13/38: controlpanel: disable volume slider when MPD does not provide volume control

Andrey Rahmatullin wrar at moszumanska.debian.org
Mon May 23 07:19:45 UTC 2016


This is an automated email from the git hooks/post-receive script.

wrar pushed a commit to branch master
in repository qmpdclient.

commit ee4fe36f84aaf70e22579c2c76712fec8d6764a8
Author: Denis Krjuchkov <denis at crazydev.net>
Date:   Sat Mar 31 12:58:50 2012 +0600

    controlpanel: disable volume slider when MPD does not provide volume control
---
 src/controlpanel.cpp | 17 ++++++++++++++++-
 src/controlpanel.h   |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/controlpanel.cpp b/src/controlpanel.cpp
index 9310479..5543d33 100644
--- a/src/controlpanel.cpp
+++ b/src/controlpanel.cpp
@@ -37,6 +37,7 @@ ControlPanel::ControlPanel(QWidget *parent) : QWidget(parent), 	m_coverArt(new C
 	Q_ASSERT(m_lastFm);
 	setupUi(this);
 	coverArtButton->setVisible(false);
+	updateVolume(-1);
 
 	connect(prevButton, SIGNAL(clicked()), MPD::instance(), SLOT(prev()));
 	connect(playButton, SIGNAL(clicked()), MPD::instance(), SLOT(play()));
@@ -46,7 +47,7 @@ ControlPanel::ControlPanel(QWidget *parent) : QWidget(parent), 	m_coverArt(new C
 	connect(volumeSlider, SIGNAL(valueChanged(int)), MPD::instance(), SLOT(setVolume(int)));
 	connect(timeSlider, SIGNAL(timeChanged(int)), MPD::instance(), SLOT(seek(int)));
 	connect(timeSlider, SIGNAL(valueChanged(int)), elapsedLabel, SLOT(setTime(int)));
-	connect(MPD::instance(), SIGNAL(volumeUpdated(int)), volumeSlider, SLOT(setValue(int)));
+	connect(MPD::instance(), SIGNAL(volumeUpdated(int)), this, SLOT(updateVolume(int)));
 	connect(MPD::instance(), SIGNAL(timeUpdated(int, int)), elapsedLabel, SLOT(setTime(int, int)));
 	connect(MPD::instance(), SIGNAL(timeUpdated(int, int)), totalLabel, SLOT(setTime(int, int)));
 	connect(MPD::instance(), SIGNAL(timeUpdated(int, int)), timeSlider, SLOT(setTime(int, int)));
@@ -144,3 +145,17 @@ void ControlPanel::setSong(const MPDSong &s) {
 void ControlPanel::showCoverArtChanged(bool a) {
 	coverArtButton->setVisible(a && m_coverArt->hasCoverArt());
 }
+
+void ControlPanel::updateVolume(int volume) {
+	if (volume < 0) {
+		volumeLabel->setEnabled(false);
+		volumeSlider->setEnabled(false);
+		volumeSlider->setValue(0);
+	}
+	else {
+		volumeLabel->setEnabled(true);
+		volumeSlider->setEnabled(true);
+		volumeSlider->setValue(volume);
+	}
+}
+
diff --git a/src/controlpanel.h b/src/controlpanel.h
index 0b36aca..0442177 100644
--- a/src/controlpanel.h
+++ b/src/controlpanel.h
@@ -39,6 +39,7 @@ public slots:
 private slots:
 	void setSong(const MPDSong &);
 	void showCoverArtChanged(bool);
+	void updateVolume(int);
 
 private:
 	CoverArtDialog *m_coverArt;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/qmpdclient.git



More information about the Pkg-mpd-commits mailing list