fix sound tip

Change-Id: I25683d0866eaa6c38837ba53c7f49c5de44e451d
This commit is contained in:
kirigayakazushin 2016-11-04 17:34:48 +08:00
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

View File

@ -23,7 +23,8 @@ SoundItem::SoundItem(QWidget *parent)
// 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)));
}