mirror of
https://github.com/CachyOS/New-Cli-Installer.git
synced 2025-01-23 22:42:31 +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 "tui.hpp"
|
||||||
|
#include "definitions.hpp"
|
||||||
|
|
||||||
#include <ftxui/component/captured_mouse.hpp>
|
#include <ftxui/component/captured_mouse.hpp>
|
||||||
#include <ftxui/component/component.hpp>
|
#include <ftxui/component/component.hpp>
|
||||||
#include <ftxui/component/component_options.hpp>
|
#include <ftxui/component/component_options.hpp>
|
||||||
@ -12,38 +14,34 @@ namespace tui {
|
|||||||
void init() noexcept {
|
void init() noexcept {
|
||||||
auto screen = ScreenInteractive::Fullscreen();
|
auto screen = ScreenInteractive::Fullscreen();
|
||||||
|
|
||||||
auto button_ok = Button("Ok", screen.ExitLoopClosure());
|
/* clang-format off */
|
||||||
auto button_quit = Button("Quit", screen.ExitLoopClosure());
|
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,
|
button_ok,
|
||||||
|
Renderer([] { return filler() | size(WIDTH, GREATER_THAN, 3); }),
|
||||||
button_quit,
|
button_quit,
|
||||||
});
|
});
|
||||||
|
|
||||||
auto dialog = vbox({
|
auto renderer = Renderer(container, [&] {
|
||||||
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, [&] {
|
|
||||||
return vbox({
|
return vbox({
|
||||||
|
// -------- Title --------------
|
||||||
text("New CLI Installer") | bold,
|
text("New CLI Installer") | bold,
|
||||||
filler(),
|
filler(),
|
||||||
// -------- Center Menu --------------
|
// -------- 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(),
|
filler(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
|
||||||
|
@ -4,18 +4,17 @@
|
|||||||
#include "definitions.hpp"
|
#include "definitions.hpp"
|
||||||
|
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
namespace utils {
|
namespace utils {
|
||||||
void print_banner() noexcept;
|
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;
|
bool prompt_char(const char* prompt, const char* color = RESET, char* read = nullptr) noexcept;
|
||||||
void clear_screen() noexcept;
|
void clear_screen() noexcept;
|
||||||
|
|
||||||
auto exec(const std::string_view& command) noexcept -> std::string;
|
auto exec(const std::string_view& command) noexcept -> std::string;
|
||||||
[[nodiscard]] bool check_root() noexcept;
|
[[nodiscard]] bool check_root() noexcept;
|
||||||
void id_system() noexcept;
|
void id_system() noexcept;
|
||||||
bool handle_connection() noexcept;
|
[[nodiscard]] bool handle_connection() noexcept;
|
||||||
void show_iwctl() noexcept;
|
void show_iwctl() noexcept;
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user