General Purpose Geodetic Library
VmStartupWizard.cpp
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of vgosDbMake. vgosDbMake is a part of CALC/SOLVE
4  * system and is designed to convert correlator output data into VgosDb format.
5  * Copyright (C) 2015-2020 Sergei Bolotin.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #include "vgosDbMake.h"
23 #include "VmStartupWizard.h"
24 
25 #include <iostream>
26 #include <stdlib.h>
27 #include <unistd.h>
28 #include <sys/types.h>
29 #include <pwd.h>
30 
31 #include <QtCore/QDir>
32 #include <QtCore/QSettings>
33 
34 #if QT_VERSION >= 0x050000
35 # include <QtWidgets/QBoxLayout>
36 # include <QtWidgets/QButtonGroup>
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/QRadioButton>
46 # include <QtWidgets/QSpinBox>
47 # include <QtWidgets/QVBoxLayout>
48 #else
49 # include <QtGui/QBoxLayout>
50 # include <QtGui/QButtonGroup>
51 # include <QtGui/QCheckBox>
52 # include <QtGui/QFrame>
53 # include <QtGui/QGroupBox>
54 # include <QtGui/QGridLayout>
55 # include <QtGui/QLabel>
56 # include <QtGui/QLineEdit>
57 # include <QtGui/QMessageBox>
58 # include <QtGui/QPushButton>
59 # include <QtGui/QRadioButton>
60 # include <QtGui/QSpinBox>
61 # include <QtGui/QVBoxLayout>
62 #endif
63 
64 #include <QtGui/QPixmap>
65 
66 
67 
68 
69 #include <SgLogger.h>
70 
71 
72 
73 
74 //
75 const int VmStartupWizard::serialNumber_ = 20150527; // 2015/05/27
76 
77 
78 /*=======================================================================================================
79 *
80 * METHODS:
81 *
82 *======================================================================================================*/
84 {
86 };
87 
88 
89 
90 //
91 VmStartupWizard::VmStartupWizard(bool isFirstRun, bool isForcedRun, bool isSystemWideRun,
92  QSettings *settings, QWidget *parent)
93  : QWizard(parent)
94 {
95  isFirstRun_ = isFirstRun;
96  isForcedRun_ = isForcedRun;
97  isSystemWideRun_ = isSystemWideRun;
98  settings_ = settings;
99  addPage(createIntroPage());
100  addPage(createPageHomeDir());
101  if (!isSystemWideRun_)
102  addPage(createPageOne());
103  addPage(createPageTwo());
104  addPage(createPageThree());
105  addPage(createConclusionPage());
106 
107  setWizardStyle(ModernStyle);
108 
109  setPixmap(QWizard::LogoPixmap, QPixmap(":/images/NVI_logo.png"));
110  setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/pattern_1.png"));
111 
112 
113  setWindowTitle(vgosDbMakeVersion.getSoftwareName() + " Startup Wizard" +
114  QString(isSystemWideRun?" (system-wide settings)":""));
115 };
116 
117 
118 
119 //
121 {
122 };
123 
124 
125 
126 //
128 {
129  VmWizardPage *w=new VmWizardPage();
130  QString str;
131 
132  // title:
133  // w->setTitle("<p><font size=+1 face=\"Times\">Wellcome to <b>&nu;Solve</b>!</font></p>");
134  w->setTitle("<p><font size=+1 face=\"Times\">Welcome to vgosDbMake</font></p>");
135 
136  // subTitle:
137  str = "The Startup Wizard will ask you few questions about software configuration.";
138  if (isFirstRun_)
139  w->setSubTitle("<font face=\"Times\"><p>Thank you for installing vgosDbMake version " +
140  vgosDbMakeVersion.toString() + ".</p><p>" + str + "</p></font>");
141  else if (!isForcedRun_)
142  w->setSubTitle( "<font face=\"Times\"><p>Congratulation! You just have upgraded SgLib and "
143  "vgosDbMake software to the versions " + libraryVersion.toString() + " and " +
144  vgosDbMakeVersion.toString() + ".</p><p>" + str + "</p></font>");
145  else
146  w->setSubTitle( "<font face=\"Times\"><p>Startup Wizard welcomes you. "
147  "You are using SgLib version " +
149  ") and vgosDbMake version " + vgosDbMakeVersion.toString() + " (" +
150  vgosDbMakeVersion.getCodeName() + ").</p><p>" + str + "</p></font>");
151 
152  w->setButtonText(QWizard::NextButton, "Agree");
153 
154  QVBoxLayout *layout = new QVBoxLayout;
155  w->setLayout(layout);
156 
157  // first label:
158  str =
159  "<h3>vgosDbMake</h3>"
160  "<p>vgosDbMake is software that converts VLBI data in vgosDb format."
161 
162  "<p>Copyright (C) 2015-2020 Sergei Bolotin.</p>"
163 
164  "<p>This program is free software: you can redistribute it and/or modify "
165  "it under the terms of the GNU General Public License as published by "
166  "the Free Software Foundation, either version 3 of the License, or "
167  "(at your option) any later version.</p>"
168 
169  "<p>This program is distributed in the hope that it will be useful, "
170  "but WITHOUT ANY WARRANTY; without even the implied warranty of "
171  "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
172  "GNU General Public License for more details.</p>"
173 
174  "<p>You should have received a copy of the GNU General Public License "
175  "along with this program. If not, see http://www.gnu.org/licenses.</p>"
176 
177  "<p>Please, read carefully the license agreement and if you agree, press \"Agree\" button.</p>"
178  ""
179  "";
180  QLabel *label=new QLabel("<font face=\"Times\">" + str + "</font>");
181  label->setWordWrap(true);
182  layout->addWidget(label);
183  layout->addStretch(1);
184 
185  QCheckBox *cb=new QCheckBox("I have read and accept the conditions.", w);
186  w->registerField("warrantyAccepted*", cb);
187  layout->addWidget(cb);
188  layout->addSpacing(40);
189 
190  return w;
191 };
192 
193 
194 
195 //
197 {
198  VmWizardPage *w=new VmWizardPage();
199  QString path2Home;
200  bool have2ForceUser(false);
201 
202  QString str;
203  QLabel *label;
204  QVBoxLayout *layout=new QVBoxLayout;
205  QGroupBox *gBox;
206  QGridLayout *gridLayout;
207  w->setLayout(layout);
208 
209 
210  w->setTitle("<p><font size=+1 face=\"Times\">Essential directories of vgosDbMake</font></p>");
211  w->setSubTitle("<font face=\"Times\"><p>The working directory of the software.</p></font>");
212  w->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/pattern_2.png"));
213 
214  if (isSystemWideRun_)
215  str =
216  "<h3>Default Directories</h3>"
217  "<p>Please, provide paths to data on your system.</p>"
218  "<p>Users will be able to overwrite default settings.</p>"
219  "";
220  else
221  str =
222  "<h3>vgosDbMake Home Directory</h3>"
223  "<p>Please, specify the software's home directory.</p>"
224  "<p>All paths that are not absolute will be counted form this directory. The software home "
225  "directory have to be writable for a user and should be different from user's home directory.</p>"
226  "";
227  label = new QLabel("<font face=\"Times\">" + str + "</font>");
228  label->setWordWrap(true);
229  layout->addWidget(label);
230  layout->addSpacing(20);
231 
232  if (!isSystemWideRun_)
233  {
234  path2Home = setup.getPath2Home();
235  if (isFirstRun_ || setup.getPath2Home()=="")
236  path2Home = QDir::homePath() + "/" + vgosDbMakeVersion.getSoftwareName();
237  if (path2Home == QDir::homePath()) // cannot be user's home
238  have2ForceUser = true;
239 
240  gBox = new QGroupBox("vgosDbMake home directory", w);
241  gridLayout = new QGridLayout(gBox);
242  label = new QLabel("Path to the software home directory:", gBox);
243  label->setMinimumSize(label->sizeHint());
244  leHomeDirName_ = new QLineEdit(gBox);
245  leHomeDirName_->setText(path2Home);
246  leHomeDirName_->setMinimumSize(leHomeDirName_->sizeHint());
247  gridLayout->addWidget(label, 0, 0);
248  gridLayout->addWidget(leHomeDirName_, 0, 1);
249 
250  if (have2ForceUser)
251  w->registerField("path2Home*", leHomeDirName_);
252  layout->addWidget(gBox);
253  layout->addSpacing(20);
254  };
255 
256  gBox = new QGroupBox("Essential directories", w);
257  gridLayout = new QGridLayout(gBox);
258 
259  label = new QLabel("Path to mark{3,4} files (input):", gBox);
260  label->setMinimumSize(label->sizeHint());
261  leInputDirName_ = new QLineEdit(gBox);
262  leInputDirName_->setText(setup.getPath2InputFiles());
263  leInputDirName_->setMinimumSize(leInputDirName_->sizeHint());
264  gridLayout->addWidget(label, 0, 0);
265  gridLayout->addWidget(leInputDirName_, 0, 1);
266 
267  label = new QLabel("Path to vgosDb files (output):", gBox);
268  label->setMinimumSize(label->sizeHint());
269  leVgosDbDirName_ = new QLineEdit(gBox);
271  leVgosDbDirName_->setMinimumSize(leVgosDbDirName_->sizeHint());
272  gridLayout->addWidget(label, 1, 0);
273  gridLayout->addWidget(leVgosDbDirName_, 1, 1);
274 
275  label = new QLabel("Path to Master files:", gBox);
276  label->setMinimumSize(label->sizeHint());
277  leMasterFilesDirName_ = new QLineEdit(gBox);
279  leMasterFilesDirName_->setMinimumSize(leMasterFilesDirName_->sizeHint());
280  gridLayout->addWidget(label, 2, 0);
281  gridLayout->addWidget(leMasterFilesDirName_, 2, 1);
282 
283  layout->addWidget(gBox);
284 
285 
286  // general options:
287  gBox = new QGroupBox("General options", w);
288  QVBoxLayout *aLayout=new QVBoxLayout(gBox);
289  cbUseLocalLocale_ = new QCheckBox("Do not alternate locale set up", gBox);
290  cbUseLocalLocale_->setMinimumSize(cbUseLocalLocale_->sizeHint());
291  cbUseLocalLocale_->setChecked(setup.getUseLocalLocale());
292  aLayout -> addWidget(cbUseLocalLocale_);
293 
294 
295  layout->addWidget(gBox);
296 
297  return w;
298 };
299 
300 
301 
302 //
304 {
305  VmWizardPage *w=new VmWizardPage();
306  QString userName(""), userLoginName(""), userEMail(""), userInitials("");
307  QString hostName(""), domainName("");
308  bool isDUN(false);
309  SgIdentities ids;
310  if (!isFirstRun_ &&
313  isDUN = true;
314 
315  if (isFirstRun_ || isDUN)
316  {
317  // guess user login name:
318  uid_t uid=geteuid();
319  struct passwd *pw=getpwuid(uid);
320  if (!pw)
321  perror("getpwuid: ");
322  else
323  {
324  char buff[256];
325  userLoginName = pw->pw_name;
326  userName = pw->pw_gecos;
327  if (userName.contains(","))
328  userName = userName.left(userName.indexOf(","));
329 
330  // guess host name:
331  if (gethostname(buff, sizeof(buff))==-1)
332  {
333  perror("gethostname: ");
334  userEMail = userName + "@localhost";
335  }
336  else
337  {
338  hostName = buff;
339  // If hostname contains at least one dot, assume this is F.Q.D.N. host name
340  // and do not ask about the domain name:
341  //
342  if (!hostName.contains("."))
343  {
344  // guess domain name:
345  if (getdomainname(buff, sizeof(buff))==-1)
346  perror("getdomainname: ");
347  else
348  {
349  domainName = buff;
350  if (!domainName.contains("(none)") && domainName.simplified().size()>0)
351  hostName += "." + domainName;
352  };
353  };
354  userEMail = userLoginName + "@" + hostName;
355  };
356  if (userName.contains(" "))
357  {
358  userInitials = userName.mid(0, 1) + userName.mid(userName.indexOf(" ") + 1, 1);
359  }
360  else if (userName.size()>=2)
361  userInitials = userName.left(2);
362  else
363  userInitials = "??";
364  };
365  }
366  else
367  {
368  userName = setup.identities().getUserName();
369  userEMail = setup.identities().getUserEmailAddress();
370  userInitials = setup.identities().getUserDefaultInitials();
371  };
372 
373  w->setTitle("<p><font size=+1 face=\"Times\">User identities</font></p>");
374  w->setSubTitle("<font face=\"Times\"><p>Please, specify your name and e-mail address.</p></font>");
375  w->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/pattern_3.png"));
376 
377  QString str;
378  QLabel *label;
379  QVBoxLayout *layout=new QVBoxLayout;
380  w->setLayout(layout);
381  // layout->addStretch(1);
382 
383  str =
384  "<h3>User Identities</h3>"
385  "<p>Describe yourself, your name, e-mail, etc.</p>"
386  "<p>[Plus something else, more polite...]</p>"
387  "";
388  label = new QLabel("<font face=\"Times\">" + str + "</font>");
389  label->setWordWrap(true);
390  layout->addWidget(label);
391  layout->addSpacing(20);
392 
393  QGroupBox *gBox=new QGroupBox("User Identities", w);
394  QGridLayout *gridLayout=new QGridLayout(gBox);
395 
396  label = new QLabel("User Name:", gBox);
397  label->setMinimumSize(label->sizeHint());
398  leUserName_ = new QLineEdit(gBox);
399  leUserName_->setText(userName);
400  leUserName_->setMinimumSize(leUserName_->sizeHint());
401  gridLayout->addWidget(label, 0, 0);
402  gridLayout->addWidget(leUserName_, 0, 1);
403  //
404  label = new QLabel("E-mail address:", gBox);
405  label->setMinimumSize(label->sizeHint());
406  leUserEmail_ = new QLineEdit(gBox);
407  leUserEmail_->setText(userEMail);
408  leUserEmail_->setMinimumSize(leUserEmail_->sizeHint());
409  gridLayout->addWidget(label, 1, 0);
410  gridLayout->addWidget(leUserEmail_, 1, 1);
411  //
412  label = new QLabel("User's default initials:", gBox);
413  label->setMinimumSize(label->sizeHint());
414  leUserInitials_ = new QLineEdit(gBox);
415  leUserInitials_->setText(userInitials);
416  leUserInitials_->setMinimumSize(leUserInitials_->sizeHint());
417  gridLayout->addWidget(label, 2, 0);
418  gridLayout->addWidget(leUserInitials_, 2, 1);
419 
420  layout->addWidget(gBox);
421  return w;
422 };
423 
424 
425 
426 //
428 {
429  VmWizardPage *w=new VmWizardPage();
430  QString acFullName, acAbbrevName, acAbbName;
431  SgIdentities ids;
432  bool have2ForceUser(false);
433 
434  acFullName = setup.identities().getAcFullName();
435  acAbbrevName = setup.identities().getAcAbbrevName();
436  acAbbName = setup.identities().getAcAbbName();
437 
439  {
440  acFullName = "";
441  acAbbrevName = "";
442  acAbbName = "";
443  have2ForceUser = true;
444  };
445 
446  w->setTitle("<p><font size=+1 face=\"Times\">Analysis Center identities</font></p>");
447  w->setSubTitle("<font face=\"Times\"><p>Please, describe organization where you work.</p></font>");
448  w->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/pattern_4.png"));
449 
450  QString str;
451  QLabel *label;
452  QVBoxLayout *layout=new QVBoxLayout;
453  w->setLayout(layout);
454  // layout->addStretch(1);
455 
456  str =
457  "<h3>Analysis Center</h3>"
458  "<p>Please, specify the analysis center.</p>"
459  "<p>[Plus something else, more polite...]</p>"
460  "";
461  label = new QLabel("<font face=\"Times\">" + str + "</font>");
462  label->setWordWrap(true);
463  layout->addWidget(label);
464  layout->addSpacing(20);
465 
466  QGroupBox *gBox=new QGroupBox("Analysis Center", w);
467  QGridLayout *gridLayout=new QGridLayout(gBox);
468  // int l;
469  label = new QLabel("Full Name:", gBox);
470  label->setMinimumSize(label->sizeHint());
471  leAcFullName_ = new QLineEdit(gBox);
472  leAcFullName_->setText(acFullName);
473  leAcFullName_->setMinimumSize(leAcFullName_->sizeHint());
474  // AC names could be long:
475  // leAcFullName_->setMinimumWidth(leAcFullName_->fontMetrics().width(acFullName) + 20);
476  gridLayout->addWidget(label, 0, 0);
477  gridLayout->addWidget(leAcFullName_, 0, 1);
478  //
479  label = new QLabel("Abbreviation:", gBox);
480  label->setMinimumSize(label->sizeHint());
481  leAcAbbrevName_ = new QLineEdit(gBox);
482  leAcAbbrevName_->setText(acAbbrevName);
483  leAcAbbrevName_->setMinimumSize(leAcAbbrevName_->sizeHint());
484  gridLayout->addWidget(label, 1, 0);
485  gridLayout->addWidget(leAcAbbrevName_, 1, 1);
486  //
487  label = new QLabel("Abbrev.:", gBox);
488  label->setMinimumSize(label->sizeHint());
489  leAcAbbName_ = new QLineEdit(gBox);
490  leAcAbbName_->setText(acAbbName);
491  leAcAbbName_->setMinimumSize(leAcAbbName_->sizeHint());
492  gridLayout->addWidget(label, 2, 0);
493  gridLayout->addWidget(leAcAbbName_, 2, 1);
494 
495  if (have2ForceUser)
496  {
497  w->registerField("acFullName*", leAcFullName_);
498  w->registerField("acAbbrevName*", leAcAbbrevName_);
499 // w->registerField("acAbbName*", leAcAbbName_);
500  };
501 
502  layout->addWidget(gBox);
503  return w;
504 };
505 
506 
507 
508 //
510 {
511  VmWizardPage *w=new VmWizardPage();
512  const QString logLevelNames[4] = {"Error", "Warning", "Info", "Debug"};
513  int logLevel(settings_->value("Logger/LogLevel", 2).toInt());
514 
515  w->setTitle("<p><font size=+1 face=\"Times\">Logger </font></p>");
516  w->setSubTitle("<font face=\"Times\"><p>Set up configuration of the logging subsystem.</p></font>");
517  w->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/pattern_5.png"));
518 
519  QString str;
520  QLabel *label;
521  QVBoxLayout *layout=new QVBoxLayout;
522  w->setLayout(layout);
523 
524  str =
525  "<h3>Logger</h3>"
526  "<p>Change parameters of the logging subsystem.</p>"
527  "";
528  label = new QLabel("<font face=\"Times\">" + str + "</font>");
529  label->setWordWrap(true);
530  layout->addWidget(label);
531  layout->addSpacing(20);
532 
533 
534  QGroupBox *gBox;
535  QGridLayout *gridLayout;
536 
537  gBox = new QGroupBox("Main log options", w);
538  gridLayout = new QGridLayout(gBox);
539 
540  eLogFileName_ = new QLineEdit(gBox);
541  eLogFileName_->setText(logger->getFileName());
542  label = new QLabel("Log file name:", gBox);
543  label->setMinimumSize(label->sizeHint());
544  eLogFileName_->setMinimumSize(eLogFileName_->sizeHint());
545 
546  gridLayout->addWidget(label, 0, 0);
547  gridLayout->addWidget(eLogFileName_, 0, 1);
548 
549  sLogCapacity_ = new QSpinBox(gBox);
550  sLogCapacity_ -> setSuffix(" lines");
551  label = new QLabel("Log capacity:", gBox);
552  label->setMinimumSize(label->sizeHint());
553  sLogCapacity_->setMinimumSize(sLogCapacity_->sizeHint());
554  sLogCapacity_->setMaximum(100000);
555  sLogCapacity_->setMinimum(100);
556  sLogCapacity_->setSingleStep(100);
557  sLogCapacity_->setValue(logger->getCapacity());
558  gridLayout->addWidget(label, 1, 0);
559  gridLayout->addWidget(sLogCapacity_, 1, 1);
560 
561  gridLayout->setColumnStretch( 2, 1);
562 
563  cbLogStoreInFile_ = new QCheckBox("Save log to the file", gBox);
564  cbLogTimeLabel_ = new QCheckBox("Put time stamps", gBox);
565  cbLogStoreInFile_->setMinimumSize(cbLogStoreInFile_->sizeHint());
566  cbLogTimeLabel_->setMinimumSize(cbLogTimeLabel_->sizeHint());
567  cbLogStoreInFile_->setChecked(logger->getIsStoreInFile());
568  cbLogTimeLabel_->setChecked(logger->getIsNeedTimeMark());
569  gridLayout->addWidget(cbLogStoreInFile_, 0, 3);
570  gridLayout->addWidget(cbLogTimeLabel_ , 1, 3);
571 
572  gridLayout->activate();
573  layout->addWidget(gBox);
574 
575 
576  gBox = new QGroupBox("Main log level", w);
577  bgLogLevels_ = new QButtonGroup(gBox);
578  QVBoxLayout *aLayout=new QVBoxLayout(gBox);
579  QRadioButton *rbLogLevel[4];
580  for (int i=0; i<4; i++)
581  {
582  rbLogLevel[i] = new QRadioButton(logLevelNames[i], gBox);
583  rbLogLevel[i]-> setMinimumSize(rbLogLevel[i]->sizeHint());
584  bgLogLevels_->addButton(rbLogLevel[i], i);
585  aLayout->addWidget(rbLogLevel[i]);
586  };
587  rbLogLevel[logLevel]->setChecked(true);
588  layout->addWidget(gBox);
589 
590  // ----
591  //
592  gBox = new QGroupBox("Aux log options", w);
593  gridLayout = new QGridLayout(gBox);
594 
595  leAuxLogsDirName_ = new QLineEdit(gBox);
597  label = new QLabel("Path to logs for each session:", gBox);
598  label->setMinimumSize(label->sizeHint());
599  leAuxLogsDirName_->setMinimumSize(leAuxLogsDirName_->sizeHint());
600  gridLayout->addWidget(label, 0, 0);
601  gridLayout->addWidget(leAuxLogsDirName_, 0, 1);
602 
603  cbMakeAuxLog_ = new QCheckBox("Save log file for each session", gBox);
604  cbMakeAuxLog_->setMinimumSize(cbMakeAuxLog_->sizeHint());
606  gridLayout->addWidget(cbMakeAuxLog_, 1, 0, 1, 2);
607 
608  gridLayout->activate();
609  layout->addWidget(gBox);
610 
611  return w;
612 };
613 
614 
615 
616 //
618 {
619  VmWizardPage *w=new VmWizardPage();
620  QString str;
621 
622  w->setTitle("<p><font size=+1 face=\"Times\">Ready to run</font></p>");
623  w->setSubTitle("<font face=\"Times\"><p>We are done.</p></font>");
624  w->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/pattern_6.png"));
625 
626  QVBoxLayout *layout = new QVBoxLayout;
627  w->setLayout(layout);
628 
629  // first label:
630  str =
631  "<h3>vgosDbMake is ready to run</h3>"
632  "<p>Good luck.</p>"
633  "";
634  QLabel *label = new QLabel("<font face=\"Times\">" + str + "</font>");
635  label->setWordWrap(true);
636  layout->addWidget(label);
637 
638  return w;
639 };
640 
641 
642 
643 //
645 {
646  if (!isSystemWideRun_)
647  {
652  };
657  setup.setPath2InputFiles(leInputDirName_->text());
659 
662  setup.setUseLocalLocale(cbUseLocalLocale_->isChecked());
663 
664  //
665  logger->setFileName(eLogFileName_->text());
666  logger->setCapacity(sLogCapacity_->value());
669 
670  int logLevel=bgLogLevels_->checkedId();
671  if (logLevel != -1)
672  {
673  settings_->setValue("Logger/LogLevel", logLevel);
674  logger->setLogFacility(SgLogger::ERR, logLevel>=0?0xFFFFFFFF:0);
675  logger->setLogFacility(SgLogger::WRN, logLevel>=1?0xFFFFFFFF:0);
676  logger->setLogFacility(SgLogger::INF, logLevel>=2?0xFFFFFFFF:0);
677  logger->setLogFacility(SgLogger::DBG, logLevel==3?0xFFFFFFFF:0);
678  };
679  //
680  // check home dir:
681  if (!isSystemWideRun_)
682  {
683  QDir dir;
684  if (!dir.exists(setup.getPath2Home()))
685  {
686  if (!dir.mkpath(setup.getPath2Home()))
687  QMessageBox::warning(this, "Warning", "Cannot create Home directory " +
688  setup.getPath2Home());
689  else
691  ": the directory " + setup.getPath2Home() + " has been created");
692  };
693  };
694  //
695  QWizard::accept();
696 };
697 /*=====================================================================================================*/
SgLogger * logger
Definition: SgLogger.cpp:231
SgVersion libraryVersion("SgLib", 0, 7, 5, "Tuscarora (rc1)", SgMJD(2022, 2, 18, 17, 34))
const QString & getPath2AuxLogs() const
Definition: NsSetup.h:510
const QString & getPath2MasterFiles() const
Definition: NsSetup.h:446
bool getHave2SavePerSessionLog() const
Definition: NsSetup.h:518
void setHave2SavePerSessionLog(bool)
Definition: NsSetup.h:816
const QString & getPath2Home() const
Definition: NsSetup.h:406
void setPath2Home(const QString &)
Definition: NsSetup.h:704
SgIdentities & identities()
Definition: NsSetup.h:566
void setPath2VgosDbFiles(const QString &)
Definition: NsSetup.h:728
const QString & getPath2VgosDbFiles() const
Definition: NsSetup.h:430
void setPath2MasterFiles(const QString &)
Definition: NsSetup.h:744
void setPath2AuxLogs(const QString &)
Definition: NsSetup.h:808
const QString & getAcAbbrevName() const
Definition: SgIdentities.h:247
const QString & getAcAbbName() const
Definition: SgIdentities.h:255
void setAcAbbrevName(const QString &)
Definition: SgIdentities.h:367
void setAcFullName(const QString &)
Definition: SgIdentities.h:359
const QString & getUserEmailAddress() const
Definition: SgIdentities.h:223
void setAcAbbName(const QString &)
Definition: SgIdentities.h:375
const QString & getUserDefaultInitials() const
Definition: SgIdentities.h:231
const QString & getAcFullName() const
Definition: SgIdentities.h:239
void setUserDefaultInitials(const QString &)
Definition: SgIdentities.h:351
void setUserEmailAddress(const QString &)
Definition: SgIdentities.h:343
void setUserName(const QString &)
Definition: SgIdentities.h:335
const QString & getUserName() const
Definition: SgIdentities.h:215
virtual void write(LogLevel, quint32, const QString &, bool=false)
Definition: SgLogger.cpp:88
bool getIsStoreInFile() const
Definition: SgLogger.h:137
void setIsStoreInFile(bool isStoreInFile)
Definition: SgLogger.h:127
void setLogFacility(LogLevel lvl, quint32 f)
Definition: SgLogger.h:131
void setFileName(const QString &fileName)
Definition: SgLogger.h:125
void setIsNeedTimeMark(bool isNeedTimeMark)
Definition: SgLogger.h:129
void setCapacity(int capacity)
Definition: SgLogger.h:126
bool getIsNeedTimeMark() const
Definition: SgLogger.h:139
const QString & getFileName() const
Definition: SgLogger.h:135
int getCapacity() const
Definition: SgLogger.h:136
const QString & getSoftwareName() const
Definition: SgVersion.h:254
const QString & getCodeName() const
Definition: SgVersion.h:286
QString toString() const
Definition: SgVersion.h:356
QLineEdit * eLogFileName_
QLineEdit * leInputDirName_
QCheckBox * cbLogStoreInFile_
QLineEdit * leVgosDbDirName_
virtual ~VmStartupWizard()
VmWizardPage * createIntroPage()
VmWizardPage * createPageOne()
QLineEdit * leAcAbbrevName_
VmWizardPage * createPageHomeDir()
QButtonGroup * bgLogLevels_
QCheckBox * cbLogTimeLabel_
QLineEdit * leAcFullName_
VmWizardPage * createPageThree()
QLineEdit * leHomeDirName_
QString className() const
VmWizardPage * createPageTwo()
QCheckBox * cbMakeAuxLog_
QLineEdit * leUserEmail_
QLineEdit * leUserInitials_
QLineEdit * leAcAbbName_
VmStartupWizard(bool isFirstRun, bool isForcedRun, bool isSystemWideRun, QSettings *settings, QWidget *parent=0)
static int serialNumber()
QLineEdit * leMasterFilesDirName_
QCheckBox * cbUseLocalLocale_
QLineEdit * leUserName_
QLineEdit * leAuxLogsDirName_
QSettings * settings_
QSpinBox * sLogCapacity_
static const int serialNumber_
VmWizardPage * createConclusionPage()
void registerField(const QString &name, QWidget *widget, const char *property=0, const char *changedSignal=0)
NsSetup setup
Definition: nuSolve.cpp:61
SgVersion vgosDbMakeVersion