File indexing completed on 2024-05-05 03:50:48

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 "PanoramioPlugin.h"
0008 
0009 #include "PanoramioModel.h"
0010 
0011 #include "MarbleWidget.h"
0012 
0013 using namespace Marble;
0014 
0015 PanoramioPlugin::PanoramioPlugin( const MarbleModel *marbleModel ) :
0016     AbstractDataPlugin( marbleModel )
0017 {
0018 }
0019 
0020 QString Marble::PanoramioPlugin::nameId() const
0021 {
0022     return QStringLiteral("panoramio");
0023 }
0024 
0025 void PanoramioPlugin::initialize()
0026 {
0027     setModel( new PanoramioModel( marbleModel(), this ) );
0028     setNumberOfItems( numberOfImagesPerFetch );
0029 }
0030 
0031 QString PanoramioPlugin::name() const
0032 {
0033     return tr( "Panoramio Photos" );
0034 }
0035 
0036 QString PanoramioPlugin::guiString() const
0037 {
0038     return tr( "&Panoramio" );
0039 }
0040 
0041 QString PanoramioPlugin::description() const
0042 {
0043     return tr( "Automatically downloads images from around the world in preference to their popularity" );
0044 }
0045 
0046 QIcon PanoramioPlugin::icon() const
0047 {
0048     return QIcon(QStringLiteral(":/icons/panoramio.png"));
0049 }
0050 
0051 
0052 QString Marble::PanoramioPlugin::version() const
0053 {
0054     return QStringLiteral("0.1");
0055 }
0056 
0057 QString PanoramioPlugin::copyrightYears() const
0058 {
0059     return QStringLiteral("2009, 2014");
0060 }
0061 
0062 QVector<PluginAuthor> PanoramioPlugin::pluginAuthors() const
0063 {
0064     return QVector<PluginAuthor>() << PluginAuthor(QStringLiteral("Bastian Holst"), QStringLiteral("bastianholst@gmx.de"));
0065 }
0066 
0067 bool PanoramioPlugin::eventFilter(QObject *object, QEvent *event)
0068 {
0069     if ( isInitialized() ) {
0070         Q_ASSERT( dynamic_cast<PanoramioModel *>( model() ) != 0 );
0071 
0072         PanoramioModel *photoPluginModel = static_cast<PanoramioModel *>( model() );
0073         MarbleWidget *widget = dynamic_cast<MarbleWidget *>( object );
0074         if ( widget ) {
0075             photoPluginModel->setMarbleWidget( widget );
0076         }
0077     }
0078 
0079     return AbstractDataPlugin::eventFilter( object, event );
0080 }
0081 
0082 #include "moc_PanoramioPlugin.cpp"