2021-07-23 08:24:00 +01:00
|
|
|
/*
|
|
|
|
* options_tab.hpp
|
|
|
|
*
|
2024-04-12 10:47:36 +01:00
|
|
|
* Copyright (c) 2020-2024, DarkMatterCore <pabloacurielz@gmail.com>.
|
2021-07-23 08:24:00 +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 __OPTIONS_TAB_HPP__
|
|
|
|
#define __OPTIONS_TAB_HPP__
|
|
|
|
|
2021-08-11 08:17:57 +01:00
|
|
|
#include "root_view.hpp"
|
2024-04-15 00:53:43 +01:00
|
|
|
#include "data_transfer_progress_display.hpp"
|
2021-07-29 08:50:17 +01:00
|
|
|
|
2021-07-23 08:24:00 +01:00
|
|
|
namespace nxdt::views
|
|
|
|
{
|
2021-07-29 08:50:17 +01:00
|
|
|
/* Update file dialog. */
|
|
|
|
class OptionsTabUpdateFileDialog: public brls::Dialog
|
|
|
|
{
|
|
|
|
private:
|
2024-04-15 00:53:43 +01:00
|
|
|
DataTransferProgressDisplay *update_progress = nullptr;
|
2021-07-29 08:50:17 +01:00
|
|
|
nxdt::tasks::DownloadFileTask download_task;
|
|
|
|
std::string success_str;
|
2022-07-05 02:04:28 +01:00
|
|
|
|
2021-07-29 08:50:17 +01:00
|
|
|
public:
|
|
|
|
OptionsTabUpdateFileDialog(std::string path, std::string url, bool force_https, std::string success_str);
|
2021-08-07 09:42:03 +01:00
|
|
|
};
|
2022-07-05 02:04:28 +01:00
|
|
|
|
2021-08-07 09:42:03 +01:00
|
|
|
/* Update application frame. */
|
|
|
|
class OptionsTabUpdateApplicationFrame: public brls::StagedAppletFrame
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
nxdt::tasks::DownloadDataTask json_task;
|
2024-04-18 09:46:29 +01:00
|
|
|
char *json_buf = nullptr;
|
2021-08-07 09:42:03 +01:00
|
|
|
size_t json_buf_size = 0;
|
|
|
|
UtilsGitHubReleaseJsonData json_data = {0};
|
2022-07-05 02:04:28 +01:00
|
|
|
|
2024-04-15 00:53:43 +01:00
|
|
|
brls::Label *wait_lbl = nullptr; /// First stage.
|
|
|
|
brls::List *changelog_list = nullptr; /// Second stage.
|
|
|
|
DataTransferProgressDisplay *update_progress = nullptr; /// Third stage.
|
2022-07-05 02:04:28 +01:00
|
|
|
|
2021-08-07 09:42:03 +01:00
|
|
|
nxdt::tasks::DownloadFileTask nro_task;
|
2022-07-05 02:04:28 +01:00
|
|
|
|
2021-08-07 09:42:03 +01:00
|
|
|
void DisplayChangelog(void);
|
|
|
|
void DisplayUpdateProgress(void);
|
2022-07-05 02:04:28 +01:00
|
|
|
|
2021-08-07 09:42:03 +01:00
|
|
|
protected:
|
|
|
|
void layout(NVGcontext* vg, brls::Style* style, brls::FontStash* stash) override;
|
2021-07-29 08:50:17 +01:00
|
|
|
bool onCancel(void) override;
|
2022-07-05 02:04:28 +01:00
|
|
|
|
2021-08-07 09:42:03 +01:00
|
|
|
public:
|
|
|
|
OptionsTabUpdateApplicationFrame(void);
|
|
|
|
~OptionsTabUpdateApplicationFrame(void);
|
2021-07-29 08:50:17 +01:00
|
|
|
};
|
2022-07-05 02:04:28 +01:00
|
|
|
|
2021-07-23 08:24:00 +01:00
|
|
|
class OptionsTab: public brls::List
|
|
|
|
{
|
2021-07-25 06:37:13 +01:00
|
|
|
private:
|
2021-08-11 08:17:57 +01:00
|
|
|
RootView *root_view = nullptr;
|
2022-07-05 02:04:28 +01:00
|
|
|
|
2021-07-25 06:37:13 +01:00
|
|
|
bool display_notification = true;
|
|
|
|
brls::menu_timer_t notification_timer = 0.0f;
|
|
|
|
brls::menu_timer_ctx_entry_t notification_timer_ctx = {0};
|
2022-07-05 02:04:28 +01:00
|
|
|
|
2024-04-15 12:47:50 +01:00
|
|
|
void DisplayNotification(const std::string& str);
|
2021-07-23 08:24:00 +01:00
|
|
|
public:
|
2021-08-11 08:17:57 +01:00
|
|
|
OptionsTab(RootView *root_view);
|
2021-07-25 06:37:13 +01:00
|
|
|
~OptionsTab(void);
|
2021-07-23 08:24:00 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __OPTIONS_TAB_HPP__ */
|