mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-27 00:35:59 -04:00
Autostart option (#2079)
* Autostart app on boot * Settings page * ext app support
This commit is contained in:
parent
3665b3c607
commit
c48cbb7e55
5 changed files with 116 additions and 0 deletions
|
@ -107,6 +107,10 @@
|
|||
#include "file_reader.hpp"
|
||||
#include "png_writer.hpp"
|
||||
#include "file_path.hpp"
|
||||
#include "ff.h"
|
||||
|
||||
#include <locale>
|
||||
#include <codecvt>
|
||||
|
||||
using portapack::receiver_model;
|
||||
using portapack::transmitter_model;
|
||||
|
@ -708,6 +712,23 @@ bool NavigationView::set_on_pop(std::function<void()> on_pop) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void NavigationView::handle_autostart() {
|
||||
std::string autostart_app{""};
|
||||
SettingsStore nav_setting{
|
||||
"nav"sv,
|
||||
{{"autostart_app"sv, &autostart_app}}};
|
||||
if (!autostart_app.empty()) {
|
||||
if (StartAppByName(autostart_app.c_str())) return;
|
||||
// if returned false, check for external apps by that name, and try to start it
|
||||
std::string appwithpath = "/" + apps_dir.string() + "/";
|
||||
appwithpath += autostart_app;
|
||||
appwithpath += ".ppma";
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> conv;
|
||||
std::filesystem::path pth = conv.from_bytes(appwithpath.c_str());
|
||||
ui::ExternalItemsMenuLoader::run_external_app(*this, pth);
|
||||
}
|
||||
}
|
||||
|
||||
/* Helpers **************************************************************/
|
||||
|
||||
static void add_apps(NavigationView& nav, BtnGridView& grid, app_location_t loc) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue