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_GLOBALCONFIGURATION_H
23 : #define MUSE_GLOBAL_GLOBALCONFIGURATION_H
24 :
25 : #include "../iglobalconfiguration.h"
26 :
27 : #include "modularity/ioc.h"
28 : #include "../iapplication.h"
29 :
30 : namespace muse {
31 : class GlobalConfiguration : public IGlobalConfiguration
32 : {
33 : GlobalInject<IApplication> application;
34 :
35 : public:
36 48 : GlobalConfiguration() {}
37 :
38 : void init();
39 :
40 : //! NOTE Use the given directory for all user data instead of the default locations
41 : void setUserDataDir(const io::path_t& dir);
42 :
43 : io::path_t appBinPath() const override;
44 : io::path_t appBinDirPath() const override;
45 : io::path_t appDataPath() const override;
46 : io::path_t appConfigPath() const override;
47 :
48 : bool isBundledWithApp(const io::path_t& path) const override;
49 : io::path_t toBundledPath(const io::path_t& path) const override;
50 : bool isBundledPath(const io::path_t& path) const override;
51 : io::path_t fromBundledPath(const io::path_t& path) const override;
52 :
53 : io::path_t userAppDataPath() const override;
54 : io::path_t userBackupPath() const override;
55 : io::path_t userDataPath() const override;
56 :
57 : io::path_t homePath() const override;
58 : io::path_t downloadsPath() const override;
59 : io::path_t documentsPath() const override;
60 :
61 : bool useFactorySettings() const override;
62 : bool enableExperimental() const override;
63 : io::path_t genericDataPath() const override;
64 :
65 : bool devModeEnabled() const override;
66 : void setDevModeEnabled(bool enabled) override;
67 :
68 : bool metricUnit() const override;
69 : void setMetricUnit(bool metricUnit) override;
70 :
71 : std::string museHubWebUrl() const override;
72 :
73 : bool highResolutionTimers() const override;
74 :
75 : private:
76 : QString resolveAppDataPath() const;
77 : QString resolveUserAppDataPath() const;
78 :
79 : mutable io::path_t m_appDataPath;
80 : mutable io::path_t m_userAppDataPath;
81 : mutable io::path_t m_userDataPath;
82 : io::path_t m_userDataDir;
83 : };
84 : }
85 :
86 : #endif // MUSE_GLOBAL_GLOBALCONFIGURATION_H
|