Skip to content

Commit

Permalink
fix(gui): show milliseconds in sound preview
Browse files Browse the repository at this point in the history
  • Loading branch information
craftablescience committed Jul 15, 2024
1 parent 4b4287e commit 8244ef2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/gui/previews/AudioPreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ SeekBar::SeekBar(QWidget* parent)
QObject::connect(this, &QProgressBar::valueChanged, this, [this](int value) {
QString formatter;
if (AudioPlayer::getLengthInSeconds() >= 60 * 60 * 24) {
formatter = "dd:hh:mm:ss";
formatter = "dd:hh:mm:ss.zzz";
} else if (AudioPlayer::getLengthInSeconds() >= 60 * 60) {
formatter = "hh:mm:ss";
formatter = "hh:mm:ss.zzz";
} else if (AudioPlayer::getLengthInSeconds() >= 60) {
formatter = "mm:ss.zzz";
} else {
formatter = "mm:ss";
formatter = "ss.zzz";
}
auto text = QString("%1 / %2").arg(
QTime(0,0).addSecs(static_cast<int>(AudioPlayer::getPositionInSeconds())).toString(formatter),
QTime(0,0).addSecs(static_cast<int>(AudioPlayer::getLengthInSeconds())).toString(formatter));
QTime(0,0).addMSecs(static_cast<int>(AudioPlayer::getPositionInSeconds() * 1000)).toString(formatter),
QTime(0,0).addMSecs(static_cast<int>(AudioPlayer::getLengthInSeconds() * 1000)).toString(formatter));
this->label->setText(text);
});
layout->addWidget(this->label);
Expand Down
2 changes: 1 addition & 1 deletion src/shared/thirdparty/sourcepp

0 comments on commit 8244ef2

Please sign in to comment.