bug fix, remove trailling space for influx inputs

This commit is contained in:
Ryan Tang 2024-08-26 15:25:19 -04:00
parent dbfb9f96bf
commit a32a1e0e71
2 changed files with 19 additions and 5 deletions

View File

@ -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());
}
}

View File

@ -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);
}
}