[Marble-commits] KDE/kdeedu/marble/src/plugins/render/aprs
Wes Hardaker
wjhns25 at hardakers.net
Tue Jun 22 22:59:04 CEST 2010
SVN commit 1141470 by hardaker:
make the APRS plugin report it's renderType properly and make it stop collecting data when it's not visible
M +33 -0 AprsPlugin.cpp
M +5 -3 AprsPlugin.h
--- trunk/KDE/kdeedu/marble/src/plugins/render/aprs/AprsPlugin.cpp #1141469:1141470
@@ -41,6 +41,7 @@
m_tcpipGatherer( 0 ),
m_ttyGatherer( 0 ),
m_fileGatherer( 0 ),
+ m_action( 0 ),
m_configDialog( 0 ),
ui_configWidget( 0 )
{
@@ -48,6 +49,14 @@
setVisible( true );
setSettings( QHash<QString,QVariant>() );
+
+ connect( this, SIGNAL( visibilityChanged( QString, bool ) ),
+ this, SLOT( updateVisibility( QString, bool ) ) );
+
+ m_action = new QAction( this );
+ connect( m_action, SIGNAL( toggled( bool ) ),
+ this, SLOT( setVisible( bool ) ) );
+
}
AprsPlugin::~AprsPlugin()
@@ -71,6 +80,20 @@
delete m_mutex;
}
+void AprsPlugin::updateVisibility( QString nameId, bool visible )
+{
+ Q_UNUSED( nameId );
+ if ( visible )
+ restartGatherers();
+ else
+ stopGatherers();
+}
+
+RenderPlugin::RenderType AprsPlugin::renderType() const
+{
+ return Online;
+}
+
QStringList AprsPlugin::backendTypes() const
{
return QStringList( "aprs" );
@@ -389,6 +412,16 @@
return true;
}
+QAction* AprsPlugin::action() const
+{
+ m_action->setCheckable( true );
+ m_action->setChecked( visible() );
+ m_action->setIcon( icon() );
+ m_action->setText( guiString() );
+ m_action->setToolTip( description() );
+ return m_action;
+}
+
Q_EXPORT_PLUGIN2( AprsPlugin, Marble::AprsPlugin )
#include "AprsPlugin.moc"
--- trunk/KDE/kdeedu/marble/src/plugins/render/aprs/AprsPlugin.h #1141469:1141470
@@ -59,6 +59,7 @@
bool render( GeoPainter *painter, ViewportParams *viewport, const QString& renderPos, GeoSceneLayer * layer = 0 );
QDialog *configDialog() const;
+ QAction *action() const;
QHash<QString,QVariant> settings() const;
void setSettings( QHash<QString,QVariant> settings );
@@ -66,13 +67,13 @@
void stopGatherers();
void restartGatherers();
+
private Q_SLOTS:
void readSettings() const;
void writeSettings();
+ void updateVisibility( QString nameId, bool visible );
+ virtual RenderType renderType() const;
-/* Q_SIGNALS: */
-/* void changedSettings(); */
-
private:
QMutex *m_mutex;
@@ -83,6 +84,7 @@
*m_ttyGatherer,
*m_fileGatherer;
QString m_filter;
+ QAction *m_action;
mutable QDialog *m_configDialog;
mutable Ui::AprsConfigWidget *ui_configWidget;
More information about the Marble-commits
mailing list