General Purpose Geodetic Library
NsMainWindow.cpp
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of nuSolve. nuSolve is a part of CALC/SOLVE system
4  * and is designed to perform data analyis of a geodetic VLBI session.
5  * Copyright (C) 2010-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 
23 #include "nuSolve.h"
24 #include "NsMainWindow.h"
25 
26 #include <iostream>
27 #include <stdlib.h>
28 
29 
30 #include <QtCore/QSettings>
31 
32 
33 #if QT_VERSION >= 0x050000
34 # include <QtWidgets/QAction>
35 # include <QtWidgets/QApplication>
36 # include <QtWidgets/QFileDialog>
37 # include <QtWidgets/QFontDialog>
38 # include <QtWidgets/QLabel>
39 # include <QtWidgets/QMenu>
40 # include <QtWidgets/QMenuBar>
41 # include <QtWidgets/QMessageBox>
42 # include <QtWidgets/QStyle>
43 # include <QtWidgets/QStyleFactory>
44 #else
45 # include <QtGui/QAction>
46 # include <QtGui/QApplication>
47 # include <QtGui/QFileDialog>
48 # include <QtGui/QFontDialog>
49 # include <QtGui/QLabel>
50 # include <QtGui/QMenu>
51 # include <QtGui/QMenuBar>
52 # include <QtGui/QMessageBox>
53 # include <QtGui/QStyle>
54 # include <QtGui/QStyleFactory>
55 #endif
56 
57 # include <QtGui/QFont>
58 
59 
60 #include <SgGuiLogger.h>
61 #include <SgGuiTaskConfig.h>
62 #include <SgMJD.h>
63 #include <SgVersion.h>
64 #include <SgVlbiStationInfo.h>
65 
66 
67 #include "NsSetupDialog.h"
68 #include "NsTestDialog.h"
69 #include "NsTestFour1Dialog.h"
70 #include "NsSessionNameDialog.h"
71 #include "NsSessionEditDialog.h"
72 
73 
74 
75 
77 
78 
79 /*=======================================================================================================
80 *
81 * METHODS:
82 *
83 *======================================================================================================*/
84 NsMainWindow::NsMainWindow(QWidget *parent, Qt::WindowFlags flags)
85  : QMainWindow(parent, flags)
86 {
87  QString windowTitle("");
88  styleKeys_ = QStyleFactory::keys();
89 
90  createActions();
91  createMenus();
93 
94 
95  logger = new SgGuiLogger(this, 800, true, "nuSolve.log");
96  // load logger's config:
97  QSettings settings;
98 
99  if (settings.contains("Version/LibraryName"))
100  {
102  settings.value("Logger/FacilityERR",
103  logger->getLogFacility(SgLogger::ERR)).toUInt());
105  settings.value("Logger/FacilityWRN",
106  logger->getLogFacility(SgLogger::WRN)).toUInt());
108  settings.value("Logger/FacilityINF",
109  logger->getLogFacility(SgLogger::INF)).toUInt());
111  settings.value("Logger/FacilityDBG",
112  logger->getLogFacility(SgLogger::DBG)).toUInt());
113  };
115  settings.value("Logger/FileName",
116  logger->getFileName()).toString());
119  settings.value("Logger/Capacity",
120  logger->getCapacity()).toInt());
122  settings.value("Logger/IsStoreInFile",
123  logger->getIsStoreInFile()).toBool());
125  settings.value("Logger/IsNeedTimeMark",
126  logger->getIsNeedTimeMark()).toBool());
128  settings.value("Logger/UseFullDate",
129  logger->getUseFullDateFormat()).toBool());
130 
131 
132  //
133  setCentralWidget((SgGuiLogger*)logger);
134  windowTitle = setup.identities().getUserName() + " (" + setup.identities().getAcFullName() +
135  ") running " + nuSolveVersion.getSoftwareName();
136  if (config.getName().size() > 0)
137  windowTitle += " with alt config=\"" + config.getName() + "\"";
138  setWindowTitle(windowTitle);
139 
140  setMinimumSize(200, 160);
142  resize( setup.getMainWinWidth()>0?setup.getMainWinWidth():1000,
144 
146  ": nuSolve's rising; today is " + SgMJD::currentMJD().toString(SgMJD::F_VerboseLong));
147 
149  ": software: " + libraryVersion.name() + " released on " +
152  ": software: " + nuSolveVersion.name() + " released on " +
155  ": Testing logger's facilities:");
157  ": This is a demo of error string");
159  ": Warnings should look like this");
161  ": Normal output");
163  ": ...and some debug output. End of demo.");
164 
165  statusBar_->showMessage("So say we all", 1200);
166 
167 //std::cout << " ++ "
168 //<< " " << qPrintable(rad2StrHms((30.0 + 15.0/60.0 + 57.0/3600.0)*DEG2RAD)) << "\n";
169 
170  /*
171  if (settings.contains("Setup/GuiStyle"))
172  {
173  QString appStyle(settings.value("Setup/GuiStyle").toString());
174  // if (!appStyle.contains("GTK")) // it crashes with "GTK+" style
175  QApplication::setStyle(appStyle);
176  };
177  */
178 };
179 
180 
181 
182 //
184 {
185  // save logger's config:
186  QSettings settings;
187  settings.setValue("Logger/FacilityERR", logger->getLogFacility(SgLogger::ERR));
188  settings.setValue("Logger/FacilityWRN", logger->getLogFacility(SgLogger::WRN));
189  settings.setValue("Logger/FacilityINF", logger->getLogFacility(SgLogger::INF));
190  settings.setValue("Logger/FacilityDBG", logger->getLogFacility(SgLogger::DBG));
191  settings.setValue("Logger/FileName", logger->getFileName());
192  settings.setValue("Logger/Capacity", logger->getCapacity());
193  settings.setValue("Logger/IsStoreInFile", logger->getIsStoreInFile());
194  settings.setValue("Logger/IsNeedTimeMark", logger->getIsNeedTimeMark());
195  settings.setValue("Logger/UseFullDate", logger->getUseFullDateFormat());
196 
197  setup.setMainWinWidth(width());
198  setup.setMainWinHeight(height());
199  setup.setMainWinPosX(x());
200  setup.setMainWinPosY(y());
201  //
202  logger->clearSpool();
203  logger->setIsStoreInFile(false);
204  //
205  if (changeStyleMenu_)
206  delete changeStyleMenu_;
207  //
208  if (logger)
209  delete logger;
210 };
211 
212 
213 
214 //
216 {
217  // File menu:
218  newFileAct_ = new QAction(tr("&New"), this);
219  newFileAct_->setShortcuts(QKeySequence::New);
220  newFileAct_->setStatusTip(tr("Create a new file"));
221  connect(newFileAct_, SIGNAL(triggered()), this, SLOT(newFile()));
222  newFileAct_->setEnabled(false);
223 
224  openFileAct_ = new QAction(tr("&Open"), this);
225  openFileAct_->setShortcuts(QKeySequence::Open);
226  openFileAct_->setStatusTip(tr("Open a file"));
227  connect(openFileAct_, SIGNAL(triggered()), this, SLOT(openFile()));
228  openFileAct_->setEnabled(false);
229 
230  saveFileAct_ = new QAction(tr("&Save"), this);
231  saveFileAct_->setShortcuts(QKeySequence::Save);
232  saveFileAct_->setStatusTip(tr("Save a file"));
233  connect(saveFileAct_, SIGNAL(triggered()), this, SLOT(saveFile()));
234  saveFileAct_->setEnabled(false);
235 
236  printFileAct_ = new QAction(tr("&Print"), this);
237  printFileAct_->setShortcuts(QKeySequence::Print);
238  printFileAct_->setStatusTip(tr("Print a file"));
239  connect(printFileAct_, SIGNAL(triggered()), this, SLOT(printFile()));
240  printFileAct_->setEnabled(false);
241 
242  closeFileAct_ = new QAction(tr("&Close"), this);
243  closeFileAct_->setShortcuts(QKeySequence::Close);
244  closeFileAct_->setStatusTip(tr("Close a file"));
245  connect(closeFileAct_, SIGNAL(triggered()), this, SLOT(closeFile()));
246  closeFileAct_->setEnabled(false);
247 
248  closeAllAct_ = new QAction(tr("Close &All"), this);
249  closeAllAct_->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::Key_A));
250  closeAllAct_->setStatusTip(tr("Close all files"));
251  connect(closeAllAct_, SIGNAL(triggered()), this, SLOT(closeAll()));
252  closeAllAct_->setEnabled(false);
253 
254  flushLogAct_ = new QAction(tr("Flush Log"), this);
255  flushLogAct_->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::Key_L));
256  flushLogAct_->setStatusTip(tr("Save all log records into a file"));
257  connect(flushLogAct_, SIGNAL(triggered()), this, SLOT(flushLog()));
258 
259  quitAct_ = new QAction(tr("&Quit"), this);
260  // quitAct_->setShortcuts(QKeySequence::Quit);
261  quitAct_->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::Key_Q));
262  quitAct_->setStatusTip(tr("Quit the application"));
263  connect(quitAct_, SIGNAL(triggered()), this, SLOT(quit()));
264 
265  // Edit menu:
266  editGenConfigAct_ = new QAction(tr("Edit &General Config"), this);
267  editGenConfigAct_->setStatusTip(tr("Start edit general config dialog"));
268  editGenConfigAct_->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::Key_G));
269  connect(editGenConfigAct_, SIGNAL(triggered()), this, SLOT(editGenConfig()));
270 
271  editSessionAct_ = new QAction(tr("&Edit Session (DBH)"), this);
272  editSessionAct_->setStatusTip(tr("Start edit session dialog (DBH)"));
273  editSessionAct_->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::Key_E));
274  connect(editSessionAct_, SIGNAL(triggered()), this, SLOT(editSession()));
275 
276  openWrapperFileAct_ = new QAction(tr("&Open Wrapper file (vgosDB)"), this);
277  openWrapperFileAct_->setStatusTip(tr("Start edit session dialog (vgosDB)"));
278  openWrapperFileAct_->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::Key_O));
279  connect(openWrapperFileAct_, SIGNAL(triggered()), this, SLOT(openWrapperFile()));
280 
281  openSessionAct_ = new QAction(tr("&Open Session (vgosDB)"), this);
282  openSessionAct_->setStatusTip(tr("Start edit session dialog (vgosDB)"));
283  openSessionAct_->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_O));
284  connect(openSessionAct_, SIGNAL(triggered()), this, SLOT(openSession()));
285 
286  openAgvAct_ = new QAction(tr("Open vgosDa file"), this);
287  openAgvAct_->setStatusTip(tr("Open vgosDa file"));
288  openAgvAct_->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_A));
289  connect(openAgvAct_, SIGNAL(triggered()), this, SLOT(openAgvFile()));
290 
291 
292  loadLnfSessionAct_ = new QAction(tr("Load last &non-finished session"), this);
293  loadLnfSessionAct_->setStatusTip(tr("Continue previous work"));
294  loadLnfSessionAct_->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::Key_N));
295  connect(loadLnfSessionAct_, SIGNAL(triggered()), this, SLOT(loadLnfSession()));
296  loadLnfSessionAct_->setEnabled(
298  setup.getLnfsFileName().size()>0 &&
300 
301  undoAct_ = new QAction(tr("&Undo"), this);
302  undoAct_->setShortcuts(QKeySequence::Undo);
303  undoAct_->setStatusTip(tr("Undo"));
304  connect(undoAct_, SIGNAL(triggered()), this, SLOT(undo()));
305  undoAct_->setEnabled(false);
306 
307  redoAct_ = new QAction(tr("&Redo"), this);
308  redoAct_->setShortcuts(QKeySequence::Redo);
309  redoAct_->setStatusTip(tr("Redo"));
310  connect(redoAct_, SIGNAL(triggered()), this, SLOT(redo()));
311  redoAct_->setEnabled(false);
312 
313  cutAct_ = new QAction(tr("&Cut"), this);
314  cutAct_->setShortcuts(QKeySequence::Cut);
315  cutAct_->setStatusTip(tr("Cut"));
316  connect(cutAct_, SIGNAL(triggered()), this, SLOT(cut()));
317  cutAct_->setEnabled(false);
318 
319  copyAct_ = new QAction(tr("&Copy"), this);
320  copyAct_->setShortcuts(QKeySequence::Copy);
321  copyAct_->setStatusTip(tr("Copy"));
322  connect(copyAct_, SIGNAL(triggered()), this, SLOT(copy()));
323  copyAct_->setEnabled(false);
324 
325  pasteAct_ = new QAction(tr("&Paste"), this);
326  pasteAct_->setShortcuts(QKeySequence::Paste);
327  pasteAct_->setStatusTip(tr("Paste"));
328  connect(pasteAct_, SIGNAL(triggered()), this, SLOT(paste()));
329  pasteAct_->setEnabled(false);
330 
331  preferencesAct_ = new QAction(tr("Preferences"), this);
332  // preferencesAct_->setShortcuts(QKeySequence::Preferences);
333  preferencesAct_->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::Key_R));
334  preferencesAct_->setStatusTip(tr("Preferences"));
335  connect(preferencesAct_, SIGNAL(triggered()), this, SLOT(preferences()));
336 
337  selectFontAct_ = new QAction(tr("Select &Font"), this);
338  selectFontAct_->setShortcuts(QList<QKeySequence>() << QKeySequence(Qt::CTRL + Qt::Key_F));
339  selectFontAct_->setStatusTip(tr("Fontifying"));
340  connect(selectFontAct_, SIGNAL(triggered()), this, SLOT(selectFont()));
341 
342  // Tools menu:
343  makeSomething1Act_ = new QAction(tr("&Make something useful #1"), this);
344  // makeSomething1Act_->setShortcuts(QKeySequence::);
345  makeSomething1Act_->setStatusTip(tr("Make something useful, theme #1"));
346  connect(makeSomething1Act_, SIGNAL(triggered()), this, SLOT(makeSomething1()));
347  makeSomething1Act_->setEnabled(false);
348 
349  testSomething1Act_ = new QAction(tr("&Test something testful #1"), this);
350  // testSomething1Act_->setShortcuts(QKeySequence::);
351  testSomething1Act_->setStatusTip(tr("Test something testful, theme #1"));
352  connect(testSomething1Act_, SIGNAL(triggered()), this, SLOT(testSomething1()));
353  testSomething1Act_->setEnabled(false);
354 
355 
356  // Test menu:
357  testPlotterAct_ = new QAction(tr("Test Plotter"), this);
358  testPlotterAct_->setStatusTip(tr("Run test for plotter dialog (temporary)"));
359  connect(testPlotterAct_, SIGNAL(triggered()), this, SLOT(testPlotter()));
360 
361  testFour1Act_ = new QAction(tr("Test Four1"), this);
362  testFour1Act_->setStatusTip(tr("Run test for four1 function dialog (temporary)"));
363  connect(testFour1Act_, SIGNAL(triggered()), this, SLOT(testFour1()));
364 
365  test1Act_ = new QAction(tr("Test #1"), this);
366  test1Act_->setStatusTip(tr("Run test #1"));
367  connect(test1Act_, SIGNAL(triggered()), this, SLOT(test1()));
368  test1Act_->setEnabled(false);
369 
370 
371 
372  // Help menu:
373  aboutAct_ = new QAction(tr("&About"), this);
374  // aboutAct->setShortcuts(QKeySequence::);
375  aboutAct_->setStatusTip(tr("About this application"));
376  connect(aboutAct_, SIGNAL(triggered()), this, SLOT(about()));
377 
378  aboutQtAct_ = new QAction(tr("&About Qt"), this);
379  // aboutQtAct_->setShortcuts(QKeySequence::);
380  aboutQtAct_->setStatusTip(tr("About Qt library"));
381  connect(aboutQtAct_, SIGNAL(triggered()), this, SLOT(aboutQt()));
382 };
383 
384 
385 
386 //
388 {
389  fileMenu_ = menuBar()->addMenu(tr("&File"));
390  fileMenu_->addAction(newFileAct_);
391  fileMenu_->addAction(openFileAct_);
392  fileMenu_->addAction(saveFileAct_);
393  fileMenu_->addAction(printFileAct_);
394  fileMenu_->addAction(closeFileAct_);
395  fileMenu_->addAction(closeAllAct_);
396  fileMenu_->addAction(flushLogAct_);
397  fileMenu_->addSeparator();
398  fileMenu_->addAction(quitAct_);
399 
400  editMenu_ = menuBar()->addMenu(tr("&Edit"));
401  editMenu_->addAction(editGenConfigAct_);
402  editMenu_->addAction(editSessionAct_);
403  editMenu_->addAction(openWrapperFileAct_);
404  editMenu_->addAction(openSessionAct_);
405  editMenu_->addAction(openAgvAct_);
406  editMenu_->addAction(loadLnfSessionAct_);
407  editMenu_->addAction(undoAct_);
408  editMenu_->addAction(redoAct_);
409  editMenu_->addAction(cutAct_);
410  editMenu_->addAction(copyAct_);
411  editMenu_->addAction(pasteAct_);
412  editMenu_->addAction(preferencesAct_);
413  editMenu_->addAction(selectFontAct_);
414 
415  changeStyleMenu_ = new QMenu(tr("Styles"));
416  for (int i=0; i<styleKeys_.count(); i++)
417  changeStyleMenu_->addAction(styleKeys_.at(i));
418  connect(changeStyleMenu_, SIGNAL(triggered(QAction*)), this, SLOT(switchToStyle(QAction*)));
419 
420  editMenu_->addMenu(changeStyleMenu_);
421 
422  toolsMenu_ = menuBar()->addMenu(tr("&Tools"));
423  toolsMenu_->addAction(makeSomething1Act_);
424 // toolsMenu_->addAction(testSomething1Act_);
425 
426  testMenu_ = menuBar()->addMenu(tr("Te&st"));
427  testMenu_->addAction(testPlotterAct_);
428  testMenu_->addAction(testFour1Act_);
429  testMenu_->addAction(test1Act_);
430 // testMenu_->addAction(test2Act_);
431 
432  helpMenu_ = menuBar()->addMenu(tr("&Help"));
433  helpMenu_->addAction(aboutAct_);
434  helpMenu_->addAction(aboutQtAct_);
435 };
436 
437 
438 
439 //
441 {
442  statusBar_ = statusBar();
443  lStats_ = new QLabel("X: WWWW/WWWW 88888.88(ps) 888.8", statusBar_);
444  lStats_->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
445  lStats_->setMinimumWidth(lStats_->sizeHint().width() + 30);
446  lStats_->setFrameStyle(QFrame::Panel | QFrame::Sunken);
447  lStats_->setLineWidth(2);
448  lStats_->setToolTip("Total and processed number of observation, delays WRMS, Chi2");
449  lStats_->setStatusTip("Total and processed number of observation, delays WRMS, Chi2");
450 
451 
452 //QLabel *label = new QLabel("<p><font size=+1 face=\"Times\"><b>&nu;Solve-" +
453  QString labelStr("<p><font face=\"Times\"><b>&nu;Solve-" +
454  nuSolveVersion.toString() + "</b>");
455  if (nuSolveVersion.getCodeName().length())
456  labelStr += " (" + nuSolveVersion.getCodeName() + ") ";
457  labelStr += "</font></p>";
458 
459  QLabel *label=new QLabel(labelStr, statusBar_);
460  label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
461  label->setMinimumWidth(label->sizeHint().width() + 30);
462  label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
463  label->setLineWidth(2);
464 
465  progressBar_ = new QProgressBar(statusBar_);
466  progressBar_->reset();
467 
468  statusBarMessager_ = new QLabel("", statusBar_);
469  statusBar_->addWidget(statusBarMessager_, 3);
470  statusBar_->addWidget(progressBar_, 1);
471  statusBar_->addPermanentWidget(lStats_);
472  statusBar_->addPermanentWidget(label);
473  showStats("", 0, 0, 0.0, 0.0);
474 };
475 
476 
477 
478 //
479 // === Functionality ===
480 //
481 // File menu:
483 {
485  ": New file menu selected");
486 };
487 
488 
489 
490 //
492 {
494  ": Open file menu selected");
495 };
496 
497 
498 
499 //
501 {
503  ": Save file menu selected");
504 };
505 
506 
507 
508 //
510 {
512  ": Print file menu selected");
513 };
514 
515 
516 
517 //
519 {
521  ": Close file menu selected");
522 };
523 
524 
525 
526 //
528 {
530  ": Close all files menu selected");
531 };
532 
533 
534 
535 //
537 {
539  ": Flush log menu selected");
540  logger->clearSpool();
541 };
542 
543 
544 
545 //
547 {
549  ": Quit menu selected");
550  close();
551 };
552 
553 
554 
555 // Edit menu:
557 {
558  (new SgGuiTaskConfigDialog(&config, &parametersDescriptor, NULL, this))->show();
559 };
560 
561 
562 
563 //
565 {
567  ": Edit Session menu selected");
568 
569  QString fileName("");
570  QString fileName2("");
572  {
574  nd = new NsSessionNameDialog(this, &fileName, &fileName2);
575  if (nd->exec() != QDialog::Accepted)
576  {
577  fileName = "";
578  fileName2 = "";
579  };
580  }
581  else
582  {
583  QString path2Databases(QDir::home().absolutePath() + "/DBH/");
584  if (!QDir(path2Databases).exists())
585  path2Databases = setup.getPath2DbhFiles();
586  fileName = QFileDialog::getOpenFileName(this, tr("Open a database"), path2Databases, "*_V*");
587  };
588  //
589  if (fileName.isEmpty())
591  ": Session selection is canceled");
592  else
593  (new NsSessionEditDialog(fileName, fileName2, &config, &parametersDescriptor,
594  SgVlbiSessionInfo::OT_DBH, false, this, Qt::Window))->show();
595 };
596 
597 
598 
599 //
601 {
603  ": Open Wrapper file menu selected");
604 
605  QString fileName("");
606  QString path2Data(QDir::home().absolutePath() + "/vgosDB/");
607  if (!QDir(path2Data).exists())
608  path2Data = setup.getPath2VgosDbFiles();
609  fileName = QFileDialog::getOpenFileName(this, tr("Open a wrap file"), path2Data, "*.wrp");
610 
611  if (fileName.isEmpty())
613  ": Session selection is canceled");
614  else
615  (new NsSessionEditDialog(fileName, "", &config, &parametersDescriptor,
616  SgVlbiSessionInfo::OT_VDB, false, this, Qt::Window))->show();
617 };
618 
619 
620 
621 //
623 {
625  ": Open Session menu selected");
626 
627  QString fileName("");
629  nd = new NsSessionNameDialog(this, &fileName);
630  if (nd->exec() != QDialog::Accepted)
631  fileName = "";
632  //
633  if (fileName.isEmpty())
635  ": Session selection is canceled");
636  else
637  (new NsSessionEditDialog(fileName, "", &config, &parametersDescriptor,
638  SgVlbiSessionInfo::OT_VDB, false, this, Qt::Window))->show();
639 };
640 
641 
642 
643 //
645 {
647  "::openAgvFile(): Open vgosDa file menu selected");
648 
649  QString fileName("");
650  QString path2Data(setup.path2(setup.getPath2VgosDaFiles()));
651  fileName = QFileDialog::getOpenFileName(this, tr("Open VDA file"), path2Data, "*.vda");
652 
653  if (fileName.isEmpty())
655  "::openAgvFile(): File selection was canceled");
656  else
657  (new NsSessionEditDialog(fileName, "", &config, &parametersDescriptor,
658  SgVlbiSessionInfo::OT_AGV, false, this, Qt::Window))->show();
659 };
660 
661 
662 
663 //
665 {
667  ": Load the Last Non-finished Session menu selected", true);
668 
670  setup.getLnfsOriginType(), true, this, Qt::Window))->show();
671 };
672 
673 
674 
675 //
677 {
679  ": Undo menu selected");
680 };
681 
682 
683 
684 //
686 {
688  ": Redo menu selected");
689 };
690 
691 
692 
693 //
695 {
697  ": Cut menu selected");
698 };
699 
700 
701 
702 //
704 {
706  ": Copy menu selected");
707 };
708 
709 
710 
711 //
713 {
715  ": Paste menu selected");
716 };
717 
718 
719 
720 //
722 {
724  ": Preferences menu selected");
725  (new NsSetupDialog(this))->show();
726 };
727 
728 
729 
730 //
732 {
734  ": Select font menu selected");
735 
736  bool isOk(false);
737  QFont f=QFontDialog::getFont(&isOk, QApplication::font());
738  if (isOk)
739  {
740  QApplication::setFont(f);
741  QSettings settings;
742  settings.setValue("Setup/GuiFont", f);
743  };
744 };
745 
746 
747 
748 //
749 void NsMainWindow::switchToStyle(QAction* action)
750 {
751  QString key = action->text();
752  QApplication::setStyle(key);
753  QSettings settings;
754  settings.setValue("Setup/GuiStyle", key);
756  ": Switched to style <" + key + ">");
757 };
758 
759 
760 
761 // Tools menu:
763 {
765  ": Make something useful #1 menu selected");
766 };
767 
768 
769 
770 //
772 {
774  ": Test something useful #1 menu selected");
775 };
776 
777 
778 
779 // Test menu:
781 {
783  ": Test Plotter menu selected");
784  (new NsTestDialog(this))->show();
785 };
786 
787 
788 
790 {
792  ": Test Four1 menu selected");
793  (new NsTestFour1Dialog(this))->show();
794 };
795 
796 
797 
798 // Test menu:
800 {
802  ": Test #1 menu selected");
803 };
804 
805 
806 
807 //
809 {
811  ": Test #2 menu selected");
812 };
813 
814 
815 
816 // Help menu:
818 {
819  QString aboutText;
820 
821  //nuSolveVersion.getSoftwareName()
822 
823  //nuSolveVersion.name()
824 
825  aboutText =
826  "<h3>This is &nu;Solve.</h3>"
827  "<p>"
828  "The software &nu;Solve is designed to perform analysis of geodetic VLBI observations."
829  "</p>"
830 
831  "<p>"
832  "You are running:"
833  "<ul>"
834  "<li>The driver: <b>" + nuSolveVersion.name() + "</b> released on " +
836  "<li>The library: <b>" + libraryVersion.name() + "</b> released on " +
838  "</ul>"
839  "</p>"
840 
841  "<p>"
842  "If you have suggestions or comments, please send e-mail to &lt;sergei.bolotin@nasa.gov&gt;."
843  "</p>"
844 
845 // "<p style=\"color:red;text-align:right;\">"
846  "<p>"
847  "Goddard VLBI group"
848  "</p>"
849 
850  "";
851 
852 
853 
855  ": About menu selected");
856  QMessageBox::about(this, nuSolveVersion.name(), aboutText);
857 };
858 
859 
860 
861 //
863 {
865  ": About Qt menu selected");
866  QMessageBox::aboutQt(this, nuSolveVersion.name());
867 };
868 
869 
870 
871 //
872 void NsMainWindow::showStats(const QString& label, int numTot, int numPrc, double wrms, double chi2)
873 {
874  lStats_->setText(label + QString("").sprintf(" %d/%d %.2f(ps) %.5g", numTot, numPrc, wrms, chi2));
875 };
876 /*=====================================================================================================*/
877 
878 
879 
880 
881 
882 
883 /*=====================================================================================================*/
884 //
885 // aux functions:
886 //
887 void longOperationStartDisplay(int minStep, int maxStep, const QString& message)
888 {
889  if (maxStep <= 0)
890  maxStep = 1; // do not need "busy indicator"
891  mainWindow->progressBar()->setRange(minStep, maxStep);
892  mainWindow->statusBarMessager()->setText(message);
893  qApp->processEvents();
894 };
895 
896 
897 
898 //
900 {
901  mainWindow->progressBar()->setValue(step);
902  qApp->processEvents();
903 };
904 
905 
906 
907 //
909 {
910  mainWindow->progressBar()->reset();
911  mainWindow->statusBarMessager()->setText("");
912 };
913 
914 
915 
916 //
917 void longOperationMessageDisplay(const QString& message)
918 {
919  mainWindow->statusBarMessager()->setText(message);
920  qApp->processEvents();
921 };
922 
923 
924 
925 //
926 void longOperationShowStats(const QString& label, int numTot, int numPrc, double wrms, double chi2)
927 {
928  mainWindow->showStats(label, numTot, numPrc, wrms, chi2);
929  qApp->processEvents();
930 }
931 /*=====================================================================================================*/
void longOperationStartDisplay(int minStep, int maxStep, const QString &message)
NsMainWindow * mainWindow
void longOperationStopDisplay()
void longOperationMessageDisplay(const QString &message)
void longOperationShowStats(const QString &label, int numTot, int numPrc, double wrms, double chi2)
void longOperationProgressDisplay(int step)
SgVersion nuSolveVersion("nuSolve", 0, 8, 2, "Dark Hollow Falls (rc2)", SgMJD(2023, 4, 3, 10, 59))
SgLogger * logger
Definition: SgLogger.cpp:231
SgVersion libraryVersion("SgLib", 0, 8, 2, "Compton Peak (rc2)", SgMJD(2023, 4, 3, 10, 59))
QAction * quitAct_
Definition: NsMainWindow.h:167
void showStats(const QString &label, int numTot, int numPrc, double wrms, double chi2)
QAction * testSomething1Act_
Definition: NsMainWindow.h:184
QAction * test1Act_
Definition: NsMainWindow.h:188
void createStatusBar()
void openSession()
void preferences()
QAction * aboutAct_
Definition: NsMainWindow.h:190
QMenu * editMenu_
Definition: NsMainWindow.h:149
QProgressBar * progressBar()
Definition: NsMainWindow.h:86
virtual ~NsMainWindow()
QAction * newFileAct_
Definition: NsMainWindow.h:160
QAction * openAgvAct_
Definition: NsMainWindow.h:173
QAction * printFileAct_
Definition: NsMainWindow.h:163
void openWrapperFile()
QMenu * fileMenu_
Definition: NsMainWindow.h:148
QAction * openWrapperFileAct_
Definition: NsMainWindow.h:171
QAction * redoAct_
Definition: NsMainWindow.h:176
QProgressBar * progressBar_
Definition: NsMainWindow.h:156
QLabel * lStats_
Definition: NsMainWindow.h:157
QAction * saveFileAct_
Definition: NsMainWindow.h:162
QAction * pasteAct_
Definition: NsMainWindow.h:179
QAction * closeFileAct_
Definition: NsMainWindow.h:164
NsMainWindow(QWidget *parent=0, Qt::WindowFlags flags=0)
QMenu * helpMenu_
Definition: NsMainWindow.h:152
QAction * makeSomething1Act_
Definition: NsMainWindow.h:183
QLabel * statusBarMessager()
Definition: NsMainWindow.h:88
QAction * openFileAct_
Definition: NsMainWindow.h:161
QString className() const
Definition: NsMainWindow.h:94
QAction * aboutQtAct_
Definition: NsMainWindow.h:191
QAction * copyAct_
Definition: NsMainWindow.h:178
void createActions()
QMenu * toolsMenu_
Definition: NsMainWindow.h:151
QAction * flushLogAct_
Definition: NsMainWindow.h:166
QAction * loadLnfSessionAct_
Definition: NsMainWindow.h:174
QAction * selectFontAct_
Definition: NsMainWindow.h:181
QAction * openSessionAct_
Definition: NsMainWindow.h:172
QAction * undoAct_
Definition: NsMainWindow.h:175
QAction * testPlotterAct_
Definition: NsMainWindow.h:186
void openAgvFile()
QAction * editGenConfigAct_
Definition: NsMainWindow.h:169
void createMenus()
void makeSomething1()
QLabel * statusBarMessager_
Definition: NsMainWindow.h:196
void switchToStyle(QAction *)
void testPlotter()
QMenu * changeStyleMenu_
Definition: NsMainWindow.h:150
QAction * preferencesAct_
Definition: NsMainWindow.h:180
QStringList styleKeys_
Definition: NsMainWindow.h:200
void loadLnfSession()
QAction * editSessionAct_
Definition: NsMainWindow.h:170
QAction * cutAct_
Definition: NsMainWindow.h:177
void testSomething1()
void editSession()
QAction * testFour1Act_
Definition: NsMainWindow.h:187
QAction * closeAllAct_
Definition: NsMainWindow.h:165
QMenu * testMenu_
Definition: NsMainWindow.h:153
void editGenConfig()
QStatusBar * statusBar_
Definition: NsMainWindow.h:155
int getMainWinHeight() const
Definition: NsSetup.h:598
QString path2(const QString &) const
Definition: NsSetup.h:1008
void setMainWinPosY(int)
Definition: NsSetup.h:904
const QString & getPath2Home() const
Definition: NsSetup.h:406
int getMainWinWidth() const
Definition: NsSetup.h:590
SgIdentities & identities()
Definition: NsSetup.h:566
void setMainWinPosX(int)
Definition: NsSetup.h:896
void setMainWinWidth(int)
Definition: NsSetup.h:880
const QString & getPath2VgosDaFiles() const
Definition: NsSetup.h:87
bool getHave2UpdateCatalog() const
Definition: NsSetup.h:526
const QString & getLnfsFileName() const
Definition: NsSetup.h:662
const QString & getPath2DbhFiles() const
Definition: NsSetup.h:422
int getMainWinPosX() const
Definition: NsSetup.h:606
const QString & getPath2VgosDbFiles() const
Definition: NsSetup.h:430
bool getLnfsIsThroughCatalog() const
Definition: NsSetup.h:678
SgVlbiSessionInfo::OriginType getLnfsOriginType() const
Definition: NsSetup.h:670
int getMainWinPosY() const
Definition: NsSetup.h:614
void setMainWinHeight(int)
Definition: NsSetup.h:888
const QString & getAcFullName() const
Definition: SgIdentities.h:239
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
quint32 getLogFacility(LogLevel lvl) const
Definition: SgLogger.h:141
void setDirName(const QString &dirName)
Definition: SgLogger.h:124
virtual void clearSpool()
Definition: SgLogger.cpp:116
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
bool getUseFullDateFormat() const
Definition: SgLogger.h:138
void setUseFullDateFormat(bool useFullDateFormat)
Definition: SgLogger.h:128
@ F_DDMonYYYY
Date: 2010 Apr 02.
Definition: SgMJD.h:87
@ F_VerboseLong
Verbose output: 02 Apr, 2010; 17:02:43.6400.
Definition: SgMJD.h:66
QString toString(Format format=F_Verbose) const
Definition: SgMJD.cpp:1008
static SgMJD currentMJD()
Definition: SgMJD.cpp:119
const QString & getName() const
Definition: SgTaskConfig.h:825
const SgMJD & getReleaseEpoch() const
Definition: SgVersion.h:294
const QString & getSoftwareName() const
Definition: SgVersion.h:254
QString name(NameFormat fmt=NF_Human) const
Definition: SgVersion.cpp:54
const QString & getCodeName() const
Definition: SgVersion.h:286
QString toString() const
Definition: SgVersion.h:356
@ OT_DBH
observations are from database files provided by correlators;
@ OT_AGV
observations are in AGV format;
@ OT_VDB
observations are from vgosDb data tree;
@ OT_UNKNOWN
unknown (=all others) source of import;
NsSetup setup
Definition: nuSolve.cpp:61
SgTaskConfig config
Definition: nuSolve.cpp:59
SgParametersDescriptor parametersDescriptor
Definition: nuSolve.cpp:60