diff --git a/examples/cpp/custom-layers/main.cpp b/examples/cpp/custom-layers/main.cpp index 62505875c..ca69791d0 100644 --- a/examples/cpp/custom-layers/main.cpp +++ b/examples/cpp/custom-layers/main.cpp @@ -1,151 +1,151 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2012 Dennis Nienhüser // #include #include #include #include #include #include #include #include #include #include using namespace Marble; class MyPaintLayer : public QObject, public LayerInterface { public: // Constructor MyPaintLayer(MarbleWidget* widget); // Implemented from LayerInterface - virtual QStringList renderPosition() const; + QStringList renderPosition() const override; // Implemented from LayerInterface - virtual bool render( GeoPainter *painter, ViewportParams *viewport, - const QString &renderPos, GeoSceneLayer *layer); + bool render( GeoPainter *painter, ViewportParams *viewport, + const QString &renderPos, GeoSceneLayer *layer) override; // Overriding QObject - virtual bool eventFilter(QObject *obj, QEvent *event); + bool eventFilter(QObject *obj, QEvent *event) override; static GeoDataCoordinates approximate(const GeoDataCoordinates &base, qreal angle, qreal dist); private: MarbleWidget* m_widget; int m_index; }; MyPaintLayer::MyPaintLayer(MarbleWidget* widget) : m_widget(widget), m_index(0) { // nothing to do } QStringList MyPaintLayer::renderPosition() const { // We will paint in exactly one of the following layers. // The current one can be changed by pressing the '+' key const QStringList layers = QStringList() << QStringLiteral("SURFACE") << QStringLiteral("HOVERS_ABOVE_SURFACE") << QStringLiteral("ORBIT") << QStringLiteral("USER_TOOLS") << QStringLiteral("STARS"); int index = m_index % layers.size(); return QStringList() << layers.at(index); } bool MyPaintLayer::eventFilter(QObject *obj, QEvent *event) { Q_UNUSED(obj) // Adjust the current layer when '+' is pressed if (event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast(event); if (keyEvent->key() == Qt::Key_Plus) { ++m_index; return true; } } return false; } GeoDataCoordinates MyPaintLayer::approximate(const GeoDataCoordinates &base, qreal angle, qreal dist) { // This is just a rough estimation that ignores projections. // It only works for short distances. Don't use in real code. GeoDataCoordinates::Unit deg = GeoDataCoordinates::Degree; return GeoDataCoordinates ( base.longitude(deg) + 1.5 * dist * sin(angle), base.latitude(deg) + dist * cos(angle), 0.0, deg); } bool MyPaintLayer::render( GeoPainter *painter, ViewportParams *viewport, const QString& renderPos, GeoSceneLayer * layer ) { Q_UNUSED(viewport) Q_UNUSED(renderPos) Q_UNUSED(layer) // Have window title reflect the current paint layer m_widget->setWindowTitle(renderPosition().first()); GeoDataCoordinates home(8.4, 48.0, 0.0, GeoDataCoordinates::Degree); QTime now = QTime::currentTime(); painter->setRenderHint(QPainter::Antialiasing, true); // Large circle built by 60 small circles painter->setPen( QPen(QBrush(QColor::fromRgb(255,255,255,200)), 3.0, Qt::SolidLine, Qt::RoundCap ) ); for (int i=0; i<60; ++i) painter->drawEllipse(approximate(home, M_PI * i / 30.0, 1.0), 5, 5); // hour, minute, second hand painter->drawPolyline(GeoDataLineString() << home << approximate(home, M_PI * now.minute() / 30.0, 0.75)); painter->drawPolyline(GeoDataLineString() << home << approximate(home, M_PI * now.hour() / 6.0, 0.5)); painter->setPen(QPen(QBrush(Qt::red), 4.0, Qt::SolidLine, Qt::RoundCap )); painter->drawPolyline(GeoDataLineString() << home << approximate(home, M_PI * now.second() / 30.0, 1.0)); return true; } int main(int argc, char** argv) { QApplication app(argc,argv); MarbleWidget *mapWidget = new MarbleWidget; // Create and register our paint layer MyPaintLayer* layer = new MyPaintLayer(mapWidget); // Uncomment for older versions of Marble: // mapWidget->map()->model()->addLayer(layer); mapWidget->addLayer(layer); // Install an event handler: Pressing + will change the layer we paint at mapWidget->installEventFilter(layer); // Finish widget creation. mapWidget->setMapThemeId(QStringLiteral("earth/bluemarble/bluemarble.dgml")); // Ensure we see our rendered feature on start mapWidget->model()->setHome(8.4, 48.0, 1800); mapWidget->goHome(); mapWidget->show(); // Update each second to give the clock second resolution QTimer seconds; seconds.setInterval(1000); QObject::connect(&seconds, SIGNAL(timeout()), mapWidget, SLOT(update())); seconds.start(); return app.exec(); } diff --git a/examples/cpp/geopainter/main.cpp b/examples/cpp/geopainter/main.cpp index 1400324bf..e2657e694 100644 --- a/examples/cpp/geopainter/main.cpp +++ b/examples/cpp/geopainter/main.cpp @@ -1,41 +1,41 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2012 Dennis Nienhüser // #include #include #include using namespace Marble; class MyMarbleWidget : public MarbleWidget { public: - virtual void customPaint(GeoPainter* painter); + void customPaint(GeoPainter* painter) override; }; void MyMarbleWidget::customPaint(GeoPainter* painter) { GeoDataCoordinates home(8.4, 49.0, 0.0, GeoDataCoordinates::Degree); painter->setPen(Qt::green); painter->drawEllipse(home, 7, 7); painter->setPen(Qt::black); painter->drawText(home, QStringLiteral("Hello Marble!")); } int main(int argc, char** argv) { QApplication app(argc,argv); MyMarbleWidget *mapWidget = new MyMarbleWidget; mapWidget->setMapThemeId(QStringLiteral("earth/openstreetmap/openstreetmap.dgml")); mapWidget->centerOn(8.4, 49.0); mapWidget->show(); return app.exec(); } diff --git a/examples/cpp/marble-game/ClickOnThat.h b/examples/cpp/marble-game/ClickOnThat.h index 6b5b2e28a..d1fe412f4 100644 --- a/examples/cpp/marble-game/ClickOnThat.h +++ b/examples/cpp/marble-game/ClickOnThat.h @@ -1,58 +1,58 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2014 Abhinav Gangwar // #ifndef MARBLE_CLICK_ON_THAT #define MARBLE_CLICK_ON_THAT // Qt #include // Marble #include namespace Marble { class ClickOnThatPrivate; class MarbleWidget; class ClickOnThat : public QObject { Q_OBJECT public: explicit ClickOnThat( MarbleWidget *marbleWidget ); - ~ClickOnThat(); + ~ClickOnThat() override; /** * disable the GeoDataDocument which * shows the pin on map. This method * is called when this game quits. */ void disablePinDocument(); public Q_SLOTS: void initiateGame(); void postQuestion( QObject* ); void updateSelectPin( bool, const GeoDataCoordinates& ); void determineResult( qreal, qreal, GeoDataCoordinates::Unit ); void highlightCorrectAnswer(); Q_SIGNALS: void gameInitialized(); void updateResult( bool ); void announceHighlight(qreal, qreal, GeoDataCoordinates::Unit ); private: ClickOnThatPrivate * const d; }; } // namespace Marble #endif // MARBLE_CLICK_ON_THAT diff --git a/examples/cpp/marble-game/CountryByFlag.h b/examples/cpp/marble-game/CountryByFlag.h index 0b3f2bf55..86ef42a39 100644 --- a/examples/cpp/marble-game/CountryByFlag.h +++ b/examples/cpp/marble-game/CountryByFlag.h @@ -1,45 +1,45 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2014 Abhinav Gangwar // #ifndef MARBLE_COUNTRY_BY_FLAG #define MARBLE_COUNTRY_BY_FLAG // Qt #include namespace Marble { class CountryByFlagPrivate; class MarbleWidget; class CountryByFlag : public QObject { Q_OBJECT; public: explicit CountryByFlag( MarbleWidget *marbleWidget ); - ~CountryByFlag(); + ~CountryByFlag() override; public Q_SLOTS: void initiateGame(); void postQuestion( QObject* ); Q_SIGNALS: void gameInitialized(); private Q_SLOTS: //void displayResult( bool ); private: CountryByFlagPrivate * const d; }; } // namespace Marble #endif // MARBLE_COUNTRY_BY_FLAG diff --git a/examples/cpp/marble-game/CountryByShape.h b/examples/cpp/marble-game/CountryByShape.h index b739d8a60..91185d03f 100644 --- a/examples/cpp/marble-game/CountryByShape.h +++ b/examples/cpp/marble-game/CountryByShape.h @@ -1,46 +1,46 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2014 Abhinav Gangwar // #ifndef MARBLE_COUNTRY_BY_SHAPE #define MARBLE_COUNTRY_BY_SHAPE // Qt #include // Marble #include namespace Marble { class CountryByShapePrivate; class MarbleWidget; class CountryByShape : public QObject { Q_OBJECT public: explicit CountryByShape( MarbleWidget *widget ); - ~CountryByShape(); + ~CountryByShape() override; Q_SIGNALS: void gameInitialized(); void announceHighlight(qreal, qreal, GeoDataCoordinates::Unit ); public Q_SLOTS: void postQuestion( QObject *gameObject ); void initiateGame(); private: CountryByShapePrivate * const d; }; } // namespace Marble #endif // MARBLE_COUNTRY_BY_SHAPE diff --git a/examples/cpp/marble-game/GameMainWindow.h b/examples/cpp/marble-game/GameMainWindow.h index cce443f71..2454f7f9b 100644 --- a/examples/cpp/marble-game/GameMainWindow.h +++ b/examples/cpp/marble-game/GameMainWindow.h @@ -1,55 +1,55 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2014 Dennis Nienhüser // Copyright 2014 Abhinav Gangwar // #ifndef MARBLE_GAMEMAINWINDOW_H #define MARBLE_GAMEMAINWINDOW_H #include #include namespace Marble { class Private; class MarbleWidget; class MainWindow: public QMainWindow { Q_OBJECT public: explicit MainWindow( const QString &marbleDataPath, QWidget *parent = nullptr, Qt::WindowFlags flags = nullptr ); - virtual ~MainWindow(); + ~MainWindow() override; MarbleWidget *marbleWidget(); Q_SIGNALS: void announceHighlight(qreal, qreal, GeoDataCoordinates::Unit ); void postQuestion( QObject* ); private Q_SLOTS: void createQuestion(); void browseMapButtonClicked(); void disableGames(); void enableCountryShapeGame(); void enableCountryFlagGame(); void enableClickOnThatGame(); void displayResult( bool ); protected: - void resizeEvent( QResizeEvent *event ); + void resizeEvent( QResizeEvent *event ) override; private: Private * const d; }; } // namespace Marble #endif // MARBLE_GAMEMAINWINDOW_H diff --git a/examples/cpp/marbleQuick2/main.cpp b/examples/cpp/marbleQuick2/main.cpp index 8b1c75cee..3e58ea9d1 100644 --- a/examples/cpp/marbleQuick2/main.cpp +++ b/examples/cpp/marbleQuick2/main.cpp @@ -1,98 +1,98 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2014 Adam Dabrowski // #include #include #include #include #include using namespace Marble; class MarbleDemoItem : public MarbleQuickItem { Q_OBJECT public: MarbleDemoItem(QQuickItem *parent = nullptr) : MarbleQuickItem(parent) { // nothing to do } - void componentComplete() + void componentComplete() override { QQuickItem *pinch = findChild(QStringLiteral("pinchArea")); if (pinch) { pinch->installEventFilter(getEventFilter()); } } public Q_SLOTS: void handlePinchStart(QPointF center) { makePinch(center, Qt::GestureStarted); } void handlePinchUpdate(QPointF center, qreal scale) { makePinch(center, Qt::GestureUpdated, scale); } void handlePinchEnd(QPointF center, bool canceled) { makePinch(center, canceled ? Qt::GestureCanceled : Qt::GestureFinished); } private: void makePinch(QPointF center, Qt::GestureState state, qreal scale = 1) { scale = sqrt(sqrt(scale)); scale = qBound(static_cast(0.5), scale, static_cast(2.0)); pinch(center, scale, state); } }; class MapTestWrap : public QQuickView { public: void start() { MarbleDeclarativePlugin plugin; plugin.registerTypes("org.kde.marble"); setSource(QUrl(QStringLiteral("qrc:/main.qml"))); if(status()!=QQuickView::Ready) qDebug("can't initialise view"); QSurfaceFormat format; format.setAlphaBufferSize(8); setFormat(format); setClearBeforeRendering(true); setColor(QColor(Qt::transparent)); setTitle(QStringLiteral("Marble in QML 2.0 demo")); show(); } }; int main(int argc, char *argv[]) { QApplication app(argc, argv); MapTestWrap test; test.start(); return app.exec(); } #include "main.moc" diff --git a/examples/cpp/squad-interpolation/squad-interpolation.h b/examples/cpp/squad-interpolation/squad-interpolation.h index 1df9fb0e4..37e0ff577 100644 --- a/examples/cpp/squad-interpolation/squad-interpolation.h +++ b/examples/cpp/squad-interpolation/squad-interpolation.h @@ -1,56 +1,56 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2014 Dennis Nienhüser // #ifndef SQUAD_INTERPOLATION #define SQUAD_INTERPOLATION #include #include #include #include #include #include #include namespace Marble { class MyPaintLayer : public QObject, public LayerInterface { Q_OBJECT public: // Constructor explicit MyPaintLayer( MarbleWidget* widget ); // LayerInterface - QStringList renderPosition() const; + QStringList renderPosition() const override; bool render( GeoPainter *painter, ViewportParams *viewport, - const QString &renderPos, GeoSceneLayer *layer); + const QString &renderPos, GeoSceneLayer *layer) override; GeoDataLatLonBox center() const; private Q_SLOTS: void addInterpolatedPoint(); private: void addRandomCity( double minDistanceKm=500, double maxDistanceKm=1500 ); static GeoDataCoordinates basePoint( const GeoDataCoordinates &q1, const GeoDataCoordinates &q2, const GeoDataCoordinates &q3 ); MarbleWidget* m_widget; GeoDataLineString m_cities; GeoDataLineString m_interpolated; double m_fraction; double m_delta; int m_index; }; } #endif // SQUAD_INTERPOLATION diff --git a/src/plugins/render/annotate/DownloadOsmDialog.h b/src/plugins/render/annotate/DownloadOsmDialog.h index f0332867e..d8d41e723 100644 --- a/src/plugins/render/annotate/DownloadOsmDialog.h +++ b/src/plugins/render/annotate/DownloadOsmDialog.h @@ -1,58 +1,58 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2017 Sutirtha Ghosh // #ifndef DOWNLOADOSMDIALOG_H #define DOWNLOADOSMDIALOG_H #include #include #include #include #include #include #include "LatLonBoxWidget.h" #include "ui_DownloadOsmDialog.h" namespace Marble { class MarbleWidget; class AnnotatePlugin; class DownloadOsmDialog : public QDialog,private Ui::DownloadOsmDialog { Q_OBJECT public: explicit DownloadOsmDialog(MarbleWidget *parent = nullptr,AnnotatePlugin *annotatePlugin = nullptr); - ~DownloadOsmDialog(); + ~DownloadOsmDialog() override; Q_SIGNALS: void openFile(const QString &filename); private: void updateCoordinates(); MarbleWidget *m_marbleWidget; QPushButton *m_downloadButton; QNetworkAccessManager m_qnam; QNetworkReply *m_reply; QTemporaryFile *m_file; LatLonBoxWidget *m_latLonBoxWidget; bool m_isDownloadSuccess; private Q_SLOTS: void downloadFile(); void updateCoordinates(const GeoDataLatLonAltBox&); void httpReadyRead(); void httpFinished(); }; } #endif // DOWNLOADOSMDIALOG_H