Skip to content

Commit

Permalink
Added support for Qt6
Browse files Browse the repository at this point in the history
Removed support for Qt4 and Qt5 < 5.12
  • Loading branch information
tumic0 committed Dec 22, 2020
1 parent b5972c8 commit 97bea8c
Show file tree
Hide file tree
Showing 81 changed files with 770 additions and 986 deletions.
10 changes: 5 additions & 5 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
version: 7.38.{build}
version: 8.0.{build}

configuration:
- Release

image:
- Visual Studio 2017
- Visual Studio 2019

environment:
NSISDIR: C:\Program Files (x86)\NSIS
matrix:
- QTDIR: C:\Qt\5.13\msvc2017
- QTDIR: C:\Qt\5.15\msvc2019
NSI: gpxsee.nsi
VCVARS: vcvars32.bat
OPENSSLDIR: C:\OpenSSL-v111-Win32\bin
LIBCRYPTO: libssl-1_1.dll
LIBSSL: libcrypto-1_1.dll
- QTDIR: C:\Qt\5.13\msvc2017_64
- QTDIR: C:\Qt\5.15\msvc2019_64
NSI: gpxsee64.nsi
VCVARS: vcvars64.bat
OPENSSLDIR: C:\OpenSSL-v111-Win64\bin
Expand All @@ -26,7 +26,7 @@ install:
- cmd: >-
set PATH=%QTDIR%\bin;%NSISDIR%;%PATH%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\"%VCVARS%
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\"%VCVARS%
build_script:
- cmd: >-
Expand Down
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ os:
- linux
- osx

dist: focal

before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -qq update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi

install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install qt; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libqt4-dev libqt4-opengl-dev; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install qtbase5-dev libqt5opengl5-dev qttools5-dev-tools; fi

script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then PATH=/usr/local/opt/qt/bin/:${PATH}; fi
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ GPXSee is a Qt-based GPS log file viewer and analyzer that supports all common G

## Build
Build requirements:
* Qt 4.8 or QT 5.x (Qt >= 5.10.1 recommended for all features)
* C++03 or newer compiler (tested: msvc2015, gcc >= 4.8, clang/Apple LLVM version 8.1.0)
* Qt5 >= 5.12 or Qt 6.x
* C++11 or newer compiler (tested: msvc2017, gcc 7.5.0, clang/Apple LLVM version 10.0.0)

