#include "GeoSceneDocument.h"
#include "GeoSceneHead.h"
@@ -65,6 +66,7 @@
#include "cloudsync/RouteSyncManager.h"
#include "cloudsync/ConflictDialog.h"
#include "cloudsync/MergeItem.h"
+#include "RenderPlugin.h"
namespace Marble
{
@@ -77,7 +79,9 @@
m_conflictDialog( 0 ),
m_togglePanelVisibilityAction( 0 ),
m_isPanelVisible( true ),
- m_tourWidget( 0 )
+ m_tourWidget( 0 ),
+ m_annotationDock( 0 ),
+ m_annotationPlugin( 0 )
{
setWindowTitle( tr( "Marble - Virtual Globe" ) );
@@ -109,7 +113,7 @@
QString ControlView::applicationVersion()
{
- return "1.9.95 (1.10 Beta 3)";
+ return "1.11.2 (stable release)";
}
MapThemeManager *ControlView::mapThemeManager()
@@ -411,7 +415,8 @@
text += QString::number( i+1 );
text += "";
- text += QString::number( accumulator.length( EARTH_RADIUS ) * METER2KM, 'f', 1 );
+ qreal planetRadius = marbleModel()->planet()->radius();
+ text += QString::number( accumulator.length( planetRadius ) * METER2KM, 'f', 1 );
/** @todo: support localization */
text += " km | ";
@@ -618,12 +623,40 @@
mainWindow->tabifyDockWidget( mapViewDock, legendDock );
mapViewDock->raise();
+ m_annotationDock = new QDockWidget( QObject::tr( "Edit Maps" ) );
+ m_annotationDock->setObjectName( "annotateDock" );
+ m_annotationDock->hide();
+ m_annotationDock->toggleViewAction()->setVisible( false );
+
+ QList renderPluginList = marbleWidget()->renderPlugins();
+ QList::const_iterator i = renderPluginList.constBegin();
+ QList::const_iterator const end = renderPluginList.constEnd();
+
+ for (; i != end; ++i ) {
+ if( (*i)->nameId() == "annotation" ) {
+ m_annotationPlugin = *i;
+ QObject::connect(m_annotationPlugin, SIGNAL(enabledChanged(bool)),
+ this, SLOT(updateAnnotationDockVisibility()));
+ QObject::connect(m_annotationPlugin, SIGNAL(visibilityChanged(bool,QString)),
+ this, SLOT(updateAnnotationDockVisibility()));
+ QObject::connect(m_annotationPlugin, SIGNAL(actionGroupsChanged()),
+ this, SLOT(updateAnnotationDock()));
+ updateAnnotationDock();
+ updateAnnotationDockVisibility();
+ mainWindow->addDockWidget( Qt::LeftDockWidgetArea, m_annotationDock );
+ }
+ }
+
+ mainWindow->tabifyDockWidget( tourDock, m_annotationDock );
+ mainWindow->tabifyDockWidget( m_annotationDock, fileViewDock );
+
QList panelActions;
panelActions << routingDock->toggleViewAction();
panelActions << locationDock->toggleViewAction();
panelActions << m_searchDock->toggleViewAction();
panelActions << mapViewDock->toggleViewAction();
panelActions << fileViewDock->toggleViewAction();
+ panelActions << m_annotationDock->toggleViewAction();
panelActions << legendDock->toggleViewAction();
panelActions << tourDock->toggleViewAction();
@@ -633,6 +666,7 @@
m_panelActions << m_searchDock->toggleViewAction();
m_panelActions << mapViewDock->toggleViewAction();
m_panelActions << fileViewDock->toggleViewAction();
+ m_panelActions << m_annotationDock->toggleViewAction();
m_panelActions << legendDock->toggleViewAction();
m_panelActions << tourDock->toggleViewAction();
foreach( QAction* action, m_panelActions ) {
@@ -712,6 +746,47 @@
m_conflictDialog->open();
}
+void ControlView::updateAnnotationDockVisibility()
+{
+ if( m_annotationPlugin != 0 && m_annotationDock != 0 ) {
+ if( m_annotationPlugin->visible() && m_annotationPlugin->enabled() ) {
+ m_annotationDock->toggleViewAction()->setVisible( true );
+ } else {
+ m_annotationDock->setVisible( false );
+ m_annotationDock->toggleViewAction()->setVisible( false );
+ }
+ }
+}
+
+void ControlView::updateAnnotationDock()
+{
+ const QList *tmp_actionGroups = m_annotationPlugin->actionGroups();
+ QWidget *widget = new QWidget( m_annotationDock );
+ QVBoxLayout *layout = new QVBoxLayout;
+ QToolBar *firstToolbar = new QToolBar( widget );
+ QToolBar *secondToolbar = new QToolBar( widget );
+ QSpacerItem *spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);
+ bool firstToolbarFilled = false;
+ if( !tmp_actionGroups->isEmpty() ) {
+ foreach( QAction *action, tmp_actionGroups->first()->actions() ) {
+ if( action->objectName() == "toolbarSeparator" ) {
+ firstToolbarFilled = true;
+ } else {
+ if( !firstToolbarFilled ) {
+ firstToolbar->addAction( action );
+ } else {
+ secondToolbar->addAction( action );
+ }
+ }
+ }
+ }
+ layout->addWidget( firstToolbar );
+ layout->addWidget( secondToolbar );
+ layout->addSpacerItem( spacer );
+ widget->setLayout( layout );
+ m_annotationDock->setWidget( widget );
+}
+
void ControlView::togglePanelVisibility()
{
Q_ASSERT( m_panelVisibility.size() == m_panelActions.size() );
diff -Nru marble-14.12.3/src/apps/marble-ui/ControlView.h marble-15.04.2/src/apps/marble-ui/ControlView.h
--- marble-14.12.3/src/apps/marble-ui/ControlView.h 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/apps/marble-ui/ControlView.h 2015-05-25 16:24:43.000000000 +0000
@@ -132,6 +132,8 @@
void showSearch();
// Bookmark sync slots
void showConflictDialog( MergeItem *item );
+ void updateAnnotationDockVisibility();
+ void updateAnnotationDock();
private:
/**
@@ -162,6 +164,8 @@
QList m_panelVisibility;
bool m_isPanelVisible;
TourWidget *m_tourWidget;
+ QDockWidget *m_annotationDock;
+ RenderPlugin *m_annotationPlugin;
};
}
Binary files /tmp/Rvfrcd6tK_/marble-14.12.3/src/apps/marble-ui/icons/edit-select.png and /tmp/TgpeiXvDyc/marble-15.04.2/src/apps/marble-ui/icons/edit-select.png differ
Binary files /tmp/Rvfrcd6tK_/marble-14.12.3/src/apps/marble-ui/icons/format-text-bold.png and /tmp/TgpeiXvDyc/marble-15.04.2/src/apps/marble-ui/icons/format-text-bold.png differ
Binary files /tmp/Rvfrcd6tK_/marble-14.12.3/src/apps/marble-ui/icons/format-text-italic.png and /tmp/TgpeiXvDyc/marble-15.04.2/src/apps/marble-ui/icons/format-text-italic.png differ
Binary files /tmp/Rvfrcd6tK_/marble-14.12.3/src/apps/marble-ui/icons/format-text-underline.png and /tmp/TgpeiXvDyc/marble-15.04.2/src/apps/marble-ui/icons/format-text-underline.png differ
Binary files /tmp/Rvfrcd6tK_/marble-14.12.3/src/apps/marble-ui/icons/insert-image.png and /tmp/TgpeiXvDyc/marble-15.04.2/src/apps/marble-ui/icons/insert-image.png differ
Binary files /tmp/Rvfrcd6tK_/marble-14.12.3/src/apps/marble-ui/icons/insert-link.png and /tmp/TgpeiXvDyc/marble-15.04.2/src/apps/marble-ui/icons/insert-link.png differ
diff -Nru marble-14.12.3/src/apps/marble-ui/marble.qrc marble-15.04.2/src/apps/marble-ui/marble.qrc
--- marble-14.12.3/src/apps/marble-ui/marble.qrc 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/apps/marble-ui/marble.qrc 2015-05-25 16:24:43.000000000 +0000
@@ -17,12 +17,17 @@
icons/document-save-as.png
icons/edit-copy.png
icons/folder-bookmark.png
+ icons/format-text-bold.png
+ icons/format-text-italic.png
+ icons/format-text-underline.png
icons/go-home.png
icons/go-home-large.png
icons/get-hot-new-stuff.png
icons/help-about.png
icons/help-contents.png
icons/help-whatsthis.png
+ icons/insert-image.png
+ icons/insert-link.png
icons/map-flat.png
icons/map-globe.png
icons/map-mercator.png
@@ -108,5 +113,6 @@
icons/cloud-download.png
icons/16x16/tool-animator.png
icons/map-gnomonic.png
+ icons/edit-select.png
diff -Nru marble-14.12.3/src/lib/astro/astrolib.cpp marble-15.04.2/src/lib/astro/astrolib.cpp
--- marble-14.12.3/src/lib/astro/astrolib.cpp 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/astro/astrolib.cpp 2015-05-25 16:24:43.000000000 +0000
@@ -842,7 +842,7 @@
ht : height above normal in meters.
solsys : = 1 if object is in solar system and parallax has to be
taken into account, 0 otherwise.
- r = vector of celestial object. The unit of lenght of this vector
+ r = vector of celestial object. The unit of length of this vector
has to be in terms of the equatorial Earth radius (6378.14 km)
if solsys = 1, otherwise it's arbitrary.
azim : azimuth in radians (0 is to the North).
@@ -2259,7 +2259,7 @@
/* (the factor 1.02 allows for enlargment of shadow due to
Earth's atmosphere) */
- // get angular seperation of center of shadow and Moon
+ // get angular separation of center of shadow and Moon
r2 = abs(rm);
sep = dot(rs,rm)/(abs(rs)*r2);
if (fabs(sep) > 1.0) sep = 1.0;
diff -Nru marble-14.12.3/src/lib/astro/eclsolar.cpp marble-15.04.2/src/lib/astro/eclsolar.cpp
--- marble-14.12.3/src/lib/astro/eclsolar.cpp 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/astro/eclsolar.cpp 2015-05-25 16:24:43.000000000 +0000
@@ -775,7 +775,7 @@
(pa < 1.0). Set pa = 1 for the normal penumbra boundaries
if mode == 1 the angle will be set such that the penumbra line
- markes magnitude pa. pa == 0 will mark normal penumbra boudaries
+ markes magnitude pa. pa == 0 will mark normal penumbra boundaries
if mode == 2 the angle will be set such that the penumbra line
markes the obscuration pa. pa == 0.5 will mean that 50% of the Sun's
@@ -1082,7 +1082,7 @@
Use yr as the year.fraction close to the desired date.
If the date is within the limits store the result in the
respective array.
- Also check for possible occurences of eclipses and store the
+ Also check for possible occurrences of eclipses and store the
respective data in an array
*/
{
@@ -1601,7 +1601,7 @@
eb_cphs = 0;
- if (firstc) // find the first occurence compliant with the step width
+ if (firstc) // find the first occurrence compliant with the step width
{
jd = eb_jdstart;
kp = eclp.solar(jd, eb_del_tdut, phi, lamda);
diff -Nru marble-14.12.3/src/lib/marble/AbstractDataPlugin.h marble-15.04.2/src/lib/marble/AbstractDataPlugin.h
--- marble-14.12.3/src/lib/marble/AbstractDataPlugin.h 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/AbstractDataPlugin.h 2015-05-25 16:24:43.000000000 +0000
@@ -78,7 +78,7 @@
* @return @c true Returns whether the rendering has been successful
*/
bool render( GeoPainter *painter, ViewportParams *viewport,
- const QString& renderPos = "NONE", GeoSceneLayer * layer = 0 );
+ const QString& renderPos = QLatin1String("NONE"), GeoSceneLayer * layer = 0 );
/**
* @return The model associated with the plugin.
diff -Nru marble-14.12.3/src/lib/marble/AbstractDataPluginItem.cpp marble-15.04.2/src/lib/marble/AbstractDataPluginItem.cpp
--- marble-14.12.3/src/lib/marble/AbstractDataPluginItem.cpp 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/AbstractDataPluginItem.cpp 2015-05-25 16:24:43.000000000 +0000
@@ -28,7 +28,6 @@
{
public:
QString m_id;
- QString m_target;
QString m_toolTip;
bool m_favorite;
bool m_sticky;
@@ -58,16 +57,6 @@
delete d;
}
-QString AbstractDataPluginItem::target() const
-{
- return d->m_target;
-}
-
-void AbstractDataPluginItem::setTarget( const QString& target )
-{
- d->m_target = target;
-}
-
QString AbstractDataPluginItem::toolTip() const
{
return d->m_toolTip;
diff -Nru marble-14.12.3/src/lib/marble/AbstractDataPluginItem.h marble-15.04.2/src/lib/marble/AbstractDataPluginItem.h
--- marble-14.12.3/src/lib/marble/AbstractDataPluginItem.h 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/AbstractDataPluginItem.h 2015-05-25 16:24:43.000000000 +0000
@@ -37,9 +37,6 @@
explicit AbstractDataPluginItem( QObject *parent = 0 );
virtual ~AbstractDataPluginItem();
- QString target() const;
- void setTarget( const QString& target );
-
/**
* Returns the item's tool tip.
*/
@@ -60,13 +57,6 @@
void setSticky( bool sticky );
/**
- * Returning the angular resolution of the viewport when the item was added to it the last
- * time.
- */
- qreal addedAngularResolution() const;
- void setAddedAngularResolution( qreal resolution );
-
- /**
* @brief Set the settings of the item.
* This is usually called automatically before painting. If you reimplement this it would be
* useful to check for changes before copying.
@@ -96,6 +86,15 @@
void toggleFavorite();
private:
+ friend class AbstractDataPluginModel;
+
+ /**
+ * Returning the angular resolution of the viewport when the item was added to it the last
+ * time.
+ */
+ qreal addedAngularResolution() const;
+ void setAddedAngularResolution( qreal resolution );
+
AbstractDataPluginItemPrivate * const d;
};
diff -Nru marble-14.12.3/src/lib/marble/AbstractDataPluginModel.cpp marble-15.04.2/src/lib/marble/AbstractDataPluginModel.cpp
--- marble-14.12.3/src/lib/marble/AbstractDataPluginModel.cpp 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/AbstractDataPluginModel.cpp 2015-05-25 16:24:43.000000000 +0000
@@ -61,8 +61,11 @@
~AbstractDataPluginModelPrivate();
+ QString generateFilename( const QString& id, const QString& type ) const;
+ QString generateFilepath( const QString& id, const QString& type ) const;
+
void updateFavoriteItems();
-
+
AbstractDataPluginModel *m_parent;
const QString m_name;
const MarbleModel *const m_marbleModel;
@@ -70,7 +73,7 @@
GeoDataLatLonAltBox m_downloadedBox;
qint32 m_lastNumber;
qint32 m_downloadedNumber;
- QString m_downloadedTarget;
+ QString m_currentPlanetId;
QList m_itemSet;
QHash m_downloadingItems;
QList m_displayedItems;
@@ -119,6 +122,7 @@
m_downloadedBox(),
m_lastNumber( 0 ),
m_downloadedNumber( 0 ),
+ m_currentPlanetId( marbleModel->planetId() ),
m_downloadTimer( m_parent ),
m_descriptionFileNumber( 0 ),
m_itemSettings(),
@@ -158,6 +162,14 @@
}
}
+void AbstractDataPluginModel::themeChanged()
+{
+ if ( d->m_currentPlanetId != d->m_marbleModel->planetId() ) {
+ clear();
+ d->m_currentPlanetId = d->m_marbleModel->planetId();
+ }
+}
+
static bool lessThanByPointer( const AbstractDataPluginItem *item1,
const AbstractDataPluginItem *item2 )
{
@@ -253,7 +265,10 @@
// Initializing file and download System
connect( &d->m_downloadManager, SIGNAL(downloadComplete(QString,QString)),
this , SLOT(processFinishedJob(QString,QString)) );
-
+
+ connect( marbleModel, SIGNAL(themeChanged(QString)),
+ this, SLOT(themeChanged()) );
+
// We want to download a new description file every timeBetweenDownloads ms
connect( &d->m_downloadTimer, SIGNAL(timeout()),
this, SLOT(handleChangedViewport()),
@@ -275,7 +290,6 @@
qint32 number )
{
GeoDataLatLonAltBox currentBox = viewport->viewLatLonAltBox();
- QString target = d->m_marbleModel->planetId();
QList list;
Q_ASSERT( !d->m_displayedItems.contains( 0 ) && "Null item in m_displayedItems. Please report a bug to marble-devel@kde.org" );
@@ -299,11 +313,6 @@
if( !(*i)->initialized() ) {
continue;
}
-
- // Only show items that are on the current planet
- if( (*i)->target() != target ) {
- continue;
- }
// Hide non-favorite items if necessary
if( d->m_favoriteItemsOnly && !(*i)->isFavorite() ) {
@@ -314,11 +323,15 @@
if( (*i)->positions().isEmpty() ) {
continue;
}
-
+
+ if ( list.contains( *i ) ) {
+ continue;
+ }
+
// If the item was added initially at a nearer position, they don't have priority,
// because we zoomed out since then.
bool const alreadyDisplayed = d->m_displayedItems.contains( *i );
- if( !list.contains( *i ) && ( !alreadyDisplayed || (*i)->addedAngularResolution() >= viewport->angularResolution() ) ) {
+ if ( !alreadyDisplayed || (*i)->addedAngularResolution() >= viewport->angularResolution() || (*i)->isSticky() ) {
bool collides = false;
int const length = list.length();
for ( int j=0; !collides && jid(), type );
+ QString id = d->generateFilename( item->id(), type );
d->m_downloadManager.addJob( url, id, id, DownloadBrowse );
d->m_downloadingItems.insert( id, item );
@@ -524,7 +537,7 @@
d->m_needsSorting = true;
}
-QString AbstractDataPluginModel::generateFilename( const QString& id, const QString& type ) const
+QString AbstractDataPluginModelPrivate::generateFilename( const QString& id, const QString& type ) const
{
QString name;
name += id;
@@ -534,19 +547,9 @@
return name;
}
-QString AbstractDataPluginModel::generateFilepath( const QString& id, const QString& type ) const
+QString AbstractDataPluginModelPrivate::generateFilepath( const QString& id, const QString& type ) const
{
- return MarbleDirs::localPath() + "/cache/" + d->m_name + '/' + generateFilename( id, type );
-}
-
-bool AbstractDataPluginModel::fileExists( const QString& fileName ) const
-{
- return d->m_storagePolicy.fileExists( fileName );
-}
-
-bool AbstractDataPluginModel::fileExists( const QString& id, const QString& type ) const
-{
- return fileExists( generateFilename( id, type ) );
+ return MarbleDirs::localPath() + "/cache/" + m_name + '/' + generateFilename( id, type );
}
AbstractDataPluginItem *AbstractDataPluginModel::findItem( const QString& id ) const
@@ -580,8 +583,7 @@
if( d->m_lastNumber != 0
// We don't need to download if nothing changed
&& ( !( d->m_downloadedBox == d->m_lastBox )
- || d->m_downloadedNumber != d->m_lastNumber
- || d->m_downloadedTarget != d->m_marbleModel->planetId() )
+ || d->m_downloadedNumber != d->m_lastNumber )
// We try to filter little changes of the bounding box
&& ( fabs( d->m_downloadedBox.east() - d->m_lastBox.east() ) * boxComparisonFactor
> d->m_lastBox.width()
@@ -599,8 +601,7 @@
// Save the download parameter
d->m_downloadedBox = d->m_lastBox;
d->m_downloadedNumber = d->m_lastNumber;
- d->m_downloadedTarget = d->m_marbleModel->planetId();
-
+
// Get items
getAdditionalItems( d->m_lastBox, d->m_lastNumber );
}
@@ -640,7 +641,7 @@
return;
}
- (*i)->addDownloadedFile( generateFilepath( itemId, fileType ),
+ (*i)->addDownloadedFile( d->generateFilepath( itemId, fileType ),
fileType );
d->m_downloadingItems.erase( i );
@@ -669,6 +670,9 @@
(*iter)->deleteLater();
}
d->m_itemSet.clear();
+ d->m_lastBox = GeoDataLatLonAltBox();
+ d->m_downloadedBox = GeoDataLatLonAltBox();
+ d->m_downloadedNumber = 0;
emit itemsUpdated();
}
diff -Nru marble-14.12.3/src/lib/marble/AbstractDataPluginModel.h marble-15.04.2/src/lib/marble/AbstractDataPluginModel.h
--- marble-14.12.3/src/lib/marble/AbstractDataPluginModel.h 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/AbstractDataPluginModel.h 2015-05-25 16:24:43.000000000 +0000
@@ -17,7 +17,6 @@
#include
#include "marble_export.h"
-#include "MarbleGlobal.h"
class QPoint;
class QUrl;
@@ -158,26 +157,6 @@
*/
void downloadDescriptionFile( const QUrl& url );
- /**
- * Generates the filename relative to the download path from @p id and @p type
- */
- QString generateFilename( const QString& id, const QString& type ) const;
-
- /**
- * Generates the absolute filepath of the from @p id and @p type
- */
- QString generateFilepath( const QString& id, const QString& type ) const;
-
- /**
- * Testing the existence of the file @p fileName
- */
- bool fileExists( const QString& fileName ) const;
-
- /**
- * Testing the existence of a file with @p id and @p type
- */
- bool fileExists( const QString& id, const QString& type ) const;
-
void registerItemProperties( const QMetaObject& item );
private Q_SLOTS:
@@ -203,6 +182,8 @@
void scheduleItemSort();
+ void themeChanged();
+
Q_SIGNALS:
void itemsUpdated();
void favoriteItemsChanged( const QStringList& favoriteItems );
diff -Nru marble-14.12.3/src/lib/marble/AbstractFloatItem.h marble-15.04.2/src/lib/marble/AbstractFloatItem.h
--- marble-14.12.3/src/lib/marble/AbstractFloatItem.h 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/AbstractFloatItem.h 2015-05-25 16:24:43.000000000 +0000
@@ -82,7 +82,8 @@
void setFont( const QFont &font );
bool render( GeoPainter *painter, ViewportParams *viewport,
- const QString& renderPos = "FLOAT_ITEM", GeoSceneLayer * layer = 0 );
+ const QString& renderPos = QLatin1String("FLOAT_ITEM"),
+ GeoSceneLayer * layer = 0 );
virtual QString renderPolicy() const;
virtual QStringList renderPosition() const;
diff -Nru marble-14.12.3/src/lib/marble/AddLinkDialog.cpp marble-15.04.2/src/lib/marble/AddLinkDialog.cpp
--- marble-14.12.3/src/lib/marble/AddLinkDialog.cpp 1970-01-01 00:00:00.000000000 +0000
+++ marble-15.04.2/src/lib/marble/AddLinkDialog.cpp 2015-05-25 16:24:43.000000000 +0000
@@ -0,0 +1,84 @@
+//
+// This file is part of the Marble Virtual Globe.
+//
+// This program is free software licensed under the GNU LGPL. You can
+// find a copy of this license in LICENSE.txt in the top directory of
+// the source code.
+//
+// Copyright 2015 Mikhail Ivchenko
+//
+
+// self
+#include "AddLinkDialog.h"
+#include "ui_AddLinkDialog.h"
+
+// Qt
+#include
+#include
+#include
+#include
+#include
+
+namespace Marble {
+
+class AddLinkDialog::Private : public Ui::UiAddLinkDialog
+{
+public:
+ Private();
+ ~Private();
+};
+
+AddLinkDialog::Private::Private() :
+ Ui::UiAddLinkDialog()
+{
+ // nothing to do
+}
+
+AddLinkDialog::Private::~Private()
+{
+}
+
+AddLinkDialog::AddLinkDialog( QWidget *parent ) :
+ QDialog( parent ),
+ d( new Private() )
+{
+ d->setupUi( this );
+
+ d->buttonBox->button( QDialogButtonBox::Ok )->setDefault( true );
+ connect( d->buttonBox->button( QDialogButtonBox::Ok ), SIGNAL(pressed()), this, SLOT(checkFields()) );
+ connect( this, SIGNAL(finished(int)), SLOT(deleteLater()) );
+}
+
+AddLinkDialog::~AddLinkDialog()
+{
+ delete d;
+}
+
+QString AddLinkDialog::name() const
+{
+ return d->m_name->text();
+}
+
+QString AddLinkDialog::url() const
+{
+ return d->m_url->text();
+}
+
+void AddLinkDialog::checkFields()
+{
+ if ( d->m_url->text().isEmpty() ) {
+ QMessageBox::warning( this,
+ tr( "No URL specified" ),
+ tr( "Please specify a URL for this link." ) );
+ } else if ( d->m_name->text().isEmpty() ) {
+ QMessageBox::warning( this,
+ tr( "No name specified" ),
+ tr( "Please specify a name for this link." ) );
+ } else {
+ accept();
+ }
+}
+
+}
+
+#include "AddLinkDialog.moc"
diff -Nru marble-14.12.3/src/lib/marble/AddLinkDialog.h marble-15.04.2/src/lib/marble/AddLinkDialog.h
--- marble-14.12.3/src/lib/marble/AddLinkDialog.h 1970-01-01 00:00:00.000000000 +0000
+++ marble-15.04.2/src/lib/marble/AddLinkDialog.h 2015-05-25 16:24:43.000000000 +0000
@@ -0,0 +1,41 @@
+//
+// This file is part of the Marble Virtual Globe.
+//
+// This program is free software licensed under the GNU LGPL. You can
+// find a copy of this license in LICENSE.txt in the top directory of
+// the source code.
+//
+// Copyright 2015 Mikhail Ivchenko
+//
+
+#ifndef ADDLINKDIALOG_H
+#define ADDLINKDIALOG_H
+
+#include "marble_export.h"
+
+#include
+
+
+namespace Marble {
+
+class MARBLE_EXPORT AddLinkDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ AddLinkDialog(QWidget *parent = 0 );
+ ~AddLinkDialog();
+ QString name() const;
+ QString url() const;
+
+private slots:
+ void checkFields();
+
+private:
+ class Private;
+ Private * const d;
+};
+
+}
+
+#endif
diff -Nru marble-14.12.3/src/lib/marble/AddLinkDialog.ui marble-15.04.2/src/lib/marble/AddLinkDialog.ui
--- marble-14.12.3/src/lib/marble/AddLinkDialog.ui 1970-01-01 00:00:00.000000000 +0000
+++ marble-15.04.2/src/lib/marble/AddLinkDialog.ui 2015-05-25 16:24:43.000000000 +0000
@@ -0,0 +1,83 @@
+
+
+ UiAddLinkDialog
+
+
+
+ 0
+ 0
+ 350
+ 72
+
+
+
+ Add link
+
+
+ -
+
+
-
+
+
+ URL:
+
+
+
+ -
+
+
+ -
+
+
+ Name:
+
+
+
+ -
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+
+ 249
+ 407
+
+
+ 157
+ 253
+
+
+
+
+ buttonBox
+ rejected()
+ UiAddLinkDialog
+ reject()
+
+
+ 249
+ 407
+
+
+ 244
+ 253
+
+
+
+
+
diff -Nru marble-14.12.3/src/lib/marble/AnimatedUpdateTrack.cpp marble-15.04.2/src/lib/marble/AnimatedUpdateTrack.cpp
--- marble-14.12.3/src/lib/marble/AnimatedUpdateTrack.cpp 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/AnimatedUpdateTrack.cpp 2015-05-25 16:24:43.000000000 +0000
@@ -59,7 +59,7 @@
{
m_paused = true;
m_pauseTime = QDateTime::currentDateTime();
- m_progress += m_playTime.msecsTo( m_pauseTime );
+ m_progress += m_playTime.secsTo( m_pauseTime );
if( m_timer.isActive() ){
m_timer.stop();
} else {
@@ -80,6 +80,7 @@
m_timer.start( ( m_delayBeforeTrackStarts - m_progress ) * 1000 );
} else {
m_pauseTime = QDateTime::currentDateTime();
+ m_item->stop();
}
} else {
if( !m_paused ){
@@ -87,6 +88,7 @@
m_item->seek( offset - m_delayBeforeTrackStarts );
} else {
m_pauseTime = QDateTime::currentDateTime();
+ m_item->stop();
m_item->seek( offset - m_delayBeforeTrackStarts );
}
}
diff -Nru marble-14.12.3/src/lib/marble/BookmarkManagerDialog.cpp marble-15.04.2/src/lib/marble/BookmarkManagerDialog.cpp
--- marble-14.12.3/src/lib/marble/BookmarkManagerDialog.cpp 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/BookmarkManagerDialog.cpp 2015-05-25 16:24:43.000000000 +0000
@@ -21,6 +21,7 @@
#include "GeoDataFolder.h"
#include "GeoDataPlacemark.h"
#include "GeoDataPoint.h"
+#include "GeoDataStyle.h"
#include "GeoDataTreeModel.h"
#include "GeoDataTypes.h"
#include "GeoWriter.h"
@@ -58,17 +59,17 @@
public:
BookmarkManagerDialog *m_parent;
- BookmarkManager *m_manager;
+ BookmarkManager *const m_manager;
- GeoDataTreeModel* m_treeModel;
+ GeoDataTreeModel *const m_treeModel;
- QSortFilterProxyModel *m_folderFilterModel;
+ QSortFilterProxyModel m_folderFilterModel;
QPersistentModelIndex m_selectedFolder;
- BranchFilterProxyModel *m_branchFilterModel;
+ BranchFilterProxyModel m_branchFilterModel;
- BookmarkManagerDialogPrivate( BookmarkManagerDialog* parent, BookmarkManager* manager );
+ BookmarkManagerDialogPrivate( BookmarkManagerDialog* parent, MarbleModel *model );
void initializeFoldersView( GeoDataTreeModel* treeModel );
@@ -98,8 +99,12 @@
void selectFolder( const QString &name = QString(), const QModelIndex &index = QModelIndex() );
};
-BookmarkManagerDialogPrivate::BookmarkManagerDialogPrivate( BookmarkManagerDialog* parent, BookmarkManager* manager ) :
- m_parent( parent ), m_manager( manager ), m_treeModel( 0 ), m_folderFilterModel( 0 ), m_branchFilterModel( 0 )
+BookmarkManagerDialogPrivate::BookmarkManagerDialogPrivate( BookmarkManagerDialog* parent, MarbleModel *model ) :
+ m_parent( parent ),
+ m_manager( model->bookmarkManager() ),
+ m_treeModel( model->treeModel() ),
+ m_folderFilterModel(),
+ m_branchFilterModel()
{
// nothing to do
}
@@ -112,7 +117,7 @@
return;
}
Q_ASSERT( index.isValid() );
- Q_ASSERT( index.model() == m_folderFilterModel );
+ Q_ASSERT( index.model() == &m_folderFilterModel );
if( m_selectedFolder.isValid() &&
m_parent->foldersTreeView->selectionModel()->selectedIndexes().contains( m_selectedFolder ) ) {
m_selectedFolder = QModelIndex();
@@ -120,9 +125,9 @@
selectFolder();
} else {
m_selectedFolder = index;
- m_branchFilterModel->setBranchIndex( m_treeModel, folderTreeIndex( index ) );
+ m_branchFilterModel.setBranchIndex( m_treeModel, folderTreeIndex( index ) );
m_parent->bookmarksListView->setRootIndex(
- m_branchFilterModel->mapFromSource( folderTreeIndex( index ) ) );
+ m_branchFilterModel.mapFromSource( folderTreeIndex( index ) ) );
m_parent->bookmarksListView->selectionModel()->clear();
}
}
@@ -186,7 +191,7 @@
{
QModelIndexList selection = m_parent->bookmarksListView->selectionModel()->selectedIndexes();
if ( selection.size() == 1 ) {
- QModelIndex index = m_branchFilterModel->mapToSource( selection.first() );
+ QModelIndex index = m_branchFilterModel.mapToSource( selection.first() );
Q_ASSERT( index.isValid() );
GeoDataObject* object = qvariant_cast( index.data( MarblePlacemarkModel::ObjectPointerRole ) );
Q_ASSERT( object );
@@ -213,10 +218,15 @@
dialog->setCoordinates( bookmark->coordinate() );
dialog->setDescription( bookmark->description() );
dialog->setFolderName( folder->name() );
+ dialog->setIconLink( bookmark->style()->iconStyle().iconPath() );
if ( dialog->exec() == QDialog::Accepted ) {
bookmark->setName( dialog->name() );
bookmark->setDescription( dialog->description() );
bookmark->setCoordinate( dialog->coordinates() );
+ GeoDataStyle *newStyle = new GeoDataStyle( *bookmark->style() );
+ newStyle->iconStyle().setIcon( QImage() );
+ newStyle->iconStyle().setIconPath( dialog->iconLink() );
+ bookmark->setStyle( newStyle );
if ( bookmark->lookAt() ) {
bookmark->lookAt()->setCoordinates( dialog->coordinates() );
bookmark->lookAt()->setRange( dialog->range() );
@@ -242,7 +252,7 @@
{
QModelIndexList selection = m_parent->bookmarksListView->selectionModel()->selectedIndexes();
if ( selection.size() == 1 ) {
- QModelIndex bookmarkIndex = m_branchFilterModel->mapToSource( selection.first() );
+ QModelIndex bookmarkIndex = m_branchFilterModel.mapToSource( selection.first() );
GeoDataFolder* folder = dynamic_cast( selectedFolder() );
if ( folder ) {
GeoDataPlacemark* bookmark = dynamic_cast( folder->child( bookmarkIndex.row() ) );
@@ -262,27 +272,27 @@
void BookmarkManagerDialogPrivate::selectFolder( const QString &name, const QModelIndex &parent )
{
if ( parent.isValid() ) {
- Q_ASSERT( parent.model() == m_folderFilterModel );
+ Q_ASSERT( parent.model() == &m_folderFilterModel );
}
if ( name.isEmpty() ) {
QModelIndex documentTreeIndex = m_treeModel->index( m_parent->bookmarkDocument() );
- QModelIndex folderFilterIndex = m_folderFilterModel->mapFromSource( documentTreeIndex );
+ QModelIndex folderFilterIndex = m_folderFilterModel.mapFromSource( documentTreeIndex );
Q_ASSERT( folderFilterIndex.isValid() );
m_parent->foldersTreeView->setCurrentIndex( folderFilterIndex );
handleFolderSelection( folderFilterIndex );
return;
}
- for ( int i=0; i < m_folderFilterModel->rowCount( parent ); ++i ) {
- QModelIndex childIndex = m_folderFilterModel->index( i, 0, parent );
+ for ( int i=0; i < m_folderFilterModel.rowCount( parent ); ++i ) {
+ QModelIndex childIndex = m_folderFilterModel.index( i, 0, parent );
if ( childIndex.data().toString() == name
&& m_selectedFolder != childIndex ) {
m_parent->foldersTreeView->setCurrentIndex( childIndex );
handleFolderSelection( childIndex );
return;
}
- if ( m_folderFilterModel->hasChildren( childIndex ) ) {
+ if ( m_folderFilterModel.hasChildren( childIndex ) ) {
selectFolder( name, childIndex );
}
}
@@ -291,8 +301,8 @@
QModelIndex BookmarkManagerDialogPrivate::folderTreeIndex( const QModelIndex &index ) const
{
Q_ASSERT( index.isValid() );
- Q_ASSERT( index.model() == m_folderFilterModel );
- QModelIndex const treeModelIndex = m_folderFilterModel->mapToSource( index );
+ Q_ASSERT( index.model() == &m_folderFilterModel );
+ QModelIndex const treeModelIndex = m_folderFilterModel.mapToSource( index );
Q_ASSERT( treeModelIndex.isValid() );
Q_ASSERT( treeModelIndex.model() == m_treeModel );
return treeModelIndex;
@@ -313,21 +323,20 @@
void BookmarkManagerDialogPrivate::initializeFoldersView( GeoDataTreeModel* treeModel )
{
- m_folderFilterModel = new QSortFilterProxyModel( m_parent );
- m_folderFilterModel->setFilterKeyColumn( 1 );
+ m_folderFilterModel.setFilterKeyColumn( 1 );
QString regexp = GeoDataTypes::GeoDataFolderType;
regexp += '|';
regexp += GeoDataTypes::GeoDataDocumentType;
- m_folderFilterModel->setFilterRegExp( regexp );
- m_folderFilterModel->setSourceModel( treeModel );
+ m_folderFilterModel.setFilterRegExp( regexp );
+ m_folderFilterModel.setSourceModel( treeModel );
- m_parent->foldersTreeView->setModel( m_folderFilterModel );
+ m_parent->foldersTreeView->setModel( &m_folderFilterModel );
m_parent->foldersTreeView->setEditTriggers( QAbstractItemView::NoEditTriggers );
m_parent->foldersTreeView->setHeaderHidden( true );
for ( int i=1; icolumnCount(); ++i ) {
m_parent->foldersTreeView->hideColumn( i );
}
- m_parent->foldersTreeView->setRootIndex( m_folderFilterModel->mapFromSource(
+ m_parent->foldersTreeView->setRootIndex( m_folderFilterModel.mapFromSource(
m_treeModel->index( m_parent->bookmarkDocument() )));
m_parent->connect( m_parent->foldersTreeView,
@@ -346,10 +355,9 @@
void BookmarkManagerDialogPrivate::initializeBookmarksView( GeoDataTreeModel* treeModel )
{
- m_branchFilterModel = new BranchFilterProxyModel( m_parent );
- m_branchFilterModel->setSourceModel( treeModel );
+ m_branchFilterModel.setSourceModel( treeModel );
- m_parent->bookmarksListView->setModel( m_branchFilterModel );
+ m_parent->bookmarksListView->setModel( &m_branchFilterModel );
m_parent->bookmarksListView->setEditTriggers( QAbstractItemView::NoEditTriggers );
m_parent->connect( m_parent->bookmarksListView->selectionModel(),
@@ -363,7 +371,7 @@
BookmarkManagerDialog::BookmarkManagerDialog( MarbleModel* model, QWidget *parent )
: QDialog( parent ),
- d( new BookmarkManagerDialogPrivate( this, model->bookmarkManager() ) )
+ d( new BookmarkManagerDialogPrivate( this, model ) )
{
setupUi( this );
bool const smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen;
@@ -372,8 +380,6 @@
foldersLabel->setVisible( !smallScreen );
bookmarkLabel->setVisible( !smallScreen );
- d->m_treeModel = model->treeModel();
-
d->initializeFoldersView( d->m_treeModel );
d->initializeBookmarksView( d->m_treeModel );
d->updateButtonState();
diff -Nru marble-14.12.3/src/lib/marble/cloudsync/BookmarkSyncManager.cpp marble-15.04.2/src/lib/marble/cloudsync/BookmarkSyncManager.cpp
--- marble-14.12.3/src/lib/marble/cloudsync/BookmarkSyncManager.cpp 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/cloudsync/BookmarkSyncManager.cpp 2015-05-25 16:24:43.000000000 +0000
@@ -267,7 +267,7 @@
void BookmarkSyncManager::startBookmarkSync()
{
- if ( !isBookmarkSyncEnabled() )
+ if ( !d->m_cloudSyncManager->isSyncEnabled() || !isBookmarkSyncEnabled() )
{
return;
}
@@ -722,10 +722,6 @@
QFile bookmarksFile( m_localBookmarksPath );
bookmarksFile.copy( QString( "%0/%1.kml" ).arg( m_cachePath, m_cloudTimestamp ) );
- /** @todo FIXME use memory, not files */
- disconnect( m_bookmarkManager, SIGNAL(bookmarksChanged()), m_q, SLOT(startBookmarkSync()) );
- m_bookmarkManager->loadFile( "bookmarks/bookmarks.kml" );
- connect( m_bookmarkManager, SIGNAL(bookmarksChanged()), m_q, SLOT(startBookmarkSync()) );
}
// Bookmark synchronization steps
diff -Nru marble-14.12.3/src/lib/marble/CMakeLists.txt marble-15.04.2/src/lib/marble/CMakeLists.txt
--- marble-14.12.3/src/lib/marble/CMakeLists.txt 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/CMakeLists.txt 2015-05-25 16:24:43.000000000 +0000
@@ -43,8 +43,8 @@
INCLUDE(graphicsview/CMakeLists.txt)
INCLUDE(layers/CMakeLists.txt)
-set(GENERIC_LIB_VERSION "0.19.95")
-set(GENERIC_LIB_SOVERSION "20")
+set(GENERIC_LIB_VERSION "0.21.2")
+set(GENERIC_LIB_SOVERSION "21")
if (QTONLY)
# ce: don't know why this is needed here - on win32 'O2' is activated by default in release mode
@@ -95,6 +95,12 @@
MapViewWidget.cpp
FileViewWidget.cpp
TourWidget.cpp
+ FlyToEditWidget.cpp
+ TourControlEditWidget.cpp
+ WaitEditWidget.cpp
+ SoundCueEditWidget.cpp
+ RemoveItemEditWidget.cpp
+ TourItemDelegate.cpp
TourPlayback.cpp
LegendWidget.cpp
PlaybackItem.cpp
@@ -193,6 +199,8 @@
MovieCapture.cpp
MovieCaptureDialog.cpp
TourCaptureDialog.cpp
+ EditPlacemarkDialog.cpp
+ AddLinkDialog.cpp
AbstractDataPlugin.cpp
AbstractDataPluginModel.cpp
@@ -222,6 +230,7 @@
MathHelper.cpp
LatLonEdit.cpp
+ PlacemarkEditHeader.cpp
MapThemeSortFilterProxyModel.cpp
@@ -317,6 +326,7 @@
MarbleAboutDialog.ui
SunControlWidget.ui
LatLonEdit.ui
+ PlacemarkEditHeader.ui
routing/RoutingWidget.ui
DataMigrationWidget.ui
EditBookmarkDialog.ui
@@ -334,6 +344,9 @@
MarbleCloudSyncSettingsWidget.ui
MovieCaptureDialog.ui
TourCaptureDialog.ui
+ EditPlacemarkDialog.ui
+ AddLinkDialog.ui
+ ElevationWidget.ui
)
# FIXME: cleaner approach of src/lib/marblwidget/MarbleControlBox.* vs. marble.qrc
@@ -444,6 +457,12 @@
LegendWidget.h
FileViewWidget.h
TourWidget.h
+ FlyToEditWidget.h
+ TourControlEditWidget.h
+ WaitEditWidget.h
+ SoundCueEditWidget.h
+ RemoveItemEditWidget.h
+ TourItemDelegate.h
TourPlayback.h
CurrentLocationWidget.h
MarbleNavigator.h
@@ -546,6 +565,8 @@
marble_export.h
Planet.h
PlanetFactory.h
+ EditPlacemarkDialog.h
+ AddLinkDialog.h
AbstractDataPlugin.h
AbstractDataPluginModel.h
@@ -553,6 +574,7 @@
AbstractWorkerThread.h
LatLonEdit.h
+ PlacemarkEditHeader.h
MapWizard.h
MapThemeDownloadDialog.h
ElevationModel.h
diff -Nru marble-14.12.3/src/lib/marble/EditBookmarkDialog.cpp marble-15.04.2/src/lib/marble/EditBookmarkDialog.cpp
--- marble-14.12.3/src/lib/marble/EditBookmarkDialog.cpp 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/EditBookmarkDialog.cpp 2015-05-25 16:24:43.000000000 +0000
@@ -17,16 +17,18 @@
#include "GeoDataDocument.h"
#include "GeoDataPlacemark.h"
#include "GeoDataPoint.h"
+#include "GeoDataStyle.h"
#include "GeoDataFolder.h"
#include "GeoDataCoordinates.h"
#include "GeoDataExtendedData.h"
+#include "MarbleDirs.h"
#include "MarbleModel.h"
#include "MarbleWidget.h"
#include "NewBookmarkFolderDialog.h"
#include "ReverseGeocodingRunnerManager.h"
#include
-
+#include
namespace Marble {
class EditBookmarkDialogPrivate {
@@ -67,15 +69,12 @@
void EditBookmarkDialogPrivate::initialize()
{
m_ui.setupUi( q );
- m_ui.m_longitude->setDimension( Longitude );
- m_ui.m_latitude->setDimension( Latitude );
bool const smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen;
- m_ui.position_lbl->setVisible( !smallScreen );
- m_ui.m_latitude->setVisible( !smallScreen );
- m_ui.m_longitude->setVisible( !smallScreen );
+ m_ui.m_header->setPositionVisible(!smallScreen);
+ m_ui.m_header->setIdVisible( false );
+ m_ui.m_header->setIconLink( MarbleDirs::path( "bitmaps/bookmark.png" ) );
QObject::connect( m_ui.m_newFolderButton, SIGNAL(clicked()), q, SLOT(openNewFolderDialog()) );
- QObject::connect( m_ui.m_longitude, SIGNAL(valueChanged(qreal)), q, SLOT(updateCoordinates()) );
- QObject::connect( m_ui.m_latitude, SIGNAL(valueChanged(qreal)), q, SLOT(updateCoordinates()) );
+ QObject::connect( m_ui.m_header, SIGNAL(valueChanged()), q, SLOT(updateCoordinates()) );
m_ui.m_folders->clear();
initComboBox( m_bookmarkManager->document() );
@@ -113,14 +112,15 @@
void EditBookmarkDialog::setCoordinates( const GeoDataCoordinates &coordinates )
{
d->m_bookmarkCoordinates = coordinates;
+ QObject::disconnect( d->m_ui.m_header, SIGNAL(valueChanged()), this, SLOT(updateCoordinates()) );
- if ( d->m_ui.m_name->text().isEmpty() ) {
- d->m_ui.m_name->setText( coordinates.toString() );
- d->m_ui.m_name->selectAll();
+ if ( d->m_ui.m_header->name().isEmpty() ) {
+ d->m_ui.m_header->setName( coordinates.toString() );
}
- d->m_ui.m_longitude->setValue( coordinates.longitude(GeoDataCoordinates::Degree) );
- d->m_ui.m_latitude->setValue( coordinates.latitude(GeoDataCoordinates::Degree) );
+ d->m_ui.m_header->setLongitude( coordinates.longitude(GeoDataCoordinates::Degree) );
+ d->m_ui.m_header->setLatitude( coordinates.latitude(GeoDataCoordinates::Degree) );
+ QObject::connect( d->m_ui.m_header, SIGNAL(valueChanged()), this, SLOT(updateCoordinates()) );
}
void EditBookmarkDialog::setRange( qreal range ) {
@@ -129,12 +129,17 @@
void EditBookmarkDialog::setName( const QString &text )
{
- d->m_ui.m_name->setText( text );
+ QObject::disconnect( d->m_ui.m_header, SIGNAL(valueChanged()), this, SLOT(updateCoordinates()) );
+ d->m_ui.m_header->setName( text );
+ d->m_ui.m_header->selectAll();
+ QObject::connect( d->m_ui.m_header, SIGNAL(valueChanged()), this, SLOT(updateCoordinates()) );
}
void EditBookmarkDialog::setDescription( const QString &text )
{
+ QObject::disconnect( d->m_ui.m_header, SIGNAL(valueChanged()), this, SLOT(updateCoordinates()) );
d->m_ui.m_description->setText( text );
+ QObject::connect( d->m_ui.m_header, SIGNAL(valueChanged()), this, SLOT(updateCoordinates()) );
}
void EditBookmarkDialog::setFolderName( const QString &name )
@@ -142,6 +147,13 @@
d->setFolderName( name );
}
+void EditBookmarkDialog::setIconLink(const QString &iconLink)
+{
+ QObject::disconnect( d->m_ui.m_header, SIGNAL(valueChanged()), this, SLOT(updateCoordinates()) );
+ d->m_ui.m_header->setIconLink( iconLink );
+ QObject::connect( d->m_ui.m_header, SIGNAL(valueChanged()), this, SLOT(updateCoordinates()) );
+}
+
void EditBookmarkDialog::setMarbleWidget( MarbleWidget* widget )
{
d->m_widget = widget;
@@ -150,8 +162,7 @@
(defaultAngleUnit == DecimalDegree) ? GeoDataCoordinates::Decimal :
(defaultAngleUnit == DMSDegree) ? GeoDataCoordinates::DMS :
/* else, UTM */ GeoDataCoordinates::DMS;
- d->m_ui.m_longitude->setNotation( notation );
- d->m_ui.m_latitude->setNotation( notation );
+ d->m_ui.m_header->setNotation(notation);
d->m_manager = new ReverseGeocodingRunnerManager( d->m_widget->model(), this );
QObject::connect( d->m_manager, SIGNAL(reverseGeocodingFinished(GeoDataCoordinates,GeoDataPlacemark)),
@@ -198,8 +209,8 @@
bookmarkName = placemark.address();
}
- m_ui.m_name->setText( bookmarkName );
- m_ui.m_name->selectAll();
+ m_ui.m_header->setName( bookmarkName );
+ m_ui.m_header->selectAll();
}
QString EditBookmarkDialogPrivate::append( const QString &bookmark, const QString &text)
@@ -230,8 +241,8 @@
void EditBookmarkDialogPrivate::updateCoordinates()
{
- m_bookmarkCoordinates.setLongitude( m_ui.m_longitude->value(), GeoDataCoordinates::Degree );
- m_bookmarkCoordinates.setLatitude( m_ui.m_latitude->value(), GeoDataCoordinates::Degree );
+ m_bookmarkCoordinates.setLongitude( m_ui.m_header->longitude(), GeoDataCoordinates::Degree );
+ m_bookmarkCoordinates.setLatitude( m_ui.m_header->latitude(), GeoDataCoordinates::Degree );
}
GeoDataPlacemark EditBookmarkDialog::bookmark() const
@@ -240,6 +251,10 @@
GeoDataPlacemark bookmark;
bookmark.setName( name() );
bookmark.setDescription( description() );
+ GeoDataStyle *newStyle = new GeoDataStyle( *bookmark.style() );
+ newStyle->iconStyle().setIcon( QImage() );
+ newStyle->iconStyle().setIconPath( iconLink() );
+ bookmark.setStyle( newStyle );
//allow for HTML in the description
bookmark.setDescriptionCDATA( true );
bookmark.setCoordinate( coordinates() );
@@ -264,7 +279,7 @@
QString EditBookmarkDialog::name() const
{
- return d->m_ui.m_name->text();
+ return d->m_ui.m_header->name();
}
GeoDataFolder *EditBookmarkDialog::folder() const
@@ -286,6 +301,11 @@
return d->m_range;
}
+QString EditBookmarkDialog::iconLink() const
+{
+ return d->m_ui.m_header->iconLink();
+}
+
}
#include "EditBookmarkDialog.moc"
diff -Nru marble-14.12.3/src/lib/marble/EditBookmarkDialog.h marble-15.04.2/src/lib/marble/EditBookmarkDialog.h
--- marble-14.12.3/src/lib/marble/EditBookmarkDialog.h 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/EditBookmarkDialog.h 2015-05-25 16:24:43.000000000 +0000
@@ -53,6 +53,8 @@
qreal range() const;
+ QString iconLink() const;
+
void setName( const QString &name );
void setReverseGeocodeName();
@@ -64,6 +66,8 @@
void setFolderName( const QString &name );
+ void setIconLink( const QString &iconLink );
+
private:
Q_PRIVATE_SLOT( d, void openNewFolderDialog() )
diff -Nru marble-14.12.3/src/lib/marble/EditBookmarkDialog.ui marble-15.04.2/src/lib/marble/EditBookmarkDialog.ui
--- marble-14.12.3/src/lib/marble/EditBookmarkDialog.ui 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/EditBookmarkDialog.ui 2015-05-25 16:24:43.000000000 +0000
@@ -6,8 +6,8 @@
0
0
- 309
- 228
+ 354
+ 394
@@ -15,53 +15,11 @@
-
+
+
+ -
-
-
-
- &Name
-
-
- m_name
-
-
-
- -
-
-
-
-
-
- 0
-
-
-
- -
-
-
- &Position
-
-
- m_latitude
-
-
-
- -
-
-
- 0
-
-
-
-
-
-
- -
-
-
-
-
-
- -
&Description
@@ -71,7 +29,7 @@
- -
+
-
@@ -83,16 +41,17 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Ubuntu'; font-size:9pt; font-weight:400; font-style:normal;">
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;">
<tr>
<td style="border: none;">
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></td></tr></table></body></html>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';"><br /></p></td></tr></table></body></html>
- -
+
-
&Folder
@@ -102,7 +61,7 @@
- -
+
-
-
@@ -123,28 +82,25 @@
+ -
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
- -
-
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
-
-
-
- Marble::LatLonEdit
+ Marble::PlacemarkEditHeader
QWidget
-
+
-
- m_name
- m_latitude
- m_longitude
+
m_description
m_folders
diff -Nru marble-14.12.3/src/lib/marble/EditPlacemarkDialog.cpp marble-15.04.2/src/lib/marble/EditPlacemarkDialog.cpp
--- marble-14.12.3/src/lib/marble/EditPlacemarkDialog.cpp 1970-01-01 00:00:00.000000000 +0000
+++ marble-15.04.2/src/lib/marble/EditPlacemarkDialog.cpp 2015-05-25 16:24:43.000000000 +0000
@@ -0,0 +1,639 @@
+//
+// This file is part of the Marble Virtual Globe.
+//
+// This program is free software licensed under the GNU LGPL. You can
+// find a copy of this license in LICENSE.txt in the top directory of
+// the source code.
+//
+// Copyright 2014 Calin Cruceru
+// Copyright 2015 Ilya Kowalewski
+//
+
+// self
+#include "EditPlacemarkDialog.h"
+#include "ui_EditPlacemarkDialog.h"
+#include "ui_ElevationWidget.h"
+
+// Qt
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+// Marble
+#include "GeoDataStyle.h"
+#include "GeoDataPlacemark.h"
+#include "MarbleWidget.h"
+#include "MarbleLocale.h"
+#include "AddLinkDialog.h"
+
+namespace Marble {
+
+class EditPlacemarkDialog::Private : public Ui::UiEditPlacemarkDialog
+{
+public:
+ Private( GeoDataPlacemark *placemark );
+ ~Private();
+
+ GeoDataPlacemark *m_placemark;
+
+ // Attached to label/icon/text color selectors.
+ QColorDialog *m_iconColorDialog;
+ QColorDialog *m_labelColorDialog;
+ QColorDialog *m_textColorDialog;
+
+
+ // Used to restore if the Cancel button is pressed.
+ QString m_initialDescription;
+ QString m_initialName;
+ GeoDataCoordinates m_initialCoords;
+ GeoDataStyle m_initialStyle;
+ QString m_styleColorTabName;
+ bool m_initialIsPlacemarkVisible;
+ bool m_initialIsBaloonVisible;
+ bool m_initialDescriptionIsCDATA;
+ QString m_initialId;
+ Ui::ElevationWidget *m_elevationWidget;
+ MarbleLocale::MeasureUnit m_elevationUnit;
+ QString m_initialTargetId;
+ QPushButton *m_textColorButton;
+};
+
+EditPlacemarkDialog::Private::Private( GeoDataPlacemark *placemark ) :
+ Ui::UiEditPlacemarkDialog(),
+ m_placemark( placemark ),
+ m_iconColorDialog( 0 ),
+ m_labelColorDialog( 0 ),
+ m_textColorButton( new QPushButton )
+{
+ // nothing to do
+}
+
+EditPlacemarkDialog::Private::~Private()
+{
+ delete m_elevationWidget;
+ delete m_iconColorDialog;
+ delete m_labelColorDialog;
+ delete m_textColorDialog;
+}
+
+EditPlacemarkDialog::EditPlacemarkDialog( GeoDataPlacemark *placemark, QWidget *parent ) :
+ QDialog( parent ),
+ d( new Private( placemark ) )
+{
+ d->setupUi( this );
+
+ // Store initial style so that it can be restored if the 'Cancel' button is pressed.
+ d->m_initialStyle = *placemark->style();
+
+
+ // If the placemark has just been created, assign it a default name.
+ if ( placemark->name().isNull() ) {
+ placemark->setName( tr("Untitled Placemark") );
+ }
+ // Setup id, name, icon link and latitude/longitude values.
+ d->m_header->setId( placemark->id() );
+ d->m_initialId = placemark->id();
+ d->m_header->setName( placemark->name() );
+ d->m_initialName = placemark->name();
+ d->m_isPlacemarkVisible->setChecked( placemark->isVisible() );
+ d->m_initialIsPlacemarkVisible = placemark->isVisible();
+ d->m_header->setIconLink( placemark->style()->iconStyle().iconPath() );
+ d->m_header->setTargetId( placemark->targetId() );
+ d->m_initialTargetId = placemark->targetId();
+ MarbleWidget* marbleWidget = dynamic_cast( parent );
+ if( marbleWidget != 0 ) {
+ const AngleUnit defaultAngleUnit = marbleWidget->defaultAngleUnit();
+ const GeoDataCoordinates::Notation notation =
+ (defaultAngleUnit == DecimalDegree) ? GeoDataCoordinates::Decimal :
+ (defaultAngleUnit == DMSDegree) ? GeoDataCoordinates::DMS :
+ /* else, UTM */ GeoDataCoordinates::DMS;
+ d->m_header->setNotation( notation );
+ }
+ connect( d->m_header, SIGNAL(valueChanged()), this, SLOT(
+ updateTextAnnotation()) );
+
+ if( d->m_isFormattedTextMode->isChecked() ) {
+ d->m_description->setHtml( placemark->description() );
+ } else {
+ d->m_description->setPlainText( placemark->description() );
+ }
+ d->m_description->setPlainText( placemark->description() );
+ d->m_initialDescription = placemark->description();
+ d->m_initialDescriptionIsCDATA = placemark->descriptionIsCDATA();
+ d->m_isBalloonVisible->setChecked( placemark->isBalloonVisible() );
+ d->m_initialIsBaloonVisible = placemark->isBalloonVisible();
+
+ d->m_header->setLatitude( placemark->coordinate().latitude( GeoDataCoordinates::Degree ) );
+ d->m_header->setLongitude( placemark->coordinate().longitude( GeoDataCoordinates::Degree ) );
+ d->m_initialCoords = GeoDataCoordinates( d->m_header->longitude(),
+ d->m_header->latitude(),
+ 0,
+ GeoDataCoordinates::Degree );
+
+ d->m_elevationWidget = new Ui::ElevationWidget;
+ QWidget *elevationTab = new QWidget;
+ d->m_elevationWidget->setupUi( elevationTab );
+ d->tabWidget->addTab( elevationTab, tr("Elevation") );
+ qreal altitude = d->m_placemark->coordinate().altitude();
+ MarbleLocale *locale = MarbleGlobal::getInstance()->locale();
+ if ( altitude == 0.0 ) {
+ switch ( locale->measurementSystem() ) {
+ case MarbleLocale::MetricSystem:
+ d->m_elevationUnit = MarbleLocale::Meter;
+ break;
+ case MarbleLocale::ImperialSystem:
+ d->m_elevationUnit = MarbleLocale::Foot;
+ break;
+ case MarbleLocale::NauticalSystem:
+ d->m_elevationUnit = MarbleLocale::NauticalMile;
+ break;
+ }
+
+ d->m_elevationWidget->elevationSpinBox->setSuffix( locale->unitAbbreviation((d->m_elevationUnit)) );
+ } else {
+ qreal convertedAltitude;
+ const MarbleLocale::MeasurementSystem currentSystem = locale->measurementSystem();
+ locale->meterToTargetUnit( altitude, currentSystem, convertedAltitude, d->m_elevationUnit );
+ d->m_elevationWidget->elevationSpinBox->setValue( convertedAltitude );
+ d->m_elevationWidget->elevationSpinBox->setSuffix( locale->unitAbbreviation(d->m_elevationUnit) );
+ }
+
+ // Adjust icon and label scales.
+ d->m_iconScale->setValue( placemark->style()->iconStyle().scale() );
+ connect( d->m_iconScale, SIGNAL(valueChanged(double)), this, SLOT(updateTextAnnotation()) );
+
+ d->m_labelScale->setValue( placemark->style()->labelStyle().scale() );
+ connect( d->m_labelScale, SIGNAL(valueChanged(double)), this, SLOT(updateTextAnnotation()) );
+
+
+ // Adjust the current color of the two push buttons' pixmap to resemble the label and icon colors.
+ const GeoDataLabelStyle labelStyle = placemark->style()->labelStyle();
+ const GeoDataIconStyle iconStyle = placemark->style()->iconStyle();
+
+ QPixmap labelPixmap( d->m_labelButton->iconSize().width(),
+ d->m_labelButton->iconSize().height() );
+ labelPixmap.fill( labelStyle.color() );
+ d->m_labelButton->setIcon( QIcon( labelPixmap ) );
+
+ QPixmap iconPixmap( d->m_iconButton->iconSize().width(),
+ d->m_iconButton->iconSize().height() );
+ iconPixmap.fill( iconStyle.color() );
+ d->m_iconButton->setIcon( QIcon( iconPixmap ) );
+
+ // Setup the color dialogs.
+ d->m_labelColorDialog = new QColorDialog( this );
+ d->m_labelColorDialog->setOption( QColorDialog::ShowAlphaChannel );
+ d->m_labelColorDialog->setCurrentColor( labelStyle.color() );
+ connect( d->m_labelButton, SIGNAL(clicked()), d->m_labelColorDialog, SLOT(exec()) );
+ connect( d->m_labelColorDialog, SIGNAL(colorSelected(QColor)), this, SLOT(updateLabelDialog(const QColor&)) );
+ connect( d->m_labelColorDialog, SIGNAL(colorSelected(QColor)), this, SLOT(updateTextAnnotation()) );
+
+ d->m_iconColorDialog = new QColorDialog( this );
+ d->m_iconColorDialog->setOption( QColorDialog::ShowAlphaChannel );
+ d->m_iconColorDialog->setCurrentColor( iconStyle.color() );
+ connect( d->m_iconButton, SIGNAL(clicked()), d->m_iconColorDialog, SLOT(exec()) );
+ connect( d->m_iconColorDialog, SIGNAL(colorSelected(QColor)), this, SLOT(updateIconDialog(const QColor&)) );
+ connect( d->m_iconColorDialog, SIGNAL(colorSelected(QColor)), this, SLOT(updateTextAnnotation()) );
+
+ d->m_formattedTextToolBar->setVisible( false );
+ d->m_fontSize->setVisible( false );
+ d->m_fontFamily->setVisible( false );
+ QAction *separator = d->m_formattedTextToolBar->insertSeparator( d->m_actionAddImage );
+ d->m_formattedTextToolBar->insertWidget( separator, d->m_textColorButton );
+ d->m_textColorButton->setMaximumSize( 24, 24 );
+ QPixmap textColorPixmap( d->m_textColorButton->iconSize().width(),
+ d->m_textColorButton->iconSize().height() );
+ textColorPixmap.fill( d->m_description->textCursor().charFormat().foreground().color() );
+ d->m_textColorButton->setIcon( QIcon( textColorPixmap ) );
+ d->m_textColorDialog = new QColorDialog( this );
+ d->m_textColorDialog->setOption( QColorDialog::ShowAlphaChannel );
+ d->m_textColorDialog->setCurrentColor( d->m_description->textCursor().charFormat().foreground().color() );
+ d->m_fontSize->setValidator( new QIntValidator( 1, 9000, this ) );
+ int index = d->m_fontSize->findText( QString::number( d->m_description->textCursor().charFormat().font().pointSize() ) );
+ if( index != -1 ) {
+ d->m_fontSize->setCurrentIndex( index );
+ } else {
+ d->m_fontSize->lineEdit()->setText( QString::number( d->m_description->textCursor().charFormat().font().pointSize() ) );
+ }
+ connect( d->m_textColorButton, SIGNAL( clicked() ), d->m_textColorDialog, SLOT( exec() ) );
+ connect( d->m_textColorDialog, SIGNAL( colorSelected( QColor ) ), this, SLOT( setTextCursorColor( const QColor& ) ) );
+ connect( d->m_isFormattedTextMode, SIGNAL( toggled( bool ) ), this, SLOT( toggleDescriptionEditMode( bool ) ) );
+ connect( d->m_fontFamily, SIGNAL( currentFontChanged( QFont ) ), this, SLOT( setTextCursorFont( QFont ) ) );
+ connect( d->m_fontSize, SIGNAL( editTextChanged( QString ) ), this, SLOT( setTextCursorFontSize( QString ) ) );
+ connect( d->m_actionBold, SIGNAL( toggled( bool ) ), this, SLOT( setTextCursorBold( bool ) ) );
+ connect( d->m_actionItalics, SIGNAL( toggled( bool ) ), this, SLOT( setTextCursorItalic( bool ) ) );
+ connect( d->m_actionUnderlined, SIGNAL( toggled( bool ) ), this, SLOT( setTextCursorUnderlined( bool ) ) );
+ connect( d->m_actionAddImage, SIGNAL( triggered() ), this, SLOT( addImageToDescription() ) );
+ connect( d->m_actionAddLink, SIGNAL( triggered() ), this, SLOT( addLinkToDescription() ) );
+ connect( d->m_description, SIGNAL( cursorPositionChanged() ), this, SLOT( updateDescriptionEditButtons() ) );
+
+ // Promote "Ok" button to default button.
+ d->buttonBox->button( QDialogButtonBox::Ok )->setDefault( true );
+
+ connect( d->buttonBox->button( QDialogButtonBox::Ok ), SIGNAL(pressed()), this, SLOT(checkFields()) );
+ connect( this, SIGNAL(accepted()), SLOT(updateTextAnnotation()) );
+ connect( this, SIGNAL(accepted()), SLOT(updatePlacemarkAltitude()) );
+ connect( this, SIGNAL(finished(int)), SLOT(restoreInitial(int)) );
+
+ // Ensure that the dialog gets deleted when closing it (either when clicking OK or
+ // Close).
+ connect( this, SIGNAL(finished(int)), SLOT(deleteLater()) );
+}
+
+EditPlacemarkDialog::~EditPlacemarkDialog()
+{
+ delete d;
+}
+
+void EditPlacemarkDialog::setLabelColor( const QColor &color )
+{
+ d->m_labelColorDialog->setCurrentColor(color);
+ updateLabelDialog(color);
+}
+
+QStringList EditPlacemarkDialog::idFilter() const
+{
+ return d->m_header->idFilter();
+}
+
+QStringList EditPlacemarkDialog::targetIds() const
+{
+ return d->m_header->targetIdList();
+}
+
+bool EditPlacemarkDialog::isTargetIdFieldVisible() const
+{
+ return d->m_header->isTargetIdVisible();
+}
+
+bool EditPlacemarkDialog::isIdFieldVisible() const
+{
+ return d->m_header->isIdVisible();
+}
+
+void EditPlacemarkDialog::updateDialogFields()
+{
+ d->m_header->setLatitude( d->m_placemark->coordinate().latitude( GeoDataCoordinates::Degree ) );
+ d->m_header->setLongitude( d->m_placemark->coordinate().longitude( GeoDataCoordinates::Degree ) );
+}
+
+void EditPlacemarkDialog::setIdFilter(const QStringList &filter)
+{
+ d->m_header->setIdFilter( filter );
+}
+
+void EditPlacemarkDialog::setTargetIds(const QStringList &targetIds)
+{
+ d->m_header->setTargetIdList( targetIds );
+}
+
+void EditPlacemarkDialog::setTargetIdFieldVisible(bool visible)
+{
+ d->m_header->setTargetIdVisible( visible );
+}
+
+void EditPlacemarkDialog::setIdFieldVisible(bool visible)
+{
+ d->m_header->setIdVisible( visible );
+}
+
+void EditPlacemarkDialog::setReadOnly(bool state)
+{
+ d->m_header->setReadOnly(state);
+ d->m_description->setReadOnly(state);
+ d->m_isBalloonVisible->setDisabled(state);
+ d->m_isPlacemarkVisible->setDisabled(state);
+ d->style_color_tab->setDisabled(state);
+}
+
+void EditPlacemarkDialog::updateTextAnnotation()
+{
+ if( d->m_isFormattedTextMode->isChecked() ) {
+ d->m_placemark->setDescription( d->m_description->toHtml() );
+ } else {
+ d->m_placemark->setDescription( d->m_description->toPlainText() );
+ }
+ //allow for HTML in the description
+ d->m_placemark->setDescriptionCDATA( true );
+ d->m_placemark->setName( d->m_header->name() );
+ d->m_placemark->setCoordinate( GeoDataCoordinates( d->m_header->longitude(),
+ d->m_header->latitude(),
+ 0,
+ GeoDataCoordinates::Degree ) );
+
+ d->m_placemark->setVisible( d->m_isPlacemarkVisible->isChecked() );
+ d->m_placemark->setBalloonVisible( d->m_isBalloonVisible->isChecked() );
+ d->m_placemark->setId( d->m_header->id() );
+ d->m_placemark->setTargetId( d->m_header->targetId() );
+
+ GeoDataStyle *newStyle = new GeoDataStyle( *d->m_placemark->style() );
+
+ QFileInfo fileInfo( d->m_header->iconLink() );
+ if ( fileInfo.exists() ) {
+ newStyle->iconStyle().setIconPath( d->m_header->iconLink() );
+ }
+
+ newStyle->iconStyle().setScale( d->m_iconScale->value() );
+ newStyle->labelStyle().setScale( d->m_labelScale->value() );
+
+ newStyle->iconStyle().setColor( d->m_iconColorDialog->currentColor() );
+ newStyle->labelStyle().setColor( d->m_labelColorDialog->currentColor() );
+
+ d->m_placemark->setStyle( newStyle );
+
+ emit textAnnotationUpdated( d->m_placemark );
+}
+
+void EditPlacemarkDialog::checkFields()
+{
+ if ( d->m_header->name().isEmpty() ) {
+ QMessageBox::warning( this,
+ tr( "No name specified" ),
+ tr( "Please specify a name for this placemark." ) );
+ } else if ( isIdFieldVisible() && d->m_header->id().isEmpty() ) {
+ QMessageBox::warning( this,
+ tr( "No ID specified" ),
+ tr( "Please specify a ID for this placemark." ) );
+ } else if ( isIdFieldVisible() && !d->m_header->isIdValid() ) {
+ QMessageBox::warning( this,
+ tr( "ID is invalid" ),
+ tr( "Please specify a valid ID for this placemark." ) );
+ } else if ( d->m_header->iconLink().isEmpty() ) {
+ QMessageBox::warning( this,
+ tr( "No image specified" ),
+ tr( "Please specify an icon for this placemark." ) );
+ } else if( !QFileInfo( d->m_header->iconLink() ).exists() ) {
+ QMessageBox::warning( this,
+ tr( "Invalid icon path" ),
+ tr( "Please specify a valid path for the icon file." ) );
+ } else {
+ accept();
+ }
+}
+
+void EditPlacemarkDialog::updateLabelDialog( const QColor &color )
+{
+ QPixmap labelPixmap( d->m_labelButton->iconSize().width(),
+ d->m_labelButton->iconSize().height() );
+ labelPixmap.fill( color );
+ d->m_labelButton->setIcon( QIcon( labelPixmap ) );
+}
+
+void EditPlacemarkDialog::updateIconDialog( const QColor &color )
+{
+ QPixmap iconPixmap( d->m_iconButton->iconSize().width(),
+ d->m_iconButton->iconSize().height() );
+ iconPixmap.fill( color );
+ d->m_iconButton->setIcon( QIcon( iconPixmap ) );
+}
+
+void EditPlacemarkDialog::updatePlacemarkAltitude()
+{
+ GeoDataCoordinates coord = d->m_placemark->coordinate();
+ qreal altitude = d->m_elevationWidget->elevationSpinBox->value();
+
+ switch (d->m_elevationUnit) {
+ case MarbleLocale::Meter:
+ break;
+ case MarbleLocale::Milimeter:
+ altitude *= MM2M;
+ break;
+ case MarbleLocale::Kilometer:
+ altitude *= KM2METER;
+ break;
+ case MarbleLocale::Centimeter:
+ altitude *= CM2M;
+ break;
+ case MarbleLocale::Foot:
+ altitude *= FT2M;
+ break;
+ case MarbleLocale::Inch:
+ altitude *= IN2M;
+ break;
+ case MarbleLocale::Yard:
+ altitude *= YD2M;
+ break;
+ case MarbleLocale::Mile:
+ altitude *= MI2KM * KM2METER;
+ break;
+ case MarbleLocale::NauticalMile:
+ altitude *= NM2KM * KM2METER;
+ break;
+ default:
+ break;
+ }
+
+ coord.setAltitude(altitude);
+ d->m_placemark->setCoordinate(coord);
+}
+
+void EditPlacemarkDialog::restoreInitial( int result )
+{
+ if ( result ) {
+ return;
+ }
+
+ if ( d->m_placemark->name() != d->m_initialName ) {
+ d->m_placemark->setName( d->m_initialName );
+ }
+
+ if ( isIdFieldVisible() && d->m_placemark->id() != d->m_initialId ) {
+ d->m_placemark->setId( d->m_initialId );
+ }
+
+ if ( isTargetIdFieldVisible() && d->m_placemark->targetId() != d->m_initialTargetId ) {
+ d->m_placemark->setTargetId( d->m_initialTargetId );
+ }
+
+ if ( d->m_placemark->description() != d->m_initialDescription ) {
+ d->m_placemark->setDescription( d->m_initialDescription );
+ }
+
+ if ( d->m_placemark->descriptionIsCDATA() != d->m_initialDescriptionIsCDATA ) {
+ d->m_placemark->setDescriptionCDATA( d->m_initialDescriptionIsCDATA );
+ }
+
+ if ( d->m_placemark->coordinate().latitude( GeoDataCoordinates::Degree ) !=
+ d->m_initialCoords.latitude( GeoDataCoordinates::Degree ) ||
+ d->m_placemark->coordinate().longitude( GeoDataCoordinates::Degree ) !=
+ d->m_initialCoords.longitude( GeoDataCoordinates::Degree ) ) {
+ d->m_placemark->setCoordinate( d->m_initialCoords );
+ }
+
+ if ( *d->m_placemark->style() != d->m_initialStyle ) {
+ d->m_placemark->setStyle( new GeoDataStyle( d->m_initialStyle ) );
+ }
+
+ if( d->m_placemark->isVisible() != d->m_initialIsPlacemarkVisible ) {
+ d->m_placemark->setVisible( d->m_initialIsPlacemarkVisible );
+ }
+
+ if( d->m_placemark->isBalloonVisible() != d->m_initialIsBaloonVisible ) {
+ d->m_placemark->setVisible( d->m_initialIsBaloonVisible );
+ }
+
+ emit textAnnotationUpdated( d->m_placemark );
+}
+
+void EditPlacemarkDialog::toggleDescriptionEditMode(bool isFormattedTextMode)
+{
+ d->m_formattedTextToolBar->setVisible( isFormattedTextMode );
+ d->m_fontSize->setVisible( isFormattedTextMode );
+ d->m_fontFamily->setVisible( isFormattedTextMode );
+ if( isFormattedTextMode ) {
+ d->m_description->setHtml( d->m_description->toPlainText() );
+ } else {
+ QTextCursor cursor = d->m_description->textCursor();
+ QTextCharFormat format;
+ format.setFont( QFont() );
+ format.setFontWeight( QFont::Normal );
+ format.setFontItalic( false );
+ format.setFontUnderline( false );
+ format.clearForeground();
+ cursor.setCharFormat( format );
+ d->m_description->setTextCursor( cursor );
+ d->m_description->setPlainText( d->m_description->toHtml() );
+ }
+}
+
+void EditPlacemarkDialog::setTextCursorBold( bool bold )
+{
+ QTextCursor cursor = d->m_description->textCursor();
+ QTextCharFormat format;
+ format.setFontWeight( bold ? QFont::Bold : QFont::Normal );
+ cursor.mergeCharFormat( format );
+ d->m_description->setTextCursor( cursor );
+}
+
+void EditPlacemarkDialog::setTextCursorItalic( bool italic )
+{
+ QTextCursor cursor = d->m_description->textCursor();
+ QTextCharFormat format;
+ format.setFontItalic( italic );
+ cursor.mergeCharFormat( format );
+ d->m_description->setTextCursor( cursor );
+}
+
+void EditPlacemarkDialog::setTextCursorUnderlined( bool underlined )
+{
+ QTextCursor cursor = d->m_description->textCursor();
+ QTextCharFormat format;
+ format.setFontUnderline( underlined );
+ cursor.mergeCharFormat( format );
+ d->m_description->setTextCursor( cursor );
+}
+
+void EditPlacemarkDialog::setTextCursorColor( const QColor &color )
+{
+ QTextCursor cursor = d->m_description->textCursor();
+ QTextCharFormat format;
+ QBrush brush( color );
+ format.setForeground( brush );
+ cursor.mergeCharFormat( format );
+ d->m_description->setTextCursor( cursor );
+ QPixmap textColorPixmap( d->m_textColorButton->iconSize().width(),
+ d->m_textColorButton->iconSize().height() );
+ textColorPixmap.fill( format.foreground().color() );
+ d->m_textColorButton->setIcon( QIcon( textColorPixmap ) );
+ d->m_textColorDialog->setCurrentColor( format.foreground().color() );
+}
+
+void EditPlacemarkDialog::setTextCursorFont( const QFont &font )
+{
+ QTextCursor cursor = d->m_description->textCursor();
+ QTextCharFormat format;
+ format.setFontFamily( font.family() );
+ cursor.mergeCharFormat( format );
+ d->m_description->setTextCursor( cursor );
+}
+
+void EditPlacemarkDialog::setTextCursorFontSize(const QString &fontSize)
+{
+ bool ok = false;
+ int size = fontSize.toInt( &ok );
+ if( ok ) {
+ QTextCursor cursor = d->m_description->textCursor();
+ QTextCharFormat format;
+ format.setFontPointSize( size );
+ cursor.mergeCharFormat( format );
+ d->m_description->setTextCursor( cursor );
+ }
+}
+
+void EditPlacemarkDialog::addImageToDescription()
+{
+ QString filename = QFileDialog::getOpenFileName( this, tr( "Choose image" ), tr( "All Supported Files (*.png *.jpg *.jpeg)" ) );
+ QImage image( filename );
+ if( !image.isNull() ) {
+ QTextCursor cursor = d->m_description->textCursor();
+ cursor.insertImage( image, filename );
+ }
+}
+
+void EditPlacemarkDialog::addLinkToDescription()
+{
+ QPointer dialog = new AddLinkDialog( this );
+ if( dialog->exec() ) {
+ QTextCharFormat oldFormat = d->m_description->textCursor().charFormat();
+ QTextCharFormat linkFormat = oldFormat;
+ linkFormat.setAnchor( true );
+ linkFormat.setFontUnderline( true );
+ linkFormat.setForeground( QApplication::palette().link() );
+ linkFormat.setAnchorHref( dialog->url() );
+ d->m_description->textCursor().insertText( dialog->name(), linkFormat );
+ QTextCursor cursor = d->m_description->textCursor();
+ cursor.setCharFormat( oldFormat );
+ d->m_description->setTextCursor( cursor );
+ d->m_description->textCursor().insertText( " " );
+ }
+}
+
+void EditPlacemarkDialog::updateDescriptionEditButtons()
+{
+ disconnect( d->m_actionBold, SIGNAL( toggled( bool ) ), this, SLOT( setTextCursorBold( bool ) ) );
+ disconnect( d->m_actionItalics, SIGNAL( toggled( bool ) ), this, SLOT( setTextCursorItalic( bool ) ) );
+ disconnect( d->m_actionUnderlined, SIGNAL( toggled( bool ) ), this, SLOT( setTextCursorUnderlined( bool ) ) );
+ disconnect( d->m_fontFamily, SIGNAL( currentFontChanged( QFont ) ), this, SLOT( setTextCursorFont( QFont ) ) );
+ disconnect( d->m_fontSize, SIGNAL( editTextChanged( QString ) ), this, SLOT( setTextCursorFontSize( QString ) ) );
+
+ QTextCharFormat format = d->m_description->textCursor().charFormat();
+
+ d->m_fontFamily->setCurrentFont( format.font() );
+
+ if( format.fontWeight() == QFont::Bold ) {
+ d->m_actionBold->setChecked( true );
+ } else if ( format.fontWeight() == QFont::Normal ) {
+ d->m_actionBold->setChecked( false );
+ }
+ d->m_actionItalics->setChecked( format.fontItalic() );
+ d->m_actionUnderlined->setChecked( format.fontUnderline() );
+
+ QPixmap textColorPixmap( d->m_textColorButton->iconSize().width(),
+ d->m_textColorButton->iconSize().height() );
+ textColorPixmap.fill( format.foreground().color() );
+ d->m_textColorButton->setIcon( QIcon( textColorPixmap ) );
+ d->m_textColorDialog->setCurrentColor( format.foreground().color() );
+
+ int index = d->m_fontSize->findText( QString::number( d->m_description->textCursor().charFormat().font().pointSize() ) );
+ if( index != -1 ) {
+ d->m_fontSize->setCurrentIndex( index );
+ } else {
+ d->m_fontSize->lineEdit()->setText( QString::number( d->m_description->textCursor().charFormat().font().pointSize() ) );
+ }
+ connect( d->m_actionBold, SIGNAL( toggled( bool ) ), this, SLOT( setTextCursorBold( bool ) ) );
+ connect( d->m_actionItalics, SIGNAL( toggled( bool ) ), this, SLOT( setTextCursorItalic( bool ) ) );
+ connect( d->m_actionUnderlined, SIGNAL( toggled( bool ) ), this, SLOT( setTextCursorUnderlined( bool ) ) );
+ connect( d->m_fontFamily, SIGNAL( currentFontChanged( QFont ) ), this, SLOT( setTextCursorFont( QFont ) ) );
+ connect( d->m_fontSize, SIGNAL( editTextChanged( QString ) ), this, SLOT( setTextCursorFontSize( QString ) ) );
+}
+
+}
+
+#include "EditPlacemarkDialog.moc"
diff -Nru marble-14.12.3/src/lib/marble/EditPlacemarkDialog.h marble-15.04.2/src/lib/marble/EditPlacemarkDialog.h
--- marble-14.12.3/src/lib/marble/EditPlacemarkDialog.h 1970-01-01 00:00:00.000000000 +0000
+++ marble-15.04.2/src/lib/marble/EditPlacemarkDialog.h 2015-05-25 16:24:43.000000000 +0000
@@ -0,0 +1,209 @@
+//
+// This file is part of the Marble Virtual Globe.
+//
+// This program is free software licensed under the GNU LGPL. You can
+// find a copy of this license in LICENSE.txt in the top directory of
+// the source code.
+//
+// Copyright 2014 Calin Cruceru
+//
+
+#ifndef EDITPLACEMARKDIALOG_H
+#define EDITPLACEMARKDIALOG_H
+
+#include "marble_export.h"
+
+#include
+
+
+namespace Marble {
+
+class GeoDataFeature;
+class GeoDataPlacemark;
+
+
+/**
+ * @brief The EditPlacemarkDialog class deals with customizing placemarks.
+ */
+class MARBLE_EXPORT EditPlacemarkDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ EditPlacemarkDialog( GeoDataPlacemark *placemark, QWidget *parent = 0 );
+ ~EditPlacemarkDialog();
+
+ /**
+ * @brief setLabelColor tells the dialog what the label color is
+ */
+ void setLabelColor( const QColor &color );
+
+ /**
+ * @brief idFilter gets filter for id of placemark
+ * @return QStringList of ids which could not be used as id.
+ */
+ QStringList idFilter() const;
+
+ /**
+ * @brief targetIds gets ids which could be target of placemark.
+ * @return QStringList of ids which could be target of placemark.
+ */
+ QStringList targetIds() const;
+
+ /**
+ * @brief isTargetIdFieldVisible tells if targetId field is shown.
+ */
+ bool isTargetIdFieldVisible() const;
+
+ /**
+ * @brief isIdFieldVisible tells if targetId field is shown.
+ */
+ bool isIdFieldVisible() const;
+
+public slots:
+ /**
+ * @brief updateDialogFields is connected to a signal from AnnotatePlugin in order
+ * to update some fields in the dialog as the user interacts directly with the text
+ * annotation item.
+ */
+ void updateDialogFields();
+
+ /**
+ * @brief setIdFilter sets filter for id of placemark.
+ * @param filter QStringList with ids which could not be used as id.
+ */
+ void setIdFilter( const QStringList &filter );
+
+ /**
+ * @brief setTargetIds sets ids which could be target of placemark.
+ * @param targetIds QStringList with ids which could be target of placemark.
+ */
+ void setTargetIds( const QStringList &targetIds );
+
+ /**
+ * @brief setTargetIdFieldVisible tells the dialog wheter targetId field should be shown.
+ */
+ void setTargetIdFieldVisible( bool visible );
+
+ /**
+ * @brief setIdFieldVisible tells the dialog wheter id field should be shown.
+ */
+ void setIdFieldVisible( bool visible );
+
+ /**
+ * @brief Protecting data from input fields changes
+ */
+ void setReadOnly( bool state );
+
+private slots:
+
+ /**
+ * @brief checkFields shows warnings if there are important fields which don't hold
+ * accurate information.
+ */
+ void checkFields();
+
+ /**
+ * @brief updateTextAnnotation is the main slot which synchronizes the information
+ * from the dialog with the way the text annotation item is painted.
+ */
+ void updateTextAnnotation();
+
+ /**
+ * @brief updateLabelDialog The color chooser for label is represented as a push
+ * button with a filled pixmap as its icon. This slot updates the color fill of this
+ * pixmap.
+ */
+ void updateLabelDialog( const QColor &color );
+
+ /**
+ * @brief updateIconDialog The same as above, but for icons.
+ * FIXME: This is not functional ATM - we need some mechanism for customizing existing
+ * icons.
+ */
+ void updateIconDialog( const QColor &color );
+
+ /**
+ * @brief updatePlacemarkAltitude changes an actual elevation value of placemark instance
+ * according to the value/unit of elevation widget spin box representing it
+ */
+ void updatePlacemarkAltitude();
+
+ /**
+ * @brief restoreInitial restores the dialog's previous settings if the dialog closes with
+ * a zero return value.
+ */
+ void restoreInitial( int result );
+
+ /**
+ * @brief toogleDescriptionEditMode toggles edit mode for description field.
+ */
+ void toggleDescriptionEditMode( bool isFormattedTextMode = false );
+
+ /**
+ * @brief setTextCursorBold sets bold style for selected text in description field.
+ * @param bold
+ */
+ void setTextCursorBold( bool bold );
+
+ /**
+ * @brief setTextCursorItalic sets italic style for selected text in description field.
+ * @param italic
+ */
+ void setTextCursorItalic( bool italic );
+
+ /**
+ * @brief setTextCursorUnderlined sets underlined style for selected text in description field.
+ * @param underlined
+ */
+ void setTextCursorUnderlined( bool underlined );
+
+ /**
+ * @brief setTextCursorColor sets color for selected text in description field.
+ * @param color
+ */
+ void setTextCursorColor( const QColor &color );
+
+ /**
+ * @brief setTextCursorFont sets font for selected text in description field.
+ * @param font
+ */
+ void setTextCursorFont( const QFont &font );
+
+ /**
+ * @brief setTextCursorFontSize sets font's size for selected text in description field.
+ * @param font
+ */
+ void setTextCursorFontSize( const QString &fontSize );
+
+ /**
+ * @brief addImageToDescription adds image to description field.
+ */
+ void addImageToDescription();
+
+ /**
+ * @brief addLinkToDescription adds link to description field.
+ */
+ void addLinkToDescription();
+
+ /**
+ * @brief updateDescriptionEditButtons updates stated of buttons for editing description field.
+ */
+ void updateDescriptionEditButtons();
+
+signals:
+ /**
+ * @brief textAnnotationUpdated signals that some property of the PlacemarkTextAnnotation
+ * instance has changed.
+ * @param feature The instance's placemark.
+ */
+ void textAnnotationUpdated( GeoDataFeature *feature );
+
+private:
+ class Private;
+ Private * const d;
+};
+
+}
+
+#endif
diff -Nru marble-14.12.3/src/lib/marble/EditPlacemarkDialog.ui marble-15.04.2/src/lib/marble/EditPlacemarkDialog.ui
--- marble-14.12.3/src/lib/marble/EditPlacemarkDialog.ui 1970-01-01 00:00:00.000000000 +0000
+++ marble-15.04.2/src/lib/marble/EditPlacemarkDialog.ui 2015-05-25 16:24:43.000000000 +0000
@@ -0,0 +1,541 @@
+
+
+ UiEditPlacemarkDialog
+
+
+
+ 0
+ 0
+ 636
+ 372
+
+
+
+ Edit placemark
+
+
+ -
+
+
+ -
+
+
+
+ 10
+
+
+
+ 1
+
+
+
+ Description
+
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 30
+ 0
+
+
+
+ Formatted text
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ true
+
+
-
+
+ 6
+
+
+ -
+
+ 8
+
+
+ -
+
+ 9
+
+
+ -
+
+ 10
+
+
+ -
+
+ 11
+
+
+ -
+
+ 12
+
+
+ -
+
+ 14
+
+
+ -
+
+ 16
+
+
+ -
+
+ 18
+
+
+ -
+
+ 20
+
+
+ -
+
+ 24
+
+
+ -
+
+ 36
+
+
+ -
+
+ 48
+
+
+ -
+
+ 72
+
+
+ -
+
+ 96
+
+
+
+
+ -
+
+
+ toolBar
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Expanding
+
+
+
+ 0
+ 20
+
+
+
+
+
+
+ -
+
+
+ -
+
+
+ Show Balloon Popup
+
+
+
+
+
+
+
+ Style, Color
+
+
+ -
+
+
+ Label
+
+
+
-
+
+
-
+
+
+
+ 9
+
+
+
+ Color:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 24
+ 24
+
+
+
+
+
+
+
+ 12
+ 12
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 13
+ 20
+
+
+
+
+ -
+
+
-
+
+
+ false
+
+
+ Scale:
+
+
+
+ -
+
+
+ false
+
+
+ 1
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 96
+ 17
+
+
+
+
+
+
+
+ -
+
+
+ Icon
+
+
+
-
+
+
-
+
+
+ false
+
+
+
+ 9
+
+
+
+ Color:
+
+
+
+ -
+
+
+ false
+
+
+
+ 0
+ 0
+
+
+
+
+ 24
+ 24
+
+
+
+
+
+
+
+ 12
+ 12
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Fixed
+
+
+
+ 13
+ 20
+
+
+
+
+ -
+
+
-
+
+
+ false
+
+
+ Scale:
+
+
+
+ -
+
+
+ false
+
+
+ 1
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 96
+ 17
+
+
+
+
+
+
+
+ -
+
+
+ Show placemark
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 298
+ 44
+
+
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+ true
+
+
+
+ :/icons/format-text-bold.png:/icons/format-text-bold.png
+
+
+ Bold
+
+
+ Bold
+
+
+
+
+ true
+
+
+
+ :/icons/format-text-italic.png:/icons/format-text-italic.png
+
+
+ Italics
+
+
+ Italics
+
+
+
+
+ true
+
+
+
+ :/icons/format-text-underline.png:/icons/format-text-underline.png
+
+
+ Underlined
+
+
+ Underlined
+
+
+
+
+
+ :/icons/insert-image.png:/icons/insert-image.png
+
+
+ Add image
+
+
+ Add image
+
+
+
+
+
+ :/icons/insert-link.png:/icons/insert-link.png
+
+
+ Add link
+
+
+ Add link
+
+
+
+
+
+ Marble::PlacemarkEditHeader
+ QWidget
+
+
+
+
+
+
+
+
+ buttonBox
+ rejected()
+ UiEditPlacemarkDialog
+ reject()
+
+
+ 249
+ 407
+
+
+ 244
+ 253
+
+
+
+
+
diff -Nru marble-14.12.3/src/lib/marble/ElevationWidget.ui marble-15.04.2/src/lib/marble/ElevationWidget.ui
--- marble-14.12.3/src/lib/marble/ElevationWidget.ui 1970-01-01 00:00:00.000000000 +0000
+++ marble-15.04.2/src/lib/marble/ElevationWidget.ui 2015-05-25 16:24:43.000000000 +0000
@@ -0,0 +1,55 @@
+
+
+ ElevationWidget
+
+
+
+ 0
+ 0
+ 319
+ 114
+
+
+
+ -
+
+
+ Elevation:
+
+
+
+ -
+
+
+ m
+
+
+ 1000000.000000000000000
+
+
+
+ -
+
+
+ above sea level
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 29
+ 20
+
+
+
+
+
+
+
+
+
diff -Nru marble-14.12.3/src/lib/marble/FileViewWidget.cpp marble-15.04.2/src/lib/marble/FileViewWidget.cpp
--- marble-14.12.3/src/lib/marble/FileViewWidget.cpp 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/FileViewWidget.cpp 2015-05-25 16:24:43.000000000 +0000
@@ -14,6 +14,8 @@
// Qt
#include
#include
+#include
+#include
// Marble
#include "GeoDataContainer.h"
@@ -25,6 +27,7 @@
#include "MarbleModel.h"
#include "MarbleWidget.h"
#include "TreeViewDecoratorModel.h"
+#include "EditPlacemarkDialog.h"
using namespace Marble;
// Ui
@@ -46,6 +49,8 @@
void saveFile();
void closeFile();
void enableFileViewActions();
+ void contextMenu(const QPoint &pt);
+ void showPlacemarkDialog();
public:
FileViewWidget *q;
@@ -53,6 +58,9 @@
MarbleWidget *m_widget;
TreeViewDecoratorModel m_treeSortProxy;
FileManager *m_fileManager;
+
+ QMenu *m_contextMenu;
+ QAction *m_viewPropertiesAction;
};
FileViewWidgetPrivate::FileViewWidgetPrivate( FileViewWidget *parent )
@@ -60,6 +68,12 @@
m_widget( 0 ),
m_fileManager( 0 )
{
+ m_contextMenu = new QMenu(q);
+ m_viewPropertiesAction = new QAction(q);
+ m_viewPropertiesAction->setText(QObject::tr("View Properties"));
+ m_contextMenu->addAction(m_viewPropertiesAction);
+ QObject::connect(m_viewPropertiesAction, SIGNAL(triggered()),
+ q, SLOT(showPlacemarkDialog()));
}
FileViewWidget::FileViewWidget( QWidget *parent, Qt::WindowFlags f )
@@ -96,6 +110,8 @@
m_fileViewUi.m_treeView->sortByColumn( 0, Qt::AscendingOrder );
m_fileViewUi.m_treeView->resizeColumnToContents( 0 );
m_fileViewUi.m_treeView->resizeColumnToContents( 1 );
+ m_fileViewUi.m_treeView->setContextMenuPolicy(Qt::CustomContextMenu);
+
QObject::connect( m_fileViewUi.m_treeView,
SIGNAL(expanded(QModelIndex)),
&m_treeSortProxy, SLOT(trackExpandedState(QModelIndex)) );
@@ -107,6 +123,8 @@
q, SLOT(enableFileViewActions()) );
QObject::connect( m_fileViewUi.m_treeView, SIGNAL(activated(QModelIndex)),
q, SLOT(mapCenterOnTreeViewModel(QModelIndex)) );
+ QObject::connect( m_fileViewUi.m_treeView, SIGNAL(customContextMenuRequested(QPoint)),
+ q, SLOT(contextMenu(QPoint)) );
}
void FileViewWidgetPrivate::setFileManager( FileManager *manager )
@@ -156,6 +174,35 @@
m_fileViewUi.m_closeButton->setEnabled( isUserDocument );
}
+void FileViewWidgetPrivate::contextMenu(const QPoint &pt)
+{
+ const QModelIndex index = m_fileViewUi.m_treeView->indexAt(pt);
+ const QAbstractItemModel *model = m_fileViewUi.m_treeView->model();
+ if (index.isValid()) {
+ GeoDataObject *obj = model->data(index, MarblePlacemarkModel::ObjectPointerRole).value();
+ const GeoDataPlacemark *placemark = dynamic_cast(obj);
+
+ if (placemark) {
+ m_contextMenu->popup(m_fileViewUi.m_treeView->mapToGlobal(pt));
+ }
+ }
+}
+
+void FileViewWidgetPrivate::showPlacemarkDialog()
+{
+ const QModelIndex index = m_fileViewUi.m_treeView->currentIndex();
+ const QAbstractItemModel *model = m_fileViewUi.m_treeView->model();
+
+ GeoDataObject *obj = model->data(index, MarblePlacemarkModel::ObjectPointerRole).value();
+ GeoDataPlacemark *placemark = dynamic_cast(obj);
+ if (placemark) {
+ QPointer dialog = new EditPlacemarkDialog(placemark, q);
+ dialog->setReadOnly(true);
+ dialog->exec();
+ delete dialog;
+ }
+}
+
void FileViewWidget::mapCenterOnTreeViewModel( const QModelIndex &index )
{
if( !index.isValid() ) {
diff -Nru marble-14.12.3/src/lib/marble/FileViewWidget.h marble-15.04.2/src/lib/marble/FileViewWidget.h
--- marble-14.12.3/src/lib/marble/FileViewWidget.h 2015-02-23 08:27:55.000000000 +0000
+++ marble-15.04.2/src/lib/marble/FileViewWidget.h 2015-05-25 16:24:43.000000000 +0000
@@ -52,6 +52,8 @@
Q_PRIVATE_SLOT( d, void enableFileViewActions() )
Q_PRIVATE_SLOT( d, void saveFile() )
Q_PRIVATE_SLOT( d, void closeFile() )
+ Q_PRIVATE_SLOT( d, void contextMenu(const QPoint&) )
+ Q_PRIVATE_SLOT( d, void showPlacemarkDialog() )
Q_DISABLE_COPY( FileViewWidget )
FileViewWidgetPrivate * const d;
diff -Nru marble-14.12.3/src/lib/marble/FlyToEditWidget.cpp marble-15.04.2/src/lib/marble/FlyToEditWidget.cpp
--- marble-14.12.3/src/lib/marble/FlyToEditWidget.cpp 1970-01-01 00:00:00.000000000 +0000
+++ marble-15.04.2/src/lib/marble/FlyToEditWidget.cpp 2015-05-25 16:24:43.000000000 +0000
@@ -0,0 +1,123 @@
+//
+// This file is part of the Marble Virtual Globe.
+//
+// This program is free software licensed under the GNU LGPL. You can
+// find a copy of this license in LICENSE.txt in the top directory of
+// the source code.
+//
+// Copyright 2013 Mihail Ivchenko
+// Copyright 2014 Sanjiban Bairagya
+// Copyright 2014 Illya Kovalevskyy
+//
+
+#include
+#include
+#include
+#include
+
+#include "FlyToEditWidget.h"
+#include "MarbleWidget.h"
+#include "geodata/data/GeoDataFlyTo.h"
+#include "GeoDataTypes.h"
+#include "GeoDataCamera.h"
+#include "MarblePlacemarkModel.h"
+
+namespace Marble
+{
+
+FlyToEditWidget::FlyToEditWidget( const QModelIndex &index, MarbleWidget* widget, QWidget *parent ) :
+ QWidget( parent ),
+ m_widget( widget ),
+ m_index( index ),
+ m_button( new QToolButton )
+{
+ QHBoxLayout *layout = new QHBoxLayout;
+ layout->setSpacing( 5 );
+
+ QLabel* iconLabel = new QLabel;
+ iconLabel->setPixmap( QPixmap( ":/marble/flag.png" ) );
+ layout->addWidget( iconLabel );
+
+ QLabel *waitLabel = new QLabel;
+ waitLabel->setText(tr("Wait duration:"));
+ layout->addWidget(waitLabel);
+
+ m_waitSpin = new QDoubleSpinBox;
+ layout->addWidget(m_waitSpin);
+ m_waitSpin->setValue(flyToElement()->duration());
+ m_waitSpin->setSuffix( tr(" s", "seconds") );
+
+ QToolButton* flyToPinCenter = new QToolButton;
+ flyToPinCenter->setIcon(QIcon(":/marble/places.png"));
+ flyToPinCenter->setToolTip(tr("Current map center"));
+ connect(flyToPinCenter, SIGNAL(clicked()), this, SLOT(updateCoordinates()));
+ layout->addWidget(flyToPinCenter);
+
+ m_button->setIcon( QIcon( ":/marble/document-save.png" ) );
+ connect(m_button, SIGNAL(clicked()), this, SLOT(save()));
+ layout->addWidget( m_button );
+
+ setLayout( layout );
+}
+
+bool FlyToEditWidget::editable() const
+{
+ return m_button->isEnabled();
+}
+
+void FlyToEditWidget::setEditable( bool editable )
+{
+ m_button->setEnabled( editable );
+}
+
+void FlyToEditWidget::setFirstFlyTo(const QPersistentModelIndex &index)
+{
+ if( m_index.internalPointer() == index.internalPointer() ) {
+ m_waitSpin->setEnabled( false );
+ } else {
+ if( !m_waitSpin->isEnabled() )
+ {
+ m_waitSpin->setEnabled( true );
+ }
+ }
+}
+
+void FlyToEditWidget::updateCoordinates()
+{
+ m_coord = m_widget->focusPoint();
+ m_coord.setAltitude( m_widget->lookAt().range() );
+}
+
+void FlyToEditWidget::save()
+{
+ if (flyToElement()->view() != 0 && m_coord != GeoDataCoordinates()) {
+ GeoDataCoordinates coords = m_coord;
+ if ( flyToElement()->view()->nodeType() == GeoDataTypes::GeoDataCameraType ) {
+ GeoDataCamera* camera = dynamic_cast( flyToElement()->view() );
+ camera->setCoordinates( coords );
+ } else if ( flyToElement()->view()->nodeType() == GeoDataTypes::GeoDataLookAtType ) {
+ GeoDataLookAt* lookAt = dynamic_cast( flyToElement()->view() );
+ lookAt->setCoordinates( coords );
+ } else{
+ GeoDataLookAt* lookAt = new GeoDataLookAt;
+ lookAt->setCoordinates( coords );
+ flyToElement()->setView( lookAt );
+ }
+ }
+
+ flyToElement()->setDuration(m_waitSpin->value());
+
+ emit editingDone(m_index);
+}
+
+GeoDataFlyTo* FlyToEditWidget::flyToElement()
+{
+ GeoDataObject *object = qvariant_cast(m_index.data( MarblePlacemarkModel::ObjectPointerRole ) );
+ Q_ASSERT( object );
+ Q_ASSERT( object->nodeType() == GeoDataTypes::GeoDataFlyToType );
+ return static_cast( object );
+}
+
+} // namespace Marble
+
+#include "FlyToEditWidget.moc"
diff -Nru marble-14.12.3/src/lib/marble/FlyToEditWidget.h marble-15.04.2/src/lib/marble/FlyToEditWidget.h
--- marble-14.12.3/src/lib/marble/FlyToEditWidget.h 1970-01-01 00:00:00.000000000 +0000
+++ marble-15.04.2/src/lib/marble/FlyToEditWidget.h 2015-05-25 16:24:43.000000000 +0000
@@ -0,0 +1,61 @@
+//
+// This file is part of the Marble Virtual Globe.
+//
+// This program is free software licensed under the GNU LGPL. You can
+// find a copy of this license in LICENSE.txt in the top directory of
+// the source code.
+//
+// Copyright 2013 Mihail Ivchenko |