add: Audio Info in NowPlayingPanel.cpp ; Includes: Samplerate, bits/sample, and codec
change: opengl dll for windows now is not included, cause it is too large refactor: Spectrogram colors for bars are now in a Header (GradientPresetHeader.h), with accompaning methods
This commit is contained in:
@@ -60,11 +60,22 @@ void NowPlayingPanel::buildLayout()
|
||||
transport->addWidget(new QLabel("Volume:"));
|
||||
transport->addWidget(m_volSlider);
|
||||
|
||||
auto *metaRow = new QHBoxLayout;
|
||||
metaRow->setSpacing(8);
|
||||
metaRow->addWidget(new QLabel("Sample rate:"));
|
||||
metaRow->addWidget(m_lblSampleRate);
|
||||
metaRow->addWidget(new QLabel("Bits/Sample:"));
|
||||
metaRow->addWidget(m_lblBitsPerSample);
|
||||
metaRow->addWidget(new QLabel("Codec:"));
|
||||
metaRow->addWidget(m_lblCodec);
|
||||
metaRow->addStretch();
|
||||
|
||||
auto *right = new QVBoxLayout;
|
||||
right->setSpacing(4);
|
||||
right->addWidget(m_lblTitle);
|
||||
right->addWidget(m_lblArtist);
|
||||
right->addWidget(m_lblAlbum);
|
||||
right->addLayout(metaRow);
|
||||
right->addLayout(seekRow);
|
||||
right->addLayout(transport);
|
||||
|
||||
@@ -73,14 +84,25 @@ void NowPlayingPanel::buildLayout()
|
||||
hlay->addLayout(right, 1);
|
||||
}
|
||||
|
||||
void NowPlayingPanel::clearAudioInfo()
|
||||
{
|
||||
m_lblSampleRate->setText("-");
|
||||
m_lblBitsPerSample->setText("-");
|
||||
m_lblCodec->setText("-");
|
||||
}
|
||||
|
||||
void NowPlayingPanel::updateTrack(const engine::Track *t)
|
||||
{
|
||||
if (!t) return;
|
||||
if (!t) {
|
||||
clearAudioInfo();
|
||||
return;
|
||||
}
|
||||
m_cover->setTrack(t);
|
||||
m_lblTitle->setText(t->displayTitle());
|
||||
m_lblArtist->setText(t->artist);
|
||||
m_lblAlbum->setText(t->album +
|
||||
(t->year > 0 ? " (" + QString::number(t->year) + ")" : ""));
|
||||
clearAudioInfo();
|
||||
m_seekBar->setValue(0);
|
||||
m_btnPlay->setText("Pause");
|
||||
}
|
||||
@@ -101,6 +123,13 @@ void NowPlayingPanel::updatePosition(qint64 posFrames, qint64 totalFrames, float
|
||||
m_seekBar->setValue(int(posFrames * 1000 / totalFrames));
|
||||
}
|
||||
|
||||
void NowPlayingPanel::updateAudioInfo(int sampleRate, int bitsPerSample, const QString &codec)
|
||||
{
|
||||
m_lblSampleRate->setText(sampleRate > 0 ? QString("%1 Hz").arg(sampleRate) : "-");
|
||||
m_lblBitsPerSample->setText(bitsPerSample > 0 ? QString("%1").arg(bitsPerSample) : "-");
|
||||
m_lblCodec->setText(!codec.isEmpty() ? codec : "-");
|
||||
}
|
||||
|
||||
void NowPlayingPanel::setPlaybackActive(bool playing)
|
||||
{
|
||||
m_btnPlay->setText(playing ? "Pause" : "Play");
|
||||
|
||||
Reference in New Issue
Block a user