1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-09 12:11:44 +00:00
nxdumptool/include/dump_options_frame.hpp
Pablo Curiel 17ec42d812 [ci skip] Add GameCardImageDumpOptionsFrame class
This commit turns DumpOptionsFrame into a non-polymorphic, non-instantiable class with an overloaded constructor, and moves most of the generic logic from its header file into a proper C++ module.

GameCardImageDumpOptionsFrame is an inherited class of DumpOptionsFrame, which adds the extra option items it needs on its own.
2024-04-20 00:42:11 +02:00

79 lines
2.6 KiB
C++

/*
* dump_options_frame.hpp
*
* Copyright (c) 2020-2024, DarkMatterCore <pabloacurielz@gmail.com>.
*
* This file is part of nxdumptool (https://github.com/DarkMatterCore/nxdumptool).
*
* nxdumptool is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* nxdumptool is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#ifndef __DUMP_OPTIONS_FRAME_HPP__
#define __DUMP_OPTIONS_FRAME_HPP__
#include <borealis.hpp>
#include "root_view.hpp"
namespace nxdt::views
{
class DumpOptionsFrame: public brls::ThumbnailFrame
{
private:
RootView *root_view = nullptr;
std::string raw_filename{}, extension{};
brls::List *list = nullptr;
brls::InputListItem *filename = nullptr;
brls::SelectListItem *output_storage = nullptr;
brls::GenericEvent *button_click_event = nullptr;
nxdt::tasks::UmsEvent::Subscription ums_task_sub;
bool finalized = false;
void Initialize(std::string& title, brls::Image *icon);
std::string SanitizeUserFileName(void);
void UpdateOutputStorages(const nxdt::tasks::UmsDeviceVector& ums_devices);
protected:
DumpOptionsFrame(RootView *root_view, std::string& title, std::string& raw_filename, std::string extension);
DumpOptionsFrame(RootView *root_view, std::string& title, brls::Image *icon, std::string& raw_filename, std::string extension);
~DumpOptionsFrame();
bool onCancel(void) override final;
void addView(brls::View *view, bool fill = false);
std::string GetFileName(void);
std::string GetOutputStoragePrefix(void);
ALWAYS_INLINE brls::GenericEvent::Subscription RegisterButtonListener(brls::GenericEvent::Callback cb)
{
return this->button_click_event->subscribe(cb);
}
ALWAYS_INLINE void UnregisterButtonListener(brls::GenericEvent::Subscription subscription)
{
this->button_click_event->unsubscribe(subscription);
}
};
}
#endif /* __DUMP_OPTIONS_FRAME_HPP__ */