TextEditor: Simplify ColorScheme::save() signature

Change-Id: I1ea25996a97e1cdbfb97f1f19231322e8a804cc6
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2024-12-03 15:08:01 +01:00
parent 3d3323fa0e
commit 8b767caf31
4 changed files with 12 additions and 10 deletions

View File

@@ -6,6 +6,8 @@
#include "texteditorconstants.h"
#include "texteditortr.h"
#include <coreplugin/icore.h>
#include <utils/fileutils.h>
#include <QFile>
@@ -216,7 +218,7 @@ void ColorScheme::clear()
m_formats.clear();
}
bool ColorScheme::save(const FilePath &filePath, QWidget *parent) const
bool ColorScheme::save(const FilePath &filePath) const
{
FileSaver saver(filePath);
if (!saver.hasError()) {
@@ -262,7 +264,7 @@ bool ColorScheme::save(const FilePath &filePath, QWidget *parent) const
saver.setResult(&w);
}
return saver.finalize(parent);
return saver.finalize(Core::ICore::dialogParent());
}
namespace {

View File

@@ -97,7 +97,7 @@ public:
void clear();
bool save(const Utils::FilePath &filePath, QWidget *parent) const;
bool save(const Utils::FilePath &filePath) const;
bool load(const Utils::FilePath &filePath);
bool equals(const ColorScheme &cs) const

View File

@@ -464,9 +464,9 @@ bool FontSettings::loadColorScheme(const Utils::FilePath &filePath,
return loaded;
}
bool FontSettings::saveColorScheme(const Utils::FilePath &fileName)
bool FontSettings::saveColorScheme(const FilePath &fileName)
{
const bool saved = m_scheme.save(fileName, Core::ICore::dialogParent());
const bool saved = m_scheme.save(fileName);
if (saved)
m_schemeFileName = fileName;
return saved;

View File

@@ -552,7 +552,7 @@ void FontSettingsPageWidget::copyColorScheme(const QString &name)
ColorScheme scheme = m_value.colorScheme();
scheme.setDisplayName(name);
if (scheme.save(filePath, Core::ICore::dialogParent()))
if (scheme.save(filePath))
m_value.setColorSchemeFileName(filePath);
refreshColorSchemeList();
@@ -629,7 +629,7 @@ void FontSettingsPageWidget::importScheme()
ColorScheme scheme;
if (scheme.load(importedFile)) {
scheme.setDisplayName(name);
scheme.save(saveFileName, Core::ICore::dialogParent());
scheme.save(saveFileName);
m_value.loadColorScheme(saveFileName, m_descriptions);
} else {
qWarning() << "Failed to import color scheme:" << importedFile;
@@ -656,7 +656,7 @@ void FontSettingsPageWidget::exportScheme()
Tr::tr("Color scheme (*.xml);;All files (*)"));
if (!filePath.isEmpty())
m_value.colorScheme().save(filePath, Core::ICore::dialogParent());
m_value.colorScheme().save(filePath);
}
void FontSettingsPageWidget::maybeSaveColorScheme()
@@ -680,7 +680,7 @@ void FontSettingsPageWidget::maybeSaveColorScheme()
if (messageBox.exec() == QMessageBox::Save) {
const ColorScheme &scheme = m_schemeEdit->colorScheme();
scheme.save(m_value.colorSchemeFileName(), Core::ICore::dialogParent());
scheme.save(m_value.colorSchemeFileName());
}
}
@@ -726,7 +726,7 @@ void FontSettingsPageWidget::apply()
// Update the scheme and save it under the name it already has
m_value.setColorScheme(m_schemeEdit->colorScheme());
const ColorScheme &scheme = m_value.colorScheme();
scheme.save(m_value.colorSchemeFileName(), Core::ICore::dialogParent());
scheme.save(m_value.colorSchemeFileName());
}
bool ok;