Skip to content
Permalink
Browse files

fix #60631: No line number reported in MSCZ XML errors

  • Loading branch information...
lasconic committed May 14, 2015
1 parent a5408f7 commit 11ff419a183fd8b4c0b9930df4d98c3360af5a52
Showing with 14 additions and 7 deletions.
  1. +1 −0 libmscore/scorefile.cpp
  2. +13 −7 mscore/file.cpp
@@ -1160,6 +1160,7 @@ bool Score::read(XmlReader& e)
qDebug("%s: xml read error at line %lld col %lld: %s",
qPrintable(e.getDocName()), e.lineNumber(), e.columnNumber(),
e.name().toUtf8().data());
MScore::lastError = tr("XML read error at line %1 column %2: %3").arg(e.lineNumber()).arg(e.columnNumber()).arg(e.name().toString());
return false;
}

@@ -163,6 +163,7 @@ static bool readScoreError(const QString& name, Score::FileError error, bool ask
return false;
case Score::FileError::FILE_BAD_FORMAT:
msg += QObject::tr("bad format");
detailedMsg = MScore::lastError;
break;
case Score::FileError::FILE_UNKNOWN_TYPE:
msg += QObject::tr("unknown type");
@@ -200,20 +201,25 @@ static bool readScoreError(const QString& name, Score::FileError error, bool ask
fprintf(stderr, "%s\n", qPrintable(msg));
return rv;
}
QMessageBox msgBox;
msgBox.setWindowTitle(QObject::tr("MuseScore: Load Error"));
msgBox.setText(msg);
msgBox.setDetailedText(detailedMsg);
msgBox.setTextFormat(Qt::RichText);
if (canIgnore && ask) {
QMessageBox msgBox;
msgBox.setWindowTitle(QObject::tr("MuseScore: Load Error"));
msgBox.setText(msg);
msgBox.setDetailedText(detailedMsg);
msgBox.setTextFormat(Qt::RichText);
msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(
QMessageBox::Cancel | QMessageBox::Ignore
);
return msgBox.exec() == QMessageBox::Ignore;
}
else
QMessageBox::critical(0, QObject::tr("MuseScore: Load Error"), msg);
else {
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(
QMessageBox::Ok
);
msgBox.exec();
}
return rv;
}

0 comments on commit 11ff419

Please sign in to comment.
You can’t perform that action at this time.