1 // -*- C++ -*- 2 // $Id: gmapdlg.h,v 1.2 2009-11-02 20:38:02 robertl Exp $ 3 //------------------------------------------------------------------------ 4 // 5 // Copyright (C) 2009 S. Khai Mong <khai@mangrai.com>. 6 // 7 // This program is free software; you can redistribute it and/or 8 // modify it under the terms of the GNU General Public License as 9 // published by the Free Software Foundation; either version 2 of the 10 // License, or (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 GNU 15 // 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, write to the Free Software 19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 20 // USA. 21 // 22 //------------------------------------------------------------------------ 23 #ifndef GMAPDLG_H 24 #define GMAPDLG_H 25 26 #include <QStackedWidget> 27 #include <QStandardItem> 28 #include <QModelIndex> 29 #include "ui_gmapui.h" 30 #include "gpx.h" 31 #include "map.h" 32 33 class GMapDialog: public QDialog 34 { 35 Q_OBJECT 36 public: 37 GMapDialog(QWidget* parent, const QString& gpxFileName, QPlainTextEdit* te); 38 39 private: 40 Ui_GMapDlg ui_; 41 Map* mapWidget_; 42 QStandardItemModel* model_; 43 QStandardItem* wptItem_, *trkItem_, *rteItem_; 44 QList<QStandardItem*> wptList_, trkList_, rteList_; 45 Gpx gpx_; 46 int menuIndex_; 47 48 void appendWaypointInfo(QStandardItem* it, const GpxWaypoint& wpt); 49 void appendTrackInfo(QStandardItem* it, const GpxTrack& trk); 50 void appendRouteInfo(QStandardItem* it, const GpxRoute& rte); 51 52 int waypointIndex(QStandardItem* it); 53 int trackIndex(QStandardItem* it); 54 int routeIndex(QStandardItem* it); 55 QString formatLength(double l); 56 57 // 58 private slots: 59 void itemChangedX(QStandardItem*); 60 void waypointClickedX(int i); 61 void trackClickedX(int i); 62 void routeClickedX(int i); 63 void treeDoubleClicked(const QModelIndex& idx); 64 void selectionChangedX(const QItemSelection&, const QItemSelection&); 65 void copyButtonClickedX(); 66 void showContextMenu(const QPoint&); 67 68 69 void expandCollapseAll(const QList<QStandardItem*>& li, 70 QStandardItem* it, bool exp); 71 void checkUncheckAll(const QList<QStandardItem*>& li, 72 QStandardItem* it, bool exp); 73 void expandAllWaypoints(); 74 void expandAllTracks(); 75 void expandAllRoutes(); 76 77 void collapseAllWaypoints(); 78 void collapseAllTracks(); 79 void collapseAllRoutes(); 80 81 void hideAllWaypoints(); 82 void hideAllTracks(); 83 void hideAllRoutes(); 84 85 void showAllWaypoints(); 86 void showAllTracks(); 87 void showAllRoutes(); 88 89 void showOnlyThisWaypoint(); 90 void showOnlyThisTrack(); 91 void showOnlyThisRoute(); 92 }; 93 94 #endif 95