Allow Valentina to open vlt files on Mac.

develop
Roman Telezhynskyi 2021-10-16 13:49:36 +03:00
parent 8625ecd2b4
commit 713ad813ff
3 changed files with 68 additions and 24 deletions

View File

@ -134,7 +134,29 @@
<string>vst</string>
</array>
<key>public.mime-type</key>
<string>text/xml</string>
<string>text/xml</string>
</dict>
</dict>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.text</string>
<string>public.xml</string>
</array>
<key>UTTypeDescription</key>
<string>Valentina layout</string>
<key>UTTypeIconFile</key>
<string>layout.icns</string>
<key>UTTypeIdentifier</key>
<string>io.bitbucket.valentinaproject.vlt</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>vlt</string>
</array>
<key>public.mime-type</key>
<string>text/xml</string>
</dict>
</dict>
</array>

1
share/fabric-pattern.svg Normal file
View File

@ -0,0 +1 @@
<svg id="Filled" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g fill="#e8edf1"><path d="m168 24-96 32s40 128-48 184c9.256 47.571 24 93.32 24 136 0 40-3.984 78.486-16 112h216v-384s-56-24-80-80z"/><path d="m488 96-32 232h-144l-32-232a354.576 354.576 0 0 0 48-40c24-24 48-24 56-24s32 0 56 24a354.576 354.576 0 0 0 48 40z"/><path d="m296 384h192v96h-192z"/></g><path d="m256 488v-384a8 8 0 0 0 -4.849-7.354c-.53-.226-53.318-23.345-75.8-75.8a8 8 0 0 0 -9.883-4.439l-96 32a8 8 0 0 0 -5.106 9.977 236.823 236.823 0 0 1 8.638 68.416c-1.254 48.932-19.186 84.749-53.3 106.456a8 8 0 0 0 -3.558 8.277c2.77 14.235 6.042 28.376 9.207 42.053 7.537 32.548 14.651 63.295 14.651 92.414 0 44.4-5.08 80.151-15.531 109.3a8 8 0 0 0 7.531 10.7h216a8 8 0 0 0 8-8zm-16-112.013h-16a8 8 0 0 0 0 16h16v88.013h-80v-16a8 8 0 0 0 -16 0v16h-100.941c8.698-28.773 12.941-62.942 12.941-104 0-30.946-7.314-62.558-15.058-96.025-2.743-11.856-5.568-24.066-8.052-36.288 35.41-24.717 54.784-64.859 56.11-116.482a256.257 256.257 0 0 0 -7.3-66.005l82.026-27.342c21.964 44.714 62.293 68.142 76.274 75.195z"/><path d="m492.438 89.344a348.673 348.673 0 0 1 -46.781-39c-26.343-26.344-52.923-26.344-61.657-26.344s-35.314 0-61.657 26.343a350.092 350.092 0 0 1 -46.781 39 8 8 0 0 0 -3.487 7.749l32 232a8 8 0 0 0 7.925 6.908h144a8 8 0 0 0 7.925-6.907l32-232a8 8 0 0 0 -3.487-7.749zm-43.41 230.656h-130.056l-30.372-220.231a369.2 369.2 0 0 0 45.061-38.112c21.653-21.657 43.244-21.657 50.339-21.657s28.686 0 50.343 21.657a369.2 369.2 0 0 0 45.057 38.112z"/><path d="m152 88a8 8 0 0 0 8-8v-16a8 8 0 0 0 -16 0v16a8 8 0 0 0 8 8z"/><path d="m384 88a8 8 0 0 0 8-8v-16a8 8 0 0 0 -16 0v16a8 8 0 0 0 8 8z"/><path d="m384 128a8 8 0 0 0 -8 8v16a8 8 0 0 0 16 0v-16a8 8 0 0 0 -8-8z"/><path d="m384 176a8 8 0 0 0 -8 8v16a8 8 0 0 0 16 0v-16a8 8 0 0 0 -8-8z"/><path d="m384 224a8 8 0 0 0 -8 8v16a8 8 0 0 0 16 0v-16a8 8 0 0 0 -8-8z"/><path d="m384 272a8 8 0 0 0 -8 8v16a8 8 0 0 0 16 0v-16a8 8 0 0 0 -8-8z"/><path d="m80 256a8 8 0 0 0 -8-8h-16a8 8 0 0 0 0 16h16a8 8 0 0 0 8-8z"/><path d="m376 424h-16a8 8 0 0 0 0 16h16a8 8 0 0 0 0-16z"/><path d="m408 440h16a8 8 0 0 0 0-16h-16a8 8 0 0 0 0 16z"/><path d="m496 384a8 8 0 0 0 -8-8h-192a8 8 0 0 0 -8 8v96a8 8 0 0 0 8 8h192a8 8 0 0 0 8-8zm-16 40h-24a8 8 0 0 0 0 16h24v32h-80v-16a8 8 0 0 0 -16 0v16h-80v-32h24a8 8 0 0 0 0-16h-24v-32h80v8a8 8 0 0 0 16 0v-8h80z"/><path d="m320 96h-8a8 8 0 0 0 0 16h8a8 8 0 0 0 0-16z"/><path d="m368 96h-16a8 8 0 0 0 0 16h16a8 8 0 0 0 0-16z"/><path d="m416 96h-16a8 8 0 0 0 0 16h16a8 8 0 0 0 0-16z"/><path d="m448 112h8a8 8 0 0 0 0-16h-8a8 8 0 0 0 0 16z"/><path d="m96 376.007h-16a8 8 0 0 0 0 16h16a8 8 0 1 0 0-16z"/><path d="m152 384a8 8 0 0 0 -8-8h-16a8 8 0 0 0 0 16h16a8 8 0 0 0 8-8z"/><path d="m192 375.993h-16a8 8 0 1 0 0 16h16a8 8 0 0 0 0-16z"/><path d="m104 264h16a8 8 0 0 0 0-16h-16a8 8 0 0 0 0 16z"/><path d="m152 264h16a8 8 0 0 0 0-16h-16a8 8 0 0 0 0 16z"/><path d="m200 264h16a8 8 0 0 0 0-16h-16a8 8 0 0 0 0 16z"/><path d="m152 136a8 8 0 0 0 8-8v-16a8 8 0 0 0 -16 0v16a8 8 0 0 0 8 8z"/><path d="m152 184a8 8 0 0 0 8-8v-16a8 8 0 0 0 -16 0v16a8 8 0 0 0 8 8z"/><path d="m152 232a8 8 0 0 0 8-8v-16a8 8 0 0 0 -16 0v16a8 8 0 0 0 8 8z"/><path d="m152 280a8 8 0 0 0 -8 8v16a8 8 0 0 0 16 0v-16a8 8 0 0 0 -8-8z"/><path d="m152 328a8 8 0 0 0 -8 8v16a8 8 0 0 0 16 0v-16a8 8 0 0 0 -8-8z"/><path d="m152 408a8 8 0 0 0 -8 8v16a8 8 0 0 0 16 0v-16a8 8 0 0 0 -8-8z"/></svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -5327,39 +5327,60 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile)
return false;
}
try
if (fileName.endsWith(".vit") || fileName.endsWith(".vst"))
{
// 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::Multisize || m.Type() == MeasurementsType::Individual)
try
{
const QString tape = VApplication::VApp()->TapeFilePath();
const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath();
// 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);
QStringList arguments = QStringList() << fileName;
if (isNoScaling)
if (m.Type() == MeasurementsType::Multisize || m.Type() == MeasurementsType::Individual)
{
arguments.append(QLatin1String("--") + LONG_OPTION_NO_HDPI_SCALING);
}
const QString tape = VApplication::VApp()->TapeFilePath();
const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath();
QProcess::startDetached(tape, arguments, workingDirectory);
qApp->exit(V_EX_OK);
return false; // stop continue processing
QStringList arguments = QStringList() << fileName;
if (isNoScaling)
{
arguments.append(QLatin1String("--") + LONG_OPTION_NO_HDPI_SCALING);
}
QProcess::startDetached(tape, arguments, 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();
if (not VApplication::IsGUIMode())
{
qApp->exit(V_EX_NOINPUT);
}
return false;
}
}
catch (VException &e)
if (fileName.endsWith(".vlt"))
{
qCCritical(vMainWindow, "%s\n\n%s\n\n%s", qUtf8Printable(tr("File error.")),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
Clear();
if (not VApplication::IsGUIMode())
// Here comes undocumented Valentina's feature.
// Because app bundle in Mac OS X doesn't allow setup assosiation for Puzzle we must do this through Valentina
const QString puzzle = VApplication::VApp()->PuzzleFilePath();
const QString workingDirectory = QFileInfo(puzzle).absoluteDir().absolutePath();
QStringList arguments = QStringList() << fileName;
if (isNoScaling)
{
qApp->exit(V_EX_NOINPUT);
arguments.append(QLatin1String("--") + LONG_OPTION_NO_HDPI_SCALING);
}
return false;
QProcess::startDetached(puzzle, arguments, workingDirectory);
qApp->exit(V_EX_OK);
return false; // stop continue processing
}
qCDebug(vMainWindow, "Loking file");