mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix sound tip
Change-Id: I25683d0866eaa6c38837ba53c7f49c5de44e451d
This commit is contained in:
parent
14952c45ed
commit
f2bc0f8868
Notes:
Deepin Code Review
2016-11-08 11:16:11 +08:00
Verified+1: Anonymous Coward #1000004 Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Tue, 08 Nov 2016 11:16:03 +0800 Reviewed-on: https://cr.deepin.io/17269 Project: dde/dde-dock Branch: refs/heads/master
@ -20,10 +20,11 @@ SoundItem::SoundItem(QWidget *parent)
|
||||
|
||||
m_tipsLabel->setObjectName("sound");
|
||||
m_tipsLabel->setVisible(false);
|
||||
// m_tipsLabel->setFixedWidth(145);
|
||||
// m_tipsLabel->setFixedWidth(145);
|
||||
m_tipsLabel->setAlignment(Qt::AlignCenter);
|
||||
m_tipsLabel->setStyleSheet("color:white;"
|
||||
"padding:5px 10px;");
|
||||
"padding:5px 10px;"
|
||||
"margin:0px 10px 0px");
|
||||
|
||||
m_applet->setVisible(false);
|
||||
|
||||
@ -35,7 +36,7 @@ QWidget *SoundItem::tipsWidget()
|
||||
{
|
||||
refershTips(true);
|
||||
|
||||
m_tipsLabel->setFixedWidth(m_tipsLabel->sizeHint().width() + 10);
|
||||
m_tipsLabel->setFixedWidth(m_tipsLabel->sizeHint().width());
|
||||
|
||||
return m_tipsLabel;
|
||||
}
|
||||
@ -171,7 +172,15 @@ void SoundItem::refershTips(const bool force)
|
||||
if (!force && !m_tipsLabel->isVisible())
|
||||
return;
|
||||
|
||||
const QString value = QString::number(m_applet->volumeValue() / 10) + '%';
|
||||
if(!m_sinkInter)
|
||||
return;
|
||||
|
||||
QString value;
|
||||
if (m_sinkInter->mute()) {
|
||||
value = QString("0") + '%';
|
||||
} else {
|
||||
value = QString::number(m_applet->volumeValue() / 10) + '%';
|
||||
}
|
||||
m_tipsLabel->setText(QString(tr("Current Volume %1").arg(value)));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user