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