mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-11-24 08:12:48 +00:00
web_browser: Make OpenPage non-const
This commit is contained in:
parent
8f8049e846
commit
2adb226b26
|
@ -13,7 +13,7 @@ DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default;
|
|||
|
||||
void DefaultWebBrowserApplet::OpenPage(std::string_view filename,
|
||||
std::function<void()> unpack_romfs_callback,
|
||||
std::function<void()> finished_callback) const {
|
||||
std::function<void()> finished_callback) {
|
||||
LOG_INFO(Service_AM,
|
||||
"(STUBBED) called - No suitable web browser implementation found to open website page "
|
||||
"at '{}'!",
|
||||
|
|
|
@ -14,7 +14,7 @@ public:
|
|||
virtual ~WebBrowserApplet();
|
||||
|
||||
virtual void OpenPage(std::string_view url, std::function<void()> unpack_romfs_callback,
|
||||
std::function<void()> finished_callback) const = 0;
|
||||
std::function<void()> finished_callback) = 0;
|
||||
};
|
||||
|
||||
class DefaultWebBrowserApplet final : public WebBrowserApplet {
|
||||
|
@ -22,7 +22,7 @@ public:
|
|||
~DefaultWebBrowserApplet() override;
|
||||
|
||||
void OpenPage(std::string_view url, std::function<void()> unpack_romfs_callback,
|
||||
std::function<void()> finished_callback) const override;
|
||||
std::function<void()> finished_callback) override;
|
||||
};
|
||||
|
||||
} // namespace Core::Frontend
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "common/string_util.h"
|
||||
#include "core/core.h"
|
||||
#include "core/frontend/applets/error.h"
|
||||
|
@ -54,7 +58,7 @@ struct ApplicationErrorArg {
|
|||
};
|
||||
static_assert(sizeof(ApplicationErrorArg) == 0x1014, "ApplicationErrorArg has incorrect size.");
|
||||
|
||||
union ErrorArguments {
|
||||
union Error::ErrorArguments {
|
||||
ShowError error;
|
||||
ShowErrorRecord error_record;
|
||||
SystemErrorArg system_error;
|
||||
|
@ -107,6 +111,7 @@ void Error::Initialize() {
|
|||
case ErrorAppletMode::ShowSystemError:
|
||||
CopyArgumentData(data, args->system_error);
|
||||
error_code = ResultCode(Decode64BitError(args->system_error.error_code_64));
|
||||
break;
|
||||
case ErrorAppletMode::ShowApplicationError:
|
||||
CopyArgumentData(data, args->application_error);
|
||||
error_code = ResultCode(args->application_error.error_code);
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
namespace Service::AM::Applets {
|
||||
|
||||
union ErrorArguments;
|
||||
|
||||
enum class ErrorAppletMode : u8 {
|
||||
ShowError = 0,
|
||||
ShowSystemError = 1,
|
||||
|
@ -23,7 +21,7 @@ enum class ErrorAppletMode : u8 {
|
|||
|
||||
class Error final : public Applet {
|
||||
public:
|
||||
Error(const Core::Frontend::ErrorApplet& frontend);
|
||||
explicit Error(const Core::Frontend::ErrorApplet& frontend);
|
||||
~Error() override;
|
||||
|
||||
void Initialize() override;
|
||||
|
@ -36,12 +34,14 @@ public:
|
|||
void DisplayCompleted();
|
||||
|
||||
private:
|
||||
union ErrorArguments;
|
||||
|
||||
const Core::Frontend::ErrorApplet& frontend;
|
||||
ResultCode error_code = RESULT_SUCCESS;
|
||||
ErrorAppletMode mode;
|
||||
ErrorAppletMode mode = ErrorAppletMode::ShowError;
|
||||
std::unique_ptr<ErrorArguments> args;
|
||||
|
||||
bool complete;
|
||||
bool complete = false;
|
||||
};
|
||||
|
||||
} // namespace Service::AM::Applets
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "common/assert.h"
|
||||
#include "common/hex_util.h"
|
||||
#include "common/logging/log.h"
|
||||
#include "core/core.h"
|
||||
|
|
|
@ -15,7 +15,7 @@ enum class PhotoViewerAppletMode : u8 {
|
|||
|
||||
class PhotoViewer final : public Applet {
|
||||
public:
|
||||
PhotoViewer(const Core::Frontend::PhotoViewerApplet& frontend);
|
||||
explicit PhotoViewer(const Core::Frontend::PhotoViewerApplet& frontend);
|
||||
~PhotoViewer() override;
|
||||
|
||||
void Initialize() override;
|
||||
|
@ -28,8 +28,8 @@ public:
|
|||
|
||||
private:
|
||||
const Core::Frontend::PhotoViewerApplet& frontend;
|
||||
bool complete;
|
||||
PhotoViewerAppletMode mode;
|
||||
bool complete = false;
|
||||
PhotoViewerAppletMode mode = PhotoViewerAppletMode::CurrentApp;
|
||||
};
|
||||
|
||||
class StubApplet final : public Applet {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <vector>
|
||||
|
||||
#include "common/common_funcs.h"
|
||||
#include "core/frontend/applets/software_keyboard.h"
|
||||
#include "core/hle/service/acc/profile_manager.h"
|
||||
#include "core/hle/service/am/applets/applets.h"
|
||||
|
||||
|
@ -29,7 +28,7 @@ static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has inco
|
|||
|
||||
class ProfileSelect final : public Applet {
|
||||
public:
|
||||
ProfileSelect(const Core::Frontend::ProfileSelectApplet& frontend);
|
||||
explicit ProfileSelect(const Core::Frontend::ProfileSelectApplet& frontend);
|
||||
~ProfileSelect() override;
|
||||
|
||||
void Initialize() override;
|
||||
|
|
|
@ -55,7 +55,7 @@ static_assert(sizeof(KeyboardConfig) == 0x3E0, "KeyboardConfig has incorrect siz
|
|||
|
||||
class SoftwareKeyboard final : public Applet {
|
||||
public:
|
||||
SoftwareKeyboard(const Core::Frontend::SoftwareKeyboardApplet& frontend);
|
||||
explicit SoftwareKeyboard(const Core::Frontend::SoftwareKeyboardApplet& frontend);
|
||||
~SoftwareKeyboard() override;
|
||||
|
||||
void Initialize() override;
|
||||
|
|
|
@ -95,7 +95,7 @@ static FileSys::VirtualFile GetManualRomFS() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
WebBrowser::WebBrowser(const Core::Frontend::WebBrowserApplet& frontend) : frontend(frontend) {}
|
||||
WebBrowser::WebBrowser(Core::Frontend::WebBrowserApplet& frontend) : frontend(frontend) {}
|
||||
|
||||
WebBrowser::~WebBrowser() = default;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Service::AM::Applets {
|
|||
|
||||
class WebBrowser final : public Applet {
|
||||
public:
|
||||
WebBrowser(const Core::Frontend::WebBrowserApplet& frontend);
|
||||
WebBrowser(Core::Frontend::WebBrowserApplet& frontend);
|
||||
~WebBrowser() override;
|
||||
|
||||
void Initialize() override;
|
||||
|
@ -32,7 +32,7 @@ public:
|
|||
void Finalize();
|
||||
|
||||
private:
|
||||
const Core::Frontend::WebBrowserApplet& frontend;
|
||||
Core::Frontend::WebBrowserApplet& frontend;
|
||||
|
||||
bool complete = false;
|
||||
bool unpacked = false;
|
||||
|
|
|
@ -17,7 +17,7 @@ QtErrorDisplay::QtErrorDisplay(GMainWindow& parent) {
|
|||
QtErrorDisplay::~QtErrorDisplay() = default;
|
||||
|
||||
void QtErrorDisplay::ShowError(ResultCode error, std::function<void()> finished) const {
|
||||
this->callback = finished;
|
||||
this->callback = std::move(finished);
|
||||
emit MainWindowDisplayError(
|
||||
tr("An error has occured.\nPlease try again or contact the developer of the "
|
||||
"software.\n\nError Code: %1-%2 (0x%3)")
|
||||
|
@ -28,7 +28,7 @@ void QtErrorDisplay::ShowError(ResultCode error, std::function<void()> finished)
|
|||
|
||||
void QtErrorDisplay::ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time,
|
||||
std::function<void()> finished) const {
|
||||
this->callback = finished;
|
||||
this->callback = std::move(finished);
|
||||
emit MainWindowDisplayError(
|
||||
tr("An error occured on %1 at %2.\nPlease try again or contact the "
|
||||
"developer of the software.\n\nError Code: %3-%4 (0x%5)")
|
||||
|
@ -42,7 +42,7 @@ void QtErrorDisplay::ShowErrorWithTimestamp(ResultCode error, std::chrono::secon
|
|||
void QtErrorDisplay::ShowCustomErrorText(ResultCode error, std::string dialog_text,
|
||||
std::string fullscreen_text,
|
||||
std::function<void()> finished) const {
|
||||
this->callback = finished;
|
||||
this->callback = std::move(finished);
|
||||
emit MainWindowDisplayError(
|
||||
tr("An error has occured.\nError Code: %1-%2 (0x%3)\n\n%4\n\n%5")
|
||||
.arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0'))
|
||||
|
|
|
@ -88,7 +88,7 @@ QtWebBrowser::QtWebBrowser(GMainWindow& main_window) {
|
|||
QtWebBrowser::~QtWebBrowser() = default;
|
||||
|
||||
void QtWebBrowser::OpenPage(std::string_view url, std::function<void()> unpack_romfs_callback,
|
||||
std::function<void()> finished_callback) const {
|
||||
std::function<void()> finished_callback) {
|
||||
this->unpack_romfs_callback = std::move(unpack_romfs_callback);
|
||||
this->finished_callback = std::move(finished_callback);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
~QtWebBrowser() override;
|
||||
|
||||
void OpenPage(std::string_view url, std::function<void()> unpack_romfs_callback,
|
||||
std::function<void()> finished_callback) const override;
|
||||
std::function<void()> finished_callback) override;
|
||||
|
||||
signals:
|
||||
void MainWindowOpenPage(std::string_view filename, std::string_view additional_args) const;
|
||||
|
@ -47,6 +47,6 @@ private:
|
|||
void MainWindowUnpackRomFS();
|
||||
void MainWindowFinishedBrowsing();
|
||||
|
||||
mutable std::function<void()> unpack_romfs_callback;
|
||||
mutable std::function<void()> finished_callback;
|
||||
std::function<void()> unpack_romfs_callback;
|
||||
std::function<void()> finished_callback;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue