Add option to show bitrate, sample rate, and format in toolbar.
Issue #1120
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
11. Remember last loaded/saved playlist name - and use this as the default
|
||||
name when saving.
|
||||
12. Fix MPRIS length field.
|
||||
13. Add option to show bitrate, sample rate, and format in toolbar.
|
||||
|
||||
2.2.0
|
||||
-----
|
||||
|
||||
@@ -226,6 +226,7 @@ void InterfaceSettings::load()
|
||||
showStopButton->setChecked(Settings::self()->showStopButton());
|
||||
showCoverWidget->setChecked(Settings::self()->showCoverWidget());
|
||||
showRatingWidget->setChecked(Settings::self()->showRatingWidget());
|
||||
showTechnicalInfo->setChecked(Settings::self()->showTechnicalInfo());
|
||||
if (systemTrayCheckBox) {
|
||||
systemTrayCheckBox->setChecked(Settings::self()->useSystemTray());
|
||||
if (minimiseOnClose) {
|
||||
@@ -309,6 +310,7 @@ void InterfaceSettings::save()
|
||||
Settings::self()->saveShowStopButton(showStopButton->isChecked());
|
||||
Settings::self()->saveShowCoverWidget(showCoverWidget->isChecked());
|
||||
Settings::self()->saveShowRatingWidget(showRatingWidget->isChecked());
|
||||
Settings::self()->saveShowTechnicalInfo(showTechnicalInfo->isChecked());
|
||||
Settings::self()->saveUseSystemTray(systemTrayCheckBox && systemTrayCheckBox->isChecked());
|
||||
Settings::self()->saveShowPopups(systemTrayPopup && systemTrayPopup->isChecked());
|
||||
Settings::self()->saveMinimiseOnClose(minimiseOnClose && minimiseOnClose->isChecked());
|
||||
|
||||
@@ -384,13 +384,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="showRatingWidget">
|
||||
<property name="text">
|
||||
<string>Show track rating</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="showTechnicalInfo">
|
||||
<property name="text">
|
||||
<string>Show technical info</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_7">
|
||||
|
||||
@@ -651,6 +651,11 @@ bool Settings::showRatingWidget()
|
||||
return cfg.get("showRatingWidget", false);
|
||||
}
|
||||
|
||||
bool Settings::showTechnicalInfo()
|
||||
{
|
||||
return cfg.get("showTechnicalInfo", false);
|
||||
}
|
||||
|
||||
bool Settings::infoTooltips()
|
||||
{
|
||||
return cfg.get("infoTooltips", true);
|
||||
@@ -1099,6 +1104,11 @@ void Settings::saveShowRatingWidget(bool v)
|
||||
cfg.set("showRatingWidget", v);
|
||||
}
|
||||
|
||||
void Settings::saveShowTechnicalInfo(bool v)
|
||||
{
|
||||
cfg.set("showTechnicalInfo", v);
|
||||
}
|
||||
|
||||
void Settings::saveInfoTooltips(bool v)
|
||||
{
|
||||
cfg.set("infoTooltips", v);
|
||||
|
||||
@@ -138,6 +138,7 @@ public:
|
||||
bool showCoverWidget();
|
||||
bool showStopButton();
|
||||
bool showRatingWidget();
|
||||
bool showTechnicalInfo();
|
||||
bool infoTooltips();
|
||||
QSet<QString> ignorePrefixes();
|
||||
bool mpris();
|
||||
@@ -234,6 +235,7 @@ public:
|
||||
void saveShowCoverWidget(bool v);
|
||||
void saveShowStopButton(bool v);
|
||||
void saveShowRatingWidget(bool v);
|
||||
void saveShowTechnicalInfo(bool v);
|
||||
void saveInfoTooltips(bool v);
|
||||
void saveIgnorePrefixes(const QSet<QString> &v);
|
||||
void saveMpris(bool v);
|
||||
|
||||
@@ -259,6 +259,7 @@ NowPlayingWidget::NowPlayingWidget(QWidget *p)
|
||||
slider=new PosSlider(this);
|
||||
time=new TimeLabel(this, slider);
|
||||
ratingWidget=new RatingWidget(this);
|
||||
infoLabel=new QLabel(this);
|
||||
QFont f=track->font();
|
||||
QFont small=Utils::smallFont(f);
|
||||
f.setBold(true);
|
||||
@@ -283,6 +284,7 @@ NowPlayingWidget::NowPlayingWidget(QWidget *p)
|
||||
botLayout->setSpacing(space/2);
|
||||
topLayout->addWidget(track);
|
||||
topLayout->addWidget(ratingWidget);
|
||||
topLayout->addWidget(infoLabel);
|
||||
layout->addLayout(topLayout);
|
||||
botLayout->addWidget(artist);
|
||||
botLayout->addWidget(time);
|
||||
@@ -300,6 +302,7 @@ NowPlayingWidget::NowPlayingWidget(QWidget *p)
|
||||
connect(ratingWidget, SIGNAL(valueChanged(int)), SLOT(setRating(int)));
|
||||
connect(this, SIGNAL(setRating(QString,quint8)), MPDConnection::self(), SLOT(setRating(QString,quint8)));
|
||||
connect(PlayQueueModel::self(), SIGNAL(currentSongRating(QString,quint8)), this, SLOT(rating(QString,quint8)));
|
||||
connect(MPDStatus::self(), SIGNAL(updated()), this, SLOT(updateInfo()));
|
||||
}
|
||||
|
||||
void NowPlayingWidget::update(const Song &song)
|
||||
@@ -308,6 +311,7 @@ void NowPlayingWidget::update(const Song &song)
|
||||
currentSongFile=song.file;
|
||||
ratingWidget->setEnabled(!song.isEmpty() && Song::Standard==song.type);
|
||||
ratingWidget->setValue(0);
|
||||
updateInfo();
|
||||
if (song.isEmpty()) {
|
||||
track->setText(" ");
|
||||
artist->setText(" ");
|
||||
@@ -388,6 +392,7 @@ int NowPlayingWidget::value() const
|
||||
void NowPlayingWidget::readConfig()
|
||||
{
|
||||
ratingWidget->setVisible(Settings::self()->showRatingWidget());
|
||||
infoLabel->setVisible(Settings::self()->showTechnicalInfo());
|
||||
}
|
||||
|
||||
void NowPlayingWidget::saveConfig()
|
||||
@@ -440,6 +445,22 @@ void NowPlayingWidget::setRating(int v)
|
||||
emit setRating(currentSongFile, v);
|
||||
}
|
||||
|
||||
void NowPlayingWidget::updateInfo()
|
||||
{
|
||||
if (currentSongFile.isEmpty()) {
|
||||
infoLabel->setText(QString());
|
||||
return;
|
||||
}
|
||||
QString info;
|
||||
|
||||
info=info.sprintf("%d kbps, %.1f kHz", MPDStatus::self()->bitrate(), MPDStatus::self()->samplerate()/1000.0);
|
||||
int pos=currentSongFile.lastIndexOf('.');
|
||||
if (pos>1) {
|
||||
info+=", "+currentSongFile.mid(pos+1).toUpper();
|
||||
}
|
||||
infoLabel->setText(info);
|
||||
}
|
||||
|
||||
void NowPlayingWidget::initColors()
|
||||
{
|
||||
ensurePolished();
|
||||
@@ -449,5 +470,6 @@ void NowPlayingWidget::initColors()
|
||||
artist->setPalette(btn.palette());
|
||||
time->setPalette(btn.palette());
|
||||
slider->updateStyleSheet(track->palette().windowText().color());
|
||||
ratingWidget->setColor(Utils::clampColor(track->palette().text().color()));
|
||||
ratingWidget->setColor(Utils::clampColor(track->palette().buttonText().color()));
|
||||
infoLabel->setPalette(btn.palette());
|
||||
}
|
||||
|
||||
@@ -86,10 +86,12 @@ private Q_SLOTS:
|
||||
void pressed();
|
||||
void released();
|
||||
void setRating(int v);
|
||||
void updateInfo();
|
||||
|
||||
private:
|
||||
SqueezedTextLabel *track;
|
||||
SqueezedTextLabel *artist;
|
||||
QLabel *infoLabel;
|
||||
TimeLabel *time;
|
||||
PosSlider *slider;
|
||||
RatingWidget *ratingWidget;
|
||||
|
||||
Reference in New Issue
Block a user