summaryrefslogtreecommitdiffstats
path: root/audio-creation/musescore/5583.patch
blob: da4d0c52d0412b305f26b8f99456dd2425b8ff18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
From 09d138946aad53962ce23298093747f0ce52304f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
Date: Tue, 31 Dec 2019 17:39:34 +0100
Subject: [PATCH 1/2] Specializes template routines.

Qt 5.14 introduces serialisation/deserialisation for enum classes,
this results in ambiguous templates between qdatastream.h and preferences.h.
we specialize everything to workaround this.
---
 mscore/preferences.h | 41 ++++++++++++++++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/mscore/preferences.h b/mscore/preferences.h
index bef3df8536..8c3ac9b0ed 100644
--- a/mscore/preferences.h
+++ b/mscore/preferences.h
@@ -233,21 +233,52 @@ extern Preferences preferences;
 
 // Stream operators for enum classes
 // enum classes don't play well with QSettings without custom serialization
-template<typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
-inline QDataStream &operator<<(QDataStream &out, const T &val)
+inline QDataStream&
+operator<<(QDataStream &out, const Ms::MuseScoreStyleType &val)
 {
     return out << static_cast<int>(val);
 }
 
-template<typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
-inline QDataStream &operator>>(QDataStream &in, T &val)
+inline QDataStream&
+operator>>(QDataStream &in, Ms::MuseScoreStyleType &val)
 {
     int tmp;
     in >> tmp;
-    val = static_cast<T>(tmp);
+    val = static_cast<Ms::MuseScoreStyleType>(tmp);
     return in;
 }
 
+inline QDataStream&
+operator<<(QDataStream &out, const Ms::SessionStart &val)
+{
+    return out << static_cast<int>(val);
+}
+
+inline QDataStream&
+operator>>(QDataStream &in, Ms::SessionStart &val)
+{
+    int tmp;
+    in >> tmp;
+    val = static_cast<Ms::SessionStart>(tmp);
+    return in;
+}
+
+inline QDataStream&
+operator<<(QDataStream &out, const Ms::MusicxmlExportBreaks &val)
+{
+    return out << static_cast<int>(val);
+}
+
+inline QDataStream&
+operator>>(QDataStream &in, Ms::MusicxmlExportBreaks &val)
+{
+    int tmp;
+    in >> tmp;
+    val = static_cast<Ms::MusicxmlExportBreaks>(tmp);
+    return in;
+}
+
+
 class PreferenceVisitor {
    public:
       virtual void visit(QString key, IntPreference*) = 0;

From 6b759bb5ee7b83fd8a82429e4cdb74279c5d33b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
Date: Tue, 31 Dec 2019 17:42:04 +0100
Subject: [PATCH 2/2] fix warnings: replace QString::null, with QString()

---
 mscore/capella.cpp               |  2 +-
 mscore/importmidi/importmidi.cpp |  2 +-
 mscore/instrdialog.cpp           |  2 +-
 mscore/musescore.cpp             | 12 ++++++------
 mscore/musescore.h               |  2 +-
 mscore/network/loginmanager.cpp  |  2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/mscore/capella.cpp b/mscore/capella.cpp
index 7144414e32..6243c8cca6 100644
--- a/mscore/capella.cpp
+++ b/mscore/capella.cpp
@@ -2708,7 +2708,7 @@ Score::FileError importCapella(MasterScore* score, const QString& name)
                   QMessageBox::warning(0,
                      QWidget::tr("Import Capella"),
                      QWidget::tr("Load failed: %1").arg(cf.error(errNo)),
-                     QString::null, QWidget::tr("Quit"), QString::null, 0, 1);
+                     QString(), QWidget::tr("Quit"), QString(), 0, 1);
                   }
             fp.close();
             // avoid another error message box
diff --git a/mscore/importmidi/importmidi.cpp b/mscore/importmidi/importmidi.cpp
index a5d8894686..8091a83369 100644
--- a/mscore/importmidi/importmidi.cpp
+++ b/mscore/importmidi/importmidi.cpp
@@ -1200,7 +1200,7 @@ Score::FileError importMidi(MasterScore *score, const QString &name)
                         QMessageBox::warning(0,
                            QWidget::tr("Load MIDI"),
                            QWidget::tr("Load failed: %1").arg(errorText),
-                           QString::null, QWidget::tr("Quit"), QString::null, 0, 1);
+                           QString(), QWidget::tr("Quit"), QString(), 0, 1);
                         }
                   fp.close();
                   qDebug("importMidi: bad file format");
