mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 14:32:22 +08:00
👷 update ui
This commit is contained in:
parent
e6a83c6030
commit
fa290acf85
44
src/tui.cpp
44
src/tui.cpp
@ -1,4 +1,6 @@
|
||||
#include "tui.hpp"
|
||||
#include "definitions.hpp"
|
||||
|
||||
#include <ftxui/component/captured_mouse.hpp>
|
||||
#include <ftxui/component/component.hpp>
|
||||
#include <ftxui/component/component_options.hpp>
|
||||
@ -12,38 +14,34 @@ namespace tui {
|
||||
void init() noexcept {
|
||||
auto screen = ScreenInteractive::Fullscreen();
|
||||
|
||||
auto button_ok = Button("Ok", screen.ExitLoopClosure());
|
||||
auto button_quit = Button("Quit", screen.ExitLoopClosure());
|
||||
/* clang-format off */
|
||||
auto button_option = ButtonOption();
|
||||
button_option.border = false;
|
||||
auto button_ok = Button("OK", [=] { info("ok\n"); }, &button_option);
|
||||
auto button_quit = Button("Quit", screen.ExitLoopClosure(), &button_option);
|
||||
/* clang-format on */
|
||||
|
||||
auto component = Container::Horizontal({
|
||||
auto container = Container::Horizontal({
|
||||
button_ok,
|
||||
Renderer([] { return filler() | size(WIDTH, GREATER_THAN, 3); }),
|
||||
button_quit,
|
||||
});
|
||||
|
||||
auto dialog = vbox({
|
||||
text("TODO!!"),
|
||||
separator(),
|
||||
hbox({
|
||||
button_ok->Render(),
|
||||
button_quit->Render(),
|
||||
}),
|
||||
});
|
||||
|
||||
// -------- Center Menu --------------
|
||||
/* clang-format off */
|
||||
auto center_dialog = hbox({
|
||||
filler(),
|
||||
border(dialog),
|
||||
filler(),
|
||||
}) | vcenter;
|
||||
/* clang-format on */
|
||||
|
||||
auto renderer = Renderer(component, [&] {
|
||||
auto renderer = Renderer(container, [&] {
|
||||
return vbox({
|
||||
// -------- Title --------------
|
||||
text("New CLI Installer") | bold,
|
||||
filler(),
|
||||
// -------- Center Menu --------------
|
||||
center_dialog | hcenter,
|
||||
hbox({
|
||||
filler(),
|
||||
border(vbox({
|
||||
text("TODO!!") | size(HEIGHT, GREATER_THAN, 5),
|
||||
separator(),
|
||||
container->Render() | hcenter | size(HEIGHT, LESS_THAN, 3) | size(WIDTH, GREATER_THAN, 25),
|
||||
})),
|
||||
filler(),
|
||||
}) | center,
|
||||
filler(),
|
||||
});
|
||||
});
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
#include <netdb.h>
|
||||
|
||||
|
@ -4,18 +4,17 @@
|
||||
#include "definitions.hpp"
|
||||
|
||||
#include <string_view>
|
||||
#include <thread>
|
||||
|
||||
namespace utils {
|
||||
void print_banner() noexcept;
|
||||
bool is_connected() noexcept;
|
||||
[[nodiscard]] bool is_connected() noexcept;
|
||||
bool prompt_char(const char* prompt, const char* color = RESET, char* read = nullptr) noexcept;
|
||||
void clear_screen() noexcept;
|
||||
|
||||
auto exec(const std::string_view& command) noexcept -> std::string;
|
||||
[[nodiscard]] bool check_root() noexcept;
|
||||
void id_system() noexcept;
|
||||
bool handle_connection() noexcept;
|
||||
[[nodiscard]] bool handle_connection() noexcept;
|
||||
void show_iwctl() noexcept;
|
||||
} // namespace utils
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user