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 : #include "videoexportconfiguration.h"
23 :
24 : using namespace mu::iex::videoexport;
25 :
26 : static const ViewMode DEFAULT_VIEW_MODE = ViewMode::PageFull;
27 : static const bool DEFAULT_SHOW_PIANO = false;
28 : static const PianoPosition DEFAULT_PIANO_POSITION = PianoPosition::Bottom;
29 : static const std::string DEFAULT_RESOLUTION = "1080p";
30 : static const int DEFAULT_FPS = 24;
31 : static const double DEFAULT_LEADING_SEC = 3.0;
32 : static const double DEFAULT_TRAILING_SECONDS = 3.0;
33 :
34 : static const std::vector<std::string> AVAILABLE_RESOLUTIONS = { "2160p", "1440p", "1080p" };
35 :
36 0 : ViewMode VideoExportConfiguration::viewMode() const
37 : {
38 0 : return m_viewMode ? m_viewMode.value() : DEFAULT_VIEW_MODE;
39 : }
40 :
41 0 : void VideoExportConfiguration::setViewMode(std::optional<ViewMode> viewMode)
42 : {
43 0 : m_viewMode = viewMode;
44 0 : }
45 :
46 0 : bool VideoExportConfiguration::showPiano() const
47 : {
48 0 : return m_showPiano ? m_showPiano.value() : DEFAULT_SHOW_PIANO;
49 : }
50 :
51 0 : void VideoExportConfiguration::setShowPiano(std::optional<bool> showPiano)
52 : {
53 0 : m_showPiano = showPiano;
54 0 : }
55 :
56 0 : PianoPosition VideoExportConfiguration::pianoPosition() const
57 : {
58 0 : return m_pianoPosition ? m_pianoPosition.value() : DEFAULT_PIANO_POSITION;
59 : }
60 :
61 0 : void VideoExportConfiguration::setPianoPosition(std::optional<PianoPosition> position)
62 : {
63 0 : m_pianoPosition = position;
64 0 : }
65 :
66 0 : std::string VideoExportConfiguration::resolution() const
67 : {
68 0 : return m_resolution ? m_resolution.value() : DEFAULT_RESOLUTION;
69 : }
70 :
71 0 : void VideoExportConfiguration::setResolution(std::optional<std::string> resolution)
72 : {
73 0 : m_resolution = resolution;
74 0 : }
75 :
76 0 : const std::vector<std::string>& VideoExportConfiguration::availableResolutions() const
77 : {
78 0 : return AVAILABLE_RESOLUTIONS;
79 : }
80 :
81 0 : int VideoExportConfiguration::fps() const
82 : {
83 0 : return m_fps ? m_fps.value() : DEFAULT_FPS;
84 : }
85 :
86 0 : void VideoExportConfiguration::setFps(std::optional<int> fps)
87 : {
88 0 : m_fps = fps;
89 0 : }
90 :
91 0 : double VideoExportConfiguration::leadingSec() const
92 : {
93 0 : return m_leadingSec ? m_leadingSec.value() : DEFAULT_LEADING_SEC;
94 : }
95 :
96 0 : void VideoExportConfiguration::setLeadingSec(std::optional<double> leadingSec)
97 : {
98 0 : m_leadingSec = leadingSec;
99 0 : }
100 :
101 0 : double VideoExportConfiguration::trailingSec() const
102 : {
103 0 : return m_trailingSec ? m_trailingSec.value() : DEFAULT_TRAILING_SECONDS;
104 : }
105 :
106 0 : void VideoExportConfiguration::setTrailingSec(std::optional<double> trailingSec)
107 : {
108 0 : m_trailingSec = trailingSec;
109 0 : }
|