Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2021 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 : #ifndef MUSE_GLOBAL_IGLOBALCONFIGURATION_H
23 : #define MUSE_GLOBAL_IGLOBALCONFIGURATION_H
24 :
25 : #include "modularity/imoduleinterface.h"
26 : #include "io/path.h"
27 :
28 : namespace muse {
29 : class IGlobalConfiguration : MODULE_GLOBAL_INTERFACE
30 : {
31 58 : INTERFACE_ID(IGlobalConfiguration)
32 : public:
33 :
34 89 : virtual ~IGlobalConfiguration() = default;
35 :
36 : //! NOTE Each platform has its own paths and rules
37 : //! More details about paths: https://github.com/musescore/MuseScore/wiki/Resources
38 :
39 : //! //! NOTE The path to the executable file
40 : virtual io::path_t appBinPath() const = 0;
41 :
42 : //! NOTE The path to the dir with the executable file (probably readonly, probably private for a user)
43 : //! Like: programs/MuseScore/bin
44 : virtual io::path_t appBinDirPath() const = 0;
45 :
46 : //! NOTE The path to the dir with the app data files (probably readonly, probably private for a user)
47 : //! Like: programs/MuseScore/share
48 : virtual io::path_t appDataPath() const = 0;
49 :
50 : //! True if `path` is an absolute path located within the application install
51 : //! tree, i.e. a file shipped with the app
52 : virtual bool isBundledWithApp(const io::path_t& path) const = 0;
53 :
54 : //! Rewrites an absolute path with ${INSTALL_ROOT} token prefix, so it can be used without
55 : // referencing the installation directory, e.g. in configuration files
56 : virtual io::path_t toBundledPath(const io::path_t& path) const = 0;
57 :
58 : //! True if `path` starts with ${INSTALL_ROOT} token
59 : virtual bool isBundledPath(const io::path_t& path) const = 0;
60 :
61 : //! Resolves a bundled path back to an absolute path against the current
62 : //! install root
63 : virtual io::path_t fromBundledPath(const io::path_t& path) const = 0;
64 :
65 : //! NOTE The path to the dir with the app configure files (must be writable, probably private for a user)
66 : //! Like: user/config/MuseScore
67 : virtual io::path_t appConfigPath() const = 0;
68 :
69 : //! NOTE The path to the dir with the app user data files (must be writable, probably private for a user)
70 : //! Like: user/appdata/MuseScore
71 : virtual io::path_t userAppDataPath() const = 0;
72 :
73 : //! NOTE The path to the dir with the user backup files (must be writable, probably private for a user)
74 : //! Like: user/appdata/MuseScore/backups
75 : virtual io::path_t userBackupPath() const = 0;
76 :
77 : //! NOTE The path to the dir with the user data files (must be writable, probably public for a user)
78 : //! Like: user/documents/MuseScore
79 : virtual io::path_t userDataPath() const = 0;
80 :
81 : //! NOTE System paths
82 : virtual io::path_t homePath() const = 0;
83 : virtual io::path_t downloadsPath() const = 0;
84 : virtual io::path_t documentsPath() const = 0;
85 : virtual io::path_t genericDataPath() const = 0;
86 :
87 : virtual bool useFactorySettings() const = 0;
88 : virtual bool enableExperimental() const = 0;
89 :
90 : virtual bool devModeEnabled() const = 0;
91 : virtual void setDevModeEnabled(bool enabled) = 0;
92 :
93 : virtual bool metricUnit() const = 0;
94 : virtual void setMetricUnit(bool metricUnit) = 0;
95 :
96 : virtual std::string museHubWebUrl() const = 0;
97 :
98 : virtual bool highResolutionTimers() const = 0;
99 : };
100 : }
101 :
102 : #endif // MUSE_GLOBAL_IGLOBALCONFIGURATION_H
|