1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Yet another Graph tab display behaviour change

This commit is contained in:
Martin Tůma 2016-03-24 20:50:11 +01:00
parent 6bcb6ceb8d
commit 5253698602
2 changed files with 133 additions and 101 deletions

View File

@ -59,351 +59,351 @@
<context> <context>
<name>GUI</name> <name>GUI</name>
<message> <message>
<location filename="../src/gui.cpp" line="173"/> <location filename="../src/gui.cpp" line="185"/>
<source>About Qt</source> <source>About Qt</source>
<translation>O Qt</translation> <translation>O Qt</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="394"/> <location filename="../src/gui.cpp" line="403"/>
<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> <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> <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>
<message> <message>
<location filename="../src/gui.cpp" line="455"/> <location filename="../src/gui.cpp" line="462"/>
<source>Open file</source> <source>Open file</source>
<translation>Otevřít soubor</translation> <translation>Otevřít soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="187"/> <location filename="../src/gui.cpp" line="199"/>
<source>Save as</source> <source>Save as</source>
<translation>Uložit jako</translation> <translation>Uložit jako</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="516"/> <location filename="../src/gui.cpp" line="527"/>
<source>Open POI file</source> <source>Open POI file</source>
<translation>Otevřít POI soubor</translation> <translation>Otevřít POI soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="178"/> <location filename="../src/gui.cpp" line="190"/>
<source>Open</source> <source>Open</source>
<translation>Otevřít</translation> <translation>Otevřít</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="161"/> <location filename="../src/gui.cpp" line="173"/>
<source>Quit</source> <source>Quit</source>
<translation>Ukončit</translation> <translation>Ukončit</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="168"/> <location filename="../src/gui.cpp" line="180"/>
<location filename="../src/gui.cpp" line="410"/> <location filename="../src/gui.cpp" line="419"/>
<location filename="../src/gui.cpp" line="411"/> <location filename="../src/gui.cpp" line="420"/>
<source>Keyboard controls</source> <source>Keyboard controls</source>
<translation>Ovládací klávesy</translation> <translation>Ovládací klávesy</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="182"/> <location filename="../src/gui.cpp" line="194"/>
<source>Save</source> <source>Save</source>
<translation>Uložit</translation> <translation>Uložit</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="192"/> <location filename="../src/gui.cpp" line="204"/>
<source>Close</source> <source>Close</source>
<translation>Zavřít</translation> <translation>Zavřít</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="197"/> <location filename="../src/gui.cpp" line="209"/>
<source>Reload</source> <source>Reload</source>
<translation>Znovu načíst</translation> <translation>Znovu načíst</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="329"/> <location filename="../src/gui.cpp" line="341"/>
<source>Show</source> <source>Show</source>
<translation>Zobrazit</translation> <translation>Zobrazit</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="274"/> <location filename="../src/gui.cpp" line="286"/>
<location filename="../src/gui.cpp" line="320"/> <location filename="../src/gui.cpp" line="332"/>
<source>File</source> <source>File</source>
<translation>Soubor</translation> <translation>Soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="166"/> <location filename="../src/gui.cpp" line="178"/>
<location filename="../src/gui.cpp" line="428"/> <location filename="../src/gui.cpp" line="437"/>
<location filename="../src/gui.cpp" line="429"/> <location filename="../src/gui.cpp" line="438"/>
<source>Data sources</source> <source>Data sources</source>
<translation>Zdroje dat</translation> <translation>Zdroje dat</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="204"/> <location filename="../src/gui.cpp" line="216"/>
<source>Load POI file</source> <source>Load POI file</source>
<translation>Nahrát POI soubor</translation> <translation>Nahrát POI soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="207"/> <location filename="../src/gui.cpp" line="219"/>
<source>Close POI files</source> <source>Close POI files</source>
<translation>Zavřit soubory POI</translation> <translation>Zavřit soubory POI</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="210"/> <location filename="../src/gui.cpp" line="222"/>
<source>Show POIs</source> <source>Show POIs</source>
<translation>Zobrazit POI</translation> <translation>Zobrazit POI</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="217"/> <location filename="../src/gui.cpp" line="229"/>
<source>Show map</source> <source>Show map</source>
<translation>Zobrazit mapu</translation> <translation>Zobrazit mapu</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="230"/> <location filename="../src/gui.cpp" line="242"/>
<source>Show graphs</source> <source>Show graphs</source>
<translation>Zobrazovat grafy</translation> <translation>Zobrazovat grafy</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="236"/> <location filename="../src/gui.cpp" line="248"/>
<source>Show toolbars</source> <source>Show toolbars</source>
<translation>Zobrazovat nástrojové lišty</translation> <translation>Zobrazovat nástrojové lišty</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="243"/> <location filename="../src/gui.cpp" line="255"/>
<source>Metric</source> <source>Metric</source>
<translation>Metrické</translation> <translation>Metrické</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="249"/> <location filename="../src/gui.cpp" line="261"/>
<source>Imperial</source> <source>Imperial</source>
<translation>Imperiální</translation> <translation>Imperiální</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="256"/> <location filename="../src/gui.cpp" line="268"/>
<source>Next</source> <source>Next</source>
<translation>Následující</translation> <translation>Následující</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="259"/> <location filename="../src/gui.cpp" line="271"/>
<source>Previous</source> <source>Previous</source>
<translation>Předchozí</translation> <translation>Předchozí</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="263"/> <location filename="../src/gui.cpp" line="275"/>
<source>Last</source> <source>Last</source>
<translation>Poslední</translation> <translation>Poslední</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="266"/> <location filename="../src/gui.cpp" line="278"/>
<source>First</source> <source>First</source>
<translation>První</translation> <translation>První</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="288"/> <location filename="../src/gui.cpp" line="300"/>
<source>Map</source> <source>Map</source>
<translation>Mapa</translation> <translation>Mapa</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="293"/> <location filename="../src/gui.cpp" line="305"/>
<source>POI</source> <source>POI</source>
<translation>POI</translation> <translation>POI</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="294"/> <location filename="../src/gui.cpp" line="306"/>
<source>POI files</source> <source>POI files</source>
<translation>POI soubory</translation> <translation>POI soubory</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="302"/> <location filename="../src/gui.cpp" line="314"/>
<source>Settings</source> <source>Settings</source>
<translation>Nastavení</translation> <translation>Nastavení</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="303"/> <location filename="../src/gui.cpp" line="315"/>
<source>Units</source> <source>Units</source>
<translation>Jednotky</translation> <translation>Jednotky</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="310"/> <location filename="../src/gui.cpp" line="322"/>
<source>Help</source> <source>Help</source>
<translation>Nápověda</translation> <translation>Nápověda</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="361"/> <location filename="../src/gui.cpp" line="796"/>
<source>Elevation</source> <source>Elevation</source>
<translation>Výška</translation> <translation>Výška</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="362"/> <location filename="../src/gui.cpp" line="797"/>
<source>Speed</source> <source>Speed</source>
<translation>Rychlost</translation> <translation>Rychlost</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="363"/> <location filename="../src/gui.cpp" line="798"/>
<source>Heart rate</source> <source>Heart rate</source>
<translation>Tep</translation> <translation>Tep</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="413"/> <location filename="../src/gui.cpp" line="422"/>
<source>Next file</source> <source>Next file</source>
<translation>Následující soubor</translation> <translation>Následující soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="414"/> <location filename="../src/gui.cpp" line="423"/>
<source>Previous file</source> <source>Previous file</source>
<translation>Předchozí soubor</translation> <translation>Předchozí soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="416"/> <location filename="../src/gui.cpp" line="425"/>
<source>First file</source> <source>First file</source>
<translation>První soubor</translation> <translation>První soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="417"/> <location filename="../src/gui.cpp" line="426"/>
<source>Last file</source> <source>Last file</source>
<translation>Poslední soubor</translation> <translation>Poslední soubor</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="418"/> <location filename="../src/gui.cpp" line="427"/>
<source>Append modifier</source> <source>Append modifier</source>
<translation>Modifikátor nahradit/přidat</translation> <translation>Modifikátor nahradit/přidat</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="432"/> <location filename="../src/gui.cpp" line="441"/>
<source>Map (tiles) source URLs are read on program startup from the following file:</source> <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> <translation>URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru:</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="436"/> <location filename="../src/gui.cpp" line="444"/>
<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> <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> <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>
<message> <message>
<location filename="../src/gui.cpp" line="444"/> <location filename="../src/gui.cpp" line="452"/>
<source>To make GPXSee load a POI file automatically on startup, add the file to the following directory:</source> <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> <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>
<message> <message>
<location filename="../src/gui.cpp" line="456"/> <location filename="../src/gui.cpp" line="463"/>
<source>GPX files (*.gpx);;All files (*)</source> <source>GPX files (*.gpx);;All files (*)</source>
<translation>soubory GPX (*.gpx);;všechny soubory (*)</translation> <translation>soubory GPX (*.gpx);;všechny soubory (*)</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="507"/> <location filename="../src/gui.cpp" line="518"/>
<location filename="../src/gui.cpp" line="533"/> <location filename="../src/gui.cpp" line="544"/>
<source>Line: %1</source> <source>Line: %1</source>
<translation>Řádka: %1</translation> <translation>Řádka: %1</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="517"/> <location filename="../src/gui.cpp" line="528"/>
<source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source> <source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source>
<translation>soubory GPX (*.gpx);;soubory CSV (*.csv);;všechny soubory (*)</translation> <translation>soubory GPX (*.gpx);;soubory CSV (*.csv);;všechny soubory (*)</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="598"/> <location filename="../src/gui.cpp" line="609"/>
<location filename="../src/gui.cpp" line="718"/> <location filename="../src/gui.cpp" line="735"/>
<source>mi</source> <source>mi</source>
<translation>mi</translation> <translation>mi</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="601"/> <location filename="../src/gui.cpp" line="612"/>
<location filename="../src/gui.cpp" line="603"/> <location filename="../src/gui.cpp" line="614"/>
<location filename="../src/gui.cpp" line="605"/> <location filename="../src/gui.cpp" line="616"/>
<location filename="../src/gui.cpp" line="607"/> <location filename="../src/gui.cpp" line="618"/>
<source>ft</source> <source>ft</source>
<translation>ft</translation> <translation>ft</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="604"/> <location filename="../src/gui.cpp" line="615"/>
<location filename="../src/gui.cpp" line="616"/> <location filename="../src/gui.cpp" line="627"/>
<source>Maximum</source> <source>Maximum</source>
<translation>Maximum</translation> <translation>Maximum</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="606"/> <location filename="../src/gui.cpp" line="617"/>
<location filename="../src/gui.cpp" line="618"/> <location filename="../src/gui.cpp" line="629"/>
<source>Minimum</source> <source>Minimum</source>
<translation>Minimum</translation> <translation>Minimum</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="171"/> <location filename="../src/gui.cpp" line="183"/>
<location filename="../src/gui.cpp" line="390"/> <location filename="../src/gui.cpp" line="399"/>
<source>About GPXSee</source> <source>About GPXSee</source>
<translation>O aplikaci GPXSee</translation> <translation>O aplikaci GPXSee</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="336"/> <location filename="../src/gui.cpp" line="348"/>
<source>Navigation</source> <source>Navigation</source>
<translation>Navigace</translation> <translation>Navigace</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="392"/> <location filename="../src/gui.cpp" line="401"/>
<source>GPX viewer and analyzer</source> <source>GPX viewer and analyzer</source>
<translation>Prohlížeč a analyzátor GPX</translation> <translation>Prohlížeč a analyzátor GPX</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="431"/> <location filename="../src/gui.cpp" line="440"/>
<source>Map sources</source> <source>Map sources</source>
<translation>Mapové zdroje</translation> <translation>Mapové zdroje</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="443"/> <location filename="../src/gui.cpp" line="451"/>
<source>POIs</source> <source>POIs</source>
<translation>POI body</translation> <translation>POI body</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="597"/> <location filename="../src/gui.cpp" line="608"/>
<location filename="../src/gui.cpp" line="609"/> <location filename="../src/gui.cpp" line="620"/>
<source>Distance</source> <source>Distance</source>
<translation>Vzdálenost</translation> <translation>Vzdálenost</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="599"/> <location filename="../src/gui.cpp" line="610"/>
<location filename="../src/gui.cpp" line="611"/> <location filename="../src/gui.cpp" line="622"/>
<source>Time</source> <source>Time</source>
<translation>Čas</translation> <translation>Čas</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="600"/> <location filename="../src/gui.cpp" line="611"/>
<location filename="../src/gui.cpp" line="612"/> <location filename="../src/gui.cpp" line="623"/>
<source>Ascent</source> <source>Ascent</source>
<translation>Stoupání</translation> <translation>Stoupání</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="613"/> <location filename="../src/gui.cpp" line="624"/>
<location filename="../src/gui.cpp" line="615"/> <location filename="../src/gui.cpp" line="626"/>
<location filename="../src/gui.cpp" line="617"/> <location filename="../src/gui.cpp" line="628"/>
<location filename="../src/gui.cpp" line="619"/> <location filename="../src/gui.cpp" line="630"/>
<source>m</source> <source>m</source>
<translation>m</translation> <translation>m</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="602"/> <location filename="../src/gui.cpp" line="613"/>
<location filename="../src/gui.cpp" line="614"/> <location filename="../src/gui.cpp" line="625"/>
<source>Descent</source> <source>Descent</source>
<translation>Klesání</translation> <translation>Klesání</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="714"/> <location filename="../src/gui.cpp" line="731"/>
<source>%1 tracks</source> <source>%1 tracks</source>
<translation>Počet tras: %1</translation> <translation>Počet tras: %1</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="610"/> <location filename="../src/gui.cpp" line="621"/>
<location filename="../src/gui.cpp" line="721"/> <location filename="../src/gui.cpp" line="738"/>
<source>km</source> <source>km</source>
<translation>km</translation> <translation>km</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="509"/> <location filename="../src/gui.cpp" line="520"/>
<location filename="../src/gui.cpp" line="534"/> <location filename="../src/gui.cpp" line="545"/>
<source>Error</source> <source>Error</source>
<translation>Chyba</translation> <translation>Chyba</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="504"/> <location filename="../src/gui.cpp" line="515"/>
<source>Error loading GPX file: <source>Error loading GPX file:
%1</source> %1</source>
<translation>Soubor GPX nelze otevřít: <translation>Soubor GPX nelze otevřít:
%1</translation> %1</translation>
</message> </message>
<message> <message>
<location filename="../src/gui.cpp" line="530"/> <location filename="../src/gui.cpp" line="541"/>
<source>Error loading POI file: <source>Error loading POI file:
%1</source> %1</source>
<translation>Soubor POI nelze otevřít: <translation>Soubor POI nelze otevřít:

