Raspberry Pi Weighting Control System
This project serves as a simple weighting control system, that was realized as a Bachelor Thesis
Functions | Variables
screen_definitions.h File Reference
#include <vector>
#include <memory>
#include "gui_element.h"
#include "gui_label.h"

Go to the source code of this file.

Functions

void define_screen_1_debug (std::vector< std::unique_ptr< gui_element >> &)
 Definitions of gui elemnts of debug screen 1. More...
 
void define_screen_2_debug (std::vector< std::unique_ptr< gui_element >> &)
 Definitions of gui elemnts of debug screen 2. More...
 
void define_screen_3_debug (std::vector< std::unique_ptr< gui_element >> &)
 Definitions of gui elemnts of debug screen 3. More...
 
void define_screen_4_debug (std::vector< std::unique_ptr< gui_element >> &)
 Definitions of gui elemnts of debug screen 4. More...
 
void define_screen_5_debug (std::vector< std::unique_ptr< gui_element >> &)
 Definitions of gui elemnts of debug screen 5. More...
 
void define_screen_0 (std::vector< std::unique_ptr< gui_element >> &)
 Definitions of gui elemnts of debug screen 0. More...
 
void define_screen_1 (std::vector< std::unique_ptr< gui_element >> &)
 Definitions of gui elemnts of debug screen 1. More...
 
void define_screen_2 (std::vector< std::unique_ptr< gui_element >> &)
 Definitions of gui elemnts of debug screen 2. More...
 
void define_screen_3 (std::vector< std::unique_ptr< gui_element >> &)
 Definitions of gui elemnts of debug screen 3. More...
 
void define_screen_4 (std::vector< std::unique_ptr< gui_element >> &)
 Definitions of gui elemnts of debug screen 4. More...
 
void define_screen_5 (std::vector< std::unique_ptr< gui_element >> &)
 Definitions of gui elemnts of debug screen 5. More...
 
void define_screen_6 (std::vector< std::unique_ptr< gui_element >> &)
 Definitions of gui elemnts of debug screen 6. More...
 

Variables

gui_labelerr_title
 
gui_labelerr_desc
 

Function Documentation

◆ define_screen_0()

void define_screen_0 ( std::vector< std::unique_ptr< gui_element >> &  elems)

Definitions of gui elemnts of debug screen 0.

Definition at line 125 of file screen_definitions.cpp.

125  {
126  elems.clear();
127 
128  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_0_ERR_TITLE_LABEL")))
129  INDENT
131  UNINDENT
132  EMPTY_LINE
133  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_0_ERR_DESC_LABEL")))
134  INDENT
136  UNINDENT
137 }
This is a wrapper for ImGui Text which serves as unchangeble label.
Definition: gui_label.h:11
const char * get_localized_text(const char *key)
Get the localized text object.
gui_label * err_title
#define INDENT
#define UNINDENT
gui_label * err_desc
#define INSERT_ELEMENT(ELEMENT)
#define EMPTY_LINE

◆ define_screen_1()

void define_screen_1 ( std::vector< std::unique_ptr< gui_element >> &  elems)

Definitions of gui elemnts of debug screen 1.

Definition at line 139 of file screen_definitions.cpp.

139  {
140  elems.clear();
141 
142  // if (usr_wrk != nullptr) { //get_userspace() checks if user exists = is logged in
143  if (app_workspace::get_instance()->has_user()) {
144  user_workspace* usr_wrk = app_workspace::get_instance()->get_userspace();
145 
146  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_1_LOGGED_USERNAME")))
147  SAME_LINE
148  INSERT_ELEMENT(new gui_label(usr_wrk->get_username().c_str()))
149  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_1_LOGGED_ROLE")))
150  SAME_LINE
151  INSERT_ELEMENT(new gui_label(usr_wrk->get_role_string()))
152  EMPTY_LINE
153  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_1_LOGOUT_BTN"), logout_action, -1, -1, 460, 40))
154 
155  if (usr_wrk->get_role() >= 1) { // emp/ admin
156  if (usr_wrk->subuser.get() != nullptr) {
157  EMPTY_LINE
158  EMPTY_LINE
159  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_1_LOGGED_SUBUSERNAME")))
160  SAME_LINE
161  INSERT_ELEMENT(new gui_label(usr_wrk->subuser->username.c_str()))
162  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_1_LOGOUT_SUBUSER"),
163  logout_subuser, -1, -1, 460, 40))
164 
165  } else {
166  EMPTY_LINE
167  EMPTY_LINE
168  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_1_LOGIN_SUBUSER")))
169  INSERT_ELEMENT(new gui_input(IN_TEXT, (void*) &app_workspace::get_instance()->subusr_name,
170  sizeof(char) * DEF_BUFF_SIZE, -1 ,-1 ,-1, get_localized_text("SCREEN_1_USERNAME")))
171  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_1_LOGIN_SUBUSER_BTN"),
172  login_subuser, -1, -1, 460, 40)) // TDOO change action to login_subuser
173  }
174  }
175  } else {
176  EMPTY_LINE
177  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_1_LOGIN_W_RFID")))
178  EMPTY_LINE
180  EMPTY_LINE
181  INSERT_ELEMENT(new gui_input(IN_TEXT, (void*) &app_workspace::get_instance()->usr_name,
182  sizeof(char) * DEF_BUFF_SIZE, -1 ,-1 ,-1, get_localized_text("SCREEN_1_USERNAME")))
183  INSERT_ELEMENT(new gui_input(IN_PASSWORD, (void*) &app_workspace::get_instance()->usr_passwd,
184  sizeof(char) * DEF_BUFF_SIZE_SMALL, -1, -1, -1, get_localized_text("SCREEN_1_PASSWORD")))
185  EMPTY_LINE
186  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_1_LOGIN_BTN"), login_action, -1, -1, 460, 40))
187  }
188 }
#define DEF_BUFF_SIZE
Definition: app_workspace.h:23
#define DEF_BUFF_SIZE_SMALL
Definition: app_workspace.h:22
One of the most importat classes in the whole project. Holds variables that define the state of the a...
static std::unique_ptr< app_workspace > & get_instance()
Get the instance app_workspace which is a singleton.
Wrapper for ImGui::Button.
Definition: gui_button.h:11
This is a wrapper for various ImGui input types.
Definition: gui_input.h:24
Container that servers for storing users data and manipulating them.
std::unique_ptr< user_cont > subuser
@ IN_TEXT
Definition: gui_input.h:14
@ IN_PASSWORD
Definition: gui_input.h:15
void logout_subuser()
void login_subuser()
void logout_action()
#define SAME_LINE
void login_action()

