forked from qt-creator/qt-creator
Editor: fix importing color schemes
Change-Id: I286de6030462e692a673a61f3630ad3ca7f95a2d Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -547,9 +547,6 @@ void FontSettingsPageWidget::importScheme()
|
|||||||
if (importedFile.isEmpty())
|
if (importedFile.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Utils::FilePath fileName = createColorSchemeFileName(importedFile.baseName() + "%1."
|
|
||||||
+ importedFile.suffix());
|
|
||||||
|
|
||||||
// Ask about saving any existing modifications
|
// Ask about saving any existing modifications
|
||||||
maybeSaveColorScheme();
|
maybeSaveColorScheme();
|
||||||
|
|
||||||
@@ -560,16 +557,25 @@ void FontSettingsPageWidget::importScheme()
|
|||||||
dialog->setLabelText(tr("Color scheme name:"));
|
dialog->setLabelText(tr("Color scheme name:"));
|
||||||
dialog->setTextValue(importedFile.baseName());
|
dialog->setTextValue(importedFile.baseName());
|
||||||
|
|
||||||
connect(dialog, &QInputDialog::textValueSelected, this, [this, fileName](const QString &name) {
|
connect(dialog,
|
||||||
m_value.setColorScheme(m_ui.schemeEdit->colorScheme());
|
&QInputDialog::textValueSelected,
|
||||||
|
this,
|
||||||
|
[this, importedFile](const QString &name) {
|
||||||
|
const Utils::FilePath saveFileName = createColorSchemeFileName(
|
||||||
|
importedFile.baseName() + "%1." + importedFile.suffix());
|
||||||
|
|
||||||
ColorScheme scheme = m_value.colorScheme();
|
ColorScheme scheme;
|
||||||
scheme.setDisplayName(name);
|
if (scheme.load(importedFile.path())) {
|
||||||
if (scheme.save(fileName.path(), Core::ICore::dialogParent()))
|
scheme.setDisplayName(name);
|
||||||
m_value.setColorSchemeFileName(fileName.path());
|
scheme.save(saveFileName.path(), Core::ICore::dialogParent());
|
||||||
|
m_value.loadColorScheme(saveFileName.path(), m_descriptions);
|
||||||
|
} else {
|
||||||
|
qWarning() << "Failed to import color scheme:" << importedFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshColorSchemeList();
|
||||||
|
});
|
||||||
|
|
||||||
refreshColorSchemeList();
|
|
||||||
});
|
|
||||||
dialog->open();
|
dialog->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user