Navigator2Go  2.0
Manage your local Ocean Navigator installation.
widgetdataorder.h
1 #ifndef WIDGETDATAORDER_H
2 #define WIDGETDATAORDER_H
3 
4 #include "QEasyDownloader.hpp"
5 #include "datadownloaddesc.h"
6 
7 #include <QWidget>
8 #include <QHash>
9 #include <QNetworkAccessManager>
10 
11 /***********************************************************************************/
12 // Forward declarations
13 namespace Ui {
14 class WidgetDataOrder;
15 }
16 class QListWidgetItem;
17 class MainWindow;
18 class Preferences;
19 
20 /***********************************************************************************/
22 class WidgetDataOrder : public QWidget {
23  Q_OBJECT
24 
25 public:
26  WidgetDataOrder(QWidget* parent, MainWindow* mainWindow, Preferences& prefs);
27  ~WidgetDataOrder() override;
28 
30  void updateRemoteDatasetListWidget();
31 
32  void setNAMOnline();
33  void setNAMOffline();
34 
35 signals:
37  void refreshRequested();
39  void showStatusBarMessage(const char* message);
40 
41 private slots:
42 
44  void on_pushButtonDownload_clicked();
46  void on_listWidgetRemoteDatasets_itemDoubleClicked(QListWidgetItem* item);
48  void on_listWidgetDownloadQueue_itemDoubleClicked(QListWidgetItem* item);
50  void on_pushButtonUpdateRemoteList_clicked();
52  void on_pushButtonDeleteSelected_clicked();
53 
54  // Data order area changes
55  void on_spinboxMinLat_valueChanged(double arg1);
56  void on_spinboxMinLon_valueChanged(double arg1);
57  void on_spinboxMaxLat_valueChanged(double arg1);
58  void on_spinboxMaxLon_valueChanged(double arg1);
59 
60 private:
62  void configureNetwork();
64  void deleteQueueItem(QListWidgetItem* item);
65 
66  Ui::WidgetDataOrder* m_ui{nullptr};
67  MainWindow* const m_mainWindow{nullptr};
69 
70  // Stores the resulting JSON objects for each dataset
71  // returned by a call to:
72  // http://navigator.oceansdata.ca/api/datasets/
73  QHash<QString, QJsonObject> m_datasetsAPIResultCache;
74  QHash<QString, DataDownloadDesc> m_downloadQueue;
75 
76  // Network stuff
77  QNetworkAccessManager m_networkAccessManager{this};
78  QEasyDownloader m_downloader{this, &m_networkAccessManager};
79 };
80 
81 #endif // WIDGETDATAORDER_H
Contains the loaded and modified settings.
Definition: preferences.h:17
Definition: QEasyDownloader.hpp:107
Definition: dialogdatasetview.h:16
Data order widget in the Data Order tab.
Definition: widgetdataorder.h:22
Preferences & m_prefs
Ref to preferences object in MainWindow.
Definition: widgetdataorder.h:68
QHash< QString, DataDownloadDesc > m_downloadQueue
Download queue maps dataset ID to download description.
Definition: widgetdataorder.h:74
QHash< QString, QJsonObject > m_datasetsAPIResultCache
Cache API results by dataset ID.
Definition: widgetdataorder.h:73
Definition: mainwindow.h:28