Fixed issue #350.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-09-08 10:22:09 +03:00
parent b7b8523691
commit 0c8b8514e4
2 changed files with 21 additions and 14 deletions

View File

@ -364,20 +364,20 @@ void MApplication::ParseCommandLine(const QStringList &arguments)
parser.addVersionOption();
parser.addPositionalArgument("filename", QCoreApplication::translate("main", "The measurement file."));
//-----
QCommandLineOption heightOption(QStringList() << "h" << "height",
QCommandLineOption heightOption(QStringList() << "e" << "height",
QCoreApplication::translate("main", "Open with the base height: 92, 98, 104, 110, 116, 122, 128, 134, 140, 146, "
"152, 158, 164, 170, 176, 182, 188 (default is measurement file value)."),
"152, 158, 164, 170, 176, 182 or 188 cm."),
QCoreApplication::translate("main", "The base height"));
parser.addOption(heightOption);
//-----
QCommandLineOption sizeOption(QStringList() << "s" << "size",
QCoreApplication::translate("main", "Open with the base size: 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, "
"48, 50, 52, 54, 56 (default is measurement file value)."),
"48, 50, 52, 54 or 56 cm."),
QCoreApplication::translate("main", "The Base size"));
parser.addOption(sizeOption);
//-----
QCommandLineOption unitOption(QStringList() << "u" << "unit",
QCoreApplication::translate("main", "Set pattern file unit: cm, mm, inch (default is measurement file value)."),
QCoreApplication::translate("main", "Set pattern file unit: cm, mm, inch."),
QCoreApplication::translate("main", "The pattern unit"));
parser.addOption(unitOption);
//-----
@ -405,7 +405,7 @@ void MApplication::ParseCommandLine(const QStringList &arguments)
{
fprintf(stderr, "%s\n", qPrintable(QCoreApplication::translate("main",
"Error: Invalid base height argument. Must be 92, 98, 104, 110, 116, 122, 128, 134, 140, 146, 152, 158, "
"164, 170, 176, 182 or 188.")));
"164, 170, 176, 182 or 188 cm.")));
parser.showHelp(1);
}
}
@ -425,7 +425,7 @@ void MApplication::ParseCommandLine(const QStringList &arguments)
{
fprintf(stderr, "%s\n", qPrintable(QCoreApplication::translate("main",
"Error: Invalid base size argument. Must be 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, "
"52, 54 or 56.")));
"52, 54 or 56 cm.")));
parser.showHelp(1);
}
}

View File

@ -1103,20 +1103,27 @@ void MainWindow::ShowMeasurements()
{
const QString absoluteMPath = AbsoluteMPath(curFile, doc->MPath());
QString run;
QStringList arguments;
if (qApp->patternType() == MeasurementsType::Standard)
{
run = QString("\"%1\" \"%2\" -u %3 -h %4 -s %5").arg(qApp->TapeFilePath()).arg(absoluteMPath)
.arg(VDomDocument::UnitsToStr(qApp->patternUnit()))
.arg(static_cast<int>(pattern->height()))
.arg(static_cast<int>(pattern->size()));
arguments = QStringList()
<< absoluteMPath
<< "-u"
<< VDomDocument::UnitsToStr(qApp->patternUnit())
<< "-e"
<< QString().setNum(static_cast<int>(UnitConvertor(pattern->height(), doc->MUnit(), Unit::Cm)))
<< "-s"
<< QString().setNum(static_cast<int>(UnitConvertor(pattern->size(), doc->MUnit(), Unit::Cm)));
}
else
{
run = QString("\"%1\" \"%2\" -u %3").arg(qApp->TapeFilePath()).arg(absoluteMPath)
.arg(VDomDocument::UnitsToStr(qApp->patternUnit()));
arguments = QStringList() << absoluteMPath
<< "-u"
<< VDomDocument::UnitsToStr(qApp->patternUnit());
}
QProcess::startDetached(run);
const QString tape = qApp->TapeFilePath();
const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath();
QProcess::startDetached(tape, arguments, workingDirectory);
}
else
{