Skip to content

Commit 4290f75

Browse files
committed
ProgressCallback: Remove modal methods
Still required for the updater, but I've moved that to an updater-specific class in the heirarchy.
1 parent 5488874 commit 4290f75

18 files changed

+71
-174
lines changed

src/common/progress_callback.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -101,39 +101,3 @@ void ProgressCallback::IncrementProgressValue()
101101
{
102102
SetProgressValue((m_progress_value - m_base_progress_value) + 1);
103103
}
104-
105-
void ProgressCallback::DisplayError(const std::string_view message)
106-
{
107-
ERROR_LOG(message);
108-
}
109-
110-
void ProgressCallback::DisplayWarning(const std::string_view message)
111-
{
112-
WARNING_LOG(message);
113-
}
114-
115-
void ProgressCallback::DisplayInformation(const std::string_view message)
116-
{
117-
INFO_LOG(message);
118-
}
119-
120-
void ProgressCallback::DisplayDebugMessage(const std::string_view message)
121-
{
122-
DEV_LOG(message);
123-
}
124-
125-
void ProgressCallback::ModalError(const std::string_view message)
126-
{
127-
ERROR_LOG(message);
128-
}
129-
130-
bool ProgressCallback::ModalConfirmation(const std::string_view message)
131-
{
132-
INFO_LOG(message);
133-
return false;
134-
}
135-
136-
void ProgressCallback::ModalInformation(const std::string_view message)
137-
{
138-
INFO_LOG(message);
139-
}

src/common/progress_callback.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ class ProgressCallback
3030
virtual void SetProgressValue(u32 value);
3131
virtual void IncrementProgressValue();
3232

33-
virtual void DisplayError(const std::string_view message);
34-
virtual void DisplayWarning(const std::string_view message);
35-
virtual void DisplayInformation(const std::string_view message);
36-
virtual void DisplayDebugMessage(const std::string_view message);
37-
38-
virtual void ModalError(const std::string_view message);
39-
virtual bool ModalConfirmation(const std::string_view message);
40-
virtual void ModalInformation(const std::string_view message);
41-
4233
#define MAKE_PROGRESS_CALLBACK_FORWARDER(from, to) \
4334
template<typename... T> \
4435
void from(fmt::format_string<T...> fmt, T&&... args) \
@@ -49,13 +40,6 @@ class ProgressCallback
4940
}
5041

5142
MAKE_PROGRESS_CALLBACK_FORWARDER(FormatStatusText, SetStatusText);
52-
MAKE_PROGRESS_CALLBACK_FORWARDER(FormatError, DisplayError);
53-
MAKE_PROGRESS_CALLBACK_FORWARDER(FormatWarning, DisplayWarning);
54-
MAKE_PROGRESS_CALLBACK_FORWARDER(FormatInformation, DisplayInformation);
55-
MAKE_PROGRESS_CALLBACK_FORWARDER(FormatDebugMessage, DisplayDebugMessage);
56-
MAKE_PROGRESS_CALLBACK_FORWARDER(FormatModalError, ModalError);
57-
MAKE_PROGRESS_CALLBACK_FORWARDER(FormatModalConfirmation, ModalConfirmation);
58-
MAKE_PROGRESS_CALLBACK_FORWARDER(FormatModalInformation, ModalInformation);
5943

6044
#undef MAKE_PROGRESS_CALLBACK_FORWARDER
6145

src/core/fullscreenui.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ class BackgroundProgressCallback final : public ProgressCallback
5555
void SetProgressRange(u32 range) override;
5656
void SetProgressValue(u32 value) override;
5757

58-
void ModalError(const std::string_view message) override;
59-
bool ModalConfirmation(const std::string_view message) override;
60-
void ModalInformation(const std::string_view message) override;
61-
6258
void SetCancelled();
6359

6460
private:
@@ -90,9 +86,6 @@ class LoadingScreenProgressCallback final : public ProgressCallback
9086
void SetProgressRange(u32 range) override;
9187
void SetProgressValue(u32 value) override;
9288

