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