Compare commits

..

No commits in common. "d330878f8a94012faff4d59bea4619fbb6dfbe13" and "bf02560cdd39002dc3d169c2df10c869f6ac8012" have entirely different histories.

3 changed files with 87 additions and 87 deletions

View File

@ -6,7 +6,7 @@ jobs:
runs-on: arch runs-on: arch
steps: steps:
- name: get dependencies - name: get dependencies
run: pacman -Sy nodejs make gcc libcups nlohmann-json --needed --noconfirm run: pacman -Sy nodejs make gcc libcups --needed --noconfirm
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@ -1,13 +1,13 @@
#include <form.h>
#include <ncurses.h>
#include <cstring>
#include <ctime>
#include <format>
#include <string>
#include <vector>
#include "gameske_funkce.h" #include "gameske_funkce.h"
#include "memory.h" #include "memory.h"
#include "strings.h" #include "strings.h"
#include <cstring>
#include <ctime>
#include <form.h>
#include <format>
#include <ncurses.h>
#include <string>
#include <vector>
#define HEADER_COLOR_PAIR COLOR_RED #define HEADER_COLOR_PAIR COLOR_RED
#define FIELD_NAME_COLOR_PAIR 10 #define FIELD_NAME_COLOR_PAIR 10
@ -17,7 +17,7 @@ std::vector<allocation> editor_easy_allocated;
[[nodiscard]] std::string vytvorTrestniOznameni() { [[nodiscard]] std::string vytvorTrestniOznameni() {
current_allocated = &editor_easy_allocated; current_allocated = &editor_easy_allocated;
auto trim = [](const char *str) -> std::string { auto trim = [](const char* str) -> std::string {
std::string s(str); std::string s(str);
if (s.empty()) if (s.empty())
return s; return s;
@ -44,22 +44,22 @@ std::vector<allocation> editor_easy_allocated;
init_pair(INPUT_COLOR_PAIR, COLOR_WHITE, COLOR_BLACK); // Vstupní pole init_pair(INPUT_COLOR_PAIR, COLOR_WHITE, COLOR_BLACK); // Vstupní pole
// Hlavní okno s rámečkem // Hlavní okno s rámečkem
WINDOW *main_win = newwin(LINES - 4, COLS - 4, 2, 2); WINDOW* main_win = newwin(LINES - 4, COLS - 4, 2, 2);
box(main_win, 0, 0); box(main_win, 0, 0);
wrefresh(main_win); wrefresh(main_win);
// Okno pro popisky // Okno pro popisky
WINDOW *label_win = derwin(main_win, LINES - 8, 30, 1, 1); WINDOW* label_win = derwin(main_win, LINES - 8, 30, 1, 1);
wbkgd(label_win, COLOR_PAIR(FIELD_NAME_COLOR_PAIR)); wbkgd(label_win, COLOR_PAIR(FIELD_NAME_COLOR_PAIR));
// Okno pro vstupní pole // Okno pro vstupní pole
WINDOW *field_win = derwin(main_win, LINES - 8, COLS - 38, 1, 32); WINDOW* field_win = derwin(main_win, LINES - 8, COLS - 38, 1, 32);
wbkgd(field_win, COLOR_PAIR(INPUT_COLOR_PAIR)); wbkgd(field_win, COLOR_PAIR(INPUT_COLOR_PAIR));
keypad(field_win, TRUE); keypad(field_win, TRUE);
// Definice polí // Definice polí
struct FieldConfig { struct FieldConfig {
const char *label; const char* label;
int height; int height;
int width; int width;
bool multiline; bool multiline;
@ -84,18 +84,18 @@ std::vector<allocation> editor_easy_allocated;
// Vykreslení popisků // Vykreslení popisků
int label_row = 0; int label_row = 0;
for (const FieldConfig &cfg : field_configs) { for (const FieldConfig& cfg : field_configs) {
mvwprintw(label_win, label_row, 0, "%s", cfg.label); mvwprintw(label_win, label_row, 0, "%s", cfg.label);
label_row += cfg.height + 1; label_row += cfg.height + 1;
} }
wrefresh(label_win); wrefresh(label_win);
// Vytvoření formuláře // Vytvoření formuláře
std::vector<FIELD *> fields; std::vector<FIELD*> fields;
int field_row = 0; int field_row = 0;
for (const FieldConfig &cfg : field_configs) { for (const FieldConfig& cfg : field_configs) {
FIELD *field = new_field(cfg.height, cfg.width, field_row, 0, 0, 0); FIELD* field = new_field(cfg.height, cfg.width, field_row, 0, 0, 0);
set_field_back(field, A_UNDERLINE | COLOR_PAIR(INPUT_COLOR_PAIR)); set_field_back(field, A_UNDERLINE | COLOR_PAIR(INPUT_COLOR_PAIR));
field_opts_off(field, O_AUTOSKIP | O_STATIC); field_opts_off(field, O_AUTOSKIP | O_STATIC);
@ -109,9 +109,9 @@ std::vector<allocation> editor_easy_allocated;
} }
fields.push_back(nullptr); fields.push_back(nullptr);
FORM *form = new_form(&fields[0]); FORM* form = new_form(&fields[0]);
set_form_win(form, field_win); set_form_win(form, field_win);
set_form_sub(form, derwin(field_win, LINES - 10, COLS - 40, 0, 1)); set_form_sub(form, derwin(field_win, LINES - 10, COLS - 40, 1, 1));
post_form(form); post_form(form);
form_driver(form, REQ_FIRST_FIELD); form_driver(form, REQ_FIRST_FIELD);
@ -197,7 +197,7 @@ std::vector<allocation> editor_easy_allocated;
// Úklid // Úklid
unpost_form(form); unpost_form(form);
free_form(form); free_form(form);
for (fieldnode *&f : fields) for (fieldnode*& f : fields)
if (f) if (f)
free_field(f); free_field(f);
delwin(label_win); delwin(label_win);
@ -208,7 +208,7 @@ std::vector<allocation> editor_easy_allocated;
// Aktuální datum // Aktuální datum
std::time_t t = std::time(nullptr); std::time_t t = std::time(nullptr);
std::tm *now = std::localtime(&t); std::tm* now = std::localtime(&t);
char date_str[100]; char date_str[100];
std::strftime(date_str, sizeof(date_str), "%d.%m.%Y", now); std::strftime(date_str, sizeof(date_str), "%d.%m.%Y", now);

View File

@ -8,7 +8,7 @@ constexpr strings english_strings{
.print_this_help = "Print this help", .print_this_help = "Print this help",
.print_version = "Print version", .print_version = "Print version",
.version = "version", .version = "version",
.main_menu = "List of complaints", .main_menu = "Main menu",
.f1_to_exit = "F1 to exit", .f1_to_exit = "F1 to exit",
.unknown_command = "Unknown command:", .unknown_command = "Unknown command:",
.min_terminal_size = "Minimum terminal size: 90x28", .min_terminal_size = "Minimum terminal size: 90x28",
@ -88,7 +88,7 @@ constexpr strings czech_strings{
.print_this_help = "Zobrazit tuto nápovědu", .print_this_help = "Zobrazit tuto nápovědu",
.print_version = "Zobrazit verzi", .print_version = "Zobrazit verzi",
.version = "verze", .version = "verze",
.main_menu = "Seznam Oznámení", .main_menu = "Hlavní nabídka",
.f1_to_exit = "F1 pro ukončení", .f1_to_exit = "F1 pro ukončení",
.unknown_command = "Neznámý příkaz: ", .unknown_command = "Neznámý příkaz: ",
.min_terminal_size = "Minimální velikost terminálu: 90x28", .min_terminal_size = "Minimální velikost terminálu: 90x28",
@ -158,4 +158,4 @@ Podpis oznamovatele: {0}
.reference_name = "Referenční Název", .reference_name = "Referenční Název",
.status_strings = {"Nebylo odesláno", "Odesláno", "Zamítnuto", "Přijato"}}; .status_strings = {"Nebylo odesláno", "Odesláno", "Zamítnuto", "Přijato"}};
const strings *loc_strings; const strings* loc_strings;