2022-09-12 19:19:10 +01:00
|
|
|
/*
|
|
|
|
* dump_options_frame.hpp
|
|
|
|
*
|
2024-04-12 10:47:36 +01:00
|
|
|
* Copyright (c) 2020-2024, DarkMatterCore <pabloacurielz@gmail.com>.
|
2022-09-12 19:19:10 +01:00
|
|
|
*
|
|
|
|
* 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>
|
|
|
|
|
2024-04-19 23:42:11 +01:00
|
|
|
#include "root_view.hpp"
|
2022-09-12 19:19:10 +01:00
|
|
|
|
|
|
|
namespace nxdt::views
|
|
|
|
{
|
|
|
|
class DumpOptionsFrame: public brls::ThumbnailFrame
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
RootView *root_view = nullptr;
|
2024-04-20 22:52:56 +01:00
|
|
|
std::string storage_prefix{}, base_output_path{}, raw_filename{}, extension{};
|
2022-09-12 19:19:10 +01:00
|
|
|
|
|
|
|
brls::List *list = nullptr;
|
2024-04-19 23:42:11 +01:00
|
|
|
brls::InputListItem *filename = nullptr;
|
|
|
|
brls::SelectListItem *output_storage = nullptr;
|
|
|
|
brls::GenericEvent *button_click_event = nullptr;
|
2022-09-12 19:19:10 +01:00
|
|
|
|
2024-04-19 23:42:11 +01:00
|
|
|
nxdt::tasks::UmsEvent::Subscription ums_task_sub;
|
2024-04-15 00:53:43 +01:00
|
|
|
|
2024-04-19 23:42:11 +01:00
|
|
|
bool finalized = false;
|
2022-09-12 19:19:10 +01:00
|
|
|
|
2024-04-20 22:52:56 +01:00
|
|
|
void Initialize(const std::string& title, brls::Image *icon);
|
2024-04-17 20:32:18 +01:00
|
|
|
|
2024-04-19 23:42:11 +01:00
|
|
|
std::string SanitizeUserFileName(void);
|
2024-04-15 00:53:43 +01:00
|
|
|
|
2024-04-19 23:42:11 +01:00
|
|
|
void UpdateOutputStorages(const nxdt::tasks::UmsDeviceVector& ums_devices);
|
2024-04-20 22:52:56 +01:00
|
|
|
void UpdateStoragePrefix(u32 selected);
|
2022-09-12 19:19:10 +01:00
|
|
|
|
|
|
|
protected:
|
2024-04-20 22:52:56 +01:00
|
|
|
DumpOptionsFrame(RootView *root_view, const std::string& title, const std::string& base_output_path, const std::string& raw_filename, const std::string& extension);
|
|
|
|
DumpOptionsFrame(RootView *root_view, const std::string& title, brls::Image *icon, const std::string& base_output_path, const std::string& raw_filename, const std::string& extension);
|
2024-04-19 23:42:11 +01:00
|
|
|
~DumpOptionsFrame();
|
2022-09-12 19:19:10 +01:00
|
|
|
|
2024-04-19 23:42:11 +01:00
|
|
|
bool onCancel(void) override final;
|
2022-09-12 19:19:10 +01:00
|
|
|
|
2024-04-19 23:42:11 +01:00
|
|
|
void addView(brls::View *view, bool fill = false);
|
2022-09-12 19:19:10 +01:00
|
|
|
|
2024-04-20 22:52:56 +01:00
|
|
|
const std::string GetOutputFilePath(void);
|
2022-09-12 19:19:10 +01:00
|
|
|
|
2024-04-19 23:42:11 +01:00
|
|
|
ALWAYS_INLINE brls::GenericEvent::Subscription RegisterButtonListener(brls::GenericEvent::Callback cb)
|
|
|
|
{
|
|
|
|
return this->button_click_event->subscribe(cb);
|
2022-09-12 19:19:10 +01:00
|
|
|
}
|
|
|
|
|
2024-04-19 23:42:11 +01:00
|
|
|
ALWAYS_INLINE void UnregisterButtonListener(brls::GenericEvent::Subscription subscription)
|
2022-09-12 19:19:10 +01:00
|
|
|
{
|
2024-04-19 23:42:11 +01:00
|
|
|
this->button_click_event->unsubscribe(subscription);
|
2022-09-12 19:19:10 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __DUMP_OPTIONS_FRAME_HPP__ */
|