GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4ConnectServer.cpp
Go to the documentation of this file.
1// $Id$
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, &QPushButton::clicked, this, &TGo4ConnectServer::close);
24 QObject::connect(ConnectBtn, &QPushButton::clicked, this, &TGo4ConnectServer::accept);
25 QObject::connect(DefaultPassCheck, &QCheckBox::toggled, this, &TGo4ConnectServer::DefaultPassCheck_toggled);
26 QObject::connect(ModeCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &TGo4ConnectServer::SelectAccount_changed);
27 QObject::connect(ConnectionCombo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &TGo4ConnectServer::SelectConnection_changed);
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
42void 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();
56 go4sett->setClientDefaultPass(def);
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}
TGo4QSettings * go4sett
void setPassword(const char *pass)
virtual void SelectAccount_changed(int index)
virtual void DefaultPassCheck_toggled(bool on)
virtual void SelectConnection_changed(int index)
TGo4ConnectServer(QWidget *parent=nullptr)