28 #include <sys/types.h>
31 #include <QtCore/QDir>
35 #if QT_VERSION >= 0x050000
36 # include <QtWidgets/QBoxLayout>
37 # include <QtWidgets/QCheckBox>
38 # include <QtWidgets/QFrame>
39 # include <QtWidgets/QGroupBox>
40 # include <QtWidgets/QGridLayout>
41 # include <QtWidgets/QLabel>
42 # include <QtWidgets/QLineEdit>
43 # include <QtWidgets/QMessageBox>
44 # include <QtWidgets/QPushButton>
45 # include <QtWidgets/QVBoxLayout>
47 # include <QtGui/QBoxLayout>
48 # include <QtGui/QCheckBox>
49 # include <QtGui/QFrame>
50 # include <QtGui/QGroupBox>
51 # include <QtGui/QGridLayout>
52 # include <QtGui/QLabel>
53 # include <QtGui/QLineEdit>
54 # include <QtGui/QMessageBox>
55 # include <QtGui/QPushButton>
56 # include <QtGui/QVBoxLayout>
59 #include <QtGui/QPixmap>
101 setWizardStyle(ModernStyle);
104 setPixmap(QWizard::LogoPixmap, QPixmap(
":/images/NVI_logo.png"));
105 setPixmap(QWizard::WatermarkPixmap, QPixmap(
":/images/pattern_1.png"));
107 setWindowTitle(tr(
"Startup Wizard"));
127 w->setTitle(
"<p><font size=+1 face=\"Times\">Welcome to νSolve</font></p>");
130 str =
"The Startup Wizard will ask you few questions about software configuration.";
132 w->setSubTitle(
"<font face=\"Times\"><p>Thank you for installing νSolve version " +
135 w->setSubTitle(
"<font face=\"Times\"><p>Congratulation! You just have upgraded SgLib and νSolve "
137 ".</p><p>" + str +
"</p></font>");
139 w->setSubTitle(
"<font face=\"Times\"><p>We are appreciate your loyalty to Startup Wizard. "
140 "We can run it as many times as you want. Currently, you are using SgLib version " +
145 w->setButtonText(QWizard::NextButton,
"Agree");
147 QVBoxLayout *layout =
new QVBoxLayout;
148 w->setLayout(layout);
153 "<p>νSolve is software for VLBI data processing. "
155 "<p>Copyright (C) 2010-2020 Sergei Bolotin.</p>"
157 "<p>This program is free software: you can redistribute it and/or modify "
158 "it under the terms of the GNU General Public License as published by "
159 "the Free Software Foundation, either version 3 of the License, or "
160 "(at your option) any later version.</p>"
162 "<p>This program is distributed in the hope that it will be useful, "
163 "but WITHOUT ANY WARRANTY; without even the implied warranty of "
164 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
165 "GNU General Public License for more details.</p>"
167 "<p>You should have received a copy of the GNU General Public License "
168 "along with this program. If not, see http://www.gnu.org/licenses.</p>"
170 "<p>Please, read carefully the license agreement and if you agree, press \"Agree\" button.</p>"
173 QLabel *label=
new QLabel(
"<font face=\"Times\">" + str +
"</font>");
174 label->setWordWrap(
true);
175 layout->addWidget(label);
176 layout->addStretch(1);
178 QCheckBox *cb=
new QCheckBox(
"I have read and accept the conditions.", w);
180 layout->addWidget(cb);
181 layout->addSpacing(40);
192 QString userName(
""), userLoginName(
""), userEMail(
""), userInitials(
"");
193 QString hostName(
""), domainName(
"");
205 struct passwd *pw=getpwuid(uid);
207 perror(
"getpwuid: ");
211 userLoginName = pw->pw_name;
212 userName = pw->pw_gecos;
213 if (userName.contains(
","))
214 userName = userName.left(userName.indexOf(
","));
217 if (gethostname(buff,
sizeof(buff))==-1)
219 perror(
"gethostname: ");
220 userEMail = userName +
"@localhost";
228 if (!hostName.contains(
"."))
231 if (getdomainname(buff,
sizeof(buff))==-1)
232 perror(
"getdomainname: ");
236 if (!domainName.contains(
"(none)") && domainName.simplified().size()>0)
237 hostName +=
"." + domainName;
240 userEMail = userLoginName +
"@" + hostName;
242 if (userName.contains(
" "))
244 userInitials = userName.mid(0, 1) + userName.mid(userName.indexOf(
" ") + 1, 1);
246 else if (userName.size()>=2)
247 userInitials = userName.left(2);
259 w->setTitle(
"<p><font size=+1 face=\"Times\">User identities</font></p>");
260 w->setSubTitle(
"<font face=\"Times\"><p>Please, specify your name and e-mail address.</p></font>");
261 w->setPixmap(QWizard::WatermarkPixmap, QPixmap(
":/images/pattern_2.png"));
265 QVBoxLayout *layout=
new QVBoxLayout;
266 w->setLayout(layout);
270 "<h3>User Identities</h3>"
271 "<p>Describe yourself, your name, e-mail, etc.</p>"
272 "<p>[Plus something else, more polite...]</p>"
274 label =
new QLabel(
"<font face=\"Times\">" + str +
"</font>");
275 label->setWordWrap(
true);
276 layout->addWidget(label);
277 layout->addSpacing(20);
279 QGroupBox *gBox=
new QGroupBox(
"User Identities", w);
280 QGridLayout *gridLayout=
new QGridLayout(gBox);
282 label =
new QLabel(
"User Name:", gBox);
283 label->setMinimumSize(label->sizeHint());
287 gridLayout->addWidget(label, 0, 0);
290 label =
new QLabel(
"E-mail address:", gBox);
291 label->setMinimumSize(label->sizeHint());
295 gridLayout->addWidget(label, 1, 0);
298 label =
new QLabel(
"User's default initials:", gBox);
299 label->setMinimumSize(label->sizeHint());
303 gridLayout->addWidget(label, 2, 0);
306 layout->addWidget(gBox);
317 QString acFullName, acAbbrevName, acAbbName;
319 bool have2ForceUser(
false);
330 have2ForceUser =
true;
333 w->setTitle(
"<p><font size=+1 face=\"Times\">Analysis Center identities</font></p>");
334 w->setSubTitle(
"<font face=\"Times\"><p>Please, describe organization where you work.</p></font>");
335 w->setPixmap(QWizard::WatermarkPixmap, QPixmap(
":/images/pattern_6.png"));
339 QVBoxLayout *layout=
new QVBoxLayout;
340 w->setLayout(layout);
344 "<h3>Analysis Center</h3>"
345 "<p>Please, specify the analysis center.</p>"
346 "<p>[Plus something else, more polite...]</p>"
348 label =
new QLabel(
"<font face=\"Times\">" + str +
"</font>");
349 label->setWordWrap(
true);
350 layout->addWidget(label);
351 layout->addSpacing(20);
353 QGroupBox *gBox=
new QGroupBox(
"Analysis Center", w);
354 QGridLayout *gridLayout=
new QGridLayout(gBox);
356 label =
new QLabel(
"Full Name:", gBox);
357 label->setMinimumSize(label->sizeHint());
363 gridLayout->addWidget(label, 0, 0);
366 label =
new QLabel(
"Abbreviation:", gBox);
367 label->setMinimumSize(label->sizeHint());
371 gridLayout->addWidget(label, 1, 0);
374 label =
new QLabel(
"Abbrev.:", gBox);
375 label->setMinimumSize(label->sizeHint());
379 gridLayout->addWidget(label, 2, 0);
389 layout->addWidget(gBox);
401 bool have2ForceUser(
false);
405 QVBoxLayout *layout=
new QVBoxLayout;
407 QGridLayout *gridLayout;
408 w->setLayout(layout);
410 w->setTitle(
"<p><font size=+1 face=\"Times\">Essential directories of νSolve</font></p>");
411 w->setSubTitle(
"<font face=\"Times\"><p>The working directory of the software.</p></font>");
412 w->setPixmap(QWizard::WatermarkPixmap, QPixmap(
":/images/pattern_5.png"));
416 "<h3>Default Directories</h3>"
417 "<p>Please, provide paths to data on your system.</p>"
418 "<p>Users will be able to overwrite default settings.</p>"
422 "<h3>νSolve Home Directory</h3>"
423 "<p>Please, specify the software's home directory.</p>"
424 "<p>All paths that are not absolute will be counted form this directory. The software home "
425 "directory have to be writable for a user and should be different from user's home directory.</p>"
428 label =
new QLabel(
"<font face=\"Times\">" + str +
"</font>");
429 label->setWordWrap(
true);
430 layout->addWidget(label);
431 layout->addSpacing(20);
439 if (path2Home == QDir::homePath())
440 have2ForceUser =
true;
442 gBox =
new QGroupBox(
"Directories", w);
443 gridLayout =
new QGridLayout(gBox);
445 label =
new QLabel(
"Path to the software home directory:", gBox);
446 label->setMinimumSize(label->sizeHint());
450 gridLayout->addWidget(label, 0, 0);
453 label =
new QLabel(
"Path to logs for each session:", gBox);
454 label->setMinimumSize(label->sizeHint());
458 gridLayout->addWidget(label, 1, 0);
461 cbMakeAuxLog_ =
new QCheckBox(
"Save a log file for each session (command line mode only)", gBox);
466 layout->addWidget(gBox);
473 gBox =
new QGroupBox(
"Essential paths", w);
474 gridLayout =
new QGridLayout(gBox);
476 label =
new QLabel(
"Executables of Catalog<->nuSolve Interface:", gBox);
477 label->setMinimumSize(label->sizeHint());
481 gridLayout->addWidget(label, 0, 0);
484 label =
new QLabel(
"Observations (DBH) files:", gBox);
485 label->setMinimumSize(label->sizeHint());
489 gridLayout->addWidget(label, 1, 0);
492 label =
new QLabel(
"Observations (vgosDb) files:", gBox);
493 label->setMinimumSize(label->sizeHint());
497 gridLayout->addWidget(label, 2, 0);
500 label =
new QLabel(
"Observations (vgosDa) files:", gBox);
501 label->setMinimumSize(label->sizeHint());
505 gridLayout->addWidget(label, 3, 0);
508 label =
new QLabel(
"A priori files:", gBox);
509 label->setMinimumSize(label->sizeHint());
513 gridLayout->addWidget(label, 4, 0);
516 label =
new QLabel(
"Masterfiles:", gBox);
517 label->setMinimumSize(label->sizeHint());
521 gridLayout->addWidget(label, 5, 0);
524 layout->addWidget(gBox);
526 gBox =
new QGroupBox(
"Miscellaneous output", w);
527 gridLayout =
new QGridLayout(gBox);
529 label =
new QLabel(
"Spoolfile output:", gBox);
530 label->setMinimumSize(label->sizeHint());
534 gridLayout->addWidget(label, 0, 0);
537 label =
new QLabel(
"List of not used observations output:", gBox);
538 label->setMinimumSize(label->sizeHint());
542 gridLayout->addWidget(label, 1, 0);
545 label =
new QLabel(
"Reports output:", gBox);
546 label->setMinimumSize(label->sizeHint());
550 gridLayout->addWidget(label, 2, 0);
553 label =
new QLabel(
"Save observations in NGS format:", gBox);
554 label->setMinimumSize(label->sizeHint());
558 gridLayout->addWidget(label, 3, 0);
561 label =
new QLabel(
"Plotter output (PS, PDF or ASCII files):", gBox);
562 label->setMinimumSize(label->sizeHint());
566 gridLayout->addWidget(label, 4, 0);
569 label =
new QLabel(
"State and intermediate results:", gBox);
570 label->setMinimumSize(label->sizeHint());
574 gridLayout->addWidget(label, 5, 0);
577 label =
new QLabel(
"Path to the auxiliary logs:", gBox);
578 label->setMinimumSize(label->sizeHint());
582 gridLayout->addWidget(label, 6, 0);
585 layout->addWidget(gBox);
598 w->setTitle(
"<p><font size=+1 face=\"Times\">Ready to run</font></p>");
599 w->setSubTitle(
"<font face=\"Times\"><p>We are done.</p></font>");
600 w->setPixmap(QWizard::WatermarkPixmap, QPixmap(
":/images/pattern_3.png"));
602 QVBoxLayout *layout =
new QVBoxLayout;
603 w->setLayout(layout);
607 "<h3>νSolve is ready to run</h3>"
608 "<p>Have a happy νSolving!</p>"
610 QLabel *label =
new QLabel(
"<font face=\"Times\">" + str +
"</font>");
611 label->setWordWrap(
true);
612 layout->addWidget(label);
657 QMessageBox::warning(
this,
"Warning",
"Cannot create Home directory " +
SgVersion nuSolveVersion("nuSolve", 0, 8, 2, "Dark Hollow Falls (rc2)", SgMJD(2023, 4, 3, 10, 59))
SgVersion libraryVersion("SgLib", 0, 8, 2, "Compton Peak (rc2)", SgMJD(2023, 4, 3, 10, 59))
void setPath2APrioriFiles(const QString &)
const QString & getPath2AuxLogs() const
void setPath2NgsOutput(const QString &)
void setPath2DbhFiles(const QString &)
const QString & getPath2ReportOutput() const
const QString & getPath2CatNuInterfaceExec() const
void setPath2SpoolFileOutput(const QString &)
const QString & getPath2MasterFiles() const
void setPath2VgosDaFiles(const QString &path)
bool getHave2SavePerSessionLog() const
const QString & getPath2SpoolFileOutput() const
void setPath2IntermediateResults(const QString &)
void setHave2SavePerSessionLog(bool)
const QString & getPath2Home() const
void setPath2CatNuInterfaceExec(const QString &)
void setPath2Home(const QString &)
void setPath2ReportOutput(const QString &)
SgIdentities & identities()
void setPath2NotUsedObsFileOutput(const QString &)
const QString & getPath2APrioriFiles() const
const QString & getPath2VgosDaFiles() const
const QString & getPath2DbhFiles() const
void setPath2PlotterOutput(const QString &)
const QString & getPath2PlotterOutput() const
void setPath2VgosDbFiles(const QString &)
const QString & getPath2VgosDbFiles() const
void setPath2MasterFiles(const QString &)
const QString & getPath2NgsOutput() const
void setPath2AuxLogs(const QString &)
const QString & getPath2NotUsedObsFileOutput() const
const QString & getPath2IntermediateResults() const
NsWizardPage * createConclusionPage()
QLineEdit * lePath2VgosDa_
QLineEdit * lePath2CatNu_
QLineEdit * lePath2Spoolfiles_
NsStartupWizard(bool isFirstRun, bool isForcedRun, bool isSystemWideRun, QWidget *parent=0)
QLineEdit * leAcFullName_
QLineEdit * leAcAbbrevName_
virtual ~NsStartupWizard()
QLineEdit * lePath2Reports_
static const int serialNumber_
QLineEdit * lePath2IntermediateResults_
QLineEdit * lePath2Apriori_
QLineEdit * lePath2VgosDb_
QCheckBox * cbMakeAuxLog_
NsWizardPage * createPageHomeDir()
QLineEdit * lePath2NotUsedObs_
static int serialNumber()
QLineEdit * lePath2NgsOutput_
QLineEdit * leUserInitials_
QString className() const
NsWizardPage * createPageTwo()
NsWizardPage * createIntroPage()
QLineEdit * lePath2Masterfiles_
QLineEdit * lePath2PlotterOutput_
QLineEdit * leHomeDirName_
NsWizardPage * createPageOne()
QLineEdit * leAuxLogsDirName_
void registerField(const QString &name, QWidget *widget, const char *property=0, const char *changedSignal=0)
const QString & getAcAbbrevName() const
const QString & getAcAbbName() const
void setAcAbbrevName(const QString &)
void setAcFullName(const QString &)
const QString & getUserEmailAddress() const
void setAcAbbName(const QString &)
const QString & getUserDefaultInitials() const
const QString & getAcFullName() const
void setUserDefaultInitials(const QString &)
void setUserEmailAddress(const QString &)
void setUserName(const QString &)
const QString & getUserName() const
virtual void write(LogLevel, quint32, const QString &, bool=false)
const QString & getSoftwareName() const
const QString & getCodeName() const