preparation for file integration

This commit is contained in:
PoliEcho 2025-05-28 15:15:32 +02:00
parent ff9303861a
commit 0a07589e0e
5 changed files with 60 additions and 44 deletions

View File

@ -1,5 +1,6 @@
#include "gameske_funkce.h"
#include "memory.h"
#include "strings.h"
#include <chrono>
#include <clocale>
#include <cstddef>
@ -104,7 +105,7 @@ void print_in_middle(WINDOW *win, int starty, int startx, int width,
refresh();
}
std::string spawncmd() {
std::string spawncmd(const std::string prompt) {
char cmd[100] = {0};
int pos = 0;
int ch;
@ -115,7 +116,7 @@ std::string spawncmd() {
keypad(cmd_win, TRUE);
box(cmd_win, 0, 0);
mvwprintw(cmd_win, 1, 1, "Command: ");
mvwprintw(cmd_win, 1, 1, "%s: ", prompt.c_str());
curs_set(1);
wrefresh(cmd_win);

View File

@ -1,3 +1,4 @@
#include "strings.h"
#include <ncurses.h>
#include <string>
@ -12,7 +13,7 @@ size_t spawn_menu(uint16_t begin_y, uint16_t begin_x, const char **choices,
void print_in_middle(WINDOW *win, int starty, int startx, int width,
const char *string, chtype color);
std::string spawncmd();
std::string spawncmd(const std::string prompt = loc_strings->command);
void async_clock_init();

View File

@ -1,11 +1,3 @@
#include <curses.h>
#include <menu.h>
#include <ncurses.h>
#include <cstdint>
#include <cstring>
#include <filesystem>
#include <iostream>
#include <vector>
#include "const.h"
#include "cups.h"
#include "editor_easy.h"
@ -13,6 +5,15 @@
#include "memory.h"
#include "strings.h"
#include "types.h"
#include <cstdint>
#include <cstring>
#include <curses.h>
#include <filesystem>
#include <iostream>
#include <menu.h>
#include <ncurses.h>
#include <string>
#include <vector>
std::vector<allocation> main_menu_allocated;
#define COMPLAINTS_DIR "complaints"
@ -113,12 +114,19 @@ void menu() {
current_allocated = &main_menu_allocated;
break;
case "easy_edit"_sh:
case "ee"_sh:
std::clog << vytvorTrestniOznameni();
break;
default:
case "ee"_sh: {
std::string name = spawncmd("Reference Name");
if (name == "") {
print_in_middle(main_menu.win, 10, 0, 40,
loc_strings->unknown_command, COLOR_PAIR(1));
}
std::clog << vytvorTrestniOznameni();
break;
}
default:
print_in_middle(main_menu.win, 10, 0, 40, loc_strings->unknown_command,
COLOR_PAIR(1));
break;
}
}

View File

@ -74,7 +74,9 @@ I request the Police of the Czech Republic to:
Signature of the complainant: {0}
*This is not a legal document, but only a template for informational purposes. For legal advice, please consult a qualified attorney.*
)"};
)",
.command = "Command",
.invalid_input = "Invalid input"};
constexpr strings czech_strings{
.invalid_option = "Neplatná volba: ",
@ -148,6 +150,8 @@ Dne {9} v místě {10}.
Podpis oznamovatele: {0}
*Toto není právní dokument, ale pouze vzor pro informativní účely. Pro právní poradenství se obraťte na kvalifikovaného právníka.*
)"};
)",
.command = "Příkaz",
.invalid_input = "Neplatný vstup"};
const strings *loc_strings;

View File

@ -34,6 +34,8 @@ typedef struct {
const char *enter_all_information_and_press_f10;
const char *criminal_complaint_template;
const char *command;
const char *invalid_input;
} strings;
extern const strings english_strings;