/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/runner/bug_report.h
43 строки
1 KB
Kai Tao
Settings: Generate bug report should tell user there is bug report generating (#40060)
17 июн 2025, 09:49
Не верифицирован
17 июн 2025, 09:49
252dbb5
Код
Авторство
О чём код?
#pragma once #include <functional> #include <vector> #include <mutex> // Observer pattern for bug report status changes using BugReportCallback = std::function<void(bool isRunning)>; class BugReportManager { public: static BugReportManager& instance(); // Register a callback to be notified when bug report status changes void register_callback(const BugReportCallback& callback); // Remove all callbacks (useful for cleanup) void clear_callbacks(); // Launch bug report and notify observers void launch_bug_report() noexcept; // Check if bug report is currently running bool is_bug_report_running() const noexcept; private: BugReportManager() = default; ~BugReportManager() = default; BugReportManager(const BugReportManager&) = delete; BugReportManager& operator=(const BugReportManager&) = delete; // Notify all registered callbacks void notify_observers(bool isRunning); std::atomic_bool m_isBugReportRunning = false; std::vector<BugReportCallback> m_callbacks; mutable std::mutex m_callbacksMutex; }; // Legacy functions for backward compatibility void launch_bug_report() noexcept; bool is_bug_report_running() noexcept;