Subversion Repositories public

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
88 andreas 1
/***************************************************************************
119 andreas 2
 *   Copyright (C) 2007, 2008 by Andreas Theofilu                          *
3
 *   andreas@theosys.at                                                    *
88 andreas 4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation version 3 of the License.                *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
19
 
20
#ifndef SPORTWATCHERWIDGET_H
21
#define SPORTWATCHERWIDGET_H
22
 
23
#include <qlabel.h>
24
#include <qdatetime.h>
25
#include <qpixmap.h>
26
#include <qimage.h>
27
#include <qpainter.h>
28
#include <qpen.h>
29
#include <qpoint.h>
30
#include <qpointarray.h>
31
#include <qrect.h>
104 andreas 32
#include <qstring.h>
132 andreas 33
#include <qtimer.h>
88 andreas 34
 
155 andreas 35
#if defined HAVE_GDAL && HAVE_LIBGDAL1_5_0
151 andreas 36
   #include <gdal/gdal_priv.h>
37
#endif
38
 
88 andreas 39
#include "garmin.h"
40
#include "managefile.h"
41
#include "disassemble.h"
42
 
43
#include "sportwatcherwidgetbase.h"
44
 
45
typedef struct INDEX
46
{
47
	QString path;
48
	QString activ;
49
	INDEX *next;
50
} INDEX;
51
 
151 andreas 52
typedef struct BMP_HEADER
53
{
54
//	uint16 bfType;
55
	unsigned int bfSize;
56
	unsigned int bfReserved;
57
	unsigned int bfOffBits;
58
} BMP_HEADER;
59
 
60
typedef struct BMP_INFO
61
{
62
	unsigned int biSize;
63
	int biWidth;
64
	int biHeight;
65
	unsigned short biPlanes;
66
	unsigned short biBitCount;
67
	unsigned int biCompression;
68
	unsigned int biSizeImage;
69
	int biXPelsPerMeter;
70
	int biYPelsPerMeter;
71
	unsigned int biClrUsed;
72
	unsigned int biClrImportant;
73
} BMP_INFO;
74
 
88 andreas 75
class sportwatcherWidget : public sportwatcherWidgetBase
76
{
77
  Q_OBJECT
78
 
79
public:
80
  sportwatcherWidget(QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
81
  ~sportwatcherWidget();
82
  /*$PUBLIC_FUNCTIONS$*/
83
 
84
public slots:
85
  /*$PUBLIC_SLOTS$*/
86
  virtual void          btFullscreenSlot();
87
  virtual void          btGlasMinusSlot();
88
  virtual void          btGlasPlusSlot();
89
  virtual void          btHandSlot();
90
  virtual void          btGlasSlot();
91
  virtual void          btFlagSlot();
92
  virtual void          liLapsSlot(QListViewItem *item);
93
  virtual void          liActivitiesSlot(QListViewItem *item);
94
  virtual void          helpAbout();
95
  virtual void          helpContents();
96
  virtual void          helpIndex();
97
  virtual void          fileExit();
98
  virtual void          filePrint();
99
  virtual void          fileSaveAs();
100
  virtual void          fileSave();
101
  virtual void          fileOpen();
102
  virtual void          fileNew();
103
  virtual void		extrasSaveHR();
104
  virtual void		extrasSettings();
152 andreas 105
  virtual void		extrasWMSSettings();
88 andreas 106
 
107
protected:
108
  /*$PROTECTED_FUNCTIONS$*/
100 andreas 109
  void destroy();
88 andreas 110
  void showLaps();
100 andreas 111
  void showTrack();
104 andreas 112
  void showTrack(int zoom);
132 andreas 113
  void showTrack(int zoom, const QRect &pan, LAP *lap);
88 andreas 114
  void showCurves();
148 andreas 115
  void showCurves(LAP *lap);
88 andreas 116
  void resizeEvent(QResizeEvent *e);
117
  void paintEvent(QPaintEvent *e);
132 andreas 118
  void mouseMoveEvent(QMouseEvent *e);
119
  void mousePressEvent(QMouseEvent *e);
120
  void mouseReleaseEvent(QMouseEvent *e);
88 andreas 121
 
132 andreas 122
protected:
123
  QTimer timer;
124
 
88 andreas 125
protected slots:
126
  /*$PROTECTED_SLOTS$*/
127
 
128
private:
129
    QDateTime *garmin_dtime (uint32 t);
130
    void getActivities();
104 andreas 131
    bool writeTag(const QFile &fn, const QString &str, int indent);
132 andreas 132
    bool findIndex(const QString &key);
155 andreas 133
#if defined HAVE_GDAL && HAVE_LIBGDAL1_5_0
151 andreas 134
    bool writeWMSTag(double llat, double llon, double rlat, double rlon, int width, int height);
135
    void fillBMPHeader (BMP_HEADER *bmpH, BMP_INFO *bmpI, int nXSize, int nYSize, int nRasterCount);
136
#endif
88 andreas 137
 
138
private:
139
  QWidget *mama;
100 andreas 140
  QPixmap pmProfile, pmMap;
88 andreas 141
  QDateTime StartTime;
142
  QStringList files;
132 andreas 143
  QRect mapPan;
88 andreas 144
  manageFile spw;
145
  disassemble ds;
146
  garmin_data *gmn;
147
  int min_hr, max_hr, avg_hr;
104 andreas 148
  int zfactor;
88 andreas 149
  double min_height, max_height;
104 andreas 150
  double total_distance;
132 andreas 151
  double oldTransX, oldTransY;
88 andreas 152
  unsigned long max_time;
132 andreas 153
  bool stateHand, stateFlag, stateGlas;
154
  int lmbPressed;
155
  LAP *mapLap;
88 andreas 156
  INDEX *index;
155 andreas 157
#if defined HAVE_GDAL && HAVE_LIBGDAL1_5_0
151 andreas 158
  GDALDataset *poDataset;
159
#endif
88 andreas 160
 
161
private:
162
  /* Config Parameters */
163
  int lower1, lower2, lower3;
164
  int upper1, upper2, upper3;
165
  int MaxHr, restHr;
166
  int vo2max, weight, sampleTime;
149 andreas 167
  int Units;
168
  bool Serial;
143 andreas 169
  QString Device, Data, HRM, MAP;
88 andreas 170
};
171
 
172
#endif
173