+++ /dev/null
-Index: marble-0.95+svn1213143/src/lib/CurrentLocationWidget.cpp
-===================================================================
---- marble-0.95+svn1213143.orig/src/lib/CurrentLocationWidget.cpp 2011-01-09 12:28:00.000000000 +0100
-+++ marble-0.95+svn1213143/src/lib/CurrentLocationWidget.cpp 2011-01-09 13:08:31.000000000 +0100
-@@ -31,6 +31,9 @@
- // Ui
- #include "ui_CurrentLocationWidget.h"
-
-+#include <QtCore/QDateTime>
-+#include <QtGui/QFileDialog>
-+
- namespace Marble
- {
-
-@@ -52,6 +55,8 @@
- void updateRecenterComboBox( int centerMode );
- void updateAutoZoomCheckBox( bool autoZoom );
- void updateActivePositionProvider( PositionProviderPlugin* );
-+ void saveTrack();
-+ void clearTrack();
- };
-
- CurrentLocationWidget::CurrentLocationWidget( QWidget *parent, Qt::WindowFlags f )
-@@ -62,11 +67,15 @@
-
- d->m_locale = MarbleGlobal::getInstance()->locale();
-
-- connect( d->m_currentLocationUi.recenterComboBox, SIGNAL ( highlighted( int ) ),
-+ connect( d->m_currentLocationUi.recenterComboBox, SIGNAL ( currentIndexChanged( int ) ),
- this, SLOT( setRecenterMode( int ) ) );
-
- connect( d->m_currentLocationUi.autoZoomCheckBox, SIGNAL( clicked( bool ) ),
- this, SLOT( setAutoZoom( bool ) ) );
-+
-+ bool const smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen;
-+ d->m_currentLocationUi.positionTrackingComboBox->setVisible( !smallScreen );
-+ d->m_currentLocationUi.locationLabel->setVisible( !smallScreen );
- }
-
- CurrentLocationWidget::~CurrentLocationWidget()
-@@ -91,6 +100,9 @@
- QString html = "<p>No Position Tracking Plugin installed.</p>";
- d->m_currentLocationUi.locationLabel->setText( html );
- d->m_currentLocationUi.locationLabel->setEnabled ( true );
-+ d->m_currentLocationUi.showTrackCheckBox->setEnabled( false );
-+ d->m_currentLocationUi.saveTrackPushButton->setEnabled( false );
-+ d->m_currentLocationUi.clearTrackPushButton->setEnabled( false );
- }
-
- //disconnect CurrentLocation Signals
-@@ -120,6 +132,7 @@
- connect( d->m_widget->model()->positionTracking(),
- SIGNAL( positionProviderPluginChanged( PositionProviderPlugin* ) ),
- this, SLOT( updateActivePositionProvider( PositionProviderPlugin* ) ) );
-+ d->updateActivePositionProvider( d->m_widget->model()->positionTracking()->positionProviderPlugin() );
- connect( d->m_currentLocationUi.positionTrackingComboBox, SIGNAL( currentIndexChanged( QString ) ),
- this, SLOT( changePositionProvider( QString ) ) );
- connect( d->m_currentLocationUi.locationLabel, SIGNAL( linkActivated( QString ) ),
-@@ -132,6 +145,17 @@
- this, SLOT( updateRecenterComboBox( int ) ) );
- connect( d->m_adjustNavigation, SIGNAL( autoZoomToggled( bool ) ),
- this, SLOT( updateAutoZoomCheckBox( bool ) ) );
-+ connect (d->m_currentLocationUi.showTrackCheckBox, SIGNAL( clicked(bool) ),
-+ d->m_widget->model()->positionTracking(), SLOT( setTrackVisible(bool) ));
-+ connect (d->m_currentLocationUi.showTrackCheckBox, SIGNAL( clicked(bool) ),
-+ d->m_widget, SLOT(repaint()));
-+ if ( d->m_widget->model()->positionTracking()->trackVisible() ) {
-+ d->m_currentLocationUi.showTrackCheckBox->setCheckState(Qt::Checked);
-+ }
-+ connect ( d->m_currentLocationUi.saveTrackPushButton, SIGNAL( clicked(bool)),
-+ this, SLOT(saveTrack()));
-+ connect (d->m_currentLocationUi.clearTrackPushButton, SIGNAL( clicked(bool)),
-+ this, SLOT(clearTrack()));
- }
-
- void CurrentLocationWidgetPrivate::adjustPositionTrackingStatus( PositionProviderStatus status )
-@@ -177,6 +201,10 @@
- }
- }
- m_currentLocationUi.positionTrackingComboBox->blockSignals( false );
-+ m_currentLocationUi.recenterLabel->setEnabled( plugin );
-+ m_currentLocationUi.recenterComboBox->setEnabled( plugin );
-+ m_currentLocationUi.autoZoomCheckBox->setEnabled( plugin );
-+
- }
-
- void CurrentLocationWidget::receiveGpsCoordinates( const GeoDataCoordinates &position, qreal speed )
-@@ -222,14 +250,14 @@
- html = html.arg( position.lonToString() ).arg( position.latToString() );
- html = html.arg( distanceString ).arg( speedString + ' ' + unitString );
- d->m_currentLocationUi.locationLabel->setText( html );
-+ d->m_currentLocationUi.showTrackCheckBox->setEnabled( true );
-+ d->m_currentLocationUi.saveTrackPushButton->setEnabled( true );
-+ d->m_currentLocationUi.clearTrackPushButton->setEnabled( true );
- }
-
- void CurrentLocationWidgetPrivate::changePositionProvider( const QString &provider )
- {
- bool hasProvider = ( provider != QObject::tr("Disabled") );
-- m_currentLocationUi.recenterLabel->setEnabled( hasProvider );
-- m_currentLocationUi.recenterComboBox->setEnabled( hasProvider );
-- m_currentLocationUi.autoZoomCheckBox->setEnabled( hasProvider );
-
- if ( hasProvider ) {
- foreach( PositionProviderPlugin* plugin, m_positionProviderPlugins ) {
-@@ -277,6 +305,28 @@
- m_widget->centerOn(m_currentPosition, true);
- }
-
-+void CurrentLocationWidgetPrivate::saveTrack()
-+{
-+ static QString s_dirName = QDir::homePath();
-+ QString suggested = s_dirName;
-+ QString fileName = QFileDialog::getSaveFileName(m_widget, QObject::tr("Save Track"), // krazy:exclude=qclasses
-+ suggested.append('/' + QDateTime::currentDateTime().toString("yyyy-MM-dd_hhmmss") + ".kml"),
-+ QObject::tr("KML File (*.kml)"));
-+ if ( !fileName.isEmpty() ) {
-+ QFileInfo file( fileName );
-+ s_dirName = file.absolutePath();
-+ m_widget->model()->positionTracking()->saveTrack( fileName );
-+ }
-+}
-+
-+void CurrentLocationWidgetPrivate::clearTrack()
-+{
-+ m_widget->model()->positionTracking()->clearTrack();
-+ m_widget->repaint();
-+ m_currentLocationUi.saveTrackPushButton->setEnabled( false );
-+ m_currentLocationUi.clearTrackPushButton->setEnabled( false );
-+}
-+
- }
-
- #include "CurrentLocationWidget.moc"
-Index: marble-0.95+svn1213143/src/lib/PositionTracking.cpp
-===================================================================
---- marble-0.95+svn1213143.orig/src/lib/PositionTracking.cpp 2011-01-09 12:28:00.000000000 +0100
-+++ marble-0.95+svn1213143/src/lib/PositionTracking.cpp 2011-01-09 12:27:59.000000000 +0100
-@@ -16,14 +16,19 @@
- #include "GeoDataPlacemark.h"
- #include "GeoDataStyle.h"
- #include "GeoDataStyleMap.h"
-+#include "GeoWriter.h"
-+#include "KmlElementDictionary.h"
- #include "AbstractProjection.h"
- #include "FileManager.h"
- #include "MarbleMath.h"
- #include "MarbleDebug.h"
-+#include "MarbleDirs.h"
- #include "PositionProviderPlugin.h"
-
- #include "PositionTracking_p.h"
-
-+#include <QtCore/QFile>
-+
- using namespace Marble;
-
- void PositionTrackingPrivate::setPosition( GeoDataCoordinates position,
-@@ -173,6 +178,34 @@
- d->m_document->setVisible( visible );
- }
-
-+bool PositionTracking::saveTrack(QString& fileName)
-+{
-+
-+ if ( !fileName.isEmpty() )
-+ {
-+ if ( !fileName.endsWith(".kml", Qt::CaseInsensitive) )
-+ {
-+ fileName.append( ".kml" );
-+ }
-+
-+ GeoWriter writer;
-+ //FIXME: a better way to do this?
-+ writer.setDocumentType( kml::kmlTag_nameSpace22 );
-+
-+ GeoDataDocument document( *d->m_document );
-+ QFileInfo fileInfo( fileName );
-+ QString name = fileInfo.baseName();
-+ document.setName( name );
-+ document.remove( 0 );
-+ document.last().setName( "Track" );
-+
-+ QFile file( fileName );
-+ file.open( QIODevice::ReadWrite );
-+ return writer.write( &file, document );
-+ }
-+ return false;
-+}
-+
- void PositionTracking::clearTrack()
- {
- GeoDataPlacemark *placemark = static_cast<GeoDataPlacemark*>(d->m_document->child(d->m_document->size()-1));
-Index: marble-0.95+svn1213143/src/lib/PositionTracking.h
-===================================================================
---- marble-0.95+svn1213143.orig/src/lib/PositionTracking.h 2011-01-09 12:28:00.000000000 +0100
-+++ marble-0.95+svn1213143/src/lib/PositionTracking.h 2011-01-09 12:27:59.000000000 +0100
-@@ -84,6 +84,11 @@
- void setTrackVisible ( bool visible );
-
- /**
-+ * Saves the track document to file
-+ */
-+ bool saveTrack( QString& fileName );
-+
-+ /**
- * Removes all track segments which were recorded
- */
- void clearTrack();
-Index: marble-0.95+svn1213143/src/lib/CurrentLocationWidget.h
-===================================================================
---- marble-0.95+svn1213143.orig/src/lib/CurrentLocationWidget.h 2011-01-09 12:28:00.000000000 +0100
-+++ marble-0.95+svn1213143/src/lib/CurrentLocationWidget.h 2011-01-09 12:27:59.000000000 +0100
-@@ -72,6 +72,9 @@
- Q_PRIVATE_SLOT( d, void updateAutoZoomCheckBox( bool autoZoom ) )
-
- Q_PRIVATE_SLOT( d, void updateActivePositionProvider( PositionProviderPlugin* ) )
-+
-+ Q_PRIVATE_SLOT( d, void saveTrack() )
-+ Q_PRIVATE_SLOT( d, void clearTrack() )
- };
-
- }
-Index: marble-0.95+svn1213143/src/lib/CurrentLocationWidget.ui
-===================================================================
---- marble-0.95+svn1213143.orig/src/lib/CurrentLocationWidget.ui 2011-01-09 12:28:00.000000000 +0100
-+++ marble-0.95+svn1213143/src/lib/CurrentLocationWidget.ui 2011-01-09 12:27:59.000000000 +0100
-@@ -7,7 +7,7 @@
- <x>0</x>
- <y>0</y>
- <width>137</width>
-- <height>190</height>
-+ <height>237</height>
- </rect>
- </property>
- <property name="windowTitle">
-@@ -40,6 +40,36 @@
- </widget>
- </item>
- <item>
-+ <widget class="QCheckBox" name="showTrackCheckBox">
-+ <property name="enabled">
-+ <bool>false</bool>
-+ </property>
-+ <property name="text">
-+ <string>Show Track</string>
-+ </property>
-+ </widget>
-+ </item>
-+ <item>
-+ <widget class="QPushButton" name="saveTrackPushButton">
-+ <property name="enabled">
-+ <bool>false</bool>
-+ </property>
-+ <property name="text">
-+ <string>Save Track</string>
-+ </property>
-+ </widget>
-+ </item>
-+ <item>
-+ <widget class="QPushButton" name="clearTrackPushButton">
-+ <property name="enabled">
-+ <bool>false</bool>
-+ </property>
-+ <property name="text">
-+ <string>Clear Track</string>
-+ </property>
-+ </widget>
-+ </item>
-+ <item>
- <widget class="QLabel" name="locationLabel">
- <property name="enabled">
- <bool>false</bool>
-@@ -65,6 +95,19 @@
- </widget>
- </item>
- <item>
-+ <spacer name="trackRecenterVerticalSpacer">
-+ <property name="orientation">
-+ <enum>Qt::Vertical</enum>
-+ </property>
-+ <property name="sizeHint" stdset="0">
-+ <size>
-+ <width>20</width>
-+ <height>20</height>
-+ </size>
-+ </property>
-+ </spacer>
-+ </item>
-+ <item>
- <widget class="QLabel" name="recenterLabel">
- <property name="enabled">
- <bool>false</bool>
-Index: marble-0.95+svn1213143/src/QtMainWindow.cpp
-===================================================================
---- marble-0.95+svn1213143.orig/src/QtMainWindow.cpp 2011-01-09 12:28:00.000000000 +0100
-+++ marble-0.95+svn1213143/src/QtMainWindow.cpp 2011-01-09 12:27:59.000000000 +0100
-@@ -41,6 +41,7 @@
- #include <QtNetwork/QNetworkProxy>
-
- #include "BookmarkInfoDialog.h"
-+#include "CurrentLocationWidget.h"
- //#include "EditBookmarkDialog.h"
- #include "MapViewWidget.h"
- #include "MarbleDirs.h"
-@@ -92,6 +93,7 @@
- m_osmEditAction( 0 ),
- m_mapViewDialog( 0 ),
- m_routingDialog( 0 ),
-+ m_trackingDialog( 0 ),
- m_routingWidget( 0 )
- {
- setUpdatesEnabled( false );
-@@ -298,6 +300,9 @@
- m_toggleRoutingTabAction = menuBar()->addAction( tr( "Routing" ) );
- connect( m_toggleRoutingTabAction, SIGNAL( triggered( bool ) ),
- this, SLOT( showRoutingDialog() ) );
-+ m_showTrackingDialogAction = menuBar()->addAction( tr( "Tracking" ) );
-+ connect( m_showTrackingDialogAction, SIGNAL( triggered()),
-+ this, SLOT( showTrackingDialog()) );
-
- m_controlView->marbleControl()->setNavigationTabShown( false );
- m_controlView->marbleControl()->setLegendTabShown( false );
-@@ -1268,6 +1273,28 @@
- m_routingDialog->activateWindow();
- }
-
-+void MainWindow::showTrackingDialog()
-+{
-+ if( !m_trackingDialog ) {
-+ m_trackingDialog = new QDialog( this );
-+ m_trackingDialog->setWindowTitle( tr( "Tracking - Marble" ) );
-+ CurrentLocationWidget *trackingWidget = new CurrentLocationWidget( m_trackingDialog );
-+ trackingWidget->setMarbleWidget( m_controlView->marbleWidget() );
-+
-+ QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok, Qt::Vertical, m_trackingDialog );
-+ connect(buttonBox, SIGNAL( accepted() ), m_trackingDialog, SLOT( accept() ) );
-+
-+ QHBoxLayout* layout = new QHBoxLayout;
-+ layout->addWidget( trackingWidget );
-+ layout->addWidget( buttonBox );
-+ m_trackingDialog->setLayout( layout );
-+ m_trackingDialog->resize( 640, 420 );
-+ }
-+
-+ m_trackingDialog->show();
-+ m_trackingDialog->raise();
-+ m_trackingDialog->activateWindow();
-+}
-
- void MainWindow::updateMapEditButtonVisibility( const QString &mapTheme )
- {
-Index: marble-0.95+svn1213143/src/QtMainWindow.h
-===================================================================
---- marble-0.95+svn1213143.orig/src/QtMainWindow.h 2011-01-09 12:28:00.000000000 +0100
-+++ marble-0.95+svn1213143/src/QtMainWindow.h 2011-01-09 12:27:59.000000000 +0100
-@@ -120,6 +120,7 @@
- void showMapViewDialog();
- void showLegendTab( bool enabled );
- void showRoutingDialog();
-+ void showTrackingDialog();
-
- private:
- void setupZoomButtons();
-@@ -194,9 +195,11 @@
- QAction *m_showMapViewDialogAction;
- QAction *m_toggleLegendTabAction;
- QAction *m_toggleRoutingTabAction;
-+ QAction *m_showTrackingDialogAction;
-
- QDialog *m_mapViewDialog;
- QDialog *m_routingDialog;
-+ QDialog *m_trackingDialog;
-
- RoutingWidget *m_routingWidget;
- };