17 #include "ui/view_selection.h" 18 #include "ui/view_info.h" 19 #include "ui/view_monitor.h" 20 #include "ui/view_promt.h" 22 constexpr uint8_t WIN_WIDTH = 80;
23 constexpr uint8_t WIN_HEIGHT = 24;
25 volatile int win_changed_cooldown = 0;
26 volatile bool t_refresh_active =
false;
28 void signal_handler(
int signal)
30 if(signal == SIGWINCH)
32 win_changed_cooldown = 10;
34 if (!t_refresh_active)
36 if(t_refresh.joinable())
38 t_refresh_active =
true;
39 t_refresh = std::thread([]()
42 while(win_changed_cooldown--)
43 std::this_thread::sleep_for(std::chrono::milliseconds(10));
45 t_refresh_active =
false;
48 win_stack.back()->repaint();
54 else if(signal == SIGINT)
57 std::cout <<
"SIGINT - Abbruch." << std::endl;
62 void abort_handler(std::exception& ex)
65 view->setTitle(
"Fehler");
66 std::string msg(ex.what());
67 msg +=
"\n\nBeende in 5 Sekunden.";
68 view->setText(msg.c_str());
69 view->setLabelClose(
"");
72 std::this_thread::sleep_for(std::chrono::milliseconds(5000));
75 std::cerr << std::endl <<
"*** EXCEPTION ***" << std::endl << ex.what() << std::endl;
83 #ifndef B15F_CLI_DEBUG 84 std::cout << std::endl <<
"Starte in 3s ..." << std::endl;
95 mousemask(ALL_MOUSE_EVENTS, NULL);
98 signal(SIGWINCH, signal_handler);
99 signal(SIGINT, signal_handler);
102 View::setWinContext(newwin(WIN_HEIGHT, WIN_WIDTH, 0, 0));
113 int exit_code = EXIT_SUCCESS;