mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 10:16:24 +02:00
### <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request ### Bug report tool status tracking: Currently, After clicking the generate package button, button is still active, as we do not have bug report progress, this will confuse user whether they actually clicks the button. Add an enable status to acknowledge the bug generating <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #xxx - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [x] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx ## Detailed Description of the Pull Request / Additional comments 1. Progress bar should be present in generating report place when there is bug report going on. 2. Runner&Settings should know each other when they trigger the bug report. 3. Runner tray icon menu item should be disabled when there is one bug report going on. 4. After bug report generation, everything should be like before. ## Validation Steps Performed https://github.com/user-attachments/assets/dcbf8e6e-c5e1-4d23-9dab-f16c11ed56cf --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
#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; |