From a9d7e30072a6182285977ef79403deb643b0684b Mon Sep 17 00:00:00 2001 From: Peguen <73380451+Peguen@users.noreply.github.com> Date: Tue, 7 Jan 2025 15:57:42 +0100 Subject: [PATCH] enabled logging receive, checked row size before adding them in log_model.cpp --- app/mon/mon_gui/src/ecalmon.cpp | 6 ++++-- app/mon/mon_gui/src/widgets/models/log_model.cpp | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/mon/mon_gui/src/ecalmon.cpp b/app/mon/mon_gui/src/ecalmon.cpp index f9edf8ddb9..fe4c8bab27 100644 --- a/app/mon/mon_gui/src/ecalmon.cpp +++ b/app/mon/mon_gui/src/ecalmon.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2025 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,7 +71,9 @@ Ecalmon::Ecalmon(QWidget *parent) , monitor_error_counter_(0) { // Just make sure that eCAL is initialized - eCAL::Initialize("eCALMon", eCAL::Init::Default | eCAL::Init::Monitoring); + auto config = eCAL::GetConfiguration(); + config.logging.receiver.enable = true; + eCAL::Initialize(config, "eCALMon", eCAL::Init::Default | eCAL::Init::Monitoring); eCAL::Monitoring::SetFilterState(false); eCAL::Process::SetState(proc_sev_healthy, proc_sev_level1, "Running"); diff --git a/app/mon/mon_gui/src/widgets/models/log_model.cpp b/app/mon/mon_gui/src/widgets/models/log_model.cpp index 0dfefa10c0..24468a6aa5 100644 --- a/app/mon/mon_gui/src/widgets/models/log_model.cpp +++ b/app/mon/mon_gui/src/widgets/models/log_model.cpp @@ -1,6 +1,6 @@ /* ========================= eCAL LICENSE ================================= * - * Copyright (C) 2016 - 2019 Continental Corporation + * Copyright (C) 2016 - 2025 Continental Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -241,7 +241,9 @@ void LogModel::insertLogs(const eCAL::pb::LogMessageList& logging_pb) // Add new elements to the bottom size_before = logs_.size(); int size_after = (size_before + inserted_row_count < max_entries_ ? size_before + inserted_row_count : max_entries_); - beginInsertRows(QModelIndex(), size_before, size_after - 1); + bool insert_row = size_before <= size_after - 1; + if (insert_row) + beginInsertRows(QModelIndex(), size_before, size_after - 1); int counter = inserted_row_count; for (auto& log_message_pb : logging_pb.log_messages()) @@ -263,7 +265,8 @@ void LogModel::insertLogs(const eCAL::pb::LogMessageList& logging_pb) counter--; } - endInsertRows(); + if (insert_row) + endInsertRows(); } void LogModel::clear()