Skip to content

Commit

Permalink
Add git pre-commit hooks
Browse files Browse the repository at this point in the history
- Added git pre-commit hooks
- Fixed mixed line-endings (final: \n)
- Fixed clang-format errors
- Updated legacy header
  • Loading branch information
AmonRaNet committed Apr 26, 2020
1 parent fb1ea3d commit 3dfb906
Show file tree
Hide file tree
Showing 88 changed files with 8,086 additions and 8,097 deletions.
86 changes: 43 additions & 43 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.dll
*.dylib

# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build*

# Qt unit tests
target_wrapper.*

# QtCreator
*.autosave

# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*

# QtCreator CMake
CMakeLists.txt.user*
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.dll
*.dylib

# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build*

# Qt unit tests
target_wrapper.*

# QtCreator
*.autosave

# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*

# QtCreator CMake
CMakeLists.txt.user*
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
repos:
- repo: local
hooks:
- id: legacy-headers
name: Update legacy headers
entry: scripts/add_header.py
args: [--apply,.,scripts/legacy_head.txt]
language: script
always_run: true
pass_filenames: false
stages: [commit]

- repo: https://github.com/pocc/pre-commit-hooks
rev: python
hooks:
- id: clang-format
args: [-i]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: check-added-large-files
args: [--maxkb=100]
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PROJECT_NAME = "QGeoView"
PROJECT_NUMBER = 1.0
PROJECT_NUMBER = 1.0
PROJECT_BRIEF = "QGeoView documentation"

ALWAYS_DETAILED_SEC = YES
Expand Down
1 change: 0 additions & 1 deletion QGeoView.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = lib \
demo

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ What things you need:
* Qt 5.6 or higher (core, gui, widgets, network)
* qmake or cmake
* doxygen (optional)
* pre-commits (optional) https://pre-commit.com/

### Installing

Expand Down
8 changes: 8 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Release Notes

## v1.0.2 - 26.04.2020

Maintenance work:
- Added git pre-commit hooks
- Fixed mixed line-endings (final: \n)
- Fixed clang-format errors
- Updated legacy header

## v1.0.1 - 30.12.2019

Relicense to LGPL 3.0 instead of GPL 3.0
Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
theme: jekyll-theme-cayman
theme: jekyll-theme-cayman
160 changes: 80 additions & 80 deletions demo/demoitem.cpp
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
/***************************************************************************
* QGeoView is a Qt / C ++ widget for visualizing geographic data.
* Copyright (C) 2018-2019 Andrey Yaroshenko.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, see https://www.gnu.org/licenses.
****************************************************************************/

#include "demoitem.h"

DemoItem::DemoItem(QGVMap* geoMap, SelectorDialog::Type type, QObject* parent)
: QObject(parent)
, mGeoMap(geoMap)
{
mSelectorDialog.reset(new SelectorDialog(type));
}

QGVMap* DemoItem::geoMap() const
{
return mGeoMap;
}

SelectorDialog* DemoItem::selector() const
{
return mSelectorDialog.data();
}

void DemoItem::init()
{
onInit();
Q_EMIT ready(this);
}
void DemoItem::start()
{
onStart();
Q_EMIT started(this);
}
void DemoItem::end()
{
onEnd();
Q_EMIT ended(this);
}

QGV::GeoPos DemoItem::randPos(const QGV::GeoRect& targetArea)
{
const double latRange = targetArea.latTop() - targetArea.latBottom();
const double lonRange = targetArea.lonRigth() - targetArea.lonLeft();
static const int range = 1000;
return { targetArea.latBottom() + latRange * (qrand() % range) / range,
targetArea.lonLeft() + lonRange * (qrand() % range) / range };
}

QGV::GeoRect DemoItem::randRect(const QGV::GeoRect& targetArea, const QSizeF& size)
{
const auto baseGeo = randPos(targetArea);
const auto base = geoMap()->getProjection()->geoToProj(baseGeo);
return geoMap()->getProjection()->projToGeo({ base, base + QPointF(size.width(), size.height()) });
}

QGV::GeoRect DemoItem::randRect(const QGV::GeoRect& targetArea, int baseSize)
{
const auto size = randSize(baseSize);
return randRect(targetArea, size);
}

QSizeF DemoItem::randSize(int baseSize)
{
const int range = -baseSize / 2;
return QSize(baseSize + (qrand() % range), baseSize + (qrand() % range));
}
/***************************************************************************
* QGeoView is a Qt / C ++ widget for visualizing geographic data.
* Copyright (C) 2018-2020 Andrey Yaroshenko.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, see https://www.gnu.org/licenses.
****************************************************************************/

#include "demoitem.h"

DemoItem::DemoItem(QGVMap* geoMap, SelectorDialog::Type type, QObject* parent)
: QObject(parent)
, mGeoMap(geoMap)
{
mSelectorDialog.reset(new SelectorDialog(type));
}

QGVMap* DemoItem::geoMap() const
{
return mGeoMap;
}

SelectorDialog* DemoItem::selector() const
{
return mSelectorDialog.data();
}

void DemoItem::init()
{
onInit();
Q_EMIT ready(this);
}
void DemoItem::start()
{
onStart();
Q_EMIT started(this);
}
void DemoItem::end()
{
onEnd();
Q_EMIT ended(this);
}

QGV::GeoPos DemoItem::randPos(const QGV::GeoRect& targetArea)
{
const double latRange = targetArea.latTop() - targetArea.latBottom();
const double lonRange = targetArea.lonRigth() - targetArea.lonLeft();
static const int range = 1000;
return { targetArea.latBottom() + latRange * (qrand() % range) / range,
targetArea.lonLeft() + lonRange * (qrand() % range) / range };
}

QGV::GeoRect DemoItem::randRect(const QGV::GeoRect& targetArea, const QSizeF& size)
{
const auto baseGeo = randPos(targetArea);
const auto base = geoMap()->getProjection()->geoToProj(baseGeo);
return geoMap()->getProjection()->projToGeo({ base, base + QPointF(size.width(), size.height()) });
}

QGV::GeoRect DemoItem::randRect(const QGV::GeoRect& targetArea, int baseSize)
{
const auto size = randSize(baseSize);
return randRect(targetArea, size);
}

QSizeF DemoItem::randSize(int baseSize)
{
const int range = -baseSize / 2;
return QSize(baseSize + (qrand() % range), baseSize + (qrand() % range));
}
Loading

0 comments on commit 3dfb906

Please sign in to comment.