host_interface_progress_callback.h (977B)
1 // SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com> 2 // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0) 3 4 #pragma once 5 6 #include "common/progress_callback.h" 7 #include "common/timer.h" 8 9 class HostInterfaceProgressCallback final : public ProgressCallback 10 { 11 public: 12 HostInterfaceProgressCallback(); 13 14 ALWAYS_INLINE void SetOpenDelay(float delay) { m_open_delay = delay; } 15 16 void PushState() override; 17 void PopState() override; 18 19 void SetCancellable(bool cancellable) override; 20 void SetTitle(const std::string_view title) override; 21 void SetStatusText(const std::string_view text) override; 22 void SetProgressRange(u32 range) override; 23 void SetProgressValue(u32 value) override; 24 25 void ModalError(const std::string_view message) override; 26 bool ModalConfirmation(const std::string_view message) override; 27 28 private: 29 void Redraw(bool force); 30 31 Common::Timer m_open_time; 32 float m_open_delay = 1.0f; 33 int m_last_progress_percent = -1; 34 };