mirror of
https://github.com/PCSX2/pcsx2.git
synced 2025-12-16 04:08:48 +00:00
Some checks failed
🐧 Linux Builds / AppImage (push) Has been cancelled
🐧 Linux Builds / Flatpak (push) Has been cancelled
🍎 MacOS Builds / Defaults (push) Has been cancelled
🖥️ Windows Builds / Lint VS Project Files (push) Has been cancelled
🖥️ Windows Builds / CMake (push) Has been cancelled
🖥️ Windows Builds / SSE4 (push) Has been cancelled
🖥️ Windows Builds / AVX2 (push) Has been cancelled
🏭 Update Controller Database / update-controller-db (push) Has been cancelled
66 lines
1.6 KiB
C++
66 lines
1.6 KiB
C++
// SPDX-FileCopyrightText: 2002-2025 PCSX2 Dev Team
|
|
// SPDX-License-Identifier: GPL-3.0+
|
|
|
|
#pragma once
|
|
|
|
#include <QtCore/QThread>
|
|
#include <QtCore/QSemaphore>
|
|
|
|
#include "common/ProgressCallback.h"
|
|
#include "common/Timer.h"
|
|
|
|
class GameListRefreshThread;
|
|
|
|
class AsyncRefreshProgressCallback : public BaseProgressCallback
|
|
{
|
|
public:
|
|
AsyncRefreshProgressCallback(bool popup_on_error, GameListRefreshThread* parent);
|
|
|
|
void Cancel();
|
|
|
|
void SetStatusText(const char* text) override;
|
|
void SetProgressRange(u32 range) override;
|
|
void SetProgressValue(u32 value) override;
|
|
void SetTitle(const char* title) override;
|
|
void DisplayError(const char* message) override;
|
|
void DisplayWarning(const char* message) override;
|
|
void DisplayInformation(const char* message) override;
|
|
void DisplayDebugMessage(const char* message) override;
|
|
void ModalError(const char* message) override;
|
|
bool ModalConfirmation(const char* message) override;
|
|
void ModalInformation(const char* message) override;
|
|
|
|
private:
|
|
void fireUpdate();
|
|
|
|
GameListRefreshThread* m_parent;
|
|
Common::Timer m_last_update_time;
|
|
QString m_status_text;
|
|
int m_last_range = 1;
|
|
int m_last_value = 0;
|
|
bool m_popup_on_error = false;
|
|
};
|
|
|
|
class GameListRefreshThread final : public QThread
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
GameListRefreshThread(bool invalidate_cache, bool popup_on_error);
|
|
~GameListRefreshThread();
|
|
|
|
void cancel();
|
|
|
|
Q_SIGNALS:
|
|
void refreshProgress(const QString& status, int current, int total);
|
|
void refreshComplete();
|
|
|
|
protected:
|
|
void run();
|
|
|
|
private:
|
|
AsyncRefreshProgressCallback m_progress;
|
|
bool m_invalidate_cache;
|
|
bool m_popup_on_error;
|
|
};
|