optimise: pass all large objects (std::function, std::string, structs) by const ref rather than value.
really, these functions should be passed by && and using std::forward on assignment. however, this means writing a lot of extra code for every single class, as well as explicitly calling move in a lot of cases. In the case of std::string, passing by value and calling std::move is the correct approach, especially if the string is created as an rvalue, then it is only created once and moved into the dest. Whereas with a const ref, the string is created and then copied into the dst, basically creating 2 copies. The same thing happens std::function, and well any object. However, accepting everything by value sucks if you call a constructor from within a constructor, as now you need to create 2 impls that accept by value and the other by rvalue. All of this extra code to have a more efficent impl just isn't worth it when, going by the benchmarks, makes no measurable difference (i count anything within >= 1ms as measurable).
This commit is contained in:
@@ -247,6 +247,7 @@ set(NANOVG_NO_HDR ON)
|
||||
set(NANOVG_NO_PIC ON)
|
||||
set(NANOVG_NO_PNM ON)
|
||||
|
||||
set(YYJSON_INSTALL OFF)
|
||||
set(YYJSON_DISABLE_READER OFF)
|
||||
set(YYJSON_DISABLE_WRITER OFF)
|
||||
set(YYJSON_DISABLE_UTILS ON)
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
static void PopToMenu();
|
||||
|
||||
// this is thread safe
|
||||
static void Notify(std::string text, ui::NotifEntry::Side side = ui::NotifEntry::Side::RIGHT);
|
||||
static void Notify(const std::string& text, ui::NotifEntry::Side side = ui::NotifEntry::Side::RIGHT);
|
||||
static void Notify(ui::NotifEntry entry);
|
||||
static void NotifyPop(ui::NotifEntry::Side side = ui::NotifEntry::Side::RIGHT);
|
||||
static void NotifyClear(ui::NotifEntry::Side side = ui::NotifEntry::Side::RIGHT);
|
||||
|
||||
@@ -52,7 +52,7 @@ struct Fields {
|
||||
|
||||
struct Header {
|
||||
Header() = default;
|
||||
Header(std::initializer_list<std::pair<const std::string, std::string>> p) : m_map{p} {}
|
||||
Header(std::initializer_list<std::pair<const std::string, std::string>>&& p) : m_map{std::forward<decltype(p)>(p)} {}
|
||||
std::unordered_map<std::string, std::string> m_map;
|
||||
|
||||
auto Find(const std::string& key) const {
|
||||
@@ -91,7 +91,7 @@ struct UserPass {
|
||||
struct UploadInfo {
|
||||
UploadInfo() = default;
|
||||
UploadInfo(const std::string& name) : m_name{name} {}
|
||||
UploadInfo(const std::string& name, s64 size, OnUploadCallback cb) : m_name{name}, m_size{size}, m_callback{cb} {}
|
||||
UploadInfo(const std::string& name, s64 size, const OnUploadCallback& cb) : m_name{name}, m_size{size}, m_callback{cb} {}
|
||||
UploadInfo(const std::string& name, const std::vector<u8>& data) : m_name{name}, m_data{data} {}
|
||||
std::string m_name{};
|
||||
std::vector<u8> m_data{};
|
||||
|
||||
@@ -487,7 +487,7 @@ struct FsNative : Fs {
|
||||
|
||||
FsFileSystem m_fs{};
|
||||
Result m_open_result{};
|
||||
bool m_own{true};
|
||||
const bool m_own{true};
|
||||
};
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -11,7 +11,7 @@ using OnInstallStart = std::function<bool(const char* path)>;
|
||||
using OnInstallWrite = std::function<bool(const void* buf, size_t size)>;
|
||||
using OnInstallClose = std::function<void()>;
|
||||
|
||||
void InitInstallMode(OnInstallStart on_start, OnInstallWrite on_write, OnInstallClose on_close);
|
||||
void InitInstallMode(const OnInstallStart& on_start, const OnInstallWrite& on_write, const OnInstallClose& on_close);
|
||||
void DisableInstallMode();
|
||||
|
||||
unsigned GetPort();
|
||||
|
||||
@@ -11,7 +11,7 @@ using OnInstallStart = std::function<bool(const char* path)>;
|
||||
using OnInstallWrite = std::function<bool(const void* buf, size_t size)>;
|
||||
using OnInstallClose = std::function<void()>;
|
||||
|
||||
void InitInstallMode(OnInstallStart on_start, OnInstallWrite on_write, OnInstallClose on_close);
|
||||
void InitInstallMode(const OnInstallStart& on_start, const OnInstallWrite& on_write, const OnInstallClose& on_close);
|
||||
void DisableInstallMode();
|
||||
|
||||
} // namespace sphaira::haze
|
||||
|
||||
@@ -32,11 +32,11 @@ using StartCallback = std::function<Result(PullCallback pull)>;
|
||||
using StartCallback2 = std::function<Result(StartThreadCallback start, PullCallback pull)>;
|
||||
|
||||
// reads data from rfunc into wfunc.
|
||||
Result Transfer(ui::ProgressBox* pbox, s64 size, ReadCallback rfunc, WriteCallback wfunc, Mode mode = Mode::MultiThreaded);
|
||||
Result Transfer(ui::ProgressBox* pbox, s64 size, const ReadCallback& rfunc, const WriteCallback& wfunc, Mode mode = Mode::MultiThreaded);
|
||||
|
||||
// reads data from rfunc, pull data from provided pull() callback.
|
||||
Result TransferPull(ui::ProgressBox* pbox, s64 size, ReadCallback rfunc, StartCallback sfunc, Mode mode = Mode::MultiThreaded);
|
||||
Result TransferPull(ui::ProgressBox* pbox, s64 size, ReadCallback rfunc, StartCallback2 sfunc, Mode mode = Mode::MultiThreaded);
|
||||
Result TransferPull(ui::ProgressBox* pbox, s64 size, const ReadCallback& rfunc, const StartCallback& sfunc, Mode mode = Mode::MultiThreaded);
|
||||
Result TransferPull(ui::ProgressBox* pbox, s64 size, const ReadCallback& rfunc, const StartCallback2& sfunc, Mode mode = Mode::MultiThreaded);
|
||||
|
||||
// helper for extract zips.
|
||||
// this will multi-thread unzip if size >= 512KiB, otherwise it'll single pass.
|
||||
@@ -50,7 +50,7 @@ using UnzipAllFilter = std::function<bool(const fs::FsPath& name, fs::FsPath& pa
|
||||
|
||||
// helper all-in-one unzip function that unzips a zip (either open or path provided).
|
||||
// the filter function can be used to modify the path and filter out unwanted files.
|
||||
Result TransferUnzipAll(ui::ProgressBox* pbox, void* zfile, fs::Fs* fs, const fs::FsPath& base_path, UnzipAllFilter filter = nullptr, Mode mode = Mode::SingleThreadedIfSmaller);
|
||||
Result TransferUnzipAll(ui::ProgressBox* pbox, const fs::FsPath& zip_out, fs::Fs* fs, const fs::FsPath& base_path, UnzipAllFilter filter = nullptr, Mode mode = Mode::SingleThreadedIfSmaller);
|
||||
Result TransferUnzipAll(ui::ProgressBox* pbox, void* zfile, fs::Fs* fs, const fs::FsPath& base_path, const UnzipAllFilter& filter = nullptr, Mode mode = Mode::SingleThreadedIfSmaller);
|
||||
Result TransferUnzipAll(ui::ProgressBox* pbox, const fs::FsPath& zip_out, fs::Fs* fs, const fs::FsPath& base_path, const UnzipAllFilter& filter = nullptr, Mode mode = Mode::SingleThreadedIfSmaller);
|
||||
|
||||
} // namespace sphaira::thread
|
||||
|
||||
@@ -10,14 +10,14 @@ struct List final : Object {
|
||||
GRID,
|
||||
};
|
||||
|
||||
using Callback = std::function<void(NVGcontext* vg, Theme* theme, Vec4 v, s64 index)>;
|
||||
using Callback = std::function<void(NVGcontext* vg, Theme* theme, const Vec4& v, s64 index)>;
|
||||
using TouchCallback = std::function<void(bool touch, s64 index)>;
|
||||
|
||||
List(s64 row, s64 page, const Vec4& pos, const Vec4& v, const Vec2& pad = {});
|
||||
|
||||
void OnUpdate(Controller* controller, TouchInfo* touch, s64 index, s64 count, TouchCallback callback);
|
||||
void OnUpdate(Controller* controller, TouchInfo* touch, s64 index, s64 count, const TouchCallback& callback);
|
||||
|
||||
void Draw(NVGcontext* vg, Theme* theme, s64 count, Callback callback) const;
|
||||
void Draw(NVGcontext* vg, Theme* theme, s64 count, const Callback& callback) const;
|
||||
|
||||
auto SetScrollBarPos(float x, float y, float h) {
|
||||
m_scrollbar.x = x;
|
||||
@@ -73,10 +73,10 @@ private:
|
||||
auto ClampX(float x, s64 count) const -> float;
|
||||
auto ClampY(float y, s64 count) const -> float;
|
||||
|
||||
void OnUpdateHome(Controller* controller, TouchInfo* touch, s64 index, s64 count, TouchCallback callback);
|
||||
void OnUpdateGrid(Controller* controller, TouchInfo* touch, s64 index, s64 count, TouchCallback callback);
|
||||
void DrawHome(NVGcontext* vg, Theme* theme, s64 count, Callback callback) const;
|
||||
void DrawGrid(NVGcontext* vg, Theme* theme, s64 count, Callback callback) const;
|
||||
void OnUpdateHome(Controller* controller, TouchInfo* touch, s64 index, s64 count, const TouchCallback& callback);
|
||||
void OnUpdateGrid(Controller* controller, TouchInfo* touch, s64 index, s64 count, const TouchCallback& callback);
|
||||
void DrawHome(NVGcontext* vg, Theme* theme, s64 count, const Callback& callback) const;
|
||||
void DrawGrid(NVGcontext* vg, Theme* theme, s64 count, const Callback& callback) const;
|
||||
|
||||
private:
|
||||
const s64 m_row;
|
||||
|
||||
@@ -86,14 +86,16 @@ struct EntryMenu final : MenuBase {
|
||||
|
||||
private:
|
||||
struct Option {
|
||||
Option(const std::string& dt, const std::string& ct, std::function<void(void)> f)
|
||||
using Callback = std::function<void(void)>;
|
||||
|
||||
Option(const std::string& dt, const std::string& ct, const Callback& f)
|
||||
: display_text{dt}, confirm_text{ct}, func{f} {}
|
||||
Option(const std::string& dt, std::function<void(void)> f)
|
||||
Option(const std::string& dt, const Callback& f)
|
||||
: display_text{dt}, func{f} {}
|
||||
|
||||
std::string display_text{};
|
||||
std::string confirm_text{};
|
||||
std::function<void(void)> func{};
|
||||
const std::string display_text;
|
||||
const std::string confirm_text;
|
||||
const Callback func{};
|
||||
};
|
||||
|
||||
Entry& m_entry;
|
||||
|
||||
@@ -33,9 +33,17 @@ struct MenuBase : Widget {
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetTitle(std::string title);
|
||||
void SetTitleSubHeading(std::string sub_heading);
|
||||
void SetSubHeading(std::string sub_heading);
|
||||
void SetTitle(const std::string& title) {
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
void SetTitleSubHeading(const std::string& sub_heading) {
|
||||
m_title_sub_heading = sub_heading;
|
||||
}
|
||||
|
||||
void SetSubHeading(const std::string& sub_heading) {
|
||||
m_sub_heading = sub_heading;
|
||||
}
|
||||
|
||||
auto GetTitle() const {
|
||||
return m_title;
|
||||
|
||||
@@ -104,7 +104,7 @@ struct Config {
|
||||
u32 limit{18};
|
||||
bool nsfw{false};
|
||||
|
||||
void SetQuery(std::string new_query) {
|
||||
void SetQuery(const std::string& new_query) {
|
||||
query = new_query;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ struct Config {
|
||||
query.clear();
|
||||
}
|
||||
|
||||
void SetCreator(Creator new_creator) {
|
||||
void SetCreator(const Creator& new_creator) {
|
||||
creator = new_creator.id;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,7 @@ public:
|
||||
enum class Side { LEFT, RIGHT };
|
||||
|
||||
public:
|
||||
NotifEntry(std::string text, Side side);
|
||||
~NotifEntry() = default;
|
||||
NotifEntry(const std::string& text, Side side);
|
||||
|
||||
auto Draw(NVGcontext* vg, Theme* theme, float y) -> bool;
|
||||
auto GetSide() const noexcept { return m_side; }
|
||||
@@ -22,17 +21,14 @@ private:
|
||||
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||
|
||||
private:
|
||||
std::string m_text{};
|
||||
std::string m_text;
|
||||
Side m_side;
|
||||
std::size_t m_count{180}; // count down to zero
|
||||
Side m_side{};
|
||||
bool m_bounds_measured{};
|
||||
};
|
||||
|
||||
class NotifMananger final : public Object {
|
||||
public:
|
||||
NotifMananger() = default;
|
||||
~NotifMananger() = default;
|
||||
|
||||
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||
|
||||
void Push(const NotifEntry& entry);
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
m_pos = { x, y, w, h };
|
||||
}
|
||||
|
||||
auto SetPos(Vec4 v) noexcept -> void {
|
||||
auto SetPos(const Vec4& v) noexcept -> void {
|
||||
m_pos = v;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class OptionBoxEntry final : public Widget {
|
||||
public:
|
||||
|
||||
public:
|
||||
OptionBoxEntry(const std::string& text, Vec4 pos);
|
||||
OptionBoxEntry(const std::string& text, const Vec4& pos);
|
||||
|
||||
auto Update(Controller* controller, TouchInfo* touch) -> void override {}
|
||||
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
||||
|
||||
@@ -13,11 +13,11 @@ public:
|
||||
using Callback = std::function<void(std::optional<s64>)>;
|
||||
|
||||
public:
|
||||
explicit PopupList(std::string title, Items items, Callback cb, s64 index = 0);
|
||||
PopupList(std::string title, Items items, Callback cb, std::string index);
|
||||
PopupList(std::string title, Items items, std::string& index_str_ref, s64& index);
|
||||
PopupList(std::string title, Items items, std::string& index_ref);
|
||||
PopupList(std::string title, Items items, s64& index_ref);
|
||||
explicit PopupList(const std::string& title, const Items& items, const Callback& cb, s64 index = 0);
|
||||
PopupList(const std::string& title, const Items& items, const Callback& cb, const std::string& index);
|
||||
PopupList(const std::string& title, const Items& items, std::string& index_str_ref, s64& index);
|
||||
PopupList(const std::string& title, const Items& items, std::string& index_ref);
|
||||
PopupList(const std::string& title, const Items& items, s64& index_ref);
|
||||
|
||||
auto Update(Controller* controller, TouchInfo* touch) -> void override;
|
||||
auto Draw(NVGcontext* vg, Theme* theme) -> void override;
|
||||
@@ -33,8 +33,8 @@ private:
|
||||
static constexpr float m_text_xoffset{15.f};
|
||||
static constexpr float m_line_width{1220.f};
|
||||
|
||||
std::string m_title{};
|
||||
Items m_items{};
|
||||
const std::string m_title;
|
||||
const Items m_items;
|
||||
Callback m_callback{};
|
||||
s64 m_index{}; // index in list array
|
||||
s64 m_starting_index{};
|
||||
|
||||
@@ -17,7 +17,7 @@ struct ProgressBox final : Widget {
|
||||
int image,
|
||||
const std::string& action,
|
||||
const std::string& title,
|
||||
ProgressBoxCallback callback, ProgressBoxDoneCallback done = [](Result rc){},
|
||||
const ProgressBoxCallback& callback, const ProgressBoxDoneCallback& done = [](Result rc){},
|
||||
int cpuid = 1, int prio = PRIO_PREEMPTIVE, int stack_size = 1024*128
|
||||
);
|
||||
~ProgressBox();
|
||||
|
||||
@@ -59,10 +59,10 @@ protected:
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string m_title;
|
||||
const std::string m_title;
|
||||
|
||||
private:
|
||||
std::string m_info{};
|
||||
const std::string m_info;
|
||||
std::string m_depends_info{};
|
||||
DependsCallback m_depends_callback{};
|
||||
DependsClickCallback m_depends_click{};
|
||||
@@ -78,7 +78,7 @@ public:
|
||||
using Callback = std::function<void(bool&)>;
|
||||
|
||||
public:
|
||||
explicit SidebarEntryBool(const std::string& title, bool option, Callback cb, const std::string& info = "", const std::string& true_str = "On", const std::string& false_str = "Off");
|
||||
explicit SidebarEntryBool(const std::string& title, bool option, const Callback& cb, const std::string& info = "", const std::string& true_str = "On", const std::string& false_str = "Off");
|
||||
explicit SidebarEntryBool(const std::string& title, bool& option, const std::string& info = "", const std::string& true_str = "On", const std::string& false_str = "Off");
|
||||
explicit SidebarEntryBool(const std::string& title, option::OptionBool& option, const Callback& cb, const std::string& info = "", const std::string& true_str = "On", const std::string& false_str = "Off");
|
||||
explicit SidebarEntryBool(const std::string& title, option::OptionBool& option, const std::string& info = "", const std::string& true_str = "On", const std::string& false_str = "Off");
|
||||
@@ -96,13 +96,13 @@ public:
|
||||
using Callback = std::function<void()>;
|
||||
|
||||
public:
|
||||
explicit SidebarEntryCallback(const std::string& title, Callback cb, const std::string& info);
|
||||
explicit SidebarEntryCallback(const std::string& title, Callback cb, bool pop_on_click = false, const std::string& info = "");
|
||||
explicit SidebarEntryCallback(const std::string& title, const Callback& cb, const std::string& info);
|
||||
explicit SidebarEntryCallback(const std::string& title, const Callback& cb, bool pop_on_click = false, const std::string& info = "");
|
||||
void Draw(NVGcontext* vg, Theme* theme, const Vec4& root_pos, bool left) override;
|
||||
|
||||
private:
|
||||
Callback m_callback;
|
||||
bool m_pop_on_click;
|
||||
const Callback m_callback;
|
||||
const bool m_pop_on_click;
|
||||
};
|
||||
|
||||
class SidebarEntryArray final : public SidebarEntryBase {
|
||||
@@ -112,16 +112,16 @@ public:
|
||||
using Callback = std::function<void(s64& index)>;
|
||||
|
||||
public:
|
||||
explicit SidebarEntryArray(const std::string& title, const Items& items, Callback cb, s64 index = 0, const std::string& info = "");
|
||||
explicit SidebarEntryArray(const std::string& title, const Items& items, Callback cb, const std::string& index, const std::string& info = "");
|
||||
explicit SidebarEntryArray(const std::string& title, const Items& items, const Callback& cb, s64 index = 0, const std::string& info = "");
|
||||
explicit SidebarEntryArray(const std::string& title, const Items& items, const Callback& cb, const std::string& index, const std::string& info = "");
|
||||
explicit SidebarEntryArray(const std::string& title, const Items& items, std::string& index, const std::string& info = "");
|
||||
void Draw(NVGcontext* vg, Theme* theme, const Vec4& root_pos, bool left) override;
|
||||
|
||||
private:
|
||||
Items m_items;
|
||||
ListCallback m_list_callback;
|
||||
Callback m_callback;
|
||||
const Items m_items;
|
||||
const Callback m_callback;
|
||||
s64 m_index;
|
||||
ListCallback m_list_callback{};
|
||||
};
|
||||
|
||||
// single text entry.
|
||||
@@ -204,9 +204,9 @@ private:
|
||||
void SetupButtons();
|
||||
|
||||
private:
|
||||
std::string m_title;
|
||||
std::string m_sub;
|
||||
Side m_side;
|
||||
const std::string m_title;
|
||||
const std::string m_sub;
|
||||
const Side m_side;
|
||||
Items m_items;
|
||||
s64 m_index{};
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ struct Vec2 {
|
||||
struct Vec4 {
|
||||
constexpr Vec4() = default;
|
||||
constexpr Vec4(float _x, float _y, float _w, float _h) : x{_x}, y{_y}, w{_w}, h{_h} {}
|
||||
constexpr Vec4(Vec2 vec0, Vec2 vec1) : x{vec0.x}, y{vec0.y}, w{vec1.x}, h{vec1.y} {}
|
||||
constexpr Vec4(Vec4 vec0, Vec4 vec1) : x{vec0.x}, y{vec0.y}, w{vec1.w}, h{vec1.h} {}
|
||||
constexpr Vec4(const Vec2& vec0, const Vec2& vec1) : x{vec0.x}, y{vec0.y}, w{vec1.x}, h{vec1.y} {}
|
||||
constexpr Vec4(const Vec4& vec0, const Vec4& vec1) : x{vec0.x}, y{vec0.y}, w{vec1.w}, h{vec1.h} {}
|
||||
|
||||
float& operator[](std::size_t idx) {
|
||||
switch (idx) {
|
||||
@@ -339,10 +339,10 @@ struct Action final {
|
||||
CallbackWithBool
|
||||
>;
|
||||
|
||||
Action(Callback cb) : Action{ActionType::DOWN, "", cb} {}
|
||||
Action(std::string hint, Callback cb) : Action{ActionType::DOWN, hint, cb} {}
|
||||
Action(u8 type, Callback cb) : Action{type, "", cb} {}
|
||||
Action(u8 type, std::string hint, Callback cb) : m_type{type}, m_callback{cb}, m_hint{hint} {}
|
||||
explicit Action(const Callback& cb) : Action{ActionType::DOWN, "", cb} {}
|
||||
explicit Action(const std::string& hint, const Callback& cb) : Action{ActionType::DOWN, hint, cb} {}
|
||||
explicit Action(u8 type, const Callback& cb) : Action{type, "", cb} {}
|
||||
explicit Action(u8 type, const std::string& hint, const Callback& cb) : m_type{type}, m_callback{cb}, m_hint{hint} {}
|
||||
|
||||
auto IsHidden() const noexcept { return m_hint.empty(); }
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ struct Widget : public Object {
|
||||
}
|
||||
|
||||
auto HasAction(Button button) const -> bool;
|
||||
void SetAction(Button button, Action action);
|
||||
void SetActions(std::same_as<std::pair<Button, Action>> auto ...args) {
|
||||
void SetAction(Button button, const Action& action);
|
||||
void SetActions(std::same_as<std::pair<Button, Action>> auto&& ...args) {
|
||||
const std::array list = {args...};
|
||||
for (const auto& [button, action] : list) {
|
||||
SetAction(button, action);
|
||||
|
||||
@@ -539,7 +539,7 @@ auto App::PopToMenu() -> void {
|
||||
}
|
||||
}
|
||||
|
||||
void App::Notify(std::string text, ui::NotifEntry::Side side) {
|
||||
void App::Notify(const std::string& text, ui::NotifEntry::Side side) {
|
||||
g_app->m_notif_manager.Push({text, side});
|
||||
}
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ void Exit() {
|
||||
}
|
||||
|
||||
#if ENABLE_NETWORK_INSTALL
|
||||
void InitInstallMode(OnInstallStart on_start, OnInstallWrite on_write, OnInstallClose on_close) {
|
||||
void InitInstallMode(const OnInstallStart& on_start, const OnInstallWrite& on_write, const OnInstallClose& on_close) {
|
||||
SCOPED_MUTEX(&g_shared_data.mutex);
|
||||
g_shared_data.on_start = on_start;
|
||||
g_shared_data.on_write = on_write;
|
||||
|
||||
@@ -610,7 +610,7 @@ void Exit() {
|
||||
}
|
||||
|
||||
#if ENABLE_NETWORK_INSTALL
|
||||
void InitInstallMode(OnInstallStart on_start, OnInstallWrite on_write, OnInstallClose on_close) {
|
||||
void InitInstallMode(const OnInstallStart& on_start, const OnInstallWrite& on_write, const OnInstallClose& on_close) {
|
||||
SCOPED_MUTEX(&g_shared_data.mutex);
|
||||
g_shared_data.on_start = on_start;
|
||||
g_shared_data.on_write = on_write;
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
};
|
||||
|
||||
struct ThreadData {
|
||||
ThreadData(ui::ProgressBox* _pbox, s64 size, ReadCallback _rfunc, WriteCallback _wfunc, u64 buffer_size);
|
||||
ThreadData(ui::ProgressBox* _pbox, s64 size, const ReadCallback& _rfunc, const WriteCallback& _wfunc, u64 buffer_size);
|
||||
|
||||
auto GetResults() volatile -> Result;
|
||||
void WakeAllThreads();
|
||||
@@ -131,8 +131,8 @@ private:
|
||||
private:
|
||||
// these need to be copied
|
||||
ui::ProgressBox* const pbox;
|
||||
const ReadCallback rfunc;
|
||||
const WriteCallback wfunc;
|
||||
const ReadCallback& rfunc;
|
||||
const WriteCallback& wfunc;
|
||||
|
||||
// these need to be created
|
||||
Mutex mutex{};
|
||||
@@ -165,7 +165,7 @@ private:
|
||||
std::atomic_bool write_running{true};
|
||||
};
|
||||
|
||||
ThreadData::ThreadData(ui::ProgressBox* _pbox, s64 size, ReadCallback _rfunc, WriteCallback _wfunc, u64 buffer_size)
|
||||
ThreadData::ThreadData(ui::ProgressBox* _pbox, s64 size, const ReadCallback& _rfunc, const WriteCallback& _wfunc, u64 buffer_size)
|
||||
: pbox{_pbox}
|
||||
, rfunc{_rfunc}
|
||||
, wfunc{_wfunc}
|
||||
@@ -355,7 +355,7 @@ auto GetAlternateCore(int id) {
|
||||
return id == 1 ? 2 : 1;
|
||||
}
|
||||
|
||||
Result TransferInternal(ui::ProgressBox* pbox, s64 size, ReadCallback rfunc, WriteCallback wfunc, StartCallback2 sfunc, Mode mode, u64 buffer_size = NORMAL_BUFFER_SIZE) {
|
||||
Result TransferInternal(ui::ProgressBox* pbox, s64 size, const ReadCallback& rfunc, const WriteCallback& wfunc, const StartCallback2& sfunc, Mode mode, u64 buffer_size = NORMAL_BUFFER_SIZE) {
|
||||
const auto is_file_based_emummc = App::IsFileBaseEmummc();
|
||||
|
||||
if (is_file_based_emummc) {
|
||||
@@ -480,18 +480,18 @@ Result TransferInternal(ui::ProgressBox* pbox, s64 size, ReadCallback rfunc, Wri
|
||||
|
||||
} // namespace
|
||||
|
||||
Result Transfer(ui::ProgressBox* pbox, s64 size, ReadCallback rfunc, WriteCallback wfunc, Mode mode) {
|
||||
Result Transfer(ui::ProgressBox* pbox, s64 size, const ReadCallback& rfunc, const WriteCallback& wfunc, Mode mode) {
|
||||
return TransferInternal(pbox, size, rfunc, wfunc, nullptr, mode);
|
||||
}
|
||||
|
||||
Result TransferPull(ui::ProgressBox* pbox, s64 size, ReadCallback rfunc, StartCallback sfunc, Mode mode) {
|
||||
Result TransferPull(ui::ProgressBox* pbox, s64 size, const ReadCallback& rfunc, const StartCallback& sfunc, Mode mode) {
|
||||
return TransferInternal(pbox, size, rfunc, nullptr, [sfunc](StartThreadCallback start, PullCallback pull) -> Result {
|
||||
R_TRY(start());
|
||||
return sfunc(pull);
|
||||
}, mode);
|
||||
}
|
||||
|
||||
Result TransferPull(ui::ProgressBox* pbox, s64 size, ReadCallback rfunc, StartCallback2 sfunc, Mode mode) {
|
||||
Result TransferPull(ui::ProgressBox* pbox, s64 size, const ReadCallback& rfunc, const StartCallback2& sfunc, Mode mode) {
|
||||
return TransferInternal(pbox, size, rfunc, nullptr, sfunc, mode);
|
||||
}
|
||||
|
||||
@@ -575,7 +575,7 @@ Result TransferZip(ui::ProgressBox* pbox, void* zfile, fs::Fs* fs, const fs::FsP
|
||||
);
|
||||
}
|
||||
|
||||
Result TransferUnzipAll(ui::ProgressBox* pbox, void* zfile, fs::Fs* fs, const fs::FsPath& base_path, UnzipAllFilter filter, Mode mode) {
|
||||
Result TransferUnzipAll(ui::ProgressBox* pbox, void* zfile, fs::Fs* fs, const fs::FsPath& base_path, const UnzipAllFilter& filter, Mode mode) {
|
||||
unz_global_info64 ginfo;
|
||||
if (UNZ_OK != unzGetGlobalInfo64(zfile, &ginfo)) {
|
||||
R_THROW(Result_UnzGetGlobalInfo64);
|
||||
@@ -632,7 +632,7 @@ Result TransferUnzipAll(ui::ProgressBox* pbox, void* zfile, fs::Fs* fs, const fs
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result TransferUnzipAll(ui::ProgressBox* pbox, const fs::FsPath& zip_out, fs::Fs* fs, const fs::FsPath& base_path, UnzipAllFilter filter, Mode mode) {
|
||||
Result TransferUnzipAll(ui::ProgressBox* pbox, const fs::FsPath& zip_out, fs::Fs* fs, const fs::FsPath& base_path, const UnzipAllFilter& filter, Mode mode) {
|
||||
zlib_filefunc64_def file_func;
|
||||
mz::FileFuncStdio(&file_func);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ auto List::ClampY(float y, s64 count) const -> float {
|
||||
return std::clamp(y, 0.F, y_max);
|
||||
}
|
||||
|
||||
void List::OnUpdate(Controller* controller, TouchInfo* touch, s64 index, s64 count, TouchCallback callback) {
|
||||
void List::OnUpdate(Controller* controller, TouchInfo* touch, s64 index, s64 count, const TouchCallback& callback) {
|
||||
switch (m_layout) {
|
||||
case Layout::HOME:
|
||||
OnUpdateHome(controller, touch, index, count, callback);
|
||||
@@ -46,7 +46,7 @@ void List::OnUpdate(Controller* controller, TouchInfo* touch, s64 index, s64 cou
|
||||
}
|
||||
}
|
||||
|
||||
void List::Draw(NVGcontext* vg, Theme* theme, s64 count, Callback callback) const {
|
||||
void List::Draw(NVGcontext* vg, Theme* theme, s64 count, const Callback& callback) const {
|
||||
switch (m_layout) {
|
||||
case Layout::HOME:
|
||||
DrawHome(vg, theme, count, callback);
|
||||
@@ -129,7 +129,7 @@ auto List::ScrollUp(s64& index, s64 step, s64 count) -> bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
void List::OnUpdateHome(Controller* controller, TouchInfo* touch, s64 index, s64 count, TouchCallback callback) {
|
||||
void List::OnUpdateHome(Controller* controller, TouchInfo* touch, s64 index, s64 count, const TouchCallback& callback) {
|
||||
if (controller->GotDown(Button::RIGHT)) {
|
||||
if (ScrollDown(index, m_row, count)) {
|
||||
callback(false, index);
|
||||
@@ -165,7 +165,7 @@ void List::OnUpdateHome(Controller* controller, TouchInfo* touch, s64 index, s64
|
||||
}
|
||||
}
|
||||
|
||||
void List::OnUpdateGrid(Controller* controller, TouchInfo* touch, s64 index, s64 count, TouchCallback callback) {
|
||||
void List::OnUpdateGrid(Controller* controller, TouchInfo* touch, s64 index, s64 count, const TouchCallback& callback) {
|
||||
const auto page_up_button = GetPageJump() ? (m_row == 1 ? Button::DPAD_LEFT : Button::L2) : (Button::NONE);
|
||||
const auto page_down_button = GetPageJump() ? (m_row == 1 ? Button::DPAD_RIGHT : Button::R2) : (Button::NONE);
|
||||
|
||||
@@ -236,7 +236,7 @@ void List::OnUpdateGrid(Controller* controller, TouchInfo* touch, s64 index, s64
|
||||
}
|
||||
}
|
||||
|
||||
void List::DrawHome(NVGcontext* vg, Theme* theme, s64 count, Callback callback) const {
|
||||
void List::DrawHome(NVGcontext* vg, Theme* theme, s64 count, const Callback& callback) const {
|
||||
const auto yoff = ClampX(m_yoff + m_y_prog, count);
|
||||
auto v = m_v;
|
||||
v.x -= yoff;
|
||||
@@ -260,7 +260,7 @@ void List::DrawHome(NVGcontext* vg, Theme* theme, s64 count, Callback callback)
|
||||
nvgRestore(vg);
|
||||
}
|
||||
|
||||
void List::DrawGrid(NVGcontext* vg, Theme* theme, s64 count, Callback callback) const {
|
||||
void List::DrawGrid(NVGcontext* vg, Theme* theme, s64 count, const Callback& callback) const {
|
||||
const auto yoff = ClampY(m_yoff + m_y_prog, count);
|
||||
const s64 start = yoff / GetMaxY() * m_row;
|
||||
gfx::drawScrollbar2(vg, theme, m_scrollbar.x, m_scrollbar.y, m_scrollbar.h, start, count, m_row, m_page);
|
||||
|
||||
@@ -288,7 +288,7 @@ void DrawIcon(NVGcontext* vg, const LazyImage& l, const LazyImage& d, float x, f
|
||||
}
|
||||
}
|
||||
|
||||
void DrawIcon(NVGcontext* vg, const LazyImage& l, const LazyImage& d, Vec4 vec, bool rounded = true, float scale = 1.0) {
|
||||
void DrawIcon(NVGcontext* vg, const LazyImage& l, const LazyImage& d, const Vec4& vec, bool rounded = true, float scale = 1.0) {
|
||||
DrawIcon(vg, l, d, vec.x, vec.y, vec.w, vec.h, rounded, scale);
|
||||
}
|
||||
|
||||
|
||||
@@ -444,7 +444,7 @@ void Menu::Draw(NVGcontext* vg, Theme* theme) {
|
||||
constexpr float text_xoffset{15.f};
|
||||
bool got_dir_count = false;
|
||||
|
||||
m_list->Draw(vg, theme, m_entries_current.size(), [this, text_col, &got_dir_count](auto* vg, auto* theme, auto v, auto i) {
|
||||
m_list->Draw(vg, theme, m_entries_current.size(), [this, text_col, &got_dir_count](auto* vg, auto* theme, auto& v, auto i) {
|
||||
const auto& [x, y, w, h] = v;
|
||||
auto& e = GetEntry(i);
|
||||
|
||||
|
||||
@@ -568,7 +568,7 @@ void FsView::Draw(NVGcontext* vg, Theme* theme) {
|
||||
constexpr float text_xoffset{15.f};
|
||||
bool got_dir_count = false;
|
||||
|
||||
m_list->Draw(vg, theme, m_entries_current.size(), [this, text_col, &got_dir_count](auto* vg, auto* theme, auto v, auto i) {
|
||||
m_list->Draw(vg, theme, m_entries_current.size(), [this, text_col, &got_dir_count](auto* vg, auto* theme, auto& v, auto i) {
|
||||
const auto& [x, y, w, h] = v;
|
||||
auto& e = GetEntry(i);
|
||||
|
||||
|
||||
@@ -502,7 +502,7 @@ void Menu::Draw(NVGcontext* vg, Theme* theme) {
|
||||
nvgRestore(vg);
|
||||
}
|
||||
|
||||
m_list->Draw(vg, theme, std::size(g_option_list), [this](auto* vg, auto* theme, auto v, auto i) {
|
||||
m_list->Draw(vg, theme, std::size(g_option_list), [this](auto* vg, auto* theme, auto& v, auto i) {
|
||||
const auto& [x, y, w, h] = v;
|
||||
const auto text_y = y + (h / 2.f);
|
||||
auto colour = ThemeEntryID_TEXT;
|
||||
|
||||
@@ -215,7 +215,7 @@ void Menu::Draw(NVGcontext* vg, Theme* theme) {
|
||||
|
||||
constexpr float text_xoffset{15.f};
|
||||
|
||||
m_list->Draw(vg, theme, m_entries.size(), [this, text_col](auto* vg, auto* theme, auto v, auto i) {
|
||||
m_list->Draw(vg, theme, m_entries.size(), [this, text_col](auto* vg, auto* theme, auto& v, auto i) {
|
||||
const auto& [x, y, w, h] = v;
|
||||
auto& e = m_entries[i];
|
||||
|
||||
|
||||
@@ -110,16 +110,4 @@ void MenuBase::Draw(NVGcontext* vg, Theme* theme) {
|
||||
m_scroll_sub_heading.Draw(vg, true, 80, 685, text_w - 160, 18, NVG_ALIGN_LEFT, theme->GetColour(ThemeEntryID_TEXT), m_sub_heading.c_str());
|
||||
}
|
||||
|
||||
void MenuBase::SetTitle(std::string title) {
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
void MenuBase::SetTitleSubHeading(std::string sub_heading) {
|
||||
m_title_sub_heading = sub_heading;
|
||||
}
|
||||
|
||||
void MenuBase::SetSubHeading(std::string sub_heading) {
|
||||
m_sub_heading = sub_heading;
|
||||
}
|
||||
|
||||
} // namespace sphaira::ui::menu
|
||||
|
||||
@@ -11,8 +11,8 @@ constexpr u64 MAX_ENTRIES = 9;
|
||||
|
||||
} // namespace
|
||||
|
||||
NotifEntry::NotifEntry(std::string text, Side side)
|
||||
: m_text{std::move(text)}
|
||||
NotifEntry::NotifEntry(const std::string& text, Side side)
|
||||
: m_text{text}
|
||||
, m_side{side} {
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace sphaira::ui {
|
||||
|
||||
OptionBoxEntry::OptionBoxEntry(const std::string& text, Vec4 pos)
|
||||
OptionBoxEntry::OptionBoxEntry(const std::string& text, const Vec4& pos)
|
||||
: m_text{text} {
|
||||
m_pos = pos;
|
||||
m_text_pos = Vec2{m_pos.x + (m_pos.w / 2.f), m_pos.y + (m_pos.h / 2.f)};
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
namespace sphaira::ui {
|
||||
|
||||
PopupList::PopupList(std::string title, Items items, std::string& index_str_ref, s64& index_ref)
|
||||
: PopupList{std::move(title), std::move(items), Callback{}, index_ref} {
|
||||
PopupList::PopupList(const std::string& title, const Items& items, std::string& index_str_ref, s64& index_ref)
|
||||
: PopupList{title, items, Callback{}, index_ref} {
|
||||
|
||||
m_callback = [&index_str_ref, &index_ref, this](auto op_idx) {
|
||||
if (op_idx) {
|
||||
@@ -17,8 +17,8 @@ PopupList::PopupList(std::string title, Items items, std::string& index_str_ref,
|
||||
};
|
||||
}
|
||||
|
||||
PopupList::PopupList(std::string title, Items items, std::string& index_ref)
|
||||
: PopupList{std::move(title), std::move(items), Callback{}} {
|
||||
PopupList::PopupList(const std::string& title, const Items& items, std::string& index_ref)
|
||||
: PopupList{title, items, Callback{}} {
|
||||
|
||||
const auto it = std::find(m_items.cbegin(), m_items.cend(), index_ref);
|
||||
if (it != m_items.cend()) {
|
||||
@@ -35,8 +35,8 @@ PopupList::PopupList(std::string title, Items items, std::string& index_ref)
|
||||
};
|
||||
}
|
||||
|
||||
PopupList::PopupList(std::string title, Items items, s64& index_ref)
|
||||
: PopupList{std::move(title), std::move(items), Callback{}, index_ref} {
|
||||
PopupList::PopupList(const std::string& title, const Items& items, s64& index_ref)
|
||||
: PopupList{title, items, Callback{}, index_ref} {
|
||||
|
||||
m_callback = [&index_ref, this](auto op_idx) {
|
||||
if (op_idx) {
|
||||
@@ -45,8 +45,8 @@ PopupList::PopupList(std::string title, Items items, s64& index_ref)
|
||||
};
|
||||
}
|
||||
|
||||
PopupList::PopupList(std::string title, Items items, Callback cb, std::string index)
|
||||
: PopupList{std::move(title), std::move(items), cb, 0} {
|
||||
PopupList::PopupList(const std::string& title, const Items& items, const Callback& cb, const std::string& index)
|
||||
: PopupList{title, items, cb, 0} {
|
||||
|
||||
const auto it = std::find(m_items.cbegin(), m_items.cend(), index);
|
||||
if (it != m_items.cend()) {
|
||||
@@ -57,9 +57,9 @@ PopupList::PopupList(std::string title, Items items, Callback cb, std::string in
|
||||
}
|
||||
}
|
||||
|
||||
PopupList::PopupList(std::string title, Items items, Callback cb, s64 index)
|
||||
: m_title{std::move(title)}
|
||||
, m_items{std::move(items)}
|
||||
PopupList::PopupList(const std::string& title, const Items& items, const Callback& cb, s64 index)
|
||||
: m_title{title}
|
||||
, m_items{items}
|
||||
, m_callback{cb}
|
||||
, m_index{index} {
|
||||
this->SetActions(
|
||||
@@ -111,7 +111,7 @@ auto PopupList::Draw(NVGcontext* vg, Theme* theme) -> void {
|
||||
gfx::drawRect(vg, 30.f, m_line_top, m_line_width, 1.f, theme->GetColour(ThemeEntryID_LINE));
|
||||
gfx::drawRect(vg, 30.f, m_line_bottom, m_line_width, 1.f, theme->GetColour(ThemeEntryID_LINE));
|
||||
|
||||
m_list->Draw(vg, theme, m_items.size(), [this](auto* vg, auto* theme, auto v, auto i) {
|
||||
m_list->Draw(vg, theme, m_items.size(), [this](auto* vg, auto* theme, auto& v, auto i) {
|
||||
const auto& [x, y, w, h] = v;
|
||||
auto colour = ThemeEntryID_TEXT;
|
||||
const auto selected = m_index == i;
|
||||
|
||||
@@ -19,7 +19,11 @@ void threadFunc(void* arg) {
|
||||
|
||||
} // namespace
|
||||
|
||||
ProgressBox::ProgressBox(int image, const std::string& action, const std::string& title, ProgressBoxCallback callback, ProgressBoxDoneCallback done, int cpuid, int prio, int stack_size) {
|
||||
ProgressBox::ProgressBox(int image, const std::string& action, const std::string& title, const ProgressBoxCallback& callback, const ProgressBoxDoneCallback& done, int cpuid, int prio, int stack_size)
|
||||
: m_done{done}
|
||||
, m_action{action}
|
||||
, m_title{title}
|
||||
, m_image{image} {
|
||||
if (App::GetApp()->m_progress_boost_mode.Get()) {
|
||||
App::SetBoostMode(true);
|
||||
}
|
||||
@@ -38,11 +42,6 @@ ProgressBox::ProgressBox(int image, const std::string& action, const std::string
|
||||
m_pos.x = (SCREEN_WIDTH / 2.f) - (m_pos.w / 2.f);
|
||||
m_pos.y = (SCREEN_HEIGHT / 2.f) - (m_pos.h / 2.f);
|
||||
|
||||
m_done = done;
|
||||
m_title = title;
|
||||
m_action = action;
|
||||
m_image = image;
|
||||
|
||||
// create cancel event.
|
||||
ueventCreate(&m_uevent, false);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace sphaira::ui {
|
||||
namespace {
|
||||
|
||||
auto DistanceBetweenY(Vec4 va, Vec4 vb) -> Vec4 {
|
||||
auto DistanceBetweenY(const Vec4& va, const Vec4& vb) -> Vec4 {
|
||||
return Vec4{
|
||||
va.x, va.y,
|
||||
va.w, vb.y - va.y
|
||||
@@ -104,7 +104,7 @@ void SidebarEntryBase::DrawEntry(NVGcontext* vg, Theme* theme, const std::string
|
||||
m_scolling_value.Draw(vg, HasFocus(), xpos, ypos, max_off, 20.f, NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE, theme->GetColour(value_id), right);
|
||||
}
|
||||
|
||||
SidebarEntryBool::SidebarEntryBool(const std::string& title, bool option, Callback cb, const std::string& info, const std::string& true_str, const std::string& false_str)
|
||||
SidebarEntryBool::SidebarEntryBool(const std::string& title, bool option, const Callback& cb, const std::string& info, const std::string& true_str, const std::string& false_str)
|
||||
: SidebarEntryBase{title, info}
|
||||
, m_option{option}
|
||||
, m_callback{cb}
|
||||
@@ -154,7 +154,7 @@ void SidebarEntryBool::Draw(NVGcontext* vg, Theme* theme, const Vec4& root_pos,
|
||||
SidebarEntryBase::DrawEntry(vg, theme, m_title, m_option ? m_true_str : m_false_str, m_option);
|
||||
}
|
||||
|
||||
SidebarEntryCallback::SidebarEntryCallback(const std::string& title, Callback cb, bool pop_on_click, const std::string& info)
|
||||
SidebarEntryCallback::SidebarEntryCallback(const std::string& title, const Callback& cb, bool pop_on_click, const std::string& info)
|
||||
: SidebarEntryBase{title, info}
|
||||
, m_callback{cb}
|
||||
, m_pop_on_click{pop_on_click} {
|
||||
@@ -170,7 +170,7 @@ SidebarEntryCallback::SidebarEntryCallback(const std::string& title, Callback cb
|
||||
});
|
||||
}
|
||||
|
||||
SidebarEntryCallback::SidebarEntryCallback(const std::string& title, Callback cb, const std::string& info)
|
||||
SidebarEntryCallback::SidebarEntryCallback(const std::string& title, const Callback& cb, const std::string& info)
|
||||
: SidebarEntryCallback{title, cb, false, info} {
|
||||
|
||||
}
|
||||
@@ -197,7 +197,7 @@ SidebarEntryArray::SidebarEntryArray(const std::string& title, const Items& item
|
||||
};
|
||||
}
|
||||
|
||||
SidebarEntryArray::SidebarEntryArray(const std::string& title, const Items& items, Callback cb, const std::string& index, const std::string& info)
|
||||
SidebarEntryArray::SidebarEntryArray(const std::string& title, const Items& items, const Callback& cb, const std::string& index, const std::string& info)
|
||||
: SidebarEntryArray{title, items, cb, 0, info} {
|
||||
|
||||
const auto it = std::find(m_items.cbegin(), m_items.cend(), index);
|
||||
@@ -206,7 +206,7 @@ SidebarEntryArray::SidebarEntryArray(const std::string& title, const Items& item
|
||||
}
|
||||
}
|
||||
|
||||
SidebarEntryArray::SidebarEntryArray(const std::string& title, const Items& items, Callback cb, s64 index, const std::string& info)
|
||||
SidebarEntryArray::SidebarEntryArray(const std::string& title, const Items& items, const Callback& cb, s64 index, const std::string& info)
|
||||
: SidebarEntryBase{title, info}
|
||||
, m_items{items}
|
||||
, m_callback{cb}
|
||||
@@ -355,7 +355,7 @@ auto Sidebar::Draw(NVGcontext* vg, Theme* theme) -> void {
|
||||
|
||||
Widget::Draw(vg, theme);
|
||||
|
||||
m_list->Draw(vg, theme, m_items.size(), [this](auto* vg, auto* theme, auto v, auto i) {
|
||||
m_list->Draw(vg, theme, m_items.size(), [this](auto* vg, auto* theme, auto& v, auto i) {
|
||||
const auto& [x, y, w, h] = v;
|
||||
|
||||
if (i != m_items.size() - 1) {
|
||||
|
||||
@@ -70,7 +70,7 @@ auto Widget::HasAction(Button button) const -> bool {
|
||||
return m_actions.contains(button);
|
||||
}
|
||||
|
||||
void Widget::SetAction(Button button, Action action) {
|
||||
void Widget::SetAction(Button button, const Action& action) {
|
||||
m_actions.insert_or_assign(button, action);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user