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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -53,7 +53,7 @@
\li Select \uicontrol Tools > \uicontrol Options > \uicontrol Devices > \li Select \uicontrol Tools > \uicontrol Options > \uicontrol Devices >
\uicontrol {Bare Metal} > \uicontrol Add > \uicontrol Default, \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: connections to GDB servers or hardware debuggers:
\image creator-baremetal-device.png "Bare Metal options" \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/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the Qt Creator documentation. ** This file is part of the Qt Creator documentation.
@@ -53,13 +53,12 @@
translation files for use by the released application. translation files for use by the released application.
To synchronize translation source (TS) files from a translator with the To synchronize translation source (TS) files from a translator with the
application code, application code, select \uicontrol Tools > \uicontrol External >
select \uicontrol {Tools > External > Text > Linguist > Update Translations \uicontrol Linguist > \uicontrol {Update Translations (lupdate)}.
(lupdate)}.
To generate from the TS files Qt message (QM) files that can be used by an To generate from the TS files Qt message (QM) files that can be used by an
application, select \uicontrol {Tools > External > Text > Linguist > Release application, select \uicontrol Tools > \uicontrol External >
Translations (lrelease)}. \uicontrol Linguist > \uicontrol {Release Translations (lrelease)}.
By default, the project .pro file is passed to the tools as an argument. To 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 > 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 \li In the \uicontrol {Error output} field, select how to handle error
messages from the tool. 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 \li In the \uicontrol Environment field, select \uicontrol Change to modify
environment variable values for build and run environments in environment variable values for build and run environments in
the \uicontrol {Edit Environment Changes} dialog. For more information 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: [ files: [
"AbstractHighlighter", "AbstractHighlighter",
"Definition", "Definition",
"DefinitionDownloader",
"FoldingRegion", "FoldingRegion",
"Format", "Format",
"Repository", "Repository",

View File

@@ -108,6 +108,7 @@ HEADERS += \
$$PWD/clangrefactoringservermessages.h \ $$PWD/clangrefactoringservermessages.h \
$$PWD/alivemessage.h \ $$PWD/alivemessage.h \
$$PWD/completionsmessage.h \ $$PWD/completionsmessage.h \
$$PWD/executeinloop.h \
$$PWD/requestcompletionsmessage.h \ $$PWD/requestcompletionsmessage.h \
$$PWD/echomessage.h \ $$PWD/echomessage.h \
$$PWD/endmessage.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() void Database::initializeTables()
{ {
try { try {
ImmediateTransaction transaction(*this); ExclusiveTransaction transaction(*this);
for (Table &table : m_sqliteTables) for (Table &table : m_sqliteTables)
table.initialize(*this); table.initialize(*this);

View File

@@ -149,7 +149,7 @@ void SftpTransfer::doStart()
break; break;
case Internal::FileTransferType::Download: case Internal::FileTransferType::Download:
if (!QDir::root().mkdir(dir)) { 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))); .arg(QDir::toNativeSeparators(dir)));
return; return;
} }

View File

@@ -461,7 +461,7 @@ void AndroidRunnerWorker::asyncStartHelper()
if (!m_gdbserverPath.isEmpty() && uploadGdbServer()) { if (!m_gdbserverPath.isEmpty() && uploadGdbServer()) {
gdbServerPrefix = "./"; gdbServerPrefix = "./";
} else { } else {
emit remoteProcessFinished(tr("Cannot find/copy C++ debug server.")); emit remoteProcessFinished(tr("Cannot find or copy C++ debug server."));
return; return;
} }
} else { } else {
@@ -517,7 +517,7 @@ void AndroidRunnerWorker::asyncStartHelper()
} }
if (!runAdb(args)) { if (!runAdb(args)) {
emit remoteProcessFinished(tr("Failed to start the activity")); emit remoteProcessFinished(tr("Failed to start the activity."));
return; return;
} }
} }
@@ -584,7 +584,7 @@ void AndroidRunnerWorker::handleJdbWaiting()
runAdb(removeForward); runAdb(removeForward);
if (!runAdb({"forward", "tcp:" + m_localJdbServerPort.toString(), if (!runAdb({"forward", "tcp:" + m_localJdbServerPort.toString(),
"jdwp:" + QString::number(m_processPID)})) { "jdwp:" + QString::number(m_processPID)})) {
emit remoteProcessFinished(tr("Failed to forward jdb debugging ports.")); emit remoteProcessFinished(tr("Failed to forward JDB debugging ports."));
return; return;
} }
m_afterFinishAdbCommands.push_back(removeForward.join(' ')); m_afterFinishAdbCommands.push_back(removeForward.join(' '));
@@ -603,7 +603,7 @@ void AndroidRunnerWorker::handleJdbWaiting()
jdbProcess->setProcessChannelMode(QProcess::MergedChannels); jdbProcess->setProcessChannelMode(QProcess::MergedChannels);
jdbProcess->start(jdbPath.toString(), jdbArgs); jdbProcess->start(jdbPath.toString(), jdbArgs);
if (!jdbProcess->waitForStarted()) { if (!jdbProcess->waitForStarted()) {
emit remoteProcessFinished(tr("Failed to start jdb.")); emit remoteProcessFinished(tr("Failed to start JDB."));
return; return;
} }
m_jdbProcess = std::move(jdbProcess); 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) void AndroidRunnerWorker::onProcessIdChanged(qint64 pid)

View File

