1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2016-06-24 00:55:44 +02:00
parent 68671ed994
commit c3d6294b7a
13 changed files with 157 additions and 184 deletions

View File

@ -44,7 +44,8 @@ HEADERS += src/config.h \
src/exportdialog.h \
src/fileselectwidget.h \
src/margins.h \
src/temperaturegraph.h
src/temperaturegraph.h \
src/graphtab.h
SOURCES += src/main.cpp \
src/gui.cpp \
src/gpx.cpp \

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="cs_CZ">
<TS version="2.1" language="cs_CZ">
<context>
<name>ElevationGraph</name>
<message>
@ -10,6 +10,7 @@
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="15"/>
<location filename="../src/elevationgraph.h" line="15"/>
<source>Elevation</source>
<translation>Výška</translation>
</message>
@ -162,358 +163,338 @@
<context>
<name>GUI</name>
<message>
<location filename="../src/gui.cpp" line="464"/>
<location filename="../src/gui.cpp" line="451"/>
<source>GPXSee is distributed under the terms of the GNU General Public License version 3. For more info about GPXSee visit the project homepage at </source>
<translation>Program GPXSee je distribuován pod podmínkami licence GNU General Public License verze 3. Pro více informací navštivte stránky programu na adrese </translation>
</message>
<message>
<location filename="../src/gui.cpp" line="528"/>
<location filename="../src/gui.cpp" line="515"/>
<source>Open file</source>
<translation>Otevřít soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="606"/>
<location filename="../src/gui.cpp" line="591"/>
<source>Open POI file</source>
<translation>Otevřít POI soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="204"/>
<location filename="../src/gui.cpp" line="205"/>
<source>Open</source>
<translation>Otevřít</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="188"/>
<location filename="../src/gui.cpp" line="189"/>
<source>Quit</source>
<translation>Ukončit</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="196"/>
<location filename="../src/gui.cpp" line="480"/>
<location filename="../src/gui.cpp" line="481"/>
<location filename="../src/gui.cpp" line="197"/>
<location filename="../src/gui.cpp" line="467"/>
<location filename="../src/gui.cpp" line="468"/>
<source>Keyboard controls</source>
<translation>Ovládací klávesy</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="220"/>
<location filename="../src/gui.cpp" line="221"/>
<source>Close</source>
<translation>Zavřít</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="226"/>
<location filename="../src/gui.cpp" line="227"/>
<source>Reload</source>
<translation>Znovu načíst</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="382"/>
<location filename="../src/gui.cpp" line="383"/>
<source>Show</source>
<translation>Zobrazit</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="323"/>
<location filename="../src/gui.cpp" line="376"/>
<location filename="../src/gui.cpp" line="324"/>
<location filename="../src/gui.cpp" line="377"/>
<source>File</source>
<translation>Soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="194"/>
<location filename="../src/gui.cpp" line="503"/>
<location filename="../src/gui.cpp" line="504"/>
<location filename="../src/gui.cpp" line="195"/>
<location filename="../src/gui.cpp" line="490"/>
<location filename="../src/gui.cpp" line="491"/>
<source>Data sources</source>
<translation>Zdroje dat</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="234"/>
<location filename="../src/gui.cpp" line="235"/>
<source>Load POI file</source>
<translation>Nahrát POI soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="237"/>
<location filename="../src/gui.cpp" line="238"/>
<source>Close POI files</source>
<translation>Zavřit POI soubory</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="240"/>
<location filename="../src/gui.cpp" line="241"/>
<source>Show POIs</source>
<translation>Zobrazit POI</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="248"/>
<location filename="../src/gui.cpp" line="249"/>
<source>Show map</source>
<translation>Zobrazit mapu</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="254"/>
<location filename="../src/gui.cpp" line="255"/>
<source>Clear tile cache</source>
<translation>Vymazat mezipaměť dlaždic</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="263"/>
<location filename="../src/gui.cpp" line="267"/>
<location filename="../src/gui.cpp" line="490"/>
<location filename="../src/gui.cpp" line="264"/>
<location filename="../src/gui.cpp" line="268"/>
<location filename="../src/gui.cpp" line="477"/>
<source>Next map</source>
<translation>Následující mapa</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="274"/>
<location filename="../src/gui.cpp" line="275"/>
<source>Show graphs</source>
<translation>Zobrazovat grafy</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="280"/>
<location filename="../src/gui.cpp" line="281"/>
<source>Show toolbars</source>
<translation>Zobrazovat nástrojové lišty</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="286"/>
<location filename="../src/gui.cpp" line="287"/>
<source>Metric</source>
<translation>Metrické</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="291"/>
<location filename="../src/gui.cpp" line="292"/>
<source>Imperial</source>
<translation>Imperiální</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="297"/>
<location filename="../src/gui.cpp" line="298"/>
<source>Fullscreen mode</source>
<translation>Celoobrazovkový režim</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="305"/>
<location filename="../src/gui.cpp" line="306"/>
<source>Next</source>
<translation>Následující</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="308"/>
<location filename="../src/gui.cpp" line="309"/>
<source>Previous</source>
<translation>Předchozí</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="312"/>
<location filename="../src/gui.cpp" line="313"/>
<source>Last</source>
<translation>Poslední</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="315"/>
<location filename="../src/gui.cpp" line="316"/>
<source>First</source>
<translation>První</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="337"/>
<location filename="../src/gui.cpp" line="338"/>
<source>Map</source>
<translation>Mapa</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="344"/>
<location filename="../src/gui.cpp" line="345"/>
<source>POI</source>
<translation>POI</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="345"/>
<location filename="../src/gui.cpp" line="346"/>
<source>POI files</source>
<translation>POI soubory</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="353"/>
<location filename="../src/gui.cpp" line="354"/>
<source>Settings</source>
<translation>Nastavení</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="354"/>
<location filename="../src/gui.cpp" line="355"/>
<source>Units</source>
<translation>Jednotky</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="363"/>
<location filename="../src/gui.cpp" line="364"/>
<source>Help</source>
<translation>Nápověda</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="426"/>
<source>Temperature</source>
<translation>Teplota</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="492"/>
<location filename="../src/gui.cpp" line="479"/>
<source>Previous map</source>
<translation>Předchozí mapa</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="691"/>
<location filename="../src/gui.cpp" line="694"/>
<location filename="../src/gui.cpp" line="676"/>
<location filename="../src/gui.cpp" line="679"/>
<source>Date</source>
<translation>Datum</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="871"/>
<location filename="../src/gui.cpp" line="852"/>
<source>No GPX files loaded</source>
<translation>Nejsou načteny žádné GPX soubory</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="423"/>
<source>Elevation</source>
<translation>Výška</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="424"/>
<source>Speed</source>
<translation>Rychlost</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="425"/>
<source>Heart rate</source>
<translation>Tep</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="483"/>
<location filename="../src/gui.cpp" line="470"/>
<source>Next file</source>
<translation>Následující soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="460"/>
<location filename="../src/gui.cpp" line="447"/>
<source>Version </source>
<translation>Verze </translation>
</message>
<message>
<location filename="../src/gui.cpp" line="209"/>
<location filename="../src/gui.cpp" line="210"/>
<source>Print...</source>
<translation>Tisknout...</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="214"/>
<location filename="../src/gui.cpp" line="215"/>
<source>Export to PDF...</source>
<translation>Exportovat do PDF...</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="484"/>
<location filename="../src/gui.cpp" line="471"/>
<source>Previous file</source>
<translation>Předchozí soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="486"/>
<location filename="../src/gui.cpp" line="473"/>
<source>First file</source>
<translation>První soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="487"/>
<location filename="../src/gui.cpp" line="474"/>
<source>Last file</source>
<translation>Poslední soubor</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="488"/>
<location filename="../src/gui.cpp" line="475"/>
<source>Append modifier</source>
<translation>Modifikátor nahradit/přidat</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="507"/>
<location filename="../src/gui.cpp" line="494"/>
<source>Map (tiles) source URLs are read on program startup from the following file:</source>
<translation>URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru:</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="510"/>
<location filename="../src/gui.cpp" line="497"/>
<source>The file format is one map entry per line, consisting of the map name and tiles URL delimited by a TAB character. The tile X and Y coordinates are replaced with $x and $y in the URL and the zoom level is replaced with $z. An example map file could look like:</source>
<translation>Formát souboru je jeden mapový záznam na řádku, kde mapový záznam sestává ze jména mapy a URL dlaždic navzájem oddělených tabulátorem. Souřadnice dlaždice jsou v URL nahrazeny řetězci $x a $y, úroven přiblížení (zoom) pak řetězcem $z. Příklad:</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="518"/>
<location filename="../src/gui.cpp" line="505"/>
<source>To make GPXSee load a POI file automatically on startup, add the file to the following directory:</source>
<translation>POI soubory, které se mají automaticky nahrát při startu programu jsou načítány z následujícího adresáře:</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="529"/>
<location filename="../src/gui.cpp" line="516"/>
<source>GPX files (*.gpx);;All files (*)</source>
<translation>Soubory GPX (*.gpx);;Všechny soubory (*)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="597"/>
<location filename="../src/gui.cpp" line="623"/>
<location filename="../src/gui.cpp" line="582"/>
<location filename="../src/gui.cpp" line="608"/>
<source>Line: %1</source>
<translation>Řádka: %1</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="607"/>
<location filename="../src/gui.cpp" line="592"/>
<source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source>
<translation>Soubory GPX (*.gpx);;Soubory CSV (*.csv);;Všechny soubory (*)</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="697"/>
<location filename="../src/gui.cpp" line="682"/>
<source>Tracks</source>
<translation>Počet tras</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="703"/>
<location filename="../src/gui.cpp" line="886"/>
<location filename="../src/gui.cpp" line="688"/>
<location filename="../src/gui.cpp" line="867"/>
<source>mi</source>
<translation>mi</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="883"/>
<location filename="../src/gui.cpp" line="864"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="199"/>
<location filename="../src/gui.cpp" line="458"/>
<location filename="../src/gui.cpp" line="200"/>
<location filename="../src/gui.cpp" line="445"/>
<source>About GPXSee</source>
<translation>O aplikaci GPXSee</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="386"/>
<location filename="../src/gui.cpp" line="387"/>
<source>Navigation</source>
<translation>Navigace</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="506"/>
<location filename="../src/gui.cpp" line="493"/>
<source>Map sources</source>
<translation>Mapové zdroje</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="517"/>
<location filename="../src/gui.cpp" line="504"/>
<source>POIs</source>
<translation>POI body</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="702"/>
<location filename="../src/gui.cpp" line="705"/>
<location filename="../src/gui.cpp" line="687"/>
<location filename="../src/gui.cpp" line="690"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="710"/>
<location filename="../src/gui.cpp" line="695"/>
<source>Time</source>
<translation>Čas</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="890"/>
<location filename="../src/gui.cpp" line="871"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="878"/>
<location filename="../src/gui.cpp" line="859"/>
<source>%1 tracks</source>
<translation>Počet tras: %1</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="706"/>
<location filename="../src/gui.cpp" line="893"/>
<location filename="../src/gui.cpp" line="691"/>
<location filename="../src/gui.cpp" line="874"/>
<source>km</source>
<translation>km</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="599"/>
<location filename="../src/gui.cpp" line="624"/>
<location filename="../src/gui.cpp" line="584"/>
<location filename="../src/gui.cpp" line="609"/>
<source>Error</source>
<translation>Chyba</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="594"/>
<location filename="../src/gui.cpp" line="579"/>
<source>Error loading GPX file:
%1</source>
<translation>Soubor GPX nelze otevřít:
%1</translation>
</message>
<message>
<location filename="../src/gui.cpp" line="620"/>
<location filename="../src/gui.cpp" line="605"/>
<source>Error loading POI file:
%1</source>
<translation>Soubor POI nelze otevřít:
@ -529,6 +510,7 @@
</message>
<message>
<location filename="../src/heartrategraph.cpp" line="11"/>
<location filename="../src/heartrategraph.h" line="15"/>
<source>Heart rate</source>
<translation>Tep</translation>
</message>
@ -600,6 +582,7 @@
</message>
<message>
<location filename="../src/speedgraph.cpp" line="12"/>
<location filename="../src/speedgraph.h" line="16"/>
<source>Speed</source>
<translation>Rychlost</translation>
</message>
@ -653,6 +636,7 @@
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="11"/>
<location filename="../src/temperaturegraph.h" line="15"/>
<source>Temperature</source>
<translation>Teplota</translation>
</message>
@ -697,7 +681,7 @@
<translation>C</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="100"/>
<location filename="../src/temperaturegraph.cpp" line="101"/>
<source>F</source>
<translation>F</translation>
</message>