◆ define_screen_1_debug()

void define_screen_1_debug ( std::vector< std::unique_ptr< gui_element >> &  elems)

Definitions of gui elemnts of debug screen 1.

Definition at line 714 of file screen_definitions.cpp.

714  {
715  elems.clear();
716 
717  INSERT_ELEMENT(new gui_label("Inputs test", -1, -1, -1, app_workspace_ns::font_size::BIG_FONT))
718  INSERT_ELEMENT(new gui_label("Int input"))
719  // for non-text inputs "data_size" doesn't matter
720  INSERT_ELEMENT(new gui_input(input_type::IN_INT, &(app_workspace::get_instance()->int_test), 0))
721  INSERT_ELEMENT(new gui_label("Float input"))
722  // for non-text inputs "data_size" doesn't matter
723  INSERT_ELEMENT(new gui_input(input_type::IN_FLOAT, &(app_workspace::get_instance()->float_test), 0))
724  INSERT_ELEMENT(new gui_label("Text input"))
725  INSERT_ELEMENT(new gui_input(input_type::IN_TEXT, &(app_workspace::get_instance()->text_test), DEF_BUFF_SIZE))
726  INSERT_ELEMENT(new gui_label("Password input"))
727  INSERT_ELEMENT(new gui_input(input_type::IN_PASSWORD, &(app_workspace::get_instance()->pass_test), DEF_BUFF_SIZE))
728  EMPTY_LINE
732 
733  INSERT_ELEMENT(new gui_label("Following line is defined with absolute positions and width (that's why the position"
734  " is misaligned to other elements", -1, -1, -1, app_workspace_ns::font_size::SMALL_FONT))
735  INSERT_ELEMENT(new gui_label("Int input:", 20, 500, 200))
736  INSERT_ELEMENT(new gui_input(input_type::IN_INT, &(app_workspace::get_instance()->int_test), 0, 200, 500, 100))
737  INSERT_ELEMENT(new gui_label("This should be on next line", -1, -1, -1, app_workspace_ns::font_size::SMALL_FONT))
738  // newly added gui_observer -test
739  INSERT_ELEMENT(new gui_label("Int observable: ", -1, -1, -1, app_workspace_ns::font_size::SMALL_FONT))
740  SAME_LINE
741  INSERT_ELEMENT(new gui_observer(OBS_INT, &(app_workspace::get_instance()->int_test), -1, -1, -1,
743  INSERT_ELEMENT(new gui_label("Float observable: ", -1, -1, -1, app_workspace_ns::font_size::SMALL_FONT))
744  SAME_LINE
745  INSERT_ELEMENT(new gui_observer(OBS_FLOAT, &(app_workspace::get_instance()->float_test), -1, -1, -1,
747  INSERT_ELEMENT(new gui_label("String observable: ", -1, -1, -1, app_workspace_ns::font_size::SMALL_FONT))
748  SAME_LINE
749  INSERT_ELEMENT(new gui_observer(OBS_STRING, app_workspace::get_instance()->text_test, -1, -1, -1,
751 
752  /* // testing const char* as parameter instead char[]
753  static const char* test = "Test string";
754  elems.push_back(std::unique_ptr<gui_element>(
755  new gui_observer(OBS_STRING, (void*) test)
756  ));
757  */
758 }
This is a special element, that doesn't wrap any ImGui function. This is used to render ImGui directl...
Definition: gui_direct.h:12
Allows to create a label, that automatically updates to observed variable value. This class doesn't w...
Definition: gui_observer.h:23
input_type
Allowed input types.
Definition: gui_input.h:11
@ IN_INT
Definition: gui_input.h:12
@ IN_FLOAT
Definition: gui_input.h:13
@ OBS_INT
Definition: gui_observer.h:12
@ OBS_FLOAT
Definition: gui_observer.h:14
@ OBS_STRING
Definition: gui_observer.h:15
This namespace holds structures and enums used in app_workspace class.
Definition: app_workspace.h:71
font_size
This enum defines sizes of corresponding fonts. E.g.: SMALL_FONT is 12px.
void float_test_label()
void text_test_label()
void int_test_label()

◆ define_screen_2()

void define_screen_2 ( std::vector< std::unique_ptr< gui_element >> &  elems)

Definitions of gui elemnts of debug screen 2.

Definition at line 190 of file screen_definitions.cpp.

190  {
191  elems.clear();
192  app_workspace *app_wrk = app_workspace::get_instance().get();
193  user_workspace *usr_wrk = app_wrk->get_userspace();
194 
195  if (!app_wrk->has_user()) {
196  INSERT_ELEMENT(new gui_label(get_localized_text("GT_SCREEN_REQUIRE_USER")))
197  EMPTY_LINE
198  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_FUNCTION_DESC")))
199  return;
200  }
201 
202  if (app_wrk->hx_measuring) {
203  if (app_wrk->hx_not_finished_yet) {
204  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_WAITING_FOR_FINISH")))
205  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEASURING_CANCEL_ENTER")))
206  return;
207  }
208 
209  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEASURING")))
210  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEASURING_CANCEL_ENTER")))
211  EMPTY_LINE
212 
213  measurement *m = app_wrk->observed_measurement.get();
214  if (m != nullptr) {
215  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_X_VAL_MEDIAN"), -1, -1, 250))
216  SAME_LINE
217  INSERT_ELEMENT(new gui_label(m->x_val_med_str.c_str()))
218  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_X_VAL_AVARAGE"), -1, -1, 250))
219  SAME_LINE
220  INSERT_ELEMENT(new gui_label(m->x_val_avg_str.c_str()))
221  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEDIAN")))
222  SAME_LINE
223  INSERT_ELEMENT(new gui_label(m->all_val_med_str.c_str()))
224  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_AVARAGE")))
225  SAME_LINE
226  INSERT_ELEMENT(new gui_label(m->all_val_avg_str.c_str()))
227  }
228 
229  // if (app_workspace::get_instance()->hx_continuous) {
230  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEASURING")))
231  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEASURING_CANCEL_ENTER")))
232  // } else {
233  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEASURING")))
234  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEASURING_WAIT_PLEASE")))
235  // }
236  } else {
237  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_CHANGED_MEASURED_USER_TIP"), -1, -1, -1,
239  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEASURED_USER")))
240  SAME_LINE
241  INSERT_ELEMENT(new gui_label(usr_wrk != nullptr ?
242  usr_wrk->get_measured_username().c_str() :
243  get_localized_text("GT_USER_NO_LOGIN")))
244 
245  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEASURING_OPTIONS")))
246 
247  INDENT
248 
249  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_CB1_LABEL"), -1, -1, 160))
250  SAME_LINE
251  INSERT_ELEMENT(new gui_combobox(app_wrk->hx_measure_opts, S2_MEASURE_OTPS_CNT,
252  &(app_wrk->selected_hx_measure_opt), nullptr, 160, -1, 200))
253  last_element(elems)->set_refresh_screen(&(app_wrk->refresh_current_screen));
254 
255  if (app_wrk->selected_hx_measure_opt == 0) {
256  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_SAMPLES_IN_LIMITS"), -1, -1, -1,
258  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_CB1_SAMPLES"), -1, -1, 160))
259  SAME_LINE
260  INSERT_ELEMENT(new gui_input(input_type::IN_INT, &(app_wrk->samples_in),
261  0, 160, -1, 200))
262  ((gui_input*) last_element(elems))->set_min_max(S2_MIN_SAMPLES_IN, S2_MAX_SAMPLES_IN); // WARNING! - if used after wrong element, application crashes on startup
263  } else if (app_wrk->selected_hx_measure_opt == 1) {
264  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_TIMEOUT_IN_LIMITS"), -1, -1, -1,
266  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_CB1_TIMEOUT"), -1, -1, 160))
267  SAME_LINE
268  INSERT_ELEMENT(new gui_input(input_type::IN_INT, &(app_wrk->timeout_in),
269  0, 160, -1, 200))
270  ((gui_input*) last_element(elems))->set_min_max(S2_MIN_TIMEOUT_IN, S2_MAX_TIMEOUT_IN); // WARNING! - if used after wrong element, application crashes on startup
271  SAME_LINE
272  // INSERT_ELEMENT(new gui_label(get_localized_text("GT_SEC_UNIT")))
273  INSERT_ELEMENT(new gui_label(get_localized_text("GT_SEC_UNIT_BRTS")))
274  }
275 
276  UNINDENT
277 
278  EMPTY_LINE
279  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_2_START_MEASURING"),
280  start_hx_measuring, -1, -1, 460, 40))
282  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_2_START_CONTINOUS"),
283  start_hx_continuous, -1, -1, 460, 40))
284 
285  EMPTY_LINE
286  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_LAST_MEAS_RES")))
287  if ((app_wrk->has_user() && app_wrk->userspace->get_last_hx_measuring() != nullptr &&
288  app_wrk->userspace->get_last_hx_measuring()->values.size() > 0))
289  {
290  measurement *m = app_wrk->userspace->get_last_hx_measuring();
291  // m->init_value_strings(); // this should be init after measuring
292 
293  // allow unit selection on this screen? or statically one unit and unit selection on measuring detail
294  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_CB2_LABEL"), -1, -1, 160))
295  // SAME_LINE
296  // INSERT_ELEMENT(new gui_combobox(result_unit_opts, 2, &(app_wrk->selected_hx_result_unit),
297  // nullptr, 160, -1, 200))
298  // last_element(elems)->set_refresh_screen(&(app_wrk->refresh_current_screen));
299 
300  INDENT
301 
302  // raw_avg is actually the same as all_val_avg
303  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_RAW_AVG")))
304  // SAME_LINE
305  // INSERT_ELEMENT(new gui_label("result"))
306  // INSERT_ELEMENT(new gui_observer(OBS_FLOAT, &(m->raw_avg))); //gui_observer can serve as label for numerical values
307  // SAME_LINE
308 
309  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_X_VAL_MEDIAN"), -1, -1, 250))
310  SAME_LINE
311  INSERT_ELEMENT(new gui_label(m->x_val_med_str.c_str()))
312 
313  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_X_VAL_AVARAGE"), -1, -1, 250))
314  SAME_LINE
315  INSERT_ELEMENT(new gui_label(m->x_val_avg_str.c_str()))
316 
317  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEDIAN")))
318  SAME_LINE
319  INSERT_ELEMENT(new gui_label(m->all_val_med_str.c_str()))
320 
321  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_AVARAGE")))
322  SAME_LINE
323  INSERT_ELEMENT(new gui_label(m->all_val_avg_str.c_str()))
324 
325  UNINDENT
326 
327  } else {
328  INDENT
329  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_NO_LAST_RESULT")))
330  UNINDENT
331  }
332  }
333 }
#define S2_MAX_SAMPLES_IN
Definition: app_workspace.h:30
#define S2_MIN_TIMEOUT_IN
Definition: app_workspace.h:31
#define S2_MIN_SAMPLES_IN
Definition: app_workspace.h:29
#define S2_MAX_TIMEOUT_IN
Definition: app_workspace.h:32
#define S2_MEASURE_OTPS_CNT
Definition: app_workspace.h:38
user_workspace * get_userspace()
bool hx_not_finished_yet
bool has_user()
Checks if user is logged in. This is determined by user_space being initialized and having the user_l...
std::unique_ptr< user_workspace > userspace
User's workspace. Serves similar function as app_workspace but for user data.
Wrapper for ImGui combo box structure.
Definition: gui_combobox.h:11
Container for measurement data and (convenience) variables, that are used to show measurement in GUI.
void start_hx_measuring()
void start_hx_continuous()
gui_element * last_element(std::vector< std::unique_ptr< gui_element >> &elems)

◆ define_screen_2_debug()

void define_screen_2_debug ( std::vector< std::unique_ptr< gui_element >> &  elems)

Definitions of gui elemnts of debug screen 2.

Definition at line 765 of file screen_definitions.cpp.

765  {
766  elems.clear();
767 
768  static const char* first[] = {"One", "Two", "Three"};
769  static int selected_s2d = 0;
770  //static const char* second[] = {"Jedna", "Dva", "Tri"};
771 
772  INSERT_ELEMENT(new gui_label("Switched to screen 2"))
773  INSERT_ELEMENT(new gui_label("Select box test, button (callback) test, graph?",
774  -1, -1, -1, app_workspace_ns::font_size::SMALL_FONT))
775  EMPTY_LINE
776 
777  // elems.push_back(std::unique_ptr<gui_element>(
778  // new gui_combobox(second, 3, "Second combobox", -1, -1, 150, app_workspace_ns::font_size::SMALL_FONT)
779  // ));
780  INSERT_ELEMENT(new gui_combobox(first, 3, &selected_s2d))
781  // elems.push_back(std::unique_ptr<gui_element>(
782  // new gui_combobox(second, 3, "Second combobox", -1, -1, 200, app_workspace_ns::font_size::BIG_FONT)
783  // ));
784 
785  EMPTY_LINE
786  INSERT_ELEMENT(new gui_button("Test Button", callback_debug, -1, -1, 400, 50))
787  if (cb_flag) {
788  INSERT_ELEMENT(new gui_label("Press the button!"))
789  } else {
790  INSERT_ELEMENT(new gui_label("Great! press it again!"))
791  }
792 
793  static char at[32];
794  sprintf(at, "Callback counter: %d", cb_cnt);
795  INSERT_ELEMENT(new gui_label(at))
796 }
void callback_debug()

◆ define_screen_3()

void define_screen_3 ( std::vector< std::unique_ptr< gui_element >> &  elems)

Definitions of gui elemnts of debug screen 3.

Definition at line 335 of file screen_definitions.cpp.

335  {
336  elems.clear();
337 
338  app_workspace *app_wrk = app_workspace::get_instance().get();
339 
340  if (app_workspace::get_instance()->has_user()) {
341  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_3_USER_MEASURINGS")))
342  SAME_LINE
343  INSERT_ELEMENT(new gui_label(app_workspace::get_instance()->userspace->get_measured_username().c_str()))
344 
345  std::vector<std::unique_ptr<measurement_header>> &headers =
346  app_workspace::get_instance()->userspace->get_user_measur_headers();
347 
348  if (headers.size() <= 0) {
349  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_3_MEASUREMENTS_EMPTY")))
350  } else {
351  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_3_FILTER_LABEL")))
352 
353  INSERT_ELEMENT(new gui_combobox(app_wrk->s3_filter_opt_labels, S3_FILTER_OPT_CNT,
354  &(app_wrk->s3_selected_filter), nullptr, -1, -1, 250))
355  ((gui_combobox*) last_element(elems))->set_value_change_action(apply_meas_list_filter); // WARNING! - if used after wrong element, application crashes (due to conversion)
356  SAME_LINE
357  INSERT_ELEMENT(new gui_input(input_type::IN_INT, &(app_wrk->s3_filter_number), 0))
358  // set min filter value to 0, because measurement_number can only be unsigned
359  ((gui_input*) last_element(elems))->set_min_max(S3_MIN_FILTER_NUMBER); // WARNING! - if used after wrong element, application crashes on startup
360  ((gui_input*) last_element(elems))->set_value_change_action(apply_meas_list_filter); // WARNING! - if used after wrong element, application crashes (due to conversion)
361 
363 
364  if (app_wrk->s3_selected_filter == 0) { // Larger than
365  for (size_t i = 0; i < headers.size(); i++) {
366  measurement_header *h = headers.at(i).get();
367 
368  if (h->measurement_number > app_wrk->s3_filter_number) {
370  &(app_workspace::get_instance()->selected_measuring), open_measuring_detail));
371  }
372  }
373  } else if (app_wrk->s3_selected_filter == 1) { // smaller than
374  for (size_t i = 0; i < headers.size(); i++) {
375  measurement_header *h = headers.at(i).get();
376 
377  if (h->measurement_number < app_wrk->s3_filter_number) {
379  &(app_workspace::get_instance()->selected_measuring), open_measuring_detail));
380  }
381  }
382  } else {
383  for (size_t i = 0; i < headers.size(); i++) {
384  measurement_header *h = headers.at(i).get();
386  &(app_workspace::get_instance()->selected_measuring), open_measuring_detail));
387  }
388  }
389 
391  }
392  } else {
393  INSERT_ELEMENT(new gui_label(get_localized_text("GT_SCREEN_REQUIRE_USER")))
394  EMPTY_LINE
395  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_3_FUNCTION_DESC")))
396  }
397 }
#define S3_MIN_FILTER_NUMBER
Definition: app_workspace.h:33
#define S3_FILTER_OPT_CNT
Definition: app_workspace.h:39
unsigned long s3_filter_number
This creates an ImGui::Seletable, which can serve as a label that can be navigated to.
Serves as container for basic measurement information, that is dispayed to GUI.
unsigned long measurement_number
const char * get_header_label()
void apply_meas_list_filter()
void open_measuring_detail()
void begin_scrollabe_region()
void end_scrollabe_region()

