#include #include #include #include #include #include #include #include #include "programSetting.h" std::string ProgramSetting::IP = "http://fsunuc.physics.fsu.edu/influx/"; std::string ProgramSetting::databaseName = "testing"; 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 TGGroupFrame * gfDatabase = new TGGroupFrame(vframe, "Database Setting", kHorizontalFrame); vframe->AddFrame(gfDatabase, new TGLayoutHints(kLHintsExpandY, 5, 5, 5, 5)); 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()"); } {///============== 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()); }