mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-04 06:49:16 +02:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
6518fe3278 | |||
97e2215f0b | |||
21e7c00f66 | |||
5daacc0a22 | |||
1323f6ead8 | |||
798f63aaff | |||
b0abc976a5 | |||
4c61e208ed | |||
c997694e10 | |||
a8d671556e | |||
2e4aeb57a8 | |||
e186a33340 | |||
1b5bdc0f07 | |||
5feec6ac0c |
66
Info.plist
Normal file
66
Info.plist
Normal 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>
|
@ -2,12 +2,15 @@
|
|||||||
GPX viewer and analyzer.
|
GPX viewer and analyzer.
|
||||||
|
|
||||||
* User-definable map sources.
|
* 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 multiple tracks in one view.
|
||||||
* Support for POI files.
|
* Support for POI files.
|
||||||
* Export to PDF.
|
* Export to PDF.
|
||||||
|
* Full-screen mode
|
||||||
* Native GUI for Windows, Mac OS X and Linux.
|
* Native GUI for Windows, Mac OS X and Linux.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
### Linux/OS X
|
### Linux/OS X
|
||||||
```shell
|
```shell
|
||||||
|
6
build/env.bat
Normal file
6
build/env.bat
Normal 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
6
build/env64.bat
Normal 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_
|
23
gpxsee.pro
23
gpxsee.pro
@ -1,4 +1,5 @@
|
|||||||
TARGET = GPXSee
|
TARGET = GPXSee
|
||||||
|
VERSION = 2.13
|
||||||
QT += core \
|
QT += core \
|
||||||
gui \
|
gui \
|
||||||
network
|
network
|
||||||
@ -36,7 +37,9 @@ HEADERS += src/config.h \
|
|||||||
src/palette.h \
|
src/palette.h \
|
||||||
src/heartrategraph.h \
|
src/heartrategraph.h \
|
||||||
src/range.h \
|
src/range.h \
|
||||||
src/cpuarch.h
|
src/cpuarch.h \
|
||||||
|
src/settings.h \
|
||||||
|
src/app.h
|
||||||
SOURCES += src/main.cpp \
|
SOURCES += src/main.cpp \
|
||||||
src/gui.cpp \
|
src/gui.cpp \
|
||||||
src/gpx.cpp \
|
src/gpx.cpp \
|
||||||
@ -62,8 +65,20 @@ SOURCES += src/main.cpp \
|
|||||||
src/waypointitem.cpp \
|
src/waypointitem.cpp \
|
||||||
src/palette.cpp \
|
src/palette.cpp \
|
||||||
src/heartrategraph.cpp \
|
src/heartrategraph.cpp \
|
||||||
src/range.cpp
|
src/range.cpp \
|
||||||
|
src/app.cpp
|
||||||
RESOURCES += gpxsee.qrc
|
RESOURCES += gpxsee.qrc
|
||||||
TRANSLATIONS = lang/gpxsee_cs.ts
|
TRANSLATIONS = lang/gpxsee_cs.ts
|
||||||
macx:ICON = icons/gpxsee.icns
|
macx {
|
||||||
win32:RC_FILE = gpxsee.rc
|
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\\\"
|
||||||
|
BIN
icons/gpx.icns
Normal file
BIN
icons/gpx.icns
Normal file
Binary file not shown.
BIN
icons/gpx.ico
Normal file
BIN
icons/gpx.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 361 KiB |
@ -19,6 +19,8 @@ InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
|||||||
|
|
||||||
; Registry key for uninstaller
|
; 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
|
; Start menu page configuration
|
||||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||||
@ -65,7 +67,7 @@ Section "GPXSee (required)" SEC_APP
|
|||||||
; Write the uninstall keys for Windows
|
; Write the uninstall keys for Windows
|
||||||
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
|
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
|
||||||
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
|
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"'
|
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||||
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
|
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
|
||||||
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
|
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
|
||||||
@ -79,6 +81,13 @@ Section "GPXSee (required)" SEC_APP
|
|||||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
|
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
|
||||||
!insertmacro MUI_STARTMENU_WRITE_END
|
!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
|
SectionEnd
|
||||||
|
|
||||||
Section "QT libs" SEC_QT
|
Section "QT libs" SEC_QT
|
||||||
@ -134,6 +143,11 @@ Section "Uninstall"
|
|||||||
Delete "$SMPROGRAMS\$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
|
SectionEnd
|
||||||
|
|
||||||
;-------------------------------
|
;-------------------------------
|
@ -19,6 +19,8 @@ InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
|||||||
|
|
||||||
; Registry key for uninstaller
|
; 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
|
; Start menu page configuration
|
||||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||||
@ -73,7 +75,7 @@ Section "GPXSee (required)" SEC_APP
|
|||||||
; Write the uninstall keys for Windows
|
; Write the uninstall keys for Windows
|
||||||
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
|
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
|
||||||
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
|
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"'
|
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||||
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
|
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
|
||||||
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
|
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
|
||||||
@ -87,6 +89,13 @@ Section "GPXSee (required)" SEC_APP
|
|||||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
|
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
|
||||||
!insertmacro MUI_STARTMENU_WRITE_END
|
!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
|
SectionEnd
|
||||||
|
|
||||||
Section "QT libs" SEC_QT
|
Section "QT libs" SEC_QT
|
||||||
@ -125,6 +134,7 @@ SectionEnd
|
|||||||
Section "Uninstall"
|
Section "Uninstall"
|
||||||
|
|
||||||
; Remove registry keys
|
; Remove registry keys
|
||||||
|
SetRegView 64
|
||||||
DeleteRegKey HKLM "${REGENTRY}"
|
DeleteRegKey HKLM "${REGENTRY}"
|
||||||
DeleteRegKey HKLM SOFTWARE\GPXSee
|
DeleteRegKey HKLM SOFTWARE\GPXSee
|
||||||
|
|
||||||
@ -137,6 +147,11 @@ Section "Uninstall"
|
|||||||
Delete "$SMPROGRAMS\$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
|
SectionEnd
|
||||||
|
|
||||||
;-------------------------------
|
;-------------------------------
|
48
src/app.cpp
Normal file
48
src/app.cpp
Normal 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
28
src/app.h
Normal 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
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#define APP_NAME "GPXSee"
|
#define APP_NAME "GPXSee"
|
||||||
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
|
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
|
||||||
#define APP_VERSION "2.12"
|
|
||||||
|
|
||||||
#define FONT_FAMILY "Arial"
|
#define FONT_FAMILY "Arial"
|
||||||
#define FONT_SIZE 12
|
#define FONT_SIZE 12
|
||||||
|
139
src/gui.cpp
139
src/gui.cpp
@ -14,9 +14,11 @@
|
|||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QSettings>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
|
#include "settings.h"
|
||||||
#include "gpx.h"
|
#include "gpx.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "maplist.h"
|
#include "maplist.h"
|
||||||
@ -84,6 +86,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
|||||||
widget->setLayout(layout);
|
widget->setLayout(layout);
|
||||||
setCentralWidget(widget);
|
setCentralWidget(widget);
|
||||||
|
|
||||||
|
setWindowIcon(QIcon(QPixmap(APP_ICON)));
|
||||||
setWindowTitle(APP_NAME);
|
setWindowTitle(APP_NAME);
|
||||||
setUnifiedTitleAndToolBarOnMac(true);
|
setUnifiedTitleAndToolBarOnMac(true);
|
||||||
|
|
||||||
@ -96,7 +99,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
|||||||
updateGraphTabs();
|
updateGraphTabs();
|
||||||
updateTrackView();
|
updateTrackView();
|
||||||
|
|
||||||
resize(600, 800);
|
readSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::loadMaps()
|
void GUI::loadMaps()
|
||||||
@ -141,9 +144,6 @@ void GUI::createMapActions()
|
|||||||
}
|
}
|
||||||
|
|
||||||
connect(sm, SIGNAL(mapped(int)), this, SLOT(mapChanged(int)));
|
connect(sm, SIGNAL(mapped(int)), this, SLOT(mapChanged(int)));
|
||||||
|
|
||||||
_mapActions.at(0)->setChecked(true);
|
|
||||||
_currentMap = _maps.at(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::createPOIFilesActions()
|
void GUI::createPOIFilesActions()
|
||||||
@ -161,7 +161,6 @@ QAction *GUI::createPOIFileAction(int index)
|
|||||||
QAction *a = new QAction(QFileInfo(_poi.files().at(index)).fileName(),
|
QAction *a = new QAction(QFileInfo(_poi.files().at(index)).fileName(),
|
||||||
this);
|
this);
|
||||||
a->setCheckable(true);
|
a->setCheckable(true);
|
||||||
a->setChecked(true);
|
|
||||||
|
|
||||||
_poiFilesSM->setMapping(a, index);
|
_poiFilesSM->setMapping(a, index);
|
||||||
connect(a, SIGNAL(triggered()), _poiFilesSM, SLOT(map()));
|
connect(a, SIGNAL(triggered()), _poiFilesSM, SLOT(map()));
|
||||||
@ -257,7 +256,6 @@ void GUI::createActions()
|
|||||||
_clearMapCacheAction->setEnabled(false);
|
_clearMapCacheAction->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
createMapActions();
|
createMapActions();
|
||||||
_showMapAction->setChecked(true);
|
|
||||||
|
|
||||||
_nextMapAction = new QAction(tr("Next map"), this);
|
_nextMapAction = new QAction(tr("Next map"), this);
|
||||||
_nextMapAction->setShortcut(NEXT_MAP_SHORTCUT);
|
_nextMapAction->setShortcut(NEXT_MAP_SHORTCUT);
|
||||||
@ -272,14 +270,12 @@ void GUI::createActions()
|
|||||||
// Settings actions
|
// Settings actions
|
||||||
_showGraphsAction = new QAction(tr("Show graphs"), this);
|
_showGraphsAction = new QAction(tr("Show graphs"), this);
|
||||||
_showGraphsAction->setCheckable(true);
|
_showGraphsAction->setCheckable(true);
|
||||||
_showGraphsAction->setChecked(true);
|
|
||||||
_showGraphsAction->setShortcut(SHOW_GRAPHS_SHORTCUT);
|
_showGraphsAction->setShortcut(SHOW_GRAPHS_SHORTCUT);
|
||||||
connect(_showGraphsAction, SIGNAL(triggered(bool)), this,
|
connect(_showGraphsAction, SIGNAL(triggered(bool)), this,
|
||||||
SLOT(showGraphs(bool)));
|
SLOT(showGraphs(bool)));
|
||||||
addAction(_showGraphsAction);
|
addAction(_showGraphsAction);
|
||||||
_showToolbarsAction = new QAction(tr("Show toolbars"), this);
|
_showToolbarsAction = new QAction(tr("Show toolbars"), this);
|
||||||
_showToolbarsAction->setCheckable(true);
|
_showToolbarsAction->setCheckable(true);
|
||||||
_showToolbarsAction->setChecked(true);
|
|
||||||
connect(_showToolbarsAction, SIGNAL(triggered(bool)), this,
|
connect(_showToolbarsAction, SIGNAL(triggered(bool)), this,
|
||||||
SLOT(showToolbars(bool)));
|
SLOT(showToolbars(bool)));
|
||||||
QActionGroup *ag = new QActionGroup(this);
|
QActionGroup *ag = new QActionGroup(this);
|
||||||
@ -287,7 +283,6 @@ void GUI::createActions()
|
|||||||
_metricUnitsAction = new QAction(tr("Metric"), this);
|
_metricUnitsAction = new QAction(tr("Metric"), this);
|
||||||
_metricUnitsAction->setCheckable(true);
|
_metricUnitsAction->setCheckable(true);
|
||||||
_metricUnitsAction->setActionGroup(ag);
|
_metricUnitsAction->setActionGroup(ag);
|
||||||
_metricUnitsAction->setChecked(true);
|
|
||||||
connect(_metricUnitsAction, SIGNAL(triggered()), this,
|
connect(_metricUnitsAction, SIGNAL(triggered()), this,
|
||||||
SLOT(setMetricUnits()));
|
SLOT(setMetricUnits()));
|
||||||
_imperialUnitsAction = new QAction(tr("Imperial"), this);
|
_imperialUnitsAction = new QAction(tr("Imperial"), this);
|
||||||
@ -403,9 +398,6 @@ void GUI::createTrackView()
|
|||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
_track->setFrameShape(QFrame::NoFrame);
|
_track->setFrameShape(QFrame::NoFrame);
|
||||||
#endif // Q_OS_WIN32
|
#endif // Q_OS_WIN32
|
||||||
|
|
||||||
if (_showMapAction->isChecked())
|
|
||||||
_track->setMap(_currentMap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::createTrackGraphs()
|
void GUI::createTrackGraphs()
|
||||||
@ -547,6 +539,7 @@ bool GUI::openFile(const QString &fileName)
|
|||||||
|
|
||||||
updateNavigationActions();
|
updateNavigationActions();
|
||||||
updateStatusBarInfo();
|
updateStatusBarInfo();
|
||||||
|
updateWindowTitle();
|
||||||
updateGraphTabs();
|
updateGraphTabs();
|
||||||
updateTrackView();
|
updateTrackView();
|
||||||
|
|
||||||
@ -718,6 +711,7 @@ void GUI::reloadFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateStatusBarInfo();
|
updateStatusBarInfo();
|
||||||
|
updateWindowTitle();
|
||||||
updateGraphTabs();
|
updateGraphTabs();
|
||||||
updateTrackView();
|
updateTrackView();
|
||||||
if (_files.isEmpty())
|
if (_files.isEmpty())
|
||||||
@ -748,6 +742,7 @@ void GUI::closeAll()
|
|||||||
|
|
||||||
_fileActionGroup->setEnabled(false);
|
_fileActionGroup->setEnabled(false);
|
||||||
updateStatusBarInfo();
|
updateStatusBarInfo();
|
||||||
|
updateWindowTitle();
|
||||||
updateGraphTabs();
|
updateGraphTabs();
|
||||||
updateTrackView();
|
updateTrackView();
|
||||||
}
|
}
|
||||||
@ -853,6 +848,15 @@ void GUI::updateStatusBarInfo()
|
|||||||
_timeLabel->setText(timeSpan(_time));
|
_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)
|
void GUI::mapChanged(int index)
|
||||||
{
|
{
|
||||||
_currentMap = _maps.at(index);
|
_currentMap = _maps.at(index);
|
||||||
@ -1050,3 +1054,114 @@ void GUI::keyPressEvent(QKeyEvent *event)
|
|||||||
openFile(file);
|
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;
|
||||||
|
}
|
||||||
|
@ -83,11 +83,17 @@ private:
|
|||||||
bool loadFile(const QString &fileName);
|
bool loadFile(const QString &fileName);
|
||||||
void saveFile(const QString &fileName);
|
void saveFile(const QString &fileName);
|
||||||
void updateStatusBarInfo();
|
void updateStatusBarInfo();
|
||||||
|
void updateWindowTitle();
|
||||||
void updateNavigationActions();
|
void updateNavigationActions();
|
||||||
void updateGraphTabs();
|
void updateGraphTabs();
|
||||||
void updateTrackView();
|
void updateTrackView();
|
||||||
|
|
||||||
void keyPressEvent(QKeyEvent * event);
|
void keyPressEvent(QKeyEvent * event);
|
||||||
|
void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
|
int mapIndex(const QString &name);
|
||||||
|
void readSettings();
|
||||||
|
void writeSettings();
|
||||||
|
|
||||||
QMenu *_fileMenu;
|
QMenu *_fileMenu;
|
||||||
QMenu *_helpMenu;
|
QMenu *_helpMenu;
|
||||||
|
27
src/main.cpp
27
src/main.cpp
@ -1,28 +1,9 @@
|
|||||||
#include <QApplication>
|
#include "app.h"
|
||||||
#include <QTranslator>
|
|
||||||
#include <QLocale>
|
|
||||||
#include "gui.h"
|
|
||||||
#include "icons.h"
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
App app(argc, argv);
|
||||||
|
app.run();
|
||||||
|
|
||||||
QString locale = QLocale::system().name();
|
return 0;
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
22
src/settings.h
Normal file
22
src/settings.h
Normal 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
|
Reference in New Issue
Block a user