From 0d086d1eb170a7254b9e52080e8d00260c3fc258 Mon Sep 17 00:00:00 2001 From: Tobias Triffterer <tobias@ep1.ruhr-uni-bochum.de> Date: Wed, 5 May 2021 23:34:57 +0200 Subject: [PATCH] Accept Histogram Clearing from Server To synchronize the histogram content, clear it when it is cleared on the server. --- src/clientgui.cpp | 8 ++++++-- src/clientgui.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/clientgui.cpp b/src/clientgui.cpp index 34c8382..058bc98 100644 --- a/src/clientgui.cpp +++ b/src/clientgui.cpp @@ -101,7 +101,10 @@ void ClientGui::handleMessageFromServer(const QString& message) case Protocol::Action::closeVacuumValve: case Protocol::Action::startAdc: case Protocol::Action::stopAdc: + break; case Protocol::Action::clearHistogram: + clearHistogram(true); + break; case Protocol::Action::adcThresholdUp: case Protocol::Action::adcThresholdDown: case Protocol::Action::queryServerInformation: @@ -251,7 +254,7 @@ void ClientGui::fillEventsIntoHistogram(const QString& adcchannels) _rootcanvas.getCanvas()->Update(); } -void ClientGui::clearHistogram() +void Fp311Online::ClientGui::clearHistogram(const bool fromServer) { sendSimpleActiontoServer(Protocol::Action::clearHistogram); for (int i = 0; i < ExperimentState::NumberOfAdcChannels - 1; i++) @@ -260,7 +263,8 @@ void ClientGui::clearHistogram() _rootcanvas.getCanvas()->Modified(); _rootcanvas.getCanvas()->Update(); - sendSimpleActiontoServer(Protocol::Action::clearHistogram); + if (!fromServer) + sendSimpleActiontoServer(Protocol::Action::clearHistogram); } void ClientGui::showEvent(QShowEvent* event) diff --git a/src/clientgui.h b/src/clientgui.h index 5f8b370..411b64d 100644 --- a/src/clientgui.h +++ b/src/clientgui.h @@ -85,7 +85,7 @@ private: void displayExperimentState(); void fillEventsIntoHistogram(const QString& adcchannels); - void clearHistogram(); + void clearHistogram(const bool fromServer = false); void showEvent(QShowEvent* event) override; -- GitLab