feat: .kc file format — Layer 1 (format registration)

Cherry-picked from feat/kc-file-format-layer1 (723a8c98d5).
- Document.cpp: checkFileName() accepts .kc extension
- FreeCADInit.py: register .kc import type
- Dialog filters: Save As, Save Copy, Merge, Project Utility
- kc_format.py: DocumentObserver preserves silo/ entries across saves
- InitGui.py: register kc_format observer on startup
This commit is contained in:
forbes
2026-02-13 14:10:36 -06:00
parent 54031edede
commit 9809ff852c
7 changed files with 76 additions and 6 deletions

View File

@@ -529,7 +529,7 @@ void StdCmdMergeProjects::activated(int iMsg)
Gui::getMainWindow(),
QString::fromUtf8(QT_TR_NOOP("Merge Document")),
FileDialog::getWorkingDirectory(),
QString::fromUtf8(QT_TR_NOOP("%1 document (*.FCStd)")).arg(exe)
QString::fromUtf8(QT_TR_NOOP("%1 document (*.FCStd *.kc)")).arg(exe)
);
if (!project.isEmpty()) {
FileDialog::setWorkingDirectory(project);

View File

@@ -46,7 +46,7 @@ DlgProjectUtility::DlgProjectUtility(QWidget* parent, Qt::WindowFlags fl)
ui->setupUi(this);
connect(ui->extractButton, &QPushButton::clicked, this, &DlgProjectUtility::extractButton);
connect(ui->createButton, &QPushButton::clicked, this, &DlgProjectUtility::createButton);
ui->extractSource->setFilter(QStringLiteral("%1 (*.FCStd)").arg(tr("Project file")));
ui->extractSource->setFilter(QStringLiteral("%1 (*.FCStd *.kc)").arg(tr("Project file")));
}
/**

View File

@@ -1616,7 +1616,7 @@ bool Document::saveAs()
getMainWindow(),
QObject::tr("Save %1 Document").arg(exe),
name,
QStringLiteral("%1 %2 (*.FCStd)").arg(exe, QObject::tr("Document"))
QStringLiteral("%1 %2 (*.FCStd *.kc)").arg(exe, QObject::tr("Document"))
);
if (!fn.isEmpty()) {
@@ -1739,7 +1739,7 @@ bool Document::saveCopy()
getMainWindow(),
QObject::tr("Save %1 Document").arg(exe),
QString::fromUtf8(getDocument()->FileName.getValue()),
QObject::tr("%1 document (*.FCStd)").arg(exe)
QObject::tr("%1 document (*.FCStd *.kc)").arg(exe)
);
if (!fn.isEmpty()) {
const char* DocName = App::GetApplication().getDocumentName(getDocument());