diff --git a/mscore/instrdialog.cpp b/mscore/instrdialog.cpp
index fa7bacd622..8d81fe9e20 100644
--- a/mscore/instrdialog.cpp
+++ b/mscore/instrdialog.cpp
@@ -138,7 +138,7 @@ void InstrumentsDialog::on_loadButton_clicked()
             QMessageBox::warning(0,
                QWidget::tr("Load Style Failed"),
                QString(strerror(errno)),
-               QString::null, QWidget::tr("Quit"), QString::null, 0, 1);
+               QString(), QWidget::tr("Quit"), QString(), 0, 1);
             return;
             }
       instrumentsWidget->buildTemplateList();
diff --git a/mscore/musescore.cpp b/mscore/musescore.cpp
index dd4a4b95ca..07cb596abe 100644
--- a/mscore/musescore.cpp
+++ b/mscore/musescore.cpp
@@ -4013,7 +4013,7 @@ bool MuseScore::readLanguages(const QString& path)
                 QMessageBox::warning(0,
                    QWidget::tr("Load Languages Failed:"),
                    error,
-                   QString::null, QWidget::tr("Quit"), QString::null, 0, 1);
+                   QString(), QWidget::tr("Quit"), QString(), 0, 1);
                 return false;
                 }
 
@@ -6753,7 +6753,7 @@ bool MuseScore::saveMp3(Score* score, const QString& name)
                   QMessageBox::warning(0,
                                        tr("Encoding Error"),
                                        tr("Unable to open target file for writing"),
-                                       QString::null, QString::null);
+                                       QString(), QString());
                   }
             return false;
             }
@@ -6792,7 +6792,7 @@ bool MuseScore::saveMp3(Score* score, QIODevice* device, bool& wasCanceled)
                   QMessageBox::warning(0,
                                tr("Error Opening LAME library"),
                                tr("Could not open MP3 encoding library!"),
-                               QString::null, QString::null);
+                               QString(), QString());
             qDebug("Could not open MP3 encoding library!");
             return false;
             }
@@ -6804,7 +6804,7 @@ bool MuseScore::saveMp3(Score* score, QIODevice* device, bool& wasCanceled)
                   QMessageBox::warning(0,
                                tr("Error Opening LAME library"),
                                tr("Not a valid or supported MP3 encoding library!"),
-                               QString::null, QString::null);
+                               QString(), QString());
             qDebug("Not a valid or supported MP3 encoding library!");
             return false;
             }
@@ -6829,7 +6829,7 @@ bool MuseScore::saveMp3(Score* score, QIODevice* device, bool& wasCanceled)
             if (!MScore::noGui) {
                   QMessageBox::warning(0, tr("Encoding Error"),
                      tr("Unable to initialize MP3 stream"),
-                     QString::null, QString::null);
+                     QString(), QString());
                   }
             qDebug("Unable to initialize MP3 stream");
             MScore::sampleRate = oldSampleRate;
@@ -6996,7 +6996,7 @@ bool MuseScore::saveMp3(Score* score, QIODevice* device, bool& wasCanceled)
                                     QMessageBox::warning(0,
                                        tr("Encoding Error"),
                                        tr("Error %1 returned from MP3 encoder").arg(bytes),
-                                       QString::null, QString::null);
+                                       QString(), QString());
                               break;
                               }
                         else
diff --git a/mscore/musescore.h b/mscore/musescore.h
index 434072a12f..d8089a345c 100644
--- a/mscore/musescore.h
+++ b/mscore/musescore.h
@@ -142,7 +142,7 @@ struct LanguageItem {
       LanguageItem(const QString k, const QString n) {
             key = k;
             name = n;
-            handbook = QString::null;
+            handbook = QString();
             }
       LanguageItem(const QString k, const QString n, const QString h) {
             key = k;
diff --git a/mscore/network/loginmanager.cpp b/mscore/network/loginmanager.cpp
index 7bcfd892e0..4abf7e3e4e 100644
--- a/mscore/network/loginmanager.cpp
+++ b/mscore/network/loginmanager.cpp
@@ -680,7 +680,7 @@ void LoginManager::mediaUploadFinished()
             QMessageBox::warning(0,
                      tr("Upload Error"),
                      tr("Sorry, MuseScore couldn't upload the audio file. Error %1").arg(e),
-                     QString::null, QString::null);
+                     QString(), QString());
             }
       }