GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4OpenRemoteDialog.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 "TGo4OpenRemoteDialog.h"
15 #include "TGo4QSettings.h"
16 
18  : QDialog( parent )
19 {
20  setObjectName("Go4OpenRemoteDialog");
21  setupUi(this);
22  QObject::connect(TypeSelectorBox, QOverload<int>::of(&QComboBox::activated), this, &TGo4OpenRemoteDialog::TypeSelectorBox_activated);
23  QObject::connect(ServerEdit, &QLineEdit::textChanged, this, &TGo4OpenRemoteDialog::ServerEdit_textChanged);
24  QObject::connect(FileNameEdit, &QLineEdit::textChanged, this, &TGo4OpenRemoteDialog::FileNameEdit_textChanged);
25 
26  QString hostname, filename, protocol;
27  go4sett->getRemoteFileSett(hostname, filename, protocol);
28 
29  ServerEdit->setText(hostname);
30  fxServer = hostname;
31  FileNameEdit->setText(filename);
32  fxFile = filename;
33  fxType = protocol;
34  int indx = 3;
35  if(protocol.contains("root:"))
36  indx = 0;
37  else if (protocol.contains("rfio:"))
38  indx = 1;
39  else if (protocol.contains("http:"))
40  indx = 2;
41 
42  if (indx < 3) {
43  TypeSelectorBox->setCurrentIndex(indx);
45  } else {
46  TypeSelectorBox->setCurrentText(protocol);
47  }
48 }
49 
51 {
52  QString server = GetServer();
53  QString fname = GetFileName();
54  QString protocol = GetFileType();
55  if(protocol.contains("root:"))
56  protocol = "root:";
57  else if (protocol.contains("rfio:"))
58  protocol = "rfio:";
59  else if (protocol.contains("http:"))
60  protocol = "http:";
61  else
62  protocol = "local:";
63  go4sett->setRemoteFileSett(server, fname, protocol);
64 }
65 
67 {
68  QString tname = TypeSelectorBox->itemText(indx);
69  if(tname.contains("root:") || tname.contains("http:") || tname.contains("rfio:"))
70  ServerEdit->setEnabled(true);
71  else
72  ServerEdit->setEnabled(false);
73  fxType = tname;
74 }
75 
77 {
78  return fxFile;
79 }
80 
82 {
83  return fxType;
84 }
85 
86 
88 {
89  return fxServer;
90 }
91 
93 {
94  fxServer=txt;
95 }
96 
97 
99 {
100  fxFile=txt;
101 }
const QString & GetServer()
void getRemoteFileSett(QString &hostname, QString &filename, QString &protocol)
virtual void ServerEdit_textChanged(const QString &txt)
const QString & GetFileName()
virtual void TypeSelectorBox_activated(int indx)
TGo4OpenRemoteDialog(QWidget *parent=nullptr)
TGo4QSettings * go4sett
void setRemoteFileSett(const QString &hostname, const QString &filename, const QString &protocol)
virtual void FileNameEdit_textChanged(const QString &txt)
const QString & GetFileType()