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 :
23 : #pragma once
24 :
25 : #include <optional>
26 :
27 : #include <QColor>
28 :
29 : #include "modularity/imoduleinterface.h"
30 :
31 : #include "global/types/retval.h"
32 : #include "global/types/val.h"
33 : #include "global/async/notification.h"
34 :
35 : #include "uitypes.h"
36 :
37 : class QByteArray;
38 : class QWindow;
39 :
40 : namespace muse::ui {
41 : class IUiConfiguration : MODULE_GLOBAL_INTERFACE
42 : {
43 550 : INTERFACE_ID(IUiConfiguration)
44 :
45 : public:
46 30 : virtual ~IUiConfiguration() = default;
47 :
48 : virtual ThemeList themes() const = 0;
49 : virtual QStringList possibleAccentColors() const = 0;
50 : virtual QStringList possibleFontFamilies() const = 0;
51 : virtual QStringList nonTextFonts() const = 0;
52 : virtual void setNonTextFonts(const QStringList& fontFamilies) = 0;
53 :
54 : virtual bool isDarkMode() const = 0;
55 : virtual void setIsDarkMode(bool dark) = 0;
56 :
57 : virtual bool isHighContrast() const = 0;
58 : virtual void setIsHighContrast(bool highContrast) = 0;
59 :
60 : virtual const ThemeInfo& currentTheme() const = 0;
61 : virtual async::Notification currentThemeChanged() const = 0;
62 : virtual void setCurrentTheme(const ThemeCode& codeKey) = 0;
63 : virtual void setCurrentThemeStyleValue(ThemeStyleKey key, const Val& val) = 0;
64 : virtual void resetThemes() = 0;
65 :
66 : virtual bool isFollowSystemThemeAvailable() const = 0;
67 : virtual ValNt<bool> isFollowSystemTheme() const = 0;
68 : virtual void setFollowSystemTheme(bool follow) = 0;
69 :
70 : virtual std::string fontFamily() const = 0;
71 : virtual void setFontFamily(const std::string& family) = 0;
72 : virtual int fontSize(FontSizeType type = FontSizeType::BODY) const = 0;
73 : virtual void setBodyFontSize(int size) = 0;
74 : virtual async::Notification fontChanged() const = 0;
75 :
76 : virtual std::string iconsFontFamily() const = 0;
77 : virtual int iconsFontSize(IconSizeType type) const = 0;
78 : virtual async::Notification iconsFontChanged() const = 0;
79 :
80 : virtual io::path_t appIconPath() const = 0;
81 :
82 : virtual std::string musicalFontFamily() const = 0;
83 : virtual int musicalFontSize() const = 0;
84 : virtual async::Notification musicalFontChanged() const = 0;
85 :
86 : virtual std::string musicalTextFontFamily() const = 0;
87 : virtual int musicalTextFontSize() const = 0;
88 : virtual async::Notification musicalTextFontChanged() const = 0;
89 :
90 : virtual std::string defaultFontFamily() const = 0;
91 : virtual int defaultFontSize() const = 0;
92 :
93 : virtual void resetFonts() = 0;
94 :
95 : //! NOTE Maybe set from command line
96 : virtual void setCustomPhysicalDotsPerInch(std::optional<double> dpi) = 0;
97 : virtual std::optional<double> customPhysicalDotsPerInch() const = 0;
98 :
99 : virtual bool isGlobalMenuAvailable() const = 0;
100 : virtual bool isSystemDragSupported() const = 0;
101 :
102 : virtual void applyPlatformStyle(QWindow* window) = 0;
103 :
104 : virtual int flickableMaxVelocity() const = 0;
105 :
106 : virtual int tooltipDelay() const = 0;
107 :
108 : virtual std::vector<QColor> colorDialogCustomColors() const = 0;
109 : virtual void setColorDialogCustomColors(const std::vector<QColor>&) = 0;
110 : };
111 : }
|