18 #include <QFileDialog>
19 #include <QButtonGroup>
28 setObjectName(
"Go4StartClient");
33 rsh_selected->setEnabled(
false);
34 ssh_selected->setEnabled(
false);
37 xterm_selected->setEnabled(
false);
38 konsole_selected->setEnabled(
false);
40 LineEditClientNode->setEnabled(
false);
64 if (LineEditClientDir->text().isEmpty())
65 LineEditClientDir->setText(QDir::currentPath());
70 if (mode == 1) mode = 2;
72 QModelIndex index = ServerModeCombo->model()->index(1, 0);
76 ServerModeCombo->model()->setData(index, v, Qt::UserRole - 1);
78 qt_selected->setEnabled(mode!=1);
84 ServerModeCombo->setCurrentIndex(mode);
85 PortNumber->setEnabled(mode == 2);
114 QFileDialog fd(
this,
"Select your working directory");
115 fd.setFileMode(QFileDialog::DirectoryOnly);
116 #if QT_VERSION >= QT_VERSION_CHECK(4,6,0)
117 fd.setOption(QFileDialog::DontUseNativeDialog);
120 QString dir = LineEditClientDir->text();
121 if (dir.isEmpty() || !QDir(dir).exists())
122 dir = QDir::currentPath();
123 fd.setDirectory(dir);
125 if (fd.exec() != QDialog::Accepted )
return;
127 QStringList flst = fd.selectedFiles();
128 if (flst.isEmpty())
return;
130 LineEditClientDir->setText(flst[0]);
132 QString fileName = LineEditClientExec->text();
133 if (fileName.length()==0)
return;
135 QString exeDirPath = QFileInfo(fileName).path();
136 if (exeDirPath.isEmpty() || ((exeDirPath == QString(
".")) && (fileName[0]!=
'.'))) {
137 fileName = QFileInfo(QDir(flst[0]), fileName).filePath();
138 LineEditClientExec->setText(fileName);
145 const char* caption = 0;
148 QString exe1_filter(
"User analysis (MainUserAnalysis.exe)");
149 QString exe2_filter(
"Any executable (*.exe)");
150 QString dll1_filter(
"User library (libGo4UserAnalysis.dll)");
151 QString dll2_filter(
"Any shared library (*.dll)");
152 QString any_filter(
"Any files (*.*)");
154 QString exe1_filter(
"User analysis (MainUserAnalysis)");
155 QString exe2_filter(
"Any executable (*)");
156 QString dll1_filter(
"User library (libGo4UserAnalysis.so)");
157 QString dll2_filter(
"Any shared library (*.so)");
158 QString any_filter(
"Any files (*)");
162 filters << exe1_filter << exe2_filter << dll1_filter << dll2_filter << any_filter;
164 QFileDialog fd(
this, caption);
165 fd.setFileMode(QFileDialog::ExistingFile);
166 #if QT_VERSION >= QT_VERSION_CHECK(4,6,0)
167 fd.setOption(QFileDialog::DontUseNativeDialog);
170 fd.setNameFilters(filters);
173 select_filer= (ExeModeCombo->currentIndex()==0) ? 0 : 2;
174 switch (select_filer) {
175 case 0: fd.selectNameFilter(exe1_filter);
break;
176 case 1: fd.selectNameFilter(exe2_filter);
break;
177 case 2: fd.selectNameFilter(dll1_filter);
break;
178 case 3: fd.selectNameFilter(dll2_filter);
break;
179 default: fd.selectNameFilter(any_filter);
break;
182 QString filename = LineEditClientExec->text();
183 if (filename.length() > 0)
184 fd.selectFile(filename);
186 if (fd.exec() != QDialog::Accepted)
return;
188 QStringList flst = fd.selectedFiles();
189 if (flst.isEmpty())
return;
192 if (fd.selectedNameFilter()==exe1_filter) select_filer = 0;
else
193 if (fd.selectedNameFilter()==exe2_filter) select_filer = 1;
else
194 if (fd.selectedNameFilter()==dll1_filter) select_filer = 2;
else
195 if (fd.selectedNameFilter()==dll2_filter) select_filer = 3;
198 if ((select_filer==0) || (select_filer==1)) ExeModeCombo->setCurrentIndex(0);
else
199 if ((select_filer==2) || (select_filer==3)) ExeModeCombo->setCurrentIndex(1);
201 LineEditClientExec->setText(flst[0]);
207 bool windows =
false;
211 ServerModeCombo->setCurrentIndex(2);
217 ExeModeCombo->setEnabled(
id<2);
218 if (
id==2) ExeModeCombo->setCurrentIndex(1);
219 bool isserver = (
id>0);
220 qt_selected->setEnabled(
id!=1);
221 PortNumber->setEnabled(
id==2);
void setClientExeMode(int mode)
void setClientArgs(const QString &)
void setClientDir(const QString &)
virtual void ServerModeCombo_activated(int)
QString getClientExec(int mode=-1)
void setClientName(const QString &)
void setClientTermMode(int)
void setClientShellMode(int)
TGo4StartClient(QWidget *parent=0)
void setClientIsServer(int kind)
QButtonGroup * ClientTermGroup
virtual void ExeMode_changed(int)
void setClientExec(const QString &)
void setClientNode(const QString &)
QButtonGroup * ClientShellGroup
void setClientConnectMode(int)
virtual void SelectProg()