Skip to content

Commit

Permalink
Merge pull request #3655 from Jojo-Schmitz/bitrate-master
Browse files Browse the repository at this point in the history
Fix #272042: saved preferences override command line options
  • Loading branch information
lasconic committed May 7, 2018
2 parents 3976fba + 7879427 commit d8797b9
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions mscore/musescore.cpp
Expand Up @@ -5954,7 +5954,7 @@ int main(int argc, char* av[])
parser.addOption(QCommandLineOption({"P", "export-score-parts"}, "Used with '-o <file>.pdf', export score and parts"));
parser.addOption(QCommandLineOption( "no-fallback-font", "Don't use Bravura as fallback musical font"));
parser.addOption(QCommandLineOption({"f", "force"}, "Used with '-o <file>', ignore warnings reg. score being corrupted or from wrong version"));
parser.addOption(QCommandLineOption({"b", "bitrate"}, "Used with '-o <file>.mp3', sets bitrate", "bitrate"));
parser.addOption(QCommandLineOption({"b", "bitrate"}, "Used with '-o <file>.mp3', sets bitrate, in kbps", "bitrate"));

parser.addPositionalArgument("scorefiles", "The files to open", "[scorefile...]");

Expand Down Expand Up @@ -6006,34 +6006,45 @@ int main(int argc, char* av[])
QString temp = parser.value("r");
if (temp.isEmpty())
parser.showHelp(EXIT_FAILURE);
preferences.setTemporaryPreference(PREF_EXPORT_PNG_RESOLUTION, temp.toDouble());
bool ok = false;
double res = temp.toDouble(&ok);
if (ok)
preferences.setTemporaryPreference(PREF_EXPORT_PNG_RESOLUTION, res);
else
fprintf(stderr, "PNG resolution value '%s' not recognized, using default setting from preferences instead.\n", qPrintable(temp));
}
if (parser.isSet("T")) {
QString temp = parser.value("T");
if (temp.isEmpty())
parser.showHelp(EXIT_FAILURE);
bool ok = false;
trimMargin = temp.toInt(&ok);
if (!ok)
if (!ok) {
fprintf(stderr, "Trim margin value '%s' not recognized, so no trimming will be done.\n", qPrintable(temp));
trimMargin = -1;
}
}
if (parser.isSet("x")) {
QString temp = parser.value("x");
if (temp.isEmpty())
parser.showHelp(EXIT_FAILURE);
bool ok = false;
guiScaling = temp.toDouble(&ok);
if (!ok)
if (!ok) {
fprintf(stderr, "GUI scaling value '%s' not recognized, so the values detected by Qt are taken.\n", qPrintable(temp));
guiScaling = 0.0;
}
}
if (parser.isSet("D")) {
QString temp = parser.value("D");
if (temp.isEmpty())
parser.showHelp(EXIT_FAILURE);
bool ok = 0.0;
bool ok = false;
userDPI = temp.toDouble(&ok);
if (!ok)
if (!ok) {
fprintf(stderr, "DPI value '%s' not recognized, so the values detected by Qt are taken.\n", qPrintable(temp));
userDPI = 0.0;
}
}
if (parser.isSet("S")) {
styleFile = parser.value("S");
Expand Down Expand Up @@ -6074,6 +6085,8 @@ int main(int argc, char* av[])
int rate = temp.toInt(&ok);
if (ok)
preferences.setTemporaryPreference(PREF_EXPORT_MP3_BITRATE, rate);
else
fprintf(stderr, "MP3 bitrate value '%s' not recognized, using default setting from preferences instead.\n", qPrintable(temp));
}

QStringList argv = parser.positionalArguments();
Expand Down

0 comments on commit d8797b9

Please sign in to comment.