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 QList<MimeType> GeneralSettings::allowedMimeTypes() const
{ {
const QStringList stringTypes = autoFormatMime.value().split(';'); const QStringList stringTypes = autoFormatMime().split(';');
QList<MimeType> types; QList<MimeType> types;
for (QString t : stringTypes) { for (QString t : stringTypes) {

View File

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

View File

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

View File

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

View File

@@ -368,13 +368,13 @@ void CdbEngine::setupEngine()
if (s.ignoreFirstChanceAccessViolation()) if (s.ignoreFirstChanceAccessViolation())
debugger.addArg("-x"); debugger.addArg("-x");
const QStringList &sourcePaths = s.cdbSourcePaths.value(); const QStringList &sourcePaths = s.cdbSourcePaths();
if (!sourcePaths.isEmpty()) if (!sourcePaths.isEmpty())
debugger.addArgs({"-srcpath", sourcePaths.join(';')}); 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) { switch (sp.startMode) {
case StartInternal: case StartInternal:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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