Run Tape through Valentina. Need for file association on Mac OS X.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-11-16 11:28:58 +02:00
parent f49d62851f
commit dc0344bbea

View file

@ -3284,6 +3284,31 @@ bool MainWindow::LoadPattern(const QString &fileName, const QString& customMeasu
return false;
}
try
{
// Here comes undocumented Valentina's feature.
// Because app bundle in Mac OS X doesn't allow setup assosiation for Tape we must do this through Valentina
VMeasurements m(pattern);
m.setXMLContent(fileName);
if (m.Type() == MeasurementsType::Standard || m.Type() == MeasurementsType::Individual)
{
const QString tape = qApp->TapeFilePath();
const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath();
QProcess::startDetached(tape, QStringList(fileName), workingDirectory);
qApp->exit(V_EX_OK);
return false; // stop continue processing
}
}
catch (VException &e)
{
qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
Clear();
qApp->exit(V_EX_NOINPUT);
return false;
}
qCDebug(vMainWindow, "Loking file");
VlpCreateLock(lock, fileName);
@ -3867,7 +3892,7 @@ void MainWindow::ProcessCMD()
return; // process only one input file
}
if (cmd->IsTestModeEnabled() || cmd->IsExportEnabled())
if (loaded && (cmd->IsTestModeEnabled() || cmd->IsExportEnabled()))
{
if (cmd->IsSetGradationSize())
{