代码拉取完成,页面将自动刷新
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "commentssettings.h"
#include <QSettings>
using namespace TextEditor;
namespace {
const char kDocumentationCommentsGroup[] = "CppToolsDocumentationComments";
const char kEnableDoxygenBlocks[] = "EnableDoxygenBlocks";
const char kGenerateBrief[] = "GenerateBrief";
const char kAddLeadingAsterisks[] = "AddLeadingAsterisks";
}
CommentsSettings::CommentsSettings()
: m_enableDoxygen(true)
, m_generateBrief(true)
, m_leadingAsterisks(true)
{}
void CommentsSettings::toSettings(QSettings *s) const
{
s->beginGroup(kDocumentationCommentsGroup);
s->setValue(kEnableDoxygenBlocks, m_enableDoxygen);
s->setValue(kGenerateBrief, m_generateBrief);
s->setValue(kAddLeadingAsterisks, m_leadingAsterisks);
s->endGroup();
}
void CommentsSettings::fromSettings(QSettings *s)
{
s->beginGroup(kDocumentationCommentsGroup);
m_enableDoxygen = s->value(kEnableDoxygenBlocks, true).toBool();
m_generateBrief = m_enableDoxygen && s->value(kGenerateBrief, true).toBool();
m_leadingAsterisks = s->value(kAddLeadingAsterisks, true).toBool();
s->endGroup();
}
QJsonObject CommentsSettings::toJson(){
return {
{kEnableDoxygenBlocks,m_enableDoxygen},
{kGenerateBrief,m_generateBrief},
{kAddLeadingAsterisks,m_leadingAsterisks},
};
}
void CommentsSettings::fromJson(const QJsonObject& data){
if(data.contains(kEnableDoxygenBlocks)){
m_enableDoxygen = data.find(kEnableDoxygenBlocks)->toBool();
}
if(data.contains(kGenerateBrief)){
m_generateBrief = data.find(kGenerateBrief)->toBool();
}
if(data.contains(kAddLeadingAsterisks)){
m_leadingAsterisks = data.find(kAddLeadingAsterisks)->toBool();
}
}
bool CommentsSettings::equals(const CommentsSettings &other) const
{
return m_enableDoxygen == other.m_enableDoxygen
&& m_generateBrief == other.m_generateBrief
&& m_leadingAsterisks == other.m_leadingAsterisks;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。