Merge remote-tracking branch 'origin/4.9'

Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/tools/clangpchmanagerbackend/source/taskscheduler.h

Change-Id: I518adaf647df412887c2a372416634359f09ad2a
This commit is contained in:
Eike Ziller
2019-03-05 10:22:45 +01:00
60 changed files with 702 additions and 684 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 51 KiB

View File

@@ -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"

View File

@@ -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

View File

@@ -0,0 +1 @@
#include "definitiondownloader.h"

View File

@@ -16,6 +16,7 @@ Project {
files: [
"AbstractHighlighter",
"Definition",
"DefinitionDownloader",
"FoldingRegion",
"Format",
"Repository",

View File

@@ -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 \

View File

@@ -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 <QAbstractEventDispatcher>
#include <QCoreApplication>
#include <QThread>
template<typename Callable>
void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance())
{
if (QThread *thread = qobject_cast<QThread *>(object))
object = QAbstractEventDispatcher::instance(thread);
QMetaObject::invokeMethod(object, std::forward<Callable>(callable));
}

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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:

View File

@@ -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);

View File

@@ -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<Sqlite::Database> databaseInitializer{database};
ClangBackEnd::FilePathCaching filePathCache{database};
ClangPchManager::ProgressManager pchCreationProgressManager{[](QFutureInterface<void> &promise) {

View File

@@ -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: ");

View File

@@ -77,7 +77,9 @@ class ClangRefactoringPluginData
public:
using QuerySqliteReadStatementFactory = QuerySqliteStatementFactory<Sqlite::Database,
Sqlite::ReadStatement>;
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<Sqlite::Database> databaseInitializer{database};
ClangBackEnd::FilePathCaching filePathCache{database};
ClangPchManager::ProgressManager progressManager{

View File

@@ -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: ");

View File

@@ -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("<html>"

View File

@@ -35,6 +35,7 @@
#include <QSysInfo>
#include <QApplication>
#include <QStandardPaths>
/*!
\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() + '/'

View File

@@ -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);

View File

@@ -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);

View File

@@ -105,14 +105,7 @@
</layout>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="minimumSize">
<size>
<width>700</width>
<height>500</height>
</size>
</property>
</widget>
<widget class="QTabWidget" name="tabWidget"/>
</item>
</layout>
</item>

View File

@@ -23,7 +23,7 @@
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>See &lt;a href=&quot;https://github.com/KDE/clazy&quot;&gt;clazy's homepage&lt;/a&gt; for more information.</string>
<string>See &lt;a href=&quot;https://github.com/KDE/clazy&quot;&gt;Clazy's homepage&lt;/a&gt; for more information.</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>

View File

@@ -45,6 +45,7 @@
#include <utils/qtcassert.h>
#include <utils/proxyaction.h>
#include <utils/utilsicons.h>
#include <utils/stylehelper.h>
#include <QAction>
#include <QComboBox>
@@ -52,6 +53,7 @@
#include <QDockWidget>
#include <QHBoxLayout>
#include <QMenu>
#include <QScrollArea>
#include <QStackedWidget>
#include <QStandardItemModel>
#include <QTimer>
@@ -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);

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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."));
}
}

View File

@@ -19,7 +19,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label1">
<property name="text">
<string>&amp;Trace File:</string>
<string>&amp;Trace file:</string>
</property>
<property name="buddy">
<cstring>traceFileLineEdit</cstring>
@@ -39,7 +39,7 @@
<item row="1" column="0">
<widget class="QLabel" name="label2">
<property name="text">
<string>Directory of &amp;Executable:</string>
<string>Directory of &amp;executable:</string>
</property>
<property name="buddy">
<cstring>executableDirLineEdit</cstring>
@@ -64,7 +64,7 @@
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="ProjectExplorer::KitChooser" name="kitChooser" native="true"/>
<widget class="ProjectExplorer::KitChooser" name="kitChooser" native="true"/>
</item>
</layout>
</item>

View File

@@ -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."));
});
}

View File

@@ -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();

View File

@@ -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<PerfEvent>::ReplaySuccess:
return true;
case Timeline::TraceStashFile<PerfEvent>::ReplayOpenFailed:
m_errorHandler(tr("Cannot re-open temporary trace file"));
m_errorHandler(tr("Cannot re-open temporary trace file."));
break;
case Timeline::TraceStashFile<PerfEvent>::ReplayLoadFailed:
// Happens if the loader rejects an event. Not an actual error
break;
case Timeline::TraceStashFile<PerfEvent>::ReplayReadPastEnd:
m_errorHandler(tr("Read past end from temporary trace file"));
m_errorHandler(tr("Read past end from temporary trace file."));
break;
}
return false;

View File

@@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Creating memory trace points</string>
<string>Creating Memory Trace Points</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
@@ -29,7 +29,7 @@
<item>
<widget class="QLabel" name="privilegeslabel">
<property name="text">
<string>Elevate privileges using</string>
<string>Elevate privileges using:</string>
</property>
</widget>
</item>

View File

@@ -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();

View File

@@ -33,6 +33,7 @@
#include <coreplugin/documentmanager.h>
#include <coreplugin/fileiconprovider.h>
#include <coreplugin/id.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/buildtargetinfo.h>
@@ -61,6 +62,7 @@
#include <QTextCursor>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonParseError>
#include <QJsonValue>
#include <QJsonArray>
@@ -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<QString> 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<QString> 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"))

View File

@@ -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();

View File

@@ -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);

View File

@@ -111,8 +111,6 @@ public:
class BaseFileFindPrivate
{
public:
BaseFileFindPrivate() : m_internalSearchEngine(std::make_unique<InternalEngine>()) {}
QPointer<IFindSupport> m_currentFindSupport;
QLabel *m_resultLabel = nullptr;
@@ -125,7 +123,7 @@ public:
QPointer<QComboBox> m_filterCombo;
QPointer<QComboBox> m_exclusionCombo;
QVector<SearchEngine *> m_searchEngines;
std::unique_ptr<SearchEngine> 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()

View File

@@ -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<int>::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);

View File

@@ -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();

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>462</width>
<width>513</width>
<height>416</height>
</rect>
</property>
@@ -39,6 +39,16 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="builtinSchemeLabel">
<property name="text">
<string>&lt;p align='center'&gt;&lt;b&gt;Builtin color schemes need to be &lt;a href=&quot;copy&quot;&gt;copied&lt;/a&gt;&lt;br/&gt; before they can be changed&lt;/b&gt;&lt;/p&gt;</string>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="detailsScrollArea">
<property name="sizePolicy">
@@ -87,36 +97,68 @@
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="5" column="0" colspan="3">
<widget class="QLabel" name="relativeForegroundHeadline">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
<item row="30" column="0" colspan="3">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="text">
<string>Relative Foreground</string>
<property name="sizeHint" stdset="0">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="3">
<widget class="QWidget" name="foregroundSpacer" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>6</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="foregroundLabel">
<item row="1" column="1">
<widget class="QToolButton" name="foregroundToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Foreground:</string>
</property>
<property name="buddy">
<cstring>foregroundToolButton</cstring>
<string/>
</property>
</widget>
</item>
<item row="10" column="0" colspan="3">
<item row="10" column="0">
<widget class="QLabel" name="foregroundLightnessLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Lightness:</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="3">
<widget class="QWidget" name="relativeForegroundSpacer3" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -138,251 +180,7 @@
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="foregroundLightnessLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Lightness:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="foregroundToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="26" column="0" colspan="3">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="QToolButton" name="eraseBackgroundToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Erase background.</string>
</property>
<property name="text">
<string>x</string>
</property>
<property name="arrowType">
<enum>Qt::LeftArrow</enum>
</property>
</widget>
</item>
<item row="14" column="0" colspan="3">
<widget class="QWidget" name="relativeBackgroundSpacer2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>6</height>
</size>
</property>
</widget>
</item>
<item row="7" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="foregroundSaturationSpinBox">
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="15" column="0">
<widget class="QLabel" name="backgroundLightnessLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Lightness:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="eraseForegroundToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Erase foreground.</string>
</property>
<property name="text">
<string>x</string>
</property>
<property name="arrowType">
<enum>Qt::LeftArrow</enum>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="backgroundSaturationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Saturation:</string>
</property>
</widget>
</item>
<item row="19" column="1" colspan="2">
<widget class="QCheckBox" name="italicCheckBox">
<property name="text">
<string>Italic</string>
</property>
</widget>
</item>
<item row="9" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="foregroundLightnessSpinBox">
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QWidget" name="relativeForegroundSpacer1" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>6</height>
</size>
</property>
</widget>
</item>
<item row="13" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="backgroundSaturationSpinBox">
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="backgroundLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Background:</string>
</property>
<property name="buddy">
<cstring>backgroundToolButton</cstring>
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QWidget" name="backgroundSpacer" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>18</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item row="17" column="0">
<widget class="QLabel" name="fontHeadline">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
<item row="7" column="0">
<item row="8" column="0">
<widget class="QLabel" name="foregroundSaturationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -395,14 +193,7 @@
</property>
</widget>
</item>
<item row="19" column="0">
<widget class="QCheckBox" name="boldCheckBox">
<property name="text">
<string>Bold</string>
</property>
</widget>
</item>
<item row="18" column="0" colspan="3">
<item row="19" column="0" colspan="3">
<widget class="QWidget" name="fontSpacer1" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -424,73 +215,7 @@
</property>
</widget>
</item>
<item row="12" column="0" colspan="3">
<widget class="QWidget" name="relativeBackgroundSpacer1" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>6</height>
</size>
</property>
</widget>
</item>
<item row="16" column="0" colspan="3">
<widget class="QWidget" name="relativeBackgroundSpacer3" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>18</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item row="24" column="0" colspan="3">
<widget class="QWidget" name="underlineSpacer2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>6</height>
</size>
</property>
</widget>
</item>
<item row="22" column="0" colspan="3">
<item row="23" column="0" colspan="3">
<widget class="QWidget" name="underlineSpacer1" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -512,20 +237,23 @@
</property>
</widget>
</item>
<item row="23" column="1">
<widget class="QToolButton" name="underlineColorToolButton">
<item row="1" column="0">
<widget class="QLabel" name="foregroundLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
<string>Foreground:</string>
</property>
<property name="buddy">
<cstring>foregroundToolButton</cstring>
</property>
</widget>
</item>
<item row="21" column="0">
<item row="22" column="0">
<widget class="QLabel" name="underlineHeadline">
<property name="font">
<font>
@@ -538,23 +266,122 @@
</property>
</widget>
</item>
<item row="23" column="0">
<widget class="QLabel" name="underlineLabel">
<item row="6" column="0" colspan="3">
<widget class="QLabel" name="relativeForegroundHeadline">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Relative Foreground</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<widget class="QWidget" name="relativeForegroundSpacer1" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>6</height>
</size>
</property>
</widget>
</item>
<item row="16" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="backgroundLightnessSpinBox">
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QToolButton" name="eraseBackgroundToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Erase background.</string>
</property>
<property name="text">
<string>x</string>
</property>
<property name="arrowType">
<enum>Qt::LeftArrow</enum>
</property>
</widget>
</item>
<item row="13" column="0" colspan="3">
<widget class="QWidget" name="relativeBackgroundSpacer1" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>6</height>
</size>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QToolButton" name="backgroundToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Color:</string>
</property>
<property name="buddy">
<cstring>backgroundToolButton</cstring>
<string/>
</property>
</widget>
</item>
<item row="11" column="0" colspan="3">
<item row="16" column="0">
<widget class="QLabel" name="backgroundLightnessLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Lightness:</string>
</property>
</widget>
</item>
<item row="12" column="0" colspan="3">
<widget class="QLabel" name="relativeBackgroundHeadline">
<property name="font">
<font>
@@ -567,7 +394,173 @@
</property>
</widget>
</item>
<item row="20" column="0" colspan="3">
<item row="18" column="0">
<widget class="QLabel" name="fontHeadline">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
<item row="14" column="0">
<widget class="QLabel" name="backgroundSaturationLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Saturation:</string>
</property>
</widget>
</item>
<item row="14" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="backgroundSaturationSpinBox">
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="24" column="2">
<widget class="QToolButton" name="eraseUnderlineColorToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Erase background.</string>
</property>
<property name="text">
<string>x</string>
</property>
<property name="arrowType">
<enum>Qt::LeftArrow</enum>
</property>
</widget>
</item>
<item row="26" column="0" colspan="3">
<widget class="QComboBox" name="underlineComboBox"/>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="eraseForegroundToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Erase foreground.</string>
</property>
<property name="text">
<string>x</string>
</property>
<property name="arrowType">
<enum>Qt::LeftArrow</enum>
</property>
</widget>
</item>
<item row="15" column="0" colspan="3">
<widget class="QWidget" name="relativeBackgroundSpacer2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>6</height>
</size>
</property>
</widget>
</item>
<item row="20" column="0">
<widget class="QCheckBox" name="boldCheckBox">
<property name="text">
<string>Bold</string>
</property>
</widget>
</item>
<item row="17" column="0" colspan="3">
<widget class="QWidget" name="relativeBackgroundSpacer3" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>18</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>18</height>
</size>
</property>
</widget>
</item>
<item row="24" column="1">
<widget class="QToolButton" name="underlineColorToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="25" column="0" colspan="3">
<widget class="QWidget" name="underlineSpacer2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>6</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>6</height>
</size>
</property>
</widget>
</item>
<item row="21" column="0" colspan="3">
<widget class="QWidget" name="fontSpacer2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -589,8 +582,8 @@
</property>
</widget>
</item>
<item row="15" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="backgroundLightnessSpinBox">
<item row="10" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="foregroundLightnessSpinBox">
<property name="minimum">
<double>-1.000000000000000</double>
</property>
@@ -602,42 +595,20 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QToolButton" name="backgroundToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="8" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="foregroundSaturationSpinBox">
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="text">
<string/>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property>
</widget>
</item>
<item row="23" column="2">
<widget class="QToolButton" name="eraseUnderlineColorToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Erase background.</string>
</property>
<property name="text">
<string>x</string>
</property>
<property name="arrowType">
<enum>Qt::LeftArrow</enum>
</property>
</widget>
</item>
<item row="25" column="0" colspan="3">
<widget class="QComboBox" name="underlineComboBox"/>
</item>
<item row="8" column="0" colspan="3">
<item row="9" column="0" colspan="3">
<widget class="QWidget" name="relativeForegroundSpacer2" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -659,8 +630,47 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QWidget" name="foregroundSpacer" native="true">
<item row="24" column="0">
<widget class="QLabel" name="underlineLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Color:</string>
</property>
<property name="buddy">
<cstring>backgroundToolButton</cstring>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="backgroundLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Background:</string>
</property>
<property name="buddy">
<cstring>backgroundToolButton</cstring>
</property>
</widget>
</item>
<item row="20" column="1" colspan="2">
<widget class="QCheckBox" name="italicCheckBox">
<property name="text">
<string>Italic</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<widget class="QWidget" name="backgroundSpacer" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -670,13 +680,13 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>6</height>
<height>18</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>6</height>
<height>18</height>
</size>
</property>
</widget>

View File

@@ -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);

View File

@@ -25,7 +25,6 @@
#include "highlighter.h"
#include "definitiondownloader.h"
#include "highlightersettings.h"
#include "textdocumentlayout.h"
#include "texteditorsettings.h"
@@ -34,6 +33,7 @@
#include <coreplugin/messagemanager.h>
#include <utils/mimetypes/mimedatabase.h>
#include <DefinitionDownloader>
#include <Format>
#include <Repository>
#include <SyntaxHighlighter>

View File

@@ -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);
}

View File

@@ -29,6 +29,7 @@
#include <clangpathwatcher.h>
#include <connectionserver.h>
#include <environment.h>
#include <executeinloop.h>
#include <generatedfiles.h>
#include <modifiedtimechecker.h>
#include <pchcreator.h>
@@ -72,48 +73,6 @@ using ClangBackEnd::FilePathCache;
using ClangBackEnd::FilePathView;
using ClangBackEnd::TimeStamp;
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
template<typename CallableType>
class CallableEvent : public QEvent
{
public:
using Callable = std::decay_t<CallableType>;
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<typename Callable>
void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance())
{
if (QThread *thread = qobject_cast<QThread *>(object))
object = QAbstractEventDispatcher::instance(thread);
QCoreApplication::postEvent(object,
new CallableEvent<Callable>(std::forward<Callable>(callable)),
Qt::HighEventPriority);
}
#else
template<typename Callable>
void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance())
{
if (QThread *thread = qobject_cast<QThread *>(object))
object = QAbstractEventDispatcher::instance(thread);
QMetaObject::invokeMethod(object, std::forward<Callable>(callable));
}
#endif
class PchManagerApplication final : public QCoreApplication
{
public:

View File

@@ -126,6 +126,11 @@ public:
return FilePath("");
}
Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const
{
return m_getPrecompiledHeader.template value<ProjectPartPch, 2>(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};
};
}

View File

@@ -25,9 +25,12 @@
#pragma once
#include "projectpartpch.h"
#include <filepath.h>
#include <utils/smallstringvector.h>
#include <utils/optional.h>
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<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const = 0;
protected:
~PrecompiledHeaderStorageInterface() = default;

View File

@@ -30,6 +30,7 @@
#include "queueinterface.h"
#include "progresscounter.h"
#include <executeinloop.h>
#include <processormanagerinterface.h>
#include <symbolindexertaskqueueinterface.h>
#include <symbolscollectorinterface.h>
@@ -149,14 +150,6 @@ private:
m_futures.erase(split, m_futures.end());
}
template <typename Callable>
void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance()) {
if (QThread *thread = qobject_cast<QThread*>(object))
object = QAbstractEventDispatcher::instance(thread);
QMetaObject::invokeMethod(object, std::forward<Callable>(callable));
}
private:
std::vector<Future> m_futures;
ProcessorManager &m_processorManager;

View File

@@ -30,6 +30,7 @@
#include <QDir>
#include <connectionserver.h>
#include <executeinloop.h>
#include <filepathcaching.h>
#include <generatedfiles.h>
#include <refactoringserver.h>
@@ -51,48 +52,6 @@ using ClangBackEnd::RefactoringDatabaseInitializer;
using ClangBackEnd::ConnectionServer;
using ClangBackEnd::SymbolIndexing;
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
template<typename CallableType>
class CallableEvent : public QEvent
{
public:
using Callable = std::decay_t<CallableType>;
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<typename Callable>
void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance())
{
if (QThread *thread = qobject_cast<QThread *>(object))
object = QAbstractEventDispatcher::instance(thread);
QCoreApplication::postEvent(object,
new CallableEvent<Callable>(std::forward<Callable>(callable)),
Qt::HighEventPriority);
}
#else
template<typename Callable>
void executeInLoop(Callable &&callable, QObject *object = QCoreApplication::instance())
{
if (QThread *thread = qobject_cast<QThread *>(object))
object = QAbstractEventDispatcher::instance(thread);
QMetaObject::invokeMethod(object, std::forward<Callable>(callable));
}
#endif
QStringList processArguments(QCoreApplication &application)
{
QCommandLineParser parser;

View File

@@ -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<ProjectPartPch> optionalProjectPartPch = m_symbolStorage.fetchPrecompiledHeader(projectPartId);
const Utils::optional<ProjectPartPch> 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<ProjectPartPch> optionalProjectPartPch = m_symbolStorage.fetchPrecompiledHeader(
optionalArtefact->projectPartId);
const Utils::optional<ProjectPartPch> optionalProjectPartPch
= m_precompiledHeaderStorage.fetchPrecompiledHeader(optionalArtefact->projectPartId);
transaction.commit();
const ProjectPartArtefact &artefact = optionalArtefact.value();

View File

@@ -31,6 +31,7 @@
#include "builddependenciesstorageinterface.h"
#include "clangpathwatcher.h"
#include <precompiledheaderstorageinterface.h>
#include <projectpartcontainer.h>
#include <filecontainerv2.h>
@@ -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;

View File

@@ -35,6 +35,7 @@
#include "symbolstorage.h"
#include <builddependenciesstorage.h>
#include <precompiledheaderstorage.h>
#include <refactoringdatabaseinitializer.h>
#include <filepathcachingfwd.h>
@@ -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<SymbolsCollectorManager, SymbolIndexerTask::Callable>;
FilePathCachingInterface &m_filePathCache;
BuildDependenciesStorage m_buildDependencyStorage;
PrecompiledHeaderStorage<Sqlite::Database> m_recompiledHeaderStorage;
SymbolStorage m_symbolStorage;
ClangPathWatcher<QFileSystemWatcher, QTimer> 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,

View File

@@ -223,11 +223,6 @@ public:
m_deleteNewLocationsTableStatement.execute();
}
Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const
{
return m_getPrecompiledHeader.template value<ProjectPartPch, 2>(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

View File

@@ -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<ProjectPartArtefact> fetchProjectPartArtefact(
Utils::SmallStringView projectPartName) const = 0;
virtual Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const = 0;
protected:
~SymbolStorageInterface() = default;

View File

@@ -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"))

View File

@@ -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):

View File

@@ -6,5 +6,11 @@ inline static QString userResourcePath()
{
return QDir::tempPath();
}
inline static QString cacheResourcePath()
{
return QDir::tempPath();
}
} // namespace ICore
} // namespace Core

View File

@@ -45,4 +45,6 @@ public:
void(const Utils::SmallStringVector &projectPartNames));
MOCK_METHOD1(fetchSystemPrecompiledHeaderPath,
ClangBackEnd::FilePath(Utils::SmallStringView projectPartName));
MOCK_CONST_METHOD1(fetchPrecompiledHeader,
Utils::optional<ClangBackEnd::ProjectPartPch>(int projectPartId));
};

View File

@@ -53,6 +53,4 @@ public:
Utils::optional<ClangBackEnd::ProjectPartArtefact> (ClangBackEnd::FilePathId sourceId));
MOCK_CONST_METHOD1(fetchProjectPartArtefact,
Utils::optional<ClangBackEnd::ProjectPartArtefact> (Utils::SmallStringView projectPartName));
MOCK_CONST_METHOD1(fetchPrecompiledHeader,
Utils::optional<ClangBackEnd::ProjectPartPch> (int projectPartId));
};

View File

@@ -43,16 +43,12 @@ protected:
NiceMock<MockSqliteDatabase> 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));
}
}

View File

@@ -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> mockSqliteTransactionBackend;
NiceMock<MockSymbolStorage> mockSymbolStorage;
NiceMock<MockBuildDependenciesStorage> mockBuildDependenciesStorage;
NiceMock<MockPrecompiledHeaderStorage> mockPrecompiledHeaderStorage;
NiceMock<MockClangPathWatcher> 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<Utils::SmallStringView>(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<FilePathId>(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<FilePathId>(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<FilePathId>(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> symbolIndexerTask;
EXPECT_CALL(mockCollector,

View File

@@ -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;