Line data Source code
1 : /*! 2 : * \file esys/repo/tui/appstate.cpp 3 : * \brief 4 : * 5 : * \cond 6 : * __legal_b__ 7 : * 8 : * Copyright (c) 2026 Michel Gillet 9 : * Distributed under the MIT License. 10 : * (See accompanying file LICENSE.txt or 11 : * copy at https://opensource.org/licenses/MIT) 12 : * 13 : * __legal_e__ 14 : * \endcond 15 : * 16 : */ 17 : 18 : #include "esys/repo/esysrepo_prec.h" 19 : #include "esys/repo/tui/appstate.h" 20 : 21 : namespace esys::repo::tui 22 : { 23 : 24 1 : AppState::AppState() = default; 25 : 26 1 : AppState::~AppState() = default; 27 : 28 37 : std::vector<RepoState> &AppState::get_repos() 29 : { 30 37 : return m_repos; 31 : } 32 : 33 0 : const std::vector<RepoState> &AppState::get_repos() const 34 : { 35 0 : return m_repos; 36 : } 37 : 38 31 : std::vector<WorkerState> &AppState::get_workers() 39 : { 40 31 : return m_workers; 41 : } 42 : 43 0 : const std::vector<WorkerState> &AppState::get_workers() const 44 : { 45 0 : return m_workers; 46 : } 47 : 48 0 : void AppState::set_layout_mode(LayoutMode layout_mode) 49 : { 50 0 : m_layout_mode = layout_mode; 51 0 : } 52 : 53 0 : LayoutMode AppState::get_layout_mode() const 54 : { 55 0 : return m_layout_mode; 56 : } 57 : 58 2 : void AppState::set_selected_worker(int selected_worker) 59 : { 60 2 : m_selected_worker = selected_worker; 61 2 : } 62 : 63 0 : int AppState::get_selected_worker() const 64 : { 65 0 : return m_selected_worker; 66 : } 67 : 68 2 : void AppState::set_selected_repo(int selected_repo) 69 : { 70 2 : m_selected_repo = selected_repo; 71 2 : } 72 : 73 0 : int AppState::get_selected_repo() const 74 : { 75 0 : return m_selected_repo; 76 : } 77 : 78 0 : void AppState::set_terminal_cols(int terminal_cols) 79 : { 80 0 : m_terminal_cols = terminal_cols; 81 0 : } 82 : 83 0 : int AppState::get_terminal_cols() const 84 : { 85 0 : return m_terminal_cols; 86 : } 87 : 88 0 : void AppState::set_terminal_rows(int terminal_rows) 89 : { 90 0 : m_terminal_rows = terminal_rows; 91 0 : } 92 : 93 0 : int AppState::get_terminal_rows() const 94 : { 95 0 : return m_terminal_rows; 96 : } 97 : 98 11 : void AppState::set_done_count(int done_count) 99 : { 100 11 : m_done_count = done_count; 101 11 : } 102 : 103 1 : int AppState::get_done_count() const 104 : { 105 1 : return m_done_count; 106 : } 107 : 108 11 : void AppState::set_running_count(int running_count) 109 : { 110 11 : m_running_count = running_count; 111 11 : } 112 : 113 5 : int AppState::get_running_count() const 114 : { 115 5 : return m_running_count; 116 : } 117 : 118 11 : void AppState::set_pending_count(int pending_count) 119 : { 120 11 : m_pending_count = pending_count; 121 11 : } 122 : 123 20 : int AppState::get_pending_count() const 124 : { 125 20 : return m_pending_count; 126 : } 127 : 128 11 : void AppState::set_failed_count(int failed_count) 129 : { 130 11 : m_failed_count = failed_count; 131 11 : } 132 : 133 1 : int AppState::get_failed_count() const 134 : { 135 1 : return m_failed_count; 136 : } 137 : 138 5 : void AppState::set_scheduler_paused(bool scheduler_paused) 139 : { 140 5 : m_scheduler_paused = scheduler_paused; 141 5 : } 142 : 143 12 : bool AppState::get_scheduler_paused() const 144 : { 145 12 : return m_scheduler_paused; 146 : } 147 : 148 5 : void AppState::set_scheduler_backpressure(bool scheduler_backpressure) 149 : { 150 5 : m_scheduler_backpressure = scheduler_backpressure; 151 5 : } 152 : 153 11 : bool AppState::get_scheduler_backpressure() const 154 : { 155 11 : return m_scheduler_backpressure; 156 : } 157 : 158 5 : void AppState::set_scheduler_pending_queue(std::size_t scheduler_pending_queue) 159 : { 160 5 : m_scheduler_pending_queue = scheduler_pending_queue; 161 5 : } 162 : 163 0 : std::size_t AppState::get_scheduler_pending_queue() const 164 : { 165 0 : return m_scheduler_pending_queue; 166 : } 167 : 168 5 : void AppState::set_scheduler_active_workers(std::size_t scheduler_active_workers) 169 : { 170 5 : m_scheduler_active_workers = scheduler_active_workers; 171 5 : } 172 : 173 0 : std::size_t AppState::get_scheduler_active_workers() const 174 : { 175 0 : return m_scheduler_active_workers; 176 : } 177 : 178 11 : void AppState::set_queue_reason(QueueReason queue_reason) 179 : { 180 11 : m_queue_reason = queue_reason; 181 11 : } 182 : 183 4 : QueueReason AppState::get_queue_reason() const 184 : { 185 4 : return m_queue_reason; 186 : } 187 : 188 2 : void AppState::set_queue_filter(QueueFilter queue_filter) 189 : { 190 2 : m_queue_filter = queue_filter; 191 2 : } 192 : 193 0 : QueueFilter AppState::get_queue_filter() const 194 : { 195 0 : return m_queue_filter; 196 : } 197 : 198 0 : void AppState::set_log_lines(std::vector<std::string> log_lines) 199 : { 200 0 : m_log_lines = std::move(log_lines); 201 0 : } 202 : 203 0 : const std::vector<std::string> &AppState::get_log_lines() const 204 : { 205 0 : return m_log_lines; 206 : } 207 : 208 0 : void AppState::set_log_scroll_offset(int log_scroll_offset) 209 : { 210 0 : m_log_scroll_offset = log_scroll_offset; 211 0 : } 212 : 213 0 : int AppState::get_log_scroll_offset() const 214 : { 215 0 : return m_log_scroll_offset; 216 : } 217 : 218 0 : void AppState::set_log_follow_tail(bool log_follow_tail) 219 : { 220 0 : m_log_follow_tail = log_follow_tail; 221 0 : } 222 : 223 0 : bool AppState::get_log_follow_tail() const 224 : { 225 0 : return m_log_follow_tail; 226 : } 227 : 228 0 : void AppState::set_phase_text(std::string phase_text) 229 : { 230 0 : m_phase_text = std::move(phase_text); 231 0 : } 232 : 233 0 : const std::string &AppState::get_phase_text() const 234 : { 235 0 : return m_phase_text; 236 : } 237 : 238 0 : void AppState::set_log_pane_height(int log_pane_height) 239 : { 240 0 : m_log_pane_height = log_pane_height; 241 0 : } 242 : 243 0 : int AppState::get_log_pane_height() const 244 : { 245 0 : return m_log_pane_height; 246 : } 247 : 248 : } // namespace esys::repo::tui