From e8be06dd316483699b4e90c4bbe2e074f0e09dec Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 6 Apr 2018 23:52:55 +0200 Subject: [PATCH] fix: 'data plot' - plot window now hides when keypress Q --- client/proxguiqt.cpp | 5 +++-- client/proxguiqt.h | 4 ++++ client/ui.c | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/client/proxguiqt.cpp b/client/proxguiqt.cpp index 47cb7d637..56de71b24 100644 --- a/client/proxguiqt.cpp +++ b/client/proxguiqt.cpp @@ -557,6 +557,8 @@ Plot::Plot(QWidget *parent) : QWidget(parent), GraphStart(0), GraphPixelsPerPoin CursorBPos = 0; setWindowTitle(tr("Sliders")); + + master = parent; } void Plot::closeEvent(QCloseEvent *event) @@ -672,8 +674,7 @@ void Plot::keyPressEvent(QKeyEvent *event) break; case Qt::Key_Q: - //this->hide(); - this->close(); + master->hide(); break; default: diff --git a/client/proxguiqt.h b/client/proxguiqt.h index 91fd0e0d0..5cc41ba5d 100644 --- a/client/proxguiqt.h +++ b/client/proxguiqt.h @@ -22,12 +22,16 @@ #include #include "ui/ui_overlays.h" + +class ProxWidget; + /** * @brief The actual plot, black area were we paint the graph */ class Plot: public QWidget { private: + QWidget *master; int GraphStart; double GraphPixelsPerPoint; int CursorAPos; diff --git a/client/ui.c b/client/ui.c index f274f6bab..708e473d7 100644 --- a/client/ui.c +++ b/client/ui.c @@ -80,9 +80,9 @@ void PrintAndLogEx(logLevel_t level, char *fmt, ...) { vsnprintf(buffer, sizeof(buffer), fmt, args); va_end(args); - if(strchr(buffer, '\n')) { + if (strchr(buffer, '\n')) { - token = strtok(buffer,"\n"); + token = strtok(buffer, "\n"); while (token != NULL) { size = strlen(buffer2); @@ -159,9 +159,9 @@ void PrintAndLog(char *fmt, ...) { } va_end(argptr2); - if (g_flushAfterWrite == 1) { + if (g_flushAfterWrite == 1) fflush(NULL); - } + //release lock pthread_mutex_unlock(&print_lock); }