93-
void ModalError(const std::string_view message) override;
94-
bool ModalConfirmation(const std::string_view message) override;
95-
9689
private:
9790
void Redraw(bool force);
9891

src/core/fullscreenui_widgets.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4235,23 +4235,6 @@ void FullscreenUI::BackgroundProgressCallback::Redraw(bool force)
42354235
UpdateBackgroundProgressDialog(m_name, m_status_text, 0, 100, percent);
42364236
}
42374237

4238-
void FullscreenUI::BackgroundProgressCallback::ModalError(const std::string_view message)
4239-
{
4240-
Host::ReportErrorAsync("Error", message);
4241-
}
4242-
4243-
bool FullscreenUI::BackgroundProgressCallback::ModalConfirmation(const std::string_view message)
4244-
{
4245-
// Not used.
4246-
INFO_LOG(message);
4247-
return true;
4248-
}
4249-
4250-
void FullscreenUI::BackgroundProgressCallback::ModalInformation(const std::string_view message)
4251-
{
4252-
Host::ReportErrorAsync("Information", message);
4253-
}
4254-
42554238
void FullscreenUI::BackgroundProgressCallback::SetCancelled()
42564239
{
42574240
if (m_cancellable)
@@ -4662,19 +4645,6 @@ void FullscreenUI::LoadingScreenProgressCallback::Redraw(bool force)
46624645
m_last_progress_percent = percent;
46634646
}
46644647

4665-
void FullscreenUI::LoadingScreenProgressCallback::ModalError(const std::string_view message)
4666-
{
4667-
ERROR_LOG(message);
4668-
Host::ReportErrorAsync("Error", message);
4669-
}
4670-
4671-
bool FullscreenUI::LoadingScreenProgressCallback::ModalConfirmation(const std::string_view message)
4672-
{
4673-
// Not used.
4674-
INFO_LOG(message);
4675-
return true;
4676-
}
4677-
46784648
//////////////////////////////////////////////////////////////////////////
46794649
// Notifications
46804650
//////////////////////////////////////////////////////////////////////////

src/duckstation-qt/gamelistrefreshthread.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,25 +79,6 @@ void GameListRefreshThread::SetProgressValue(u32 value)
7979
fireUpdate();
8080
}
8181

