• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • plugins
  • render
  • foursquare
FoursquarePlugin.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2012 Utku Aydın <utkuaydin34@gmail.com>
9 //
10 
11 #include "FoursquarePlugin.h"
12 #include "FoursquareModel.h"
13 #include <QSettings>
14 
15 namespace Marble {
16 
17 FoursquarePlugin::FoursquarePlugin()
18  : AbstractDataPlugin( 0 )
19 {
20 }
21 
22 FoursquarePlugin::FoursquarePlugin(const MarbleModel* marbleModel)
23  : AbstractDataPlugin(marbleModel)
24 {
25  setEnabled( true ); // Plugin is enabled by default
26  setVisible( false ); // Plugin is invisible by default
27 }
28 
29 void FoursquarePlugin::initialize()
30 {
31  FoursquareModel *model = new FoursquareModel( marbleModel(), this );
32  setModel( model );
33  setNumberOfItems( 20 ); // Do we hardcode that?
34 }
35 
36 QString FoursquarePlugin::name() const
37 {
38  return tr( "Places" );
39 }
40 
41 QString FoursquarePlugin::guiString() const
42 {
43  return tr( "&Places" ); // TODO: Check if that ampersand conflicts with another
44 }
45 
46 QString FoursquarePlugin::nameId() const
47 {
48  return "foursquare";
49 }
50 
51 QString FoursquarePlugin::version() const
52 {
53  return "1.0";
54 }
55 
56 QString FoursquarePlugin::description() const
57 {
58  return tr( "Displays trending Foursquare places" );
59 }
60 
61 QString FoursquarePlugin::copyrightYears() const
62 {
63  return "2012";
64 }
65 
66 QList<PluginAuthor> FoursquarePlugin::pluginAuthors() const
67 {
68  return QList<PluginAuthor>()
69  << PluginAuthor( QString::fromUtf8( "Dennis Nienhüser" ), "earthwings@gentoo.org" )
70  << PluginAuthor( QString::fromUtf8( "Utku Aydın" ), "utkuaydin34@gmail.com" );
71 }
72 
73 QIcon FoursquarePlugin::icon() const
74 {
75  return QIcon(":/icons/places.png");
76 }
77 
78 bool FoursquarePlugin::isAuthenticated()
79 {
80  QSettings settings;
81 
82  return !settings.value( "access_token" ).isNull();
83 }
84 
85 bool FoursquarePlugin::storeAccessToken(const QString& tokenUrl)
86 {
87  QString expected = "http://edu.kde.org/marble/dummy#access_token=";
88  if( tokenUrl.startsWith( expected ) ) {
89  QSettings settings;
90  QString url = tokenUrl;
91  settings.setValue( "access_token", url.remove( expected ) );
92  return true;
93  } else {
94  return false;
95  }
96 }
97 
98 }
99 
100 Q_EXPORT_PLUGIN2(FoursquarePlugin, Marble::FoursquarePlugin)
101 #include "FoursquarePlugin.moc"
102 
Marble::AbstractDataPlugin::setNumberOfItems
void setNumberOfItems(quint32 number)
Set the number of items to be shown at the same time.
Definition: AbstractDataPlugin.cpp:156
Marble::FoursquarePlugin::isAuthenticated
Q_INVOKABLE bool isAuthenticated()
Checks if there is an access token stored.
Definition: FoursquarePlugin.cpp:78
FoursquareModel.h
Marble::FoursquarePlugin::FoursquarePlugin
FoursquarePlugin()
Definition: FoursquarePlugin.cpp:17
FoursquarePlugin.h
Marble::PluginAuthor
Definition: PluginInterface.h:28
Marble::FoursquarePlugin
Definition: FoursquarePlugin.h:19
Marble::AbstractDataPlugin
An abstract class for plugins that show data that has a geo coordinate.
Definition: AbstractDataPlugin.h:45
QString::remove
QString & remove(int position, int n)
Marble::FoursquareModel
Definition: FoursquareModel.h:18
QObject::tr
QString tr(const char *sourceText, const char *disambiguation, int n)
Marble::FoursquarePlugin::storeAccessToken
Q_INVOKABLE bool storeAccessToken(const QString &tokenUrl)
Stores the access token.
Definition: FoursquarePlugin.cpp:85
QSettings::setValue
void setValue(const QString &key, const QVariant &value)
Marble::FoursquarePlugin::pluginAuthors
QList< PluginAuthor > pluginAuthors() const
Definition: FoursquarePlugin.cpp:66
Marble::FoursquarePlugin::description
QString description() const
Returns a user description of the plugin.
Definition: FoursquarePlugin.cpp:56
QString::fromUtf8
QString fromUtf8(const char *str, int size)
QVariant::isNull
bool isNull() const
QString::startsWith
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
Marble::RenderPlugin::setVisible
void setVisible(bool visible)
settting visible
Definition: RenderPlugin.cpp:151
QString
QList
Marble::AbstractDataPlugin::setModel
void setModel(AbstractDataPluginModel *model)
Set the model of the plugin.
Definition: AbstractDataPlugin.cpp:134
Q_EXPORT_PLUGIN2
#define Q_EXPORT_PLUGIN2(a, b)
Definition: marble_export.h:34
QSettings
Marble::FoursquarePlugin::name
QString name() const
Returns the user-visible name of the plugin.
Definition: FoursquarePlugin.cpp:36
Marble::MarbleModel
The data model (not based on QAbstractModel) for a MarbleWidget.
Definition: MarbleModel.h:97
QSettings::value
QVariant value(const QString &key, const QVariant &defaultValue) const
Marble::RenderPlugin::setEnabled
void setEnabled(bool enabled)
settting enabled
Definition: RenderPlugin.cpp:139
Marble::FoursquarePlugin::copyrightYears
QString copyrightYears() const
Definition: FoursquarePlugin.cpp:61
Marble::FoursquarePlugin::nameId
QString nameId() const
Returns the unique name of the plugin.
Definition: FoursquarePlugin.cpp:46
Marble::FoursquarePlugin::guiString
QString guiString() const
String that should be displayed in GUI.
Definition: FoursquarePlugin.cpp:41
Marble::FoursquarePlugin::version
QString version() const
Definition: FoursquarePlugin.cpp:51
Marble::RenderPlugin::marbleModel
const MarbleModel * marbleModel() const
Access to the MarbleModel.
Definition: RenderPlugin.cpp:83
Marble::RenderPlugin::settings
virtual QHash< QString, QVariant > settings() const
Settings of the plugin.
Definition: RenderPlugin.cpp:185
Marble::FoursquarePlugin::icon
QIcon icon() const
Returns an icon for the plugin.
Definition: FoursquarePlugin.cpp:73
Marble::AbstractDataPlugin::model
AbstractDataPluginModel * model()
Definition: AbstractDataPlugin.cpp:124
QIcon
Marble::FoursquarePlugin::initialize
virtual void initialize()
Definition: FoursquarePlugin.cpp:29
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal