GSI Object Oriented Online Offline (Go4)  GO4-6.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4ConnectServer.cpp
Go to the documentation of this file.
1 // $Id: TGo4ConnectServer.cpp 3121 2021-03-30 07:56:48Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4ConnectServer.h"
15 #include "TGo4QSettings.h"
16 
18  : QDialog( parent )
19 {
20  setObjectName("Go4ConnectServer");
21  setupUi(this);
22 
23  QObject::connect(CloseBtn, SIGNAL(clicked()), this, SLOT(close()));
24  QObject::connect(ConnectBtn, SIGNAL(clicked()), this, SLOT(accept()));
25  QObject::connect(DefaultPassCheck, SIGNAL(toggled(bool)), this, SLOT(DefaultPassCheck_toggled(bool)));
26  QObject::connect(ModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(SelectAccount_changed(int)));
27  QObject::connect(ConnectionCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(SelectConnection_changed(int)));
28 
29  ClientNode->setText(go4sett->getClientNode());
30  PortNumber->setValue(go4sett->getClientPort());
31  ModeCombo->setCurrentIndex(go4sett->getClientControllerMode());
32 
33  ConnectionCombo->setCurrentIndex(go4sett->getClientConnectMode());
34  bool canHaveOtherAccounts=(go4sett->getClientConnectMode()!=0);
35  bool def = go4sett->getClientDefaultPass();
36  DefaultPassCheck->setChecked(def);
37  PasswordEdit->setEnabled(!def);
38  AccountEdit->setEnabled(canHaveOtherAccounts);
39  AccountEdit->setVisible(canHaveOtherAccounts);
40 }
41 
42 void TGo4ConnectServer::setPassword(const char* pass)
43 {
44  if (PasswordEdit->isEnabled())
45  PasswordEdit->setText(pass);
46 }
47 
49 {
50  go4sett->setClientNode(ClientNode->text());
51  go4sett->setClientPort(PortNumber->value());
52  go4sett->setClientControllerMode(ModeCombo->currentIndex());
53  go4sett->setClientConnectMode(ConnectionCombo->currentIndex());
54  go4sett->setClientAccountName(AccountEdit->text());
55  bool def = DefaultPassCheck->isChecked();
57  QString res;
58  if (!def) res = PasswordEdit->text();
59  return res;
60 }
61 
63 {
64  PasswordEdit->setEnabled(!on);
65 }
66 
68 {
69  switch(index) {
70  case 0:
71  default:
72  AccountEdit->setText("observer");
73  break;
74  case 1:
75  AccountEdit->setText("controller");
76  break;
77  case 2:
78  AccountEdit->setText("admin");
79  break;
80  case 3:
81  AccountEdit->setText(fLastAccount);
82  break;
83  };
84 
85  AccountEdit->setEnabled(index==3);
86 }
87 
89 {
90  AccountEdit->setEnabled(index==1);
91  AccountEdit->setVisible(index==1);
92 }
void setClientControllerMode(int)
virtual void SelectAccount_changed(int index)
void setClientAccountName(const QString &)
TGo4ConnectServer(QWidget *parent=0)
virtual void DefaultPassCheck_toggled(bool on)
int getClientControllerMode()
void setClientPort(int)
int getClientConnectMode()
TGo4QSettings * go4sett
bool getClientDefaultPass()
void setClientNode(const QString &)
void setClientConnectMode(int)
void setClientDefaultPass(bool)
virtual void SelectConnection_changed(int index)
QString getClientNode()
void setPassword(const char *pass)