| 234 | } |
| 235 | |
| 236 | void OnLogMessage(const AnyLogMessage& message) |
| 237 | { |
| 238 | _logRenderer->add(message); |
| 239 | _logStream.flush(); |
| 240 | |
| 241 | std::visit( |
| 242 | overloaded{ |
| 243 | /* Fallback --- do nothing */ |
| 244 | [&](const auto& m) |
| 245 | { |
| 246 | }, |
| 247 | |
| 248 | /* We terminated due to the stop button. */ |
| 249 | [&](std::shared_ptr<const EmergencyStopMessage> m) |
| 250 | { |
| 251 | _statusBar->SetLeftLabel("Emergency stop!"); |
| 252 | _statusBar->HideProgressBar(); |
| 253 | _statusBar->SetRightLabel(""); |
| 254 | }, |
| 255 | |
| 256 | /* A fatal error. */ |
| 257 | [&](std::shared_ptr<const ErrorLogMessage> m) |
| 258 | { |
| 259 | _statusBar->SetLeftLabel(m->message); |
| 260 | wxMessageBox(m->message, "Error", wxOK | wxICON_ERROR); |
| 261 | _statusBar->HideProgressBar(); |
| 262 | _statusBar->SetRightLabel(""); |
| 263 | }, |
| 264 | |
| 265 | /* Indicates that we're starting a write operation. */ |
| 266 | [&](std::shared_ptr<const BeginWriteOperationLogMessage> m) |
| 267 | { |
| 268 | _statusBar->SetRightLabel( |
| 269 | fmt::format("W {}.{}", m->track, m->head)); |
| 270 | _imagerPanel->SetVisualiserMode( |
| 271 | m->track, m->head, VISMODE_WRITING); |
| 272 | }, |
| 273 | |
| 274 | [&](std::shared_ptr<const EndWriteOperationLogMessage> m) |
| 275 | { |
| 276 | _statusBar->SetRightLabel(""); |
| 277 | _imagerPanel->SetVisualiserMode(0, 0, VISMODE_NOTHING); |
| 278 | }, |
| 279 | |
| 280 | /* Indicates that we're starting a read operation. */ |
| 281 | [&](std::shared_ptr<const BeginReadOperationLogMessage> m) |
| 282 | { |
| 283 | _statusBar->SetRightLabel( |
| 284 | fmt::format("R {}.{}", m->track, m->head)); |
| 285 | _imagerPanel->SetVisualiserMode( |
| 286 | m->track, m->head, VISMODE_READING); |
| 287 | }, |
| 288 | |
| 289 | [&](std::shared_ptr<const EndReadOperationLogMessage> m) |
| 290 | { |
| 291 | _statusBar->SetRightLabel(""); |
| 292 | _imagerPanel->SetVisualiserMode(0, 0, VISMODE_NOTHING); |
| 293 | }, |
nothing calls this directly
no test coverage detected