2022-10-14 18:27:31 -04:00
|
|
|
#include <TApplication.h>
|
|
|
|
#include <TGClient.h>
|
|
|
|
#include <TCanvas.h>
|
|
|
|
#include <TF1.h>
|
|
|
|
#include <TRandom.h>
|
|
|
|
#include <TRootEmbeddedCanvas.h>
|
|
|
|
#include <TGTableContainer.h>
|
|
|
|
#include <TGFileDialog.h>
|
|
|
|
|
|
|
|
#include "programSetting.h"
|
|
|
|
|
|
|
|
std::string ProgramSetting::IP = "http://fsunuc.physics.fsu.edu/influx/";
|
|
|
|
std::string ProgramSetting::databaseName = "testing";
|
2022-10-18 17:23:29 -04:00
|
|
|
std::string ProgramSetting::DataSavingPath = "/home/catrina/FSUDAQ/";
|
2022-10-14 18:27:31 -04:00
|
|
|
|
|
|
|
ProgramSetting::ProgramSetting(const TGWindow *p){
|
|
|
|
fMain = new TGMainFrame(p, 600, 400);
|
|
|
|
fMain->SetWindowName("Program Setting");
|
|
|
|
fMain->Connect("CloseWindow()", "ProgramSetting", this, "CloseWindow()");
|
|
|
|
|
|
|
|
TGVerticalFrame * vframe = new TGVerticalFrame(fMain); fMain->AddFrame(vframe);
|
|
|
|
|
|
|
|
{///============== Database
|
2022-10-18 17:23:29 -04:00
|
|
|
TGGroupFrame * gfDatabase = new TGGroupFrame(vframe, "Database Setting", kHorizontalFrame); vframe->AddFrame(gfDatabase, new TGLayoutHints(kLHintsExpandY | kLHintsExpandX , 5, 5, 5, 5));
|
2022-10-14 18:27:31 -04:00
|
|
|
|
|
|
|
TGVerticalFrame * vfDB = new TGVerticalFrame(gfDatabase); gfDatabase->AddFrame(vfDB);
|
|
|
|
|
|
|
|
TGHorizontalFrame * hfDB1 = new TGHorizontalFrame(vfDB); vfDB->AddFrame(hfDB1);
|
|
|
|
TGLabel * lbIP = new TGLabel(hfDB1, "IP :"); hfDB1->AddFrame(lbIP, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
|
|
|
txtIP = new TGTextEntry(hfDB1, IP.c_str()); hfDB1->AddFrame(txtIP, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
|
|
|
txtIP->Resize(300, 20);
|
|
|
|
txtIP->Connect("ReturnPressed()", "ProgramSetting", this, "SetDataBase()");
|
|
|
|
|
|
|
|
TGHorizontalFrame * hfDB2 = new TGHorizontalFrame(vfDB); vfDB->AddFrame(hfDB2);
|
|
|
|
TGLabel * lbDBName = new TGLabel(hfDB2, "DB Name :"); hfDB2->AddFrame(lbDBName, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
|
|
|
txtDBName = new TGTextEntry(hfDB2, databaseName.c_str()); hfDB2->AddFrame(txtDBName, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
|
|
|
txtDBName->Connect("ReturnPressed()", "ProgramSetting", this, "SetDataBase()");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-10-18 17:23:29 -04:00
|
|
|
{///============== Data Saving Path
|
|
|
|
TGGroupFrame * gfData = new TGGroupFrame(vframe, "Data Storage", kHorizontalFrame); vframe->AddFrame(gfData, new TGLayoutHints(kLHintsExpandY | kLHintsExpandY , 5, 5, 5, 5));
|
|
|
|
|
|
|
|
TGVerticalFrame * vfData = new TGVerticalFrame(gfData); gfData->AddFrame(vfData);
|
|
|
|
|
|
|
|
TGHorizontalFrame * hfData = new TGHorizontalFrame(vfData); vfData->AddFrame(hfData);
|
|
|
|
TGLabel * lbDataPath = new TGLabel(hfData, "Data Absolute Path :"); hfData->AddFrame(lbDataPath, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
|
|
|
txtDataPath = new TGTextEntry(hfData, DataSavingPath.c_str()); hfData->AddFrame(txtDataPath, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 5,5,3,3));
|
|
|
|
txtDataPath->Connect("ReturnPressed()", "ProgramSetting", this, "SetDataPath()");
|
|
|
|
txtDataPath->Resize(300, 20);
|
|
|
|
}
|
|
|
|
|
2022-10-14 18:27:31 -04:00
|
|
|
{///============== Read Time event building
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
fMain->MapSubwindows();
|
|
|
|
fMain->Resize(fMain->GetDefaultSize());
|
|
|
|
fMain->MapWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
ProgramSetting::~ProgramSetting(){
|
|
|
|
|
|
|
|
delete txtIP;
|
|
|
|
delete txtDBName;
|
|
|
|
|
|
|
|
fMain->Cleanup();
|
|
|
|
delete fMain;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramSetting::SetDataBase(){
|
|
|
|
|
|
|
|
IP = txtIP->GetText();
|
|
|
|
databaseName = txtDBName->GetText();
|
|
|
|
|
|
|
|
printf("IP: %s\n", IP.c_str());
|
|
|
|
printf("Name: %s\n", databaseName.c_str());
|
|
|
|
|
|
|
|
}
|
2022-10-18 17:23:29 -04:00
|
|
|
|
|
|
|
void ProgramSetting::SetDataPath(){
|
|
|
|
|
|
|
|
DataSavingPath = txtDataPath->GetText();
|
|
|
|
|
|
|
|
printf("DataSavingPath : %s\n", DataSavingPath.c_str());
|
|
|
|
|
|
|
|
}
|