File indexing completed on 2024-04-21 11:23:51

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2014 Sanjiban Bairagya <sanjiban22393@gmail.com>
0004 //
0005 
0006 #ifndef TOURPLAYBACK_H
0007 #define TOURPLAYBACK_H
0008 
0009 #include <QObject>
0010 
0011 #include "marble_export.h"
0012 
0013 class QUrl;
0014 
0015 namespace Marble
0016 {
0017 
0018 class MarbleWidget;
0019 class GeoDataCoordinates;
0020 class GeoDataTour;
0021 class GeoDataPlacemark;
0022 class GeoDataFeature;
0023 class GeoDataContainer;
0024 class PlaybackItem;
0025 
0026 class TourPlaybackPrivate;
0027 
0028 class MARBLE_EXPORT TourPlayback : public QObject
0029 {
0030     Q_OBJECT
0031 public:
0032     explicit TourPlayback(QObject *parent=nullptr);
0033     ~TourPlayback() override;
0034 
0035     void setTour(GeoDataTour *tour);
0036     void setMarbleWidget( MarbleWidget *widget );
0037 
0038     /**
0039      * @brief setBaseUrl - sets base url for using in QWebView.
0040      */
0041     void setBaseUrl( const QUrl &baseUrl );
0042 
0043     /**
0044      * @brief baseUrl - gets base url which is using in QWebView.
0045      */
0046     QUrl baseUrl() const;
0047 
0048     /** Tour duration in seconds */
0049     double duration() const;
0050     bool isPlaying() const;
0051 
0052     void play();
0053     void pause();
0054     void stop();
0055 
0056     /**
0057      * Seek to the given timestamp (in seconds)
0058      * @param offset Target timestamp in seconds in the range 0..duration()
0059      */
0060     void seek( double offset );
0061 
0062     /** Size of main track (flyto, wait, tourcontrol primitives) **/
0063     int mainTrackSize();
0064     /**
0065      * Element of main track (flyto, wait, tourcontrol primitives)
0066      * @param i Position of element.
0067      */
0068     PlaybackItem* mainTrackItemAt( int i );
0069 
0070 public Q_SLOTS:
0071     void updateTracks();
0072     void clearTracks();
0073 
0074 Q_SIGNALS:
0075     void finished();
0076     void paused();
0077     void stopped();
0078     void progressChanged( double );
0079     void updated( GeoDataFeature* );
0080     void added( GeoDataContainer *parent, GeoDataFeature *feature, int row );
0081     void removed(GeoDataFeature *feature);
0082     void itemFinished( int index );
0083 
0084 private Q_SLOTS:
0085     void stopTour();
0086     void showBalloon( GeoDataPlacemark* );
0087     void hideBalloon();
0088     void centerOn( const GeoDataCoordinates &coordinates );
0089     void handleFinishedItem( int index );
0090 
0091 private:
0092     TourPlaybackPrivate * const d;
0093 };
0094 
0095 } // namespace Marble
0096 
0097 #endif // TOURPLAYBACK_H