Marble

MarbleDirs.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2006-2007 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
5//
6
7#ifndef MARBLE_MARBLEDIRS_H
8#define MARBLE_MARBLEDIRS_H
9
10#include "marble_export.h"
11
12#include <QDir>
13
14class QString;
15class QStringList;
16
17namespace Marble
18{
19
20/**
21 * @short A class that manages data look-up for Marble.
22 *
23 * The class basically does for Marble what KStandardDirs did for KDE4.
24 * Given that the MarbleWidget is a Qt5-only library and given that it
25 * comes with its own model and data we need this class.
26 *
27 * The class needs to respect the requirements of the different plattforms,
28 * so to avoid very different implementations for each plattform we
29 * specify how data should get looked up:
30 *
31 * Generally there are two places of which Marble will draw it's data from:
32 *
33 * "localPath" and "systemPath".
34 *
35 * look-up of the data should happen in the localPath first.
36 * Only if the look-up in the localPath failed then MarbleDirs should
37 * look up the data in the systemPath.
38 *
39 * localPath:
40 * The place for localPath should match space that is fully accessible to
41 * the user. On Unix-like plattforms this matches
42 * QDir::homePath() + "/.marble/data"
43 *
44 * systemPath:
45 * Ideally the systemPath should match the place where cmake installed the
46 * data for marble. However this doesn't work for all plattforms:
47 *
48 * - For Linux and Mac non-bundle deployment the location can be
49 * chosen using the cmake MARBLE_DATA_PATH option at compile time.
50 * - For Mac bundle deployment the location inside the bundle gets
51 * chosen as the default location.
52 * - For Windows a path relative to the application binary can be chosen
53 * as this should usually work without problems.
54 *
55 * To allow kiosk-like setups and for custom setups in general
56 * it should be possible to change the place of the systemPath at runtime.
57 * Therefore we introduce a global variable "MarbleDataPath" in the
58 * MarbleDirs.h source code.
59 * Initially MarbleDataPath is empty. The systemPath will point to
60 * MarbleDataPath as soon as it gets changed to a valid non-empty path. So
61 * as soon as MarbleDataPath contains a valid path the path specified by
62 * cmake will get ignored.
63 *
64 * ( Possible future extension: if the MarbleDataPath contains several
65 * valid paths separated by a colon then each of these paths should be
66 * used for look up in the same order as for the KDE kiosk framework. )
67 *
68 * It's the duty of each application that uses the MarbleWidget to retrieve
69 * the value of the MarbleDataPath from the MarbleWidget and to save it
70 * in its settings and restore it on start-up of the application.
71 *
72 */
73
74class MARBLE_EXPORT MarbleDirs
75{
76 public:
77 MarbleDirs();
78
79 static QString path( const QString& relativePath );
80
81 static QString pluginPath( const QString& relativePath );
82
83
84 static QStringList entryList( const QString& relativePath, QDir::Filters filters = QDir::NoFilter );
85
86 static QStringList pluginEntryList( const QString& relativePath, QDir::Filters filters = QDir::NoFilter );
87
88
89 static QString systemPath();
90
91 static QString pluginSystemPath();
92
93
94 static QString localPath();
95
96 static QStringList oldLocalPaths();
97
98 static QString pluginLocalPath();
99
100
101 static QString marbleDataPath();
102
103 static QString marblePluginPath();
104
105
106 static void setMarbleDataPath( const QString& adaptedPath);
107
108 static void setMarblePluginPath( const QString& adaptedPath);
109
110
111 static void debug();
112
113 private:
114 Q_DISABLE_COPY( MarbleDirs )
115 class Private;
116 Private * const d;
117};
118
119}
120
121#endif
A class that manages data look-up for Marble.
Definition MarbleDirs.h:75
Binds a QML item to a specific geodetic location in screen coordinates.
typedef Filters
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.