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

KDE's Doxygen guidelines are available online.