773981779751908ef730a29b54557fe19b9e2d39
[alioth/musescore.git] / debian / patches / backports / qt514-1.diff
1 Origin: upstream, commit:09d138946aad53962ce23298093747f0ce52304f
2 Author: Jérôme Duval <jerome.duval@gmail.com>
3 Description: Specializes template routines.
4  Qt 5.14 introduces serialisation/deserialisation for enum classes,
5  this results in ambiguous templates between qdatastream.h and preferences.h.
6  we specialize everything to workaround this.
7
8 --- a/mscore/capella.cpp
9 +++ b/mscore/capella.cpp
10 @@ -2708,7 +2708,7 @@ Score::FileError importCapella(MasterSco
11                    QMessageBox::warning(0,
12                       QWidget::tr("Import Capella"),
13                       QWidget::tr("Load failed: %1").arg(cf.error(errNo)),
14 -                     QString::null, QWidget::tr("Quit"), QString::null, 0, 1);
15 +                     QString(), QWidget::tr("Quit"), QString(), 0, 1);
16                    }
17              fp.close();
18              // avoid another error message box
19 --- a/mscore/importmidi/importmidi.cpp
20 +++ b/mscore/importmidi/importmidi.cpp
21 @@ -1200,7 +1200,7 @@ Score::FileError importMidi(MasterScore
22                          QMessageBox::warning(0,
23                             QWidget::tr("Load MIDI"),
24                             QWidget::tr("Load failed: %1").arg(errorText),
25 -                           QString::null, QWidget::tr("Quit"), QString::null, 0, 1);
26 +                           QString(), QWidget::tr("Quit"), QString(), 0, 1);
27                          }
28                    fp.close();
29                    qDebug("importMidi: bad file format");
30 --- a/mscore/instrdialog.cpp
31 +++ b/mscore/instrdialog.cpp
32 @@ -138,7 +138,7 @@ void InstrumentsDialog::on_loadButton_cl
33              QMessageBox::warning(0,
34                 QWidget::tr("Load Style Failed"),
35                 QString(strerror(errno)),
36 -               QString::null, QWidget::tr("Quit"), QString::null, 0, 1);
37 +               QString(), QWidget::tr("Quit"), QString(), 0, 1);
38              return;
39              }
40        instrumentsWidget->buildTemplateList();
41 --- a/mscore/musescore.cpp
42 +++ b/mscore/musescore.cpp
43 @@ -4022,7 +4022,7 @@ bool MuseScore::readLanguages(const QStr
44                  QMessageBox::warning(0,
45                     QWidget::tr("Load Languages Failed:"),
46                     error,
47 -                   QString::null, QWidget::tr("Quit"), QString::null, 0, 1);
48 +                   QString(), QWidget::tr("Quit"), QString(), 0, 1);
49                  return false;
50                  }
51  
52 @@ -6813,7 +6813,7 @@ bool MuseScore::saveMp3(Score* score, co
53                    QMessageBox::warning(0,
54                                         tr("Encoding Error"),
55                                         tr("Unable to open target file for writing"),
56 -                                       QString::null, QString::null);
57 +                                       QString(), QString());
58                    }
59              return false;
60              }
61 @@ -6841,7 +6841,7 @@ bool MuseScore::saveMp3(Score* score, QI
62                    QMessageBox::warning(0,
63                                 tr("Error Opening LAME library"),
64                                 tr("Could not open MP3 encoding library!"),
65 -                               QString::null, QString::null);
66 +                               QString(), QString());
67              qDebug("Could not open MP3 encoding library!");
68              return false;
69              }
70 @@ -6853,7 +6853,7 @@ bool MuseScore::saveMp3(Score* score, QI
71                    QMessageBox::warning(0,
72                                 tr("Error Opening LAME library"),
73                                 tr("Not a valid or supported MP3 encoding library!"),
74 -                               QString::null, QString::null);
75 +                               QString(), QString());
76              qDebug("Not a valid or supported MP3 encoding library!");
77              return false;
78              }
79 @@ -6878,7 +6878,7 @@ bool MuseScore::saveMp3(Score* score, QI
80              if (!MScore::noGui) {
81                    QMessageBox::warning(0, tr("Encoding Error"),
82                       tr("Unable to initialize MP3 stream"),
83 -                     QString::null, QString::null);
84 +                     QString(), QString());
85                    }
86              qDebug("Unable to initialize MP3 stream");
87              MScore::sampleRate = oldSampleRate;
88 @@ -7045,7 +7045,7 @@ bool MuseScore::saveMp3(Score* score, QI
89                                      QMessageBox::warning(0,
90                                         tr("Encoding Error"),
91                                         tr("Error %1 returned from MP3 encoder").arg(bytes),
92 -                                       QString::null, QString::null);
93 +                                       QString(), QString());
94                                break;
95                                }
96                          else
97 --- a/mscore/musescore.h
98 +++ b/mscore/musescore.h
99 @@ -135,7 +135,7 @@ struct LanguageItem {
100        LanguageItem(const QString k, const QString n) {
101              key = k;
102              name = n;
103 -            handbook = QString::null;
104 +            handbook = QString();
105              }
106        LanguageItem(const QString k, const QString n, const QString h) {
107              key = k;
108 --- a/mscore/network/loginmanager.cpp
109 +++ b/mscore/network/loginmanager.cpp
110 @@ -793,7 +793,7 @@ void LoginManager::mediaUploadFinished()
111              QMessageBox::warning(0,
112                       tr("Upload Error"),
113                       tr("Sorry, MuseScore couldn't upload the audio file. Error %1").arg(e),
114 -                     QString::null, QString::null);
115 +                     QString(), QString());
116              }
117        }
118  
119 --- a/mscore/preferences.h
120 +++ b/mscore/preferences.h
121 @@ -372,21 +372,52 @@ extern Preferences preferences;
122  
123  // Stream operators for enum classes
124  // enum classes don't play well with QSettings without custom serialization
125 -template<typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
126 -inline QDataStream &operator<<(QDataStream &out, const T &val)
127 +inline QDataStream&
128 +operator<<(QDataStream &out, const Ms::MuseScoreStyleType &val)
129  {
130      return out << static_cast<int>(val);
131  }
132  
133 -template<typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
134 -inline QDataStream &operator>>(QDataStream &in, T &val)
135 +inline QDataStream&
136 +operator>>(QDataStream &in, Ms::MuseScoreStyleType &val)
137  {
138      int tmp;
139      in >> tmp;
140 -    val = static_cast<T>(tmp);
141 +    val = static_cast<Ms::MuseScoreStyleType>(tmp);
142      return in;
143  }
144  
145 +inline QDataStream&
146 +operator<<(QDataStream &out, const Ms::SessionStart &val)
147 +{
148 +    return out << static_cast<int>(val);
149 +}
150 +
151 +inline QDataStream&
152 +operator>>(QDataStream &in, Ms::SessionStart &val)
153 +{
154 +    int tmp;
155 +    in >> tmp;
156 +    val = static_cast<Ms::SessionStart>(tmp);
157 +    return in;
158 +}
159 +
160 +inline QDataStream&
161 +operator<<(QDataStream &out, const Ms::MusicxmlExportBreaks &val)
162 +{
163 +    return out << static_cast<int>(val);
164 +}
165 +
166 +inline QDataStream&
167 +operator>>(QDataStream &in, Ms::MusicxmlExportBreaks &val)
168 +{
169 +    int tmp;
170 +    in >> tmp;
171 +    val = static_cast<Ms::MusicxmlExportBreaks>(tmp);
172 +    return in;
173 +}
174 +
175 +
176  class PreferenceVisitor {
177     public:
178        virtual void visit(QString key, IntPreference*) = 0;