Build steps:
```shell
Expand Down
36 changes: 13 additions & 23 deletions gpxsee.pro
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@ unix:!macx {
} else {
TARGET = GPXSee
}
VERSION = 7.38
VERSION = 8.0

QT += core \
gui \
network \
sql \
concurrent
greaterThan(QT_MAJOR_VERSION, 4) {
QT += widgets
QT += printsupport
}
lessThan(QT_MAJOR_VERSION, 5) {QT += opengl}
equals(QT_MAJOR_VERSION, 5) : lessThan(QT_MINOR_VERSION, 4) {QT += opengl}
concurrent \
widgets \
printsupport
greaterThan(QT_MAJOR_VERSION, 5) {QT += openglwidgets}

INCLUDEPATH += ./src
HEADERS += src/common/config.h \
Expand All @@ -27,10 +24,10 @@ HEADERS += src/common/config.h \
src/GUI/planeitem.h \
src/GUI/popup.h \
src/common/garmin.h \
src/common/staticassert.h \
src/common/coordinates.h \
src/common/range.h \
src/common/rectc.h \
src/common/textcodec.h \
src/common/wgs84.h \
src/common/util.h \
src/common/rtree.h \
Expand Down Expand Up @@ -58,7 +55,6 @@ HEADERS += src/common/config.h \
src/GUI/heartrategraph.h \
src/GUI/trackinfo.h \
src/GUI/fileselectwidget.h \
src/GUI/margins.h \
src/GUI/temperaturegraph.h \
src/GUI/graphtab.h \
src/GUI/trackitem.h \
Expand All @@ -74,7 +70,6 @@ HEADERS += src/common/config.h \
src/GUI/optionsdialog.h \
src/GUI/colorbox.h \
src/GUI/stylecombobox.h \
src/GUI/opengl.h \
src/GUI/timetype.h \
src/GUI/percentslider.h \
src/GUI/elevationgraphitem.h \
Expand All @@ -86,7 +81,6 @@ HEADERS += src/common/config.h \
src/GUI/gearratiographitem.h \
src/GUI/oddspinbox.h \
src/GUI/settings.h \
src/GUI/cpuarch.h \
src/GUI/searchpointer.h \
src/GUI/mapview.h \
src/GUI/font.h \
Expand Down Expand Up @@ -208,7 +202,10 @@ HEADERS += src/common/config.h \
src/data/address.h \
src/data/smlparser.h \
src/GUI/pdfexportdialog.h \
src/GUI/pngexportdialog.h
src/GUI/pngexportdialog.h \
src/data/geojsonparser.h \
src/GUI/timezoneinfo.h

SOURCES += src/main.cpp \
src/GUI/axislabelitem.cpp \
src/GUI/mapitem.cpp \
Expand All @@ -217,6 +214,7 @@ SOURCES += src/main.cpp \
src/common/coordinates.cpp \
src/common/rectc.cpp \
src/common/range.cpp \
src/common/textcodec.cpp \
src/common/util.cpp \
src/common/greatcircle.cpp \
src/common/programpaths.cpp \
Expand Down Expand Up @@ -362,19 +360,11 @@ SOURCES += src/main.cpp \
src/data/gpiparser.cpp \
src/data/smlparser.cpp \
src/GUI/pdfexportdialog.cpp \
src/GUI/pngexportdialog.cpp

greaterThan(QT_MAJOR_VERSION, 4) {
HEADERS += src/data/geojsonparser.h
SOURCES += src/data/geojsonparser.cpp
}
equals(QT_MAJOR_VERSION, 5):greaterThan(QT_MINOR_VERSION, 4) {
HEADERS += src/GUI/timezoneinfo.h
}
src/GUI/pngexportdialog.cpp \
src/data/geojsonparser.cpp

DEFINES += APP_VERSION=\\\"$$VERSION\\\" \
QT_NO_DEPRECATED_WARNINGS
DEFINES *= QT_USE_QSTRINGBUILDER

RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_en.ts \
Expand Down
2 changes: 1 addition & 1 deletion pkg/gpxsee.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "7.38"
!define VERSION "8.0"

; The file to write
OutFile "GPXSee-${VERSION}.exe"
Expand Down
2 changes: 1 addition & 1 deletion pkg/gpxsee64.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "7.38"
!define VERSION "8.0"

; The file to write
OutFile "GPXSee-${VERSION}_x64.exe"
Expand Down
9 changes: 5 additions & 4 deletions src/GUI/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#include <QNetworkAccessManager>
#include <QLibraryInfo>
#include <QSettings>
#include <QSurfaceFormat>
#include "common/programpaths.h"
#include "common/config.h"
#include "map/downloader.h"
#include "map/ellipsoid.h"
#include "map/gcs.h"
#include "map/pcs.h"
#include "data/dem.h"
#include "opengl.h"
#include "gui.h"
#include "settings.h"
#include "mapaction.h"
Expand Down Expand Up @@ -52,17 +52,18 @@ App::App(int &argc, char **argv) : QApplication(argc, argv)
"QThreadStorage: Thread X exited after QThreadStorage Y destroyed" */
Downloader::setNetworkManager(new QNetworkAccessManager(this));
DEM::setDir(ProgramPaths::demDir());
OPENGL_SET_FORMAT(4, 8);
QSurfaceFormat fmt;
fmt.setStencilBufferSize(8);
fmt.setSamples(4);
QSurfaceFormat::setDefaultFormat(fmt);

loadDatums();
loadPCSs();

QSettings settings(qApp->applicationName(), qApp->applicationName());
settings.beginGroup(OPTIONS_SETTINGS_GROUP);
#ifdef ENABLE_HTTP2
Downloader::enableHTTP2(settings.value(ENABLE_HTTP2_SETTING,
ENABLE_HTTP2_DEFAULT).toBool());
#endif // ENABLE_HTTP2
Downloader::setTimeout(settings.value(CONNECTION_TIMEOUT_SETTING,
CONNECTION_TIMEOUT_DEFAULT).toInt());
settings.endGroup();
Expand Down
3 changes: 2 additions & 1 deletion src/GUI/colorbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ void ColorBox::mousePressEvent(QMouseEvent *event)
if (event->button() != Qt::LeftButton)
return;
QColorDialog::ColorDialogOptions options = _alpha
? QColorDialog::ShowAlphaChannel : (QColorDialog::ColorDialogOptions)0;
? QColorDialog::ColorDialogOptions(QColorDialog::ShowAlphaChannel)
: QColorDialog::ColorDialogOptions();
QColor color = QColorDialog::getColor(_color, this, QString(), options);
if (color.isValid()) {
_color = color;
Expand Down
42 changes: 0 additions & 42 deletions src/GUI/cpuarch.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/GUI/fileselectwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ FileSelectWidget::FileSelectWidget(QWidget *parent) : QWidget(parent)
connect(_button, SIGNAL(clicked()), this, SLOT(browse()));

QHBoxLayout *layout = new QHBoxLayout();
layout->setMargin(0);
layout->setContentsMargins(QMargins());
layout->addWidget(_edit);
layout->addWidget(_button);
setLayout(layout);
Expand Down
20 changes: 14 additions & 6 deletions src/GUI/graphview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#include <QGraphicsSimpleTextItem>
#include <QPalette>
#include <QLocale>
#include <QOpenGLWidget>
#include "data/graph.h"
#include "opengl.h"
#include "axisitem.h"
#include "axislabelitem.h"
#include "slideritem.h"
Expand Down Expand Up @@ -351,23 +351,31 @@ void GraphView::wheelEvent(QWheelEvent *e)
{
static int deg = 0;

deg += e->delta() / 8;
deg += e->angleDelta().y() / 8;
if (qAbs(deg) < 15)
return;
deg = 0;

#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QPointF pos = mapToScene(e->pos());
#else // QT 5.15
QPointF pos = mapToScene(e->position().toPoint());
#endif // QT 5.15
QRectF gr(_grid->boundingRect());
QPointF r(pos.x() / gr.width(), pos.y() / gr.height());

_zoom = (e->delta() > 0) ? _zoom * 1.25 : qMax(_zoom / 1.25, 1.0);
_zoom = (e->angleDelta().y() > 0) ? _zoom * 1.25 : qMax(_zoom / 1.25, 1.0);
redraw();

QRectF ngr(_grid->boundingRect());
QPointF npos(mapFromScene(QPointF(r.x() * ngr.width(),
r.y() * ngr.height())));
QScrollBar *sb = horizontalScrollBar();
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
sb->setSliderPosition(sb->sliderPosition() + npos.x() - e->pos().x());
#else // QT 5.15
sb->setSliderPosition(sb->sliderPosition() + npos.x() - e->position().x());
#endif // QT 5.15

QGraphicsView::wheelEvent(e);
}
Expand Down Expand Up @@ -456,8 +464,8 @@ void GraphView::updateSliderInfo()
'f', _precision) + UNIT_SPACE + _yUnits);
if (cardinal && cardinal->secondaryGraph()) {
qreal delta = y - cardinal->secondaryGraph()->yAtX(_sliderPos);
yText += " " + QChar(0x0394) + l.toString(-delta * _yScale + _yOffset,
'f', _precision) + UNIT_SPACE + _yUnits;
yText += QString(" ") + QChar(0x0394) + l.toString(-delta * _yScale
+ _yOffset, 'f', _precision) + UNIT_SPACE + _yUnits;
}
_sliderInfo->setText(xText, yText);
}
Expand Down Expand Up @@ -537,7 +545,7 @@ void GraphView::setGraphWidth(int width)
void GraphView::useOpenGL(bool use)
{
if (use)
setViewport(new OPENGL_WIDGET);
setViewport(new QOpenGLWidget);
else
setViewport(new QWidget);
}
Expand Down
Loading

0 comments on commit 97bea8c

Please sign in to comment.