Skip to content

Commit

Permalink
enabled logging receive, checked row size before adding them in log_m…
Browse files Browse the repository at this point in the history
…odel.cpp
  • Loading branch information
Peguen committed Jan 7, 2025
1 parent 6e7ffce commit a9d7e30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions app/mon/mon_gui/src/ecalmon.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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");

Expand Down
9 changes: 6 additions & 3 deletions app/mon/mon_gui/src/widgets/models/log_model.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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())
Expand All @@ -263,7 +265,8 @@ void LogModel::insertLogs(const eCAL::pb::LogMessageList& logging_pb)
counter--;
}

endInsertRows();
if (insert_row)
endInsertRows();
}

void LogModel::clear()
Expand Down

0 comments on commit a9d7e30

Please sign in to comment.