82-
void GameListRefreshThread::ModalError(const std::string_view message)
83-
{
84-
// Not used.
85-
WARNING_LOG(message);
86-
}
87-
88-
bool GameListRefreshThread::ModalConfirmation(const std::string_view message)
89-
{
90-
// Not used.
91-
WARNING_LOG(message);
92-
return true;
93-
}
94-
95-
void GameListRefreshThread::ModalInformation(const std::string_view message)
96-
{
97-
// Not used.
98-
WARNING_LOG(message);
99-
}
100-
10182
void GameListRefreshThread::fireUpdate()
10283
{
10384
emit refreshProgress(m_status_text, m_last_value, m_last_range, static_cast<int>(GameList::GetEntryCount()),

src/duckstation-qt/gamelistrefreshthread.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ class GameListRefreshThread final : public QThread, public ProgressCallback
3333
void SetProgressRange(u32 range) override;
3434
void SetProgressValue(u32 value) override;
3535

36-
void ModalError(const std::string_view message) override;
37-
bool ModalConfirmation(const std::string_view message) override;
38-
void ModalInformation(const std::string_view message) override;
39-
4036
void fireUpdate();
4137

4238
Timer m_start_time;

src/duckstation-qt/qtprogresscallback.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -79,22 +79,6 @@ void QtModalProgressCallback::SetProgressValue(u32 value)
7979
QCoreApplication::processEvents();
8080
}
8181

82-
void QtModalProgressCallback::ModalError(const std::string_view message)
83-
{
84-
QtUtils::MessageBoxCritical(&m_dialog, m_dialog.windowTitle(), QtUtils::StringViewToQString(message));
85-
}
86-
87-
bool QtModalProgressCallback::ModalConfirmation(const std::string_view message)
88-
{
89-
return (QtUtils::MessageBoxQuestion(&m_dialog, m_dialog.windowTitle(), QtUtils::StringViewToQString(message)) ==
90-
QMessageBox::Yes);
91-
}
92-
93-
void QtModalProgressCallback::ModalInformation(const std::string_view message)
94-
{
95-
QtUtils::MessageBoxInformation(&m_dialog, m_dialog.windowTitle(), QtUtils::StringViewToQString(message));
96-
}
97-
9882
void QtModalProgressCallback::dialogCancelled()
9983
{
10084
m_cancelled = true;
@@ -161,22 +145,6 @@ void QtAsyncProgressThread::SetProgressValue(u32 value)
161145
emit progressUpdated(static_cast<int>(m_progress_value), static_cast<int>(m_progress_range));
162146
}
163147

164-
void QtAsyncProgressThread::ModalError(const std::string_view message)
165-
{
166-
QtUtils::MessageBoxCritical(parentWidget(), tr("Error"), QtUtils::StringViewToQString(message));
167-
}
168-
169-
bool QtAsyncProgressThread::ModalConfirmation(const std::string_view message)
170-
{
171-
return (QtUtils::MessageBoxQuestion(parentWidget(), tr("Question"), QtUtils::StringViewToQString(message)) ==
172-
QMessageBox::Yes);
173-
}
174-
175-
void QtAsyncProgressThread::ModalInformation(const std::string_view message)
176-
{
177-
QtUtils::MessageBoxInformation(parentWidget(), tr("Information"), QtUtils::StringViewToQString(message));
178-
}
179-
180148
void QtAsyncProgressThread::start()
181149
{
182150
Assert(!isRunning());

src/duckstation-qt/qtprogresscallback.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ class QtModalProgressCallback final : public QObject, public ProgressCallback
2727
void SetProgressRange(u32 range) override;
2828
void SetProgressValue(u32 value) override;
2929

30-
void ModalError(const std::string_view message) override;
31-
bool ModalConfirmation(const std::string_view message) override;
32-
void ModalInformation(const std::string_view message) override;
33-
3430
void MakeVisible();
3531

3632
private:
@@ -63,10 +59,6 @@ class QtAsyncProgressThread : public QThread, public ProgressCallback
6359
void SetProgressRange(u32 range) override;
6460
void SetProgressValue(u32 value) override;
6561

66-
void ModalError(const std::string_view message) override;
67-
bool ModalConfirmation(const std::string_view message) override;
68-
void ModalInformation(const std::string_view message) override;
69-
7062
void start();
7163
void join();
7264

src/updater/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ target_link_libraries(updater PRIVATE common minizip ZLIB::ZLIB)
88
if(WIN32)
99
target_sources(updater PRIVATE
1010
updater.rc
11+
updater_progress_callback.h
1112
win32_main.cpp
1213
win32_progress_callback.cpp
1314
win32_progress_callback.h
@@ -22,6 +23,7 @@ if(APPLE)
2223
cocoa_main.mm
2324
cocoa_progress_callback.mm
2425
cocoa_progress_callback.h
26+
updater_progress_callback.h
2527
)
2628
target_sources(updater PRIVATE ${MAC_SOURCES})
2729
set_source_files_properties(${MAC_SOURCES} PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE)

src/updater/cocoa_progress_callback.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#pragma once
55

6-
#include "common/progress_callback.h"
6+
#include "updater_progress_callback.h"
77

88
#include <AppKit/AppKit.h>
99
#include <Cocoa/Cocoa.h>
@@ -16,7 +16,7 @@
1616
#error ARC should not be enabled.
1717
#endif
1818

19-
class CocoaProgressCallback final : public ProgressCallback
19+
class CocoaProgressCallback final : public UpdaterProgressCallback
2020
{
2121
public:
2222
CocoaProgressCallback();

0 commit comments

Comments
 (0)