FGx  1
airportswidget.h
1 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
2 // FGx FlightGear Launcher // airportswidget.h
3 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-
4 // (c) 2010-2012
5 // Yves Sablonier, Pete Morgan
6 // Geoff McLane
7 // GNU GPLv2, see main.cpp and shipped licence.txt for further information
8 
9 #ifndef AIRPORTSWIDGET_H
10 #define AIRPORTSWIDGET_H
11 
12 #include <QtCore/QDirIterator>
13 #include <QtCore/QStringList>
14 #include <QtCore/QHash>
15 
16 #include <QtGui/QWidget>
17 #include <QtGui/QButtonGroup>
18 #include <QtGui/QRadioButton>
19 #include <QtGui/QPushButton>
20 #include <QtGui/QProgressBar>
21 #include <QtGui/QStatusBar>
22 #include <QtGui/QRadioButton>
23 #include <QtGui/QToolButton>
24 #include <QtGui/QTabWidget>
25 
26 
27 #include <QtGui/QStandardItemModel>
28 #include <QtGui/QSortFilterProxyModel>
29 #include <QtGui/QTreeView>
30 #include <QtGui/QTreeWidget>
31 
32 #include "xwidgets/xgroupboxes.h"
33 
34 #include "xobjects/mainobject.h"
35 class MainObject;
36 
37 #include "map/openlayerwidget.h"
38 class OpenLayerWidget;
39 
40 #include "airports/metarwidget.h"
41 class MetarWidget;
42 
43 #include "utilities/workThread.h" // class workThread
44 #include "utilities/loadAptDat.h" // class loadAptDat
45 
46 class AirportsWidget : public QWidget
47 {
48 Q_OBJECT
49 public:
50 
51  enum AIPORTS_TREE_COLS{
52  CA_CODE = 0,
53  CA_NAME = 1,
54  CA_DIR = 2
55  };
56 
57  enum AIRPORT_INFO_TREE_COLS{
58  CI_NODE = 0,
59  CI_LABEL = 1,
60  CI_TYPE = 2,
61  CI_SETTING_KEY = 3,
62  CI_WIDTH = 4,
63  CI_LENGTH = 5,
64  CI_LAT = 6,
65  CI_LON = 7,
66  CI_HEADING =8,
67  CI_RUNWAYS = 9
68  //CI_HDG = 10
69  };
70 
71  enum STARTUP_POSTITION{
72  USE_DEFAULT = 0,
73  USE_AIRPORT = 1,
74  USE_COORDINATES = 2
75  };
76 
77  explicit AirportsWidget(MainObject *mOb, QWidget *parent = 0);
78  ~AirportsWidget();
79 
80  MainObject *mainObject;
81 
82 
83  QTabWidget *tabWidget;
84  OpenLayerWidget *mapWidget;
85  MetarWidget *metarWidget;
86 
87  XGroupVBox *groupBoxAirport;
88  XGroupVBox *groupBoxUseCoordinates;
89 
90  QButtonGroup *buttonGroupFilter;
91  QLineEdit *txtAirportsFilter;
92 
93  QStandardItemModel *model;
94  QSortFilterProxyModel *proxyModel;
95  QTreeView *treeAirports;
96 
97  QPushButton *buttonRefreshTree;
98  QStatusBar *statusBarAirports;
99  QToolButton *buttonOpenAirportsFolder;
100  QLabel *labelAirportsFolder;
101 
102  QTreeWidget *treeAptInfo;
103  QStatusBar *statusBarAirportInfo;
104 
105 
106  void scan_airports_xml();
107  void show_progress(bool state);
108 
109  void load_airports_tree();
110 
111  void load_info_tree(QString airport_dir, QString airport_code);
112  void load_tower_node(QString airport_dir, QString airport_code);
113  int load_runways_node(QString airport_dir, QString airport_code);
114  int load_parking_node(QString airport_dir, QString airport_code);
115 
116 
117  QLineEdit *txtLat;
118  QLineEdit *txtLon;
119  QLineEdit *txtVOR;
120  QLineEdit *txtNDB;
121  QLineEdit *txtFIX;
122  QLineEdit *txtOffset;
123  QLineEdit *txtAltitude;
124  QLineEdit *txtHeading;
125 
126  QString validate();
127 
128  QString current_airport();
129 
130  workThread *apt_dat_loader;
131  PLOADITEM ploadItem;
132  loadAptDat *pAptDat;
133 
134 signals:
135 
136  void setx(QString option, bool enabled, QString value);
137  void set_ena(QString option, bool enabled);
138 
139 public slots:
140 
141  void on_map_double_clicked(QString lat, QString lon, QString heading);
142 
143  void initialize();
144 
145  void on_update_airports_filter();
146 
147  void on_airport_tree_selected(QModelIndex currentIdx, QModelIndex previousIdx);
148  void on_airport_info_selection_changed();
149 
150  void on_airport_info_double_clicked(QTreeWidgetItem*,int);
151  void on_open_airports_folder();
152  void on_show_metar();
153 
154  void on_reload_cache();
155 
156  //void on_tab_changed();
157 
158  void on_coordinates_changed();
159 
160  void on_upx( QString option, bool enabled, QString value);
161 
162  void on_loadaptdat_done(); // fired when the apt.dat[.gz] thread load completes
163 
164 };
165 
166 #endif // AIRPORTSWIDGET_H
tagLOADITEM
Definition: loadAptDat.h:58
workThread
Definition: workThread.h:66
MainObject
The MainObject is an extended QObject, and the main "controller" for FGx.
Definition: mainobject.h:61
loadAptDat
Definition: loadAptDat.h:76
OpenLayerWidget
Definition: openlayerwidget.h:37
MetarWidget
Definition: metarwidget.h:21
AirportsWidget
Definition: airportswidget.h:46
XGroupVBox
A QGroupBox with a QVBoxLyout layout.
Definition: xgroupboxes.h:19