View File

@ -3,7 +3,7 @@
#include "elevationgraph.h"
ElevationGraph::ElevationGraph(QWidget *parent) : GraphView(parent)
ElevationGraph::ElevationGraph(QWidget *parent) : GraphTab(parent)
{
_ascent = 0;
_descent = 0;

View File

@ -1,28 +1,28 @@
#ifndef ELEVATIONGRAPH_H
#define ELEVATIONGRAPH_H
#include "graphview.h"
#include "units.h"
#include "graphtab.h"
class GPX;
class ElevationGraph : public GraphView
class ElevationGraph : public GraphTab
{
Q_OBJECT
public:
ElevationGraph(QWidget *parent = 0);
QString label() const {return tr("Elevation");}
void loadGPX(const GPX &gpx);
void clear();
void setUnits(enum Units units);
private:
qreal ascent() const {return _ascent;}
qreal descent() const {return _descent;}
qreal max() const {return bounds().bottom();}
qreal min() const {return bounds().top();}
private:
void setXUnits();
void setYUnits();
void addInfo();

23
src/graphtab.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef GRAPHTAB_H
#define GRAPHTAB_H
#include "graphview.h"
#include "units.h"
class GPX;
class GraphTab : public GraphView
{
Q_OBJECT
public:
GraphTab(QWidget *parent = 0) : GraphView(parent)
{setFrameShape(QFrame::NoFrame);}
virtual QString label() const = 0;
virtual void loadGPX(const GPX &gpx) = 0;
virtual void clear() = 0;
virtual void setUnits(enum Units units) = 0;
};
#endif // GRAPHTAB_H

View File

@ -34,6 +34,7 @@
#include "filebrowser.h"
#include "cpuarch.h"
#include "exportdialog.h"
#include "graphtab.h"
#include "gui.h"
@ -101,8 +102,8 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
GUI::~GUI()
{
for (int i = 0; i < _tabs.size(); i++) {
if (_trackGraphs->indexOf(_tabs.at(i).first) < 0)
delete _tabs.at(i).first;
if (_trackGraphs->indexOf(_tabs.at(i)) < 0)
delete _tabs.at(i);
}
}
@ -400,15 +401,6 @@ void GUI::createTrackView()
void GUI::createTrackGraphs()
{
_elevationGraph = new ElevationGraph;
_elevationGraph->setFrameShape(QFrame::NoFrame);
_speedGraph = new SpeedGraph;
_speedGraph->setFrameShape(QFrame::NoFrame);
_heartRateGraph = new HeartRateGraph;
_heartRateGraph->setFrameShape(QFrame::NoFrame);
_temperatureGraph = new TemperatureGraph;
_temperatureGraph->setFrameShape(QFrame::NoFrame);
_trackGraphs = new QTabWidget;
connect(_trackGraphs, SIGNAL(currentChanged(int)), this,
SLOT(graphChanged(int)));
@ -420,19 +412,14 @@ void GUI::createTrackGraphs()
_trackGraphs->setDocumentMode(true);
#endif // Q_OS_WIN32
_tabs.append(GraphTab(_elevationGraph, tr("Elevation")));
_tabs.append(GraphTab(_speedGraph, tr("Speed")));
_tabs.append(GraphTab(_heartRateGraph, tr("Heart rate")));
_tabs.append(GraphTab(_temperatureGraph, tr("Temperature")));
_tabs.append(new ElevationGraph);
_tabs.append(new SpeedGraph);
_tabs.append(new HeartRateGraph);
_tabs.append(new TemperatureGraph);
connect(_elevationGraph, SIGNAL(sliderPositionChanged(qreal)), this,
SLOT(sliderPositionChanged(qreal)));
connect(_speedGraph, SIGNAL(sliderPositionChanged(qreal)), this,
SLOT(sliderPositionChanged(qreal)));
connect(_heartRateGraph, SIGNAL(sliderPositionChanged(qreal)), this,
SLOT(sliderPositionChanged(qreal)));
connect(_temperatureGraph, SIGNAL(sliderPositionChanged(qreal)), this,
SLOT(sliderPositionChanged(qreal)));
for (int i = 0; i < _tabs.count(); i++)
connect(_tabs.at(i), SIGNAL(sliderPositionChanged(qreal)), this,
SLOT(sliderPositionChanged(qreal)));
}
void GUI::createStatusBar()
@ -565,10 +552,8 @@ bool GUI::loadFile(const QString &fileName)
GPX gpx;
if (gpx.loadFile(fileName)) {
_elevationGraph->loadGPX(gpx);
_speedGraph->loadGPX(gpx);
_heartRateGraph->loadGPX(gpx);
_temperatureGraph->loadGPX(gpx);
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->loadGPX(gpx);
updateGraphTabs();
_track->setHidden(false);
_track->loadGPX(gpx);
@ -740,10 +725,8 @@ void GUI::reloadFile()
_dateRange = DateRange(QDate(), QDate());
_trackCount = 0;
_elevationGraph->clear();
_speedGraph->clear();
_heartRateGraph->clear();
_temperatureGraph->clear();
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->clear();
_track->clear();
_sliderPos = 0;
@ -774,10 +757,8 @@ void GUI::closeFiles()
_sliderPos = 0;
_elevationGraph->clear();
_speedGraph->clear();
_heartRateGraph->clear();
_temperatureGraph->clear();
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->clear();
_track->clear();
_files.clear();
@ -977,18 +958,18 @@ void GUI::updateNavigationActions()
void GUI::updateGraphTabs()
{
int index;
GraphView *gv;
GraphTab *tab;
for (int i = 0; i < _tabs.size(); i++) {
gv = _tabs.at(i).first;
if (!gv->count() && (index = _trackGraphs->indexOf(gv)) >= 0)
tab = _tabs.at(i);
if (!tab->count() && (index = _trackGraphs->indexOf(tab)) >= 0)
_trackGraphs->removeTab(index);
}
for (int i = 0; i < _tabs.size(); i++) {
gv = _tabs.at(i).first;
if (gv->count() && _trackGraphs->indexOf(gv) < 0)
_trackGraphs->insertTab(i, gv, _tabs.at(i).second);
tab = _tabs.at(i);
if (tab->count() && _trackGraphs->indexOf(tab) < 0)
_trackGraphs->insertTab(i, tab, _tabs.at(i)->label());
}
if (_trackGraphs->count()) {
@ -1009,20 +990,16 @@ void GUI::updateTrackView()
void GUI::setMetricUnits()
{
_track->setUnits(Metric);
_elevationGraph->setUnits(Metric);
_speedGraph->setUnits(Metric);
_heartRateGraph->setUnits(Metric);
_temperatureGraph->setUnits(Metric);
for (int i = 0; i <_tabs.count(); i++)
_tabs.at(i)->setUnits(Metric);
updateStatusBarInfo();
}
void GUI::setImperialUnits()
{
_track->setUnits(Imperial);
_elevationGraph->setUnits(Imperial);
_speedGraph->setUnits(Imperial);
_heartRateGraph->setUnits(Imperial);
_temperatureGraph->setUnits(Imperial);
for (int i = 0; i <_tabs.count(); i++)
_tabs.at(i)->setUnits(Imperial);
updateStatusBarInfo();
}

View File

@ -18,11 +18,7 @@ class QLabel;
class QSignalMapper;
class QPrinter;
class FileBrowser;
class GraphView;
class ElevationGraph;
class SpeedGraph;
class HeartRateGraph;
class TemperatureGraph;
class GraphTab;
class TrackView;
class Map;
@ -71,7 +67,6 @@ private slots:
void sliderPositionChanged(qreal pos);
private:
typedef QPair<GraphView *, QString> GraphTab;
typedef QPair<QDate, QDate> DateRange;
void loadMaps();
@ -156,11 +151,7 @@ private:
QLabel *_timeLabel;
TrackView *_track;
ElevationGraph *_elevationGraph;
SpeedGraph *_speedGraph;
HeartRateGraph *_heartRateGraph;
TemperatureGraph *_temperatureGraph;
QList<GraphTab> _tabs;
QList<GraphTab*> _tabs;
POI _poi;
QList<Map*> _maps;

View File

@ -2,7 +2,7 @@
#include "heartrategraph.h"
HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphView(parent)
HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphTab(parent)
{
_units = Metric;

View File

@ -1,26 +1,25 @@
#ifndef HEARTRATEGRAPH_H
#define HEARTRATEGRAPH_H
#include "graphview.h"
#include "units.h"
#include "graphtab.h"
class GPX;
class HeartRateGraph : public GraphView
class HeartRateGraph : public GraphTab
{
Q_OBJECT
public:
HeartRateGraph(QWidget *parent = 0);
QString label() const {return tr("Heart rate");}
void loadGPX(const GPX &gpx);
void clear();
void setUnits(enum Units units);
private:
qreal avg() const;
qreal max() const {return bounds().bottom();}
private:
void setXUnits();
void addInfo();

View File

@ -3,7 +3,7 @@
#include "speedgraph.h"
SpeedGraph::SpeedGraph(QWidget *parent) : GraphView(parent)
SpeedGraph::SpeedGraph(QWidget *parent) : GraphTab(parent)
{
_units = Metric;

View File

@ -2,26 +2,25 @@
#define SPEEDGRAPH_H
#include <QList>
#include "graphview.h"
#include "units.h"
#include "graphtab.h"
class GPX;
class SpeedGraph : public GraphView
class SpeedGraph : public GraphTab
{
Q_OBJECT
public:
SpeedGraph(QWidget *parent = 0);
QString label() const {return tr("Speed");}
void loadGPX(const GPX &gpx);
void clear();
void setUnits(enum Units units);
private:
qreal avg() const;
qreal max() const {return bounds().bottom();}
private:
void setXUnits();
void setYUnits();
void addInfo();

View File

@ -2,7 +2,7 @@
#include "temperaturegraph.h"
TemperatureGraph::TemperatureGraph(QWidget *parent) : GraphView(parent)
TemperatureGraph::TemperatureGraph(QWidget *parent) : GraphTab(parent)
{
_units = Metric;

View File

@ -1,27 +1,26 @@
#ifndef TEMPERATUREGRAPH_H
#define TEMPERATUREGRAPH_H
#include "units.h"
#include "graphview.h"
#include "graphtab.h"
class GPX;
class TemperatureGraph : public GraphView
class TemperatureGraph : public GraphTab
{
Q_OBJECT
public:
TemperatureGraph(QWidget *parent = 0);
QString label() const {return tr("Temperature");}
void loadGPX(const GPX &gpx);
void clear();
void setUnits(enum Units units);
private:
qreal avg() const;
qreal min() const {return bounds().top();}
qreal max() const {return bounds().bottom();}
private:
void setXUnits();
void setYUnits();
void addInfo();