CompilerExplorer: More Key and Store

Change-Id: I49a79e672915503359380e776b994e53b210eda9
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-08-28 15:11:10 +02:00
parent 2e3b6fcf61
commit e6a1d6685e
2 changed files with 19 additions and 17 deletions

View File

@@ -44,6 +44,7 @@
using namespace std::chrono_literals;
using namespace Aggregation;
using namespace TextEditor;
using namespace Utils;
namespace CompilerExplorer {
@@ -51,7 +52,8 @@ class CodeEditorWidget : public TextEditorWidget
{
public:
CodeEditorWidget(const std::shared_ptr<SourceSettings> &settings)
: m_settings(settings){};
: m_settings(settings)
{}
void updateHighlighter()
{
@@ -94,8 +96,8 @@ JsonSettingsDocument::JsonSettingsDocument()
JsonSettingsDocument::~JsonSettingsDocument() {}
Core::IDocument::OpenResult JsonSettingsDocument::open(QString *errorString,
const Utils::FilePath &filePath,
const Utils::FilePath &realFilePath)
const FilePath &filePath,
const FilePath &realFilePath)
{
if (!filePath.isReadableFile())
return OpenResult::ReadError;
@@ -121,16 +123,16 @@ Core::IDocument::OpenResult JsonSettingsDocument::open(QString *errorString,
return OpenResult::CannotHandle;
}
m_ceSettings.fromMap(doc.toVariant().toMap());
m_ceSettings.fromMap(storeFromVariant(doc.toVariant().toMap()));
emit settingsChanged();
return OpenResult::Success;
}
bool JsonSettingsDocument::saveImpl(QString *errorString,
const Utils::FilePath &newFilePath,
const FilePath &newFilePath,
bool autoSave)
{
QVariantMap map;
Store map;
if (autoSave) {
if (m_windowStateCallback)
@@ -145,7 +147,7 @@ bool JsonSettingsDocument::saveImpl(QString *errorString,
m_ceSettings.toMap(map);
}
QJsonDocument doc = QJsonDocument::fromVariant(map);
QJsonDocument doc = QJsonDocument::fromVariant(variantFromStore(map));
Utils::FilePath path = newFilePath.isEmpty() ? filePath() : newFilePath;
@@ -174,7 +176,7 @@ bool JsonSettingsDocument::setContents(const QByteArray &contents)
QTC_ASSERT(doc.isObject(), return false);
m_ceSettings.fromMap(doc.toVariant().toMap());
m_ceSettings.fromMap(storeFromVariant(doc.toVariant()));
emit settingsChanged();
return true;
@@ -241,7 +243,7 @@ CompilerWidget::CompilerWidget(const std::shared_ptr<SourceSettings> &sourceSett
, m_compilerSettings(compilerSettings)
{
using namespace Layouting;
QVariantMap map;
Store map;
m_delayTimer = new QTimer(this);
m_delayTimer->setSingleShot(true);