File indexing completed on 2024-04-14 03:47:39
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de> 0004 // 0005 0006 // self 0007 #include "AbstractDataPluginItem.h" 0008 0009 // Marble 0010 #include "GeoDataCoordinates.h" 0011 #include "ViewportParams.h" 0012 #include "MarbleDebug.h" 0013 0014 // Qt 0015 #include <QAction> 0016 #include <QRect> 0017 #include <QSize> 0018 0019 namespace Marble 0020 { 0021 0022 class AbstractDataPluginItemPrivate 0023 { 0024 public: 0025 QString m_id; 0026 QString m_toolTip; 0027 bool m_favorite; 0028 bool m_sticky; 0029 qreal m_addedAngularResolution; 0030 0031 AbstractDataPluginItemPrivate(); 0032 }; 0033 0034 AbstractDataPluginItemPrivate::AbstractDataPluginItemPrivate() 0035 : m_favorite( false ), 0036 m_sticky( false ), 0037 m_addedAngularResolution( 0 ) 0038 { 0039 // nothing to do 0040 } 0041 0042 AbstractDataPluginItem::AbstractDataPluginItem( QObject *parent ) 0043 : QObject( parent ), 0044 BillboardGraphicsItem(), 0045 d( new AbstractDataPluginItemPrivate ) 0046 { 0047 // nothing to do 0048 } 0049 0050 AbstractDataPluginItem::~AbstractDataPluginItem() 0051 { 0052 delete d; 0053 } 0054 0055 QString AbstractDataPluginItem::toolTip() const 0056 { 0057 return d->m_toolTip; 0058 } 0059 0060 void AbstractDataPluginItem::setToolTip( const QString& toolTip ) 0061 { 0062 d->m_toolTip = toolTip; 0063 } 0064 0065 QString AbstractDataPluginItem::id() const 0066 { 0067 return d->m_id; 0068 } 0069 0070 void AbstractDataPluginItem::setId( const QString& id ) 0071 { 0072 d->m_id = id; 0073 } 0074 0075 bool AbstractDataPluginItem::isFavorite() const 0076 { 0077 return d->m_favorite; 0078 } 0079 0080 void AbstractDataPluginItem::setFavorite( bool favorite ) 0081 { 0082 if ( isFavorite() != favorite ) { 0083 d->m_favorite = favorite; 0084 emit favoriteChanged( id(), favorite ); 0085 } 0086 } 0087 0088 bool AbstractDataPluginItem::isSticky() const 0089 { 0090 return d->m_sticky; 0091 } 0092 0093 void AbstractDataPluginItem::setSticky( bool sticky ) 0094 { 0095 if ( d->m_sticky != sticky ) { 0096 d->m_sticky = sticky; 0097 emit stickyChanged(); 0098 } 0099 } 0100 0101 void AbstractDataPluginItem::toggleFavorite() 0102 { 0103 setFavorite( !isFavorite() ); 0104 } 0105 0106 qreal AbstractDataPluginItem::addedAngularResolution() const 0107 { 0108 return d->m_addedAngularResolution; 0109 } 0110 0111 void AbstractDataPluginItem::setAddedAngularResolution( qreal resolution ) 0112 { 0113 d->m_addedAngularResolution = resolution; 0114 } 0115 0116 void AbstractDataPluginItem::setSettings( const QHash<QString, QVariant>& settings ) 0117 { 0118 Q_UNUSED( settings ) 0119 } 0120 0121 QAction *AbstractDataPluginItem::action() 0122 { 0123 return nullptr; 0124 } 0125 0126 void AbstractDataPluginItem::addDownloadedFile( const QString& url, const QString& type ) 0127 { 0128 Q_UNUSED( url ) 0129 Q_UNUSED( type ) 0130 } 0131 0132 QList<QAction*> AbstractDataPluginItem::actions() 0133 { 0134 QList<QAction*> result; 0135 QAction* pluginAction = action(); 0136 0137 if ( pluginAction ) { 0138 result << pluginAction; 0139 } 0140 0141 return result; 0142 } 0143 0144 } // Marble namespace 0145 0146 #include "moc_AbstractDataPluginItem.cpp"