1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:57:35 +00:00

AK: Rename Time to Duration

That's what this class really is; in fact that's what the first line of
the comment says it is.

This commit does not rename the main files, since those will contain
other time-related classes in a little bit.
This commit is contained in:
kleines Filmröllchen 2023-03-13 16:30:34 +01:00 committed by Jelle Raaijmakers
parent 82ddc813d5
commit 213025f210
140 changed files with 634 additions and 628 deletions

View file

@ -59,7 +59,7 @@ ErrorOr<void> VideoPlayerWidget::setup_interface()
update_seek_slider_max();
auto progress = value / static_cast<double>(m_seek_slider->max());
auto duration = m_playback_manager->duration().to_milliseconds();
Time timestamp = Time::from_milliseconds(static_cast<i64>(round(progress * static_cast<double>(duration))));
Duration timestamp = Duration::from_milliseconds(static_cast<i64>(round(progress * static_cast<double>(duration))));
auto seek_mode_to_use = m_seek_slider->knob_dragging() ? seek_mode() : Video::PlaybackManager::SeekMode::Accurate;
m_playback_manager->seek_to_timestamp(timestamp, seek_mode_to_use);
set_current_timestamp(m_playback_manager->current_playback_time());
@ -252,7 +252,7 @@ void VideoPlayerWidget::update_seek_slider_max()
m_seek_slider->set_enabled(true);
}
void VideoPlayerWidget::set_current_timestamp(Time timestamp)
void VideoPlayerWidget::set_current_timestamp(Duration timestamp)
{
set_time_label(timestamp);
if (!m_playback_manager)
@ -261,10 +261,10 @@ void VideoPlayerWidget::set_current_timestamp(Time timestamp)
m_seek_slider->set_value(static_cast<int>(round(progress * m_seek_slider->max())), GUI::AllowCallback::No);
}
void VideoPlayerWidget::set_time_label(Time timestamp)
void VideoPlayerWidget::set_time_label(Duration timestamp)
{
StringBuilder string_builder;
auto append_time = [&](Time time) {
auto append_time = [&](Duration time) {
auto seconds = (time.to_milliseconds() + 500) / 1000;
string_builder.append(human_readable_digital_time(seconds));
};