LCOV - code coverage report
Current view: top level - src/notation/internal - notationconfiguration.h Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 1 0
Test Date: 2026-11-19 04:14:36

            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              : #pragma once
      23              : 
      24              : #include "async/asyncable.h"
      25              : 
      26              : #include "modularity/ioc.h"
      27              : #include "global/iglobalconfiguration.h"
      28              : #include "io/ifilesystem.h"
      29              : #include "ui/iuiconfiguration.h"
      30              : #include "engraving/iengravingconfiguration.h"
      31              : 
      32              : #include "../inotationconfiguration.h"
      33              : 
      34              : namespace mu::notation {
      35              : class NotationConfiguration : public INotationConfiguration, public muse::async::Asyncable
      36              : {
      37              :     muse::GlobalInject<muse::IGlobalConfiguration> globalConfiguration;
      38              :     muse::GlobalInject<muse::io::IFileSystem> fileSystem;
      39              :     muse::GlobalInject<muse::ui::IUiConfiguration> uiConfiguration;
      40              :     muse::GlobalInject<engraving::IEngravingConfiguration> engravingConfiguration;
      41              : 
      42              : public:
      43            0 :     NotationConfiguration() = default;
      44              : 
      45              :     void init();
      46              : 
      47              :     QColor notationColor() const override;
      48              :     void setNotationColor(const QColor& color) override;
      49              :     muse::async::Notification notationColorChanged() const override;
      50              :     void resetNotationColor() override;
      51              : 
      52              :     QColor backgroundColor() const override;
      53              :     void setBackgroundColor(const QColor& color) override;
      54              : 
      55              :     muse::io::path_t backgroundWallpaperPath() const override;
      56              :     const QPixmap& backgroundWallpaper() const override;
      57              :     void setBackgroundWallpaperPath(const muse::io::path_t& path) override;
      58              : 
      59              :     bool backgroundUseColor() const override;
      60              :     void setBackgroundUseColor(bool value) override;
      61              : 
      62              :     void resetBackground() override;
      63              : 
      64              :     muse::async::Notification backgroundChanged() const override;
      65              : 
      66              :     QColor foregroundColor() const override;
      67              :     void setForegroundColor(const QColor& color) override;
      68              : 
      69              :     muse::io::path_t foregroundWallpaperPath() const override;
      70              :     const QPixmap& foregroundWallpaper() const override;
      71              :     void setForegroundWallpaperPath(const muse::io::path_t& path) override;
      72              : 
      73              :     bool foregroundUseColor() const override;
      74              :     void setForegroundUseColor(bool value) override;
      75              : 
      76              :     void resetForeground() override;
      77              : 
      78              :     muse::async::Notification foregroundChanged() const override;
      79              : 
      80              :     muse::io::path_t wallpapersDefaultDirPath() const override;
      81              : 
      82              :     bool shouldInvertScore() const override;  // Whether score should be inverted now, based on theme.
      83              : 
      84              :     bool scoreInversionEnabled() const override;
      85              :     void setScoreInversionEnabled(bool value) override;
      86              :     muse::async::Notification scoreInversionChanged() const override;
      87              : 
      88              :     bool isOnlyInvertInDarkTheme() const override;
      89              :     void setOnlyInvertInDarkTheme(bool value) override;
      90              :     muse::async::Notification isOnlyInvertInDarkThemeChanged() const override;
      91              : 
      92              :     QColor borderColor() const override;
      93              :     int borderWidth() const override;
      94              : 
      95              :     QColor playbackCursorColor() const override;
      96              :     QColor loopMarkerColor() const override;
      97              :     int cursorOpacity() const override;
      98              : 
      99              :     bool thinNoteInputCursor() const override;
     100              : 
     101              :     bool enableJianpu() const override;
     102              : 
     103              :     QColor selectionColor(engraving::voice_idx_t voiceIndex = 0) const override;
     104              :     QColor highlightSelectionColor(engraving::voice_idx_t voiceIndex = 0) const override;
     105              : 
     106              :     QColor dropRectColor() const override;
     107              : 
     108              :     muse::draw::Color noteInputPreviewColor() const override;
     109              : 
     110              :     bool useNoteInputCursorInInputByDuration() const override;
     111              :     void setUseNoteInputCursorInInputByDuration(bool use) override;
     112              :     muse::async::Notification useNoteInputCursorInInputByDurationChanged() const override;
     113              : 
     114              :     int selectionProximity() const override;
     115              :     void setSelectionProximity(int proximity) override;
     116              :     muse::async::Channel<int> selectionProximityChanged() const override;
     117              : 
     118              :     ZoomType defaultZoomType() const override;
     119              :     void setDefaultZoomType(ZoomType zoomType) override;
     120              : 
     121              :     int defaultZoom() const override;
     122              :     void setDefaultZoom(int zoomPercentage) override;
     123              :     muse::async::Notification defaultZoomChanged() const override;
     124              : 
     125              :     QList<int> possibleZoomPercentageList() const override;
     126              : 
     127              :     AutomationLane currentAutomationLane() const override;
     128              :     void setCurrentAutomationLane(AutomationLane lane) override;
     129              :     muse::async::Notification currentAutomationLaneChanged() const override;
     130              : 
     131              :     int mouseZoomPrecision() const override;
     132              :     void setMouseZoomPrecision(int precision) override;
     133              :     muse::async::Notification mouseZoomPrecisionChanged() const override;
     134              : 
     135              :     std::string fontFamily() const override;
     136              :     int fontSize() const override;
     137              : 
     138              :     muse::io::path_t userStylesPath() const override;
     139              :     void setUserStylesPath(const muse::io::path_t& path) override;
     140              :     muse::async::Channel<muse::io::path_t> userStylesPathChanged() const override;
     141              : 
     142              :     muse::io::path_t defaultStyleFilePath() const override;
     143              :     void setDefaultStyleFilePath(const muse::io::path_t& path) override;
     144              :     muse::async::Channel<muse::io::path_t> defaultStyleFilePathChanged() const override;
     145              : 
     146              :     muse::io::path_t partStyleFilePath() const override;
     147              :     void setPartStyleFilePath(const muse::io::path_t& path) override;
     148              :     muse::async::Channel<muse::io::path_t> partStyleFilePathChanged() const override;
     149              : 
     150              :     NoteInputMethod defaultNoteInputMethod() const override;
     151              :     void setDefaultNoteInputMethod(NoteInputMethod method) override;
     152              :     muse::async::Notification defaultNoteInputMethodChanged() const override;
     153              : 
     154              :     bool addAccidentalDotsArticulationsToNextNoteEntered() const override;
     155              :     void setAddAccidentalDotsArticulationsToNextNoteEntered(bool value) override;
     156              :     muse::async::Notification addAccidentalDotsArticulationsToNextNoteEnteredChanged() const override;
     157              : 
     158              :     engraving::TupletSelectedDuration tupletCommandsSelectedDurationAs() const override;
     159              :     void setTupletCommandsSelectedDurationAs(engraving::TupletSelectedDuration selectedDurationAs) override;
     160              :     muse::async::Notification tupletCommandsSelectedDurationAsChanged() const override;
     161              : 
     162              :     muse::io::path_t userMusicFontsPath() const override;
     163              :     void setUserMusicFontsPath(const muse::io::path_t& path) override;
     164              :     muse::async::Channel<muse::io::path_t> userMusicFontsPathChanged() const override;
     165              : 
     166              :     bool isMidiInputEnabled() const override;
     167              :     void setIsMidiInputEnabled(bool enabled) override;
     168              :     muse::async::Notification isMidiInputEnabledChanged() const override;
     169              : 
     170              :     bool startNoteInputAtSelectedNoteRestWhenPressingMidiKey() const override;
     171              :     void setStartNoteInputAtSelectedNoteRestWhenPressingMidiKey(bool value) override;
     172              :     muse::async::Notification startNoteInputAtSelectedNoteRestWhenPressingMidiKeyChanged() const override;
     173              : 
     174              :     bool isAutomaticallyPanEnabled() const override;
     175              :     void setIsAutomaticallyPanEnabled(bool enabled) override;
     176              :     muse::async::Notification isAutomaticallyPanEnabledChanged() const override;
     177              : 
     178              :     bool isPlayRepeatsEnabled() const override;
     179              :     void setIsPlayRepeatsEnabled(bool enabled) override;
     180              :     muse::async::Notification isPlayRepeatsChanged() const override;
     181              : 
     182              :     bool isPlayChordSymbolsEnabled() const override;
     183              :     void setIsPlayChordSymbolsEnabled(bool enabled) override;
     184              :     muse::async::Notification isPlayChordSymbolsChanged() const override;
     185              : 
     186              :     bool isPlayPreviewNotesInInputByDuration() const override;
     187              :     void setIsPlayPreviewNotesInInputByDuration(bool play) override;
     188              :     muse::async::Notification isPlayPreviewNotesInInputByDurationChanged() const override;
     189              : 
     190              :     bool playPreviewNotesWithScoreDynamics() const override;
     191              :     void setPlayPreviewNotesWithScoreDynamics(bool use) override;
     192              :     muse::async::Notification playPreviewNotesWithScoreDynamicsChanged() const override;
     193              : 
     194              :     bool isMetronomeEnabled() const override;
     195              :     void setIsMetronomeEnabled(bool enabled) override;
     196              :     muse::async::Notification isMetronomeEnabledChanged() const override;
     197              : 
     198              :     bool isCountInEnabled() const override;
     199              :     void setIsCountInEnabled(bool enabled) override;
     200              :     muse::async::Notification isCountInEnabledChanged() const override;
     201              : 
     202              :     muse::ValCh<muse::Orientation> canvasOrientation() const override;
     203              :     void setCanvasOrientation(muse::Orientation orientation) override;
     204              : 
     205              :     bool colorNotesOutsideOfUsablePitchRange() const override;
     206              :     void setColorNotesOutsideOfUsablePitchRange(bool value) override;
     207              :     muse::async::Channel<bool> colorNotesOutsideOfUsablePitchRangeChanged() const override;
     208              : 
     209              :     bool warnGuitarBends() const override;
     210              :     void setWarnGuitarBends(bool value) override;
     211              :     muse::async::Channel<bool> warnGuitarBendsChanged() const override;
     212              : 
     213              :     int delayBetweenNotesInRealTimeModeMilliseconds() const override;
     214              :     void setDelayBetweenNotesInRealTimeModeMilliseconds(int delayMs) override;
     215              :     muse::async::Channel<int> delayBetweenNotesInRealTimeModeMillisecondsChanged() const override;
     216              : 
     217              :     bool useMidiVelocityAndDurationDuringNoteInput() const override;
     218              :     void setUseMidiVelocityAndDurationDuringNoteInput(bool use) override;
     219              :     muse::async::Channel<bool> useMidiVelocityAndDurationDuringNoteInputChanged() const override;
     220              : 
     221              :     int notePlayDurationMilliseconds() const override;
     222              :     void setNotePlayDurationMilliseconds(int durationMs) override;
     223              :     muse::async::Channel<int> notePlayDurationMillisecondsChanged() const override;
     224              : 
     225              :     void setTemplateModeEnabled(std::optional<bool> enabled) override;
     226              :     void setTestModeEnabled(std::optional<bool> enabled) override;
     227              : 
     228              :     muse::io::path_t instrumentsXmlPath() const override;
     229              :     muse::io::path_t scoreOrdersXmlPath() const override;
     230              : 
     231              :     muse::io::path_t userInstrumentsFolder() const override;
     232              :     muse::io::paths_t userInstrumentsAndScoreOrdersPaths() const override;
     233              :     void setUserInstrumentsFolder(const muse::io::path_t& path) override;
     234              :     muse::async::Channel<muse::io::path_t> userInstrumentsFolderChanged() const override;
     235              : 
     236              :     muse::io::path_t stringTuningsPresetsPath() const override;
     237              : 
     238              :     bool isSnappedToGrid(muse::Orientation gridOrientation) const override;
     239              :     void setIsSnappedToGrid(muse::Orientation gridOrientation, bool isSnapped) override;
     240              : 
     241              :     int gridSizeSpatium(muse::Orientation gridOrientation) const override;
     242              :     void setGridSize(muse::Orientation gridOrientation, int sizeSpatium) override;
     243              : 
     244              :     bool needToShowMScoreError(const std::string& errorKey) const override;
     245              :     void setNeedToShowMScoreError(const std::string& errorKey, bool show) override;
     246              : 
     247              :     muse::ValCh<bool> midiUseWrittenPitch() const override;
     248              :     void setMidiUseWrittenPitch(bool useWrittenPitch) override;
     249              : 
     250              :     muse::io::path_t styleFileImportPath() const override;
     251              :     void setStyleFileImportPath(const muse::io::path_t& path) override;
     252              :     muse::async::Channel<std::string> styleFileImportPathChanged() const override;
     253              : 
     254              : private:
     255              :     muse::async::Notification m_notationColorChanged;
     256              :     muse::async::Notification m_backgroundChanged;
     257              :     muse::async::Notification m_foregroundChanged;
     258              :     muse::async::Notification m_scoreInversionChanged;
     259              :     muse::async::Notification m_isOnlyInvertInDarkThemeChanged;
     260              : 
     261              :     muse::async::Notification m_defaultNoteInputMethodChanged;
     262              :     muse::async::Notification m_addAccidentalDotsArticulationsToNextNoteEnteredChanged;
     263              :     muse::async::Notification m_tupletCommandsSelectedDurationAsChanged;
     264              :     muse::async::Notification m_useNoteInputCursorInInputByDurationChanged;
     265              :     muse::async::Notification m_isMidiInputEnabledChanged;
     266              :     muse::async::Notification m_startNoteInputAtSelectedNoteRestWhenPressingMidiKeyChanged;
     267              : 
     268              :     muse::async::Notification m_defaultZoomChanged;
     269              :     muse::async::Notification m_mouseZoomPrecisionChanged;
     270              :     muse::async::Notification m_currentAutomationLaneChanged;
     271              :     muse::async::Channel<muse::Orientation> m_canvasOrientationChanged;
     272              :     muse::async::Channel<muse::io::path_t> m_userStylesPathChanged;
     273              :     muse::async::Channel<muse::io::path_t> m_userMusicFontsPathChanged;
     274              :     muse::async::Channel<muse::io::path_t> m_userInstrumentsFolderChanged;
     275              :     muse::async::Channel<int> m_selectionProximityChanged;
     276              :     muse::async::Channel<bool> m_colorNotesOutsideOfUsablePitchRangeChanged;
     277              :     muse::async::Channel<bool> m_warnGuitarBendsChanged;
     278              :     muse::async::Channel<int> m_delayBetweenNotesInRealTimeModeMillisecondsChanged;
     279              :     muse::async::Channel<int> m_notePlayDurationMillisecondsChanged;
     280              :     muse::async::Channel<bool> m_useMidiVelocityAndDurationDuringNoteInputChanged;
     281              :     muse::async::Channel<std::string> m_styleFileImportPathChanged;
     282              :     muse::async::Notification m_isPlayRepeatsChanged;
     283              :     muse::async::Notification m_isPlayChordSymbolsChanged;
     284              :     muse::async::Notification m_isPlayNotesPreviewInInputByDurationChanged;
     285              :     muse::async::Notification m_playPreviewNotesWithScoreDynamicsChanged;
     286              :     muse::async::Notification m_isMetronomeEnabledChanged;
     287              :     muse::ValCh<bool> m_midiInputUseWrittenPitch;
     288              :     muse::async::Channel<QColor> m_anchorColorChanged;
     289              : 
     290              :     muse::async::Notification m_isAutomaticallyPanEnabledChanged;
     291              :     muse::async::Notification m_isCountInEnabledChanged;
     292              : };
     293              : }
        

Generated by: LCOV version 2.0-1