◆ define_screen_3_debug()

void define_screen_3_debug ( std::vector< std::unique_ptr< gui_element >> &  elems)

Definitions of gui elemnts of debug screen 3.

Definition at line 798 of file screen_definitions.cpp.

798  {
799  elems.clear();
800 
801  static char fake_in[128];
802  static int selected_s3d = 0;
803 
804  // following label doesnt work, why?
805  INSERT_ELEMENT(new gui_label("Label size TEST small", -1, -1, -1, app_workspace_ns::font_size::SMALL_FONT))
806  INSERT_ELEMENT(new gui_label("Label size TEST normal", -1, -1, -1, app_workspace_ns::font_size::NORMAL_FONT))
807  INSERT_ELEMENT(new gui_label("Label size TEST big", -1, -1, -1, app_workspace_ns::font_size::BIG_FONT))
808  EMPTY_LINE
809 
810  INSERT_ELEMENT(new gui_input(IN_TEXT, fake_in, 128, -1, -1, -1, "label", app_workspace_ns::font_size::SMALL_FONT))
811  INSERT_ELEMENT(new gui_input(IN_TEXT, fake_in, 128, -1, -1, -1, "label", app_workspace_ns::font_size::NORMAL_FONT))
812  INSERT_ELEMENT(new gui_input(IN_TEXT, fake_in, 128, -1, -1, -1, "label", app_workspace_ns::font_size::BIG_FONT))
813  EMPTY_LINE
814 
815  static const char* combo[] = {"Test", "Pokus"};
816 
817  INSERT_ELEMENT(new gui_combobox(combo, 2, &selected_s3d, "Combobox", -1, -1, 150,
819  INSERT_ELEMENT(new gui_combobox(combo, 2, &selected_s3d, "Combobox", -1, -1, 150,
821  INSERT_ELEMENT(new gui_combobox(combo, 2, &selected_s3d, "Combobox", -1, -1, 150,
823  EMPTY_LINE
827 }
void empty_cb()

◆ define_screen_4()

void define_screen_4 ( std::vector< std::unique_ptr< gui_element >> &  elems)

Definitions of gui elemnts of debug screen 4.

Definition at line 399 of file screen_definitions.cpp.

399  {
400  elems.clear();
401 
402  app_workspace* app_wrk = app_workspace::get_instance().get();
403  measurement* m = nullptr;
404 
405  if (app_wrk->has_user()) {
406  m = app_wrk->userspace->picked.get();
407  } else {
408  INSERT_ELEMENT(new gui_label(get_localized_text("GT_SCREEN_REQUIRE_USER")))
409  EMPTY_LINE
410  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_FUNCTION_DESCRIPTION")))
411  return;
412  }
413 
414  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_TITLE")))
415 
416  if (m == nullptr || m->id <= 0) {
417  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_NO_MEASUREMENT")))
418  } else {
419  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_UNITS_LAB"), -1, -1, 180))
420  SAME_LINE
421  INSERT_ELEMENT(new gui_combobox(app_wrk->unit_sel_labels, UNIT_SEL_CNT,
422  &(app_wrk->selected_unit_option), nullptr, 160, -1, 200))
423  ((gui_combobox*) last_element(elems))->set_value_change_action(unit_select_action); // WARNING! - if used after wrong element, application crashes (due to conversion)
424 
425  // using gui_observer for numerical values, because label would require some buffer/ string
426 
427  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_MEASUR_NUM_LAB"), -1, -1, 250))
428  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_MEASUR_NUM_LAB")))
429  SAME_LINE
430  INSERT_ELEMENT(new gui_observer(OBS_LONG, &(m->measurement_number)))
431 
432  if (m->continuous) {
433  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_MEASUR_NUM_PARTS")))
434  SAME_LINE
435  INSERT_ELEMENT(new gui_observer(OBS_INT, &(m->cont_measurements)))
436  }
437 
438  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_MEASURED_LAB"), -1, -1, 250))
439  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_MEASURED_LAB")))
440  SAME_LINE
441  INSERT_ELEMENT(new gui_label(m->measuree_uname.size() <= 0 ?
442  get_localized_text("GT_EMPTY_NULL_STRING") : m->measuree_uname.c_str()))
443 
444  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_MEASURED_BY_LAB"), -1, -1, 250))
445  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_MEASURED_BY_LAB")))
446  SAME_LINE
447  INSERT_ELEMENT(new gui_label(m->measurer_uname.size() <= 0 ?
448  get_localized_text("GT_EMPTY_NULL_STRING") : m->measurer_uname.c_str()))
449 
450 
451  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_MEASURING_SECTION")))
452  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_MEASURING_LEN_LAB"), -1, -1, 250))
453  INDENT
454  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_M_LENGTH"), -1, -1, 150))
455  SAME_LINE
456  INSERT_ELEMENT(new gui_label(m->length_str.c_str()))
457 
458  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_MEASURING_START_LAB"), -1, -1, 250))
459  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_M_START"), -1, -1, 150))
460  SAME_LINE
461  INSERT_ELEMENT(new gui_label(m->start_str.c_str()))
462 
463  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_MEASURING_END_LAB"), -1, -1, 250))
464  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_M_END"), -1, -1, 150))
465  SAME_LINE
466  INSERT_ELEMENT(new gui_label(m->end_str.c_str()))
467  UNINDENT
468 
469  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_EVERY_X_VAL_SECTION")))
470  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_X_VAL_MEDIAN"), -1, -1, 250))
471  INDENT
472  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEDIAN"), -1, -1, 150))
473  SAME_LINE
474  INSERT_ELEMENT(new gui_label(m->x_val_med_str.c_str()))
475 
476  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_X_VAL_AVARAGE"), -1, -1, 250))
477  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_AVARAGE"), -1, -1, 150))
478  SAME_LINE
479  INSERT_ELEMENT(new gui_label(m->x_val_avg_str.c_str()))
480  UNINDENT
481 
482 
483  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_ALL_VAL_SECTION")))
484  INDENT
485  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_MEDIAN")))
486  SAME_LINE
487  INSERT_ELEMENT(new gui_label(m->all_val_med_str.c_str()))
488 
489  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_AVARAGE")))
490  SAME_LINE
491  INSERT_ELEMENT(new gui_label(m->all_val_avg_str.c_str()))
492  UNINDENT
493  }
494 }
#define UNIT_SEL_CNT
Definition: app_workspace.h:37
@ OBS_LONG
Definition: gui_observer.h:13
void unit_select_action()

◆ define_screen_4_debug()

void define_screen_4_debug ( std::vector< std::unique_ptr< gui_element >> &  elems)

Definitions of gui elemnts of debug screen 4.

Definition at line 829 of file screen_definitions.cpp.

829  {
830  elems.clear();
831 
832  // elems.push_back(std::unique_ptr<gui_element>(
833  // new gui_direct(render_line)
834  // ));
840  // elems.push_back(std::unique_ptr<gui_element>(
841  // new gui_direct(render_vert)
842  // ));
850 
851  static char in1[32], in2[32], in3[32], in4[32];
852  EMPTY_LINE
853  INSERT_ELEMENT(new gui_input(IN_TEXT, in1, 32, -1, -1, 50, "in 1"))
854  SAME_LINE
855  INSERT_ELEMENT(new gui_input(IN_TEXT, in2, 32, -1, -1, 50, "in 2"))
856  SAME_LINE
857  INSERT_ELEMENT(new gui_input(IN_TEXT, in3, 32, -1, -1, 50, "in 3"))
858  INSERT_ELEMENT(new gui_input(IN_TEXT, in4, 32, -1, -1, 50, "in 4"))
859 
860  // text wrapping bug fix test
861  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_2_SAMPLES_IN_LIMITS"), -1, -1, 100))
862  // INSERT_ELEMENT(new gui_direct(text_wrap_debug))
863 }
void draw_rect()

◆ define_screen_5()

void define_screen_5 ( std::vector< std::unique_ptr< gui_element >> &  elems)

Definitions of gui elemnts of debug screen 5.

Definition at line 496 of file screen_definitions.cpp.

496  {
497  elems.clear();
498 
499  app_workspace* app_wrk = app_workspace::get_instance().get();
500 
501  if (app_wrk->s5_success_indicator >= 0) {
503  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_5_CALIBRATION_APPLIED")))
504  } else if (app_wrk->s5_success_indicator == S5_USER_CREATED) {
505  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_5_USER_CREATED")))
506  } else if (app_wrk->s5_success_indicator == S5_FINISHED_KB_DELAYS) {
507  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_5_FINISHED_TESTING_KB")))
508  }
509  }
510 
511  if (app_wrk->has_user()) {
512  if (app_wrk->userspace->get_user()->role <= 1) {
513  INSERT_ELEMENT(new gui_label(get_localized_text("GT_INSUFFICIENT_PERMISSION")))
514  EMPTY_LINE
515  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_5_ADMIN_SCREEN_ONLY")))
516  return;
517  }
518  } else {
519  INSERT_ELEMENT(new gui_label(get_localized_text("GT_SCREEN_REQUIRE_USER")))
520  EMPTY_LINE
521  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_5_FUNCTION_DESCRIPTION")))
522  return;
523  }
524 
525  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_5_CALIBRATE_HX"),
526  move_to_hx_calibration, -1, -1, 460, 40))
527  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_5_ADD_USER"),
528  move_to_user_addition, -1, -1, 460, 40))
529  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_5_TEST_HX_SAMPLES"),
530  move_to_hx_test_samp, -1, -1, 460, 40))
531  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_5_TEST_HX_TIMEOUT"),
532  move_to_hx_test_time, -1, -1, 460, 40))
533  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_5_TEST_KB_DELAYS"),
534  move_to_kb_delay_test, -1, -1, 460, 40))
535 }
#define S5_CALIBRATION_APPLIED
Definition: app_workspace.h:63
#define S5_USER_CREATED
Definition: app_workspace.h:64
#define S5_FINISHED_KB_DELAYS
Definition: app_workspace.h:65
int s5_success_indicator
void move_to_user_addition()
void move_to_hx_calibration()
void move_to_hx_test_samp()
void move_to_hx_test_time()
void move_to_kb_delay_test()

