🧹 drivers: refactor a bit

This commit is contained in:
Vladislav Nepogodin 2024-04-29 19:15:50 +04:00
parent 2eab6198d7
commit b5253b2f4e
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9

View File

@ -21,9 +21,9 @@ using namespace std::string_view_literals;
#include "follow_process_log.hpp" #include "follow_process_log.hpp"
#endif #endif
namespace tui { namespace {
static void setup_graphics_card() noexcept { void setup_graphics_card() noexcept {
std::string driver{}; std::string driver{};
/// TODO(vnepogodin): parse toml DBs /// TODO(vnepogodin): parse toml DBs
@ -42,7 +42,7 @@ static void setup_graphics_card() noexcept {
driver = radiobox_list[static_cast<size_t>(selected)]; driver = radiobox_list[static_cast<size_t>(selected)];
screen.ExitLoopClosure()(); screen.ExitLoopClosure()();
}; };
detail::radiolist_widget(radiobox_list, ok_callback, &selected, &screen, {.text = use_spacebar}, {.text_size = nothing}); tui::detail::radiolist_widget(radiobox_list, ok_callback, &selected, &screen, {.text = use_spacebar}, {.text_size = nothing});
} }
/* clang-format off */ /* clang-format off */
if (driver.empty()) { return; } if (driver.empty()) { return; }
@ -62,7 +62,7 @@ static void setup_graphics_card() noexcept {
#endif #endif
} }
static void install_graphics_menu() noexcept { void install_graphics_menu() noexcept {
[[maybe_unused]] auto* config_instance = Config::instance(); [[maybe_unused]] auto* config_instance = Config::instance();
[[maybe_unused]] auto& config_data = config_instance->data(); [[maybe_unused]] auto& config_data = config_instance->data();
[[maybe_unused]] const auto& mountpoint = std::get<std::string>(config_data["MOUNTPOINT"]); [[maybe_unused]] const auto& mountpoint = std::get<std::string>(config_data["MOUNTPOINT"]);
@ -96,9 +96,13 @@ static void install_graphics_menu() noexcept {
break; break;
} }
}; };
detail::menu_widget(menu_entries, ok_callback, &selected, &screen); tui::detail::menu_widget(menu_entries, ok_callback, &selected, &screen);
} }
} // namespace
namespace tui {
void install_drivers_menu() noexcept { void install_drivers_menu() noexcept {
const std::vector<std::string> menu_entries = { const std::vector<std::string> menu_entries = {
"Install Display Driver", "Install Display Driver",