From a32a1e0e7134b448e55bcfa46671dbbf4703527d Mon Sep 17 00:00:00 2001 From: "Ryan@SOLARIS_testStation" Date: Mon, 26 Aug 2024 15:25:19 -0400 Subject: [PATCH] bug fix, remove trailling space for influx inputs --- analyzers/Analyser.cpp | 3 ++- analyzers/CoincidentAnalyzer.h | 21 +++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/analyzers/Analyser.cpp b/analyzers/Analyser.cpp index 6e3c781..2fcc2ae 100644 --- a/analyzers/Analyser.cpp +++ b/analyzers/Analyser.cpp @@ -102,6 +102,7 @@ void Analyzer::SetDatabase(QString IP, QString Name, QString Token){ bool foundDatabase = false; for( int i = 0; i < (int) databaseList.size(); i++){ if( databaseList[i] == dataBaseName.toStdString() ) foundDatabase = true; + // printf("%d | %s\n", i, databaseList[i].c_str()); } if( foundDatabase ){ influx->AddDataPoint("test value=1"); @@ -216,7 +217,7 @@ void Analyzer::SetDatabaseButton(){ // Show the dialog and get the result if (dialog.exec() == QDialog::Accepted) { - SetDatabase(ipLineEdit.text(), nameLineEdit.text(),tokenLineEdit.text()); + SetDatabase(ipLineEdit.text().trimmed(), nameLineEdit.text().trimmed(),tokenLineEdit.text().trimmed()); } } diff --git a/analyzers/CoincidentAnalyzer.h b/analyzers/CoincidentAnalyzer.h index a60ae52..b34db4c 100644 --- a/analyzers/CoincidentAnalyzer.h +++ b/analyzers/CoincidentAnalyzer.h @@ -44,6 +44,9 @@ private: bool allowSignalSlot; + QLineEdit * leInfluxIP; + QLineEdit * leDBName; + // declaie histograms Histogram2D * h2D; Histogram1D * h1; @@ -307,22 +310,28 @@ inline void CoincidentAnalyzer::SetUpCanvas(){ QLabel * lbIP = new QLabel("Database IP :", box); lbIP->setAlignment(Qt::AlignRight | Qt::AlignCenter); boxLayout->addWidget(lbIP, rowID, 0); - QLineEdit * leInfluxIP = new QLineEdit(box); + leInfluxIP = new QLineEdit(box); leInfluxIP->setReadOnly(true); boxLayout->addWidget(leInfluxIP, rowID, 1, 1, 3); QPushButton * bnInflux = new QPushButton("Set Influx", box); - boxLayout->addWidget(bnInflux, rowID, 1, 1, 3); + boxLayout->addWidget(bnInflux, rowID, 4); rowID ++; QLabel * lbDBName = new QLabel("Database name :", box); lbDBName->setAlignment(Qt::AlignRight | Qt::AlignCenter); boxLayout->addWidget(lbDBName, rowID, 0); - QLineEdit * leDBName= new QLineEdit(box); + leDBName = new QLineEdit(box); leDBName->setReadOnly(true); boxLayout->addWidget(leDBName, rowID, 1); - connect(bnInflux, &QPushButton::clicked, this, &Analyzer::SetDatabaseButton); + connect(bnInflux, &QPushButton::clicked, this, [=](){ + SetDatabaseButton(); + if( influx ) { + leDBName->setText(dataBaseName); + leInfluxIP->setText(dataBaseIP); + } + }); // rowID ++; // QFrame *separator3 = new QFrame(box); @@ -638,6 +647,10 @@ inline void CoincidentAnalyzer::LoadSettings(){ h2D->Rebin(x_bin, x_min, x_max, y_bin, y_min, y_max); SetDatabase(dataBaseIP, dataBaseName, dataBaseToken); + if( influx ){ + leDBName->setText(dataBaseName); + leInfluxIP->setText(dataBaseIP); + } }