Refactor update rows

This commit is contained in:
2024-07-16 10:33:44 +02:00
parent 1924c4392b
commit 540a8ea06d
3 changed files with 1 additions and 8 deletions

View File

@@ -24,13 +24,12 @@ namespace platform {
results.load(); results.load();
openExcel = false; openExcel = false;
workbook = NULL; workbook = NULL;
this->rows = std::max(6, rows - 6); // 6 is the number of lines used by the menu & header
maxModel = results.maxModelSize(); maxModel = results.maxModelSize();
maxTitle = results.maxTitleSize(); maxTitle = results.maxTitleSize();
header_lengths = { 3, 10, maxModel, 11, 10, 12, 2, 3, 7, maxTitle }; header_lengths = { 3, 10, maxModel, 11, 10, 12, 2, 3, 7, maxTitle };
header_labels = { " #", "Date", "Model", "Score Name", "Score", "Platform", "SD", "C/P", "Time", "Title" }; header_labels = { " #", "Date", "Model", "Score Name", "Score", "Platform", "SD", "C/P", "Time", "Title" };
sort_fields = { "Date", "Model", "Score", "Time" }; sort_fields = { "Date", "Model", "Score", "Time" };
computeSizes(); updateSize(rows, cols);
if (min_columns > cols) { if (min_columns > cols) {
throw std::runtime_error("Make screen bigger to fit the results! " + std::to_string(min_columns - cols) + " columns needed! "); throw std::runtime_error("Make screen bigger to fit the results! " + std::to_string(min_columns - cols) + " columns needed! ");
} }
@@ -56,13 +55,11 @@ namespace platform {
for (auto& paginator_ : paginator) { for (auto& paginator_ : paginator) {
paginator_.setPageSize(rows); paginator_.setPageSize(rows);
} }
resize = false;
} }
void ManageScreen::updateSize(int rows_, int cols_) void ManageScreen::updateSize(int rows_, int cols_)
{ {
rows = std::max(6, rows_ - 6); // 6 is the number of lines used by the menu & header rows = std::max(6, rows_ - 6); // 6 is the number of lines used by the menu & header
cols = cols_; cols = cols_;
resize = true;
computeSizes(); computeSizes();
} }
void ManageScreen::doMenu() void ManageScreen::doMenu()
@@ -373,7 +370,6 @@ namespace platform {
{"Page+", '+', false}, {"Page+", '+', false},
{"Page-", '-', false} {"Page-", '-', false}
}; };
while (!finished) { while (!finished) {
auto main_menu = OptionsMenu(mainOptions, Colors::IGREEN(), Colors::YELLOW(), cols); auto main_menu = OptionsMenu(mainOptions, Colors::IGREEN(), Colors::YELLOW(), cols);
auto list_menu = OptionsMenu(listOptions, Colors::IBLUE(), Colors::YELLOW(), cols); auto list_menu = OptionsMenu(listOptions, Colors::IBLUE(), Colors::YELLOW(), cols);

View File

@@ -47,7 +47,6 @@ namespace platform {
bool complete; bool complete;
bool partial; bool partial;
bool compare; bool compare;
bool resize = false;
int maxModel, maxTitle; int maxModel, maxTitle;
std::vector<std::string> header_labels; std::vector<std::string> header_labels;
std::vector<int> header_lengths; std::vector<int> header_lengths;

View File

@@ -54,6 +54,4 @@ private:
int page; int page;
int numPages; int numPages;
}; };
//Options: (quit, list, Delete, datasets, hide, sort, report, excel, title, set A, set B, compare A~B, page, Page+, Page-
//123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456798012345678901234567890(120)
#endif #endif