-
Notifications
You must be signed in to change notification settings - Fork 0
/
configwindow.h
190 lines (164 loc) · 5.28 KB
/
configwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/* -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*- */
/* vim: set shiftwidth=4 softtabstop=4 expandtab: */
/*
********************************************************************
** NIDAS: NCAR In-situ Data Acquistion Software
**
** 2009, Copyright University Corporation for Atmospheric Research
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** The LICENSE.txt file accompanying this software contains
** a copy of the GNU General Public License. If it is not found,
** write to the Free Software Foundation, Inc.,
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
**
********************************************************************
*/
/*
The main window of the nidas (for aircraft) Configuration Editor.
This is the controller in regards to Qt and sets up windows,
handles signals/slots, etc
*/
#ifndef CONFIGWINDOW_H
#define CONFIGWINDOW_H
#include <QMainWindow>
#include <nidas/core/DSMSensor.h>
#include <nidas/core/XMLParser.h>
#include <nidas/core/Project.h>
#include <nidas/core/Site.h>
#include <nidas/core/DSMConfig.h>
#include <xercesc/util/PlatformUtils.hpp>
#include "Document.h"
#include "AddSensorComboDialog.h"
#include "AddDSMComboDialog.h"
#include "AddA2DVariableComboDialog.h"
#include "VariableComboDialog.h"
#include "NewProjectDialog.h"
#include "exceptions/UserFriendlyExceptionHandler.h"
#include "nidas_qmv/NidasModel.h"
#include "nidas_qmv/SiteItem.h"
#include <QTreeView>
#include <QTableView>
#include <QSplitter>
#include <iostream>
#include <fstream>
#include <string>
using namespace nidas::core;
namespace n_u = nidas::util;
using namespace config;
using namespace xercesc;
class QAction;
class QActionGroup;
class QLabel;
class QMenu;
class ConfigWindow : public QMainWindow
{
Q_OBJECT
public:
ConfigWindow();
~ConfigWindow() {
XMLPlatformUtils::Terminate();
};
// Refactor in such a way that Document doesn't need these
// or they're in document or we don't need Document or something.
NidasModel *getModel() const { cerr << "model pointer =" << model << "\n" ;return model; } // XXX
QTableView *getTableView() const { return tableview; } // XXX
void show();
virtual void closeEvent(QCloseEvent *event)
{ quit(); QWidget::closeEvent(event); }
public slots:
void newFile();
void openFile();
void newProj();
void saveOldFile();
bool saveFile(std::string origFile);
bool saveAsFile();
void editProjName();
void toggleErrorsWindow(bool);
void addSensorCombo();
void editSensorCombo();
void deleteSensor();
void addDSMCombo();
void editDSMCombo();
void deleteDSM();
void editA2DVariableCombo();
void addA2DVariableCombo();
void editVariableCombo();
void deleteA2DVariable();
void quit();
void changeToIndex(const QModelIndex&);
void changeToIndex(const QItemSelection&);
void setFilename(QString filename) { _filename = filename; return; }
void writeProjectName(QString projName);
private:
void buildMenus();
void buildFileMenu();
void buildWindowMenu();
void buildAddMenu();
void buildSensorCatalog();
void buildA2DVarDB();
void buildSensorMenu();
void buildSensorActions();
void buildDSMMenu();
void buildDSMActions();
void buildVariableMenu();
void buildVariableActions();
void buildA2DVariableMenu();
void buildA2DVariableActions();
void buildProjectMenu();
UserFriendlyExceptionHandler * exceptionHandler;
AddSensorComboDialog *sensorComboDialog;
AddDSMComboDialog *dsmComboDialog;
AddA2DVariableComboDialog *a2dVariableComboDialog;
VariableComboDialog *variableComboDialog;
NewProjectDialog *newProjDialog;
QMessageBox * _errorMessage;
Document* _doc;
bool doCalibrations;
void getFile();
void setupDefaultDir();
std::string _defaultDir;
bool _noProjDir;
QString _projDir;
QString _defaultCaption;
const QString _gvDefault;
const QString _c130Default;
const QString _a2dCalDir;
const QString _engCalDirRoot;
const QString _pmsSpecsFile;
bool fileExists(QString filename);
QString _filename;
bool _fileOpen;
bool saveFileCopy(std::string origFile);
bool askSaveFileAndContinue();
void setupModelView(QSplitter *splitter);
NidasModel *model;
QTreeView *treeview;
QTableView *tableview;
QSplitter *mainSplitter;
QMenu *sensorMenu;
QAction *addSensorAction;
QAction *editSensorAction;
QAction *deleteSensorAction;
QMenu *dsmMenu;
QAction *addDSMAction;
QAction *editDSMAction;
QAction *deleteDSMAction;
QMenu *sampleMenu;
QMenu *variableMenu;
QAction *editVariableAction;
QMenu *a2dVariableMenu;
QAction *editA2DVariableAction;
QAction *addA2DVariableAction;
QAction *deleteA2DVariableAction;
};
#endif