• 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
  • lib
  • marble
  • cloudsync
OwncloudSyncBackend.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 2013 Utku Aydın <utkuaydin34@gmail.com>
9 //
10 
11 #include "OwncloudSyncBackend.h"
12 
13 #include "MarbleDirs.h"
14 #include "MarbleModel.h"
15 #include "MarbleDebug.h"
16 #include "GeoDocument.h"
17 #include "MarbleWidget.h"
18 #include "RenderPlugin.h"
19 #include "RoutingModel.h"
20 #include "GeoDataParser.h"
21 #include "GeoDataFolder.h"
22 #include "RoutingManager.h"
23 #include "GeoDataDocument.h"
24 #include "CloudRouteModel.h"
25 #include "GeoDataPlacemark.h"
26 #include "CloudSyncManager.h"
27 #include "GeoDataDocument.h"
28 #include "GeoDocument.h"
29 #include "GeoDataTypes.h"
30 #include "GeoDataExtendedData.h"
31 
32 #include <QNetworkAccessManager>
33 #include <QScriptValueIterator>
34 #include <QNetworkRequest>
35 #include <QNetworkReply>
36 #include <QScriptEngine>
37 #include <QFileInfo>
38 #include <QBuffer>
39 #include <QTimer>
40 #include <QDir>
41 
42 namespace Marble
43 {
44 
45 class OwncloudSyncBackend::Private {
46 
47  public:
48  Private( CloudSyncManager* cloudSyncManager );
49 
50  QDir m_cacheDir;
51  QNetworkAccessManager m_network;
52  QNetworkReply *m_routeUploadReply;
53  QNetworkReply *m_routeListReply;
54  QNetworkReply *m_routeDownloadReply;
55  QNetworkReply *m_routeDeleteReply;
56  QNetworkReply *m_authReply;
57 
58  QVector<RouteItem> m_routeList;
59 
60  QString m_routeUploadEndpoint;
61  QString m_routeListEndpoint;
62  QString m_routeDownloadEndpoint;
63  QString m_routeDeleteEndpoint;
64  QString m_routePreviewEndpoint;
65 
66  CloudSyncManager* m_cloudSyncManager;
67  QUrl m_apiUrl;
68 };
69 
70 OwncloudSyncBackend::Private::Private( CloudSyncManager* cloudSyncManager ) :
71  m_cacheDir( MarbleDirs::localPath() + "/cloudsync/cache/routes/" ),
72  m_network(),
73  m_routeUploadReply(),
74  m_routeListReply(),
75  m_routeDownloadReply(),
76  m_routeDeleteReply(),
77  m_authReply(),
78  m_routeList(),
79  // Route API endpoints
80  m_routeUploadEndpoint( "routes/create" ),
81  m_routeListEndpoint( "routes" ),
82  m_routeDownloadEndpoint( "routes" ),
83  m_routeDeleteEndpoint( "routes/delete" ),
84  m_routePreviewEndpoint( "routes/preview" ),
85  m_cloudSyncManager( cloudSyncManager )
86 {
87 }
88 
89 OwncloudSyncBackend::OwncloudSyncBackend( CloudSyncManager* cloudSyncManager ) :
90  d( new Private( cloudSyncManager ) )
91 {
92  connect(d->m_cloudSyncManager, SIGNAL(apiUrlChanged(QUrl)), this, SLOT(validateSettings()));
93 }
94 
95 OwncloudSyncBackend::~OwncloudSyncBackend()
96 {
97  delete d;
98 }
99 
100 void OwncloudSyncBackend::uploadRoute( const QString &timestamp )
101 {
102  QString word = "----MarbleCloudBoundary";
103  QString boundary = QString( "--%0" ).arg( word );
104  QNetworkRequest request( endpointUrl( d->m_routeUploadEndpoint ) );
105  request.setHeader( QNetworkRequest::ContentTypeHeader, QString( "multipart/form-data; boundary=%0" ).arg( word ) );
106 
107  QByteArray data;
108  data.append( QString( boundary + "\r\n" ).toUtf8() );
109 
110  // Timestamp part
111  data.append( "Content-Disposition: form-data; name=\"timestamp\"" );
112  data.append( "\r\n\r\n" );
113  data.append( QString( timestamp + "\r\n" ).toUtf8() );
114  data.append( QString( boundary + "\r\n" ).toUtf8() );
115 
116  // Name part
117  data.append( "Content-Disposition: form-data; name=\"name\"" );
118  data.append( "\r\n\r\n" );
119  data.append( routeName( timestamp ).toUtf8() );
120  data.append( "\r\n" );
121  data.append( QString( boundary + "\r\n" ).toUtf8() );
122 
123  QFile kmlFile( d->m_cacheDir.absolutePath() + QString( "/%0.kml" ).arg( timestamp ) );
124 
125  if( !kmlFile.open( QFile::ReadOnly ) ) {
126  mDebug() << "Could not open " << timestamp << ".kml. Either it has not been saved" <<
127  " to cache for upload or another application removed it from there.";
128  return;
129  }
130 
131  GeoDataParser parser(GeoData_KML);
132  if (!parser.read(&kmlFile)) {
133  mDebug() << "[OwncloudSyncBackend] KML file" << kmlFile.fileName()
134  << "is broken so I can't fill required properties";
135  return;
136  }
137 
138  GeoDataDocument *root = dynamic_cast<GeoDataDocument*>(parser.releaseDocument());
139  if (!root || root->size() < 2) {
140  mDebug() << "[OwncloudSyncBackend] Root document is broken";
141  return;
142  }
143 
144  GeoDataDocument *doc = dynamic_cast<GeoDataDocument*>(root->child(1));
145  if (!doc || doc->nodeType() != GeoDataTypes::GeoDataDocumentType || doc->size() < 1) {
146  mDebug() << "[OwncloudSyncBackend] Tracking document is broken";
147  return;
148  }
149 
150  GeoDataPlacemark *placemark = dynamic_cast<GeoDataPlacemark*>(doc->child(0));
151  if (!placemark || placemark->nodeType() != GeoDataTypes::GeoDataPlacemarkType) {
152  mDebug() << "[OwncloudSyncBackend] Placemark is broken";
153  return;
154  }
155 
156  // Duration part
157  double duration =
158  QTime().secsTo( QTime::fromString( placemark->extendedData().value("duration").value().toString(), Qt::ISODate ) ) / 60.0;
159  mDebug() << "[Owncloud] Duration on write is" << duration;
160  data.append( "Content-Disposition: form-data; name=\"duration\"" );
161  data.append( "\r\n\r\n" );
162  data.append( QString::number(duration).toUtf8() );
163  data.append( "\r\n" );
164  data.append( QString( boundary + "\r\n" ).toUtf8() );
165 
166  // Distance part
167  double distance =
168  placemark->extendedData().value("length").value().toDouble();
169  mDebug() << "[Owncloud] Distance on write is" << distance;
170  data.append( "Content-Disposition: form-data; name=\"distance\"" );
171  data.append( "\r\n\r\n" );
172  data.append( QString::number(distance).toUtf8() );
173  data.append( "\r\n" );
174  data.append( QString( boundary + "\r\n" ).toUtf8() );
175 
176  // KML part
177  data.append( QString( "Content-Disposition: form-data; name=\"kml\"; filename=\"%0.kml\"" ).arg( timestamp ).toUtf8() );
178  data.append( "\r\n" );
179  data.append( "Content-Type: application/vnd.google-earth.kml+xml" );
180  data.append( "\r\n\r\n" );
181 
182  kmlFile.seek(0); // just to be sure
183  data.append( kmlFile.readAll() );
184  data.append( "\r\n" );
185  data.append( QString( boundary + "\r\n" ).toUtf8() );
186 
187  kmlFile.close();
188 
189  // Preview part
190  data.append( QString( "Content-Disposition: form-data; name=\"preview\"; filename=\"%0.jpg\"" ).arg( timestamp ).toUtf8() );
191  data.append( "\r\n" );
192  data.append( "Content-Type: image/jpg" );
193  data.append( "\r\n\r\n" );
194 
195  QByteArray previewBytes;
196  QBuffer previewBuffer( &previewBytes );
197  QPixmap preview = createPreview( timestamp );
198  preview.save( &previewBuffer, "JPG" );
199 
200  data.append( previewBytes );
201  data.append( "\r\n" );
202  data.append( QString( boundary + "\r\n" ).toUtf8() );
203 
204  d->m_routeUploadReply = d->m_network.post( request, data );
205  connect( d->m_routeUploadReply, SIGNAL(uploadProgress(qint64,qint64)), this, SIGNAL(routeUploadProgress(qint64,qint64)) );
206 }
207 
208 void OwncloudSyncBackend::downloadRouteList()
209 {
210  QNetworkRequest request( endpointUrl( d->m_routeListEndpoint ) );
211  d->m_routeListReply = d->m_network.get( request );
212  connect( d->m_routeListReply, SIGNAL(downloadProgress(qint64,qint64)), this, SIGNAL(routeListDownloadProgress(qint64,qint64)) );
213  connect( d->m_routeListReply, SIGNAL(finished()), this, SLOT(prepareRouteList()) );
214 }
215 
216 void OwncloudSyncBackend::downloadRoute( const QString &timestamp )
217 {
218  QNetworkRequest routeRequest( endpointUrl( d->m_routeDownloadEndpoint, timestamp ) );
219  d->m_routeDownloadReply = d->m_network.get( routeRequest );
220  connect( d->m_routeDownloadReply, SIGNAL(finished()), this, SLOT(saveDownloadedRoute()) );
221  connect( d->m_routeDownloadReply, SIGNAL(downloadProgress(qint64,qint64)), this, SIGNAL(routeDownloadProgress(qint64,qint64)) );
222 }
223 
224 void OwncloudSyncBackend::deleteRoute( const QString &timestamp )
225 {
226  QUrl url( endpointUrl( d->m_routeDeleteEndpoint, timestamp ) );
227  QNetworkRequest request( url );
228  d->m_routeDeleteReply = d->m_network.deleteResource( request );
229  connect( d->m_routeDeleteReply, SIGNAL(finished()), this, SIGNAL(routeDeleted()) );
230 }
231 
232 QPixmap OwncloudSyncBackend::createPreview( const QString &timestamp ) const
233 {
234  MarbleWidget mapWidget;
235  foreach( RenderPlugin* plugin, mapWidget.renderPlugins() ) {
236  plugin->setEnabled( false );
237  }
238 
239  mapWidget.setProjection( Mercator );
240  mapWidget.setMapThemeId( "earth/openstreetmap/openstreetmap.dgml" );
241  mapWidget.resize( 512, 512 );
242 
243  RoutingManager* manager = mapWidget.model()->routingManager();
244  manager->loadRoute( d->m_cacheDir.absolutePath() + QString( "/%0.kml" ).arg( timestamp ) );
245  GeoDataLatLonBox const bbox = manager->routingModel()->route().bounds();
246 
247  if ( !bbox.isEmpty() ) {
248  mapWidget.centerOn( bbox );
249  }
250 
251  QPixmap pixmap = QPixmap::grabWidget( &mapWidget );
252  QDir( d->m_cacheDir.absolutePath() ).mkpath( "preview" );
253  pixmap.save( d->m_cacheDir.absolutePath() + "/preview/" + timestamp + ".jpg" );
254 
255  return pixmap;
256 }
257 
258 QString OwncloudSyncBackend::routeName( const QString &timestamp ) const
259 {
260  QFile file( d->m_cacheDir.absolutePath() + QString( "/%0.kml" ).arg( timestamp ) );
261  file.open( QFile::ReadOnly );
262 
263  GeoDataParser parser( GeoData_KML );
264  if( !parser.read( &file ) ) {
265  mDebug() << "Could not read " << timestamp << ".kml. Timestamp will be used as "
266  << "route name because of the problem";
267  return timestamp;
268  }
269  file.close();
270 
271  QString routeName;
272  GeoDocument *geoDoc = parser.releaseDocument();
273  GeoDataDocument *container = dynamic_cast<GeoDataDocument*>( geoDoc );
274  if ( container && container->size() > 0 ) {
275  GeoDataFolder *folder = container->folderList().at( 0 );
276  foreach ( GeoDataPlacemark *placemark, folder->placemarkList() ) {
277  routeName.append( placemark->name() );
278  routeName.append( " - " );
279  }
280  }
281 
282  return routeName.left( routeName.length() - 3 );
283 }
284 
285 void OwncloudSyncBackend::validateSettings()
286 {
287  if( d->m_cloudSyncManager->owncloudServer().size() > 0
288  && d->m_cloudSyncManager->owncloudUsername().size() > 0
289  && d->m_cloudSyncManager->owncloudPassword().size() > 0 )
290  {
291  QNetworkRequest request( endpointUrl( d->m_routeListEndpoint ) );
292  d->m_authReply = d->m_network.get( request );
293  connect( d->m_authReply, SIGNAL(finished()), this, SLOT(checkAuthReply()) );
294  connect( d->m_authReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(checkAuthError(QNetworkReply::NetworkError)) );
295  } else {
296  // no server, make the error field blank
297  d->m_cloudSyncManager->setStatus("", CloudSyncManager::Success);
298  }
299 }
300 
301 void OwncloudSyncBackend::checkAuthError(QNetworkReply::NetworkError error)
302 {
303  if ( error == QNetworkReply::HostNotFoundError ) {
304  QString const status = tr( "Server '%1' could not be reached" ).arg( d->m_cloudSyncManager->owncloudServer() );
305  d->m_cloudSyncManager->setStatus( status , CloudSyncManager::Error );
306  }
307 }
308 
309 void OwncloudSyncBackend::checkAuthReply()
310 {
311  int statusCode = d->m_authReply->attribute( QNetworkRequest::HttpStatusCodeAttribute ).toInt();
312 
313  if ( statusCode == 0 ) // request was cancelled
314  return;
315 
316  QString result = d->m_authReply->readAll();
317 
318  if ( !result.startsWith('{')) {
319  // not a JSON result
320  if ( result.contains("http://owncloud.org") ) {
321  // an owncloud login page was returned, marble app is not installed
322  d->m_cloudSyncManager->setStatus( tr( "The Marble app is not installed on the ownCloud server" ), CloudSyncManager::Error);
323  } else {
324  d->m_cloudSyncManager->setStatus( tr( "The server is not an ownCloud server" ), CloudSyncManager::Error);
325  }
326  } else if ( result == "{\"message\":\"Current user is not logged in\"}" && statusCode == 401 ) {
327  // credientials were incorrect
328  d->m_cloudSyncManager->setStatus( tr( "Username or password are incorrect" ), CloudSyncManager::Error);
329  } else if ( result.contains("\"status\":\"success\"") && statusCode == 200 ) {
330  // credentials were correct
331  d->m_cloudSyncManager->setStatus( tr( "Login successful" ), CloudSyncManager::Success);
332  }
333 }
334 
335 void OwncloudSyncBackend::cancelUpload()
336 {
337  d->m_routeUploadReply->abort();
338 }
339 
340 void OwncloudSyncBackend::prepareRouteList()
341 {
342  QString result = d->m_routeListReply->readAll();
343 
344  QScriptEngine engine;
345  QScriptValue response = engine.evaluate( QString( "(%0)" ).arg( result ) );
346  QScriptValue routes = response.property( "data" );
347 
348  d->m_routeList.clear();
349 
350  if( routes.isArray() ) {
351  QScriptValueIterator iterator( routes );
352 
353  while( iterator.hasNext() ) {
354  iterator.next();
355 
356  RouteItem route;
357  route.setIdentifier( iterator.value().property( "timestamp" ).toString() );
358  route.setName ( iterator.value().property( "name" ).toString() );
359  route.setDistance( iterator.value().property( "distance" ).toString() );
360  route.setDuration( iterator.value().property( "duration" ).toString() );
361  route.setPreviewUrl( endpointUrl( d->m_routePreviewEndpoint, route.identifier() ) );
362  route.setOnCloud( true );
363 
364  d->m_routeList.append( route );
365  }
366  }
367 
368  // FIXME Find why an empty item added to the end.
369  if( !d->m_routeList.isEmpty() ) {
370  d->m_routeList.remove( d->m_routeList.count() - 1 );
371  }
372 
373  emit routeListDownloaded( d->m_routeList );
374 }
375 
376 void OwncloudSyncBackend::saveDownloadedRoute()
377 {
378  QString timestamp = QFileInfo( d->m_routeDownloadReply->url().toString() ).fileName();
379 
380  bool pathCreated = d->m_cacheDir.mkpath( d->m_cacheDir.absolutePath() );
381  if ( !pathCreated ) {
382  mDebug() << "Couldn't create the path " << d->m_cacheDir.absolutePath() <<
383  ". Check if your user has sufficient permissions for this operation.";
384  }
385 
386  QString kmlFilePath = QString( "%0/%1.kml").arg( d->m_cacheDir.absolutePath(), timestamp );
387  QFile kmlFile( kmlFilePath );
388  bool fileOpened = kmlFile.open( QFile::ReadWrite );
389 
390  if ( !fileOpened ) {
391  mDebug() << "Failed to open file" << kmlFilePath << " for writing."
392  << " Its directory either is missing or is not writable.";
393  return;
394  }
395 
396  kmlFile.write( d->m_routeDownloadReply->readAll() );
397  kmlFile.close();
398 
399  QString previewPath = QString( "%0/preview/" ).arg( d->m_cacheDir.absolutePath() );
400  bool previewPathCreated = d->m_cacheDir.mkpath( previewPath );
401  if ( !previewPathCreated ) {
402  mDebug() << "Couldn't create the path " << previewPath <<
403  ". Check if your user has sufficient permissions for this operation.";
404  }
405 
406  QString previewFilePath = QString( "%0/preview/%1.jpg").arg( d->m_cacheDir.absolutePath(), timestamp );
407  QFile previewFile( previewFilePath );
408  bool previewFileOpened = previewFile.open( QFile::ReadWrite );
409 
410  if ( !previewFileOpened ) {
411  mDebug() << "Failed to open file" << previewFilePath << "for writing."
412  << " Its directory either is missing or is not writable.";
413  return;
414  }
415 
416  QPixmap preview = createPreview( timestamp );
417  preview.save( &previewFile, "JPG" );
418  previewFile.close();
419 
420  emit routeDownloaded();
421 }
422 
423 QUrl OwncloudSyncBackend::endpointUrl( const QString &endpoint ) const
424 {
425  QString endpointUrl = QString( "%0/%1" ).arg( d->m_cloudSyncManager->apiUrl().toString() ).arg( endpoint );
426  return QUrl( endpointUrl );
427 }
428 
429 QUrl OwncloudSyncBackend::endpointUrl( const QString &endpoint, const QString &parameter ) const
430 {
431  QString endpointUrl = QString( "%0/%1/%2" ).arg( d->m_cloudSyncManager->apiUrl().toString() ).arg( endpoint ).arg( parameter );
432  return QUrl( endpointUrl );
433 }
434 
435 void OwncloudSyncBackend::removeFromCache( const QDir &cacheDir, const QString &timestamp )
436 {
437  bool fileRemoved = QFile( QString( "%0/%1.kml" ).arg( cacheDir.absolutePath(), timestamp ) ).remove();
438  bool previewRemoved = QFile( QString( "%0/preview/%1.jpg" ).arg( cacheDir.absolutePath(), timestamp ) ).remove();
439  if ( !fileRemoved || !previewRemoved ) {
440  mDebug() << "Failed to remove locally cached route " << timestamp << ". It might "
441  "have been removed already, or its directory is missing / not writable.";
442  }
443 
444  emit removedFromCache( timestamp );
445 }
446 
447 }
448 
449 #include "OwncloudSyncBackend.moc"
GeoDataDocument.h
RoutingModel.h
QString::append
QString & append(QChar ch)
Marble::GeoDataLatLonBox::isEmpty
virtual bool isEmpty() const
Indicates whether the bounding box is not initialised (and contains nothing).
Definition: GeoDataLatLonBox.cpp:768
Marble::GeoDataDocument
A container for Features, Styles and in the future Schemas.
Definition: GeoDataDocument.h:65
Marble::GeoDataContainer::child
GeoDataFeature * child(int)
returns the requested child item
Definition: GeoDataContainer.cpp:239
Marble::GeoDataParser
Definition: GeoDataParser.h:40
Marble::OwncloudSyncBackend::uploadRoute
void uploadRoute(const QString &timestamp)
Definition: OwncloudSyncBackend.cpp:100
QByteArray
QFile::remove
bool remove()
MarbleModel.h
This file contains the headers for MarbleModel.
QNetworkReply
QScriptValue
Marble::Route::bounds
GeoDataLatLonBox bounds() const
Definition: Route.cpp:46
Marble::GeoDataTypes::GeoDataPlacemarkType
const char * GeoDataPlacemarkType
Definition: GeoDataTypes.cpp:66
Marble::GeoDataTypes::GeoDataDocumentType
const char * GeoDataDocumentType
Definition: GeoDataTypes.cpp:38
Marble::OwncloudSyncBackend::routeUploadProgress
void routeUploadProgress(qint64 sent, qint64 total)
QScriptEngine::evaluate
QScriptValue evaluate(const QString &program, const QString &fileName, int lineNumber)
Marble::OwncloudSyncBackend::removedFromCache
void removedFromCache(const QString &timestamp)
Marble::MarbleWidget::setProjection
void setProjection(int projection)
Set the Projection used for the map.
Definition: MarbleWidget.cpp:591
QScriptValueIterator
Marble::RouteItem::setPreviewUrl
void setPreviewUrl(const QUrl &previewUrl)
Definition: RouteItem.cpp:86
Marble::RouteItem::setIdentifier
void setIdentifier(const QString &identifier)
Definition: RouteItem.cpp:56
QBuffer
GeoDataParser.h
Marble::RouteItem
Definition: RouteItem.h:20
QTime::fromString
QTime fromString(const QString &string, Qt::DateFormat format)
Marble::RoutingModel::route
const Route & route() const
Definition: RoutingModel.cpp:434
GeoDataExtendedData.h
QTime
MarbleDebug.h
QObject::tr
QString tr(const char *sourceText, const char *disambiguation, int n)
Marble::RouteItem::setDuration
void setDuration(const QString &duration)
Definition: RouteItem.cpp:106
QFile
Marble::OwncloudSyncBackend::deleteRoute
void deleteRoute(const QString &timestamp)
Definition: OwncloudSyncBackend.cpp:224
Marble::OwncloudSyncBackend::routeDownloaded
void routeDownloaded()
CloudRouteModel.h
Marble::OwncloudSyncBackend::routeDownloadProgress
void routeDownloadProgress(qint64 received, qint64 total)
Marble::RouteItem::identifier
QString identifier() const
Definition: RouteItem.cpp:51
Marble::MarbleWidget
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:104
Marble::GeoData_KML
Definition: GeoDataParser.h:36
Marble::RoutingManager::routingModel
RoutingModel * routingModel()
Provides access to the routing model which contains a list of routing instructions describing steps t...
Definition: RoutingManager.cpp:261
Marble::MarbleWidget::setMapThemeId
void setMapThemeId(const QString &maptheme)
Set a new map theme.
Definition: MarbleWidget.cpp:759
QWidget::resize
void resize(int w, int h)
QScriptEngine
QNetworkRequest
QString::number
QString number(int n, int base)
RoutingManager.h
QPixmap::save
bool save(const QString &fileName, const char *format, int quality) const
Marble::GeoParser::read
bool read(QIODevice *)
Main API for reading the XML document.
Definition: GeoParser.cpp:74
Marble::OwncloudSyncBackend::OwncloudSyncBackend
OwncloudSyncBackend(CloudSyncManager *cloudSyncManager)
Definition: OwncloudSyncBackend.cpp:89
Marble::MarbleModel::routingManager
RoutingManager * routingManager()
Definition: MarbleModel.cpp:675
Marble::Mercator
Mercator projection.
Definition: MarbleGlobal.h:47
Marble::MarbleWidget::model
MarbleModel * model()
Return the model that this view shows.
Definition: MarbleWidget.cpp:289
Marble::RoutingManager::loadRoute
void loadRoute(const QString &filename)
Opens the given filename (kml format) and loads the route contained in it.
Definition: RoutingManager.cpp:337
MarbleDirs.h
Marble::GeoDataContainer::folderList
QVector< GeoDataFolder * > folderList() const
A convenience function that returns all folders in this container.
Definition: GeoDataContainer.cpp:197
QString::startsWith
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
Marble::OwncloudSyncBackend::endpointUrl
QUrl endpointUrl(const QString &endpoint) const
Generates an endpoint URL by appending endpoint name to API URL.
Definition: OwncloudSyncBackend.cpp:423
GeoDocument.h
Marble::OwncloudSyncBackend::cancelUpload
void cancelUpload()
Definition: OwncloudSyncBackend.cpp:335
Marble::GeoDataExtendedData::value
GeoDataData value(const QString &key) const
return the value of GeoDataExtendedData associated with the given key
Definition: GeoDataExtendedData.cpp:66
Marble::GeoDataContainer::size
int size() const
size of the container
Definition: GeoDataContainer.cpp:286
QString
Marble::RouteItem::setName
void setName(const QString &name)
Definition: RouteItem.cpp:66
Marble::GeoDataFolder
Definition: GeoDataFolder.h:50
GeoDataPlacemark.h
QFile::open
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
QScriptValue::property
QScriptValue property(const QString &name, const ResolveFlags &mode) const
Marble::GeoDataData::value
QVariant value() const
return the value of data
Definition: GeoDataData.cpp:68
QPixmap
Marble::CloudSyncManager::Error
Definition: CloudSyncManager.h:46
QByteArray::append
QByteArray & append(char ch)
QFileInfo
Marble::RoutingManager
Delegates data retrieval and model updates to the appropriate routing provider.
Definition: RoutingManager.h:37
Marble::OwncloudSyncBackend::routeDeleted
void routeDeleted()
Marble::OwncloudSyncBackend::downloadRouteList
void downloadRouteList()
Definition: OwncloudSyncBackend.cpp:208
QString::contains
bool contains(QChar ch, Qt::CaseSensitivity cs) const
Marble::MarbleWidget::centerOn
void centerOn(const qreal lon, const qreal lat, bool animated=false)
Center the view on a geographical point.
Definition: MarbleWidget.cpp:549
QUrl
QNetworkRequest::setHeader
void setHeader(KnownHeaders header, const QVariant &value)
OwncloudSyncBackend.h
QDir
GeoDataFolder.h
QNetworkAccessManager
Marble::OwncloudSyncBackend::downloadRoute
void downloadRoute(const QString &timestamp)
Definition: OwncloudSyncBackend.cpp:216
Marble::CloudSyncManager::Success
Definition: CloudSyncManager.h:46
Marble::RenderPlugin::setEnabled
void setEnabled(bool enabled)
settting enabled
Definition: RenderPlugin.cpp:139
QVector
Marble::OwncloudSyncBackend::routeName
QString routeName(const QString &timestamp) const
Definition: OwncloudSyncBackend.cpp:258
QDir::absolutePath
QString absolutePath() const
Marble::GeoDocument
A shared base class between GeoDataDocument/GeoSourceDocument.
Definition: GeoDocument.h:42
Marble::GeoDataFeature::name
QString name() const
The name of the feature.
Definition: GeoDataFeature.cpp:544
RenderPlugin.h
Marble::RouteItem::setOnCloud
void setOnCloud(const bool onCloud)
Definition: RouteItem.cpp:116
Marble::OwncloudSyncBackend::routeListDownloaded
void routeListDownloaded(const QVector< RouteItem > &routeList)
QPixmap::grabWidget
QPixmap grabWidget(QWidget *widget, const QRect &rectangle)
QString::length
int length() const
Marble::OwncloudSyncBackend::removeFromCache
void removeFromCache(const QDir &cacheDir, const QString &timestamp)
Removes route with given timestamp from cache.
Definition: OwncloudSyncBackend.cpp:435
QString::left
QString left(int n) const
MarbleWidget.h
This file contains the headers for MarbleWidget.
QVariant::toDouble
double toDouble(bool *ok) const
GeoDataTypes.h
Marble::GeoDataFeature::extendedData
GeoDataExtendedData & extendedData() const
Return the ExtendedData assigned to the feature.
Definition: GeoDataFeature.cpp:743
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Marble::CloudSyncManager
Definition: CloudSyncManager.h:24
Marble::GeoDataFeature::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoData.
Definition: GeoDataFeature.cpp:158
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QVariant::toString
QString toString() const
Marble::GeoDataPlacemark
a class representing a point of interest on the map
Definition: GeoDataPlacemark.h:54
CloudSyncManager.h
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:36
Marble::OwncloudSyncBackend::routeListDownloadProgress
void routeListDownloadProgress(qint64 received, qint64 total)
QTime::secsTo
int secsTo(const QTime &t) const
QScriptValue::isArray
bool isArray() const
Marble::RenderPlugin
The abstract class that creates a renderable item.
Definition: RenderPlugin.h:43
Marble::OwncloudSyncBackend::createPreview
QPixmap createPreview(const QString &timestamp) const
Definition: OwncloudSyncBackend.cpp:232
Marble::MarbleWidget::renderPlugins
QList< RenderPlugin * > renderPlugins() const
Returns a list of all RenderPlugins on the widget, this includes float items.
Definition: MarbleWidget.cpp:1107
Marble::RouteItem::setDistance
void setDistance(const QString &distance)
Definition: RouteItem.cpp:96
Marble::OwncloudSyncBackend::~OwncloudSyncBackend
~OwncloudSyncBackend()
Definition: OwncloudSyncBackend.cpp:95
Marble::GeoDataLatLonBox
A class that defines a 2D bounding box for geographic data.
Definition: GeoDataLatLonBox.h:51
Marble::GeoParser::releaseDocument
GeoDocument * releaseDocument()
retrieve the parsed document and reset the parser If parsing was successful, retrieve the resulting d...
Definition: GeoParser.cpp:205
Marble::GeoDataContainer::placemarkList
QVector< GeoDataPlacemark * > placemarkList() const
A convenience function that returns all placemarks in this container.
Definition: GeoDataContainer.cpp:214
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:41 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