forked from qt-creator/qt-creator
CompilerExplorer: Fix saving
Change-Id: I7f6770170c76d636fa2d3631d9ff462da9e227bd Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -107,8 +107,11 @@ JsonSettingsDocument::JsonSettingsDocument(QUndoStack *undoStack)
|
||||
{
|
||||
setId(Constants::CE_EDITOR_ID);
|
||||
setMimeType("application/compiler-explorer");
|
||||
connect(&m_ceSettings, &CompilerExplorerSettings::changed, this, [this] { emit changed(); });
|
||||
m_ceSettings.setAutoApply(true);
|
||||
connect(&m_ceSettings, &CompilerExplorerSettings::changed, this, [this] {
|
||||
emit changed();
|
||||
emit contentsChanged();
|
||||
});
|
||||
m_ceSettings.setAutoApply(false);
|
||||
m_ceSettings.setUndoStack(undoStack);
|
||||
}
|
||||
|
||||
@@ -157,8 +160,10 @@ bool JsonSettingsDocument::saveImpl(QString *errorString, const FilePath &newFil
|
||||
|
||||
Utils::FilePath path = newFilePath.isEmpty() ? filePath() : newFilePath;
|
||||
|
||||
if (!newFilePath.isEmpty() && !autoSave)
|
||||
if (!newFilePath.isEmpty() && !autoSave) {
|
||||
setPreferredDisplayName({});
|
||||
setFilePath(newFilePath);
|
||||
}
|
||||
|
||||
auto result = path.writeFileContents(jsonFromStore(store));
|
||||
if (!result && errorString) {
|
||||
@@ -182,6 +187,8 @@ bool JsonSettingsDocument::setContents(const QByteArray &contents)
|
||||
m_ceSettings.fromMap(*result);
|
||||
|
||||
emit settingsChanged();
|
||||
emit changed();
|
||||
emit contentsChanged();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user