[Marble-commits] KDE/kdeedu/marble/src
Bastian Holst
bastianholst at gmx.de
Wed Apr 7 15:03:03 CEST 2010
SVN commit 1112135 by bholst:
* Marble uses now XDG_DATA_HOME
* DataMigration assistant
M +1 -0 QtMainWindow.cpp
M +2 -0 lib/CMakeLists.txt
A lib/DataMigration.cpp [License: LGPL]
A lib/DataMigration.h [License: LGPL]
A lib/DataMigrationWidget.ui
M +42 -2 lib/MarbleDirs.cpp
M +6 -3 lib/MarbleDirs.h
M +5 -0 lib/MarbleWidget.cpp
M +1 -1 marble.knsrc
M +1 -1 marble_part.cpp
--- trunk/KDE/kdeedu/marble/src/QtMainWindow.cpp #1112134:1112135
@@ -61,6 +61,7 @@
MainWindow::MainWindow(const QString& marbleDataPath, QWidget *parent) : QMainWindow(parent), m_sunControlDialog(0)
{
MarbleGlobal::getInstance()->setProfiles( MarbleGlobal::detectProfiles() );
+
setUpdatesEnabled( false );
QString selectedPath = marbleDataPath.isEmpty() ? readMarbleDataPath() : marbleDataPath;
--- trunk/KDE/kdeedu/marble/src/lib/CMakeLists.txt #1112134:1112135
@@ -155,6 +155,7 @@
AbstractLayer/AbstractLayer.cpp
AbstractLayer/AbstractLayerContainer.cpp
AbstractLayer/AbstractLayerData.cpp
+ DataMigration.cpp
AbstractDataPlugin.cpp
AbstractDataPluginModel.cpp
@@ -216,6 +217,7 @@
SunControlWidget.ui
LatLonEdit.ui
routing/RoutingWidget.ui
+ DataMigrationWidget.ui
)
# FIXME: cleaner approach of src/lib/MarbleControlBox.* vs. marble.qrc
--- trunk/KDE/kdeedu/marble/src/lib/MarbleDirs.cpp #1112134:1112135
@@ -11,12 +11,15 @@
#include "MarbleDirs.h"
+#include "MarbleDebug.h"
#include <QtCore/QDir>
#include <QtCore/QFile>
+#include <QtCore/QString>
+#include <QtCore/QStringList>
#include <QtGui/QApplication>
-#include "MarbleDebug.h"
+#include <stdlib.h>
#ifdef Q_OS_MACX
//for getting app bundle path
@@ -214,7 +217,11 @@
QString MarbleDirs::localPath()
{
#ifndef Q_OS_WIN
- return QString( QDir::homePath() + "/.marble/data" ); // local path
+ QString dataHome = getenv( "XDG_DATA_HOME" );
+ if( dataHome.isEmpty() )
+ dataHome = QDir::homePath() + "/.local/share";
+
+ return dataHome + "/marble"; // local path
#else
HWND hwnd = 0;
WCHAR *appdata_path = new WCHAR[MAX_PATH+1];
@@ -226,6 +233,39 @@
#endif
}
+QStringList MarbleDirs::oldLocalPaths()
+{
+ QStringList possibleOldPaths;
+
+#ifndef Q_OS_WIN
+ QString oldDefault = QDir::homePath() + "/.marble/data";
+ possibleOldPaths.append( oldDefault );
+
+ QString xdgDefault = QDir::homePath() + "/.local/share/marble";
+ possibleOldPaths.append( xdgDefault );
+
+ QString xdg = getenv( "XDG_DATA_HOME" );
+ xdg += "/marble/";
+ possibleOldPaths.append( xdg );
+#endif
+ QString currentLocalPath = QDir( MarbleDirs::localPath() ).canonicalPath();
+ QStringList oldPaths;
+ foreach( const QString& possibleOldPath, possibleOldPaths ) {
+ if( !QDir().exists( possibleOldPath ) ) {
+ continue;
+ }
+
+ QString canonicalPossibleOldPath = QDir( possibleOldPath ).canonicalPath();
+ if( canonicalPossibleOldPath == currentLocalPath ) {
+ continue;
+ }
+
+ oldPaths.append( canonicalPossibleOldPath );
+ }
+
+ return oldPaths;
+}
+
QString MarbleDirs::pluginLocalPath()
{
#ifndef Q_OS_WIN
--- trunk/KDE/kdeedu/marble/src/lib/MarbleDirs.h #1112134:1112135
@@ -15,10 +15,11 @@
#include "marble_export.h"
-#include <QtCore/QString>
-#include <QtCore/QStringList>
#include <QtCore/QDir>
+class QString;
+class QStringList;
+
namespace Marble
{
@@ -96,8 +97,10 @@
static QString pluginSystemPath();
- static QString localPath();
+ static QString localPath();
+ static QStringList oldLocalPaths();
+
static QString pluginLocalPath();
--- trunk/KDE/kdeedu/marble/src/lib/MarbleWidget.cpp #1112134:1112135
@@ -29,6 +29,7 @@
#endif
#include "AbstractProjection.h"
+#include "DataMigration.h"
#include "FileViewModel.h"
#include "GeoPainter.h"
#include "MarbleDebug.h"
@@ -164,6 +165,10 @@
void MarbleWidgetPrivate::construct()
{
+ QPointer<DataMigration> dataMigration = new DataMigration( m_widget );
+ dataMigration->exec();
+ delete dataMigration;
+
#ifdef MARBLE_DBUS
QDBusConnection::sessionBus().registerObject("/MarbleWidget", m_widget,
QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllProperties);
--- trunk/KDE/kdeedu/marble/src/marble.knsrc #1112134:1112135
@@ -6,5 +6,5 @@
[KNewStuff3]
ProvidersUrl=http://edu.kde.org/marble/newstuff/providers.xml
Categories=Marble,Maps
-TargetDir=.marble/data/maps
+TargetDir=marble/maps
Uncompress=archive
--- trunk/KDE/kdeedu/marble/src/marble_part.cpp #1112134:1112135
@@ -99,7 +99,7 @@
// only set marble data path when a path was given
if ( arguments.count() != 0 && !arguments.first().isEmpty() )
MarbleDirs::setMarbleDataPath( arguments.first() );
-
+
// Setting measure system to provide nice standards for all unit questions.
// This has to happen before any initialization so plugins (for example) can
// use it during initialization.
More information about the Marble-commits
mailing list