@@ -121,7 +121,7 @@ void TestResultItem::updateResult(bool &changed, Result::Type addedChildType)
if (!TestResult::isMessageCaseStart(old)) if (!TestResult::isMessageCaseStart(old))
return; return;
Result::Type newResult = Result::MessageTestCaseSuccess; Result::Type newResult = old;
switch (addedChildType) { switch (addedChildType) {
case Result::Fail: case Result::Fail:
case Result::MessageFatal: case Result::MessageFatal:

View File

@@ -1625,7 +1625,7 @@ void BinEditorWidget::contextMenuEvent(QContextMenuEvent *event)
} else { } else {
jumpToBeAddressHereAction->setText(tr("Jump to Address in This Window")); jumpToBeAddressHereAction->setText(tr("Jump to Address in This Window"));
jumpToBeAddressNewWindowAction->setText(tr("Jump to Address in New Window")); jumpToBeAddressNewWindowAction->setText(tr("Jump to Address in New Window"));
copyBeValue->setText(tr("Copy value")); copyBeValue->setText(tr("Copy Value"));
jumpToBeAddressHereAction->setEnabled(false); jumpToBeAddressHereAction->setEnabled(false);
jumpToBeAddressNewWindowAction->setEnabled(false); jumpToBeAddressNewWindowAction->setEnabled(false);
copyBeValue->setEnabled(false); copyBeValue->setEnabled(false);

View File

@@ -62,7 +62,9 @@ QString backendProcessPath()
class ClangPchManagerPluginData class ClangPchManagerPluginData
{ {
public: 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::RefactoringDatabaseInitializer<Sqlite::Database> databaseInitializer{database};
ClangBackEnd::FilePathCaching filePathCache{database}; ClangBackEnd::FilePathCaching filePathCache{database};
ClangPchManager::ProgressManager pchCreationProgressManager{[](QFutureInterface<void> &promise) { ClangPchManager::ProgressManager pchCreationProgressManager{[](QFutureInterface<void> &promise) {

View File

@@ -51,11 +51,11 @@ ClangPchManager::PchManagerConnectionClient::PchManagerConnectionClient(
{ {
m_processCreator.setTemporaryDirectoryPattern("clangpchmanagerbackend-XXXXXX"); m_processCreator.setTemporaryDirectoryPattern("clangpchmanagerbackend-XXXXXX");
QDir pchsDirectory(Core::ICore::userResourcePath()); QDir pchsDirectory(Core::ICore::cacheResourcePath());
pchsDirectory.mkdir("pchs"); pchsDirectory.mkdir("pchs");
pchsDirectory.cd("pchs"); pchsDirectory.cd("pchs");
m_processCreator.setArguments({connectionName(), m_processCreator.setArguments({connectionName(),
Core::ICore::userResourcePath() + "/symbol-experimental-v1.db", Core::ICore::cacheResourcePath() + "/symbol-experimental-v1.db",
pchsDirectory.absolutePath()}); pchsDirectory.absolutePath()});
stdErrPrefixer().setPrefix("PchManagerConnectionClient.stderr: "); stdErrPrefixer().setPrefix("PchManagerConnectionClient.stderr: ");

View File

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

View File

@@ -48,8 +48,8 @@ RefactoringConnectionClient::RefactoringConnectionClient(RefactoringClientInterf
, m_serverProxy(client) , m_serverProxy(client)
{ {
m_processCreator.setTemporaryDirectoryPattern("clangrefactoringbackend-XXXXXX"); m_processCreator.setTemporaryDirectoryPattern("clangrefactoringbackend-XXXXXX");
m_processCreator.setArguments({connectionName(), m_processCreator.setArguments(
Core::ICore::userResourcePath() + "/symbol-experimental-v1.db"}); {connectionName(), Core::ICore::cacheResourcePath() + "/symbol-experimental-v1.db"});
stdErrPrefixer().setPrefix("RefactoringConnectionClient.stderr: "); stdErrPrefixer().setPrefix("RefactoringConnectionClient.stderr: ");
stdOutPrefixer().setPrefix("RefactoringConnectionClient.stdout: "); stdOutPrefixer().setPrefix("RefactoringConnectionClient.stdout: ");

View File

@@ -245,7 +245,7 @@ static QString createDiagnosticToolTipString(const Diagnostic &diagnostic, Fixit
createFullLocationString(diagnostic.location)); createFullLocationString(diagnostic.location));
lines << qMakePair( lines << qMakePair(
QCoreApplication::translate("ClangTools::Diagnostic", "Fixit Status:"), QCoreApplication::translate("ClangTools::Diagnostic", "Fixit status:"),
fixitStatus(fixItStatus)); fixitStatus(fixItStatus));
QString html = QLatin1String("<html>" QString html = QLatin1String("<html>"

View File

@@ -35,6 +35,7 @@
#include <QSysInfo> #include <QSysInfo>
#include <QApplication> #include <QApplication>
#include <QStandardPaths>
/*! /*!
\namespace Core \namespace Core
@@ -439,6 +440,11 @@ QString ICore::userResourcePath()
return urp; return urp;
} }
QString ICore::cacheResourcePath()
{
return QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
}
QString ICore::installerResourcePath() QString ICore::installerResourcePath()
{ {
return QFileInfo(settings(QSettings::SystemScope)->fileName()).path() + '/' return QFileInfo(settings(QSettings::SystemScope)->fileName()).path() + '/'

View File

@@ -94,6 +94,7 @@ public:
static QString resourcePath(); static QString resourcePath();
static QString userResourcePath(); static QString userResourcePath();
static QString cacheResourcePath();
static QString installerResourcePath(); static QString installerResourcePath();
static QString libexecPath(); static QString libexecPath();
static QString clangExecutable(const QString &clangBinDirectory); static QString clangExecutable(const QString &clangBinDirectory);

View File

@@ -167,7 +167,7 @@ static void addConfigForBuildSystem(ClangDiagnosticConfigsModel &model)
ClangDiagnosticConfig config; ClangDiagnosticConfig config;
config.setId("Builtin.BuildSystem"); config.setId("Builtin.BuildSystem");
config.setDisplayName(QCoreApplication::translate("ClangDiagnosticConfigsModel", config.setDisplayName(QCoreApplication::translate("ClangDiagnosticConfigsModel",
"Build-systems' warnings")); "Build-system warnings"));
config.setIsReadOnly(true); config.setIsReadOnly(true);
config.setUseBuildSystemWarnings(true); config.setUseBuildSystemWarnings(true);

View File

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

View File

@@ -23,7 +23,7 @@
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <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>
<property name="openExternalLinks"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>

View File

@@ -45,6 +45,7 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/proxyaction.h> #include <utils/proxyaction.h>
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
#include <utils/stylehelper.h>
#include <QAction> #include <QAction>
#include <QComboBox> #include <QComboBox>
@@ -52,6 +53,7 @@
#include <QDockWidget> #include <QDockWidget>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QMenu> #include <QMenu>
#include <QScrollArea>
#include <QStackedWidget> #include <QStackedWidget>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QTimer> #include <QTimer>
@@ -189,14 +191,22 @@ DebuggerMainWindowPrivate::DebuggerMainWindowPrivate(DebuggerMainWindow *parent)
hbox->addWidget(viewButton); hbox->addWidget(viewButton);
hbox->addWidget(closeButton); 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); auto dock = new QDockWidget(DebuggerMainWindow::tr("Toolbar"), q);
dock->setObjectName("Toolbar"); dock->setObjectName("Toolbar");
dock->setFeatures(QDockWidget::NoDockWidgetFeatures); dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
dock->setAllowedAreas(Qt::BottomDockWidgetArea); dock->setAllowedAreas(Qt::BottomDockWidgetArea);
dock->setTitleBarWidget(new QWidget(dock)); // hide title bar dock->setTitleBarWidget(new QWidget(dock)); // hide title bar
dock->setProperty("managed_dockwidget", "true"); dock->setProperty("managed_dockwidget", "true");
toolbar->setParent(dock); dock->setWidget(scrolledToolbar);
dock->setWidget(toolbar);
m_toolBarDock = dock; m_toolBarDock = dock;
q->addDockWidget(Qt::BottomDockWidgetArea, m_toolBarDock); 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. // Run status. Note that it has exitcode 1 if there are no added files.
QString output; QString output;
if (commitData.commitType == FixupCommit) { 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()) { if (output.isEmpty()) {
*errorMessage = msgNoCommits(false); *errorMessage = msgNoCommits(false);
return false; return false;

View File

@@ -211,7 +211,7 @@ void PerfConfigWidget::handleProcessFinished()
if (tracePoints.isEmpty()) { if (tracePoints.isEmpty()) {
Core::AsynchronousMessageBox::warning( Core::AsynchronousMessageBox::warning(
tr("No trace points found"), tr("No Trace Points Found"),
tr("Trace points can be defined with \"perf probe -a\".")); tr("Trace points can be defined with \"perf probe -a\"."));
} else { } else {
for (const QByteArray &event : qAsConst(tracePoints)) { for (const QByteArray &event : qAsConst(tracePoints)) {
@@ -233,7 +233,7 @@ void PerfConfigWidget::handleProcessError(QProcess::ProcessError error)
{ {
if (error == QProcess::FailedToStart) { if (error == QProcess::FailedToStart) {
Core::AsynchronousMessageBox::warning( Core::AsynchronousMessageBox::warning(
tr("Cannot list trace points"), tr("Cannot List Trace Points"),
tr("\"perf probe -l\" failed to start. Is perf installed?")); tr("\"perf probe -l\" failed to start. Is perf installed?"));
m_ui->useTracePointsButton->setEnabled(true); m_ui->useTracePointsButton->setEnabled(true);
} }

View File

@@ -75,8 +75,8 @@ PerfDataReader::PerfDataReader(QObject *parent) :
} }
if (exitCode != 0) { if (exitCode != 0) {
QMessageBox::warning(Core::ICore::mainWindow(), QMessageBox::warning(Core::ICore::mainWindow(),
tr("Perf data parser failed"), tr("Perf Data Parser Failed"),
tr("The perf data parser failed to process all the samples. " tr("The Perf data parser failed to process all the samples. "
"Your trace is incomplete. The exit code was %1.") "Your trace is incomplete. The exit code was %1.")
.arg(exitCode)); .arg(exitCode));
} }
@@ -101,17 +101,17 @@ PerfDataReader::PerfDataReader(QObject *parent) :
connect(&m_input, &QProcess::errorOccurred, this, [this](QProcess::ProcessError e){ connect(&m_input, &QProcess::errorOccurred, this, [this](QProcess::ProcessError e){
switch (e) { switch (e) {
case QProcess::FailedToStart: case QProcess::FailedToStart:
emit processFailed(tr("perfparser failed to start")); emit processFailed(tr("perfparser failed to start."));
QMessageBox::warning(Core::ICore::mainWindow(), QMessageBox::warning(Core::ICore::mainWindow(),
tr("Perf data parser failed"), tr("Perf Data Parser Failed"),
tr("Could not start the 'perfparser' utility program. " tr("Could not start the perfparser utility program. "
"Make sure a working perf parser is available at the location " "Make sure a working Perf parser is available at the location "
"given by the PERFPROFILER_PARSER_FILEPATH environment " "given by the PERFPROFILER_PARSER_FILEPATH environment "
"variable.")); "variable."));
break; break;
case QProcess::Crashed: case QProcess::Crashed:
QMessageBox::warning(Core::ICore::mainWindow(), QMessageBox::warning(Core::ICore::mainWindow(),
tr("Perf data parser crashed"), tr("Perf Data Parser Crashed"),
tr("This is a bug. Please report it.")); tr("This is a bug. Please report it."));
break; break;
case QProcess::ReadError: case QProcess::ReadError:
@@ -346,8 +346,8 @@ void PerfDataReader::writeChunk()
m_input.kill(); m_input.kill();
emit finished(); emit finished();
QMessageBox::warning(Core::ICore::mainWindow(), QMessageBox::warning(Core::ICore::mainWindow(),
tr("Cannot send data to Perf data parser"), tr("Cannot Send Data to Perf Data Parser"),
tr("The perf data parser doesn't accept further input. " tr("The Perf data parser does not accept further input. "
"Your trace is incomplete.")); "Your trace is incomplete."));
} }
} }

View File

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

View File

@@ -138,10 +138,10 @@ public:
// The terminate() below will frequently lead to QProcess::Crashed. We're not interested // The terminate() below will frequently lead to QProcess::Crashed. We're not interested
// in that. FailedToStart is the only actual failure. // in that. FailedToStart is the only actual failure.
if (e == QProcess::FailedToStart) { 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(), QMessageBox::warning(Core::ICore::mainWindow(),
msg, tr("Make sure you are running a recent Linux kernel and " msg, tr("Make sure that you are running a recent Linux kernel and "
"that the 'perf' utility is available.")); "that the \"perf\" utility is available."));
reportFailure(msg); reportFailure(msg);
} }
}); });
@@ -227,7 +227,7 @@ void PerfProfilerRunner::start()
}); });
connect(recorder, &DeviceProcess::readyReadStandardOutput, this, [this, reader, recorder] { connect(recorder, &DeviceProcess::readyReadStandardOutput, this, [this, reader, recorder] {
if (!reader->feedParser(recorder->readAllStandardOutput())) 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); options->menu()->setEnabled(true);
const Core::Context globalContext(Core::Constants::C_GLOBAL); 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( Core::Command *command = Core::ActionManager::registerAction(
m_loadPerfData, Constants::PerfProfilerTaskLoadPerf, globalContext); m_loadPerfData, Constants::PerfProfilerTaskLoadPerf, globalContext);
connect(m_loadPerfData, &QAction::triggered, this, &PerfProfilerTool::showLoadPerfDialog); connect(m_loadPerfData, &QAction::triggered, this, &PerfProfilerTool::showLoadPerfDialog);
options->addAction(command); 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, command = Core::ActionManager::registerAction(m_loadTrace, Constants::PerfProfilerTaskLoadTrace,
globalContext); globalContext);
connect(m_loadTrace, &QAction::triggered, this, &PerfProfilerTool::showLoadTraceDialog); connect(m_loadTrace, &QAction::triggered, this, &PerfProfilerTool::showLoadTraceDialog);
options->addAction(command); 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, command = Core::ActionManager::registerAction(m_saveTrace, Constants::PerfProfilerTaskSaveTrace,
globalContext); globalContext);
connect(m_saveTrace, &QAction::triggered, this, &PerfProfilerTool::showSaveTraceDialog); connect(m_saveTrace, &QAction::triggered, this, &PerfProfilerTool::showSaveTraceDialog);
@@ -126,7 +126,7 @@ PerfProfilerTool::PerfProfilerTool(QObject *parent) :
}); });
options->addAction(command); 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->setIcon(Debugger::Icons::TRACEPOINT_TOOLBAR.icon());
tracePointsAction->setIconVisibleInMenu(false); tracePointsAction->setIconVisibleInMenu(false);
tracePointsAction->setToolTip(tr("Create trace points for memory profiling on the target " tracePointsAction->setToolTip(tr("Create trace points for memory profiling on the target "
@@ -141,7 +141,7 @@ PerfProfilerTool::PerfProfilerTool(QObject *parent) :
m_tracePointsButton->setDefaultAction(tracePointsAction); m_tracePointsButton->setDefaultAction(tracePointsAction);
auto action = new QAction(tr("Performance Analyzer"), this); 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), menu->addAction(ActionManager::registerAction(action, Constants::PerfProfilerLocalActionId),
Debugger::Constants::G_ANALYZER_TOOLS); Debugger::Constants::G_ANALYZER_TOOLS);
QObject::connect(action, &QAction::triggered, this, [this] { QObject::connect(action, &QAction::triggered, this, [this] {
@@ -251,7 +251,7 @@ void PerfProfilerTool::createViews()
connect(m_recordButton, &QAbstractButton::clicked, this, &PerfProfilerTool::setRecording); connect(m_recordButton, &QAbstractButton::clicked, this, &PerfProfilerTool::setRecording);
m_clearButton->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon()); 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); connect(m_clearButton, &QAbstractButton::clicked, this, &PerfProfilerTool::clear);
m_filterButton->setIcon(Utils::Icons::FILTER.icon()); m_filterButton->setIcon(Utils::Icons::FILTER.icon());
@@ -410,10 +410,10 @@ void PerfProfilerTool::onReaderFinished()
m_readerRunning = false; m_readerRunning = false;
if (m_traceManager->traceDuration() <= 0) { if (m_traceManager->traceDuration() <= 0) {
QMessageBox::warning(Core::ICore::mainWindow(), QMessageBox::warning(Core::ICore::mainWindow(),
tr("No data loaded"), tr("No Data Loaded"),
tr("The profiler did not produce any samples. " tr("The profiler did not produce any samples. "
"Make sure you are running a recent Linux kernel and that the " "Make sure that you are running a recent Linux kernel and that "
"'perf' utility is available and generates useful call " "the \"perf\" utility is available and generates useful call "
"graphs.")); "graphs."));
clear(); clear();
} else { } else {
@@ -612,7 +612,7 @@ void PerfProfilerTool::showLoadTraceDialog()
m_perspective.select(); m_perspective.select();
QString filename = QFileDialog::getOpenFileName( QString filename = QFileDialog::getOpenFileName(
ICore::mainWindow(), tr("Load trace file"), ICore::mainWindow(), tr("Load Trace File"),
"", tr("Trace File (*.ptr)")); "", tr("Trace File (*.ptr)"));
if (filename.isEmpty()) if (filename.isEmpty())
return; return;
@@ -627,7 +627,7 @@ void PerfProfilerTool::showSaveTraceDialog()
m_perspective.select(); m_perspective.select();
QString filename = QFileDialog::getSaveFileName( QString filename = QFileDialog::getSaveFileName(
ICore::mainWindow(), tr("Save trace file"), ICore::mainWindow(), tr("Save Trace File"),
"", tr("Trace File (*.ptr)")); "", tr("Trace File (*.ptr)"));
if (filename.isEmpty()) if (filename.isEmpty())
return; return;
@@ -641,8 +641,8 @@ void PerfProfilerTool::showSaveTraceDialog()
void PerfProfilerTool::setAggregated(bool aggregated) void PerfProfilerTool::setAggregated(bool aggregated)
{ {
m_aggregateButton->setChecked(aggregated); m_aggregateButton->setChecked(aggregated);
m_aggregateButton->setToolTip(aggregated ? tr("Show all addresses") m_aggregateButton->setToolTip(aggregated ? tr("Show all addresses.")
: tr("Aggregate by functions")); : tr("Aggregate by functions."));
emit aggregatedChanged(aggregated); emit aggregatedChanged(aggregated);
} }
@@ -653,8 +653,8 @@ void PerfProfilerTool::setRecording(bool recording)
m_recordButton->setIcon(recording ? recordOn : recordOff); m_recordButton->setIcon(recording ? recordOn : recordOff);
m_recordButton->setChecked(recording); m_recordButton->setChecked(recording);
m_recordButton->setToolTip(recording ? tr("Stop collecting profile data") : m_recordButton->setToolTip(recording ? tr("Stop collecting profile data.") :
tr("Collect profile data")); tr("Collect profile data."));
emit recordingChanged(recording); emit recordingChanged(recording);
} }
@@ -668,7 +668,7 @@ void PerfProfilerTool::updateTime(qint64 duration, qint64 delay)
m_recordedLabel->clear(); m_recordedLabel->clear();
if (delay > 0) 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)); .arg(qAbs(delay / e8) % ten));
else if (delay == 0) else if (delay == 0)
m_delayLabel->clear(); m_delayLabel->clear();

View File

@@ -94,13 +94,13 @@ void PerfProfilerEventStorage::clear()
m_file.clear(); m_file.clear();
m_size = 0; m_size = 0;
if (!m_file.open()) 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() void PerfProfilerEventStorage::finalize()
{ {
if (!m_file.flush()) 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( bool PerfProfilerEventStorage::replay(
@@ -110,13 +110,13 @@ bool PerfProfilerEventStorage::replay(
case Timeline::TraceStashFile<PerfEvent>::ReplaySuccess: case Timeline::TraceStashFile<PerfEvent>::ReplaySuccess:
return true; return true;
case Timeline::TraceStashFile<PerfEvent>::ReplayOpenFailed: case Timeline::TraceStashFile<PerfEvent>::ReplayOpenFailed:
m_errorHandler(tr("Cannot re-open temporary trace file")); m_errorHandler(tr("Cannot re-open temporary trace file."));
break; break;
case Timeline::TraceStashFile<PerfEvent>::ReplayLoadFailed: case Timeline::TraceStashFile<PerfEvent>::ReplayLoadFailed:
// Happens if the loader rejects an event. Not an actual error // Happens if the loader rejects an event. Not an actual error
break; break;
case Timeline::TraceStashFile<PerfEvent>::ReplayReadPastEnd: 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; break;
} }
return false; return false;

View File

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

View File

@@ -1490,7 +1490,7 @@ ClangToolChainConfigWidget::ClangToolChainConfigWidget(ClangToolChain *tc) :
m_parentToolchainCombo = new QComboBox(this); m_parentToolchainCombo = new QComboBox(this);
m_mainLayout->insertRow(m_mainLayout->rowCount() - 1, m_mainLayout->insertRow(m_mainLayout->rowCount() - 1,
tr("Parent Toolchain:"), tr("Parent toolchain:"),
m_parentToolchainCombo); m_parentToolchainCombo);
ToolChainManager *tcManager = ToolChainManager::instance(); ToolChainManager *tcManager = ToolChainManager::instance();

View File

@@ -33,6 +33,7 @@
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <coreplugin/fileiconprovider.h> #include <coreplugin/fileiconprovider.h>
#include <coreplugin/id.h> #include <coreplugin/id.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <projectexplorer/buildtargetinfo.h> #include <projectexplorer/buildtargetinfo.h>
@@ -61,6 +62,7 @@
#include <QTextCursor> #include <QTextCursor>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonObject> #include <QJsonObject>
#include <QJsonParseError>
#include <QJsonValue> #include <QJsonValue>
#include <QJsonArray> #include <QJsonArray>
@@ -342,30 +344,48 @@ static QStringList readLines(const Utils::FileName &projectFile)
return lines; return lines;
} }
static QStringList readLinesJson(const Utils::FileName &projectFile) static QStringList readLinesJson(const Utils::FileName &projectFile,
QString *errorMessage)
{ {
const QString projectFileName = projectFile.fileName(); const QString projectFileName = projectFile.fileName();
QStringList lines = { projectFileName }; QStringList lines = { projectFileName };
QFile file(projectFile.toString()); 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; return lines;
}
const QByteArray content = file.readAll(); const QByteArray content = file.readAll();
// This assumes te project file is formed with only one field called // 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. // 'files' that has a list associated of the files to include in the project.
if (!content.isEmpty()) { if (content.isEmpty()) {
const QJsonDocument doc = QJsonDocument::fromJson(content); *errorMessage = PythonProject::tr("Unable read \"%1\": The file is empty.")
const QJsonObject obj = doc.object(); .arg(projectFile.toUserOutput());
if (obj.contains("files")) { return lines;
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()); 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; return lines;
@@ -451,8 +471,12 @@ void PythonProject::parseProject()
m_rawListEntries.clear(); m_rawListEntries.clear();
const Utils::FileName filePath = projectFilePath(); const Utils::FileName filePath = projectFilePath();
// The PySide project file is JSON based // The PySide project file is JSON based
if (filePath.endsWith(".pyproject")) if (filePath.endsWith(".pyproject")) {
m_rawFileList = readLinesJson(filePath); 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 // To keep compatibility with PyQt we keep the compatibility with plain
// text files as project files. // text files as project files.
else if (filePath.endsWith(".pyqtc")) else if (filePath.endsWith(".pyqtc"))

View File

@@ -130,7 +130,7 @@ void QnxDeviceTester::handleVarRunProcessFinished(const QString &error)
m_result = TestFailure; m_result = TestFailure;
} }
} else { } 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.") " files can be created in /var/run.")
+ QLatin1Char('\n')); + QLatin1Char('\n'));
m_result = TestFailure; m_result = TestFailure;
@@ -162,7 +162,7 @@ void QnxDeviceTester::handleProcessFinished(const QString &error)
m_result = TestFailure; m_result = TestFailure;
} }
} else { } 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; m_result = TestFailure;
} }
testNextCommand(); testNextCommand();

View File

@@ -176,8 +176,6 @@ FindInFilesSilverSearcher::FindInFilesSilverSearcher(QObject *parent)
setEnabled(isSilverSearcherAvailable()); setEnabled(isSilverSearcherAvailable());
if (!isEnabled()) { if (!isEnabled()) {
auto layout = new QHBoxLayout(m_widget);
layout->setMargin(0);
QLabel *label = new QLabel(tr("Silver Searcher is not available on the system.")); QLabel *label = new QLabel(tr("Silver Searcher is not available on the system."));
label->setStyleSheet("QLabel { color : red; }"); label->setStyleSheet("QLabel { color : red; }");
layout->addWidget(label); layout->addWidget(label);

View File

@@ -111,8 +111,6 @@ public:
class BaseFileFindPrivate class BaseFileFindPrivate
{ {
public: public:
BaseFileFindPrivate() : m_internalSearchEngine(std::make_unique<InternalEngine>()) {}
QPointer<IFindSupport> m_currentFindSupport; QPointer<IFindSupport> m_currentFindSupport;
QLabel *m_resultLabel = nullptr; QLabel *m_resultLabel = nullptr;
@@ -125,7 +123,7 @@ public:
QPointer<QComboBox> m_filterCombo; QPointer<QComboBox> m_filterCombo;
QPointer<QComboBox> m_exclusionCombo; QPointer<QComboBox> m_exclusionCombo;
QVector<SearchEngine *> m_searchEngines; QVector<SearchEngine *> m_searchEngines;
std::unique_ptr<SearchEngine> m_internalSearchEngine; InternalEngine m_internalSearchEngine;
int m_currentSearchEngineIndex = -1; int m_currentSearchEngineIndex = -1;
}; };
@@ -182,7 +180,7 @@ void SearchEngine::setEnabled(bool enabled)
BaseFileFind::BaseFileFind() : d(new BaseFileFindPrivate) BaseFileFind::BaseFileFind() : d(new BaseFileFindPrivate)
{ {
addSearchEngine(d->m_internalSearchEngine.get()); addSearchEngine(&d->m_internalSearchEngine);
} }
BaseFileFind::~BaseFileFind() BaseFileFind::~BaseFileFind()

View File

@@ -155,6 +155,7 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) :
m_ui->detailsScrollArea->viewport()->setAutoFillBackground(false); m_ui->detailsScrollArea->viewport()->setAutoFillBackground(false);
m_ui->scrollAreaWidgetContents->setAutoFillBackground(false); m_ui->scrollAreaWidgetContents->setAutoFillBackground(false);
m_ui->itemList->setModel(m_formatsModel); m_ui->itemList->setModel(m_formatsModel);
m_ui->builtinSchemeLabel->setVisible(m_readOnly);
populateUnderlineStyleComboBox(); populateUnderlineStyleComboBox();
@@ -186,6 +187,7 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) :
this, &ColorSchemeEdit::eraseUnderlineColor); this, &ColorSchemeEdit::eraseUnderlineColor);
connect(m_ui->underlineComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), connect(m_ui->underlineComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &ColorSchemeEdit::changeUnderlineStyle); this, &ColorSchemeEdit::changeUnderlineStyle);
connect(m_ui->builtinSchemeLabel, &QLabel::linkActivated, this, &ColorSchemeEdit::copyScheme);
} }
ColorSchemeEdit::~ColorSchemeEdit() ColorSchemeEdit::~ColorSchemeEdit()
@@ -214,31 +216,9 @@ void ColorSchemeEdit::setReadOnly(bool readOnly)
m_readOnly = readOnly; m_readOnly = readOnly;
const bool enabled = !readOnly; m_ui->detailsScrollArea->setVisible(!readOnly);
m_ui->foregroundLabel->setEnabled(enabled); m_ui->builtinSchemeLabel->setVisible(readOnly);
m_ui->foregroundToolButton->setEnabled(enabled); updateControls();
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);
} }
void ColorSchemeEdit::setColorScheme(const ColorScheme &colorScheme) void ColorSchemeEdit::setColorScheme(const ColorScheme &colorScheme)
@@ -278,7 +258,8 @@ void ColorSchemeEdit::updateForegroundControls()
const auto &formatDescription = m_descriptions[m_curItem]; const auto &formatDescription = m_descriptions[m_curItem];
const Format &format = m_scheme.formatFor(formatDescription.id()); 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->relativeForegroundHeadline->setEnabled(isVisible);
m_ui->foregroundLabel->setVisible(isVisible); m_ui->foregroundLabel->setVisible(isVisible);
@@ -297,7 +278,8 @@ void ColorSchemeEdit::updateBackgroundControls()
const auto formatDescription = m_descriptions[m_curItem]; const auto formatDescription = m_descriptions[m_curItem];
const Format &format = m_scheme.formatFor(formatDescription.id()); 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->relativeBackgroundHeadline->setVisible(isVisible);
m_ui->backgroundLabel->setVisible(isVisible); m_ui->backgroundLabel->setVisible(isVisible);
@@ -319,7 +301,8 @@ void ColorSchemeEdit::updateRelativeForegroundControls()
QSignalBlocker saturationSignalBlocker(m_ui->foregroundSaturationSpinBox); QSignalBlocker saturationSignalBlocker(m_ui->foregroundSaturationSpinBox);
QSignalBlocker lightnessSignalBlocker(m_ui->foregroundLightnessSpinBox); 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->relativeForegroundHeadline->setVisible(isVisible);
m_ui->foregroundSaturationLabel->setVisible(isVisible); m_ui->foregroundSaturationLabel->setVisible(isVisible);
@@ -350,7 +333,8 @@ void ColorSchemeEdit::updateRelativeBackgroundControls()
QSignalBlocker saturationSignalBlocker(m_ui->backgroundSaturationSpinBox); QSignalBlocker saturationSignalBlocker(m_ui->backgroundSaturationSpinBox);
QSignalBlocker lightnessSignalBlocker(m_ui->backgroundLightnessSpinBox); 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->relativeBackgroundHeadline->setVisible(isVisible);
m_ui->backgroundSaturationLabel->setVisible(isVisible); m_ui->backgroundSaturationLabel->setVisible(isVisible);
@@ -381,7 +365,8 @@ void ColorSchemeEdit::updateFontControls()
QSignalBlocker boldSignalBlocker(m_ui->boldCheckBox); QSignalBlocker boldSignalBlocker(m_ui->boldCheckBox);
QSignalBlocker italicSignalBlocker(m_ui->italicCheckBox); 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->fontHeadline->setVisible(isVisible);
m_ui->boldCheckBox->setVisible(isVisible); m_ui->boldCheckBox->setVisible(isVisible);
@@ -401,7 +386,8 @@ void ColorSchemeEdit::updateUnderlineControls()
QSignalBlocker comboBoxSignalBlocker(m_ui->underlineComboBox); 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->underlineHeadline->setVisible(isVisible);
m_ui->underlineLabel->setVisible(isVisible); m_ui->underlineLabel->setVisible(isVisible);

View File

@@ -59,6 +59,9 @@ public:
void setColorScheme(const ColorScheme &colorScheme); void setColorScheme(const ColorScheme &colorScheme);
const ColorScheme &colorScheme() const; const ColorScheme &colorScheme() const;
signals:
void copyScheme();
private: private:
void currentItemChanged(const QModelIndex &index); void currentItemChanged(const QModelIndex &index);
void changeForeColor(); void changeForeColor();

View File

@@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>462</width> <width>513</width>
<height>416</height> <height>416</height>
</rect> </rect>
</property> </property>
@@ -39,6 +39,16 @@
</property> </property>
</widget> </widget>
</item> </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> <item>
<widget class="QScrollArea" name="detailsScrollArea"> <widget class="QScrollArea" name="detailsScrollArea">
<property name="sizePolicy"> <property name="sizePolicy">
@@ -87,36 +97,68 @@
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>0</number> <number>0</number>
</property> </property>
<item row="5" column="0" colspan="3"> <item row="30" column="0" colspan="3">
<widget class="QLabel" name="relativeForegroundHeadline"> <spacer name="spacer">
<property name="font"> <property name="orientation">
<font> <enum>Qt::Vertical</enum>
<weight>75</weight>
<bold>true</bold>
</font>
</property> </property>
<property name="text"> <property name="sizeHint" stdset="0">
<string>Relative Foreground</string> <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> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0"> <item row="1" column="1">
<widget class="QLabel" name="foregroundLabel"> <widget class="QToolButton" name="foregroundToolButton">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Foreground:</string> <string/>
</property>
<property name="buddy">
<cstring>foregroundToolButton</cstring>
</property> </property>
</widget> </widget>
</item> </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"> <widget class="QWidget" name="relativeForegroundSpacer3" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -138,251 +180,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0"> <item row="8" 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">
<widget class="QLabel" name="foregroundSaturationLabel"> <widget class="QLabel" name="foregroundSaturationLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@@ -395,14 +193,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="19" column="0"> <item row="19" column="0" colspan="3">
<widget class="QCheckBox" name="boldCheckBox">
<property name="text">
<string>Bold</string>
</property>
</widget>
</item>
<item row="18" column="0" colspan="3">
<widget class="QWidget" name="fontSpacer1" native="true"> <widget class="QWidget" name="fontSpacer1" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -424,73 +215,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="0" colspan="3"> <item row="23" 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">
<widget class="QWidget" name="underlineSpacer1" native="true"> <widget class="QWidget" name="underlineSpacer1" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -512,20 +237,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="23" column="1"> <item row="1" column="0">
<widget class="QToolButton" name="underlineColorToolButton"> <widget class="QLabel" name="foregroundLabel">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>Foreground:</string>
</property>
<property name="buddy">
<cstring>foregroundToolButton</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="21" column="0"> <item row="22" column="0">
<widget class="QLabel" name="underlineHeadline"> <widget class="QLabel" name="underlineHeadline">
<property name="font"> <property name="font">
<font> <font>
@@ -538,23 +266,122 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="23" column="0"> <item row="6" column="0" colspan="3">
<widget class="QLabel" name="underlineLabel"> <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"> <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> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Color:</string> <string/>
</property>
<property name="buddy">
<cstring>backgroundToolButton</cstring>
</property> </property>
</widget> </widget>
</item> </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"> <widget class="QLabel" name="relativeBackgroundHeadline">
<property name="font"> <property name="font">
<font> <font>
@@ -567,7 +394,173 @@
</property> </property>
</widget> </widget>
</item> </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"> <widget class="QWidget" name="fontSpacer2" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -589,8 +582,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="15" column="1" colspan="2"> <item row="10" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="backgroundLightnessSpinBox"> <widget class="QDoubleSpinBox" name="foregroundLightnessSpinBox">
<property name="minimum"> <property name="minimum">
<double>-1.000000000000000</double> <double>-1.000000000000000</double>
</property> </property>
@@ -602,42 +595,20 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="8" column="1" colspan="2">
<widget class="QToolButton" name="backgroundToolButton"> <widget class="QDoubleSpinBox" name="foregroundSaturationSpinBox">
<property name="sizePolicy"> <property name="minimum">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <double>-1.000000000000000</double>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="text"> <property name="maximum">
<string/> <double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.050000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="23" column="2"> <item row="9" column="0" colspan="3">
<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">
<widget class="QWidget" name="relativeForegroundSpacer2" native="true"> <widget class="QWidget" name="relativeForegroundSpacer2" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -659,8 +630,47 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="3"> <item row="24" column="0">
<widget class="QWidget" name="foregroundSpacer" native="true"> <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"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -670,13 +680,13 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>6</height> <height>18</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>6</height> <height>18</height>
</size> </size>
</property> </property>
</widget> </widget>

View File

@@ -376,6 +376,8 @@ QWidget *FontSettingsPage::widget()
this, &FontSettingsPage::colorSchemeSelected); this, &FontSettingsPage::colorSchemeSelected);
connect(d_ptr->m_ui->copyButton, &QPushButton::clicked, connect(d_ptr->m_ui->copyButton, &QPushButton::clicked,
this, &FontSettingsPage::openCopyColorSchemeDialog); this, &FontSettingsPage::openCopyColorSchemeDialog);
connect(d_ptr->m_ui->schemeEdit, &ColorSchemeEdit::copyScheme,
this, &FontSettingsPage::openCopyColorSchemeDialog);
connect(d_ptr->m_ui->deleteButton, &QPushButton::clicked, connect(d_ptr->m_ui->deleteButton, &QPushButton::clicked,
this, &FontSettingsPage::confirmDeleteColorScheme); this, &FontSettingsPage::confirmDeleteColorScheme);

View File

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

View File

@@ -575,7 +575,7 @@ VcsBaseSubmitEditor::PromptSubmitResult
message = tr("What do you want to do with these changes?"); message = tr("What do you want to do with these changes?");
} else { } else {
message = tr("Cannot %1%2.\nWhat do you want to do?", 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(), .arg(commitName.toLower(),
errorMessage.isEmpty() ? errorMessage : ": " + errorMessage); errorMessage.isEmpty() ? errorMessage : ": " + errorMessage);
} }

View File

@@ -29,6 +29,7 @@
#include <clangpathwatcher.h> #include <clangpathwatcher.h>
#include <connectionserver.h> #include <connectionserver.h>
#include <environment.h> #include <environment.h>
#include <executeinloop.h>
#include <generatedfiles.h> #include <generatedfiles.h>
#include <modifiedtimechecker.h> #include <modifiedtimechecker.h>
#include <pchcreator.h> #include <pchcreator.h>
@@ -72,48 +73,6 @@ using ClangBackEnd::FilePathCache;
using ClangBackEnd::FilePathView; using ClangBackEnd::FilePathView;
using ClangBackEnd::TimeStamp; 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 class PchManagerApplication final : public QCoreApplication
{ {
public: public:

View File

@@ -126,6 +126,11 @@ public:
return FilePath(""); return FilePath("");
} }
Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const
{
return m_getPrecompiledHeader.template value<ProjectPartPch, 2>(projectPartId);
}
public: public:
Sqlite::ImmediateNonThrowingDestructorTransaction m_transaction; Sqlite::ImmediateNonThrowingDestructorTransaction m_transaction;
Database &m_database; Database &m_database;
@@ -155,6 +160,10 @@ public:
"SELECT systemPchPath FROM precompiledHeaders WHERE projectPartId = (SELECT projectPartId " "SELECT systemPchPath FROM precompiledHeaders WHERE projectPartId = (SELECT projectPartId "
"FROM projectParts WHERE projectPartName = ?)", "FROM projectParts WHERE projectPartName = ?)",
m_database}; 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 #pragma once
#include "projectpartpch.h"
#include <filepath.h> #include <filepath.h>
#include <utils/smallstringvector.h> #include <utils/smallstringvector.h>
#include <utils/optional.h>
namespace ClangBackEnd { namespace ClangBackEnd {
@@ -50,6 +53,7 @@ public:
= 0; = 0;
virtual void deleteSystemPrecompiledHeaders(const Utils::SmallStringVector &projectPartNames) = 0; virtual void deleteSystemPrecompiledHeaders(const Utils::SmallStringVector &projectPartNames) = 0;
virtual FilePath fetchSystemPrecompiledHeaderPath(Utils::SmallStringView projectPartName) = 0; virtual FilePath fetchSystemPrecompiledHeaderPath(Utils::SmallStringView projectPartName) = 0;
virtual Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const = 0;
protected: protected:
~PrecompiledHeaderStorageInterface() = default; ~PrecompiledHeaderStorageInterface() = default;

View File

@@ -30,6 +30,7 @@
#include "queueinterface.h" #include "queueinterface.h"
#include "progresscounter.h" #include "progresscounter.h"
#include <executeinloop.h>
#include <processormanagerinterface.h> #include <processormanagerinterface.h>
#include <symbolindexertaskqueueinterface.h> #include <symbolindexertaskqueueinterface.h>
#include <symbolscollectorinterface.h> #include <symbolscollectorinterface.h>
@@ -149,14 +150,6 @@ private:
m_futures.erase(split, m_futures.end()); 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: private:
std::vector<Future> m_futures; std::vector<Future> m_futures;
ProcessorManager &m_processorManager; ProcessorManager &m_processorManager;

View File

@@ -30,6 +30,7 @@
#include <QDir> #include <QDir>
#include <connectionserver.h> #include <connectionserver.h>
#include <executeinloop.h>
#include <filepathcaching.h> #include <filepathcaching.h>
#include <generatedfiles.h> #include <generatedfiles.h>
#include <refactoringserver.h> #include <refactoringserver.h>
@@ -51,48 +52,6 @@ using ClangBackEnd::RefactoringDatabaseInitializer;
using ClangBackEnd::ConnectionServer; using ClangBackEnd::ConnectionServer;
using ClangBackEnd::SymbolIndexing; 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) QStringList processArguments(QCoreApplication &application)
{ {
QCommandLineParser parser; QCommandLineParser parser;

View File

@@ -60,18 +60,20 @@ private:
SymbolIndexer::SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue, SymbolIndexer::SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue,
SymbolStorageInterface &symbolStorage, SymbolStorageInterface &symbolStorage,
BuildDependenciesStorageInterface &usedMacroAndSourceStorage, BuildDependenciesStorageInterface &buildDependenciesStorage,
PrecompiledHeaderStorageInterface &precompiledHeaderStorage,
ClangPathWatcherInterface &pathWatcher, ClangPathWatcherInterface &pathWatcher,
FilePathCachingInterface &filePathCache, FilePathCachingInterface &filePathCache,
FileStatusCache &fileStatusCache, FileStatusCache &fileStatusCache,
Sqlite::TransactionInterface &transactionInterface) Sqlite::TransactionInterface &transactionInterface)
: m_symbolIndexerTaskQueue(symbolIndexerTaskQueue), : m_symbolIndexerTaskQueue(symbolIndexerTaskQueue)
m_symbolStorage(symbolStorage), , m_symbolStorage(symbolStorage)
m_buildDependencyStorage(usedMacroAndSourceStorage), , m_buildDependencyStorage(buildDependenciesStorage)
m_pathWatcher(pathWatcher), , m_precompiledHeaderStorage(precompiledHeaderStorage)
m_filePathCache(filePathCache), , m_pathWatcher(pathWatcher)
m_fileStatusCache(fileStatusCache), , m_filePathCache(filePathCache)
m_transactionInterface(transactionInterface) , m_fileStatusCache(fileStatusCache)
, m_transactionInterface(transactionInterface)
{ {
pathWatcher.setNotifier(this); pathWatcher.setNotifier(this);
} }
@@ -97,7 +99,8 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
projectPart.languageExtension); projectPart.languageExtension);
if (optionalArtefact) if (optionalArtefact)
projectPartId = optionalArtefact->projectPartId; 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); FilePathIds sourcePathIds = updatableFilePathIds(projectPart, optionalArtefact);
transaction.commit(); transaction.commit();
@@ -179,8 +182,8 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
if (!optionalArtefact) if (!optionalArtefact)
return; return;
const Utils::optional<ProjectPartPch> optionalProjectPartPch = m_symbolStorage.fetchPrecompiledHeader( const Utils::optional<ProjectPartPch> optionalProjectPartPch
optionalArtefact->projectPartId); = m_precompiledHeaderStorage.fetchPrecompiledHeader(optionalArtefact->projectPartId);
transaction.commit(); transaction.commit();
const ProjectPartArtefact &artefact = optionalArtefact.value(); const ProjectPartArtefact &artefact = optionalArtefact.value();

View File

@@ -31,6 +31,7 @@
#include "builddependenciesstorageinterface.h" #include "builddependenciesstorageinterface.h"
#include "clangpathwatcher.h" #include "clangpathwatcher.h"
#include <precompiledheaderstorageinterface.h>
#include <projectpartcontainer.h> #include <projectpartcontainer.h>
#include <filecontainerv2.h> #include <filecontainerv2.h>
@@ -43,7 +44,8 @@ class SymbolIndexer final : public ClangPathWatcherNotifier
public: public:
SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue, SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue,
SymbolStorageInterface &symbolStorage, SymbolStorageInterface &symbolStorage,
BuildDependenciesStorageInterface &usedMacroAndSourceStorage, BuildDependenciesStorageInterface &buildDependenciesStorage,
PrecompiledHeaderStorageInterface &precompiledHeaderStorage,
ClangPathWatcherInterface &pathWatcher, ClangPathWatcherInterface &pathWatcher,
FilePathCachingInterface &filePathCache, FilePathCachingInterface &filePathCache,
FileStatusCache &fileStatusCache, FileStatusCache &fileStatusCache,
@@ -71,6 +73,7 @@ private:
SymbolIndexerTaskQueueInterface &m_symbolIndexerTaskQueue; SymbolIndexerTaskQueueInterface &m_symbolIndexerTaskQueue;
SymbolStorageInterface &m_symbolStorage; SymbolStorageInterface &m_symbolStorage;
BuildDependenciesStorageInterface &m_buildDependencyStorage; BuildDependenciesStorageInterface &m_buildDependencyStorage;
PrecompiledHeaderStorageInterface &m_precompiledHeaderStorage;
ClangPathWatcherInterface &m_pathWatcher; ClangPathWatcherInterface &m_pathWatcher;
FilePathCachingInterface &m_filePathCache; FilePathCachingInterface &m_filePathCache;
FileStatusCache &m_fileStatusCache; FileStatusCache &m_fileStatusCache;

View File

@@ -35,6 +35,7 @@
#include "symbolstorage.h" #include "symbolstorage.h"
#include <builddependenciesstorage.h> #include <builddependenciesstorage.h>
#include <precompiledheaderstorage.h>
#include <refactoringdatabaseinitializer.h> #include <refactoringdatabaseinitializer.h>
#include <filepathcachingfwd.h> #include <filepathcachingfwd.h>
@@ -83,6 +84,7 @@ public:
ProgressCounter::SetProgressCallback &&setProgressCallback) ProgressCounter::SetProgressCallback &&setProgressCallback)
: m_filePathCache(filePathCache) : m_filePathCache(filePathCache)
, m_buildDependencyStorage(database) , m_buildDependencyStorage(database)
, m_recompiledHeaderStorage(database)
, m_symbolStorage(database) , m_symbolStorage(database)
, m_collectorManger(generatedFiles, database) , m_collectorManger(generatedFiles, database)
, m_progressCounter(std::move(setProgressCallback)) , m_progressCounter(std::move(setProgressCallback))
@@ -119,6 +121,7 @@ private:
using SymbolIndexerTaskScheduler = TaskScheduler<SymbolsCollectorManager, SymbolIndexerTask::Callable>; using SymbolIndexerTaskScheduler = TaskScheduler<SymbolsCollectorManager, SymbolIndexerTask::Callable>;
FilePathCachingInterface &m_filePathCache; FilePathCachingInterface &m_filePathCache;
BuildDependenciesStorage m_buildDependencyStorage; BuildDependenciesStorage m_buildDependencyStorage;
PrecompiledHeaderStorage<Sqlite::Database> m_recompiledHeaderStorage;
SymbolStorage m_symbolStorage; SymbolStorage m_symbolStorage;
ClangPathWatcher<QFileSystemWatcher, QTimer> m_sourceWatcher{m_filePathCache}; ClangPathWatcher<QFileSystemWatcher, QTimer> m_sourceWatcher{m_filePathCache};
FileStatusCache m_fileStatusCache{m_filePathCache}; FileStatusCache m_fileStatusCache{m_filePathCache};
@@ -127,6 +130,7 @@ private:
SymbolIndexer m_indexer{m_indexerQueue, SymbolIndexer m_indexer{m_indexerQueue,
m_symbolStorage, m_symbolStorage,
m_buildDependencyStorage, m_buildDependencyStorage,
m_recompiledHeaderStorage,
m_sourceWatcher, m_sourceWatcher,
m_filePathCache, m_filePathCache,
m_fileStatusCache, m_fileStatusCache,

View File

@@ -223,11 +223,6 @@ public:
m_deleteNewLocationsTableStatement.execute(); m_deleteNewLocationsTableStatement.execute();
} }
Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const
{
return m_getPrecompiledHeader.template value<ProjectPartPch, 2>(projectPartId);
}
SourceLocationEntries sourceLocations() const SourceLocationEntries sourceLocations() const
{ {
return SourceLocationEntries(); return SourceLocationEntries();
@@ -350,10 +345,6 @@ public:
"projectIncludeSearchPaths, projectPartId, language, languageVersion, languageExtension " "projectIncludeSearchPaths, projectPartId, language, languageVersion, languageExtension "
"FROM projectParts WHERE projectPartName = ?", "FROM projectParts WHERE projectPartName = ?",
m_database}; m_database};
mutable ReadStatement m_getPrecompiledHeader{
"SELECT projectPchPath, projectPchBuildTime FROM precompiledHeaders WHERE projectPartId = ?",
m_database
};
}; };
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -27,7 +27,6 @@
#include "filestatus.h" #include "filestatus.h"
#include "projectpartentry.h" #include "projectpartentry.h"
#include "projectpartpch.h"
#include "projectpartartefact.h" #include "projectpartartefact.h"
#include "sourcelocationentry.h" #include "sourcelocationentry.h"
#include "sourcedependency.h" #include "sourcedependency.h"
@@ -67,7 +66,6 @@ public:
FilePathId sourceId) const = 0; FilePathId sourceId) const = 0;
virtual Utils::optional<ProjectPartArtefact> fetchProjectPartArtefact( virtual Utils::optional<ProjectPartArtefact> fetchProjectPartArtefact(
Utils::SmallStringView projectPartName) const = 0; Utils::SmallStringView projectPartName) const = 0;
virtual Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const = 0;
protected: protected:
~SymbolStorageInterface() = default; ~SymbolStorageInterface() = default;

View File

@@ -65,6 +65,6 @@ def getCodeModelString(useClang):
def checkCodeModelSettings(useClang): def checkCodeModelSettings(useClang):
__openCodeModelOptions__() __openCodeModelOptions__()
test.verify(verifyChecked("{name='ignorePCHCheckBox' type='QCheckBox' visible='1'}"), test.log("Verifying whether 'Ignore pre-compiled headers' is unchecked by default.")
"Verifying whether 'Ignore pre-compiled headers' is checked by default.") verifyChecked("{name='ignorePCHCheckBox' type='QCheckBox' visible='1'}", False)
clickButton(waitForObject(":Options.OK_QPushButton")) clickButton(waitForObject(":Options.OK_QPushButton"))

View File

@@ -42,9 +42,9 @@ def tempDir():
def deleteDirIfExists(path): def deleteDirIfExists(path):
shutil.rmtree(path, True) shutil.rmtree(path, True)
def verifyChecked(objectName): def verifyChecked(objectName, checked=True):
object = waitForObject(objectName) object = waitForObject(objectName)
test.compare(object.checked, True) test.compare(object.checked, checked)
return object return object
def ensureChecked(objectName, shouldBeChecked = True, timeout=20000): def ensureChecked(objectName, shouldBeChecked = True, timeout=20000):

View File

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

View File

@@ -45,4 +45,6 @@ public:
void(const Utils::SmallStringVector &projectPartNames)); void(const Utils::SmallStringVector &projectPartNames));
MOCK_METHOD1(fetchSystemPrecompiledHeaderPath, MOCK_METHOD1(fetchSystemPrecompiledHeaderPath,
ClangBackEnd::FilePath(Utils::SmallStringView projectPartName)); 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)); Utils::optional<ClangBackEnd::ProjectPartArtefact> (ClangBackEnd::FilePathId sourceId));
MOCK_CONST_METHOD1(fetchProjectPartArtefact, MOCK_CONST_METHOD1(fetchProjectPartArtefact,
Utils::optional<ClangBackEnd::ProjectPartArtefact> (Utils::SmallStringView projectPartName)); 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; NiceMock<MockSqliteDatabase> database;
Storage storage{database}; Storage storage{database};
MockSqliteWriteStatement &insertProjectPartStatement = storage.m_insertProjectPartStatement; MockSqliteWriteStatement &insertProjectPartStatement = storage.m_insertProjectPartStatement;
MockSqliteWriteStatement &insertProjectPrecompiledHeaderStatement MockSqliteWriteStatement &insertProjectPrecompiledHeaderStatement = storage.m_insertProjectPrecompiledHeaderStatement;
= storage.m_insertProjectPrecompiledHeaderStatement; MockSqliteWriteStatement &deleteProjectPrecompiledHeaderStatement = storage.m_deleteProjectPrecompiledHeaderStatement;
MockSqliteWriteStatement &deleteProjectPrecompiledHeaderStatement MockSqliteWriteStatement &insertSystemPrecompiledHeaderStatement = storage.m_insertSystemPrecompiledHeaderStatement;
= storage.m_deleteProjectPrecompiledHeaderStatement; MockSqliteWriteStatement &deleteSystemPrecompiledHeaderStatement = storage.m_deleteSystemPrecompiledHeaderStatement;
MockSqliteWriteStatement &insertSystemPrecompiledHeaderStatement MockSqliteReadStatement &fetchSystemPrecompiledHeaderPathStatement = storage.m_fetchSystemPrecompiledHeaderPathStatement;
= storage.m_insertSystemPrecompiledHeaderStatement; MockSqliteReadStatement &getPrecompiledHeader = storage.m_getPrecompiledHeader;
MockSqliteWriteStatement &deleteSystemPrecompiledHeaderStatement
= storage.m_deleteSystemPrecompiledHeaderStatement;
MockSqliteReadStatement &fetchSystemPrecompiledHeaderPathStatement
= storage.m_fetchSystemPrecompiledHeaderPathStatement;
}; };
TEST_F(PrecompiledHeaderStorage, UseTransaction) TEST_F(PrecompiledHeaderStorage, UseTransaction)
@@ -241,4 +237,21 @@ TEST_F(PrecompiledHeaderStorage, FetchSystemPrecompiledHeaderReturnsNullOptional
ASSERT_THAT(path, IsEmpty()); 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 "googletest.h"
#include "filesystem-utilities.h" #include "filesystem-utilities.h"
#include "mockclangpathwatcher.h" #include "mockclangpathwatcher.h"
#include "mockprecompiledheaderstorage.h"
#include "mocksymbolscollector.h" #include "mocksymbolscollector.h"
#include "mocksymbolstorage.h" #include "mocksymbolstorage.h"
#include "mockfilepathcaching.h" #include "mockfilepathcaching.h"
@@ -237,6 +238,7 @@ protected:
NiceMock<MockSqliteTransactionBackend> mockSqliteTransactionBackend; NiceMock<MockSqliteTransactionBackend> mockSqliteTransactionBackend;
NiceMock<MockSymbolStorage> mockSymbolStorage; NiceMock<MockSymbolStorage> mockSymbolStorage;
NiceMock<MockBuildDependenciesStorage> mockBuildDependenciesStorage; NiceMock<MockBuildDependenciesStorage> mockBuildDependenciesStorage;
NiceMock<MockPrecompiledHeaderStorage> mockPrecompiledHeaderStorage;
NiceMock<MockClangPathWatcher> mockPathWatcher; NiceMock<MockClangPathWatcher> mockPathWatcher;
ClangBackEnd::FileStatusCache fileStatusCache{filePathCache}; ClangBackEnd::FileStatusCache fileStatusCache{filePathCache};
ClangBackEnd::GeneratedFiles generatedFiles; ClangBackEnd::GeneratedFiles generatedFiles;
@@ -246,6 +248,7 @@ protected:
ClangBackEnd::SymbolIndexer indexer{indexerQueue, ClangBackEnd::SymbolIndexer indexer{indexerQueue,
mockSymbolStorage, mockSymbolStorage,
mockBuildDependenciesStorage, mockBuildDependenciesStorage,
mockPrecompiledHeaderStorage,
mockPathWatcher, mockPathWatcher,
filePathCache, filePathCache,
fileStatusCache, fileStatusCache,
@@ -292,7 +295,8 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesInCollector)
TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesWithPrecompiledHeaderInCollector) TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesWithPrecompiledHeaderInCollector)
{ {
ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<Utils::SmallStringView>(projectPart1.projectPartId))).WillByDefault(Return(emptyArtefact)); 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, EXPECT_CALL(mockCollector,
setFile(main1PathId, setFile(main1PathId,
@@ -506,7 +510,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderWithoutProjectPartArtifact)
Eq(Utils::LanguageVersion::CXX14), Eq(Utils::LanguageVersion::CXX14),
Eq(Utils::LanguageExtension::None))) Eq(Utils::LanguageExtension::None)))
.WillOnce(Return(12)); .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(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).Times(0);
EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockSqliteTransactionBackend, commit());
EXPECT_CALL(mockCollector, EXPECT_CALL(mockCollector,
@@ -559,7 +563,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderWithProjectPartArtifact)
Eq(Utils::LanguageVersion::CXX14), Eq(Utils::LanguageVersion::CXX14),
Eq(Utils::LanguageExtension::None))) Eq(Utils::LanguageExtension::None)))
.WillOnce(Return(-1)); .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(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).WillOnce(Return(-1));
EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockSqliteTransactionBackend, commit());
EXPECT_CALL(mockCollector, EXPECT_CALL(mockCollector,
@@ -614,7 +618,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderButGetsAnErrorForCollectingS
Eq(Utils::LanguageVersion::CXX14), Eq(Utils::LanguageVersion::CXX14),
Eq(Utils::LanguageExtension::None))) Eq(Utils::LanguageExtension::None)))
.WillOnce(Return(12)); .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(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).Times(0);
EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockSqliteTransactionBackend, commit());
EXPECT_CALL(mockCollector, EXPECT_CALL(mockCollector,
@@ -656,7 +660,14 @@ TEST_F(SymbolIndexer, CallSetNotifier)
{ {
EXPECT_CALL(mockPathWatcher, setNotifier(_)); 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) TEST_F(SymbolIndexer, PathChangedCallsFetchProjectPartArtefactInStorage)
@@ -673,7 +684,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathCallsInOrder)
EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin());
EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<FilePathId>(sourceFileIds[0]))).WillOnce(Return(artefact)); 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(mockSqliteTransactionBackend, commit());
EXPECT_CALL(mockCollector, EXPECT_CALL(mockCollector,
setFile(Eq(sourceFileIds[0]), setFile(Eq(sourceFileIds[0]),
@@ -715,7 +726,7 @@ TEST_F(SymbolIndexer, HandleEmptyOptionalArtifactInUpdateChangedPath)
EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin());
EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(sourceFileIds[0])).WillOnce(Return(nullArtefact)); 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(mockSqliteTransactionBackend, commit()).Times(0);
EXPECT_CALL(mockCollector, setFile(_, _)).Times(0); EXPECT_CALL(mockCollector, setFile(_, _)).Times(0);
EXPECT_CALL(mockCollector, collectSymbols()).Times(0); EXPECT_CALL(mockCollector, collectSymbols()).Times(0);
@@ -737,7 +748,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathCallsInOrderButGetsAnErrorForCollectingSy
EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin()); EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin());
EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<FilePathId>(sourceFileIds[0]))) EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<FilePathId>(sourceFileIds[0])))
.WillOnce(Return(artefact)); .WillOnce(Return(artefact));
EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))); EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId)));
EXPECT_CALL(mockSqliteTransactionBackend, commit()); EXPECT_CALL(mockSqliteTransactionBackend, commit());
EXPECT_CALL(mockCollector, EXPECT_CALL(mockCollector,
setFile(Eq(sourceFileIds[0]), setFile(Eq(sourceFileIds[0]),
@@ -779,8 +790,8 @@ TEST_F(SymbolIndexer, UpdateChangedPathIsUsingPrecompiledHeader)
{ {
ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<FilePathId>(sourceFileIds[0]))) ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<FilePathId>(sourceFileIds[0])))
.WillByDefault(Return(artefact)); .WillByDefault(Return(artefact));
ON_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))) ON_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId)))
.WillByDefault(Return(projectPartPch)); .WillByDefault(Return(projectPartPch));
std::vector<SymbolIndexerTask> symbolIndexerTask; std::vector<SymbolIndexerTask> symbolIndexerTask;
EXPECT_CALL(mockCollector, EXPECT_CALL(mockCollector,

View File

@@ -74,7 +74,6 @@ protected:
MockSqliteWriteStatement &insertProjectPartSourcesStatement = storage.m_insertProjectPartSourcesStatement; MockSqliteWriteStatement &insertProjectPartSourcesStatement = storage.m_insertProjectPartSourcesStatement;
MockSqliteReadStatement &getProjectPartArtefactsBySourceId = storage.m_getProjectPartArtefactsBySourceId; MockSqliteReadStatement &getProjectPartArtefactsBySourceId = storage.m_getProjectPartArtefactsBySourceId;
MockSqliteReadStatement &getProjectPartArtefactsByProjectPartName = storage.m_getProjectPartArtefactsByProjectPartName; MockSqliteReadStatement &getProjectPartArtefactsByProjectPartName = storage.m_getProjectPartArtefactsByProjectPartName;
MockSqliteReadStatement &getPrecompiledHeader = storage.m_getPrecompiledHeader;
SymbolEntries symbolEntries{{1, {"functionUSR", "function", SymbolKind::Function}}, SymbolEntries symbolEntries{{1, {"functionUSR", "function", SymbolKind::Function}},
{2, {"function2USR", "function2", SymbolKind::Function}}}; {2, {"function2USR", "function2", SymbolKind::Function}}};
@@ -261,24 +260,6 @@ TEST_F(SymbolStorage, FetchProjectPartArtefactByProjectNameReturnArtefact)
ASSERT_THAT(result, Eq(artefact)); 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) TEST_F(SymbolStorage, AddNewSymbolsTable)
{ {
InSequence s; InSequence s;