From 7c33043ac0021b022bc52bccbf6d7a44bbec2717 Mon Sep 17 00:00:00 2001 From: Andre Bernet Date: Sun, 22 Jan 2017 17:44:55 +0100 Subject: [PATCH] Force different file name after conversion (#4272) * Force different file name after conversion * More detailed instructions --- companion/src/mdichild.cpp | 9 +++++---- companion/src/mdichild.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index 0772bbb3e..668d79cb5 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -152,10 +152,10 @@ void MdiChild::showModelsListContextMenu(const QPoint & pos) contextMenu.exec(globalPos); } -void MdiChild::setCurrentFileExtension(const QString & ext) +void MdiChild::forceNewFilename(const QString & suffix, const QString & ext) { QFileInfo info(curFile); - curFile = info.path() + "/" + info.baseName() + ext; + curFile = info.path() + "/" + info.baseName() + suffix + ext; } void MdiChild::onFirmwareChanged() @@ -168,11 +168,12 @@ void MdiChild::onFirmwareChanged() void MdiChild::convertStorage(BoardEnum from, BoardEnum to) { - QMessageBox::warning(this, "Companion", tr("Models and settings will be automatically converted"), QMessageBox::Ok); + QMessageBox::warning(this, "Companion", tr("Models and settings will be automatically converted.\nIf that is not what you intended, please close the file\nand choose the correct radio type/profile before reopening it."), QMessageBox::Ok); radioData.convert(from, to); - setCurrentFileExtension(".otx"); + forceNewFilename("_converted", ".otx"); initModelsList(); fileChanged = true; + isUntitled = true; documentWasModified(); } diff --git a/companion/src/mdichild.h b/companion/src/mdichild.h index 48e4f1062..680c7e9ac 100644 --- a/companion/src/mdichild.h +++ b/companion/src/mdichild.h @@ -60,7 +60,7 @@ class MdiChild : public QWidget protected: void convertStorage(BoardEnum from, BoardEnum to); - void setCurrentFileExtension(const QString & ext); + void forceNewFilename(const QString & suffix, const QString & ext); void closeEvent(QCloseEvent * event); protected slots: