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