From a9668ca86e6e811e3039dce0f6b3de286edcaf72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Tue, 6 Dec 2016 01:48:26 +0100 Subject: [PATCH] Added options dialogue --- gpxsee.pro | 11 +- gpxsee.qrc | 3 + icons/flag_48.png | Bin 0 -> 7299 bytes icons/preferences-desktop-display.png | Bin 0 -> 3341 bytes icons/system-run.png | Bin 0 -> 3221 bytes src/app.cpp | 18 ++ src/colorbox.cpp | 68 +++++++ src/colorbox.h | 29 +++ src/coordinates.cpp | 32 ++++ src/coordinates.h | 1 + src/exportdialog.cpp | 48 +++-- src/exportdialog.h | 13 +- src/graphitem.cpp | 20 +- src/graphitem.h | 2 + src/graphview.cpp | 28 ++- src/graphview.h | 6 +- src/gui.cpp | 265 +++++++++++++++++++------- src/gui.h | 11 +- src/icons.h | 9 +- src/optionsdialog.cpp | 203 ++++++++++++++++++++ src/optionsdialog.h | 60 ++++++ src/palette.cpp | 66 ++----- src/palette.h | 19 +- src/pathitem.cpp | 31 ++- src/pathitem.h | 10 +- src/pathview.cpp | 82 +++++++- src/pathview.h | 11 ++ src/poi.cpp | 40 ++-- src/poi.h | 6 +- src/routeitem.cpp | 2 - src/settings.h | 61 ++++++ src/sliderinfoitem.cpp | 4 +- src/stylecombobox.cpp | 61 ++++++ src/stylecombobox.h | 19 ++ 34 files changed, 1044 insertions(+), 195 deletions(-) create mode 100644 icons/flag_48.png create mode 100644 icons/preferences-desktop-display.png create mode 100644 icons/system-run.png create mode 100644 src/colorbox.cpp create mode 100644 src/colorbox.h create mode 100644 src/optionsdialog.cpp create mode 100644 src/optionsdialog.h create mode 100644 src/stylecombobox.cpp create mode 100644 src/stylecombobox.h diff --git a/gpxsee.pro b/gpxsee.pro index 3d6faa7f..1017efae 100644 --- a/gpxsee.pro +++ b/gpxsee.pro @@ -5,6 +5,7 @@ QT += core \ network greaterThan(QT_MAJOR_VERSION, 4): QT += widgets greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport +lessThan(QT_MAJOR_VERSION, 5) : QT += opengl HEADERS += src/config.h \ src/icons.h \ src/gui.h \ @@ -70,7 +71,10 @@ HEADERS += src/config.h \ src/cadencegraph.h \ src/powergraph.h \ src/igcparser.h \ - src/nmeaparser.h + src/nmeaparser.h \ + src/optionsdialog.h \ + src/colorbox.h \ + src/stylecombobox.h SOURCES += src/main.cpp \ src/gui.cpp \ src/poi.cpp \ @@ -121,7 +125,10 @@ SOURCES += src/main.cpp \ src/powergraph.cpp \ src/igcparser.cpp \ src/path.cpp \ - src/nmeaparser.cpp + src/nmeaparser.cpp \ + src/optionsdialog.cpp \ + src/colorbox.cpp \ + src/stylecombobox.cpp RESOURCES += gpxsee.qrc TRANSLATIONS = lang/gpxsee_cs.ts macx { diff --git a/gpxsee.qrc b/gpxsee.qrc index ac4aedfb..c27f8dd0 100644 --- a/gpxsee.qrc +++ b/gpxsee.qrc @@ -15,6 +15,9 @@ icons/arrow-right-double.png icons/view-fullscreen.png icons/office-chart-line-stacked.png + icons/preferences-desktop-display.png + icons/flag_48.png + icons/system-run.png lang/gpxsee_cs.qm diff --git a/icons/flag_48.png b/icons/flag_48.png new file mode 100644 index 0000000000000000000000000000000000000000..8d450bf2faa989a486a4733a8af0babf9a98cc1d GIT binary patch literal 7299 zcmV-}9DL)6P)fTBvN4(1L@4W($& z8mcj;hM317L4+7%PEtukWS)~V?EO3UKKDP(`dRg?^{#il@B8?Emi1ZJ-g2_t*S@cP z;)LS~iLNC8{9YHZTQ3*|_^Iqe!N<`fV+6-SJ);E;>)wwP?1_Ub-$}oL_BuC^rt>WS z6!x3|GAsyxORb5GrwQ_ZpSoC}X`R~(G!1%s&xMTQC7|tQKLMWQ2_aO?8#*#tH2#)~ z9Clhz9OD@x01V**$P~Q^85$+PGMXm9v;4cMTTS3}Z2{X+=PLnF?Yy8*Uu(O2$NiV^anMfbzhyohQ<|p*7!W{D!Xs9aFw|trHR z{>-Cx_>T{vO2{DqysQGiBUeC&O%qKMOd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qzZrs0|lr9SAqeV`#KCC>paU-H$cED~!5f{5e$zQnmLQ0j3_TgQTxNZ6M4%l+Pn~D^$3*F%NgDwWx==u88Z;6B ze$511AA1%GG!1$Rui#TbK;J6;?TcsmH+KN(0IH4*#kj0?0T*nm3y0wK2OvRFJ`_R3 zPhf(KnXdEf8`uTf0k{$>?JjM4!YH&$+p5?qUHOFb4rzN8JES#fwMvaDwL@Bc!s}U| za6Qsh&OiA&prC409foZ>8cKBn5Uc|%*C~Rp4zOP50<1dy;L1$t6VhiO{U3g#o29w5 zO~L;^8iwdVCaua283l(9WJ09lq-FT`F4G9py&CdDrBkG5 zxvWl?b&;%ZNL!>ENjH%u={3^9(n->nr0>h?OOti7^iApI(s!lh&UIXq^%3dA(ud^v z^|J0Jy-6OwDeHUE#V%_jp45QCDs$@8LkadEzB3&J>jFa_dX}MFdLb^!0nmnJy@Lv-y?fCl^Bsl_jjPxFP{4?p+(y7w2 zv8=81E$I_*DoEzWa+{x zjq6qAdiO|csFME&k2R|oMo6du0000YdQ@0+Q*UN;cVTj6004N}D=#nC%goCzPEIUH d)ypqR2LLwM23QbN%3J^d002ovPDHLkV1j8F^%4L8 literal 0 HcmV?d00001 diff --git a/icons/preferences-desktop-display.png b/icons/preferences-desktop-display.png new file mode 100644 index 0000000000000000000000000000000000000000..3334a429916376facc4bd09232d339b49b684fa3 GIT binary patch literal 3341 zcmV+o4f67dP)}`5Dv9MPB56?~wNhHON+60LO4Pu!!Psj_$42|0`MyU?*@SHKmFw2YNPjHNIo<5Aj@mEu%>P&7%;{Jmp16|-stjN zY@Tr5l;^Y#*XoM-_`b&I%JtgB_R+C*24g^=XdL!_{{B4=cmPVPJ@3E%gULj~&=0^}H|*i{;X{1>>0P{k+3#@kmG|H| zNgT()aRdCuFej$*2#!MS_ja!fAULwg&+zL@Z(_~j>)7A;5JSU<89ebxin%7@ z%&1LzHlh$|J&Z7gqN3!h3ec@hwImZBzS0%Is)g1u0bSRvq>#3uv1|b!ZLCniZp>w;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@aZTCIyWx|qM}bhQ0Q@pi9O3WRiZk_PkaXR$+_ML@NA>tJ7BAG*gPY@lFhL<2^$c{U~* z13F|zvlSo^2o|zM;*g-wAd9iifX$kZ+13Ld!x00pp z2mP(&8VvqXgacwe;=ySXAQP4hDVdM&NWd3gjKs#rp{eSCu*eY1bQb*9&u`eBEplUe z1-Gxf_S*2(u1+YeC_-0R3x@*^!?x{jjv@&wTOigtIy$;8adBDC5r}K1ZNcS=LA-7S z2JS?OJc6*hBNcLYS3Zh5|0-J~`M%Cn1Bqw{ba~lu?BsC^PUKJ$JlV!2##!4sTEK`U zQKBz`z5DlI10ToLI)lwD8^i}cfp{8gS~taln>j-90M3hg-1bej;2-YZZC=mv`WUZU zhFFYvY$}QA|4m3DPuAt;;EnU~r9{p6`O`6{t$%vsjp2mk1Zxl41yf@UgJg9A?B4qk z9Qo>VI2LpaC#krS1dsS7Un0FW*@E-LvOe4|K=52vuJrTSx^d6{?##+H7W^oCx|3jI{>F{^~1B7{5XSCz&U~ zzq51a2uCQYz{%QR3hR0o9eaX4>nw5yh5layZ5snD^pIia__YkeOWtfqZ`wt$pke`&ugbfP|MT9|C zPC62)L|ahDOx7e#BKRLZ1l~NM39sWLxb_YX0u1H_{JakF4B{zTN^9u%wTNF)tfl+b z&~r%UT@lM^@RQ5u!Q1u#J;8}C+iH79M{o2x?Ge#Yw+z))IGoOdP@x?0oe;; zA{Q-M@<)0emtN;a@8eAG`@o$1K0q_@7=7?c+E}E~+-X+XOrzS{^J%bby5F6i_cXoE zncm0lp8e2G$vD#5TuMt}1+C|Cte7NsPV{`c`}%*Y+z #include #include +#include +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#include +#else // QT 5 +#include +#endif // QT 5 #include "gui.h" #include "app.h" @@ -21,6 +27,18 @@ App::App(int &argc, char **argv) : QApplication(argc, argv), QNetworkProxyFactory::setUseSystemConfiguration(true); +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + QGLFormat fmt; + fmt.setSamples(10); + QGLFormat::setDefaultFormat(fmt); +#else + QSurfaceFormat fmt; + fmt.setSamples(10); + QSurfaceFormat::setDefaultFormat(fmt); +#endif + + QPixmapCache::setCacheLimit(65536); + _gui = new GUI(); } diff --git a/src/colorbox.cpp b/src/colorbox.cpp new file mode 100644 index 00000000..86314de8 --- /dev/null +++ b/src/colorbox.cpp @@ -0,0 +1,68 @@ +#include +#include +#include +#include +#include +#include "colorbox.h" + + +ColorBox::ColorBox(QWidget *parent) : QWidget(parent) +{ + _color = Qt::red; + setSizePolicy(QSizePolicy::QSizePolicy::Minimum, QSizePolicy::Fixed); +} + +QSize ColorBox::sizeHint() const +{ + static QSize size; + if (size.isValid()) + return size; + + QComboBox cb; + size = cb.sizeHint(); + return size; +} + +void ColorBox::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event); + + QStylePainter painter(this); + + QStyleOptionComboBox option; + option.initFrom(this); + +#if defined(Q_OS_MAC) || defined(Q_OS_WIN32) + painter.setBrush(_color); + painter.drawPrimitive(QStyle::PE_Frame, option); +#else // Q_OS_MAC || Q_OS_WIN32 +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + painter.setBrush(_color); + painter.drawRect(event->rect().adjusted(-1, -1, 0, 0)); + painter.drawPrimitive(QStyle::PE_FrameLineEdit, option); +#else // QT 5 + option.palette.setBrush(QPalette::Base, _color); + painter.drawPrimitive(QStyle::PE_FrameLineEdit, option); +#endif // QT 5 +#endif // Q_OS_MAC || Q_OS_WIN32 +} + +void ColorBox::mousePressEvent(QMouseEvent *event) +{ + if (event->button() != Qt::LeftButton) + return; + + QColor color = QColorDialog::getColor(_color, this, QString(), + QColorDialog::ShowAlphaChannel); + if (color.isValid()) { + _color = color; + update(); + emit colorChanged(_color); + } +} + +void ColorBox::setColor(const QColor &color) +{ + _color = color; + update(); +} diff --git a/src/colorbox.h b/src/colorbox.h new file mode 100644 index 00000000..f596fcbc --- /dev/null +++ b/src/colorbox.h @@ -0,0 +1,29 @@ +#ifndef COLORBOX_H +#define COLORBOX_H + +#include + +class ColorBox : public QWidget +{ + Q_OBJECT + +public: + ColorBox(QWidget *parent = 0); + + const QColor &color() const {return _color;} + void setColor(const QColor &color); + + QSize sizeHint() const; + +signals: + void colorChanged(const QColor &color); + +protected: + void mousePressEvent(QMouseEvent *event); + void paintEvent(QPaintEvent *event); + +private: + QColor _color; +}; + +#endif // COLORBOX_H diff --git a/src/coordinates.cpp b/src/coordinates.cpp index d4603f47..239092fe 100644 --- a/src/coordinates.cpp +++ b/src/coordinates.cpp @@ -2,6 +2,10 @@ #include "wgs84.h" #include "coordinates.h" +#define MIN_LAT deg2rad(-90.0) +#define MAX_LAT deg2rad(90.0) +#define MIN_LON deg2rad(-180.0) +#define MAX_LON deg2rad(180.0) qreal Coordinates::distanceTo(const Coordinates &c) const { @@ -35,3 +39,31 @@ QDebug operator<<(QDebug dbg, const Coordinates &coordinates) return dbg.maybeSpace(); } + +QPair Coordinates::boundingRect(qreal distance) const +{ + qreal radDist = distance / WGS84_RADIUS; + + qreal minLat = deg2rad(_lat) - radDist; + qreal maxLat = deg2rad(_lat) + radDist; + + qreal minLon, maxLon; + if (minLat > MIN_LAT && maxLat < MAX_LAT) { + qreal deltaLon = asin(sin(radDist) / cos(_lat)); + minLon = deg2rad(_lon) - deltaLon; + if (minLon < MIN_LON) + minLon += 2.0 * M_PI; + maxLon = deg2rad(_lon) + deltaLon; + if (maxLon > MAX_LON) + maxLon -= 2.0 * M_PI; + } else { + // a pole is within the distance + minLat = qMax(minLat, MIN_LAT); + maxLat = qMin(maxLat, MAX_LAT); + minLon = MIN_LON; + maxLon = MAX_LON; + } + + return QPair(Coordinates(rad2deg(minLon), + rad2deg(minLat)), Coordinates(rad2deg(maxLon), rad2deg(maxLat))); +} diff --git a/src/coordinates.h b/src/coordinates.h index b9bc3f93..83a26322 100644 --- a/src/coordinates.h +++ b/src/coordinates.h @@ -26,6 +26,7 @@ public: && _lat <= 90.0) ? true : false;} qreal distanceTo(const Coordinates &c) const; + QPair boundingRect(qreal distance) const; QPointF toMercator() const; static Coordinates fromMercator(const QPointF &m); diff --git a/src/exportdialog.cpp b/src/exportdialog.cpp index 5040c9f0..4c272afc 100644 --- a/src/exportdialog.cpp +++ b/src/exportdialog.cpp @@ -17,17 +17,17 @@ #include "exportdialog.h" -ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent) - : QDialog(parent), _printer(printer) +ExportDialog::ExportDialog(Export *exp, QWidget *parent) + : QDialog(parent), _export(exp) { int index; - _units = (QLocale::system().measurementSystem() - == QLocale::ImperialSystem) ? QPrinter::Inch : QPrinter::Millimeter; + _units = QLocale::system().measurementSystem() == QLocale::ImperialSystem ? + QPrinter::Inch : QPrinter::Millimeter; _fileSelect = new FileSelectWidget(); _fileSelect->setFilter(tr("PDF files (*.pdf);;All files (*)")); - _fileSelect->setFile(_printer->outputFileName()); + _fileSelect->setFile(_export->fileName); _paperSize = new QComboBox(); _paperSize->addItem("A3", QPrinter::A3); @@ -36,7 +36,7 @@ ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent) _paperSize->addItem("Tabloid", QPrinter::Tabloid); _paperSize->addItem("Legal", QPrinter::Legal); _paperSize->addItem("Letter", QPrinter::Letter); - if ((index = _paperSize->findData(_printer->paperSize())) >= 0) + if ((index = _paperSize->findData(_export->paperSize)) >= 0) _paperSize->setCurrentIndex(index); _portrait = new QRadioButton(tr("Portrait")); @@ -44,32 +44,34 @@ ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent) QHBoxLayout *orientationLayout = new QHBoxLayout(); orientationLayout->addWidget(_portrait); orientationLayout->addWidget(_landscape); - if (_printer->orientation() == QPrinter::Portrait) + if (_export->orientation == QPrinter::Portrait) _portrait->setChecked(true); else _landscape->setChecked(true); - qreal top, bottom, left, right; - - _printer->getPageMargins(&left, &top, &right, &bottom, _units); - QString us = _units == QPrinter::Inch ? tr("in") : tr("mm"); _topMargin = new QDoubleSpinBox(); _bottomMargin = new QDoubleSpinBox(); _leftMargin = new QDoubleSpinBox(); _rightMargin = new QDoubleSpinBox(); - _topMargin->setValue(top); + QString us = (_units == QPrinter::Inch) ? tr("in") : tr("mm"); _topMargin->setSuffix(UNIT_SPACE + us); - _bottomMargin->setValue(bottom); _bottomMargin->setSuffix(UNIT_SPACE + us); - _leftMargin->setValue(left); _leftMargin->setSuffix(UNIT_SPACE + us); - _rightMargin->setValue(right); _rightMargin->setSuffix(UNIT_SPACE + us); if (_units == QPrinter::Inch) { + _topMargin->setValue(_export->margins.top() * MM2IN); + _bottomMargin->setValue(_export->margins.bottom() * MM2IN); + _leftMargin->setValue(_export->margins.left() * MM2IN); + _rightMargin->setValue(_export->margins.right() * MM2IN); _topMargin->setSingleStep(0.1); _bottomMargin->setSingleStep(0.1); _leftMargin->setSingleStep(0.1); _rightMargin->setSingleStep(0.1); + } else { + _topMargin->setValue(_export->margins.top()); + _bottomMargin->setValue(_export->margins.bottom()); + _leftMargin->setValue(_export->margins.left()); + _rightMargin->setValue(_export->margins.right()); } QGridLayout *marginsLayout = new QGridLayout(); @@ -164,12 +166,16 @@ void ExportDialog::accept() QPrinter::PaperSize paperSize = static_cast (_paperSize->itemData(_paperSize->currentIndex()).toInt()); - _printer->setOutputFormat(QPrinter::PdfFormat); - _printer->setOutputFileName(_fileSelect->file()); - _printer->setPaperSize(paperSize); - _printer->setOrientation(orientation); - _printer->setPageMargins(_leftMargin->value(), _topMargin->value(), - _rightMargin->value(), _bottomMargin->value(), _units); + _export->fileName = _fileSelect->file(); + _export->paperSize = paperSize; + _export->orientation = orientation; + if (_units == QPrinter::Inch) + _export->margins = MarginsF(_leftMargin->value() / MM2IN, + _topMargin->value() / MM2IN, _rightMargin->value() / MM2IN, + _bottomMargin->value() / MM2IN); + else + _export->margins = MarginsF(_leftMargin->value(), _topMargin->value(), + _rightMargin->value(), _bottomMargin->value()); QDialog::accept(); } diff --git a/src/exportdialog.h b/src/exportdialog.h index 867024b6..b2957a66 100644 --- a/src/exportdialog.h +++ b/src/exportdialog.h @@ -3,18 +3,26 @@ #include #include +#include "margins.h" class QComboBox; class QRadioButton; class FileSelectWidget; class QDoubleSpinBox; +struct Export { + QString fileName; + QPrinter::PaperSize paperSize; + QPrinter::Orientation orientation; + MarginsF margins; +}; + class ExportDialog : public QDialog { Q_OBJECT public: - ExportDialog(QPrinter *printer, QWidget *parent = 0); + ExportDialog(Export *exp, QWidget *parent = 0); public slots: void accept(); @@ -22,8 +30,7 @@ public slots: private: bool checkFile(); - QPrinter *_printer; - + Export *_export; QPrinter::Unit _units; FileSelectWidget *_fileSelect; diff --git a/src/graphitem.cpp b/src/graphitem.cpp index 224987c7..08c9ca3e 100644 --- a/src/graphitem.cpp +++ b/src/graphitem.cpp @@ -2,20 +2,20 @@ #include "graphitem.h" -#define GRAPH_WIDTH 1 -#define HOVER_WIDTH 2 - GraphItem::GraphItem(const Graph &graph, QGraphicsItem *parent) : QGraphicsObject(parent) { _id = 0; + _width = 1; - _pen = QPen(Qt::black, GRAPH_WIDTH); + _pen = QPen(Qt::black, _width); _type = Distance; _graph = graph; _sx = 1.0; _sy = 1.0; + setZValue(1.0); + updatePath(); updateBounds(); } @@ -51,6 +51,14 @@ void GraphItem::setColor(const QColor &color) update(); } +void GraphItem::setWidth(int width) +{ + prepareGeometryChange(); + + _width = width; + _pen.setWidth(width); +} + qreal GraphItem::yAtX(qreal x) { int low = 0; @@ -130,10 +138,10 @@ void GraphItem::emitSliderPositionChanged(qreal pos) void GraphItem::selected(bool selected) { if (selected) { - _pen.setWidth(HOVER_WIDTH); + _pen.setWidth(_width + 1); setZValue(zValue() + 1.0); } else { - _pen.setWidth(GRAPH_WIDTH); + _pen.setWidth(_width); setZValue(zValue() - 1.0); } diff --git a/src/graphitem.h b/src/graphitem.h index 56810ef2..967b1db2 100644 --- a/src/graphitem.h +++ b/src/graphitem.h @@ -24,6 +24,7 @@ public: int id() const {return _id;} void setId(int id) {_id = id;} void setColor(const QColor &color); + void setWidth(int width); qreal yAtX(qreal x); qreal distanceAtTime(qreal time); @@ -41,6 +42,7 @@ private: int _id; QPen _pen; + int _width; Graph _graph; GraphType _type; diff --git a/src/graphview.cpp b/src/graphview.cpp index 1637fd74..e48ea4e8 100644 --- a/src/graphview.cpp +++ b/src/graphview.cpp @@ -27,19 +27,21 @@ GraphView::GraphView(QWidget *parent) setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); _xAxis = new AxisItem(AxisItem::X); - _xAxis->setZValue(1.0); + _xAxis->setZValue(2.0); _yAxis = new AxisItem(AxisItem::Y); - _yAxis->setZValue(1.0); + _yAxis->setZValue(2.0); _slider = new SliderItem(); - _slider->setZValue(2.0); + _slider->setZValue(3.0); _sliderInfo = new SliderInfoItem(_slider); - _sliderInfo->setZValue(2.0); + _sliderInfo->setZValue(3.0); _info = new InfoItem(); _grid = new GridItem(); connect(_slider, SIGNAL(positionChanged(const QPointF&)), this, SLOT(emitSliderPositionChanged(const QPointF&))); + _width = 1; + _xScale = 1; _yScale = 1; _yOffset = 0; @@ -169,7 +171,8 @@ void GraphView::loadGraph(const Graph &graph, PathItem *path, int id) GraphItem *gi = new GraphItem(graph); gi->setGraphType(_graphType); gi->setId(id); - gi->setColor(_palette.color()); + gi->setColor(_palette.nextColor()); + gi->setWidth(_width); connect(this, SIGNAL(sliderPositionChanged(qreal)), gi, SLOT(emitSliderPositionChanged(qreal))); @@ -431,3 +434,18 @@ void GraphView::clearInfo() { _info->clear(); } + +void GraphView::setPalette(const Palette &palette) +{ + _palette = palette; + _palette.reset(); + + for (int i = 0; i < _graphs.count(); i++) + _graphs.at(i)->setColor(_palette.nextColor()); +} + +void GraphView::setGraphWidth(int width) +{ + for (int i = 0; i < _graphs.count(); i++) + _graphs.at(i)->setWidth(width); +} diff --git a/src/graphview.h b/src/graphview.h index 691586a5..085182a4 100644 --- a/src/graphview.h +++ b/src/graphview.h @@ -35,6 +35,9 @@ public: void setUnits(Units units); void showGrid(bool show); + void setPalette(const Palette &palette); + void setGraphWidth(int width); + const QString &yLabel() const {return _yLabel;} const QString &yUnits() const {return _yUnits;} qreal yScale() const {return _yScale;} @@ -60,7 +63,7 @@ protected: void redraw(const QSizeF &size); void addInfo(const QString &key, const QString &value); void clearInfo(); - void skipColor() {_palette.color();} + void skipColor() {_palette.nextColor();} private slots: void emitSliderPositionChanged(const QPointF &pos); @@ -99,6 +102,7 @@ private: QSet _hide; QRectF _bounds; Palette _palette; + int _width; Units _units; GraphType _graphType; diff --git a/src/gui.cpp b/src/gui.cpp index d3972569..a39cb686 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include "config.h" #include "icons.h" #include "keys.h" @@ -39,7 +38,6 @@ #include "trackinfo.h" #include "filebrowser.h" #include "cpuarch.h" -#include "exportdialog.h" #include "graphtab.h" #include "format.h" #include "gui.h" @@ -88,14 +86,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent) readSettings(); - _exportPaperSize = (QLocale::system().measurementSystem() - == QLocale::ImperialSystem) ? QPrinter::Letter : QPrinter::A4; - _exportOrientation = QPrinter::Portrait; - _exportFileName = QString("%1/export.pdf").arg(QDir::currentPath()); - _exportMargins = MarginsF(5.0, 5.0, 5.0, 5.0); - setAcceptDrops(true); - QPixmapCache::setCacheLimit(65536); } GUI::~GUI() @@ -198,7 +189,6 @@ void GUI::createActions() { QActionGroup *ag; - // Action Groups _fileActionGroup = new QActionGroup(this); _fileActionGroup->setExclusive(false); @@ -377,6 +367,9 @@ void GUI::createActions() connect(_fullscreenAction, SIGNAL(triggered(bool)), this, SLOT(showFullscreen(bool))); addAction(_fullscreenAction); + _openOptionsAction = new QAction(tr("Options..."), this); + connect(_openOptionsAction, SIGNAL(triggered()), this, + SLOT(openOptions())); // Navigation actions _nextAction = new QAction(QIcon(QPixmap(NEXT_FILE_ICON)), tr("Next"), this); @@ -453,8 +446,9 @@ void GUI::createMenus() unitsMenu->addAction(_imperialUnitsAction); settingsMenu->addSeparator(); settingsMenu->addAction(_showToolbarsAction); - settingsMenu->addSeparator(); settingsMenu->addAction(_fullscreenAction); + settingsMenu->addSeparator(); + settingsMenu->addAction(_openOptionsAction); QMenu *helpMenu = menuBar()->addMenu(tr("Help")); helpMenu->addAction(_dataSourcesAction); @@ -746,26 +740,64 @@ void GUI::printFile() plot(&printer); } +void GUI::openOptions() +{ + Options options(_options); + + OptionsDialog dialog(&options, this); + if (dialog.exec() != QDialog::Accepted) + return; + + if (options.palette != _options.palette) { + _pathView->setPalette(options.palette); + for (int i = 0; i < _tabs.count(); i++) + _tabs.at(i)->setPalette(options.palette); + } + if (options.trackWidth != _options.trackWidth) + _pathView->setTrackWidth(options.trackWidth); + if (options.routeWidth != _options.routeWidth) + _pathView->setRouteWidth(options.routeWidth); + if (options.trackStyle != _options.trackStyle) + _pathView->setTrackStyle(options.trackStyle); + if (options.routeStyle != _options.routeStyle) + _pathView->setRouteStyle(options.routeStyle); + if (options.pathAntiAliasing != _options.pathAntiAliasing) + _pathView->setRenderHint(QPainter::Antialiasing, + options.pathAntiAliasing); + if (options.graphWidth != _options.graphWidth) + for (int i = 0; i < _tabs.count(); i++) + _tabs.at(i)->setGraphWidth(options.graphWidth); + if (options.graphAntiAliasing != _options.graphAntiAliasing) + for (int i = 0; i < _tabs.count(); i++) + _tabs.at(i)->setRenderHint(QPainter::Antialiasing, + options.graphAntiAliasing); + + if (options.poiRadius != _options.poiRadius) + _poi->setRadius(options.poiRadius); + + if (options.useOpenGL != _options.useOpenGL) + _pathView->useOpenGL(options.useOpenGL); + + _options = options; +} + void GUI::exportFile() { - QPrinter printer(QPrinter::HighResolution); - printer.setCreator(QString(APP_NAME) + QString(" ") + QString(APP_VERSION)); - printer.setOrientation(_exportOrientation); - printer.setOutputFileName(_exportFileName); - printer.setPaperSize(_exportPaperSize); - printer.setPageMargins(_exportMargins.left(), _exportMargins.top(), - _exportMargins.right(), _exportMargins.bottom(), QPrinter::Millimeter); - ExportDialog dialog(&printer, this); + ExportDialog dialog(&_export, this); + if (dialog.exec() != QDialog::Accepted) + return; - if (dialog.exec() == QDialog::Accepted) { - _exportFileName = printer.outputFileName(); - _exportPaperSize = printer.paperSize(); - _exportOrientation = printer.orientation(); - printer.getPageMargins(&(_exportMargins.rleft()), - &(_exportMargins.rtop()), &(_exportMargins.rright()), - &(_exportMargins.rbottom()), QPrinter::Millimeter); - plot(&printer); - } + QPrinter printer(QPrinter::HighResolution); + printer.setOutputFormat(QPrinter::PdfFormat); + printer.setCreator(QString(APP_NAME) + QString(" ") + + QString(APP_VERSION)); + printer.setOrientation(_export.orientation); + printer.setOutputFileName(_export.fileName); + printer.setPaperSize(_export.paperSize); + printer.setPageMargins(_export.margins.left(), _export.margins.top(), + _export.margins.right(), _export.margins.bottom(), QPrinter::Millimeter); + + plot(&printer); } void GUI::plot(QPrinter *printer) @@ -1229,35 +1261,46 @@ void GUI::dropEvent(QDropEvent *event) void GUI::writeSettings() { QSettings settings(APP_NAME, APP_NAME); + settings.clear(); settings.beginGroup(WINDOW_SETTINGS_GROUP); - settings.setValue(WINDOW_SIZE_SETTING, size()); - settings.setValue(WINDOW_POS_SETTING, pos()); + if (size() != WINDOW_SIZE_DEFAULT) + settings.setValue(WINDOW_SIZE_SETTING, size()); + if (pos() != WINDOW_POS_DEFAULT) + 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()); + if (_showToolbarsAction->isChecked() != SHOW_TOOLBARS_DEFAULT) + settings.setValue(SHOW_TOOLBARS_SETTING, + _showToolbarsAction->isChecked()); settings.endGroup(); settings.beginGroup(MAP_SETTINGS_GROUP); if (_currentMap) settings.setValue(CURRENT_MAP_SETTING, _currentMap->name()); - settings.setValue(SHOW_MAP_SETTING, _showMapAction->isChecked()); + if (_showMapAction->isChecked() != SHOW_MAP_DEFAULT) + settings.setValue(SHOW_MAP_SETTING, _showMapAction->isChecked()); settings.endGroup(); settings.beginGroup(GRAPH_SETTINGS_GROUP); - settings.setValue(SHOW_GRAPHS_SETTING, _showGraphsAction->isChecked()); - settings.setValue(GRAPH_TYPE_SETTING, _timeGraphAction->isChecked() - ? Time : Distance); - settings.setValue(SHOW_GRAPH_GRIDS_SETTING, - _showGraphGridAction->isChecked()); + if (_showGraphsAction->isChecked() != SHOW_GRAPHS_DEFAULT) + settings.setValue(SHOW_GRAPHS_SETTING, _showGraphsAction->isChecked()); + if ((_timeGraphAction->isChecked() ? Time : Distance) != GRAPH_TYPE_DEFAULT) + settings.setValue(GRAPH_TYPE_SETTING, _timeGraphAction->isChecked() + ? Time : Distance); + if (_showGraphGridAction->isChecked() != SHOW_GRAPH_GRIDS_DEFAULT) + settings.setValue(SHOW_GRAPH_GRIDS_SETTING, + _showGraphGridAction->isChecked()); settings.endGroup(); settings.beginGroup(POI_SETTINGS_GROUP); - settings.setValue(SHOW_POI_SETTING, _showPOIAction->isChecked()); - settings.setValue(OVERLAP_POI_SETTING, _overlapPOIAction->isChecked()); + if (_showPOIAction->isChecked() != SHOW_POI_DEFAULT) + settings.setValue(SHOW_POI_SETTING, _showPOIAction->isChecked()); + if (_overlapPOIAction->isChecked() != OVERLAP_POI_DEFAULT) + settings.setValue(OVERLAP_POI_SETTING, _overlapPOIAction->isChecked()); settings.remove(DISABLED_POI_FILE_SETTINGS_PREFIX); settings.beginWriteArray(DISABLED_POI_FILE_SETTINGS_PREFIX); @@ -1271,15 +1314,61 @@ void GUI::writeSettings() settings.endGroup(); settings.beginGroup(DATA_SETTINGS_GROUP); - settings.setValue(SHOW_TRACKS_SETTING, _showTracksAction->isChecked()); - settings.setValue(SHOW_ROUTES_SETTING, _showRoutesAction->isChecked()); - settings.setValue(SHOW_WAYPOINTS_SETTING, - _showWaypointsAction->isChecked()); - settings.setValue(SHOW_WAYPOINT_LABELS_SETTING, - _showWaypointLabelsAction->isChecked()); - settings.setValue(SHOW_ROUTE_WAYPOINTS_SETTING, - _showRouteWaypointsAction->isChecked()); + if (_showTracksAction->isChecked() != SHOW_TRACKS_DEFAULT) + settings.setValue(SHOW_TRACKS_SETTING, _showTracksAction->isChecked()); + if (_showRoutesAction->isChecked() != SHOW_ROUTES_DEFAULT) + settings.setValue(SHOW_ROUTES_SETTING, _showRoutesAction->isChecked()); + if (_showWaypointsAction->isChecked() != SHOW_WAYPOINTS_DEFAULT) + settings.setValue(SHOW_WAYPOINTS_SETTING, + _showWaypointsAction->isChecked()); + if (_showWaypointLabelsAction->isChecked() != SHOW_WAYPOINT_LABELS_DEFAULT) + settings.setValue(SHOW_WAYPOINT_LABELS_SETTING, + _showWaypointLabelsAction->isChecked()); + if (_showRouteWaypointsAction->isChecked() != SHOW_ROUTE_WAYPOINTS_DEFAULT) + settings.setValue(SHOW_ROUTE_WAYPOINTS_SETTING, + _showRouteWaypointsAction->isChecked()); + settings.endGroup(); + settings.beginGroup(EXPORT_SETTINGS_GROUP); + if (_export.orientation != PAPER_ORIENTATION_DEFAULT) + settings.setValue(PAPER_ORIENTATION_SETTING, _export.orientation); + if (_export.paperSize != PAPER_SIZE_DEFAULT) + settings.setValue(PAPER_SIZE_SETTING, _export.paperSize); + if (_export.margins.left() != MARGIN_LEFT_DEFAULT) + settings.setValue(MARGIN_LEFT_SETTING, _export.margins.left()); + if (_export.margins.top() != MARGIN_TOP_DEFAULT) + settings.setValue(MARGIN_TOP_SETTING, _export.margins.top()); + if (_export.margins.right() != MARGIN_RIGHT_DEFAULT) + settings.setValue(MARGIN_RIGHT_SETTING, _export.margins.right()); + if (_export.margins.bottom() != MARGIN_BOTTOM_DEFAULT) + settings.setValue(MARGIN_BOTTOM_SETTING, _export.margins.bottom()); + if (_export.fileName != EXPORT_FILENAME_DEFAULT) + settings.setValue(EXPORT_FILENAME_SETTING, _export.fileName); + settings.endGroup(); + + settings.beginGroup(OPTIONS_SETTINGS_GROUP); + if (_options.palette.color() != PALETTE_COLOR_DEFAULT) + settings.setValue(PALETTE_COLOR_SETTING, _options.palette.color()); + if (_options.palette.shift() != PALETTE_SHIFT_DEFAULT) + settings.setValue(PALETTE_SHIFT_SETTING, _options.palette.shift()); + if (_options.trackWidth != TRACK_WIDTH_DEFAULT) + settings.setValue(TRACK_WIDTH_SETTING, _options.trackWidth); + if (_options.routeWidth != ROUTE_WIDTH_DEFAULT) + settings.setValue(ROUTE_WIDTH_SETTING, _options.routeWidth); + if (_options.trackStyle != TRACK_STYLE_DEFAULT) + settings.setValue(TRACK_STYLE_SETTING, (int)_options.trackStyle); + if (_options.routeStyle != ROUTE_STYLE_DEFAULT) + settings.setValue(ROUTE_STYLE_SETTING, (int)_options.routeStyle); + if (_options.graphWidth != GRAPH_WIDTH_DEFAULT) + settings.setValue(GRAPH_WIDTH_SETTING, _options.graphWidth); + if (_options.pathAntiAliasing != PATH_AA_DEFAULT) + settings.setValue(PATH_AA_SETTING, _options.pathAntiAliasing); + if (_options.graphAntiAliasing != GRAPH_AA_DEFAULT) + settings.setValue(GRAPH_AA_SETTING, _options.graphAntiAliasing); + if (_options.poiRadius != POI_RADIUS_DEFAULT) + settings.setValue(POI_RADIUS_SETTING, _options.poiRadius); + if (_options.useOpenGL != USE_OPENGL_DEFAULT) + settings.setValue(USE_OPENGL_SETTING, _options.useOpenGL); settings.endGroup(); } @@ -1288,26 +1377,24 @@ 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()); + resize(settings.value(WINDOW_SIZE_SETTING, WINDOW_SIZE_DEFAULT).toSize()); + move(settings.value(WINDOW_POS_SETTING, WINDOW_POS_DEFAULT).toPoint()); settings.endGroup(); settings.beginGroup(SETTINGS_SETTINGS_GROUP); - Units u = QLocale::system().measurementSystem() == QLocale::ImperialSystem - ? Imperial : Metric; - if (settings.value(UNITS_SETTING, u).toInt() == Imperial) { + if (settings.value(UNITS_SETTING, UNITS_DEFAULT).toInt() == Imperial) { setImperialUnits(); _imperialUnitsAction->setChecked(true); } else _metricUnitsAction->setChecked(true); - if (settings.value(SHOW_TOOLBARS_SETTING, true).toBool() == false) + if (!settings.value(SHOW_TOOLBARS_SETTING, SHOW_TOOLBARS_DEFAULT).toBool()) showToolbars(false); else _showToolbarsAction->setChecked(true); settings.endGroup(); settings.beginGroup(MAP_SETTINGS_GROUP); - if (settings.value(SHOW_MAP_SETTING, true).toBool() == true) + if (settings.value(SHOW_MAP_SETTING, SHOW_MAP_DEFAULT).toBool()) _showMapAction->setChecked(true); if (_maps.count()) { int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString()); @@ -1320,31 +1407,33 @@ void GUI::readSettings() settings.endGroup(); settings.beginGroup(GRAPH_SETTINGS_GROUP); - if (settings.value(SHOW_GRAPHS_SETTING, true).toBool() == false) + if (!settings.value(SHOW_GRAPHS_SETTING, SHOW_GRAPHS_DEFAULT).toBool()) showGraphs(false); else _showGraphsAction->setChecked(true); - if (settings.value(GRAPH_TYPE_SETTING, Distance).toInt() == Time) { + if (settings.value(GRAPH_TYPE_SETTING, GRAPH_TYPE_DEFAULT).toInt() + == Time) { setTimeGraph(); _timeGraphAction->setChecked(true); } else _distanceGraphAction->setChecked(true); - if (settings.value(SHOW_GRAPH_GRIDS_SETTING, true).toBool() == false) + if (!settings.value(SHOW_GRAPH_GRIDS_SETTING, SHOW_GRAPH_GRIDS_DEFAULT) + .toBool()) showGraphGrids(false); else _showGraphGridAction->setChecked(true); settings.endGroup(); settings.beginGroup(POI_SETTINGS_GROUP); - if (settings.value(OVERLAP_POI_SETTING, true).toBool() == false) + if (!settings.value(OVERLAP_POI_SETTING, OVERLAP_POI_DEFAULT).toBool()) _pathView->setPOIOverlap(false); else _overlapPOIAction->setChecked(true); - if (settings.value(LABELS_POI_SETTING, true).toBool() == false) + if (!settings.value(LABELS_POI_SETTING, LABELS_POI_DEFAULT).toBool()) _pathView->showPOILabels(false); else _showPOILabelsAction->setChecked(true); - if (settings.value(SHOW_POI_SETTING, false).toBool() == true) + if (settings.value(SHOW_POI_SETTING, SHOW_POI_DEFAULT).toBool()) _showPOIAction->setChecked(true); else _pathView->showPOI(false); @@ -1364,31 +1453,77 @@ void GUI::readSettings() settings.endGroup(); settings.beginGroup(DATA_SETTINGS_GROUP); - if (settings.value(SHOW_TRACKS_SETTING, true).toBool() == false) { + if (!settings.value(SHOW_TRACKS_SETTING, SHOW_TRACKS_DEFAULT).toBool()) { _pathView->showTracks(false); for (int i = 0; i < _tabs.count(); i++) _tabs.at(i)->showTracks(false); } else _showTracksAction->setChecked(true); - if (settings.value(SHOW_ROUTES_SETTING, true).toBool() == false) { + if (!settings.value(SHOW_ROUTES_SETTING, SHOW_ROUTES_DEFAULT).toBool()) { _pathView->showRoutes(false); for (int i = 0; i < _tabs.count(); i++) _tabs.at(i)->showRoutes(false); } else _showRoutesAction->setChecked(true); - if (settings.value(SHOW_WAYPOINTS_SETTING, true).toBool() == false) + if (!settings.value(SHOW_WAYPOINTS_SETTING, SHOW_WAYPOINTS_DEFAULT) + .toBool()) _pathView->showWaypoints(false); else _showWaypointsAction->setChecked(true); - if (settings.value(SHOW_WAYPOINT_LABELS_SETTING, true).toBool() == false) + if (!settings.value(SHOW_WAYPOINT_LABELS_SETTING, + SHOW_WAYPOINT_LABELS_DEFAULT).toBool()) _pathView->showWaypointLabels(false); else _showWaypointLabelsAction->setChecked(true); - if (settings.value(SHOW_ROUTE_WAYPOINTS_SETTING, true).toBool() == false) + if (!settings.value(SHOW_ROUTE_WAYPOINTS_SETTING, + SHOW_ROUTE_WAYPOINTS_SETTING).toBool()) _pathView->showRouteWaypoints(false); else _showRouteWaypointsAction->setChecked(true); settings.endGroup(); + + settings.beginGroup(EXPORT_SETTINGS_GROUP); + _export.orientation = (QPrinter::Orientation) settings.value( + PAPER_ORIENTATION_SETTING, PAPER_ORIENTATION_DEFAULT).toInt(); + _export.paperSize = (QPrinter::PaperSize) settings.value(PAPER_SIZE_SETTING, + PAPER_SIZE_DEFAULT).toInt(); + qreal ml = settings.value(MARGIN_LEFT_SETTING, MARGIN_LEFT_DEFAULT) + .toReal(); + qreal mt = settings.value(MARGIN_TOP_SETTING, MARGIN_TOP_DEFAULT).toReal(); + qreal mr = settings.value(MARGIN_RIGHT_SETTING, MARGIN_RIGHT_DEFAULT) + .toReal(); + qreal mb = settings.value(MARGIN_BOTTOM_SETTING, MARGIN_BOTTOM_DEFAULT) + .toReal(); + _export.margins = MarginsF(ml, mt, mr, mb); + _export.fileName = settings.value(EXPORT_FILENAME_SETTING, + EXPORT_FILENAME_DEFAULT).toString(); + settings.endGroup(); + + settings.beginGroup(OPTIONS_SETTINGS_GROUP); + QColor pc = settings.value(PALETTE_COLOR_SETTING, PALETTE_COLOR_DEFAULT) + .value(); + qreal ps = settings.value(PALETTE_SHIFT_SETTING, PALETTE_SHIFT_DEFAULT) + .toDouble(); + _options.palette = Palette(pc, ps); + _options.trackWidth = settings.value(TRACK_WIDTH_SETTING, + TRACK_WIDTH_DEFAULT).toInt(); + _options.routeWidth = settings.value(ROUTE_WIDTH_SETTING, + ROUTE_WIDTH_DEFAULT).toInt(); + _options.trackStyle = (Qt::PenStyle) settings.value(TRACK_STYLE_SETTING, + (int)TRACK_STYLE_DEFAULT).toInt(); + _options.routeStyle = (Qt::PenStyle) settings.value(ROUTE_STYLE_SETTING, + (int)ROUTE_STYLE_DEFAULT).toInt(); + _options.graphWidth = settings.value(GRAPH_WIDTH_SETTING, + GRAPH_WIDTH_DEFAULT).toInt(); + _options.pathAntiAliasing = settings.value(PATH_AA_SETTING, PATH_AA_DEFAULT) + .toBool(); + _options.graphAntiAliasing = settings.value(GRAPH_AA_SETTING, + GRAPH_AA_DEFAULT).toBool(); + _options.poiRadius = settings.value(POI_RADIUS_SETTING, POI_RADIUS_DEFAULT) + .toInt(); + _options.useOpenGL = settings.value(USE_OPENGL_SETTING, USE_OPENGL_DEFAULT) + .toBool(); + settings.endGroup(); } int GUI::mapIndex(const QString &name) diff --git a/src/gui.h b/src/gui.h index a8b76d0e..cc2c72ba 100644 --- a/src/gui.h +++ b/src/gui.h @@ -9,7 +9,8 @@ #include "units.h" #include "graph.h" #include "poi.h" -#include "margins.h" +#include "exportdialog.h" +#include "optionsdialog.h" class QMenu; class QToolBar; @@ -55,6 +56,7 @@ private slots: void clearMapCache(); void nextMap(); void prevMap(); + void openOptions(); void mapChanged(int); void graphChanged(int); @@ -159,6 +161,7 @@ private: QAction *_showWaypointsAction; QAction *_showWaypointLabelsAction; QAction *_showRouteWaypointsAction; + QAction *_openOptionsAction; QList _mapActions; QList _poiFilesActions; @@ -192,10 +195,8 @@ private: int _frameStyle; bool _showGraphs; - QString _exportFileName; - QPrinter::PaperSize _exportPaperSize; - QPrinter::Orientation _exportOrientation; - MarginsF _exportMargins; + Export _export; + Options _options; }; #endif // GUI_H diff --git a/src/icons.h b/src/icons.h index 705b4770..94c48c23 100644 --- a/src/icons.h +++ b/src/icons.h @@ -1,7 +1,9 @@ #ifndef ICONS_H #define ICONS_H -#define APP_ICON ":/icons/gpxsee.png" +#define APP_ICON ":/icons/gpxsee.png" + +// Toolbar/menu icons #define OPEN_FILE_ICON ":/icons/document-open.png" #define EXPORT_FILE_ICON ":/icons/document-export.png" #define PRINT_FILE_ICON ":/icons/document-print.png" @@ -17,4 +19,9 @@ #define FIRST_FILE_ICON ":/icons/arrow-left-double.png" #define FULLSCREEN_ICON ":/icons/view-fullscreen.png" +// Options dialog icons +#define APPEARANCE_ICON ":/icons/preferences-desktop-display.png" +#define POI_ICON ":/icons/flag_48.png" +#define SYSTEM_ICON ":/icons/system-run.png" + #endif /* ICONS_H */ diff --git a/src/optionsdialog.cpp b/src/optionsdialog.cpp new file mode 100644 index 00000000..3c007cc0 --- /dev/null +++ b/src/optionsdialog.cpp @@ -0,0 +1,203 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "config.h" +#include "units.h" +#include "icons.h" +#include "colorbox.h" +#include "stylecombobox.h" +#include "optionsdialog.h" + +#define MENU_MARGIN 20 + + +QWidget *OptionsDialog::createAppearancePage() +{ + _baseColor = new ColorBox(); + _baseColor->setColor(_options->palette.color()); + _colorOffset = new QDoubleSpinBox(); + _colorOffset->setMinimum(0); + _colorOffset->setMaximum(1.0); + _colorOffset->setSingleStep(0.01); + _colorOffset->setValue(_options->palette.shift()); + + QFormLayout *paletteLayout = new QFormLayout(); + paletteLayout->addRow(tr("Base color:"), _baseColor); + paletteLayout->addRow(tr("Palette shift:"), _colorOffset); + + QWidget *colorTab = new QWidget(); + colorTab->setLayout(paletteLayout); + + + _trackWidth = new QSpinBox(); + _trackWidth->setValue(_options->trackWidth); + _trackWidth->setMinimum(1); + _trackStyle = new StyleComboBox(); + _trackStyle->setValue(_options->trackStyle); + QGroupBox *trackBox = new QGroupBox(tr("Tracks")); + QFormLayout *trackLayout = new QFormLayout(); + trackLayout->addRow(tr("Line width:"), _trackWidth); + trackLayout->addRow(tr("Line style:"), _trackStyle); + trackBox->setLayout(trackLayout); + + _routeWidth = new QSpinBox(); + _routeWidth->setValue(_options->routeWidth); + _routeWidth->setMinimum(1); + _routeStyle = new StyleComboBox(); + _routeStyle->setValue(_options->routeStyle); + QGroupBox *routeBox = new QGroupBox(tr("Routes")); + QFormLayout *routeLayout = new QFormLayout(); + routeLayout->addRow(tr("Line width:"), _routeWidth); + routeLayout->addRow(tr("Line style:"), _routeStyle); + routeBox->setLayout(routeLayout); + + _pathAA = new QCheckBox(tr("Use anti-aliasing")); + _pathAA->setChecked(_options->pathAntiAliasing); + + QWidget *pathTab = new QWidget(); + QVBoxLayout *pathTabLayout = new QVBoxLayout(); + pathTabLayout->addWidget(trackBox); + pathTabLayout->addWidget(routeBox); + pathTabLayout->addWidget(_pathAA); + pathTab->setLayout(pathTabLayout); + + + _graphWidth = new QSpinBox(); + _graphWidth->setValue(_options->graphWidth); + _graphWidth->setMinimum(1); + QFormLayout *graphLayout = new QFormLayout(); + graphLayout->addRow(tr("Line width:"), _graphWidth); + + _graphAA = new QCheckBox(tr("Use anti-aliasing")); + _graphAA->setChecked(_options->graphAntiAliasing); + + QWidget *graphTab = new QWidget(); + QVBoxLayout *graphTabLayout = new QVBoxLayout(); + graphTabLayout->addLayout(graphLayout); + graphTabLayout->addWidget(_graphAA); + graphTabLayout->addStretch(); + graphTab->setLayout(graphTabLayout); + + QTabWidget *appearancePage = new QTabWidget(); + appearancePage->addTab(colorTab, tr("Colors")); + appearancePage->addTab(pathTab, tr("Paths")); + appearancePage->addTab(graphTab, tr("Graphs")); + + return appearancePage; +} + +QWidget *OptionsDialog::createPOIPage() +{ + _poiRadius = new QDoubleSpinBox(); + _poiRadius->setSingleStep(1); + _poiRadius->setDecimals(1); + _poiRadius->setValue(_options->poiRadius / 1000); + _poiRadius->setSuffix(UNIT_SPACE + tr("km")); + + QFormLayout *poiLayout = new QFormLayout(); + poiLayout->addRow(tr("POI radius:"), _poiRadius); + + QWidget *poiTab = new QWidget(); + poiTab->setLayout(poiLayout); + + QTabWidget *poiPage = new QTabWidget(); + poiPage->addTab(poiTab, tr("POI")); + + return poiPage; +} + +QWidget *OptionsDialog::createSystemPage() +{ + _useOpenGL = new QCheckBox(tr("Use OpenGL")); +#ifdef Q_OS_WIN32 + if (QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) { + _useOpenGL->setChecked(false); + _useOpenGL->setEnabled(false); + } else +#endif // Q_OS_WIN32 + _useOpenGL->setChecked(_options->useOpenGL); + + QFormLayout *systemLayout = new QFormLayout(); + systemLayout->addWidget(_useOpenGL); + + QWidget *systemTab = new QWidget(); + systemTab->setLayout(systemLayout); + + QTabWidget *systemPage = new QTabWidget(); + systemPage->addTab(systemTab, tr("System")); + + return systemPage; +} + +OptionsDialog::OptionsDialog(Options *options, QWidget *parent) + : QDialog(parent), _options(options) +{ + QStackedWidget *pages = new QStackedWidget(); + pages->addWidget(createAppearancePage()); + pages->addWidget(createPOIPage()); + pages->addWidget(createSystemPage()); + + QListWidget *menu = new QListWidget(); + new QListWidgetItem(QIcon(QPixmap(APPEARANCE_ICON)), tr("Appearance"), + menu); + new QListWidgetItem(QIcon(QPixmap(POI_ICON)), tr("POI"), menu); + new QListWidgetItem(QIcon(QPixmap(SYSTEM_ICON)), tr("System"), menu); + + QHBoxLayout *contentLayout = new QHBoxLayout(); + contentLayout->addWidget(menu); + contentLayout->addWidget(pages); + + menu->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); + menu->setMaximumWidth(menu->sizeHintForColumn(0) + 2 * menu->frameWidth() + + MENU_MARGIN); + pages->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); + pages->setMinimumWidth(2 * menu->size().width()); + + connect(menu, SIGNAL(currentRowChanged(int)), pages, + SLOT(setCurrentIndex(int))); + menu->item(0)->setSelected(true); + + + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok + | QDialogButtonBox::Cancel); + connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + + QVBoxLayout *layout = new QVBoxLayout; + layout->addLayout(contentLayout); + layout->addWidget(buttonBox); + setLayout(layout); + + setWindowTitle(tr("Options")); + setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); +} + +void OptionsDialog::accept() +{ + _options->palette.setColor(_baseColor->color()); + _options->palette.setShift(_colorOffset->value()); + _options->trackWidth = _trackWidth->value(); + _options->trackStyle = (Qt::PenStyle) _trackStyle->itemData( + _trackStyle->currentIndex()).toInt(); + _options->routeWidth = _routeWidth->value(); + _options->routeStyle = (Qt::PenStyle) _routeStyle->itemData( + _routeStyle->currentIndex()).toInt(); + _options->pathAntiAliasing = _pathAA->isChecked(); + _options->graphWidth = _graphWidth->value(); + _options->graphAntiAliasing = _graphAA->isChecked(); + + _options->poiRadius = _poiRadius->value() * 1000; + + _options->useOpenGL = _useOpenGL->isChecked(); + + QDialog::accept(); +} diff --git a/src/optionsdialog.h b/src/optionsdialog.h new file mode 100644 index 00000000..82c08807 --- /dev/null +++ b/src/optionsdialog.h @@ -0,0 +1,60 @@ +#ifndef OPTIONSDIALOG_H +#define OPTIONSDIALOG_H + +#include +#include "palette.h" + +class ColorBox; +class StyleComboBox; +class QSpinBox; +class QDoubleSpinBox; +class QComboBox; +class QCheckBox; + +struct Options { + // Appearance + Palette palette; + int trackWidth; + int routeWidth; + Qt::PenStyle trackStyle; + Qt::PenStyle routeStyle; + int graphWidth; + bool pathAntiAliasing; + bool graphAntiAliasing; + // POI + int poiRadius; + // System + bool useOpenGL; +}; + +class OptionsDialog : public QDialog +{ + Q_OBJECT + +public: + OptionsDialog(Options *options, QWidget *parent = 0); + +public slots: + void accept(); + +private: + QWidget *createAppearancePage(); + QWidget *createPOIPage(); + QWidget *createSystemPage(); + + Options *_options; + + ColorBox *_baseColor; + QDoubleSpinBox *_colorOffset; + QSpinBox *_trackWidth; + StyleComboBox *_trackStyle; + QSpinBox *_routeWidth; + StyleComboBox *_routeStyle; + QCheckBox *_pathAA; + QSpinBox *_graphWidth; + QCheckBox *_graphAA; + QDoubleSpinBox *_poiRadius; + QCheckBox *_useOpenGL; +}; + +#endif // OPTIONSDIALOG_H diff --git a/src/palette.cpp b/src/palette.cpp index d04036f4..5b4f301b 100644 --- a/src/palette.cpp +++ b/src/palette.cpp @@ -1,62 +1,38 @@ #include "palette.h" - -#define HUE_INIT 0.1f -#define HUE_INCREMENT 0.62f -#define SATURATION 0.99f -#define VALUE 0.99f - -static unsigned hsv2rgb(float h, float s, float v) +Palette::Palette(const QColor &color, qreal shift) { - unsigned hi; - float r = 0, g = 0, b = 0, p, q, t, f; + _h = 0; _s = 0; _v = 0; _a = 1.0; - hi = (unsigned)(h * 6.0f); - f = h * 6.0f - hi; - p = v * (1.0f - s); - q = v * (1.0f - f * s); - t = v * (1.0f - (1.0f - f) * s); + setColor(color); + setShift(shift); - switch (hi) { - case 0: - r = v; g = t; b = p; - break; - case 1: - r = q; g = v; b = p; - break; - case 2: - r = p; g = v; b = t; - break; - case 3: - r = p; g = q; b = v; - break; - case 4: - r = t; g = p; b = v; - break; - case 5: - r = v; g = p; b = q; - break; - } - - return ((unsigned)(r * 256) << 16) - + ((unsigned)(g * 256) << 8) - + (unsigned)(b * 256); + _state = _h; } -Palette::Palette() +void Palette::setColor(const QColor &color) { - _hueState = HUE_INIT; + if (color.isValid()) + color.getHsvF(&_h, &_s, &_v, &_a); } -QColor Palette::color() +void Palette::setShift(qreal shift) { - _hueState += HUE_INCREMENT; - _hueState -= (int) _hueState; + if (shift >= 0 && shift <= 1.0) + _shift = shift; +} - return QColor(hsv2rgb(_hueState, SATURATION, VALUE)); +QColor Palette::nextColor() +{ + QColor ret = QColor::fromHsvF(_state, _s, _v, _a); + + _state += _shift; + _state -= (int) _state; + + return ret; } void Palette::reset() { - _hueState = HUE_INIT; + _state = _h; } diff --git a/src/palette.h b/src/palette.h index 60e68206..0bf3af14 100644 --- a/src/palette.h +++ b/src/palette.h @@ -6,12 +6,25 @@ class Palette { public: - Palette(); - QColor color(); + Palette(const QColor &color = Qt::blue, qreal shift = 0.62); + + QColor color() const {return QColor::fromHsvF(_h, _s, _v, _a);} + qreal shift() const {return _shift;} + void setColor(const QColor &color); + void setShift(qreal shift); + + QColor nextColor(); void reset(); + bool operator==(const Palette &other) const + {return (_h == other._h && _s == other._s && _v == other._v + && _a == other._a && _shift == other._shift);} + bool operator!=(const Palette &other) const + {return !(*this == other);} + private: - float _hueState; + qreal _h, _s, _v, _a, _shift; + qreal _state; }; #endif // PALLETE_H diff --git a/src/pathitem.cpp b/src/pathitem.cpp index 1520e236..adc14d0c 100644 --- a/src/pathitem.cpp +++ b/src/pathitem.cpp @@ -6,13 +6,10 @@ #include "pathitem.h" -#define PATH_WIDTH 3 -#define HOVER_WIDTH 4 - void PathItem::updateShape() { QPainterPathStroker s; - s.setWidth(HOVER_WIDTH * 1.0/scale()); + s.setWidth((_width + 1) * 1.0/scale()); _shape = s.createStroke(_path); if (qMax(boundingRect().width(), boundingRect().height()) * scale() <= 768) @@ -23,8 +20,10 @@ void PathItem::updateShape() PathItem::PathItem(QGraphicsItem *parent) : QGraphicsObject(parent) { + _width = 3; + QBrush brush(Qt::SolidPattern); - _pen = QPen(brush, PATH_WIDTH); + _pen = QPen(brush, _width); _units = Metric; @@ -54,7 +53,7 @@ void PathItem::setScale(qreal scale) { prepareGeometryChange(); - _pen.setWidthF(PATH_WIDTH * 1.0/scale); + _pen.setWidthF(_width * 1.0/scale); QGraphicsItem::setScale(scale); _marker->setScale(1.0/scale); @@ -67,6 +66,22 @@ void PathItem::setColor(const QColor &color) update(); } +void PathItem::setWidth(int width) +{ + prepareGeometryChange(); + + _width = width; + _pen.setWidthF(_width * 1.0/scale()); + + updateShape(); +} + +void PathItem::setStyle(Qt::PenStyle style) +{ + _pen.setStyle(style); + update(); +} + void PathItem::setUnits(enum Units units) { _units = units; @@ -120,7 +135,7 @@ void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - _pen.setWidthF(HOVER_WIDTH * 1.0/scale()); + _pen.setWidthF((_width + 1) * 1.0/scale()); setZValue(zValue() + 1.0); update(); @@ -131,7 +146,7 @@ void PathItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - _pen.setWidthF(PATH_WIDTH * 1.0/scale()); + _pen.setWidthF(_width * 1.0/scale()); setZValue(zValue() - 1.0); update(); diff --git a/src/pathitem.h b/src/pathitem.h index 6f40982a..83e7a3e6 100644 --- a/src/pathitem.h +++ b/src/pathitem.h @@ -24,6 +24,8 @@ public: void setScale(qreal scale); void setUnits(enum Units units); void setColor(const QColor &color); + void setWidth(int width); + void setStyle(Qt::PenStyle style); public slots: void moveMarker(qreal distance); @@ -36,11 +38,7 @@ protected: QVector _distance; QPainterPath _path; - QPainterPath _shape; - QPen _pen; - MarkerItem *_marker; - Units _units; private: @@ -48,6 +46,10 @@ private: void hoverEnterEvent(QGraphicsSceneHoverEvent *event); void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); + + int _width; + QPen _pen; + QPainterPath _shape; }; #endif // PATHITEM_H diff --git a/src/pathview.cpp b/src/pathview.cpp index 31611e57..02512d0e 100644 --- a/src/pathview.cpp +++ b/src/pathview.cpp @@ -1,6 +1,12 @@ #include #include #include +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#include +#else // QT 5 +#include +#endif // QT 5 +#include #include "rd.h" #include "poi.h" #include "data.h" @@ -90,7 +96,7 @@ PathView::PathView(QWidget *parent) setViewportUpdateMode(QGraphicsView::FullViewportUpdate); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setRenderHints(QPainter::Antialiasing); + setRenderHint(QPainter::Antialiasing, true); setAcceptDrops(false); _mapScale = new ScaleItem(); @@ -110,6 +116,10 @@ PathView::PathView(QWidget *parent) _showPOILabels = true; _overlapPOIs = true; _showRouteWaypoints = true; + _trackWidth = 3; + _routeWidth = 3; + _trackStyle = Qt::SolidLine; + _routeStyle = Qt::DashLine; _plot = false; } @@ -123,7 +133,7 @@ PathView::~PathView() PathItem *PathView::addTrack(const Track &track) { if (track.isNull()) { - _palette.color(); + _palette.nextColor(); return 0; } @@ -132,7 +142,9 @@ PathItem *PathView::addTrack(const Track &track) _tr |= ti->path().boundingRect(); _zoom = scale2zoom(contentsScale()); ti->setScale(1.0/mapScale(_zoom)); - ti->setColor(_palette.color()); + ti->setColor(_palette.nextColor()); + ti->setWidth(_trackWidth); + ti->setStyle(_trackStyle); ti->setVisible(_showTracks); _scene->addItem(ti); @@ -145,7 +157,7 @@ PathItem *PathView::addTrack(const Track &track) PathItem *PathView::addRoute(const Route &route) { if (route.isNull()) { - _palette.color(); + _palette.nextColor(); return 0; } @@ -154,7 +166,9 @@ PathItem *PathView::addRoute(const Route &route) _rr |= ri->path().boundingRect(); _zoom = scale2zoom(contentsScale()); ri->setScale(1.0/mapScale(_zoom)); - ri->setColor(_palette.color()); + ri->setColor(_palette.nextColor()); + ri->setWidth(_routeWidth); + ri->setStyle(_routeStyle); ri->setVisible(_showRoutes); ri->showWaypoints(_showRouteWaypoints); ri->showWaypointLabels(_showWaypointLabels); @@ -297,6 +311,17 @@ void PathView::rescale(int zoom) updatePOIVisibility(); } +void PathView::setPalette(const Palette &palette) +{ + _palette = palette; + _palette.reset(); + + for (int i = 0; i < _tracks.count(); i++) + _tracks.at(i)->setColor(_palette.nextColor()); + for (int i = 0; i < _routes.count(); i++) + _routes.at(i)->setColor(_palette.nextColor()); +} + void PathView::setPOI(POI *poi) { if (_poi) @@ -585,6 +610,38 @@ void PathView::setPOIOverlap(bool overlap) updatePOIVisibility(); } +void PathView::setTrackWidth(int width) +{ + _trackWidth = width; + + for (int i = 0; i < _tracks.count(); i++) + _tracks.at(i)->setWidth(width); +} + +void PathView::setRouteWidth(int width) +{ + _routeWidth = width; + + for (int i = 0; i < _routes.count(); i++) + _routes.at(i)->setWidth(width); +} + +void PathView::setTrackStyle(Qt::PenStyle style) +{ + _trackStyle = style; + + for (int i = 0; i < _tracks.count(); i++) + _tracks.at(i)->setStyle(style); +} + +void PathView::setRouteStyle(Qt::PenStyle style) +{ + _routeStyle = style; + + for (int i = 0; i < _routes.count(); i++) + _routes.at(i)->setStyle(style); +} + void PathView::drawBackground(QPainter *painter, const QRectF &rect) { if ((_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty()) @@ -652,3 +709,18 @@ void PathView::paintEvent(QPaintEvent *event) QGraphicsView::paintEvent(event); } + +void PathView::useOpenGL(bool use) +{ + if (use) { +#ifdef Q_OS_WIN32 + if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA) +#endif // Q_OS_WIN32 +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + setViewport(new QGLWidget); +#else // QT 5 + setViewport(new QOpenGLWidget); +#endif // QT 5 + } else + setViewport(new QWidget); +} diff --git a/src/pathview.h b/src/pathview.h index 5d7f81b1..06914804 100644 --- a/src/pathview.h +++ b/src/pathview.h @@ -30,6 +30,7 @@ public: QList loadData(const Data &data); + void setPalette(const Palette &palette); void setPOI(POI *poi); void setMap(Map *map); void setUnits(enum Units units); @@ -42,6 +43,8 @@ public: void clear(); + void useOpenGL(bool use); + public slots: void redraw(); @@ -53,6 +56,10 @@ public slots: void showRoutes(bool show); void showWaypoints(bool show); void showRouteWaypoints(bool show); + void setTrackWidth(int width); + void setRouteWidth(int width); + void setTrackStyle(Qt::PenStyle style); + void setRouteStyle(Qt::PenStyle style); private slots: void updatePOI(); @@ -103,6 +110,10 @@ private: bool _showPOILabels; bool _overlapPOIs; bool _showRouteWaypoints; + int _trackWidth; + int _routeWidth; + Qt::PenStyle _trackStyle; + Qt::PenStyle _routeStyle; bool _plot; }; diff --git a/src/poi.cpp b/src/poi.cpp index 603ef56d..557c019c 100644 --- a/src/poi.cpp +++ b/src/poi.cpp @@ -10,7 +10,7 @@ POI::POI(QObject *parent) : QObject(parent) { _errorLine = 0; - _radius = 0.01; + _radius = 1000; } bool POI::loadFile(const QString &fileName) @@ -66,11 +66,15 @@ QVector POI::points(const PathItem *path) const const QPainterPath &pp = path->path(); for (int i = 0; i < pp.elementCount(); i++) { - Coordinates p = Coordinates::fromMercator(pp.elementAt(i)); - min[0] = p.lon() - _radius; - min[1] = -p.lat() - _radius; - max[0] = p.lon() + _radius; - max[1] = -p.lat() + _radius; + const QPainterPath::Element &pe = pp.elementAt(i); + Coordinates p = Coordinates::fromMercator(QPointF(pe.x, -pe.y)); + + QPair br = p.boundingRect(_radius); + min[0] = br.first.lon(); + min[1] = br.first.lat(); + max[0] = br.second.lon(); + max[1] = br.second.lat(); + _tree.Search(min, max, cb, &set); } @@ -92,10 +96,13 @@ QVector POI::points(const QList &list) for (int i = 0; i < list.count(); i++) { const Coordinates &p = list.at(i)->waypoint().coordinates(); - min[0] = p.lon() - _radius; - min[1] = p.lat() - _radius; - max[0] = p.lon() + _radius; - max[1] = p.lat() + _radius; + + QPair br = p.boundingRect(_radius); + min[0] = br.first.lon(); + min[1] = br.first.lat(); + max[0] = br.second.lon(); + max[1] = br.second.lat(); + _tree.Search(min, max, cb, &set); } @@ -116,10 +123,13 @@ QVector POI::points(const QList &list) const for (int i = 0; i < list.count(); i++) { const Coordinates &p = list.at(i).coordinates(); - min[0] = p.lon() - _radius; - min[1] = p.lat() - _radius; - max[0] = p.lon() + _radius; - max[1] = p.lat() + _radius; + + QPair br = p.boundingRect(_radius); + min[0] = br.first.lon(); + min[1] = br.first.lat(); + max[0] = br.second.lon(); + max[1] = br.second.lat(); + _tree.Search(min, max, cb, &set); } @@ -168,7 +178,7 @@ void POI::clear() emit pointsChanged(); } -void POI::setRadius(qreal radius) +void POI::setRadius(unsigned radius) { _radius = radius; diff --git a/src/poi.h b/src/poi.h index c36fafb3..a1a1c93a 100644 --- a/src/poi.h +++ b/src/poi.h @@ -22,8 +22,8 @@ public: const QString &errorString() const {return _errorString;} int errorLine() const {return _errorLine;} - qreal radius() const {return _radius;} - void setRadius(qreal radius); + unsigned radius() const {return _radius;} + void setRadius(unsigned radius); QVector points(const PathItem *path) const; QVector points(const QList &list) const; @@ -49,7 +49,7 @@ private: QStringList _files; QList _indexes; - qreal _radius; + unsigned _radius; QString _errorString; int _errorLine; diff --git a/src/routeitem.cpp b/src/routeitem.cpp index d193890b..5824c44d 100644 --- a/src/routeitem.cpp +++ b/src/routeitem.cpp @@ -52,8 +52,6 @@ RouteItem::RouteItem(const Route &route, QGraphicsItem *parent) _marker->setPos(_path.elementAt(0)); - _pen.setStyle(Qt::DotLine); - setToolTip(toolTip()); } diff --git a/src/settings.h b/src/settings.h index c12092fd..b93fba4a 100644 --- a/src/settings.h +++ b/src/settings.h @@ -3,33 +3,94 @@ #define WINDOW_SETTINGS_GROUP "Window" #define WINDOW_SIZE_SETTING "size" +#define WINDOW_SIZE_DEFAULT QSize(600, 800) #define WINDOW_POS_SETTING "pos" +#define WINDOW_POS_DEFAULT QPoint(10, 10) #define SETTINGS_SETTINGS_GROUP "Settings" #define UNITS_SETTING "units" +#define UNITS_DEFAULT \ + (QLocale::system().measurementSystem() == QLocale::ImperialSystem) \ + ? Imperial : Metric #define SHOW_TOOLBARS_SETTING "toolbar" +#define SHOW_TOOLBARS_DEFAULT true #define GRAPH_SETTINGS_GROUP "Graph" #define SHOW_GRAPHS_SETTING "show" +#define SHOW_GRAPHS_DEFAULT true #define GRAPH_TYPE_SETTING "type" +#define GRAPH_TYPE_DEFAULT Distance #define SHOW_GRAPH_GRIDS_SETTING "grid" +#define SHOW_GRAPH_GRIDS_DEFAULT true #define MAP_SETTINGS_GROUP "Map" #define CURRENT_MAP_SETTING "map" #define SHOW_MAP_SETTING "show" +#define SHOW_MAP_DEFAULT true #define POI_SETTINGS_GROUP "POI" #define OVERLAP_POI_SETTING "overlap" +#define OVERLAP_POI_DEFAULT false #define LABELS_POI_SETTING "labels" +#define LABELS_POI_DEFAULT true #define SHOW_POI_SETTING "show" +#define SHOW_POI_DEFAULT false #define DISABLED_POI_FILE_SETTINGS_PREFIX "disabled" #define DISABLED_POI_FILE_SETTING "file" #define DATA_SETTINGS_GROUP "Data" #define SHOW_TRACKS_SETTING "tracks" +#define SHOW_TRACKS_DEFAULT true #define SHOW_ROUTES_SETTING "routes" +#define SHOW_ROUTES_DEFAULT true #define SHOW_WAYPOINTS_SETTING "waypoints" +#define SHOW_WAYPOINTS_DEFAULT true #define SHOW_ROUTE_WAYPOINTS_SETTING "routeWaypoints" +#define SHOW_ROUTE_WAYPOINTS_DEFAULT true #define SHOW_WAYPOINT_LABELS_SETTING "waypointLabels" +#define SHOW_WAYPOINT_LABELS_DEFAULT true + +#define EXPORT_SETTINGS_GROUP "Export" +#define PAPER_ORIENTATION_SETTING "orientation" +#define PAPER_ORIENTATION_DEFAULT QPrinter::Portrait +#define PAPER_SIZE_SETTING "size" +#define PAPER_SIZE_DEFAULT \ + (QLocale::system().measurementSystem() == QLocale::ImperialSystem) \ + ? QPrinter::Letter : QPrinter::A4 +#define MARGIN_LEFT_SETTING "marginLeft" +#define MARGIN_LEFT_DEFAULT 5 +#define MARGIN_TOP_SETTING "marginTop" +#define MARGIN_TOP_DEFAULT 5 +#define MARGIN_RIGHT_SETTING "marginRight" +#define MARGIN_RIGHT_DEFAULT 5 +#define MARGIN_BOTTOM_SETTING "marginBottom" +#define MARGIN_BOTTOM_DEFAULT 5 +#define EXPORT_FILENAME_SETTING "fileName" +#define EXPORT_FILENAME_DEFAULT \ + QString("%1/export.pdf").arg(QDir::currentPath()) + +#define OPTIONS_SETTINGS_GROUP "Options" +#define PALETTE_COLOR_SETTING "paletteColor" +#define PALETTE_COLOR_DEFAULT QColor(Qt::blue) +#define PALETTE_SHIFT_SETTING "paletteShift" +#define PALETTE_SHIFT_DEFAULT 0.62 +#define TRACK_WIDTH_SETTING "trackWidth" +#define TRACK_WIDTH_DEFAULT 3 +#define ROUTE_WIDTH_SETTING "routeWidth" +#define ROUTE_WIDTH_DEFAULT 3 +#define TRACK_STYLE_SETTING "trackStyle" +#define TRACK_STYLE_DEFAULT Qt::SolidLine +#define ROUTE_STYLE_SETTING "routeStyle" +#define ROUTE_STYLE_DEFAULT Qt::DotLine +#define GRAPH_WIDTH_SETTING "graphWidth" +#define GRAPH_WIDTH_DEFAULT 1 +#define PATH_AA_SETTING "pathAntiAliasing" +#define PATH_AA_DEFAULT true +#define GRAPH_AA_SETTING "graphAntiAliasing" +#define GRAPH_AA_DEFAULT false +#define POI_RADIUS_SETTING "poiRadius" +#define POI_RADIUS_DEFAULT 1000 +#define USE_OPENGL_SETTING "useOpenGL" +#define USE_OPENGL_DEFAULT false #endif // SETTINGS_H diff --git a/src/sliderinfoitem.cpp b/src/sliderinfoitem.cpp index a435c692..03f81d18 100644 --- a/src/sliderinfoitem.cpp +++ b/src/sliderinfoitem.cpp @@ -32,9 +32,11 @@ void SliderInfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem font.setPixelSize(FONT_SIZE); font.setFamily(FONT_FAMILY); QFontMetrics fm(font); - painter->setFont(font); + painter->setFont(font); + painter->setRenderHint(QPainter::Antialiasing, false); painter->setPen(Qt::red); + if (_side == Right) painter->drawText(SIZE, fm.height() - fm.descent(), _text); else diff --git a/src/stylecombobox.cpp b/src/stylecombobox.cpp new file mode 100644 index 00000000..c8921661 --- /dev/null +++ b/src/stylecombobox.cpp @@ -0,0 +1,61 @@ +#include +#include +#include +#include "stylecombobox.h" + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a)) + +StyleComboBox::StyleComboBox(QWidget *parent) : QComboBox(parent) +{ + Qt::PenStyle styles[] = {Qt::SolidLine, Qt::DashLine, Qt::DotLine, + Qt::DashDotLine, Qt::DashDotDotLine}; + + QSize is = iconSize(); + setIconSize(QSize(sizeHint().width(), is.height())); + is = iconSize(); + + for (size_t i = 0; i < ARRAY_SIZE(styles); i++) { + QPixmap pm(is); + pm.fill(Qt::transparent); + + QBrush brush(Qt::black); + QPen pen(brush, is.height() / 7, styles[i]); + + QPainter painter(&pm); + painter.setPen(pen); + painter.drawLine(0, is.height() / 2, is.width(), is.height() / 2); + + addItem(QIcon(pm), QString(), QVariant((int)styles[i])); + } +} + +void StyleComboBox::setValue(Qt::PenStyle value) +{ + for (int i = 0; i < count(); i++) { + if ((Qt::PenStyle) itemData(i).toInt() == value) { + setCurrentIndex(i); + return; + } + } +} + +void StyleComboBox::resizeEvent(QResizeEvent *event) +{ + QSize is = iconSize(); + setIconSize(QSize(event->size().width() - 30, is.height())); + is = iconSize(); + + for (int i = 0; i < count(); i++) { + QPixmap pm(is); + pm.fill(Qt::transparent); + + QBrush brush(Qt::black); + QPen pen(brush, is.height() / 7, (Qt::PenStyle) itemData(i).toInt()); + + QPainter painter(&pm); + painter.setPen(pen); + painter.drawLine(0, is.height() / 2, is.width(), is.height() / 2); + + setItemIcon(i, QIcon(pm)); + } +} diff --git a/src/stylecombobox.h b/src/stylecombobox.h new file mode 100644 index 00000000..2e30637a --- /dev/null +++ b/src/stylecombobox.h @@ -0,0 +1,19 @@ +#ifndef STYLECOMBOBOX_H +#define STYLECOMBOBOX_H + +#include + +class StyleComboBox : public QComboBox +{ + Q_OBJECT + +public: + StyleComboBox(QWidget *parent = 0); + + void setValue(Qt::PenStyle value); + +private: + void resizeEvent(QResizeEvent *event); +}; + +#endif // STYLECOMBOBOX_H