1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-02 22:09:16 +02:00

Compare commits

...

14 Commits
2.12 ... 2.13

18 changed files with 371 additions and 48 deletions

66
Info.plist Normal file
View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>gpxsee.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.13</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>GPXSee</string>
<key>CFBundleIdentifier</key>
<string>cz.wz.tumic.GPXSee</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>gpx</string>
</array>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/gpx+xml</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>gpx.icns</string>
<key>CFBundleTypeName</key>
<string>GPS Exchange Format</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
</array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.topografix.gpx</string>
<key>UTTypeReferenceURL</key>
<string>http://www.topografix.com/GPX/1/1</string>
<key>UTTypeDescription</key>
<string>GPS Exchange Format</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.xml</string>
</array>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>gpx</string>
</array>
<key>public.mime-type</key>
<string>application/gpx+xml</string>
</dict>
</dict>
</array>
</dict>
</plist>

View File

@ -2,12 +2,15 @@
GPX viewer and analyzer.
* User-definable map sources.
* Track and elevation/speed graphs.
* Track and elevation/speed/heart rate graphs.
* Support for multiple tracks in one view.
* Support for POI files.
* Export to PDF.
* Full-screen mode
* Native GUI for Windows, Mac OS X and Linux.
![GPXSee - Linux](https://a.fsdn.com/con/app/proj/gpxsee/screenshots/linux.png)
## Build
### Linux/OS X
```shell

6
build/env.bat Normal file
View File

@ -0,0 +1,6 @@
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
set PATH=C:\qt\qtbase\bin;%PATH%
set PATH=C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;%PATH%
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;%INCLUDE%
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib;%LIB%
set CL=/D_USING_V110_SDK71_

6
build/env64.bat Normal file
View File

@ -0,0 +1,6 @@
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
set PATH=C:\qt64\qtbase\bin;%PATH%
set PATH=C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;%PATH%
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;%INCLUDE%
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64;%LIB%
set CL=/D_USING_V110_SDK71_

View File

@ -1,4 +1,5 @@
TARGET = GPXSee
VERSION = 2.13
QT += core \
gui \
network
@ -36,7 +37,9 @@ HEADERS += src/config.h \
src/palette.h \
src/heartrategraph.h \
src/range.h \
src/cpuarch.h
src/cpuarch.h \
src/settings.h \
src/app.h
SOURCES += src/main.cpp \
src/gui.cpp \
src/gpx.cpp \
@ -62,8 +65,20 @@ SOURCES += src/main.cpp \
src/waypointitem.cpp \
src/palette.cpp \
src/heartrategraph.cpp \
src/range.cpp
src/range.cpp \
src/app.cpp
RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_cs.ts
macx:ICON = icons/gpxsee.icns
win32:RC_FILE = gpxsee.rc
macx {
ICON = icons/gpxsee.icns
QMAKE_INFO_PLIST = Info.plist
APP_RESOURCES.files = icons/gpx.icns \
pkg/maps.txt
APP_RESOURCES.path = Contents/Resources
QMAKE_BUNDLE_DATA += APP_RESOURCES
}
win32 {
RC_ICONS = icons/gpxsee.ico \
icons/gpx.ico
}
DEFINES += APP_VERSION=\\\"$$VERSION\\\"

View File

@ -1 +0,0 @@
IDI_ICON1 ICON DISCARDABLE "icons/gpxsee.ico"

BIN
icons/gpx.icns Normal file

Binary file not shown.

BIN
icons/gpx.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

View File

@ -18,7 +18,9 @@ InstallDir "$PROGRAMFILES\GPXSee"
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
; Registry key for uninstaller
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
; GPX file type registry entry
!define REGGPX "GPXSee.gpx"
; Start menu page configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
@ -65,7 +67,7 @@ Section "GPXSee (required)" SEC_APP
; Write the uninstall keys for Windows
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "2.12"
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "2.13"
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
@ -79,6 +81,13 @@ Section "GPXSee (required)" SEC_APP
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
!insertmacro MUI_STARTMENU_WRITE_END
; Associate .gpx files
WriteRegStr HKCR ".gpx" "" "${REGGPX}"
WriteRegStr HKCR "${REGGPX}" "" "GPS Exchange Format"
WriteRegStr HKCR "${REGGPX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,1"
WriteRegStr HKCR "${REGGPX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd
Section "QT libs" SEC_QT
@ -132,7 +141,12 @@ Section "Uninstall"
SetShellVarContext all
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\*.*"
RMDir "$SMPROGRAMS\$StartMenuFolder"
RMDir "$SMPROGRAMS\$StartMenuFolder"
; Remove GPX file association
DeleteRegKey HKCR "${REGGPX}"
DeleteRegKey HKCR ".gpx"
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd

View File

@ -18,7 +18,9 @@ InstallDir "$PROGRAMFILES64\GPXSee"
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
; Registry key for uninstaller
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
; GPX file type registry entry
!define REGGPX "GPXSee.gpx"
; Start menu page configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
@ -73,7 +75,7 @@ Section "GPXSee (required)" SEC_APP
; Write the uninstall keys for Windows
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "2.12"
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "2.13"
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
@ -87,6 +89,13 @@ Section "GPXSee (required)" SEC_APP
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
!insertmacro MUI_STARTMENU_WRITE_END
; Associate .gpx files
WriteRegStr HKCR ".gpx" "" "${REGGPX}"
WriteRegStr HKCR "${REGGPX}" "" "GPS Exchange Format"
WriteRegStr HKCR "${REGGPX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,1"
WriteRegStr HKCR "${REGGPX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd
Section "QT libs" SEC_QT
@ -125,6 +134,7 @@ SectionEnd
Section "Uninstall"
; Remove registry keys
SetRegView 64
DeleteRegKey HKLM "${REGENTRY}"
DeleteRegKey HKLM SOFTWARE\GPXSee
@ -135,7 +145,12 @@ Section "Uninstall"
SetShellVarContext all
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\*.*"
RMDir "$SMPROGRAMS\$StartMenuFolder"
RMDir "$SMPROGRAMS\$StartMenuFolder"
; Remove GPX file association
DeleteRegKey HKCR "${REGGPX}"
DeleteRegKey HKCR ".gpx"
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
SectionEnd

48
src/app.cpp Normal file
View File

@ -0,0 +1,48 @@
#include <QtGlobal>
#include <QTranslator>
#include <QLocale>
#include <QFileOpenEvent>
#include "gui.h"
#include "app.h"
App::App(int &argc, char **argv) : QApplication(argc, argv),
_argc(argc), _argv(argv)
{
_translator = new QTranslator();
QString locale = QLocale::system().name();
_translator->load(QString(":/lang/gpxsee_") + locale);
installTranslator(_translator);
#ifdef Q_OS_MAC
setAttribute(Qt::AA_DontShowIconsInMenus);
#endif // Q_OS_MAC
_gui = new GUI();
}
App::~App()
{
delete _gui;
delete _translator;
}
void App::run()
{
_gui->show();
for (int i = 1; i < _argc; i++)
_gui->openFile(QString::fromLocal8Bit(_argv[i]));
exec();
}
bool App::event(QEvent *event)
{
if (event->type() == QEvent::FileOpen) {
QFileOpenEvent *e = static_cast<QFileOpenEvent *>(event);
return _gui->openFile(e->file());
}
return QApplication::event(event);
}

28
src/app.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef APP_H
#define APP_H
#include <QApplication>
class GUI;
class QTranslator;
class App : QApplication
{
Q_OBJECT
public:
App(int &argc, char **argv);
~App();
void run();
protected:
bool event(QEvent *event);
private:
int &_argc;
char **_argv;
GUI *_gui;
QTranslator *_translator;
};
#endif // APP_H

View File

@ -8,7 +8,6 @@
#define APP_NAME "GPXSee"
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
#define APP_VERSION "2.12"
#define FONT_FAMILY "Arial"
#define FONT_SIZE 12

View File

@ -14,9 +14,11 @@
#include <QActionGroup>
#include <QAction>
#include <QLabel>
#include <QSettings>
#include "config.h"
#include "icons.h"
#include "keys.h"
#include "settings.h"
#include "gpx.h"
#include "map.h"
#include "maplist.h"
@ -84,6 +86,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
widget->setLayout(layout);
setCentralWidget(widget);
setWindowIcon(QIcon(QPixmap(APP_ICON)));
setWindowTitle(APP_NAME);
setUnifiedTitleAndToolBarOnMac(true);
@ -96,7 +99,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
updateGraphTabs();
updateTrackView();
resize(600, 800);
readSettings();
}
void GUI::loadMaps()
@ -141,9 +144,6 @@ void GUI::createMapActions()
}
connect(sm, SIGNAL(mapped(int)), this, SLOT(mapChanged(int)));
_mapActions.at(0)->setChecked(true);
_currentMap = _maps.at(0);
}
void GUI::createPOIFilesActions()
@ -161,7 +161,6 @@ QAction *GUI::createPOIFileAction(int index)
QAction *a = new QAction(QFileInfo(_poi.files().at(index)).fileName(),
this);
a->setCheckable(true);
a->setChecked(true);
_poiFilesSM->setMapping(a, index);
connect(a, SIGNAL(triggered()), _poiFilesSM, SLOT(map()));
@ -257,7 +256,6 @@ void GUI::createActions()
_clearMapCacheAction->setEnabled(false);
} else {
createMapActions();
_showMapAction->setChecked(true);
_nextMapAction = new QAction(tr("Next map"), this);
_nextMapAction->setShortcut(NEXT_MAP_SHORTCUT);
@ -272,14 +270,12 @@ void GUI::createActions()
// Settings actions
_showGraphsAction = new QAction(tr("Show graphs"), this);
_showGraphsAction->setCheckable(true);
_showGraphsAction->setChecked(true);
_showGraphsAction->setShortcut(SHOW_GRAPHS_SHORTCUT);
connect(_showGraphsAction, SIGNAL(triggered(bool)), this,
SLOT(showGraphs(bool)));
addAction(_showGraphsAction);
_showToolbarsAction = new QAction(tr("Show toolbars"), this);
_showToolbarsAction->setCheckable(true);
_showToolbarsAction->setChecked(true);
connect(_showToolbarsAction, SIGNAL(triggered(bool)), this,
SLOT(showToolbars(bool)));
QActionGroup *ag = new QActionGroup(this);
@ -287,7 +283,6 @@ void GUI::createActions()
_metricUnitsAction = new QAction(tr("Metric"), this);
_metricUnitsAction->setCheckable(true);
_metricUnitsAction->setActionGroup(ag);
_metricUnitsAction->setChecked(true);
connect(_metricUnitsAction, SIGNAL(triggered()), this,
SLOT(setMetricUnits()));
_imperialUnitsAction = new QAction(tr("Imperial"), this);
@ -403,9 +398,6 @@ void GUI::createTrackView()
#ifdef Q_OS_WIN32
_track->setFrameShape(QFrame::NoFrame);
#endif // Q_OS_WIN32
if (_showMapAction->isChecked())
_track->setMap(_currentMap);
}
void GUI::createTrackGraphs()
@ -547,6 +539,7 @@ bool GUI::openFile(const QString &fileName)
updateNavigationActions();
updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs();
updateTrackView();
@ -718,6 +711,7 @@ void GUI::reloadFile()
}
updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs();
updateTrackView();
if (_files.isEmpty())
@ -748,6 +742,7 @@ void GUI::closeAll()
_fileActionGroup->setEnabled(false);
updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs();
updateTrackView();
}
@ -853,6 +848,15 @@ void GUI::updateStatusBarInfo()
_timeLabel->setText(timeSpan(_time));
}
void GUI::updateWindowTitle()
{
if (_files.count() == 1)
setWindowTitle(QFileInfo(_files.at(0)).fileName()
+ QString(" - " APP_NAME));
else
setWindowTitle(APP_NAME);
}
void GUI::mapChanged(int index)
{
_currentMap = _maps.at(index);
@ -1050,3 +1054,114 @@ void GUI::keyPressEvent(QKeyEvent *event)
openFile(file);
}
}
void GUI::closeEvent(QCloseEvent *event)
{
writeSettings();
event->accept();
}
void GUI::writeSettings()
{
QSettings settings(APP_NAME, APP_NAME);
settings.beginGroup(WINDOW_SETTINGS_GROUP);
settings.setValue(WINDOW_SIZE_SETTING, size());
settings.setValue(WINDOW_POS_SETTING, pos());
settings.endGroup();
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
settings.setValue(UNITS_SETTING, _imperialUnitsAction->isChecked()
? Imperial : Metric);
settings.setValue(SHOW_TOOLBARS_SETTING, _showToolbarsAction->isChecked());
settings.setValue(SHOW_GRAPHS_SETTING, _showGraphsAction->isChecked());
settings.endGroup();
settings.beginGroup(MAP_SETTINGS_GROUP);
if (_currentMap)
settings.setValue(CURRENT_MAP_SETTING, _currentMap->name());
settings.setValue(SHOW_MAP_SETTING, _showMapAction->isChecked());
settings.endGroup();
settings.beginGroup(POI_SETTINGS_GROUP);
settings.setValue(SHOW_POI_SETTING, _showPOIAction->isChecked());
settings.remove(DISABLED_POI_FILE_SETTINGS_PREFIX);
settings.beginWriteArray(DISABLED_POI_FILE_SETTINGS_PREFIX);
for (int i = 0, j = 0; i < _poiFilesActions.count(); i++) {
if (!_poiFilesActions.at(i)->isChecked()) {
settings.setArrayIndex(j++);
settings.setValue(DISABLED_POI_FILE_SETTING, _poi.files().at(i));
}
}
settings.endArray();
settings.endGroup();
}
void GUI::readSettings()
{
QSettings settings(APP_NAME, APP_NAME);
settings.beginGroup(WINDOW_SETTINGS_GROUP);
resize(settings.value(WINDOW_SIZE_SETTING, QSize(600, 800)).toSize());
move(settings.value(WINDOW_POS_SETTING, QPoint(10, 10)).toPoint());
settings.endGroup();
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
if (settings.value(UNITS_SETTING, Metric).toInt() == Imperial) {
setImperialUnits();
_imperialUnitsAction->setChecked(true);
} else
_metricUnitsAction->setChecked(true);
if (settings.value(SHOW_TOOLBARS_SETTING, true).toBool() == false) {
showToolbars(false);
_showToolbarsAction->setChecked(false);
} else
_showToolbarsAction->setChecked(true);
if (settings.value(SHOW_GRAPHS_SETTING, true).toBool() == false) {
showGraphs(false);
_showGraphsAction->setChecked(false);
} else
_showGraphsAction->setChecked(true);
settings.endGroup();
settings.beginGroup(MAP_SETTINGS_GROUP);
if (settings.value(SHOW_MAP_SETTING, true).toBool() == true)
_showMapAction->setChecked(true);
if (_maps.count()) {
int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString());
_mapActions.at(index)->setChecked(true);
_currentMap = _maps.at(index);
if (_showMapAction->isChecked())
_track->setMap(_currentMap);
} else
_currentMap = 0;
settings.endGroup();
settings.beginGroup(POI_SETTINGS_GROUP);
if (settings.value(SHOW_POI_SETTING, false).toBool() == true)
_showPOIAction->setChecked(true);
for (int i = 0; i < _poiFilesActions.count(); i++)
_poiFilesActions.at(i)->setChecked(true);
int size = settings.beginReadArray(DISABLED_POI_FILE_SETTINGS_PREFIX);
for (int i = 0; i < size; i++) {
settings.setArrayIndex(i);
int index = _poi.files().indexOf(settings.value(
DISABLED_POI_FILE_SETTING).toString());
if (index >= 0) {
_poi.enableFile(_poi.files().at(index), false);
_poiFilesActions.at(index)->setChecked(false);
}
}
settings.endArray();
settings.endGroup();
}
int GUI::mapIndex(const QString &name)
{
for (int i = 0; i < _maps.count(); i++)
if (_maps.at(i)->name() == name)
return i;
return 0;
}

View File

@ -83,11 +83,17 @@ private:
bool loadFile(const QString &fileName);
void saveFile(const QString &fileName);
void updateStatusBarInfo();
void updateWindowTitle();
void updateNavigationActions();
void updateGraphTabs();
void updateTrackView();
void keyPressEvent(QKeyEvent * event);
void closeEvent(QCloseEvent *event);
int mapIndex(const QString &name);
void readSettings();
void writeSettings();
QMenu *_fileMenu;
QMenu *_helpMenu;

View File

@ -1,28 +1,9 @@
#include <QApplication>
#include <QTranslator>
#include <QLocale>
#include "gui.h"
#include "icons.h"
#include "app.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
App app(argc, argv);
app.run();
QString locale = QLocale::system().name();
QTranslator translator;
translator.load(QString(":/lang/gpxsee_") + locale);
app.installTranslator(&translator);
#ifdef Q_OS_MAC
app.setAttribute(Qt::AA_DontShowIconsInMenus);
#endif // Q_OS_MAC
GUI gui;
gui.setWindowIcon(QIcon(QPixmap(APP_ICON)));
gui.show();
for (int i = 1; i < argc; i++)
gui.openFile(argv[i]);
return app.exec();
return 0;
}

22
src/settings.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#define WINDOW_SETTINGS_GROUP "Window"
#define WINDOW_SIZE_SETTING "size"
#define WINDOW_POS_SETTING "pos"
#define SETTINGS_SETTINGS_GROUP "Settings"
#define UNITS_SETTING "units"
#define SHOW_TOOLBARS_SETTING "toolbar"
#define SHOW_GRAPHS_SETTING "graphs"
#define MAP_SETTINGS_GROUP "Map"
#define CURRENT_MAP_SETTING "map"
#define SHOW_MAP_SETTING "show"
#define POI_SETTINGS_GROUP "POI"
#define SHOW_POI_SETTING "show"
#define DISABLED_POI_FILE_SETTINGS_PREFIX "disabled"
#define DISABLED_POI_FILE_SETTING "file"
#endif // SETTINGS_H