1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 11:45:53 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2023-12-26 14:14:08 +01:00
parent 9380f31022
commit 14dc2af877
18 changed files with 31 additions and 32 deletions

View File

@ -2,12 +2,6 @@
#include <QLineEdit>
#include "pluginparameters.h"
static const QMap<QString, QStringList> pluginParams = {
{"nmea", {"nmea.source", "nmea.baudrate"}},
{"serialnmea", {"serialnmea.serial_port"}},
{"geoclue2", {"desktopId"}}
};
static void deleteLayout(QLayout *layout)
{
if (!layout)
@ -32,6 +26,12 @@ PluginParameters::PluginParameters(const QString &plugin,
void PluginParameters::setPlugin(const QString &plugin)
{
static const QMap<QString, QStringList> pluginParams = {
{"nmea", {"nmea.source", "nmea.baudrate"}},
{"serialnmea", {"serialnmea.serial_port"}},
{"geoclue2", {"desktopId"}}
};
saveParameters();
QStringList params = pluginParams.value(plugin);

View File

@ -323,7 +323,7 @@ bool ISO8211::readRecord(Record &record)
const FieldDefinition &def = fields.at(i);
Data data;
FieldsMap::const_iterator it = _map.find(def.tag);
FieldsMap::const_iterator it(_map.find(def.tag));
if (it == _map.constEnd()) {
_errorString = QString("%1: unknown record").arg(QString(def.tag));
return false;

View File

@ -86,7 +86,7 @@ static QMap<uint,uint> orderMap = orderMapInit();
static uint order(uint type)
{
uint st = ((type>>16) == BUAARE) ? type : (type & 0xFFFF0000);
QMap<uint, uint>::const_iterator it = orderMap.find(st);
QMap<uint, uint>::const_iterator it(orderMap.find(st));
return (it == orderMap.constEnd()) ? (type>>16) + 512 : it.value();
}

View File

@ -15,7 +15,8 @@ using namespace ENC;
typedef QSet<Coordinates> PointSet;
static const float C1 = 0.866025f; /* sqrt(3)/2 */
static const QColor haloColor(Qt::white);
static const QColor tsslptPen = QColor("#eb49eb");
static const QColor tsslptBrush = QColor("#80eb49eb");
static const Style *style()
{
@ -174,8 +175,8 @@ void RasterTile::drawArrows(QPainter *painter,
QPolygonF polygon(tsslptArrow(centroid(poly.path().first()),
deg2rad(180 - poly.param().toDouble())));
painter->setPen(QPen(QColor("#eb49eb"), 1));
painter->setBrush(QBrush("#80eb49eb"));
painter->setPen(QPen(tsslptPen, 1));
painter->setBrush(QBrush(tsslptBrush));
painter->drawPolygon(polygon);
}
}

View File

@ -344,7 +344,7 @@ const Style::Line &Style::line(uint type) const
{
static Line null;
QMap<uint, Line>::const_iterator it = _lines.find(type);
QMap<uint, Line>::const_iterator it(_lines.find(type));
return (it == _lines.constEnd()) ? null : *it;
}
@ -352,7 +352,7 @@ const Style::Polygon &Style::polygon(uint type) const
{
static Polygon null;
QMap<uint, Polygon>::const_iterator it = _polygons.find(type);
QMap<uint, Polygon>::const_iterator it(_polygons.find(type));
return (it == _polygons.constEnd()) ? null : *it;
}
@ -360,7 +360,7 @@ const Style::Point &Style::point(uint type) const
{
static Point null;
QMap<uint, Point>::const_iterator it = _points.find(type);
QMap<uint, Point>::const_iterator it(_points.find(type));
return (it == _points.constEnd()) ? null : *it;
}

View File

@ -111,6 +111,7 @@ private:
QMap<uint, Point> _points;
QVector<uint> _drawOrder;
/* Fonts and images must be initialized after QGuiApplication! */
QFont _small, _normal, _large;
QImage _light, _signal;
};

View File

@ -105,7 +105,7 @@ bool IMGData::readFAT(QFile &file, TileMap &tileMap)
QByteArray fn(name, sizeof(name));
if (VectorTile::isTileFile(tt)) {
VectorTile *tile;
TileMap::const_iterator it = tileMap.find(fn);
TileMap::const_iterator it(tileMap.find(fn));
if (it == tileMap.constEnd()) {
tile = new VectorTile();
tileMap.insert(fn, tile);

View File

@ -1,7 +1,6 @@
#include <QFont>
#include <QPainter>
#include <QCache>
#include "map/imgmap.h"
#include "map/textpathitem.h"
#include "map/textpointitem.h"
#include "map/bitmapline.h"

View File

@ -1250,7 +1250,7 @@ const Style::Line &Style::line(quint32 type) const
{
static Line null;
QMap<quint32, Line>::const_iterator it = _lines.find(type);
QMap<quint32, Line>::const_iterator it(_lines.find(type));
return (it == _lines.constEnd()) ? null : *it;
}
@ -1258,7 +1258,7 @@ const Style::Polygon &Style::polygon(quint32 type) const
{
static Polygon null;
QMap<quint32, Polygon>::const_iterator it = _polygons.find(type);
QMap<quint32, Polygon>::const_iterator it(_polygons.find(type));
return (it == _polygons.constEnd()) ? null : *it;
}
@ -1266,7 +1266,7 @@ const Style::Point &Style::point(quint32 type) const
{
static Point null;
QMap<quint32, Point>::const_iterator it = _points.find(type);
QMap<quint32, Point>::const_iterator it(_points.find(type));
return (it == _points.constEnd()) ? null : *it;
}

View File

@ -176,6 +176,7 @@ private:
QMap<quint32, Point> _points;
QList<quint32> _drawOrder;
/* Fonts and images must be initialized after QGuiApplication! */
QFont _large, _normal, _small, _extraSmall;
};

View File

@ -99,7 +99,7 @@ QMap<int, Conversion::Entry> Conversion::defaults()
Conversion Conversion::conversion(int id)
{
QMap<int, Entry>::const_iterator it = _conversions.find(id);
QMap<int, Entry>::const_iterator it(_conversions.find(id));
if (it == _conversions.constEnd())
return Conversion();

View File

@ -1,6 +1,5 @@
#include <QFile>
#include "common/csv.h"
#include "angularunits.h"
#include "pcs.h"
QMap<int, PCS::Entry> PCS::_pcss = defaults();
@ -14,7 +13,7 @@ QMap<int, PCS::Entry> PCS::defaults()
PCS PCS::pcs(int id)
{
QMap<int, Entry>::const_iterator it = _pcss.find(id);
QMap<int, Entry>::const_iterator it(_pcss.find(id));
if (it == _pcss.constEnd())
return PCS();

View File

@ -5,7 +5,6 @@
#include <QRegularExpression>
#include <QtEndian>
#include "common/rectc.h"
#include "common/wgs84.h"
#include "common/color.h"
#include "calibrationpoint.h"
#include "utm.h"

View File

@ -1,6 +1,7 @@
#ifndef TEXTPOINTITEM_H
#define TEXTPOINTITEM_H
#include <cmath>
#include "textitem.h"
class QFont;

View File

@ -110,8 +110,8 @@ void TileLoader::loadTilesSync(QVector<Tile> &list)
for (int i = 0; i < tl.size(); i++) {
Tile *t = tl[i];
QString file = tileFile(*t);
if (QFileInfo(file).exists())
QString file(tileFile(*t));
if (QFileInfo::exists(file))
t->setFile(file);
}
}

View File

@ -1,4 +1,3 @@
#include "projection.h"
#include "matrix.h"
#include "transform.h"

View File

@ -321,7 +321,7 @@ bool WMS::parseCapabilities()
void WMS::capabilitiesReady()
{
if (!QFileInfo(_path).exists()) {
if (!QFileInfo::exists(_path)) {
_errorString = "Error downloading capabilities XML file";
_valid = false;
} else {
@ -338,7 +338,7 @@ WMS::WMS(const QString &file, const WMS::Setup &setup, QObject *parent)
QString url = QString("%1%2service=WMS&request=GetCapabilities")
.arg(setup.url(), setup.url().contains('?') ? "&" : "?");
if (!QFileInfo(file).exists()) {
if (!QFileInfo::exists(file)) {
Downloader *downloader = new Downloader(this);
connect(downloader, &Downloader::finished, this,
&WMS::capabilitiesReady);

View File

@ -6,7 +6,6 @@
#include <QStringList>
#include <QtAlgorithms>
#include <QXmlStreamReader>
#include "pcs.h"
#include "crs.h"
#include "wmts.h"
@ -301,7 +300,7 @@ bool WMTS::parseCapabilities(CTX &ctx)
void WMTS::capabilitiesReady()
{
if (!QFileInfo(_path).exists()) {
if (!QFileInfo::exists(_path)) {
_errorString = "Error downloading capabilities XML file";
_valid = false;
} else {
@ -354,7 +353,7 @@ WMTS::WMTS(const QString &file, const WMTS::Setup &setup, QObject *parent)
_path = url.isLocalFile() ? url.toLocalFile() : file;
if (!url.isLocalFile() && !QFileInfo(file).exists()) {
if (!url.isLocalFile() && !QFileInfo::exists(file)) {
Downloader *downloader = new Downloader(this);
connect(downloader, &Downloader::finished, this,
&WMTS::capabilitiesReady);