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) 2025 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 <memory>
26 :
27 : #include "global/async/channel.h"
28 : #include "global/async/notification.h"
29 : #include "global/io/path.h"
30 : #include "global/types/ret.h"
31 :
32 : #include "notation/inotation_fwd.h"
33 :
34 : #include "inotationproject_fwd.h"
35 : #include "types/projecttypes.h"
36 :
37 : namespace mu::project {
38 : struct ProjectCreateOptions;
39 : struct ProjectMeta;
40 :
41 : class INotationProject
42 : {
43 : public:
44 122 : virtual ~INotationProject() = default;
45 :
46 : virtual muse::io::path_t path() const = 0;
47 : virtual void setPath(const muse::io::path_t& path) = 0;
48 : virtual muse::async::Notification pathChanged() const = 0;
49 :
50 : virtual QString displayName() const = 0;
51 : virtual muse::async::Notification displayNameChanged() const = 0;
52 :
53 : virtual muse::Ret load(const muse::io::path_t& path, const OpenParams& params = {}, const std::string& format = "") = 0;
54 : virtual muse::Ret createNew(const ProjectCreateOptions& projectInfo) = 0;
55 :
56 : virtual bool isCloudProject() const = 0;
57 : virtual const CloudProjectInfo& cloudInfo() const = 0;
58 : virtual void setCloudInfo(const CloudProjectInfo& info) = 0;
59 :
60 : virtual const CloudAudioInfo& cloudAudioInfo() const = 0;
61 : virtual void setCloudAudioInfo(const CloudAudioInfo& audioInfo) = 0;
62 :
63 : virtual bool isNewlyCreated() const = 0;
64 : virtual void markAsNewlyCreated() = 0;
65 :
66 : virtual bool isImported() const = 0;
67 :
68 : virtual void markAsUnsaved() = 0;
69 :
70 : virtual bool isNeedSave() const = 0;
71 : virtual muse::async::Notification needSaveChanged() const = 0;
72 : virtual muse::Ret canSave() const = 0;
73 :
74 : virtual bool needAutoSave() const = 0;
75 : virtual void setNeedAutoSave(bool val) = 0;
76 :
77 : virtual muse::Ret save(const muse::io::path_t& path = muse::io::path_t(), SaveMode saveMode = SaveMode::Save,
78 : bool createBackup = true) = 0;
79 : virtual muse::Ret savePage(const muse::io::path_t& path, const size_t pageNum) = 0;
80 : virtual muse::async::Channel<muse::io::path_t, SaveMode> saveComplited() const = 0;
81 :
82 : virtual muse::Ret writeToDevice(QIODevice* device) = 0;
83 :
84 : virtual ProjectMeta metaInfo() const = 0;
85 : virtual void setMetaInfo(const ProjectMeta& meta, bool undoable = false) = 0;
86 :
87 : virtual notation::IMasterNotationPtr masterNotation() const = 0;
88 : virtual IProjectAudioSettingsPtr audioSettings() const = 0;
89 : };
90 :
91 : using INotationProjectPtr = std::shared_ptr<INotationProject>;
92 : }
|