23 #include <QFileDialog>
24 #include <QPushButton>
25 #include <QMessageBox>
26 #include <QGridLayout>
37 setWindowTitle(tr(
"Convert Data File..."));
39 all =
new QGridLayout(
this);
41 QGroupBox *Group2 =
new QGroupBox(tr(
"File specification"),
this);
43 QGridLayout *file =
new QGridLayout();
44 file->addWidget(
new QLabel(tr(
"Input File:")),0, 0);
47 QPushButton *BrowseButt =
new QPushButton(tr(
"Browse"));
48 file->addWidget(BrowseButt, 0, 2);
49 connect(BrowseButt, SIGNAL(clicked()), SLOT(
slotBrowse()));
50 file->addWidget(
new QLabel(tr(
"Output File:")), 1, 0);
60 OutType->addItem(tr(
"Qucs dataset"));
61 OutType->addItem(tr(
"Touchstone"));
63 OutType->addItem(tr(
"Qucs library"));
64 OutType->addItem(tr(
"Qucs netlist"));
69 Group2->setLayout(file);
70 all->addWidget(Group2, 0,0,1,1);
72 QGroupBox *Group1 =
new QGroupBox(tr(
"Messages"));
74 QVBoxLayout *vMess =
new QVBoxLayout();
77 MsgText->setTextFormat(Qt::PlainText);
79 MsgText->setWordWrapMode(QTextOption::NoWrap);
80 MsgText->setMinimumSize(250, 60);
81 Group1->setLayout(vMess);
82 all->addWidget(Group1, 1,0,1,1);
84 QHBoxLayout *Butts =
new QHBoxLayout();
94 connect(
CancelButt, SIGNAL(clicked()), SLOT(reject()));
99 all->addLayout(Butts,2,0,1,1);
111 QString s = QFileDialog::getOpenFileName(
114 " (*.s?p *.csv *.citi *.cit *.asc *.mdl *.vcd *.dat *.cir);;"+
115 tr(
"Touchstone files")+
" (*.s?p);;"+
116 tr(
"CSV files")+
" (*.csv);;"+
117 tr(
"CITI files")+
" (*.citi *.cit);;"+
118 tr(
"ZVR ASCII files")+
" (*.asc);;"+
119 tr(
"IC-CAP model files")+
" (*.mdl);;"+
120 tr(
"VCD files")+
" (*.vcd);;"+
121 tr(
"Qucs dataset files")+
" (*.dat);;"+
122 tr(
"SPICE files")+
" (*.cir);;"+
123 tr(
"Any file")+
" (*)",
124 this, 0, tr(
"Enter a Data File Name"));
132 switch(
OutType->currentItem()) {
171 if(QMessageBox::information(
this, tr(
"Info"),
172 tr(
"Output file already exists!")+
"\n"+tr(
"Overwrite it?"),
173 tr(
"&Yes"), tr(
"&No"), 0,1,1))
181 QString Suffix = Info.extension();
183 QStringList CommandLine;
187 executableSuffix =
".exe";
191 CommandLine <<
"-if";
193 if((Suffix ==
"citi") || (Suffix ==
"cit"))
194 CommandLine <<
"citi";
195 else if(Suffix ==
"vcd")
196 CommandLine <<
"vcd";
197 else if(Suffix ==
"asc")
198 CommandLine <<
"zvr";
199 else if(Suffix ==
"mdl")
200 CommandLine <<
"mdl";
201 else if(Suffix ==
"csv")
202 CommandLine <<
"csv";
203 else if(Suffix ==
"dat")
204 CommandLine <<
"qucsdata";
205 else if(Suffix ==
"cir")
206 CommandLine <<
"spice";
208 if(Suffix.at(0) ==
's')
209 if(Suffix.at(2) ==
'p')
210 if(Suffix.length() == 3)
211 if(Suffix.at(1).isDigit()) {
212 CommandLine <<
"touchstone";
216 MsgText->append(tr(
"ERROR: Unknown file format! Please check file name extension!"));
220 CommandLine <<
"-of";
221 switch(
OutType->currentItem()) {
223 CommandLine <<
"qucsdata";
226 CommandLine <<
"touchstone";
231 CommandLine <<
"csv";
236 CommandLine <<
"qucslib";
239 CommandLine <<
"qucs";
242 CommandLine <<
"matlab";
245 CommandLine <<
"qucsdata";
259 MsgText->append(tr(
"Running command line:")+
"\n");
260 MsgText->append(Program + CommandLine.join(
" "));
263 qDebug() <<
"Command:" << Program << CommandLine.join(
" ");
264 Process.start(Program, CommandLine);
267 MsgText->append(tr(
"ERROR: Cannot start converter!"));
323 MsgText->append(tr(
"Successfully converted file!"));
325 disconnect(
CancelButt, SIGNAL(clicked()), 0, 0);
326 connect(
CancelButt, SIGNAL(clicked()), SLOT(accept()));
329 MsgText->append(tr(
"Converter ended with errors!"));
tQucsSettings QucsSettings
Definitions and declarations for the main application.
void slotProcessEnded(int status)