GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4ConnectServer.cpp
Go to the documentation of this file.
1 // $Id: TGo4ConnectServer.cpp 1597 2015-06-19 16:28:25Z 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 für 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  ClientNode->setText(go4sett->getClientNode());
24  PortNumber->setValue(go4sett->getClientPort());
25  ModeCombo->setCurrentIndex(go4sett->getClientControllerMode());
26 
27  ConnectionCombo->setCurrentIndex(go4sett->getClientConnectMode());
28  bool canHaveOtherAccounts=(go4sett->getClientConnectMode()!=0);
29  bool def = go4sett->getClientDefaultPass();
30  DefaultPassCheck->setChecked(def);
31  PasswordEdit->setEnabled(!def);
32  AccountEdit->setEnabled(canHaveOtherAccounts);
33  AccountEdit->setVisible(canHaveOtherAccounts);
34 }
35 
36 void TGo4ConnectServer::setPassword(const char* pass)
37 {
38  if (PasswordEdit->isEnabled())
39  PasswordEdit->setText(pass);
40 }
41 
43 {
44  go4sett->setClientNode(ClientNode->text());
45  go4sett->setClientPort(PortNumber->value());
46  go4sett->setClientControllerMode(ModeCombo->currentIndex());
47  go4sett->setClientConnectMode(ConnectionCombo->currentIndex());
48  go4sett->setClientAccountName(AccountEdit->text());
49  bool def = DefaultPassCheck->isChecked();
51  QString res;
52  if (!def) res = PasswordEdit->text();
53  return res;
54 }
55 
56 
58 {
59  PasswordEdit->setEnabled(!on);
60 }
61 
63 {
64 
65  switch(index)
66  {
67  case 0:
68  default:
69  AccountEdit->setText("observer");
70  break;
71  case 1:
72  AccountEdit->setText("controller");
73  break;
74  case 2:
75  AccountEdit->setText("admin");
76  break;
77  case 3:
78  AccountEdit->setText(fLastAccount);
79  break;
80  };
81 
82  AccountEdit->setEnabled(index==3);
83 
84 }
85 
87 {
88  AccountEdit->setEnabled(index==1);
89  AccountEdit->setVisible(index==1);
90 
91 }
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)