diff --git a/gpxsee.pro b/gpxsee.pro index f60e1832..16b3b139 100644 --- a/gpxsee.pro +++ b/gpxsee.pro @@ -37,7 +37,8 @@ HEADERS += src/config.h \ src/heartrategraph.h \ src/range.h \ src/cpuarch.h \ - src/settings.h + src/settings.h \ + src/app.h SOURCES += src/main.cpp \ src/gui.cpp \ src/gpx.cpp \ @@ -63,7 +64,8 @@ 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 diff --git a/pkg/mac/Info.plist b/pkg/mac/Info.plist new file mode 100644 index 00000000..9242110f --- /dev/null +++ b/pkg/mac/Info.plist @@ -0,0 +1,66 @@ + + + + + NSPrincipalClass + NSApplication + CFBundleIconFile + gpxsee.icns + CFBundlePackageType + APPL + CFBundleShortVersionString + 2.13 + CFBundleSignature + ???? + CFBundleExecutable + GPXSee + CFBundleIdentifier + cz.wz.tumic.GPXSee + + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + gpx + + CFBundleTypeMIMETypes + + application/gpx+xml + + CFBundleTypeIconFile + + CFBundleTypeName + GPS Exchange Format + CFBundleTypeRole + Viewer + + + + UTImportedTypeDeclarations + + + UTTypeIdentifier + com.topografix.gpx + UTTypeReferenceURL + http://www.topografix.com/GPX/1/1 + UTTypeDescription + GPS Exchange Format + UTTypeConformsTo + + public.xml + + UTTypeTagSpecification + + public.filename-extension + + gpx + + public.mime-type + application/gpx+xml + + + + + + diff --git a/gpxsee.nsi b/pkg/win/gpxsee.nsi similarity index 95% rename from gpxsee.nsi rename to pkg/win/gpxsee.nsi index ded2cdcf..0eb6342a 100644 --- a/gpxsee.nsi +++ b/pkg/win/gpxsee.nsi @@ -65,7 +65,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 diff --git a/gpxsee64.nsi b/pkg/win/gpxsee64.nsi similarity index 95% rename from gpxsee64.nsi rename to pkg/win/gpxsee64.nsi index 6f637994..46cf2824 100644 --- a/gpxsee64.nsi +++ b/pkg/win/gpxsee64.nsi @@ -73,7 +73,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 diff --git a/src/app.cpp b/src/app.cpp new file mode 100644 index 00000000..793cb29a --- /dev/null +++ b/src/app.cpp @@ -0,0 +1,50 @@ +#include +#include +#include +#include +#include "gui.h" +#include "icons.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->setWindowIcon(QIcon(QPixmap(APP_ICON))); + _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(event); + return _gui->openFile(e->file()); + } + + return QApplication::event(event); +} diff --git a/src/app.h b/src/app.h new file mode 100644 index 00000000..d8c13ae0 --- /dev/null +++ b/src/app.h @@ -0,0 +1,28 @@ +#ifndef APP_H +#define APP_H + +#include + +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 diff --git a/src/config.h b/src/config.h index 52ecca13..82268744 100644 --- a/src/config.h +++ b/src/config.h @@ -8,7 +8,7 @@ #define APP_NAME "GPXSee" #define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee" -#define APP_VERSION "2.12" +#define APP_VERSION "2.13" #define FONT_FAMILY "Arial" #define FONT_SIZE 12 diff --git a/src/gui.cpp b/src/gui.cpp index a388983d..8f329451 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include diff --git a/src/main.cpp b/src/main.cpp index e18f76c8..585f02ce 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,28 +1,9 @@ -#include -#include -#include -#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(QString::fromLocal8Bit(argv[i])); - - return app.exec(); + return 0; }