◆ define_screen_5_debug()

void define_screen_5_debug ( std::vector< std::unique_ptr< gui_element >> &  elems)

Definitions of gui elemnts of debug screen 5.

Definition at line 865 of file screen_definitions.cpp.

865  {
866  elems.clear();
867 
868  INSERT_ELEMENT(new gui_label("Test/ debug functions dont always have GUI. View logs for information",
870  INSERT_ELEMENT(new gui_button("Test db function", invoke_sql_debug, -1, -1, 460, 40))
871  INSERT_ELEMENT(new gui_button("HX samples scale", invoke_sql_debug, -1, -1, 460, 40))
872  INSERT_ELEMENT(new gui_button("HX timeout scale", invoke_sql_debug, -1, -1, 460, 40))
873  // INSERT_ELEMENT(new gui_label("Scale result: "))
874  // SAME_LINE
875 
876  INSERT_ELEMENT(new gui_button("Test sql 1", invoke_sql_debug, -1, -1, 460, 40))
877  INSERT_ELEMENT(new gui_button("Test login sql", test_user_login_sql, -1, -1, 460, 40))
878  INSERT_ELEMENT(new gui_button("Test creds sql", test_user_creds_sql, -1, -1, 460, 40))
879  INSERT_ELEMENT(new gui_button("Test headers sql", test_user_meas_header_sql, -1, -1, 460, 40))
880  INSERT_ELEMENT(new gui_button("Test increment sql", test_user_inc_measur_cnt, -1, -1, 460, 40))
881  INSERT_ELEMENT(new gui_button("Test uname ava sql", test_user_is_uname_avail, -1, -1, 460, 40))
882  INSERT_ELEMENT(new gui_button("Test rfid ava sql", test_user_is_rfid_avail, -1, -1, 460, 40))
883  // INSERT_ELEMENT(new gui_button("Err test 1", test_errscr_1, -1, -1, 460, 40))
884  // INSERT_ELEMENT(new gui_button("Err test 2", test_errscr_2, -1, -1, 460, 40))
885 
886  // INSERT_ELEMENT(new gui_button("Update user rfids", update_rfids_debug, -1, -1, 460, 40))
887  // INSERT_ELEMENT(new gui_button("Insert user tst", test_user_insert, -1, -1, 460, 40))
888  // INSERT_ELEMENT(new gui_button("Insert measur tst", test_measurement_insert, -1, -1, 460, 40))
889  INSERT_ELEMENT(new gui_button("Insert measur tst", test_measurement_query, -1, -1, 460, 40))
890 
891 }
void test_user_creds_sql()
void test_user_inc_measur_cnt()
void test_user_is_uname_avail()
void test_user_login_sql()
void test_user_is_rfid_avail()
void test_measurement_query()
void invoke_sql_debug()
void test_user_meas_header_sql()

◆ define_screen_6()

void define_screen_6 ( std::vector< std::unique_ptr< gui_element >> &  elems)

Definitions of gui elemnts of debug screen 6.

Definition at line 537 of file screen_definitions.cpp.

537  {
538  elems.clear();
539 
540  app_workspace* app_wrk = app_workspace::get_instance().get();
541 
542  if (app_wrk->has_user()) {
543  if (app_wrk->userspace->get_user()->role <= 1) {
544  INSERT_ELEMENT(new gui_label(get_localized_text("GT_INSUFFICIENT_PERMISSION")))
545  EMPTY_LINE
546  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_5_ADMIN_SCREEN_ONLY")))
547  return;
548  }
549  } else {
550  INSERT_ELEMENT(new gui_label(get_localized_text("GT_SCREEN_REQUIRE_USER")))
551  EMPTY_LINE
552  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_FUNCTION_DESCRIPTION")))
553  return;
554  }
555 
556  if (app_wrk->hx_measuring) {
557  if (app_wrk->s6_tare_complete) {
558  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_CALIBRATING")))
559  } else if (app_wrk->test_hx_testing) {
560  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_TESTING_IN_PROGRESS")))
561  } else {
562  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_TARING")))
563  }
564 
565  return;
566  }
567 
568  if (app_wrk->s5_screen_6_indicator == S5_TO_S6_CALIBRATION) { // calibration
569  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_REF_UNIT_LAB"), -1, -1, 220))
570  SAME_LINE
571  INSERT_ELEMENT(new gui_input(input_type::IN_INT, &(app_wrk->s6_ref_mass_in), 0, 220, -1, 200))
572 
573  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_4_UNITS_LAB"), -1, -1, 220))
574  SAME_LINE
575  INSERT_ELEMENT(new gui_combobox(app_wrk->s6_unit_sel_labels, S6_UNIT_SEL_CNT,
576  &(app_wrk->s6_selected_unit_option), nullptr, 220, -1, 200))
577 
578  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_SAMPLES_LAB"), -1, -1, 220))
579  SAME_LINE
580  INSERT_ELEMENT(new gui_input(input_type::IN_INT, &(app_wrk->s6_samples_in), 0, 220, -1, 200))
581  ((gui_input*) last_element(elems))->set_min_max(S6_MIN_SAMPLES_IN, S6_MAX_SAMPLES_IN); // WARNING! - if used after wrong element, application crashes on startup
582 
583  EMPTY_LINE
584 
585  if (app_wrk->s6_tare_complete) {
586  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_CALIBRATION_REQ")))
587  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_6_START_CALIBRATION"),
588  start_calibration, -1, -1, 460, 40))
589  } else {
590  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_TARE_REQ")))
591  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_6_START_TARE"),
592  start_tare, -1, -1, 460, 40))
593  }
594 
595  if (app_wrk->s6_calibration_finished) {
596  EMPTY_LINE
597  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_REF_UNIT_LAB"), -1, -1, 240))
598  SAME_LINE
599  INSERT_ELEMENT(new gui_label(app_wrk->s6_ref_mass_str.c_str()))
600 
601  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_HX_REF_UNIT_LAB"), -1, -1, 240))
602  SAME_LINE
603  INSERT_ELEMENT(new gui_observer(OBS_INT, &(app_wrk->s6_calib_ref_unit)))
604 
605  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_HX_OFFSET_LAB"), -1, -1, 240))
606  SAME_LINE
607  INSERT_ELEMENT(new gui_observer(OBS_INT, &(app_wrk->s6_calib_offset)))
608 
609  EMPTY_LINE
610  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_6_APPLY_CAL"),
611  apply_calibration, -1, -1, 460, 40))
612 
613  // EMPTY_LINE
614  // INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_MAKE_PERMANENT_LAB")))
615  }
616  } else if (app_wrk->s5_screen_6_indicator == S5_TO_S6_USERADD) { // user addition
617  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_USR_ROLE"), -1, -1, 220))
618  SAME_LINE
619  INSERT_ELEMENT(new gui_combobox(app_wrk->s6_role_labels, S6_ROLE_CNT,
620  &(app_wrk->s6_selected_role), nullptr, 220, -1, 200))
621 
622  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_USR_USERNAME"), -1, -1, 220))
623  SAME_LINE
624  INSERT_ELEMENT(new gui_input(input_type::IN_TEXT, &(app_wrk->s6_uname_in), DEF_BUFF_SIZE_SMALL, 220, -1, 200))
625 
626  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_USR_PASSWORD"), -1, -1, 220))
627  SAME_LINE
628  INSERT_ELEMENT(new gui_input(input_type::IN_PASSWORD_PLAIN, &(app_wrk->s6_passwd_in),
629  DEF_BUFF_SIZE_SMALL, 220, -1, 200))
630 
631  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_USR_RFID_IND"), -1, -1, 280))
632  SAME_LINE
633  INSERT_ELEMENT(new gui_label(get_localized_text(app_wrk->s6_rfid_indicator ?
634  get_localized_text("GT_YES") :
635  get_localized_text("GT_NO")), -1, -1, 220))
636 
637  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_USR_DESCRIPTION"), -1, -1, 220))
638  SAME_LINE
639  INSERT_ELEMENT(new gui_input(input_type::IN_TEXT, &(app_wrk->s6_desc_in), DEF_BUFF_SIZE_EXTRA, 220, -1, 200))
640 
641  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_USR_NAME"), -1, -1, 220))
642  SAME_LINE
643  INSERT_ELEMENT(new gui_input(input_type::IN_TEXT, &(app_wrk->s6_name_in), DEF_BUFF_SIZE, 220, -1, 200))
644 
645  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_USR_LASTNAME"), -1, -1, 220))
646  SAME_LINE
647  INSERT_ELEMENT(new gui_input(input_type::IN_TEXT, &(app_wrk->s6_lastname_in), DEF_BUFF_SIZE_SMALL, 220, -1,200))
648 
649  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_USR_DOB"), -1, -1, 300))
650 
651  INDENT
652 
653  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_USR_YEAR"), -1, -1, 220))
654  SAME_LINE
655  INSERT_ELEMENT(new gui_input(input_type::IN_INT, &(app_wrk->s6_year_in), 0, 220, -1, 200))
656  std::time_t ct_tmp = std::time(nullptr);
657  std::tm *current_time = std::localtime(&ct_tmp);
658  int year_max = current_time->tm_year + 1900; // tm_year is a year since 1900 (e.g: 122 = 2022)
659  ((gui_input*) last_element(elems))->set_min_max(YEAR_MIN, year_max); // WARNING! - if used after wrong element, application crashes on startup
660 
661 
662  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_USR_MONTH"), -1, -1, 220))
663  SAME_LINE
664  INSERT_ELEMENT(new gui_combobox(app_wrk->s6_month_labels, S6_MONTH_CNT,
665  &(app_wrk->s6_selected_month), nullptr, 220, -1, 200))
666 
667  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_USR_DAY"), -1, -1, 220))
668  SAME_LINE
669  INSERT_ELEMENT(new gui_input(input_type::IN_INT, &(app_wrk->s6_day_in), 0, 220, -1, 200))
670  ((gui_input*) last_element(elems))->set_min_max(DAY_MIN, DAY_MAX); // WARNING! - if used after wrong element, application crashes on startup
671 
672  UNINDENT
673 
674  EMPTY_LINE
675  INSERT_ELEMENT(new gui_button(get_localized_text("SCREEN_6_USR_ADD"),
676  register_user, -1, -1, 460, 40))
677  } else if (app_wrk->s5_screen_6_indicator == S5_TO_S6_HX_TEST_SAMPLES) { // testing hx with sample count
678  INSERT_ELEMENT(new gui_label(get_localized_text("GT_RESULTS")))
679  EMPTY_LINE
680 
681  for (int i = 0; i < (HX_TEST_CONST_IT_COUNT + HX_TEST_INC_IT_COUNT); i++) {
682  INSERT_ELEMENT(new gui_label(app_wrk->test_hx_samples_times[i].second.c_str()))
683  }
684  } else if (app_wrk->s5_screen_6_indicator == S5_TO_S6_HX_TEST_TIMEOUT) { // testing hx with timeout
685  INSERT_ELEMENT(new gui_label(get_localized_text("GT_RESULTS")))
686  EMPTY_LINE
687 
688  for (int i = 0; i < (HX_TEST_CONST_IT_COUNT + HX_TEST_INC_IT_COUNT); i++) {
689  INSERT_ELEMENT(new gui_label(app_wrk->test_hx_timeout_collected[i].second.c_str()))
690  }
691  } else if (app_wrk->s5_screen_6_indicator == S5_TO_S6_KB_DELAY_TEST) {
692  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_KB_TESTING_TIP1")))
693  EMPTY_LINE
694  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_KB_TESTING_TIP")))
695 
696  EMPTY_LINE
697  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_STOP_TESTING_HASH")))
698  EMPTY_LINE
699 
700  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_KB_DELAY_MS")))
701  SAME_LINE
702  INSERT_ELEMENT(new gui_observer(OBS_INT, &(app_wrk->kb_delay_ms)))
703 
704  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_KB_DELAY_US")))
705  SAME_LINE
706  INSERT_ELEMENT(new gui_observer(OBS_INT, &(app_wrk->kb_delay_us)))
707  } else {
708  INSERT_ELEMENT(new gui_label(get_localized_text("SCREEN_6_WRONG_INDICATOR")))
709  }
710 }
#define S5_TO_S6_KB_DELAY_TEST
Definition: app_workspace.h:61
#define S6_MAX_SAMPLES_IN
Definition: app_workspace.h:35
#define S6_ROLE_CNT
Definition: app_workspace.h:41
#define DAY_MIN
Definition: app_workspace.h:44
#define S5_TO_S6_CALIBRATION
Definition: app_workspace.h:57
#define DEF_BUFF_SIZE_EXTRA
Definition: app_workspace.h:27
#define YEAR_MIN
Definition: app_workspace.h:46
#define S5_TO_S6_USERADD
Definition: app_workspace.h:58
#define S6_MIN_SAMPLES_IN
Definition: app_workspace.h:34
#define HX_TEST_CONST_IT_COUNT
Definition: app_workspace.h:52
#define HX_TEST_INC_IT_COUNT
Definition: app_workspace.h:53
#define S5_TO_S6_HX_TEST_TIMEOUT
Definition: app_workspace.h:60
#define S6_MONTH_CNT
Definition: app_workspace.h:42
#define S6_UNIT_SEL_CNT
Definition: app_workspace.h:40
#define DAY_MAX
Definition: app_workspace.h:45
#define S5_TO_S6_HX_TEST_SAMPLES
Definition: app_workspace.h:59
int s5_screen_6_indicator
std::pair< long, std::string > test_hx_samples_times[HX_TEST_CONST_IT_COUNT+HX_TEST_INC_IT_COUNT]
std::pair< long, std::string > test_hx_timeout_collected[HX_TEST_CONST_IT_COUNT+HX_TEST_INC_IT_COUNT]
@ IN_PASSWORD_PLAIN
Definition: gui_input.h:16
void start_tare()
void apply_calibration()
void register_user()
void start_calibration()

Variable Documentation

◆ err_desc

gui_label* err_desc
extern

Definition at line 123 of file screen_definitions.cpp.

◆ err_title

gui_label* err_title
extern

Definition at line 122 of file screen_definitions.cpp.