Decide to activate export option from loading class

This commit is contained in:
Gavin MacGregor
2025-03-25 18:58:23 +00:00
parent 8751783cb2
commit e647b3e67a

View File

@@ -1050,7 +1050,6 @@ void MainWindow::loadFile(const QString &fileName)
int levelSeen; int levelSeen;
QFile file(fileName); QFile file(fileName);
const QFileInfo fileInfo(file);
LoadFormat *loadingFormat = m_loadFormats.findFormat(QFileInfo(fileName).suffix()); LoadFormat *loadingFormat = m_loadFormats.findFormat(QFileInfo(fileName).suffix());
if (loadingFormat == nullptr) { if (loadingFormat == nullptr) {
@@ -1070,11 +1069,10 @@ void MainWindow::loadFile(const QString &fileName)
QApplication::setOverrideCursor(Qt::WaitCursor); QApplication::setOverrideCursor(Qt::WaitCursor);
if (loadingFormat->load(&file, m_textWidget->document())) { if (loadingFormat->load(&file, m_textWidget->document())) {
// TODO put "native format" into class? if (m_saveFormats.isExportOnly(QFileInfo(file).suffix()))
if (fileInfo.suffix() == "tti" || fileInfo.suffix() == "ttix")
m_exportAutoFileName.clear();
else
m_exportAutoFileName = fileName; m_exportAutoFileName = fileName;
else
m_exportAutoFileName.clear();
} else { } else {
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
QMessageBox::warning(this, QApplication::applicationDisplayName(), tr("Cannot load file %1\n%2").arg(QDir::toNativeSeparators(fileName), loadingFormat->errorString())); QMessageBox::warning(this, QApplication::applicationDisplayName(), tr("Cannot load file %1\n%2").arg(QDir::toNativeSeparators(fileName), loadingFormat->errorString()));