Bug 336097

Summary: Pointing a MarbleWidget to a Different Tile Location
Product: [Applications] marble Reporter: hwdchiva <miguel.duenas>
Component: generalAssignee: marble-bugs
Status: REPORTED ---    
Severity: wishlist    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: All   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Proposed Changes Diff

Description hwdchiva 2014-06-11 20:14:36 UTC
Created attachment 87138 [details]
Proposed Changes Diff

Currently, Marble downloads tiles to a default location, such as "/home/.local/share" for Non-windows environments or "C:\..\AppData\Roaming\.marble\data" for Windows. Here is the function where these get set:

QString MarbleDirs::localPath() 
{
#ifndef Q_OS_WIN
    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];
    
	SHGetSpecialFolderPathW( hwnd, appdata_path, CSIDL_APPDATA, 0 );
	QString appdata = QString::fromUtf16( reinterpret_cast<ushort*>( appdata_path ) );
	delete[] appdata_path;
	return QString( QDir::fromNativeSeparators( appdata ) + "/.marble/data" ); // local path
#endif
}

I'm developing an application where it would be useful to set this "localPath" to a location the user desires. The application runs offline, so the user has to download maps into a thumb drive, then upload them to the host computer running this application. Although uploading the tiles to "C:\..\AppData\Roaming\.marble\data" is doable, it would be easier to upload them to something like "C:/MarbleMaps".

I have updated my local version of Marble (KDE/4.12) to allow a MarbleWidget to take a "localPath" as a parameter. I have attached a text file documented the changes I have made. By documented, I mean the "git diff" output.