Public Member Functions | List of all members
dbutils::gui::DBParamsGroupBox Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-30/DatabaseUtils/cxx/include/GUI/DBParamsGroupBox.h"

Inheritance diagram for dbutils::gui::DBParamsGroupBox:

Public Member Functions

 DBParamsGroupBox (QWidget *parent=0)
 

Detailed Description

Class for providing a groupbox that displays the current database parameters.

Author
Kurt Biery
Version
Revision
1.1.28.1
Date
2019/09/27 00:07:04

Definition at line 18 of file DBParamsGroupBox.h.

Constructor & Destructor Documentation

dbutils::gui::DBParamsGroupBox::DBParamsGroupBox ( QWidget *  parent = 0)

Definition at line 10 of file DBParamsGroupBox.cpp.

References novadaq::EnvVarCache::getEnvVar(), novadaq::EnvVarCache::getInstance(), dbutils::gui::NameValueLabelPair::setValue(), and string.

10  :
11  QGroupBox(tr("Current Database Parameters"), parent)
12 {
13  QGridLayout* gridLayout = new QGridLayout;
14  NameValueLabelPair* nameValWidget;
15 
16  nameValWidget = new NameValueLabelPair("DB Host");
17  std::string dbHost =
19  nameValWidget->setValue(dbHost);
20  gridLayout->addWidget(nameValWidget, 0, 0);
21 
22 
23  QHBoxLayout* hboxLayout = new QHBoxLayout;
24  hboxLayout->setContentsMargins(0,0,0,0);
25 
26  nameValWidget = new NameValueLabelPair("DB Name");
27  std::string dbName =
29  nameValWidget->setValue(dbName);
30  hboxLayout->addWidget(nameValWidget);
31  hboxLayout->addSpacing(10);
32 
33  nameValWidget = new NameValueLabelPair("DB User");
34  std::string dbUser =
36  std::string cfgMgrDBUser =
37  novadaq::EnvVarCache::getInstance().getEnvVar("CFGMGR_DB_USER");
38  std::string simpleUser =
40  if (dbUser == "" && cfgMgrDBUser == "") {
41  nameValWidget->setValue(simpleUser.c_str());
42  }
43  else if (dbUser == cfgMgrDBUser) {
44  nameValWidget->setValue(dbUser.c_str());
45  }
46  else {
47  std::string tmpString = dbUser;
48  tmpString.append("/");
49  tmpString.append(cfgMgrDBUser);
50  nameValWidget->setValue(tmpString.c_str());
51  }
52  hboxLayout->addWidget(nameValWidget);
53  hboxLayout->addStretch();
54 
55  QWidget* tmpWidget = new QWidget();
56  tmpWidget->setLayout(hboxLayout);
57  gridLayout->addWidget(tmpWidget, 1, 0, Qt::AlignLeft);
58 
59  this->setLayout(gridLayout);
60 }
static EnvVarCache & getInstance()
Definition: EnvVarCache.cpp:12
std::string getEnvVar(std::string name)
Definition: EnvVarCache.cpp:33
enum BeamMode string

The documentation for this class was generated from the following files: