Fixed long durations
This commit is contained in:
@@ -187,6 +187,7 @@ PlayQueue::PlayQueue()
|
||||
}
|
||||
|
||||
_nbTracks = bindNew<Wt::WText>("track-count");
|
||||
_duration = bindNew<Wt::WText>("duration");
|
||||
|
||||
LmsApp->preQuit().connect([=]
|
||||
{
|
||||
@@ -367,6 +368,7 @@ PlayQueue::updateInfo()
|
||||
|
||||
const auto trackCount {getTrackList()->getCount()};
|
||||
_nbTracks->setText(Wt::WString::trn("Lms.track-count", trackCount).arg(trackCount));
|
||||
_duration->setText(Utils::durationToString(getTrackList()->getDuration()));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -101,6 +101,7 @@ class PlayQueue : public Template
|
||||
Database::TrackListId _tracklistId {};
|
||||
InfiniteScrollingContainer* _entriesContainer {};
|
||||
Wt::WText* _nbTracks {};
|
||||
Wt::WText* _duration {};
|
||||
Wt::WCheckBox* _repeatBtn {};
|
||||
Wt::WCheckBox* _radioBtn {};
|
||||
std::optional<std::size_t> _trackPos; // current track position, if set
|
||||
|
||||
+15
-3
@@ -37,9 +37,21 @@ namespace UserInterface::Utils
|
||||
const std::chrono::seconds duration {std::chrono::duration_cast<std::chrono::seconds>(msDuration)};
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << (duration.count() / 60)
|
||||
<< ":"
|
||||
<< std::setfill('0') << std::setw(2) << duration.count() % 60;
|
||||
|
||||
if (duration.count() >= 3600)
|
||||
{
|
||||
oss << (duration.count() / 3600)
|
||||
<< ":"
|
||||
<< std::setfill('0') << std::setw(2) << (duration.count() % 3600) / 60
|
||||
<< ":"
|
||||
<< std::setfill('0') << std::setw(2) << duration.count() % 60;
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << (duration.count() / 60)
|
||||
<< ":"
|
||||
<< std::setfill('0') << std::setw(2) << duration.count() % 60;
|
||||
}
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,6 @@ namespace UserInterface
|
||||
|
||||
_container->remove(*itTrackList->second);
|
||||
_trackListWidgets.erase(itTrackList);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user