File indexing completed on 2024-05-12 07:43:22
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2010 Niko Sams <niko.sams@gmail.com> 0004 // 0005 0006 0007 #ifndef MARBLE_ROUTINGPROFILESMODEL_H 0008 #define MARBLE_ROUTINGPROFILESMODEL_H 0009 0010 #include "marble_export.h" 0011 #include "RoutingProfile.h" 0012 0013 #include <QAbstractListModel> 0014 0015 0016 namespace Marble { 0017 0018 class PluginManager; 0019 0020 class MARBLE_EXPORT RoutingProfilesModel : public QAbstractListModel 0021 { 0022 Q_OBJECT 0023 public: 0024 explicit RoutingProfilesModel( const PluginManager *pluginManager, QObject *parent = nullptr ); 0025 0026 QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override; 0027 int rowCount( const QModelIndex& parent = QModelIndex() ) const override; 0028 bool removeRows( int row, int count, const QModelIndex& parent = QModelIndex() ) override; 0029 0030 enum ProfileTemplate { 0031 CarFastestTemplate, 0032 CarShortestTemplate, 0033 CarEcologicalTemplate, 0034 BicycleTemplate, 0035 PedestrianTemplate, 0036 0037 LastTemplate 0038 }; 0039 0040 void setProfiles( const QList<RoutingProfile> &profiles ); 0041 QList<RoutingProfile> profiles() const; 0042 0043 void loadDefaultProfiles(); 0044 0045 void addProfile( const QString &name ); 0046 bool moveUp( int row ); 0047 bool moveDown( int row ); 0048 0049 bool setProfileName( int row, const QString &name ); 0050 bool setProfilePluginSettings( int row, const QHash<QString, QHash<QString, QVariant> > &pluginSettings ); 0051 0052 private: 0053 QList<RoutingProfile> m_profiles; 0054 const PluginManager* m_pluginManager; 0055 }; 0056 0057 } 0058 0059 #endif // MARBLE_ROUTINGPROFILESMODEL_H