From 540a8ea06d7f41312a69c3474c1dcdd7f5bdb0c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20Monta=C3=B1ana=20G=C3=B3mez?= Date: Tue, 16 Jul 2024 10:33:44 +0200 Subject: [PATCH] Refactor update rows --- src/manage/ManageScreen.cpp | 6 +----- src/manage/ManageScreen.h | 1 - src/manage/Paginator.hpp | 2 -- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/manage/ManageScreen.cpp b/src/manage/ManageScreen.cpp index 5063efb..0ad5bd4 100644 --- a/src/manage/ManageScreen.cpp +++ b/src/manage/ManageScreen.cpp @@ -24,13 +24,12 @@ namespace platform { results.load(); openExcel = false; workbook = NULL; - this->rows = std::max(6, rows - 6); // 6 is the number of lines used by the menu & header maxModel = results.maxModelSize(); maxTitle = results.maxTitleSize(); 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" }; sort_fields = { "Date", "Model", "Score", "Time" }; - computeSizes(); + updateSize(rows, cols); if (min_columns > cols) { 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) { paginator_.setPageSize(rows); } - resize = false; } void ManageScreen::updateSize(int rows_, int cols_) { rows = std::max(6, rows_ - 6); // 6 is the number of lines used by the menu & header cols = cols_; - resize = true; computeSizes(); } void ManageScreen::doMenu() @@ -373,7 +370,6 @@ namespace platform { {"Page+", '+', false}, {"Page-", '-', false} }; - while (!finished) { auto main_menu = OptionsMenu(mainOptions, Colors::IGREEN(), Colors::YELLOW(), cols); auto list_menu = OptionsMenu(listOptions, Colors::IBLUE(), Colors::YELLOW(), cols); diff --git a/src/manage/ManageScreen.h b/src/manage/ManageScreen.h index 78900e4..d9e0d57 100644 --- a/src/manage/ManageScreen.h +++ b/src/manage/ManageScreen.h @@ -47,7 +47,6 @@ namespace platform { bool complete; bool partial; bool compare; - bool resize = false; int maxModel, maxTitle; std::vector header_labels; std::vector header_lengths; diff --git a/src/manage/Paginator.hpp b/src/manage/Paginator.hpp index 9e3a8c1..cd2f2bb 100644 --- a/src/manage/Paginator.hpp +++ b/src/manage/Paginator.hpp @@ -54,6 +54,4 @@ private: int page; 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 \ No newline at end of file