Replace a few aspect.value() calls with operatpor()

Change-Id: Icaada671fe8dbe59d4f596da49476b3ec2137c25
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-07-18 14:33:48 +02:00
parent 3e2e0d9393
commit bedab22e63
14 changed files with 36 additions and 38 deletions

View File

@@ -61,7 +61,7 @@ GeneralSettings::GeneralSettings()
QList<MimeType> GeneralSettings::allowedMimeTypes() const
{
const QStringList stringTypes = autoFormatMime.value().split(';');
const QStringList stringTypes = autoFormatMime().split(';');
QList<MimeType> types;
for (QString t : stringTypes) {

View File

@@ -383,7 +383,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
connect(bs, &BuildSystem::parsingFinished, this, [this, bs] {
const CMakeConfig config = bs->configurationFromCMake();
const TriState qmlDebugSetting = m_buildConfig->qmlDebugging.value();
const TriState qmlDebugSetting = m_buildConfig->qmlDebugging();
bool qmlDebugConfig = CMakeBuildConfiguration::hasQmlDebugging(config);
if ((qmlDebugSetting == TriState::Enabled && !qmlDebugConfig)
|| (qmlDebugSetting == TriState::Disabled && qmlDebugConfig)) {
@@ -843,10 +843,10 @@ void CMakeBuildSettingsWidget::updateConfigurationStateIndex(int index)
CMakeConfig CMakeBuildSettingsWidget::getQmlDebugCxxFlags()
{
const TriState qmlDebuggingState = m_buildConfig->qmlDebugging.value();
const TriState qmlDebuggingState = m_buildConfig->qmlDebugging();
if (qmlDebuggingState == TriState::Default) // don't touch anything
return {};
const bool enable = m_buildConfig->qmlDebugging.value() == TriState::Enabled;
const bool enable = m_buildConfig->qmlDebugging() == TriState::Enabled;
const CMakeConfig configList = m_buildConfig->cmakeBuildSystem()->configurationFromCMake();
const QByteArrayList cxxFlagsPrev{"CMAKE_CXX_FLAGS",

View File

@@ -148,7 +148,7 @@ public:
QStringList arguments() const override
{
return settings().diffOptions.value().split(' ', Qt::SkipEmptyParts)
return settings().diffOptions().split(' ', Qt::SkipEmptyParts)
+ VcsBaseEditorConfig::arguments();
}
};

View File

@@ -84,7 +84,7 @@ CvsSettings::CvsSettings()
QStringList CvsSettings::addOptions(const QStringList &args) const
{
const QString cvsRoot = this->cvsRoot.value();
const QString cvsRoot = this->cvsRoot();
if (cvsRoot.isEmpty())
return args;

View File

@@ -368,13 +368,13 @@ void CdbEngine::setupEngine()
if (s.ignoreFirstChanceAccessViolation())
debugger.addArg("-x");
const QStringList &sourcePaths = s.cdbSourcePaths.value();
const QStringList &sourcePaths = s.cdbSourcePaths();
if (!sourcePaths.isEmpty())
debugger.addArgs({"-srcpath", sourcePaths.join(';')});
debugger.addArgs({"-y", QChar('"') + s.cdbSymbolPaths.value().join(';') + '"'});
debugger.addArgs({"-y", QChar('"') + s.cdbSymbolPaths().join(';') + '"'});
debugger.addArgs(expand(s.cdbAdditionalArguments.value()), CommandLine::Raw);
debugger.addArgs(expand(s.cdbAdditionalArguments()), CommandLine::Raw);
switch (sp.startMode) {
case StartInternal:

View File

@@ -169,7 +169,7 @@ CdbOptionsPageWidget::CdbOptionsPageWidget()
using namespace Layouting;
DebuggerSettings &s = settings();
m_breakEventWidget->setBreakEvents(settings().cdbBreakEvents.value());
m_breakEventWidget->setBreakEvents(settings().cdbBreakEvents());
Column {
Row {
@@ -220,7 +220,7 @@ void CdbOptionsPageWidget::apply()
void CdbOptionsPageWidget::finish()
{
m_breakEventWidget->setBreakEvents(settings().cdbBreakEvents.value());
m_breakEventWidget->setBreakEvents(settings().cdbBreakEvents());
m_group.finish();
}

View File

@@ -124,7 +124,7 @@ bool PerfConfigEventsModel::setData(const QModelIndex &dataIndex, const QVariant
const int row = dataIndex.row();
const int column = dataIndex.column();
QStringList events = m_settings->events.value();
QStringList events = m_settings->events();
EventDescription description = parseEvent(events[row]);
switch (column) {
case ColumnEventType:
@@ -183,7 +183,7 @@ bool PerfConfigEventsModel::insertRows(int row, int count, const QModelIndex &pa
if (parent.isValid())
return false;
QStringList events = m_settings->events.value();
QStringList events = m_settings->events();
for (int i = 0; i < count; ++i)
events.insert(row, "dummy");
beginInsertRows(parent, row, row + count - 1);
@@ -197,7 +197,7 @@ bool PerfConfigEventsModel::removeRows(int row, int count, const QModelIndex &pa
if (parent.isValid())
return false;
QStringList events = m_settings->events.value();
QStringList events = m_settings->events();
for (int i = 0; i < count; ++i)
events.removeAt(row);
beginRemoveRows(parent, row, row + count - 1);

View File

@@ -303,7 +303,7 @@ CommandLine MakeStep::effectiveMakeCommand(MakeCommandType type) const
cmd.addArgs(displayArguments());
cmd.addArgs(userArguments(), CommandLine::Raw);
cmd.addArgs(jobArguments());
cmd.addArgs(m_buildTargetsAspect.value());
cmd.addArgs(m_buildTargetsAspect());
return cmd;
}

View File

@@ -291,9 +291,9 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker)
auto runControl = runWorker->runControl();
if (auto aspect = runControl->aspect<QmlProfilerRunConfigurationAspect>()) {
if (auto settings = static_cast<const QmlProfilerSettings *>(aspect->currentSettings)) {
d->m_profilerConnections->setFlushInterval(settings->flushEnabled.value() ?
settings->flushInterval.value() : 0);
d->m_profilerModelManager->setAggregateTraces(settings->aggregateTraces.value());
d->m_profilerConnections->setFlushInterval(settings->flushEnabled() ?
settings->flushInterval() : 0);
d->m_profilerModelManager->setAggregateTraces(settings->aggregateTraces());
}
}

View File

@@ -436,7 +436,7 @@ void SquishFileHandler::recordTestCase(const QString &suiteName, const QString &
return;
conf.setAut(dialog.aut.currentText());
conf.setArguments(dialog.arguments.value());
conf.setArguments(dialog.arguments());
}
SquishTools::instance()->recordTestCase(suitePath, testCaseName, conf);

View File

@@ -523,8 +523,8 @@ void SquishServerSettingsWidget::addAttachableAut(TreeItem *categoryItem, Squish
if (dialog.exec() != QDialog::Accepted)
return;
const QString executableStr = dialog.executable.value();
const QString hostStr = dialog.host.value();
const QString executableStr = dialog.executable();
const QString hostStr = dialog.host();
if (executableStr.isEmpty() || hostStr.isEmpty())
return;

View File

@@ -143,9 +143,7 @@ void TerminalWidget::setupPty()
m_process = std::make_unique<Process>();
CommandLine shellCommand = m_openParameters.shellCommand.value_or(
CommandLine{settings().shell(),
settings().shellArguments.value(),
CommandLine::Raw});
CommandLine{settings().shell(), settings().shellArguments(), CommandLine::Raw});
Environment env = m_openParameters.environment.value_or(Environment{})
.appliedToEnvironment(shellCommand.executable().deviceEnvironment());
@@ -230,8 +228,8 @@ void TerminalWidget::setupFont()
{
QFont f;
f.setFixedPitch(true);
f.setFamily(settings().font.value());
f.setPointSize(settings().fontSize.value());
f.setFamily(settings().font());
f.setPointSize(settings().fontSize());
setFont(f);
}
@@ -241,12 +239,12 @@ void TerminalWidget::setupColors()
// Check if the colors have changed.
std::array<QColor, 20> newColors;
for (int i = 0; i < 16; ++i) {
newColors[i] = settings().colors[i].value();
newColors[i] = settings().colors[i]();
}
newColors[ColorIndex::Background] = settings().backgroundColor.value();
newColors[ColorIndex::Foreground] = settings().foregroundColor.value();
newColors[ColorIndex::Selection] = settings().selectionColor.value();
newColors[ColorIndex::FindMatch] = settings().findMatchColor.value();
newColors[ColorIndex::Background] = settings().backgroundColor();
newColors[ColorIndex::Foreground] = settings().foregroundColor();
newColors[ColorIndex::Selection] = settings().selectionColor();
newColors[ColorIndex::FindMatch] = settings().findMatchColor();
if (m_currentColors == newColors)
return;
@@ -401,7 +399,7 @@ void TerminalWidget::setupSurface()
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
});
connect(m_surface.get(), &Internal::TerminalSurface::bell, this, [] {
if (settings().audibleBell.value())
if (settings().audibleBell())
QApplication::beep();
});
connect(m_surface.get(),
@@ -438,7 +436,7 @@ void TerminalWidget::setupSurface()
void TerminalWidget::configBlinkTimer()
{
bool shouldRun = m_cursor.visible && m_cursor.blink && hasFocus()
&& settings().allowBlinkingCursor.value();
&& settings().allowBlinkingCursor();
if (shouldRun != m_cursorBlinkTimer.isActive()) {
if (shouldRun)
m_cursorBlinkTimer.start();

View File

@@ -477,7 +477,7 @@ CallgrindToolPrivate::CallgrindToolPrivate()
connect(m_searchFilter, &QLineEdit::textChanged,
&m_updateTimer, QOverload<>::of(&QTimer::start));
setCostFormat(CostDelegate::CostFormat(settings->costFormat.value()));
setCostFormat(CostDelegate::CostFormat(settings->costFormat()));
m_perspective.addToolBarAction(settings->detectCycles.action());
m_perspective.addToolBarAction(settings->shortenTemplates.action());
@@ -747,9 +747,9 @@ void CallgrindToolPrivate::setupRunner(CallgrindToolRunner *toolRunner)
// apply project settings
ValgrindProjectSettings settings;
settings.fromMap(runControl->settingsData(ANALYZER_VALGRIND_SETTINGS));
m_visualization->setMinimumInclusiveCostRatio(settings.visualizationMinimumInclusiveCostRatio.value() / 100.0);
m_proxyModel.setMinimumInclusiveCostRatio(settings.minimumInclusiveCostRatio.value() / 100.0);
m_dataModel.setVerboseToolTipsEnabled(settings.enableEventToolTips.value());
m_visualization->setMinimumInclusiveCostRatio(settings.visualizationMinimumInclusiveCostRatio() / 100.0);
m_proxyModel.setMinimumInclusiveCostRatio(settings.minimumInclusiveCostRatio() / 100.0);
m_dataModel.setVerboseToolTipsEnabled(settings.enableEventToolTips());
m_toolBusy = true;
updateRunActions();

View File

@@ -103,7 +103,7 @@ QStringList ValgrindToolRunner::genericToolArguments() const
{
QString smcCheckValue;
switch (m_settings.selfModifyingCodeDetection.value()) {
switch (m_settings.selfModifyingCodeDetection()) {
case ValgrindBaseSettings::DetectSmcNo:
smcCheckValue = "none";
break;