View File

@ -29,6 +29,13 @@
#include "gui.h" #include "gui.h"
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
struct GraphTab {
GraphView *view;
QString label;
};
static QString timeSpan(qreal time) static QString timeSpan(qreal time)
{ {
unsigned h, m, s; unsigned h, m, s;
@ -79,8 +86,8 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
_time = 0; _time = 0;
_trackCount = 0; _trackCount = 0;
_lastGraph = static_cast<GraphView*>(_trackGraphs->currentWidget()); _lastGraph = 0;
_lastSliderPos = _lastGraph->sliderPosition(); _lastSliderPos = -1.0;
updateGraphTabs(); updateGraphTabs();
resize(600, 800); resize(600, 800);
@ -351,7 +358,6 @@ void GUI::createToolBars()
void GUI::createTrackView() void GUI::createTrackView()
{ {
_track = new TrackView(this); _track = new TrackView(this);
_track->setEnabled(false);
if (_showMapAction->isChecked()) if (_showMapAction->isChecked())
_track->setMap(_currentMap); _track->setMap(_currentMap);
@ -364,9 +370,6 @@ void GUI::createTrackGraphs()
_heartRateGraph = new HeartRateGraph; _heartRateGraph = new HeartRateGraph;
_trackGraphs = new QTabWidget; _trackGraphs = new QTabWidget;
_trackGraphs->addTab(_elevationGraph, tr("Elevation"));
_trackGraphs->addTab(_speedGraph, tr("Speed"));
_trackGraphs->addTab(_heartRateGraph, tr("Heart rate"));
connect(_trackGraphs, SIGNAL(currentChanged(int)), this, connect(_trackGraphs, SIGNAL(currentChanged(int)), this,
SLOT(graphChanged(int))); SLOT(graphChanged(int)));
@ -494,6 +497,7 @@ bool GUI::loadFile(const QString &fileName)
_elevationGraph->loadGPX(gpx); _elevationGraph->loadGPX(gpx);
_speedGraph->loadGPX(gpx); _speedGraph->loadGPX(gpx);
_heartRateGraph->loadGPX(gpx); _heartRateGraph->loadGPX(gpx);
updateGraphTabs();
_track->loadGPX(gpx); _track->loadGPX(gpx);
if (_showPOIAction->isChecked()) if (_showPOIAction->isChecked())
_track->loadPOI(_poi); _track->loadPOI(_poi);
@ -504,7 +508,6 @@ bool GUI::loadFile(const QString &fileName)
} }
_trackCount += gpx.trackCount(); _trackCount += gpx.trackCount();
_track->setEnabled(true);
return true; return true;
} else { } else {
@ -673,7 +676,6 @@ void GUI::closeAll()
{ {
closeFiles(); closeFiles();
_track->setEnabled(false);
_fileActionGroup->setEnabled(false); _fileActionGroup->setEnabled(false);
updateStatusBarInfo(); updateStatusBarInfo();
updateGraphTabs(); updateGraphTabs();
@ -757,10 +759,15 @@ void GUI::poiFileChecked(int index)
void GUI::graphChanged(int index) void GUI::graphChanged(int index)
{ {
if (index < 0)
return;
GraphView *tv = static_cast<GraphView*>(_trackGraphs->widget(index)); GraphView *tv = static_cast<GraphView*>(_trackGraphs->widget(index));
if (_lastGraph->sliderPosition() >= 0) if (_lastGraph) {
_lastSliderPos = _lastGraph->sliderPosition(); if (_lastGraph->sliderPosition() >= 0)
tv->setSliderPosition(_lastSliderPos); _lastSliderPos = _lastGraph->sliderPosition();
tv->setSliderPosition(_lastSliderPos);
}
_lastGraph = tv; _lastGraph = tv;
} }
@ -785,11 +792,36 @@ void GUI::updateNavigationActions()
void GUI::updateGraphTabs() void GUI::updateGraphTabs()
{ {
struct GraphTab tabs[] = {
{_elevationGraph, tr("Elevation")},
{_speedGraph, tr("Speed")},
{_heartRateGraph, tr("Heart rate")}
};
int index;
GraphView *gv; GraphView *gv;
for (int i = 0; i < _trackGraphs->count(); i++) {
gv = static_cast<GraphView*>(_trackGraphs->widget(i)); for (int i = 0; i < (int)ARRAY_SIZE(tabs); i++) {
_trackGraphs->setTabEnabled(i, gv->count()); gv = tabs[i].view;
if (!gv->count() && (index = _trackGraphs->indexOf(gv)) >= 0)
_trackGraphs->removeTab(index);
} }
for (int i = 0; i < (int)ARRAY_SIZE(tabs); i++) {
gv = tabs[i].view;
if (gv->count() && _trackGraphs->indexOf(gv) < 0)
_trackGraphs->insertTab(i, gv, tabs[i].label);
}
for (int i = 0; i < (int)ARRAY_SIZE(tabs); i++) {
if (tabs[i].view->count()) {
_trackGraphs->setHidden(false);
_showGraphsAction->setEnabled(true);
return;
}
}
_trackGraphs->setHidden(true);
_showGraphsAction->setEnabled(false);
} }
void GUI::setMetricUnits() void GUI::setMetricUnits()