Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-Studio-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 MU_PALETTE_PALETTECONFIGURATION_H
23 : #define MU_PALETTE_PALETTECONFIGURATION_H
24 :
25 : #include "../ipaletteconfiguration.h"
26 : #include "async/asyncable.h"
27 :
28 : #include "modularity/ioc.h"
29 : #include "iglobalconfiguration.h"
30 : #include "ui/iuiconfiguration.h"
31 :
32 : namespace mu::palette {
33 : class PaletteConfiguration : public IPaletteConfiguration, public muse::async::Asyncable, public muse::Contextable
34 : {
35 : muse::GlobalInject<muse::ui::IUiConfiguration> uiConfiguration;
36 : muse::GlobalInject<muse::IGlobalConfiguration> globalConfiguration;
37 :
38 : public:
39 0 : PaletteConfiguration(const muse::modularity::ContextPtr& iocCtx)
40 0 : : muse::Contextable(iocCtx)
41 : {
42 0 : }
43 :
44 : void init();
45 :
46 : double paletteScaling() const override;
47 : void setPaletteScaling(double scale) override;
48 :
49 : double paletteSpatium() const override;
50 :
51 : muse::ValCh<bool> isSinglePalette() const override;
52 : void setIsSinglePalette(bool isSingle) override;
53 :
54 : muse::ValCh<bool> isSingleClickToOpenPalette() const override;
55 : void setIsSingleClickToOpenPalette(bool isSingleClick) override;
56 :
57 : muse::ValCh<bool> isPaletteDragEnabled() const override;
58 : void setIsPaletteDragEnabled(bool enabled) override;
59 :
60 : QColor elementsBackgroundColor() const override;
61 : QColor elementsColor() const override;
62 : QColor gridColor() const override;
63 : QColor accentColor() const override;
64 : muse::async::Notification colorsChanged() const override;
65 :
66 : muse::io::path_t keySignaturesDirPath() const override;
67 : muse::io::path_t timeSignaturesDirPath() const override;
68 :
69 : bool useFactorySettings() const override;
70 : bool enableExperimental() const override;
71 :
72 : muse::ValCh<PaletteConfig> paletteConfig(const QString& paletteId) const override;
73 : void setPaletteConfig(const QString& paletteId, const PaletteConfig& config) override;
74 :
75 : muse::ValCh<PaletteCellConfig> paletteCellConfig(const QString& cellId) const override;
76 : void setPaletteCellConfig(const QString& cellId, const PaletteCellConfig& config) override;
77 :
78 : private:
79 : QColor themeColor(muse::ui::ThemeStyleKey key) const;
80 :
81 : muse::ValCh<bool> m_isSinglePalette;
82 : muse::ValCh<bool> m_isSingleClickToOpenPalette;
83 : muse::ValCh<bool> m_isPaletteDragEnabled;
84 :
85 : mutable QHash<QString, muse::ValCh<PaletteConfig> > m_paletteConfigs;
86 : mutable QHash<QString, muse::ValCh<PaletteCellConfig> > m_paletteCellsConfigs;
87 : };
88 : }
89 :
90 : #endif // MU_PALETTE_PALETTECONFIGURATION_H
|