Navigator2Go  2.0
Manage your local Ocean Navigator installation.
widgetconfigeditor.h
1 #ifndef WIDGETCONFIGEDITOR_H
2 #define WIDGETCONFIGEDITOR_H
3 
4 #include "nodiscard.h"
5 
6 #include <QWidget>
7 #include <QJsonObject>
8 
9 /***********************************************************************************/
10 // Forward declarations
11 namespace Ui {
12 class WidgetConfigEditor;
13 }
14 
15 class QListWidgetItem;
16 class MainWindow;
17 class Preferences;
18 
19 /***********************************************************************************/
21 class WidgetConfigEditor : public QWidget {
22  Q_OBJECT
23 
24 public:
25  WidgetConfigEditor(QWidget* parent, const Preferences* prefs);
26  ~WidgetConfigEditor() override;
27 
28  void addDatasetToConfigList();
29  void saveConfigFile();
30  void updateDatasetListWidget();
31 
32  NODISCARD auto hasUnsavedData() const noexcept { return m_hasUnsavedData; }
33 
34 signals:
36  void showStatusBarMessage(const char* message);
37 
38 private slots:
40  void on_pushButtonAddDataset_clicked();
42  void on_pushButtonDeleteDataset_clicked();
44  void on_pushButtonSaveConfigFile_clicked();
46  void on_pushButtonLoadCustomConfig_clicked();
48  void on_pushButtonLoadDefaultConfig_clicked();
50  void on_listWidgetActiveDatasets_itemDoubleClicked(QListWidgetItem* item);
51 
52 private:
54  void setDefaultConfigFile();
56  int showUnsavedDataMessageBox();
57 
58  Ui::WidgetConfigEditor* m_ui{nullptr};
59  const Preferences* const m_prefs{nullptr};
60 
62  QJsonObject m_documentRootObject;
63 
64  bool m_hasUnsavedData{false};
65 };
66 
67 #endif // WIDGETCONFIGEDITOR_H
Contains the loaded and modified settings.
Definition: preferences.h:17
QJsonObject m_documentRootObject
Root JSON object of active config file.
Definition: widgetconfigeditor.h:62
Definition: dialogdatasetview.h:16
Dataset config editor widget in the Config Editor tab.
Definition: widgetconfigeditor.h:21
QString m_activeConfigFile
Path to the currently loaded config file.
Definition: widgetconfigeditor.h:61
Definition: mainwindow.h:28