diff --git a/doc/images/qtcreator-external-tools.png b/doc/images/qtcreator-external-tools.png index fbcdb1086e6..8caa35a2371 100644 Binary files a/doc/images/qtcreator-external-tools.png and b/doc/images/qtcreator-external-tools.png differ diff --git a/doc/src/baremetal/creator-baremetal-dev.qdoc b/doc/src/baremetal/creator-baremetal-dev.qdoc index 73eaa37ec33..594ad80ae5d 100644 --- a/doc/src/baremetal/creator-baremetal-dev.qdoc +++ b/doc/src/baremetal/creator-baremetal-dev.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -53,7 +53,7 @@ \li Select \uicontrol Tools > \uicontrol Options > \uicontrol Devices > \uicontrol {Bare Metal} > \uicontrol Add > \uicontrol Default, - \uicontrol OpenCD, or \uicontrol {ST-LINK Utility} to specify + \uicontrol OpenOCD, or \uicontrol {ST-LINK Utility} to specify connections to GDB servers or hardware debuggers: \image creator-baremetal-device.png "Bare Metal options" diff --git a/doc/src/howto/creator-only/creator-external-tools.qdoc b/doc/src/howto/creator-only/creator-external-tools.qdoc index b7f911dcd9a..a5038a65918 100644 --- a/doc/src/howto/creator-only/creator-external-tools.qdoc +++ b/doc/src/howto/creator-only/creator-external-tools.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Creator documentation. @@ -53,13 +53,12 @@ translation files for use by the released application. To synchronize translation source (TS) files from a translator with the - application code, - select \uicontrol {Tools > External > Text > Linguist > Update Translations - (lupdate)}. + application code, select \uicontrol Tools > \uicontrol External > + \uicontrol Linguist > \uicontrol {Update Translations (lupdate)}. To generate from the TS files Qt message (QM) files that can be used by an - application, select \uicontrol {Tools > External > Text > Linguist > Release - Translations (lrelease)}. + application, select \uicontrol Tools > \uicontrol External > + \uicontrol Linguist > \uicontrol {Release Translations (lrelease)}. By default, the project .pro file is passed to the tools as an argument. To specify other command line arguments for the tools, select \uicontrol {Tools > @@ -127,6 +126,13 @@ \li In the \uicontrol {Error output} field, select how to handle error messages from the tool. + \li In the \uicontrol {Base environment} field, select whether to run + the tool in the system environment or the \l{Build Environment} + {build environment} or \l {Selecting the Run Environment} + {run environment} of the active project. Select the build or run + environment if the system environment does not contain the necessary + PATH settings to find the tool chain, for example. + \li In the \uicontrol Environment field, select \uicontrol Change to modify environment variable values for build and run environments in the \uicontrol {Edit Environment Changes} dialog. For more information diff --git a/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/DefinitionDownloader b/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/DefinitionDownloader new file mode 100644 index 00000000000..2a82740d19b --- /dev/null +++ b/src/libs/3rdparty/syntax-highlighting/autogenerated/src/lib/DefinitionDownloader @@ -0,0 +1 @@ +#include "definitiondownloader.h" diff --git a/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.qbs b/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.qbs index 248ebe0fd4f..526265220c2 100644 --- a/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.qbs +++ b/src/libs/3rdparty/syntax-highlighting/syntax-highlighting.qbs @@ -16,6 +16,7 @@ Project { files: [ "AbstractHighlighter", "Definition", + "DefinitionDownloader", "FoldingRegion", "Format", "Repository", diff --git a/src/libs/clangsupport/clangsupport-lib.pri b/src/libs/clangsupport/clangsupport-lib.pri index 221ccfd001e..7ab8e47ac78 100644 --- a/src/libs/clangsupport/clangsupport-lib.pri +++ b/src/libs/clangsupport/clangsupport-lib.pri @@ -108,6 +108,7 @@ HEADERS += \ $$PWD/clangrefactoringservermessages.h \ $$PWD/alivemessage.h \ $$PWD/completionsmessage.h \ + $$PWD/executeinloop.h \ $$PWD/requestcompletionsmessage.h \ $$PWD/echomessage.h \ $$PWD/endmessage.h \ diff --git a/src/libs/clangsupport/executeinloop.h b/src/libs/clangsupport/executeinloop.h new file mode 100644 index 00000000000..3642c3ccd3a --- /dev/null +++ b/src/libs/clangsupport/executeinloop.h @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include +#include +#include + +template +void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance()) +{ + if (QThread *thread = qobject_cast(object)) + object = QAbstractEventDispatcher::instance(thread); + + QMetaObject::invokeMethod(object, std::forward(callable)); +} diff --git a/src/libs/sqlite/sqlitedatabase.cpp b/src/libs/sqlite/sqlitedatabase.cpp index 1ddaf2cfbcb..ef5205484c6 100644 --- a/src/libs/sqlite/sqlitedatabase.cpp +++ b/src/libs/sqlite/sqlitedatabase.cpp @@ -164,7 +164,7 @@ void Database::execute(Utils::SmallStringView sqlStatement) void Database::initializeTables() { try { - ImmediateTransaction transaction(*this); + ExclusiveTransaction transaction(*this); for (Table &table : m_sqliteTables) table.initialize(*this); diff --git a/src/libs/ssh/sftptransfer.cpp b/src/libs/ssh/sftptransfer.cpp index 57674cc94dd..7b65048a32d 100644 --- a/src/libs/ssh/sftptransfer.cpp +++ b/src/libs/ssh/sftptransfer.cpp @@ -149,7 +149,7 @@ void SftpTransfer::doStart() break; case Internal::FileTransferType::Download: if (!QDir::root().mkdir(dir)) { - emitError(tr("Failed to create local directory \"%1\"") + emitError(tr("Failed to create local directory \"%1\".") .arg(QDir::toNativeSeparators(dir))); return; } diff --git a/src/plugins/android/androidrunnerworker.cpp b/src/plugins/android/androidrunnerworker.cpp index 565ac17bac1..4b119642ec5 100644 --- a/src/plugins/android/androidrunnerworker.cpp +++ b/src/plugins/android/androidrunnerworker.cpp @@ -461,7 +461,7 @@ void AndroidRunnerWorker::asyncStartHelper() if (!m_gdbserverPath.isEmpty() && uploadGdbServer()) { gdbServerPrefix = "./"; } else { - emit remoteProcessFinished(tr("Cannot find/copy C++ debug server.")); + emit remoteProcessFinished(tr("Cannot find or copy C++ debug server.")); return; } } else { @@ -517,7 +517,7 @@ void AndroidRunnerWorker::asyncStartHelper() } if (!runAdb(args)) { - emit remoteProcessFinished(tr("Failed to start the activity")); + emit remoteProcessFinished(tr("Failed to start the activity.")); return; } } @@ -584,7 +584,7 @@ void AndroidRunnerWorker::handleJdbWaiting() runAdb(removeForward); if (!runAdb({"forward", "tcp:" + m_localJdbServerPort.toString(), "jdwp:" + QString::number(m_processPID)})) { - emit remoteProcessFinished(tr("Failed to forward jdb debugging ports.")); + emit remoteProcessFinished(tr("Failed to forward JDB debugging ports.")); return; } m_afterFinishAdbCommands.push_back(removeForward.join(' ')); @@ -603,7 +603,7 @@ void AndroidRunnerWorker::handleJdbWaiting() jdbProcess->setProcessChannelMode(QProcess::MergedChannels); jdbProcess->start(jdbPath.toString(), jdbArgs); if (!jdbProcess->waitForStarted()) { - emit remoteProcessFinished(tr("Failed to start jdb.")); + emit remoteProcessFinished(tr("Failed to start JDB.")); return; } m_jdbProcess = std::move(jdbProcess); @@ -643,7 +643,7 @@ void AndroidRunnerWorker::handleJdbSettled() } } } - emit remoteProcessFinished(tr("Cannot attach jdb to the running application")); + emit remoteProcessFinished(tr("Cannot attach JDB to the running application.")); } void AndroidRunnerWorker::onProcessIdChanged(qint64 pid) diff --git a/src/plugins/autotest/testresultmodel.cpp b/src/plugins/autotest/testresultmodel.cpp index 46d74064c6e..c5304fed86f 100644 --- a/src/plugins/autotest/testresultmodel.cpp +++ b/src/plugins/autotest/testresultmodel.cpp @@ -121,7 +121,7 @@ void TestResultItem::updateResult(bool &changed, Result::Type addedChildType) if (!TestResult::isMessageCaseStart(old)) return; - Result::Type newResult = Result::MessageTestCaseSuccess; + Result::Type newResult = old; switch (addedChildType) { case Result::Fail: case Result::MessageFatal: diff --git a/src/plugins/bineditor/bineditorwidget.cpp b/src/plugins/bineditor/bineditorwidget.cpp index 468e9bd0b77..2d177864530 100644 --- a/src/plugins/bineditor/bineditorwidget.cpp +++ b/src/plugins/bineditor/bineditorwidget.cpp @@ -1625,7 +1625,7 @@ void BinEditorWidget::contextMenuEvent(QContextMenuEvent *event) } else { jumpToBeAddressHereAction->setText(tr("Jump to Address in This Window")); jumpToBeAddressNewWindowAction->setText(tr("Jump to Address in New Window")); - copyBeValue->setText(tr("Copy value")); + copyBeValue->setText(tr("Copy Value")); jumpToBeAddressHereAction->setEnabled(false); jumpToBeAddressNewWindowAction->setEnabled(false); copyBeValue->setEnabled(false); diff --git a/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp b/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp index 8f7ea722426..7d564399b65 100644 --- a/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp +++ b/src/plugins/clangpchmanager/clangpchmanagerplugin.cpp @@ -62,7 +62,9 @@ QString backendProcessPath() class ClangPchManagerPluginData { public: - Sqlite::Database database{Utils::PathString{Core::ICore::userResourcePath() + "/symbol-experimental-v1.db"}, 1000ms}; + Sqlite::Database database{Utils::PathString{Core::ICore::cacheResourcePath() + + "/symbol-experimental-v1.db"}, + 1000ms}; ClangBackEnd::RefactoringDatabaseInitializer databaseInitializer{database}; ClangBackEnd::FilePathCaching filePathCache{database}; ClangPchManager::ProgressManager pchCreationProgressManager{[](QFutureInterface &promise) { diff --git a/src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp b/src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp index 6db0db09745..a8e7e7a2ef4 100644 --- a/src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp +++ b/src/plugins/clangpchmanager/pchmanagerconnectionclient.cpp @@ -51,11 +51,11 @@ ClangPchManager::PchManagerConnectionClient::PchManagerConnectionClient( { m_processCreator.setTemporaryDirectoryPattern("clangpchmanagerbackend-XXXXXX"); - QDir pchsDirectory(Core::ICore::userResourcePath()); + QDir pchsDirectory(Core::ICore::cacheResourcePath()); pchsDirectory.mkdir("pchs"); pchsDirectory.cd("pchs"); m_processCreator.setArguments({connectionName(), - Core::ICore::userResourcePath() + "/symbol-experimental-v1.db", + Core::ICore::cacheResourcePath() + "/symbol-experimental-v1.db", pchsDirectory.absolutePath()}); stdErrPrefixer().setPrefix("PchManagerConnectionClient.stderr: "); diff --git a/src/plugins/clangrefactoring/clangrefactoringplugin.cpp b/src/plugins/clangrefactoring/clangrefactoringplugin.cpp index 917823152e3..ea765bed5f8 100644 --- a/src/plugins/clangrefactoring/clangrefactoringplugin.cpp +++ b/src/plugins/clangrefactoring/clangrefactoringplugin.cpp @@ -77,7 +77,9 @@ class ClangRefactoringPluginData public: using QuerySqliteReadStatementFactory = QuerySqliteStatementFactory; - Sqlite::Database database{Utils::PathString{Core::ICore::userResourcePath() + "/symbol-experimental-v1.db"}, 1000ms}; + Sqlite::Database database{Utils::PathString{Core::ICore::cacheResourcePath() + + "/symbol-experimental-v1.db"}, + 1000ms}; ClangBackEnd::RefactoringDatabaseInitializer databaseInitializer{database}; ClangBackEnd::FilePathCaching filePathCache{database}; ClangPchManager::ProgressManager progressManager{ diff --git a/src/plugins/clangrefactoring/refactoringconnectionclient.cpp b/src/plugins/clangrefactoring/refactoringconnectionclient.cpp index ff66ec20cbf..a42ed38a161 100644 --- a/src/plugins/clangrefactoring/refactoringconnectionclient.cpp +++ b/src/plugins/clangrefactoring/refactoringconnectionclient.cpp @@ -48,8 +48,8 @@ RefactoringConnectionClient::RefactoringConnectionClient(RefactoringClientInterf , m_serverProxy(client) { m_processCreator.setTemporaryDirectoryPattern("clangrefactoringbackend-XXXXXX"); - m_processCreator.setArguments({connectionName(), - Core::ICore::userResourcePath() + "/symbol-experimental-v1.db"}); + m_processCreator.setArguments( + {connectionName(), Core::ICore::cacheResourcePath() + "/symbol-experimental-v1.db"}); stdErrPrefixer().setPrefix("RefactoringConnectionClient.stderr: "); stdOutPrefixer().setPrefix("RefactoringConnectionClient.stdout: "); diff --git a/src/plugins/clangtools/clangtoolsdiagnosticmodel.cpp b/src/plugins/clangtools/clangtoolsdiagnosticmodel.cpp index c52f670e703..ea6ec38fa38 100644 --- a/src/plugins/clangtools/clangtoolsdiagnosticmodel.cpp +++ b/src/plugins/clangtools/clangtoolsdiagnosticmodel.cpp @@ -245,7 +245,7 @@ static QString createDiagnosticToolTipString(const Diagnostic &diagnostic, Fixit createFullLocationString(diagnostic.location)); lines << qMakePair( - QCoreApplication::translate("ClangTools::Diagnostic", "Fixit Status:"), + QCoreApplication::translate("ClangTools::Diagnostic", "Fixit status:"), fixitStatus(fixItStatus)); QString html = QLatin1String("" diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp index f16f4369bb2..9cb23af6562 100644 --- a/src/plugins/coreplugin/icore.cpp +++ b/src/plugins/coreplugin/icore.cpp @@ -35,6 +35,7 @@ #include #include +#include /*! \namespace Core @@ -439,6 +440,11 @@ QString ICore::userResourcePath() return urp; } +QString ICore::cacheResourcePath() +{ + return QStandardPaths::writableLocation(QStandardPaths::CacheLocation); +} + QString ICore::installerResourcePath() { return QFileInfo(settings(QSettings::SystemScope)->fileName()).path() + '/' diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index 80e387658f4..5125345cffd 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -94,6 +94,7 @@ public: static QString resourcePath(); static QString userResourcePath(); + static QString cacheResourcePath(); static QString installerResourcePath(); static QString libexecPath(); static QString clangExecutable(const QString &clangBinDirectory); diff --git a/src/plugins/cpptools/clangdiagnosticconfigsmodel.cpp b/src/plugins/cpptools/clangdiagnosticconfigsmodel.cpp index 777dd27ca26..236bcfde202 100644 --- a/src/plugins/cpptools/clangdiagnosticconfigsmodel.cpp +++ b/src/plugins/cpptools/clangdiagnosticconfigsmodel.cpp @@ -167,7 +167,7 @@ static void addConfigForBuildSystem(ClangDiagnosticConfigsModel &model) ClangDiagnosticConfig config; config.setId("Builtin.BuildSystem"); config.setDisplayName(QCoreApplication::translate("ClangDiagnosticConfigsModel", - "Build-systems' warnings")); + "Build-system warnings")); config.setIsReadOnly(true); config.setUseBuildSystemWarnings(true); diff --git a/src/plugins/cpptools/clangdiagnosticconfigswidget.ui b/src/plugins/cpptools/clangdiagnosticconfigswidget.ui index af4824ae228..e80ccef4feb 100644 --- a/src/plugins/cpptools/clangdiagnosticconfigswidget.ui +++ b/src/plugins/cpptools/clangdiagnosticconfigswidget.ui @@ -105,14 +105,7 @@ - - - - 700 - 500 - - - + diff --git a/src/plugins/cpptools/clazychecks.ui b/src/plugins/cpptools/clazychecks.ui index 34d9aaf0c80..3abdd85aed7 100644 --- a/src/plugins/cpptools/clazychecks.ui +++ b/src/plugins/cpptools/clazychecks.ui @@ -23,7 +23,7 @@ - See <a href="https://github.com/KDE/clazy">clazy's homepage</a> for more information. + See <a href="https://github.com/KDE/clazy">Clazy's homepage</a> for more information. true diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 9acc34e6ab5..096c03db16c 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include @@ -52,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -189,14 +191,22 @@ DebuggerMainWindowPrivate::DebuggerMainWindowPrivate(DebuggerMainWindow *parent) hbox->addWidget(viewButton); hbox->addWidget(closeButton); + auto scrolledToolbar = new QScrollArea; + scrolledToolbar->setWidget(toolbar); + scrolledToolbar->setFrameStyle(QFrame::NoFrame); + scrolledToolbar->setWidgetResizable(true); + scrolledToolbar->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + scrolledToolbar->setFixedHeight(StyleHelper::navigationWidgetHeight()); + scrolledToolbar->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + auto dock = new QDockWidget(DebuggerMainWindow::tr("Toolbar"), q); dock->setObjectName("Toolbar"); dock->setFeatures(QDockWidget::NoDockWidgetFeatures); dock->setAllowedAreas(Qt::BottomDockWidgetArea); dock->setTitleBarWidget(new QWidget(dock)); // hide title bar dock->setProperty("managed_dockwidget", "true"); - toolbar->setParent(dock); - dock->setWidget(toolbar); + dock->setWidget(scrolledToolbar); + m_toolBarDock = dock; q->addDockWidget(Qt::BottomDockWidgetArea, m_toolBarDock); diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 9fdd6a27905..8dac6098973 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2524,7 +2524,8 @@ bool GitClient::getCommitData(const QString &workingDirectory, // Run status. Note that it has exitcode 1 if there are no added files. QString output; if (commitData.commitType == FixupCommit) { - synchronousLog(repoDirectory, {HEAD, "--not", "--remotes", "-n1"}, &output, errorMessage); + synchronousLog(repoDirectory, {HEAD, "--not", "--remotes", "-n1"}, &output, errorMessage, + VcsCommand::SuppressCommandLogging); if (output.isEmpty()) { *errorMessage = msgNoCommits(false); return false; diff --git a/src/plugins/perfprofiler/perfconfigwidget.cpp b/src/plugins/perfprofiler/perfconfigwidget.cpp index b267c2923f8..bb87d231331 100644 --- a/src/plugins/perfprofiler/perfconfigwidget.cpp +++ b/src/plugins/perfprofiler/perfconfigwidget.cpp @@ -211,7 +211,7 @@ void PerfConfigWidget::handleProcessFinished() if (tracePoints.isEmpty()) { Core::AsynchronousMessageBox::warning( - tr("No trace points found"), + tr("No Trace Points Found"), tr("Trace points can be defined with \"perf probe -a\".")); } else { for (const QByteArray &event : qAsConst(tracePoints)) { @@ -233,7 +233,7 @@ void PerfConfigWidget::handleProcessError(QProcess::ProcessError error) { if (error == QProcess::FailedToStart) { Core::AsynchronousMessageBox::warning( - tr("Cannot list trace points"), + tr("Cannot List Trace Points"), tr("\"perf probe -l\" failed to start. Is perf installed?")); m_ui->useTracePointsButton->setEnabled(true); } diff --git a/src/plugins/perfprofiler/perfdatareader.cpp b/src/plugins/perfprofiler/perfdatareader.cpp index f4b0d19c3c4..795a6974d34 100644 --- a/src/plugins/perfprofiler/perfdatareader.cpp +++ b/src/plugins/perfprofiler/perfdatareader.cpp @@ -75,8 +75,8 @@ PerfDataReader::PerfDataReader(QObject *parent) : } if (exitCode != 0) { QMessageBox::warning(Core::ICore::mainWindow(), - tr("Perf data parser failed"), - tr("The perf data parser failed to process all the samples. " + tr("Perf Data Parser Failed"), + tr("The Perf data parser failed to process all the samples. " "Your trace is incomplete. The exit code was %1.") .arg(exitCode)); } @@ -101,17 +101,17 @@ PerfDataReader::PerfDataReader(QObject *parent) : connect(&m_input, &QProcess::errorOccurred, this, [this](QProcess::ProcessError e){ switch (e) { case QProcess::FailedToStart: - emit processFailed(tr("perfparser failed to start")); + emit processFailed(tr("perfparser failed to start.")); QMessageBox::warning(Core::ICore::mainWindow(), - tr("Perf data parser failed"), - tr("Could not start the 'perfparser' utility program. " - "Make sure a working perf parser is available at the location " + tr("Perf Data Parser Failed"), + tr("Could not start the perfparser utility program. " + "Make sure a working Perf parser is available at the location " "given by the PERFPROFILER_PARSER_FILEPATH environment " "variable.")); break; case QProcess::Crashed: QMessageBox::warning(Core::ICore::mainWindow(), - tr("Perf data parser crashed"), + tr("Perf Data Parser Crashed"), tr("This is a bug. Please report it.")); break; case QProcess::ReadError: @@ -346,8 +346,8 @@ void PerfDataReader::writeChunk() m_input.kill(); emit finished(); QMessageBox::warning(Core::ICore::mainWindow(), - tr("Cannot send data to Perf data parser"), - tr("The perf data parser doesn't accept further input. " + tr("Cannot Send Data to Perf Data Parser"), + tr("The Perf data parser does not accept further input. " "Your trace is incomplete.")); } } diff --git a/src/plugins/perfprofiler/perfloaddialog.ui b/src/plugins/perfprofiler/perfloaddialog.ui index 5bc41cd26ba..c08b6433f1a 100644 --- a/src/plugins/perfprofiler/perfloaddialog.ui +++ b/src/plugins/perfprofiler/perfloaddialog.ui @@ -19,7 +19,7 @@ - &Trace File: + &Trace file: traceFileLineEdit @@ -39,7 +39,7 @@ - Directory of &Executable: + Directory of &executable: executableDirLineEdit @@ -64,7 +64,7 @@ - + diff --git a/src/plugins/perfprofiler/perfprofilerruncontrol.cpp b/src/plugins/perfprofiler/perfprofilerruncontrol.cpp index d01d5c07568..50aa9696a11 100644 --- a/src/plugins/perfprofiler/perfprofilerruncontrol.cpp +++ b/src/plugins/perfprofiler/perfprofilerruncontrol.cpp @@ -138,10 +138,10 @@ public: // The terminate() below will frequently lead to QProcess::Crashed. We're not interested // in that. FailedToStart is the only actual failure. if (e == QProcess::FailedToStart) { - QString msg = tr("perf process failed to start"); + QString msg = tr("Perf Process Failed to Start"); QMessageBox::warning(Core::ICore::mainWindow(), - msg, tr("Make sure you are running a recent Linux kernel and " - "that the 'perf' utility is available.")); + msg, tr("Make sure that you are running a recent Linux kernel and " + "that the \"perf\" utility is available.")); reportFailure(msg); } }); @@ -227,7 +227,7 @@ void PerfProfilerRunner::start() }); connect(recorder, &DeviceProcess::readyReadStandardOutput, this, [this, reader, recorder] { if (!reader->feedParser(recorder->readAllStandardOutput())) - reportFailure(tr("Failed to transfer perf data to perfparser")); + reportFailure(tr("Failed to transfer Perf data to perfparser.")); }); } diff --git a/src/plugins/perfprofiler/perfprofilertool.cpp b/src/plugins/perfprofiler/perfprofilertool.cpp index 662e9ef5484..5a25c32e9f6 100644 --- a/src/plugins/perfprofiler/perfprofilertool.cpp +++ b/src/plugins/perfprofiler/perfprofilertool.cpp @@ -89,19 +89,19 @@ PerfProfilerTool::PerfProfilerTool(QObject *parent) : options->menu()->setEnabled(true); const Core::Context globalContext(Core::Constants::C_GLOBAL); - m_loadPerfData = new QAction(tr("Load perf.data file"), options); + m_loadPerfData = new QAction(tr("Load perf.data File"), options); Core::Command *command = Core::ActionManager::registerAction( m_loadPerfData, Constants::PerfProfilerTaskLoadPerf, globalContext); connect(m_loadPerfData, &QAction::triggered, this, &PerfProfilerTool::showLoadPerfDialog); options->addAction(command); - m_loadTrace = new QAction(tr("Load trace file"), options); + m_loadTrace = new QAction(tr("Load Trace File"), options); command = Core::ActionManager::registerAction(m_loadTrace, Constants::PerfProfilerTaskLoadTrace, globalContext); connect(m_loadTrace, &QAction::triggered, this, &PerfProfilerTool::showLoadTraceDialog); options->addAction(command); - m_saveTrace = new QAction(tr("Save trace file"), options); + m_saveTrace = new QAction(tr("Save Trace File"), options); command = Core::ActionManager::registerAction(m_saveTrace, Constants::PerfProfilerTaskSaveTrace, globalContext); connect(m_saveTrace, &QAction::triggered, this, &PerfProfilerTool::showSaveTraceDialog); @@ -126,7 +126,7 @@ PerfProfilerTool::PerfProfilerTool(QObject *parent) : }); options->addAction(command); - QAction *tracePointsAction = new QAction(tr("Create memory trace points"), options); + QAction *tracePointsAction = new QAction(tr("Create Memory Trace Points"), options); tracePointsAction->setIcon(Debugger::Icons::TRACEPOINT_TOOLBAR.icon()); tracePointsAction->setIconVisibleInMenu(false); tracePointsAction->setToolTip(tr("Create trace points for memory profiling on the target " @@ -141,7 +141,7 @@ PerfProfilerTool::PerfProfilerTool(QObject *parent) : m_tracePointsButton->setDefaultAction(tracePointsAction); auto action = new QAction(tr("Performance Analyzer"), this); - action->setToolTip(tr("The Performance Analyzer can be used to find performance bottlenecks")); + action->setToolTip(tr("Finds performance bottlenecks.")); menu->addAction(ActionManager::registerAction(action, Constants::PerfProfilerLocalActionId), Debugger::Constants::G_ANALYZER_TOOLS); QObject::connect(action, &QAction::triggered, this, [this] { @@ -251,7 +251,7 @@ void PerfProfilerTool::createViews() connect(m_recordButton, &QAbstractButton::clicked, this, &PerfProfilerTool::setRecording); m_clearButton->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon()); - m_clearButton->setToolTip(tr("Discard data")); + m_clearButton->setToolTip(tr("Discard data.")); connect(m_clearButton, &QAbstractButton::clicked, this, &PerfProfilerTool::clear); m_filterButton->setIcon(Utils::Icons::FILTER.icon()); @@ -410,10 +410,10 @@ void PerfProfilerTool::onReaderFinished() m_readerRunning = false; if (m_traceManager->traceDuration() <= 0) { QMessageBox::warning(Core::ICore::mainWindow(), - tr("No data loaded"), + tr("No Data Loaded"), tr("The profiler did not produce any samples. " - "Make sure you are running a recent Linux kernel and that the " - "'perf' utility is available and generates useful call " + "Make sure that you are running a recent Linux kernel and that " + "the \"perf\" utility is available and generates useful call " "graphs.")); clear(); } else { @@ -612,7 +612,7 @@ void PerfProfilerTool::showLoadTraceDialog() m_perspective.select(); QString filename = QFileDialog::getOpenFileName( - ICore::mainWindow(), tr("Load trace file"), + ICore::mainWindow(), tr("Load Trace File"), "", tr("Trace File (*.ptr)")); if (filename.isEmpty()) return; @@ -627,7 +627,7 @@ void PerfProfilerTool::showSaveTraceDialog() m_perspective.select(); QString filename = QFileDialog::getSaveFileName( - ICore::mainWindow(), tr("Save trace file"), + ICore::mainWindow(), tr("Save Trace File"), "", tr("Trace File (*.ptr)")); if (filename.isEmpty()) return; @@ -641,8 +641,8 @@ void PerfProfilerTool::showSaveTraceDialog() void PerfProfilerTool::setAggregated(bool aggregated) { m_aggregateButton->setChecked(aggregated); - m_aggregateButton->setToolTip(aggregated ? tr("Show all addresses") - : tr("Aggregate by functions")); + m_aggregateButton->setToolTip(aggregated ? tr("Show all addresses.") + : tr("Aggregate by functions.")); emit aggregatedChanged(aggregated); } @@ -653,8 +653,8 @@ void PerfProfilerTool::setRecording(bool recording) m_recordButton->setIcon(recording ? recordOn : recordOff); m_recordButton->setChecked(recording); - m_recordButton->setToolTip(recording ? tr("Stop collecting profile data") : - tr("Collect profile data")); + m_recordButton->setToolTip(recording ? tr("Stop collecting profile data.") : + tr("Collect profile data.")); emit recordingChanged(recording); } @@ -668,7 +668,7 @@ void PerfProfilerTool::updateTime(qint64 duration, qint64 delay) m_recordedLabel->clear(); if (delay > 0) - m_delayLabel->setText(tr("Processing Delay: %1.%2s").arg(delay / e9) + m_delayLabel->setText(tr("Processing delay: %1.%2s").arg(delay / e9) .arg(qAbs(delay / e8) % ten)); else if (delay == 0) m_delayLabel->clear(); diff --git a/src/plugins/perfprofiler/perfprofilertracemanager.cpp b/src/plugins/perfprofiler/perfprofilertracemanager.cpp index a4272ad1177..4e98b969548 100644 --- a/src/plugins/perfprofiler/perfprofilertracemanager.cpp +++ b/src/plugins/perfprofiler/perfprofilertracemanager.cpp @@ -94,13 +94,13 @@ void PerfProfilerEventStorage::clear() m_file.clear(); m_size = 0; if (!m_file.open()) - m_errorHandler(tr("Failed to reset temporary trace file")); + m_errorHandler(tr("Failed to reset temporary trace file.")); } void PerfProfilerEventStorage::finalize() { if (!m_file.flush()) - m_errorHandler(tr("Failed to flush temporary trace file")); + m_errorHandler(tr("Failed to flush temporary trace file.")); } bool PerfProfilerEventStorage::replay( @@ -110,13 +110,13 @@ bool PerfProfilerEventStorage::replay( case Timeline::TraceStashFile::ReplaySuccess: return true; case Timeline::TraceStashFile::ReplayOpenFailed: - m_errorHandler(tr("Cannot re-open temporary trace file")); + m_errorHandler(tr("Cannot re-open temporary trace file.")); break; case Timeline::TraceStashFile::ReplayLoadFailed: // Happens if the loader rejects an event. Not an actual error break; case Timeline::TraceStashFile::ReplayReadPastEnd: - m_errorHandler(tr("Read past end from temporary trace file")); + m_errorHandler(tr("Read past end from temporary trace file.")); break; } return false; diff --git a/src/plugins/perfprofiler/perftracepointdialog.ui b/src/plugins/perfprofiler/perftracepointdialog.ui index 8b2a077a998..ce2f1f4c408 100644 --- a/src/plugins/perfprofiler/perftracepointdialog.ui +++ b/src/plugins/perfprofiler/perftracepointdialog.ui @@ -11,7 +11,7 @@ - Creating memory trace points + Creating Memory Trace Points @@ -29,7 +29,7 @@ - Elevate privileges using + Elevate privileges using: diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 26763ed5d55..c9c28846f6a 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -1490,7 +1490,7 @@ ClangToolChainConfigWidget::ClangToolChainConfigWidget(ClangToolChain *tc) : m_parentToolchainCombo = new QComboBox(this); m_mainLayout->insertRow(m_mainLayout->rowCount() - 1, - tr("Parent Toolchain:"), + tr("Parent toolchain:"), m_parentToolchainCombo); ToolChainManager *tcManager = ToolChainManager::instance(); diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp index 9de4989a936..f85d248a537 100644 --- a/src/plugins/pythoneditor/pythoneditorplugin.cpp +++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -61,6 +62,7 @@ #include #include #include +#include #include #include @@ -342,30 +344,48 @@ static QStringList readLines(const Utils::FileName &projectFile) return lines; } -static QStringList readLinesJson(const Utils::FileName &projectFile) +static QStringList readLinesJson(const Utils::FileName &projectFile, + QString *errorMessage) { const QString projectFileName = projectFile.fileName(); QStringList lines = { projectFileName }; QFile file(projectFile.toString()); - if (!file.open(QFile::ReadOnly)) + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + *errorMessage = PythonProject::tr("Unable to open \"%1\" for reading: %2") + .arg(projectFile.toUserOutput(), file.errorString()); return lines; + } + const QByteArray content = file.readAll(); // This assumes te project file is formed with only one field called // 'files' that has a list associated of the files to include in the project. - if (!content.isEmpty()) { - const QJsonDocument doc = QJsonDocument::fromJson(content); - const QJsonObject obj = doc.object(); - if (obj.contains("files")) { - QJsonValue files = obj.value("files"); - QJsonArray files_array = files.toArray(); - QSet visited; - for (const auto &file : files_array) - visited.insert(file.toString()); + if (content.isEmpty()) { + *errorMessage = PythonProject::tr("Unable read \"%1\": The file is empty.") + .arg(projectFile.toUserOutput()); + return lines; + } - lines.append(visited.toList()); - } + QJsonParseError error; + const QJsonDocument doc = QJsonDocument::fromJson(content, &error); + if (doc.isNull()) { + const int line = content.left(error.offset).count('\n') + 1; + *errorMessage = PythonProject::tr("Unable parse %1:%2: %3") + .arg(projectFile.toUserOutput()).arg(line) + .arg(error.errorString()); + return lines; + } + + const QJsonObject obj = doc.object(); + if (obj.contains("files")) { + QJsonValue files = obj.value("files"); + QJsonArray files_array = files.toArray(); + QSet visited; + for (const auto &file : files_array) + visited.insert(file.toString()); + + lines.append(visited.toList()); } return lines; @@ -451,8 +471,12 @@ void PythonProject::parseProject() m_rawListEntries.clear(); const Utils::FileName filePath = projectFilePath(); // The PySide project file is JSON based - if (filePath.endsWith(".pyproject")) - m_rawFileList = readLinesJson(filePath); + if (filePath.endsWith(".pyproject")) { + QString errorMessage; + m_rawFileList = readLinesJson(filePath, &errorMessage); + if (!errorMessage.isEmpty()) + Core::MessageManager::write(errorMessage); + } // To keep compatibility with PyQt we keep the compatibility with plain // text files as project files. else if (filePath.endsWith(".pyqtc")) diff --git a/src/plugins/qnx/qnxdevicetester.cpp b/src/plugins/qnx/qnxdevicetester.cpp index a710210ce3b..b1374519d8a 100644 --- a/src/plugins/qnx/qnxdevicetester.cpp +++ b/src/plugins/qnx/qnxdevicetester.cpp @@ -130,7 +130,7 @@ void QnxDeviceTester::handleVarRunProcessFinished(const QString &error) m_result = TestFailure; } } else { - emit errorMessage(tr("An error occurred checking that" + emit errorMessage(tr("An error occurred while checking that" " files can be created in /var/run.") + QLatin1Char('\n')); m_result = TestFailure; @@ -162,7 +162,7 @@ void QnxDeviceTester::handleProcessFinished(const QString &error) m_result = TestFailure; } } else { - emit errorMessage(tr("An error occurred checking for %1.").arg(command) + QLatin1Char('\n')); + emit errorMessage(tr("An error occurred while checking for %1.").arg(command) + QLatin1Char('\n')); m_result = TestFailure; } testNextCommand(); diff --git a/src/plugins/silversearcher/findinfilessilversearcher.cpp b/src/plugins/silversearcher/findinfilessilversearcher.cpp index fc65d06a07c..5b22cc2cd4a 100644 --- a/src/plugins/silversearcher/findinfilessilversearcher.cpp +++ b/src/plugins/silversearcher/findinfilessilversearcher.cpp @@ -176,8 +176,6 @@ FindInFilesSilverSearcher::FindInFilesSilverSearcher(QObject *parent) setEnabled(isSilverSearcherAvailable()); if (!isEnabled()) { - auto layout = new QHBoxLayout(m_widget); - layout->setMargin(0); QLabel *label = new QLabel(tr("Silver Searcher is not available on the system.")); label->setStyleSheet("QLabel { color : red; }"); layout->addWidget(label); diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index a910de019c0..eb449251c16 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -111,8 +111,6 @@ public: class BaseFileFindPrivate { public: - BaseFileFindPrivate() : m_internalSearchEngine(std::make_unique()) {} - QPointer m_currentFindSupport; QLabel *m_resultLabel = nullptr; @@ -125,7 +123,7 @@ public: QPointer m_filterCombo; QPointer m_exclusionCombo; QVector m_searchEngines; - std::unique_ptr m_internalSearchEngine; + InternalEngine m_internalSearchEngine; int m_currentSearchEngineIndex = -1; }; @@ -182,7 +180,7 @@ void SearchEngine::setEnabled(bool enabled) BaseFileFind::BaseFileFind() : d(new BaseFileFindPrivate) { - addSearchEngine(d->m_internalSearchEngine.get()); + addSearchEngine(&d->m_internalSearchEngine); } BaseFileFind::~BaseFileFind() diff --git a/src/plugins/texteditor/colorschemeedit.cpp b/src/plugins/texteditor/colorschemeedit.cpp index 193b0564e8a..ec316880bd2 100644 --- a/src/plugins/texteditor/colorschemeedit.cpp +++ b/src/plugins/texteditor/colorschemeedit.cpp @@ -155,6 +155,7 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) : m_ui->detailsScrollArea->viewport()->setAutoFillBackground(false); m_ui->scrollAreaWidgetContents->setAutoFillBackground(false); m_ui->itemList->setModel(m_formatsModel); + m_ui->builtinSchemeLabel->setVisible(m_readOnly); populateUnderlineStyleComboBox(); @@ -186,6 +187,7 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) : this, &ColorSchemeEdit::eraseUnderlineColor); connect(m_ui->underlineComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &ColorSchemeEdit::changeUnderlineStyle); + connect(m_ui->builtinSchemeLabel, &QLabel::linkActivated, this, &ColorSchemeEdit::copyScheme); } ColorSchemeEdit::~ColorSchemeEdit() @@ -214,31 +216,9 @@ void ColorSchemeEdit::setReadOnly(bool readOnly) m_readOnly = readOnly; - const bool enabled = !readOnly; - m_ui->foregroundLabel->setEnabled(enabled); - m_ui->foregroundToolButton->setEnabled(enabled); - m_ui->backgroundLabel->setEnabled(enabled); - m_ui->backgroundToolButton->setEnabled(enabled); - m_ui->eraseBackgroundToolButton->setEnabled(enabled); - m_ui->eraseForegroundToolButton->setEnabled(enabled); - m_ui->relativeForegroundHeadline->setEnabled(enabled); - m_ui->foregroundSaturationLabel->setEnabled(enabled); - m_ui->foregroundLightnessLabel->setEnabled(enabled); - m_ui->foregroundSaturationSpinBox->setEnabled(enabled); - m_ui->foregroundLightnessSpinBox->setEnabled(enabled); - m_ui->relativeBackgroundHeadline->setEnabled(enabled); - m_ui->backgroundSaturationLabel->setEnabled(enabled); - m_ui->backgroundLightnessLabel->setEnabled(enabled); - m_ui->backgroundSaturationSpinBox->setEnabled(enabled); - m_ui->backgroundLightnessSpinBox->setEnabled(enabled); - m_ui->fontHeadline->setEnabled(enabled); - m_ui->boldCheckBox->setEnabled(enabled); - m_ui->italicCheckBox->setEnabled(enabled); - m_ui->underlineHeadline->setEnabled(enabled); - m_ui->underlineLabel->setEnabled(enabled); - m_ui->underlineColorToolButton->setEnabled(enabled); - m_ui->eraseUnderlineColorToolButton->setEnabled(enabled); - m_ui->underlineComboBox->setEnabled(enabled); + m_ui->detailsScrollArea->setVisible(!readOnly); + m_ui->builtinSchemeLabel->setVisible(readOnly); + updateControls(); } void ColorSchemeEdit::setColorScheme(const ColorScheme &colorScheme) @@ -278,7 +258,8 @@ void ColorSchemeEdit::updateForegroundControls() const auto &formatDescription = m_descriptions[m_curItem]; const Format &format = m_scheme.formatFor(formatDescription.id()); - bool isVisible = formatDescription.showControl(FormatDescription::ShowForegroundControl); + bool isVisible = !m_readOnly + && formatDescription.showControl(FormatDescription::ShowForegroundControl); m_ui->relativeForegroundHeadline->setEnabled(isVisible); m_ui->foregroundLabel->setVisible(isVisible); @@ -297,7 +278,8 @@ void ColorSchemeEdit::updateBackgroundControls() const auto formatDescription = m_descriptions[m_curItem]; const Format &format = m_scheme.formatFor(formatDescription.id()); - bool isVisible = formatDescription.showControl(FormatDescription::ShowBackgroundControl); + bool isVisible = !m_readOnly + && formatDescription.showControl(FormatDescription::ShowBackgroundControl); m_ui->relativeBackgroundHeadline->setVisible(isVisible); m_ui->backgroundLabel->setVisible(isVisible); @@ -319,7 +301,8 @@ void ColorSchemeEdit::updateRelativeForegroundControls() QSignalBlocker saturationSignalBlocker(m_ui->foregroundSaturationSpinBox); QSignalBlocker lightnessSignalBlocker(m_ui->foregroundLightnessSpinBox); - bool isVisible = formatDescription.showControl(FormatDescription::ShowRelativeForegroundControl); + bool isVisible = !m_readOnly + && formatDescription.showControl(FormatDescription::ShowRelativeForegroundControl); m_ui->relativeForegroundHeadline->setVisible(isVisible); m_ui->foregroundSaturationLabel->setVisible(isVisible); @@ -350,7 +333,8 @@ void ColorSchemeEdit::updateRelativeBackgroundControls() QSignalBlocker saturationSignalBlocker(m_ui->backgroundSaturationSpinBox); QSignalBlocker lightnessSignalBlocker(m_ui->backgroundLightnessSpinBox); - bool isVisible = formatDescription.showControl(FormatDescription::ShowRelativeBackgroundControl); + bool isVisible = !m_readOnly + && formatDescription.showControl(FormatDescription::ShowRelativeBackgroundControl); m_ui->relativeBackgroundHeadline->setVisible(isVisible); m_ui->backgroundSaturationLabel->setVisible(isVisible); @@ -381,7 +365,8 @@ void ColorSchemeEdit::updateFontControls() QSignalBlocker boldSignalBlocker(m_ui->boldCheckBox); QSignalBlocker italicSignalBlocker(m_ui->italicCheckBox); - bool isVisible= formatDescription.showControl(FormatDescription::ShowFontControls); + bool isVisible = !m_readOnly + && formatDescription.showControl(FormatDescription::ShowFontControls); m_ui->fontHeadline->setVisible(isVisible); m_ui->boldCheckBox->setVisible(isVisible); @@ -401,7 +386,8 @@ void ColorSchemeEdit::updateUnderlineControls() QSignalBlocker comboBoxSignalBlocker(m_ui->underlineComboBox); - bool isVisible= formatDescription.showControl(FormatDescription::ShowUnderlineControl); + bool isVisible = !m_readOnly + && formatDescription.showControl(FormatDescription::ShowUnderlineControl); m_ui->underlineHeadline->setVisible(isVisible); m_ui->underlineLabel->setVisible(isVisible); diff --git a/src/plugins/texteditor/colorschemeedit.h b/src/plugins/texteditor/colorschemeedit.h index 6a1356609bf..f7504c170f8 100644 --- a/src/plugins/texteditor/colorschemeedit.h +++ b/src/plugins/texteditor/colorschemeedit.h @@ -59,6 +59,9 @@ public: void setColorScheme(const ColorScheme &colorScheme); const ColorScheme &colorScheme() const; +signals: + void copyScheme(); + private: void currentItemChanged(const QModelIndex &index); void changeForeColor(); diff --git a/src/plugins/texteditor/colorschemeedit.ui b/src/plugins/texteditor/colorschemeedit.ui index e9bb34596ba..ded11ef21f0 100644 --- a/src/plugins/texteditor/colorschemeedit.ui +++ b/src/plugins/texteditor/colorschemeedit.ui @@ -6,7 +6,7 @@ 0 0 - 462 + 513 416 @@ -39,6 +39,16 @@ + + + + <p align='center'><b>Builtin color schemes need to be <a href="copy">copied</a><br/> before they can be changed</b></p> + + + false + + + @@ -87,36 +97,68 @@ 0 - - - - - 75 - true - + + + + Qt::Vertical - - Relative Foreground + + + 200 + 0 + + + + + + + + + 0 + 0 + + + + + 0 + 6 + + + + + 16777215 + 6 + - - + + - + 0 0 - Foreground: - - - foregroundToolButton + - + + + + + 0 + 0 + + + + Lightness: + + + + @@ -138,251 +180,7 @@ - - - - - 0 - 0 - - - - Lightness: - - - - - - - - 0 - 0 - - - - - - - - - - - Qt::Vertical - - - - 200 - 0 - - - - - - - - - 0 - 0 - - - - Erase background. - - - x - - - Qt::LeftArrow - - - - - - - - 0 - 0 - - - - - 0 - 6 - - - - - 16777215 - 6 - - - - - - - - -1.000000000000000 - - - 1.000000000000000 - - - 0.050000000000000 - - - - - - - - 0 - 0 - - - - Lightness: - - - - - - - - 0 - 0 - - - - Erase foreground. - - - x - - - Qt::LeftArrow - - - - - - - - 0 - 0 - - - - Saturation: - - - - - - - Italic - - - - - - - -1.000000000000000 - - - 1.000000000000000 - - - 0.050000000000000 - - - - - - - - 0 - 0 - - - - - 0 - 6 - - - - - 16777215 - 6 - - - - - - - - -1.000000000000000 - - - 1.000000000000000 - - - 0.050000000000000 - - - - - - - - 0 - 0 - - - - Background: - - - backgroundToolButton - - - - - - - - 0 - 0 - - - - - 0 - 18 - - - - - 16777215 - 18 - - - - - - - - - 75 - true - - - - Font - - - - + @@ -395,14 +193,7 @@ - - - - Bold - - - - + @@ -424,73 +215,7 @@ - - - - - 0 - 0 - - - - - 0 - 6 - - - - - 16777215 - 6 - - - - - - - - - 0 - 0 - - - - - 0 - 18 - - - - - 16777215 - 18 - - - - - - - - - 0 - 0 - - - - - 0 - 6 - - - - - 16777215 - 6 - - - - - + @@ -512,20 +237,23 @@ - - + + - + 0 0 - + Foreground: + + + foregroundToolButton - + @@ -538,23 +266,122 @@ - - + + + + + 75 + true + + + + Relative Foreground + + + + + - + + 0 + 0 + + + + + 0 + 6 + + + + + 16777215 + 6 + + + + + + + + -1.000000000000000 + + + 1.000000000000000 + + + 0.050000000000000 + + + + + + + + 0 + 0 + + + + Erase background. + + + x + + + Qt::LeftArrow + + + + + + + + 0 + 0 + + + + + 0 + 6 + + + + + 16777215 + 6 + + + + + + + + 0 0 - Color: - - - backgroundToolButton + - + + + + + 0 + 0 + + + + Lightness: + + + + @@ -567,7 +394,173 @@ - + + + + + 75 + true + + + + Font + + + + + + + + 0 + 0 + + + + Saturation: + + + + + + + -1.000000000000000 + + + 1.000000000000000 + + + 0.050000000000000 + + + + + + + + 0 + 0 + + + + Erase background. + + + x + + + Qt::LeftArrow + + + + + + + + + + + 0 + 0 + + + + Erase foreground. + + + x + + + Qt::LeftArrow + + + + + + + + 0 + 0 + + + + + 0 + 6 + + + + + 16777215 + 6 + + + + + + + + Bold + + + + + + + + 0 + 0 + + + + + 0 + 18 + + + + + 16777215 + 18 + + + + + + + + + 0 + 0 + + + + + + + + + + + + 0 + 0 + + + + + 0 + 6 + + + + + 16777215 + 6 + + + + + @@ -589,8 +582,8 @@ - - + + -1.000000000000000 @@ -602,42 +595,20 @@ - - - - - 0 - 0 - + + + + -1.000000000000000 - - + + 1.000000000000000 + + + 0.050000000000000 - - - - - 0 - 0 - - - - Erase background. - - - x - - - Qt::LeftArrow - - - - - - - + @@ -659,8 +630,47 @@ - - + + + + + 0 + 0 + + + + Color: + + + backgroundToolButton + + + + + + + + 0 + 0 + + + + Background: + + + backgroundToolButton + + + + + + + Italic + + + + + 0 @@ -670,13 +680,13 @@ 0 - 6 + 18 16777215 - 6 + 18 diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index ed79d3a4e67..cb783fa7bbe 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -376,6 +376,8 @@ QWidget *FontSettingsPage::widget() this, &FontSettingsPage::colorSchemeSelected); connect(d_ptr->m_ui->copyButton, &QPushButton::clicked, this, &FontSettingsPage::openCopyColorSchemeDialog); + connect(d_ptr->m_ui->schemeEdit, &ColorSchemeEdit::copyScheme, + this, &FontSettingsPage::openCopyColorSchemeDialog); connect(d_ptr->m_ui->deleteButton, &QPushButton::clicked, this, &FontSettingsPage::confirmDeleteColorScheme); diff --git a/src/plugins/texteditor/highlighter.cpp b/src/plugins/texteditor/highlighter.cpp index b21af3644c8..4178dc7195f 100644 --- a/src/plugins/texteditor/highlighter.cpp +++ b/src/plugins/texteditor/highlighter.cpp @@ -25,7 +25,6 @@ #include "highlighter.h" -#include "definitiondownloader.h" #include "highlightersettings.h" #include "textdocumentlayout.h" #include "texteditorsettings.h" @@ -34,6 +33,7 @@ #include #include +#include #include #include #include diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 7def2dc94f7..d66759cd171 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -575,7 +575,7 @@ VcsBaseSubmitEditor::PromptSubmitResult message = tr("What do you want to do with these changes?"); } else { message = tr("Cannot %1%2.\nWhat do you want to do?", - "%2 is an optional error message with ': ' prefix. Do not separate it from %1.") + "%2 is an optional error message with ': ' prefix. Don't add space in front.") .arg(commitName.toLower(), errorMessage.isEmpty() ? errorMessage : ": " + errorMessage); } diff --git a/src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp b/src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp index 17af1a2bc31..89567b8d386 100644 --- a/src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp +++ b/src/tools/clangpchmanagerbackend/clangpchmanagerbackendmain.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -72,48 +73,6 @@ using ClangBackEnd::FilePathCache; using ClangBackEnd::FilePathView; using ClangBackEnd::TimeStamp; -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) -template -class CallableEvent : public QEvent -{ -public: - using Callable = std::decay_t; - CallableEvent(Callable &&callable) - : QEvent(QEvent::None) - , callable(std::move(callable)) - {} - CallableEvent(const Callable &callable) - : QEvent(QEvent::None) - , callable(callable) - {} - - ~CallableEvent() { callable(); } - -public: - Callable callable; -}; - -template -void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance()) -{ - if (QThread *thread = qobject_cast(object)) - object = QAbstractEventDispatcher::instance(thread); - - QCoreApplication::postEvent(object, - new CallableEvent(std::forward(callable)), - Qt::HighEventPriority); -} -#else -template -void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance()) -{ - if (QThread *thread = qobject_cast(object)) - object = QAbstractEventDispatcher::instance(thread); - - QMetaObject::invokeMethod(object, std::forward(callable)); -} -#endif - class PchManagerApplication final : public QCoreApplication { public: diff --git a/src/tools/clangpchmanagerbackend/source/precompiledheaderstorage.h b/src/tools/clangpchmanagerbackend/source/precompiledheaderstorage.h index 022f5d926bd..7d1069b9988 100644 --- a/src/tools/clangpchmanagerbackend/source/precompiledheaderstorage.h +++ b/src/tools/clangpchmanagerbackend/source/precompiledheaderstorage.h @@ -126,6 +126,11 @@ public: return FilePath(""); } + Utils::optional fetchPrecompiledHeader(int projectPartId) const + { + return m_getPrecompiledHeader.template value(projectPartId); + } + public: Sqlite::ImmediateNonThrowingDestructorTransaction m_transaction; Database &m_database; @@ -155,6 +160,10 @@ public: "SELECT systemPchPath FROM precompiledHeaders WHERE projectPartId = (SELECT projectPartId " "FROM projectParts WHERE projectPartName = ?)", m_database}; + mutable ReadStatement m_getPrecompiledHeader{ + "SELECT ifnull(nullif(projectPchPath, ''), systemPchPath), " + "projectPchBuildTime FROM precompiledHeaders WHERE projectPartId = ?", + m_database}; }; } diff --git a/src/tools/clangpchmanagerbackend/source/precompiledheaderstorageinterface.h b/src/tools/clangpchmanagerbackend/source/precompiledheaderstorageinterface.h index 2a7e11604b2..06833be4a2b 100644 --- a/src/tools/clangpchmanagerbackend/source/precompiledheaderstorageinterface.h +++ b/src/tools/clangpchmanagerbackend/source/precompiledheaderstorageinterface.h @@ -25,9 +25,12 @@ #pragma once +#include "projectpartpch.h" + #include #include +#include namespace ClangBackEnd { @@ -50,6 +53,7 @@ public: = 0; virtual void deleteSystemPrecompiledHeaders(const Utils::SmallStringVector &projectPartNames) = 0; virtual FilePath fetchSystemPrecompiledHeaderPath(Utils::SmallStringView projectPartName) = 0; + virtual Utils::optional fetchPrecompiledHeader(int projectPartId) const = 0; protected: ~PrecompiledHeaderStorageInterface() = default; diff --git a/src/tools/clangpchmanagerbackend/source/taskscheduler.h b/src/tools/clangpchmanagerbackend/source/taskscheduler.h index 3d2b03ae977..7ae70c9f66e 100644 --- a/src/tools/clangpchmanagerbackend/source/taskscheduler.h +++ b/src/tools/clangpchmanagerbackend/source/taskscheduler.h @@ -30,6 +30,7 @@ #include "queueinterface.h" #include "progresscounter.h" +#include #include #include #include @@ -149,14 +150,6 @@ private: m_futures.erase(split, m_futures.end()); } - template - void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance()) { - if (QThread *thread = qobject_cast(object)) - object = QAbstractEventDispatcher::instance(thread); - - QMetaObject::invokeMethod(object, std::forward(callable)); - } - private: std::vector m_futures; ProcessorManager &m_processorManager; diff --git a/src/tools/clangrefactoringbackend/clangrefactoringbackendmain.cpp b/src/tools/clangrefactoringbackend/clangrefactoringbackendmain.cpp index 876c047fb85..9579f760c9c 100644 --- a/src/tools/clangrefactoringbackend/clangrefactoringbackendmain.cpp +++ b/src/tools/clangrefactoringbackend/clangrefactoringbackendmain.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -51,48 +52,6 @@ using ClangBackEnd::RefactoringDatabaseInitializer; using ClangBackEnd::ConnectionServer; using ClangBackEnd::SymbolIndexing; -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) -template -class CallableEvent : public QEvent -{ -public: - using Callable = std::decay_t; - CallableEvent(Callable &&callable) - : QEvent(QEvent::None) - , callable(std::move(callable)) - {} - CallableEvent(const Callable &callable) - : QEvent(QEvent::None) - , callable(callable) - {} - - ~CallableEvent() { callable(); } - -public: - Callable callable; -}; - -template -void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance()) -{ - if (QThread *thread = qobject_cast(object)) - object = QAbstractEventDispatcher::instance(thread); - - QCoreApplication::postEvent(object, - new CallableEvent(std::forward(callable)), - Qt::HighEventPriority); -} -#else -template -void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance()) -{ - if (QThread *thread = qobject_cast(object)) - object = QAbstractEventDispatcher::instance(thread); - - QMetaObject::invokeMethod(object, std::forward(callable)); -} -#endif - QStringList processArguments(QCoreApplication &application) { QCommandLineParser parser; diff --git a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp index 2b4e90cf5a4..6928e497125 100644 --- a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp +++ b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp @@ -60,18 +60,20 @@ private: SymbolIndexer::SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue, SymbolStorageInterface &symbolStorage, - BuildDependenciesStorageInterface &usedMacroAndSourceStorage, + BuildDependenciesStorageInterface &buildDependenciesStorage, + PrecompiledHeaderStorageInterface &precompiledHeaderStorage, ClangPathWatcherInterface &pathWatcher, FilePathCachingInterface &filePathCache, FileStatusCache &fileStatusCache, Sqlite::TransactionInterface &transactionInterface) - : m_symbolIndexerTaskQueue(symbolIndexerTaskQueue), - m_symbolStorage(symbolStorage), - m_buildDependencyStorage(usedMacroAndSourceStorage), - m_pathWatcher(pathWatcher), - m_filePathCache(filePathCache), - m_fileStatusCache(fileStatusCache), - m_transactionInterface(transactionInterface) + : m_symbolIndexerTaskQueue(symbolIndexerTaskQueue) + , m_symbolStorage(symbolStorage) + , m_buildDependencyStorage(buildDependenciesStorage) + , m_precompiledHeaderStorage(precompiledHeaderStorage) + , m_pathWatcher(pathWatcher) + , m_filePathCache(filePathCache) + , m_fileStatusCache(fileStatusCache) + , m_transactionInterface(transactionInterface) { pathWatcher.setNotifier(this); } @@ -97,7 +99,8 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart) projectPart.languageExtension); if (optionalArtefact) projectPartId = optionalArtefact->projectPartId; - const Utils::optional optionalProjectPartPch = m_symbolStorage.fetchPrecompiledHeader(projectPartId); + const Utils::optional optionalProjectPartPch + = m_precompiledHeaderStorage.fetchPrecompiledHeader(projectPartId); FilePathIds sourcePathIds = updatableFilePathIds(projectPart, optionalArtefact); transaction.commit(); @@ -179,8 +182,8 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId, if (!optionalArtefact) return; - const Utils::optional optionalProjectPartPch = m_symbolStorage.fetchPrecompiledHeader( - optionalArtefact->projectPartId); + const Utils::optional optionalProjectPartPch + = m_precompiledHeaderStorage.fetchPrecompiledHeader(optionalArtefact->projectPartId); transaction.commit(); const ProjectPartArtefact &artefact = optionalArtefact.value(); diff --git a/src/tools/clangrefactoringbackend/source/symbolindexer.h b/src/tools/clangrefactoringbackend/source/symbolindexer.h index bee726abf42..33c691e4dd5 100644 --- a/src/tools/clangrefactoringbackend/source/symbolindexer.h +++ b/src/tools/clangrefactoringbackend/source/symbolindexer.h @@ -31,6 +31,7 @@ #include "builddependenciesstorageinterface.h" #include "clangpathwatcher.h" +#include #include #include @@ -43,7 +44,8 @@ class SymbolIndexer final : public ClangPathWatcherNotifier public: SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue, SymbolStorageInterface &symbolStorage, - BuildDependenciesStorageInterface &usedMacroAndSourceStorage, + BuildDependenciesStorageInterface &buildDependenciesStorage, + PrecompiledHeaderStorageInterface &precompiledHeaderStorage, ClangPathWatcherInterface &pathWatcher, FilePathCachingInterface &filePathCache, FileStatusCache &fileStatusCache, @@ -71,6 +73,7 @@ private: SymbolIndexerTaskQueueInterface &m_symbolIndexerTaskQueue; SymbolStorageInterface &m_symbolStorage; BuildDependenciesStorageInterface &m_buildDependencyStorage; + PrecompiledHeaderStorageInterface &m_precompiledHeaderStorage; ClangPathWatcherInterface &m_pathWatcher; FilePathCachingInterface &m_filePathCache; FileStatusCache &m_fileStatusCache; diff --git a/src/tools/clangrefactoringbackend/source/symbolindexing.h b/src/tools/clangrefactoringbackend/source/symbolindexing.h index 62be193682c..5b8b2221f06 100644 --- a/src/tools/clangrefactoringbackend/source/symbolindexing.h +++ b/src/tools/clangrefactoringbackend/source/symbolindexing.h @@ -35,6 +35,7 @@ #include "symbolstorage.h" #include +#include #include #include @@ -83,6 +84,7 @@ public: ProgressCounter::SetProgressCallback &&setProgressCallback) : m_filePathCache(filePathCache) , m_buildDependencyStorage(database) + , m_recompiledHeaderStorage(database) , m_symbolStorage(database) , m_collectorManger(generatedFiles, database) , m_progressCounter(std::move(setProgressCallback)) @@ -119,6 +121,7 @@ private: using SymbolIndexerTaskScheduler = TaskScheduler; FilePathCachingInterface &m_filePathCache; BuildDependenciesStorage m_buildDependencyStorage; + PrecompiledHeaderStorage m_recompiledHeaderStorage; SymbolStorage m_symbolStorage; ClangPathWatcher m_sourceWatcher{m_filePathCache}; FileStatusCache m_fileStatusCache{m_filePathCache}; @@ -127,6 +130,7 @@ private: SymbolIndexer m_indexer{m_indexerQueue, m_symbolStorage, m_buildDependencyStorage, + m_recompiledHeaderStorage, m_sourceWatcher, m_filePathCache, m_fileStatusCache, diff --git a/src/tools/clangrefactoringbackend/source/symbolstorage.h b/src/tools/clangrefactoringbackend/source/symbolstorage.h index f1fdbc7c02e..3b7141c7838 100644 --- a/src/tools/clangrefactoringbackend/source/symbolstorage.h +++ b/src/tools/clangrefactoringbackend/source/symbolstorage.h @@ -223,11 +223,6 @@ public: m_deleteNewLocationsTableStatement.execute(); } - Utils::optional fetchPrecompiledHeader(int projectPartId) const - { - return m_getPrecompiledHeader.template value(projectPartId); - } - SourceLocationEntries sourceLocations() const { return SourceLocationEntries(); @@ -350,10 +345,6 @@ public: "projectIncludeSearchPaths, projectPartId, language, languageVersion, languageExtension " "FROM projectParts WHERE projectPartName = ?", m_database}; - mutable ReadStatement m_getPrecompiledHeader{ - "SELECT projectPchPath, projectPchBuildTime FROM precompiledHeaders WHERE projectPartId = ?", - m_database - }; }; } // namespace ClangBackEnd diff --git a/src/tools/clangrefactoringbackend/source/symbolstorageinterface.h b/src/tools/clangrefactoringbackend/source/symbolstorageinterface.h index c10c7fca48e..5f2e6c30e68 100644 --- a/src/tools/clangrefactoringbackend/source/symbolstorageinterface.h +++ b/src/tools/clangrefactoringbackend/source/symbolstorageinterface.h @@ -27,7 +27,6 @@ #include "filestatus.h" #include "projectpartentry.h" -#include "projectpartpch.h" #include "projectpartartefact.h" #include "sourcelocationentry.h" #include "sourcedependency.h" @@ -67,7 +66,6 @@ public: FilePathId sourceId) const = 0; virtual Utils::optional fetchProjectPartArtefact( Utils::SmallStringView projectPartName) const = 0; - virtual Utils::optional fetchPrecompiledHeader(int projectPartId) const = 0; protected: ~SymbolStorageInterface() = default; diff --git a/tests/system/shared/clang.py b/tests/system/shared/clang.py index 810f652b0b3..04cd836e66a 100644 --- a/tests/system/shared/clang.py +++ b/tests/system/shared/clang.py @@ -65,6 +65,6 @@ def getCodeModelString(useClang): def checkCodeModelSettings(useClang): __openCodeModelOptions__() - test.verify(verifyChecked("{name='ignorePCHCheckBox' type='QCheckBox' visible='1'}"), - "Verifying whether 'Ignore pre-compiled headers' is checked by default.") + test.log("Verifying whether 'Ignore pre-compiled headers' is unchecked by default.") + verifyChecked("{name='ignorePCHCheckBox' type='QCheckBox' visible='1'}", False) clickButton(waitForObject(":Options.OK_QPushButton")) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index f89b9c6e2d3..36b5fbfc4e8 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -42,9 +42,9 @@ def tempDir(): def deleteDirIfExists(path): shutil.rmtree(path, True) -def verifyChecked(objectName): +def verifyChecked(objectName, checked=True): object = waitForObject(objectName) - test.compare(object.checked, True) + test.compare(object.checked, checked) return object def ensureChecked(objectName, shouldBeChecked = True, timeout=20000): diff --git a/tests/unit/mockup/coreplugin/icore.h b/tests/unit/mockup/coreplugin/icore.h index cfec03f999a..579fbc3b56f 100644 --- a/tests/unit/mockup/coreplugin/icore.h +++ b/tests/unit/mockup/coreplugin/icore.h @@ -6,5 +6,11 @@ inline static QString userResourcePath() { return QDir::tempPath(); } + +inline static QString cacheResourcePath() +{ + return QDir::tempPath(); +} + } // namespace ICore } // namespace Core diff --git a/tests/unit/unittest/mockprecompiledheaderstorage.h b/tests/unit/unittest/mockprecompiledheaderstorage.h index a2bc0fddf0a..72eefcc1d1a 100644 --- a/tests/unit/unittest/mockprecompiledheaderstorage.h +++ b/tests/unit/unittest/mockprecompiledheaderstorage.h @@ -45,4 +45,6 @@ public: void(const Utils::SmallStringVector &projectPartNames)); MOCK_METHOD1(fetchSystemPrecompiledHeaderPath, ClangBackEnd::FilePath(Utils::SmallStringView projectPartName)); + MOCK_CONST_METHOD1(fetchPrecompiledHeader, + Utils::optional(int projectPartId)); }; diff --git a/tests/unit/unittest/mocksymbolstorage.h b/tests/unit/unittest/mocksymbolstorage.h index 0e4422012e7..325e18b1c97 100644 --- a/tests/unit/unittest/mocksymbolstorage.h +++ b/tests/unit/unittest/mocksymbolstorage.h @@ -53,6 +53,4 @@ public: Utils::optional (ClangBackEnd::FilePathId sourceId)); MOCK_CONST_METHOD1(fetchProjectPartArtefact, Utils::optional (Utils::SmallStringView projectPartName)); - MOCK_CONST_METHOD1(fetchPrecompiledHeader, - Utils::optional (int projectPartId)); }; diff --git a/tests/unit/unittest/precompiledheaderstorage-test.cpp b/tests/unit/unittest/precompiledheaderstorage-test.cpp index fb65aa7c809..22dffe3c29c 100644 --- a/tests/unit/unittest/precompiledheaderstorage-test.cpp +++ b/tests/unit/unittest/precompiledheaderstorage-test.cpp @@ -43,16 +43,12 @@ protected: NiceMock database; Storage storage{database}; MockSqliteWriteStatement &insertProjectPartStatement = storage.m_insertProjectPartStatement; - MockSqliteWriteStatement &insertProjectPrecompiledHeaderStatement - = storage.m_insertProjectPrecompiledHeaderStatement; - MockSqliteWriteStatement &deleteProjectPrecompiledHeaderStatement - = storage.m_deleteProjectPrecompiledHeaderStatement; - MockSqliteWriteStatement &insertSystemPrecompiledHeaderStatement - = storage.m_insertSystemPrecompiledHeaderStatement; - MockSqliteWriteStatement &deleteSystemPrecompiledHeaderStatement - = storage.m_deleteSystemPrecompiledHeaderStatement; - MockSqliteReadStatement &fetchSystemPrecompiledHeaderPathStatement - = storage.m_fetchSystemPrecompiledHeaderPathStatement; + MockSqliteWriteStatement &insertProjectPrecompiledHeaderStatement = storage.m_insertProjectPrecompiledHeaderStatement; + MockSqliteWriteStatement &deleteProjectPrecompiledHeaderStatement = storage.m_deleteProjectPrecompiledHeaderStatement; + MockSqliteWriteStatement &insertSystemPrecompiledHeaderStatement = storage.m_insertSystemPrecompiledHeaderStatement; + MockSqliteWriteStatement &deleteSystemPrecompiledHeaderStatement = storage.m_deleteSystemPrecompiledHeaderStatement; + MockSqliteReadStatement &fetchSystemPrecompiledHeaderPathStatement = storage.m_fetchSystemPrecompiledHeaderPathStatement; + MockSqliteReadStatement &getPrecompiledHeader = storage.m_getPrecompiledHeader; }; TEST_F(PrecompiledHeaderStorage, UseTransaction) @@ -241,4 +237,21 @@ TEST_F(PrecompiledHeaderStorage, FetchSystemPrecompiledHeaderReturnsNullOptional ASSERT_THAT(path, IsEmpty()); } + +TEST_F(PrecompiledHeaderStorage, FetchPrecompiledHeaderCallsValueInStatement) +{ + EXPECT_CALL(getPrecompiledHeader, valueReturnProjectPartPch(Eq(25))); + + storage.fetchPrecompiledHeader(25); +} + +TEST_F(PrecompiledHeaderStorage, FetchPrecompiledHeader) +{ + ClangBackEnd::ProjectPartPch pch{"", "/path/to/pch", 131}; + EXPECT_CALL(getPrecompiledHeader, valueReturnProjectPartPch(Eq(25))).WillRepeatedly(Return(pch)); + + auto precompiledHeader = storage.fetchPrecompiledHeader(25); + + ASSERT_THAT(precompiledHeader.value(), Eq(pch)); +} } diff --git a/tests/unit/unittest/symbolindexer-test.cpp b/tests/unit/unittest/symbolindexer-test.cpp index 0a7b6acba19..eecd388f024 100644 --- a/tests/unit/unittest/symbolindexer-test.cpp +++ b/tests/unit/unittest/symbolindexer-test.cpp @@ -26,6 +26,7 @@ #include "googletest.h" #include "filesystem-utilities.h" #include "mockclangpathwatcher.h" +#include "mockprecompiledheaderstorage.h" #include "mocksymbolscollector.h" #include "mocksymbolstorage.h" #include "mockfilepathcaching.h" @@ -237,6 +238,7 @@ protected: NiceMock mockSqliteTransactionBackend; NiceMock mockSymbolStorage; NiceMock mockBuildDependenciesStorage; + NiceMock mockPrecompiledHeaderStorage; NiceMock mockPathWatcher; ClangBackEnd::FileStatusCache fileStatusCache{filePathCache}; ClangBackEnd::GeneratedFiles generatedFiles; @@ -246,6 +248,7 @@ protected: ClangBackEnd::SymbolIndexer indexer{indexerQueue, mockSymbolStorage, mockBuildDependenciesStorage, + mockPrecompiledHeaderStorage, mockPathWatcher, filePathCache, fileStatusCache, @@ -292,7 +295,8 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesInCollector) TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesWithPrecompiledHeaderInCollector) { ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq(projectPart1.projectPartId))).WillByDefault(Return(emptyArtefact)); - ON_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))).WillByDefault(Return(projectPartPch)); + ON_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))) + .WillByDefault(Return(projectPartPch)); EXPECT_CALL(mockCollector, setFile(main1PathId, @@ -506,7 +510,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderWithoutProjectPartArtifact) Eq(Utils::LanguageVersion::CXX14), Eq(Utils::LanguageExtension::None))) .WillOnce(Return(12)); - EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(12))); + EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(12))); EXPECT_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).Times(0); EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockCollector, @@ -559,7 +563,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderWithProjectPartArtifact) Eq(Utils::LanguageVersion::CXX14), Eq(Utils::LanguageExtension::None))) .WillOnce(Return(-1)); - EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))); + EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))); EXPECT_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).WillOnce(Return(-1)); EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockCollector, @@ -614,7 +618,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderButGetsAnErrorForCollectingS Eq(Utils::LanguageVersion::CXX14), Eq(Utils::LanguageExtension::None))) .WillOnce(Return(12)); - EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(12))); + EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(12))); EXPECT_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).Times(0); EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockCollector, @@ -656,7 +660,14 @@ TEST_F(SymbolIndexer, CallSetNotifier) { EXPECT_CALL(mockPathWatcher, setNotifier(_)); - ClangBackEnd::SymbolIndexer indexer{indexerQueue, mockSymbolStorage, mockBuildDependenciesStorage, mockPathWatcher, filePathCache, fileStatusCache, mockSqliteTransactionBackend}; + ClangBackEnd::SymbolIndexer indexer{indexerQueue, + mockSymbolStorage, + mockBuildDependenciesStorage, + mockPrecompiledHeaderStorage, + mockPathWatcher, + filePathCache, + fileStatusCache, + mockSqliteTransactionBackend}; } TEST_F(SymbolIndexer, PathChangedCallsFetchProjectPartArtefactInStorage) @@ -673,7 +684,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathCallsInOrder) EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq(sourceFileIds[0]))).WillOnce(Return(artefact)); - EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))); + EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))); EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockCollector, setFile(Eq(sourceFileIds[0]), @@ -715,7 +726,7 @@ TEST_F(SymbolIndexer, HandleEmptyOptionalArtifactInUpdateChangedPath) EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(sourceFileIds[0])).WillOnce(Return(nullArtefact)); - EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(_)).Times(0); + EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(_)).Times(0); EXPECT_CALL(mockSqliteTransactionBackend, commit()).Times(0); EXPECT_CALL(mockCollector, setFile(_, _)).Times(0); EXPECT_CALL(mockCollector, collectSymbols()).Times(0); @@ -737,7 +748,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathCallsInOrderButGetsAnErrorForCollectingSy EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq(sourceFileIds[0]))) .WillOnce(Return(artefact)); - EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))); + EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))); EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockCollector, setFile(Eq(sourceFileIds[0]), @@ -779,8 +790,8 @@ TEST_F(SymbolIndexer, UpdateChangedPathIsUsingPrecompiledHeader) { ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq(sourceFileIds[0]))) .WillByDefault(Return(artefact)); - ON_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))) - .WillByDefault(Return(projectPartPch)); + ON_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))) + .WillByDefault(Return(projectPartPch)); std::vector symbolIndexerTask; EXPECT_CALL(mockCollector, diff --git a/tests/unit/unittest/symbolstorage-test.cpp b/tests/unit/unittest/symbolstorage-test.cpp index c960a028bc3..f9a3d0a7dee 100644 --- a/tests/unit/unittest/symbolstorage-test.cpp +++ b/tests/unit/unittest/symbolstorage-test.cpp @@ -74,7 +74,6 @@ protected: MockSqliteWriteStatement &insertProjectPartSourcesStatement = storage.m_insertProjectPartSourcesStatement; MockSqliteReadStatement &getProjectPartArtefactsBySourceId = storage.m_getProjectPartArtefactsBySourceId; MockSqliteReadStatement &getProjectPartArtefactsByProjectPartName = storage.m_getProjectPartArtefactsByProjectPartName; - MockSqliteReadStatement &getPrecompiledHeader = storage.m_getPrecompiledHeader; SymbolEntries symbolEntries{{1, {"functionUSR", "function", SymbolKind::Function}}, {2, {"function2USR", "function2", SymbolKind::Function}}}; @@ -261,24 +260,6 @@ TEST_F(SymbolStorage, FetchProjectPartArtefactByProjectNameReturnArtefact) ASSERT_THAT(result, Eq(artefact)); } -TEST_F(SymbolStorage, FetchPrecompiledHeaderCallsValueInStatement) -{ - EXPECT_CALL(getPrecompiledHeader, valueReturnProjectPartPch(Eq(25))); - - storage.fetchPrecompiledHeader(25); -} - -TEST_F(SymbolStorage, FetchPrecompiledHeader) -{ - ClangBackEnd::ProjectPartPch pch{"", "/path/to/pch", 131}; - EXPECT_CALL(getPrecompiledHeader, valueReturnProjectPartPch(Eq(25))) - .WillRepeatedly(Return(pch)); - - auto precompiledHeader = storage.fetchPrecompiledHeader(25); - - ASSERT_THAT(precompiledHeader.value(), Eq(pch)); -} - TEST_F(SymbolStorage, AddNewSymbolsTable) { InSequence s;