• 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
  • positionprovider
  • geoclue
  • GeoCute
VelocityProvider.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 2009 Eckhart Wörner <ewoerner@kde.org>
9 //
10 
11 #include "VelocityProvider_p.h"
12 
13 #include <QDBusReply>
14 
15 
16 
17 using namespace GeoCute;
18 
19 VelocityProvider::Private::Private(VelocityProvider& parent,
20  const QString& service, const QString& path)
21  : interface(service, path, interfaceName), parent(parent)
22 {
23  // Get an initial velocity
24  interface.callWithCallback("GetVelocity", QList<QVariant>(), &parent,
25  SLOT(velocityChangedCall(QDBusMessage)), 0);
26  // Stay informed about future velocity changes
27  interface.connect("VelocityChanged", &parent,
28  SLOT(velocityChangedCall(QDBusMessage)));
29 }
30 
31 void VelocityProvider::Private::velocityChangedCall(QDBusMessage message)
32 {
33  Velocity newVelocity;
34  newVelocity.fields
35  = static_cast<VelocityFields>(message.arguments()[0].toInt());
36  newVelocity.speed = message.arguments()[2].toDouble();
37  newVelocity.direction = message.arguments()[3].toDouble();
38  newVelocity.climb = message.arguments()[4].toDouble();
39 
40  currentVelocity = newVelocity;
41  emit parent.velocityChanged(newVelocity);
42 }
43 
44 
45 
46 VelocityProvider::VelocityProvider(const QString& service, const QString& path,
47  QObject* parent)
48  : Provider(service, path, parent),
49  d(new Private(*this, service, path))
50 {
51 }
52 
53 VelocityProvider::~VelocityProvider()
54 {
55  delete d;
56 }
57 
58 Velocity VelocityProvider::velocity()
59 {
60  return d->currentVelocity;
61 }
62 
63 
64 
65 #include "VelocityProvider.moc"
interfaceName
static const QString interfaceName
Definition: MasterClient_p.h:23
GeoCute::Velocity::speed
qreal speed
Definition: Velocity.h:34
GeoCute::VelocityProvider::Private::interface
SimpleDBusInterface interface
Definition: VelocityProvider_p.h:32
GeoCute::VelocityProvider::VelocityProvider
VelocityProvider(const QString &service, const QString &path, QObject *parent=0)
Definition: VelocityProvider.cpp:46
GeoCute::Velocity::climb
qreal climb
Definition: Velocity.h:36
QDBusMessage::arguments
QList< QVariant > arguments() const
GeoCute::VelocityProvider::Private
Definition: VelocityProvider_p.h:25
VelocityProvider_p.h
GeoCute::VelocityProvider::~VelocityProvider
~VelocityProvider()
Definition: VelocityProvider.cpp:53
QObject
GeoCute::SimpleDBusInterface::connect
void connect(const QString &name, QObject *receiver, const char *slot)
Definition: SimpleDBusInterface.cpp:70
QString
QList< QVariant >
GeoCute::VelocityProvider
Definition: VelocityProvider.h:24
GeoCute::VelocityProvider::velocity
Velocity velocity()
Definition: VelocityProvider.cpp:58
GeoCute::Velocity::direction
qreal direction
Definition: Velocity.h:35
GeoCute::VelocityProvider::Private::currentVelocity
Velocity currentVelocity
Definition: VelocityProvider_p.h:33
QDBusMessage
GeoCute::Velocity::fields
VelocityFields fields
Definition: Velocity.h:33
GeoCute::VelocityProvider::Private::velocityChangedCall
void velocityChangedCall(QDBusMessage message)
Definition: VelocityProvider.cpp:31
GeoCute::Provider
Definition: Provider.h:24
GeoCute::VelocityProvider::Private::Private
Private(VelocityProvider &parent, const QString &service, const QString &path)
Definition: VelocityProvider.cpp:19
QObject::parent
QObject * parent() const
GeoCute::SimpleDBusInterface::callWithCallback
void callWithCallback(const QString &message, const QList< QVariant > &args, QObject *receiver, const char *returnMethod, const char *errorMethod) const
Definition: SimpleDBusInterface.cpp:60
GeoCute::Velocity
Definition: Velocity.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:42 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