Merge remote-tracking branch 'origin/4.14' into master

Change-Id: I8fa31853863de717ef68dcd9d39dfece6a6cdfc4
This commit is contained in:
Eike Ziller
2020-10-09 16:39:20 +02:00
73 changed files with 647 additions and 379 deletions

View File

@@ -48,9 +48,7 @@ jobs:
- name: Checkout submodules
run: |
git submodule set-url -- perfparser https://code.qt.io/qt-creator/perfparser.git
git submodule update --init src/plugins/help/qlitehtml/litehtml
git submodule update --init src/tools/perfparser
git submodule update --init tests/unit/unittest/3rdparty/googletest
git submodule update --init
- name: Download Ninja and CMake
shell: cmake -P {0}

View File

@@ -360,8 +360,7 @@ function(enable_pch target)
endif()
unset(PCH_TARGET)
if ("Qt5::Widgets" IN_LIST dependencies OR
"Qt5::Gui" IN_LIST dependencies)
if ("Qt5::Widgets" IN_LIST dependencies)
set(PCH_TARGET QtCreatorPchGui)
elseif ("Qt5::Core" IN_LIST dependencies)
set(PCH_TARGET QtCreatorPchConsole)

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -113,10 +113,15 @@
icon, hover the mouse pointer over the line.
Select the \inlineimage settings.png
button to configure Clang diagnostics globally for Clang tools.
button to customize Clang diagnostics for the current project.
\image qtcreator-clang-tools-options-customized.png "Clang Tools customized settings"
To restore the global settings, select \uicontrol {Restore Global Settings}.
To view and modify the global settings, select
\uicontrol {Open Global Settings}. To open the Clang static analyzer,
select \uicontrol {Go to Analyzer}.
\section1 Configuring Clang Tools
To configure Clang diagnostics globally for Clang tools:
@@ -138,6 +143,9 @@
generated during the build. For big projects, not building the
project might save some time.
\li To disable automatic analysis of open documents, deselect the
\uicontrol {Analyze open files} check box.
\li In the \uicontrol {Parallel jobs} field, select the number of jobs
to run in parallel to make the analysis faster on multi-core
processors.
@@ -147,7 +155,7 @@
\li Select \uicontrol Copy to create a custom Clang configuration.
\image qtcreator-diagnostics-configuration.png "Diagnostics Configuration dialog"
\image qtcreator-clang-copy-diagnostic-configuration.png "Copy Diagnostic Configuration dialog"
\li In the \uicontrol {Diagnostic configuration name} field, give the
configuration a name, and then select \uicontrol OK.
@@ -158,6 +166,8 @@
system to the Clang code model for displaying annotations in the
code editor.
\image qtcreator-diagnostics-configuration.png "Diagnostics Configuration dialog"
\li In the \uicontrol {Clang-Tidy Checks} tab, select
\uicontrol {Select Checks} to select the checks to perform.

View File

@@ -26,8 +26,10 @@
#include "valueschangedcommand.h"
#include "sharedmemory.h"
#include <QCache>
#include <QDebug>
#include <QIODevice>
#include <cstring>

View File

@@ -728,11 +728,11 @@ namespace ADS
while (stateReader.readNextStartElement()) {
QWidget *childNode = nullptr;
bool result = true;
if (stateReader.name() == "splitter") {
if (stateReader.name() == QLatin1String("splitter")) {
result = restoreSplitter(stateReader, childNode, testing);
} else if (stateReader.name() == "area") {
} else if (stateReader.name() == QLatin1String("area")) {
result = restoreDockArea(stateReader, childNode, testing);
} else if (stateReader.name() == "sizes") {
} else if (stateReader.name() == QLatin1String("sizes")) {
QString size = stateReader.readElementText().trimmed();
qCInfo(adsLog) << "Size: " << size;
QTextStream textStream(&size);
@@ -797,7 +797,7 @@ namespace ADS
dockArea = new DockAreaWidget(m_dockManager, q);
while (stateReader.readNextStartElement()) {
if (stateReader.name() != "widget")
if (stateReader.name() != QLatin1String("widget"))
continue;
auto objectName = stateReader.attributes().value("name");
@@ -849,10 +849,10 @@ namespace ADS
{
bool result = true;
while (stateReader.readNextStartElement()) {
if (stateReader.name() == "splitter") {
if (stateReader.name() == QLatin1String("splitter")) {
result = restoreSplitter(stateReader, createdWidget, testing);
qCInfo(adsLog) << "Splitter";
} else if (stateReader.name() == "area") {
} else if (stateReader.name() == QLatin1String("area")) {
result = restoreDockArea(stateReader, createdWidget, testing);
qCInfo(adsLog) << "DockAreaWidget";
} else {
@@ -1302,7 +1302,7 @@ namespace ADS
if (isFloating) {
qCInfo(adsLog) << "Restore floating widget";
if (!stateReader.readNextStartElement() || stateReader.name() != "geometry")
if (!stateReader.readNextStartElement() || stateReader.name() != QLatin1String("geometry"))
return false;
QByteArray geometryString = stateReader

View File

@@ -191,7 +191,7 @@ namespace ADS
if (!stateReader.readNextStartElement())
return false;
if (stateReader.name() != "QtAdvancedDockingSystem")
if (stateReader.name() != QLatin1String("QtAdvancedDockingSystem"))
return false;
qCInfo(adsLog) << stateReader.attributes().value("version");
@@ -219,7 +219,7 @@ namespace ADS
#endif
int dockContainerCount = 0;
while (stateReader.readNextStartElement()) {
if (stateReader.name() == "container") {
if (stateReader.name() == QLatin1String("container")) {
result = restoreContainer(dockContainerCount, stateReader, testing);
if (!result)
break;

View File

@@ -52,14 +52,15 @@ if (_library_enabled)
return()
endif()
set(PythonRegex "^(.*)/(.*)/(python[0-9]+)${CMAKE_IMPORT_LIBRARY_SUFFIX}$")
set(PythonRegex "^(.*)/(.*)/(python([0-9]+))${CMAKE_IMPORT_LIBRARY_SUFFIX}$")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(PythonRegex "^(.*)/(.*)/(python[0-9]+_d)${CMAKE_IMPORT_LIBRARY_SUFFIX}$")
set(PythonRegex "^(.*)/(.*)/(python([0-9]+)_d)${CMAKE_IMPORT_LIBRARY_SUFFIX}$")
endif()
foreach(lib IN LISTS PYTHON_LIBRARIES)
if (lib MATCHES ${PythonRegex})
set(PythonDll "${CMAKE_MATCH_1}/${CMAKE_MATCH_3}${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(PythonZip "${CMAKE_MATCH_1}/python${CMAKE_MATCH_4}.zip")
break()
endif()
endforeach()
@@ -84,13 +85,16 @@ if (_library_enabled)
pyvalue.cpp pyvalue.h
)
install(FILES "${PythonDll}"
install(FILES
"${PythonDll}"
"${PythonZip}"
DESTINATION lib/qtcreatorcdbext${ArchSuffix}/
COMPONENT qtcreatorcdbext)
add_custom_target(copy_python_dll ALL VERBATIM)
add_custom_command(TARGET copy_python_dll POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy "${PythonDll}" "${PROJECT_BINARY_DIR}/lib/qtcreatorcdbext${ArchSuffix}/"
COMMAND "${CMAKE_COMMAND}" -E copy "${PythonZip}" "${PROJECT_BINARY_DIR}/lib/qtcreatorcdbext${ArchSuffix}/"
VERBATIM
)
endif()

View File

@@ -85,6 +85,36 @@ void BaseAspect::setConfigWidgetCreator(const ConfigWidgetCreator &configWidgetC
m_configWidgetCreator = configWidgetCreator;
}
/*!
Returns the key to be used when accessing the settings.
\sa setSettingsKey()
*/
QString BaseAspect::settingsKey() const
{
return m_settingsKey;
}
/*!
Sets the key to be used when accessing the settings.
\sa settingsKey()
*/
void BaseAspect::setSettingsKey(const QString &key)
{
m_settingsKey = key;
}
/*!
Sets the key and group to be used when accessing the settings.
\sa settingsKey()
*/
void BaseAspect::setSettingsKey(const QString &group, const QString &key)
{
m_settingsKey = group + "/" + key;
}
/*!
\internal
*/

View File

@@ -59,11 +59,12 @@ public:
void setId(Utils::Id id) { m_id = id; }
void setDisplayName(const QString &displayName) { m_displayName = displayName; }
void setSettingsKey(const QString &settingsKey) { m_settingsKey = settingsKey; }
void setSettingsKey(const QString &settingsKey);
void setSettingsKey(const QString &group, const QString &key);
Utils::Id id() const { return m_id; }
QString displayName() const { return m_displayName; }
QString settingsKey() const { return m_settingsKey; }
QString settingsKey() const;
bool isVisible() const { return m_visible; }
void setVisible(bool visible) { m_visible = visible; }

View File

@@ -31,6 +31,7 @@
#include <QFormLayout>
#include <QGridLayout>
#include <QStyle>
#include <QWidget>
namespace Utils {
@@ -69,7 +70,7 @@ LayoutBuilder::LayoutItem::LayoutItem()
Constructs a layout item proxy for \a layout, spanning the number
of cells specified by \a span in the target layout, with alignment \a align.
*/
LayoutBuilder::LayoutItem::LayoutItem(QLayout *layout, int span, Qt::Alignment align)
LayoutBuilder::LayoutItem::LayoutItem(QLayout *layout, int span, Alignment align)
: layout(layout), span(span), align(align)
{}
@@ -77,7 +78,7 @@ LayoutBuilder::LayoutItem::LayoutItem(QLayout *layout, int span, Qt::Alignment a
Constructs a layout item proxy for \a widget, spanning the number
of cell specified by \a span in the target layout, with alignment \a align.
*/
LayoutBuilder::LayoutItem::LayoutItem(QWidget *widget, int span, Qt::Alignment align)
LayoutBuilder::LayoutItem::LayoutItem(QWidget *widget, int span, Alignment align)
: widget(widget), span(span), align(align)
{}
@@ -269,8 +270,12 @@ LayoutBuilder &LayoutBuilder::addItem(const LayoutItem &item)
item.aspect->addToLayout(*this);
} else {
if (m_gridLayout) {
if (auto widget = item.widget)
m_gridLayout->addWidget(widget, m_currentGridRow, m_currentGridColumn, 1, item.span, item.align);
if (auto widget = item.widget) {
Qt::Alignment align;
if (item.align == AlignAsFormLabel)
align = Qt::Alignment(widget->style()->styleHint(QStyle::SH_FormLayoutLabelAlignment));
m_gridLayout->addWidget(widget, m_currentGridRow, m_currentGridColumn, 1, item.span, align);
}
m_currentGridColumn += item.span;
} else {
m_pendingFormItems.append(item);

View File

@@ -45,6 +45,8 @@ class QTCREATOR_UTILS_EXPORT LayoutBuilder
{
public:
enum LayoutType { GridLayout, FormLayout };
enum Alignment { DefaultAlignment, AlignAsFormLabel };
explicit LayoutBuilder(QWidget *parent, LayoutType layoutType = FormLayout);
explicit LayoutBuilder(QLayout *layout); // Adds to existing layout.
@@ -54,8 +56,8 @@ public:
{
public:
LayoutItem();
LayoutItem(QLayout *layout, int span = 1, Qt::Alignment align = {});
LayoutItem(QWidget *widget, int span = 1, Qt::Alignment align = {});
LayoutItem(QLayout *layout, int span = 1, Alignment align = {});
LayoutItem(QWidget *widget, int span = 1, Alignment align = {});
LayoutItem(BaseAspect *aspect);
LayoutItem(const QString &text);
@@ -64,7 +66,7 @@ public:
BaseAspect *aspect = nullptr;
QString text;
int span = 1;
Qt::Alignment align;
Alignment align;
};
LayoutBuilder &addItem(const LayoutItem &item);

View File

@@ -113,38 +113,6 @@ void SavedAction::setDefaultValue(const QVariant &value)
}
/*!
Returns the key to be used when accessing the settings.
\sa settingsKey()
*/
QString SavedAction::settingsKey() const
{
return m_settingsKey;
}
/*!
Sets the key to be used when accessing the settings.
\sa settingsKey()
*/
void SavedAction::setSettingsKey(const QString &key)
{
m_settingsKey = key;
}
/*!
Sets the key and group to be used when accessing the settings.
\sa settingsKey()
*/
void SavedAction::setSettingsKey(const QString &group, const QString &key)
{
m_settingsKey = group + "/" + key;
}
QString SavedAction::toString() const
{
return QLatin1String("value: ") + m_value.toString()

View File

@@ -54,11 +54,6 @@ public:
void trigger(const QVariant &data);
// used for persistency
QString settingsKey() const;
void setSettingsKey(const QString &key);
void setSettingsKey(const QString &group, const QString &key);
virtual void readSettings(const QSettings *settings);
virtual void writeSettings(QSettings *settings);
@@ -88,7 +83,6 @@ private:
QVariant m_value;
QVariant m_defaultValue;
QString m_settingsKey;
QString m_dialogText;
QWidget *m_widget = nullptr;
QAction m_action;

View File

@@ -244,14 +244,16 @@ void AvdDialog::updateApiLevelComboBox()
if (installedSystemImages.isEmpty()) {
m_avdDialog.targetApiComboBox->setEnabled(false);
m_avdDialog.warningText->setVisible(true);
m_avdDialog.warningText->setText(tr("Cannot create a new AVD. No sufficiently recent Android SDK available.\n"
"Install an SDK of at least API version %1.")
.arg(m_minApiLevel));
m_avdDialog.warningText->setText(
tr("Cannot create a new AVD. No suitable Android system image is installed.\n"
"Install a system image of at least API version %1 from the SDK Manager tab.")
.arg(m_minApiLevel));
} else if (filteredList.isEmpty()) {
m_avdDialog.targetApiComboBox->setEnabled(false);
m_avdDialog.warningText->setVisible(true);
m_avdDialog.warningText->setText(tr("Cannot create a AVD for ABI %1. Install an image for it.")
.arg(abi()));
m_avdDialog.warningText->setText(tr("Cannot create an AVD for ABI %1. Install a system "
"image for it from the SDK Manager tab first.")
.arg(abi()));
} else {
m_avdDialog.warningText->setVisible(false);
m_avdDialog.targetApiComboBox->setEnabled(true);

View File

@@ -143,16 +143,16 @@ void CatchOutputReader::processOutputLine(const QByteArray &outputLineWithNewLin
case QXmlStreamReader::EndElement: {
const auto currentTag = m_xmlReader.name();
if (currentTag == CatchXml::SectionElement) {
if (currentTag == QLatin1String(CatchXml::SectionElement)) {
sendResult(ResultType::TestEnd);
testOutputNodeFinished(SectionNode);
} else if (currentTag == CatchXml::TestCaseElement) {
} else if (currentTag == QLatin1String(CatchXml::TestCaseElement)) {
sendResult(ResultType::TestEnd);
testOutputNodeFinished(TestCaseNode);
} else if (currentTag == CatchXml::GroupElement) {
} else if (currentTag == QLatin1String(CatchXml::GroupElement)) {
testOutputNodeFinished(GroupNode);
} else if (currentTag == CatchXml::ExpressionElement
|| currentTag == CatchXml::BenchmarkResults) {
} else if (currentTag == QLatin1String(CatchXml::ExpressionElement)
|| currentTag == QLatin1String(CatchXml::BenchmarkResults)) {
sendResult(m_currentResult);
m_currentExpression.clear();
m_testCaseInfo.pop();

View File

@@ -343,10 +343,6 @@ void TestResultsPane::clearContents()
clearMarks();
}
void TestResultsPane::visibilityChanged(bool /*visible*/)
{
}
void TestResultsPane::setFocus()
{
}

View File

@@ -85,7 +85,6 @@ public:
QString displayName() const override;
int priorityInStatusBar() const override;
void clearContents() override;
void visibilityChanged(bool visible) override;
void setFocus() override;
bool hasFocus() const override;
bool canFocus() const override;

View File

@@ -249,7 +249,7 @@ void DeviceSelectionModel::parsePackage(const QString &packageFile)
QXmlStreamReader in(&f);
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == "package")
if (elementName == QLatin1String("package"))
parsePackage(in, packageFile);
else
in.skipCurrentElement();
@@ -265,18 +265,18 @@ void DeviceSelectionModel::parsePackage(QXmlStreamReader &in, const QString &pac
child->version = extractPackVersion(packageFile);
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == "name") {
if (elementName == QLatin1String("name")) {
fillElementProperty(in, child->name);
} else if (elementName == "description") {
} else if (elementName == QLatin1String("description")) {
fillElementProperty(in, child->desc);
} else if (elementName == "vendor") {
} else if (elementName == QLatin1String("vendor")) {
fillVendor(in, child->vendorName, child->vendorId);
} else if (elementName == "url") {
} else if (elementName == QLatin1String("url")) {
fillElementProperty(in, child->url);
} else if (elementName == "devices") {
} else if (elementName == QLatin1String("devices")) {
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == "family")
if (elementName == QLatin1String("family"))
parseFamily(in, child);
else
in.skipCurrentElement();
@@ -297,17 +297,17 @@ void DeviceSelectionModel::parseFamily(QXmlStreamReader &in, DeviceSelectionItem
fillVendor(attrs.value("Dvendor").toString(), child->vendorName, child->vendorId);
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == "processor") {
if (elementName == QLatin1String("processor")) {
fillCpu(in, child->cpu);
} else if (elementName == "algorithm") {
} else if (elementName == QLatin1String("algorithm")) {
fillAlgorithms(in, child->algorithms);
} else if (elementName == "memory") {
} else if (elementName == QLatin1String("memory")) {
fillMemories(in, child->memories);
} else if (elementName == "description") {
} else if (elementName == QLatin1String("description")) {
fillElementProperty(in, child->desc);
} else if (elementName == "subFamily") {
} else if (elementName == QLatin1String("subFamily")) {
parseSubFamily(in, child);
} else if (elementName == "device") {
} else if (elementName == QLatin1String("device")) {
parseDevice(in, child);
} else {
in.skipCurrentElement();
@@ -324,11 +324,11 @@ void DeviceSelectionModel::parseSubFamily(QXmlStreamReader &in, DeviceSelectionI
child->name = attrs.value("DsubFamily").toString();
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == "processor") {
if (elementName == QLatin1String("processor")) {
fillCpu(in, child->cpu);
} else if (elementName == "debug") {
} else if (elementName == QLatin1String("debug")) {
fillSvd(in, child->svd);
} else if (elementName == "device") {
} else if (elementName == QLatin1String("device")) {
parseDevice(in, child);
} else {
in.skipCurrentElement();
@@ -345,17 +345,17 @@ void DeviceSelectionModel::parseDevice(QXmlStreamReader &in, DeviceSelectionItem
child->name = attrs.value("Dname").toString();
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == "processor") {
if (elementName == QLatin1String("processor")) {
fillCpu(in, child->cpu);
} else if (elementName == "debug") {
} else if (elementName == QLatin1String("debug")) {
fillSvd(in, child->svd);
} else if (elementName == "description") {
} else if (elementName == QLatin1String("description")) {
fillElementProperty(in, child->desc);
} else if (elementName == "memory") {
} else if (elementName == QLatin1String("memory")) {
fillMemories(in, child->memories);
} else if (elementName == "algorithm") {
} else if (elementName == QLatin1String("algorithm")) {
fillAlgorithms(in, child->algorithms);
} else if (elementName == "variant") {
} else if (elementName == QLatin1String("variant")) {
parseDeviceVariant(in, child);
} else {
in.skipCurrentElement();
@@ -372,11 +372,11 @@ void DeviceSelectionModel::parseDeviceVariant(QXmlStreamReader &in, DeviceSelect
child->name = attrs.value("Dvariant").toString();
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == "processor") {
if (elementName == QLatin1String("processor")) {
fillCpu(in, child->cpu);
} else if (elementName == "memory") {
} else if (elementName == QLatin1String("memory")) {
fillMemories(in, child->memories);
} else if (elementName == "algorithm") {
} else if (elementName == QLatin1String("algorithm")) {
fillAlgorithms(in, child->algorithms);
} else {
in.skipCurrentElement();

View File

@@ -319,7 +319,7 @@ void AbstractSettings::readDocumentation()
QXmlStreamReader xml(&file);
if (!xml.readNextStartElement())
return;
if (xml.name() != Constants::DOCUMENTATION_XMLROOT) {
if (xml.name() != QLatin1String(Constants::DOCUMENTATION_XMLROOT)) {
BeautifierPlugin::showError(tr("The file \"%1\" is not a valid documentation file.")
.arg(filename));
return;

View File

@@ -469,7 +469,7 @@ bool CompleteCommand::run()
auto *processor = ClangEditorDocumentProcessor::get(documentFilePath);
QTC_ASSERT(processor, return false);
return completionResults(editor, QStringList(), timeOutInMs());
return !completionResults(editor, QStringList(), timeOutInMs()).isNull();
}
Command::Ptr CompleteCommand::parse(BatchFileLineTokenizer &arguments,

View File

@@ -352,11 +352,11 @@ static void localizedText(const QStringList &locales, QXmlStreamReader *reader,
static bool parseOutputAttribute(const QString &attribute, QXmlStreamReader *reader, ExternalTool::OutputHandling *value)
{
const auto output = reader->attributes().value(attribute);
if (output == kOutputShowInPane) {
if (output == QLatin1String(kOutputShowInPane)) {
*value = ExternalTool::ShowInPane;
} else if (output == kOutputReplaceSelection) {
} else if (output == QLatin1String(kOutputReplaceSelection)) {
*value = ExternalTool::ReplaceSelection;
} else if (output == kOutputIgnore) {
} else if (output == QLatin1String(kOutputIgnore)) {
*value = ExternalTool::Ignore;
} else {
reader->raiseError("Allowed values for output attribute are 'showinpane','replaceselection','ignore'");
@@ -374,19 +374,19 @@ ExternalTool * ExternalTool::createFromXml(const QByteArray &xml, QString *error
auto tool = new ExternalTool;
QXmlStreamReader reader(xml);
if (!reader.readNextStartElement() || reader.name() != kExternalTool)
if (!reader.readNextStartElement() || reader.name() != QLatin1String(kExternalTool))
reader.raiseError("Missing start element <externaltool>");
tool->m_id = reader.attributes().value(kId).toString();
if (tool->m_id.isEmpty())
reader.raiseError("Missing or empty id attribute for <externaltool>");
while (reader.readNextStartElement()) {
if (reader.name() == kDescription) {
if (reader.name() == QLatin1String(kDescription)) {
localizedText(locales, &reader, &descriptionLocale, &tool->m_description);
} else if (reader.name() == kDisplayName) {
} else if (reader.name() == QLatin1String(kDisplayName)) {
localizedText(locales, &reader, &nameLocale, &tool->m_displayName);
} else if (reader.name() == kCategory) {
} else if (reader.name() == QLatin1String(kCategory)) {
localizedText(locales, &reader, &categoryLocale, &tool->m_displayCategory);
} else if (reader.name() == kOrder) {
} else if (reader.name() == QLatin1String(kOrder)) {
if (tool->m_order >= 0) {
reader.raiseError("only one <order> element allowed");
break;
@@ -395,7 +395,7 @@ ExternalTool * ExternalTool::createFromXml(const QByteArray &xml, QString *error
tool->m_order = reader.readElementText().toInt(&ok);
if (!ok || tool->m_order < 0)
reader.raiseError("<order> element requires non-negative integer value");
} else if (reader.name() == kExecutable) {
} else if (reader.name() == QLatin1String(kExecutable)) {
if (reader.attributes().hasAttribute(kOutput)) {
if (!parseOutputAttribute(kOutput, &reader, &tool->m_outputHandling))
break;
@@ -406,9 +406,9 @@ ExternalTool * ExternalTool::createFromXml(const QByteArray &xml, QString *error
}
if (reader.attributes().hasAttribute(kModifiesDocument)) {
const auto value = reader.attributes().value(kModifiesDocument);
if (value == kYes || value == kTrue) {
if (value == QLatin1String(kYes) || value == QLatin1String(kTrue)) {
tool->m_modifiesCurrentDocument = true;
} else if (value == kNo || value == kFalse) {
} else if (value == QLatin1String(kNo) || value == QLatin1String(kFalse)) {
tool->m_modifiesCurrentDocument = false;
} else {
reader.raiseError("Allowed values for modifiesdocument attribute are 'yes','true','no','false'");
@@ -416,33 +416,33 @@ ExternalTool * ExternalTool::createFromXml(const QByteArray &xml, QString *error
}
}
while (reader.readNextStartElement()) {
if (reader.name() == kPath) {
if (reader.name() == QLatin1String(kPath)) {
tool->m_executables.append(reader.readElementText());
} else if (reader.name() == kArguments) {
} else if (reader.name() == QLatin1String(kArguments)) {
if (!tool->m_arguments.isEmpty()) {
reader.raiseError("only one <arguments> element allowed");
break;
}
tool->m_arguments = reader.readElementText();
} else if (reader.name() == kInput) {
} else if (reader.name() == QLatin1String(kInput)) {
if (!tool->m_input.isEmpty()) {
reader.raiseError("only one <input> element allowed");
break;
}
tool->m_input = reader.readElementText();
} else if (reader.name() == kWorkingDirectory) {
} else if (reader.name() == QLatin1String(kWorkingDirectory)) {
if (!tool->m_workingDirectory.isEmpty()) {
reader.raiseError("only one <workingdirectory> element allowed");
break;
}
tool->m_workingDirectory = reader.readElementText();
} else if (reader.name() == kBaseEnvironmentId) {
} else if (reader.name() == QLatin1String(kBaseEnvironmentId)) {
if (tool->m_baseEnvironmentProviderId.isValid()) {
reader.raiseError("only one <baseEnvironmentId> element allowed");
break;
}
tool->m_baseEnvironmentProviderId = Id::fromString(reader.readElementText());
} else if (reader.name() == kEnvironment) {
} else if (reader.name() == QLatin1String(kEnvironment)) {
if (!tool->m_environment.isEmpty()) {
reader.raiseError("only one <environment> element allowed");
break;

View File

@@ -58,7 +58,7 @@ public:
virtual int priorityInStatusBar() const = 0;
virtual void clearContents() = 0;
virtual void visibilityChanged(bool visible) = 0;
virtual void visibilityChanged(bool visible);
virtual void setFocus() = 0;
virtual bool hasFocus() const = 0;

View File

@@ -34,11 +34,13 @@
#include <utils/fancymainwindow.h>
#include <utils/theme/theme.h>
#include <utils/utilsicons.h>
#include <utils/qtcassert.h>
#include <QApplication>
#include <QComboBox>
#include <QDockWidget>
#include <QFormLayout>
#include <QGroupBox>
#include <QLabel>
#include <QLineEdit>
#include <QMenuBar>
@@ -116,6 +118,12 @@ bool lightColored(const QWidget *widget)
return false;
}
static bool isDarkFusionStyle(const QStyle *style)
{
return creatorTheme()->flag(Theme::DarkUserInterface)
&& strcmp(style->metaObject()->className(), "QFusionStyle") == 0;
}
class ManhattanStylePrivate
{
public:
@@ -385,11 +393,150 @@ int ManhattanStyle::styleHint(StyleHint hint, const QStyleOption *option, const
return ret;
}
static void drawPrimitiveTweakedForDarkTheme(QStyle::PrimitiveElement element,
const QStyleOption *option,
QPainter *painter, const QWidget *widget)
{
const bool hasFocus = option->state & QStyle::State_HasFocus;
const bool isChecked = option->state & QStyle::State_On;
const bool isPartiallyChecked = option->state & QStyle::State_NoChange;
const bool isEnabled = option->state & QStyle::State_Enabled;
const bool isSunken = option->state & QStyle::State_Sunken;
const QColor frameColor = isEnabled ? option->palette.color(QPalette::Mid).darker(132)
: creatorTheme()->color(Theme::BackgroundColorDisabled);
const QColor indicatorColor = isEnabled ? option->palette.color(QPalette::Mid).darker(90)
: creatorTheme()->color(Theme::BackgroundColorDisabled);
const QColor bgColor = isSunken ? option->palette.color(QPalette::Mid).darker()
: option->palette.color(QPalette::Window);
const QColor hlColor = option->palette.color(QPalette::Highlight);
QPen framePen(hasFocus ? hlColor : frameColor, 1);
framePen.setJoinStyle(Qt::MiterJoin);
QPen indicatorPen(indicatorColor, 1);
indicatorPen.setJoinStyle(Qt::MiterJoin);
painter->save();
painter->setRenderHint(QPainter::Antialiasing);
switch (element) {
case QStyle::PE_Frame: {
const QRectF frameRectF = QRectF(option->rect).adjusted(0.5, 0.5, -0.5, -0.5);
painter->setPen(framePen);
painter->drawRect(frameRectF);
break;
}
case QStyle::PE_FrameLineEdit: {
const bool isComboBox = widget->inherits("QComboBox");
const QRectF frameRectF =
QRectF(option->rect).adjusted(0.5, 0.5, isComboBox ? -8.5 : -0.5, -0.5);
painter->setPen(framePen);
painter->drawRect(frameRectF);
break;
}
case QStyle::PE_FrameGroupBox: {
// Snippet from QFusionStyle::drawPrimitive - BEGIN
static const int groupBoxTopMargin = 3;
int topMargin = 0;
auto control = dynamic_cast<const QGroupBox *>(widget);
if (control && !control->isCheckable() && control->title().isEmpty()) {
// Shrinking the topMargin if Not checkable AND title is empty
topMargin = groupBoxTopMargin;
} else {
topMargin = qMax(widget->style()->pixelMetric(QStyle::PM_ExclusiveIndicatorHeight),
option->fontMetrics.height()) + groupBoxTopMargin;
}
// Snippet from QFusionStyle::drawPrimitive - END
const QRectF frameRectF = QRectF(option->rect).adjusted(0.5, topMargin + 0.5, -0.5, -0.5);
painter->setPen(framePen);
if (isEnabled)
painter->setOpacity(0.5);
painter->drawRect(frameRectF);
break;
}
case QStyle::PE_IndicatorRadioButton: {
const double lineWidth = 1.666;
const double o = lineWidth / 2;
indicatorPen.setWidth(lineWidth);
painter->setPen(framePen);
if (isEnabled)
painter->setBrush(bgColor);
painter->drawRoundedRect(QRectF(option->rect).adjusted(o, o, -o, -o),
100, 100, Qt::RelativeSize);
if (isChecked) {
painter->setPen(Qt::NoPen);
painter->setBrush(indicatorColor);
const double o = 4.25;
painter->drawRoundedRect(QRectF(option->rect).adjusted(o, o, -o, -o),
100, 100, Qt::RelativeSize);
}
break;
}
case QStyle::PE_IndicatorCheckBox: {
const QRectF frameRectF = QRectF(option->rect).adjusted(0.5, 0.5, -0.5, -0.5);
painter->setPen(framePen);
if (isEnabled)
painter->setBrush(bgColor);
painter->drawRect(frameRectF);
if (isPartiallyChecked) {
QPen outline(indicatorColor, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
painter->setPen(outline);
QColor fill(frameColor);
fill.setAlphaF(0.8);
painter->setBrush(fill);
const double o = 3.5;
painter->drawRect(QRectF(option->rect).adjusted(o, o, -o, -o));
} else if (isChecked) {
const double o = 3;
const QRectF r = QRectF(option->rect).adjusted(o, o, -o, -o);
QPen checkMarkPen(indicatorColor, 1.75, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
painter->setPen(checkMarkPen);
painter->drawPolyline(QPolygonF({QPointF(r.left(), r.top() + r.height() / 2),
QPointF(r.left() + r.width() / 2.3, r.bottom()),
r.topRight()}));
}
break;
}
case QStyle::PE_IndicatorTabClose: {
QWindow *window = widget->window()->windowHandle();
QRect iconRect = QRect(0, 0, 16, 16);
iconRect.moveCenter(option->rect.center());
const QIcon::Mode mode = !isEnabled ? QIcon::Disabled : QIcon::Normal;
const static QIcon closeIcon = Utils::Icons::CLOSE_FOREGROUND.icon();
if (option->state & QStyle::State_MouseOver)
widget->style()->drawPrimitive(QStyle::PE_PanelButtonCommand, option, painter, widget);
const QPixmap iconPx =
closeIcon.pixmap(window, iconRect.size() * widget->devicePixelRatio(), mode);
painter->drawPixmap(iconRect, iconPx);
break;
}
default:
QTC_ASSERT_STRING("Unhandled QStyle::PrimitiveElement case");
break;
}
painter->restore();
}
void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
QPainter *painter, const QWidget *widget) const
{
if (!panelWidget(widget)) {
QProxyStyle::drawPrimitive(element, option, painter, widget);
const bool isPanelWidget = panelWidget(widget);
if (!isPanelWidget) {
const bool tweakDarkTheme =
(element == PE_Frame
|| element == PE_FrameLineEdit
|| element == PE_FrameGroupBox
|| element == PE_IndicatorRadioButton
|| element == PE_IndicatorCheckBox
|| element == PE_IndicatorTabClose)
&& isDarkFusionStyle(baseStyle());
if (tweakDarkTheme)
drawPrimitiveTweakedForDarkTheme(element, option, painter, widget);
else
QProxyStyle::drawPrimitive(element, option, painter, widget);
return;
}

View File

@@ -105,10 +105,6 @@ QString MessageOutputWindow::displayName() const
return tr("General Messages");
}
void MessageOutputWindow::visibilityChanged(bool /*b*/)
{
}
void MessageOutputWindow::append(const QString &text)
{
m_widget->appendMessage(text, Utils::DebugFormat);

View File

@@ -45,7 +45,6 @@ public:
QString displayName() const override;
int priorityInStatusBar() const override;
void clearContents() override;
void visibilityChanged(bool visible) override;
void append(const QString &text);
bool canFocus() const override;

View File

@@ -126,6 +126,10 @@ QList<QWidget *> IOutputPane::toolBarWidgets() const
return widgets << m_zoomInButton << m_zoomOutButton;
}
void IOutputPane::visibilityChanged(bool /*visible*/)
{
}
void IOutputPane::setFont(const QFont &font)
{
emit fontChanged(font);

View File

@@ -96,12 +96,12 @@ static QString findResourceInFile(const QString &resName, const QString &filePat
while (!xmlr.atEnd() && !xmlr.hasError()) {
const QXmlStreamReader::TokenType token = xmlr.readNext();
if (token == QXmlStreamReader::StartElement) {
if (xmlr.name() == "qresource") {
if (xmlr.name() == QLatin1String("qresource")) {
const QXmlStreamAttributes sa = xmlr.attributes();
const QString prefixName = sa.value("prefix").toString();
if (!prefixName.isEmpty())
prefixStack.push_back(prefixName);
} else if (xmlr.name() == "file") {
} else if (xmlr.name() == QLatin1String("file")) {
const QXmlStreamAttributes sa = xmlr.attributes();
const QString aliasName = sa.value("alias").toString();
const QString fileName = xmlr.readElementText();
@@ -117,7 +117,7 @@ static QString findResourceInFile(const QString &resName, const QString &filePat
return fileName;
}
} else if (token == QXmlStreamReader::EndElement) {
if (xmlr.name() == "qresource") {
if (xmlr.name() == QLatin1String("qresource")) {
if (!prefixStack.isEmpty())
prefixStack.pop_back();
}

View File

@@ -175,10 +175,6 @@ void Console::clearContents()
m_consoleItemModel->clear();
}
void Console::visibilityChanged(bool /*visible*/)
{
}
bool Console::canFocus() const
{
return true;

View File

@@ -61,7 +61,6 @@ public:
QString displayName() const override { return tr("QML Debugger Console"); }
int priorityInStatusBar() const override;
void clearContents() override;
void visibilityChanged(bool visible) override;
bool canFocus() const override;
bool hasFocus() const override;
void setFocus() override;

View File

@@ -568,13 +568,13 @@ static void handleField(QXmlStreamReader &in, PeripheralRegister &reg)
PeripheralRegisterField fld;
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == kName) {
if (elementName == QLatin1String(kName)) {
fld.name = in.readElementText();
} else if (elementName == kDescription) {
} else if (elementName == QLatin1String(kDescription)) {
fld.description = in.readElementText();
} else if (elementName == kAccess) {
} else if (elementName == QLatin1String(kAccess)) {
fld.access = decodeAccess(in.readElementText());
} else if (elementName == kBitRange) {
} else if (elementName == QLatin1String(kBitRange)) {
const QString elementText = in.readElementText();
const int startBracket = elementText.indexOf('[');
const int endBracket = elementText.indexOf(']');
@@ -589,9 +589,9 @@ static void handleField(QXmlStreamReader &in, PeripheralRegister &reg)
const int to = int(decodeNumeric(items.at(MaxBit)));
fld.bitOffset = from;
fld.bitWidth = to - from + 1;
} else if (elementName == kBitOffset) {
} else if (elementName == QLatin1String(kBitOffset)) {
fld.bitOffset = int(decodeNumeric(in.readElementText()));
} else if (elementName == kBitWidth) {
} else if (elementName == QLatin1String(kBitWidth)) {
fld.bitWidth = int(decodeNumeric(in.readElementText()));
} else {
in.skipCurrentElement();
@@ -611,24 +611,24 @@ static void handleRegister(QXmlStreamReader &in, PeripheralRegisterGroup &group)
PeripheralRegister reg;
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == kName) {
if (elementName == QLatin1String(kName)) {
reg.name = in.readElementText();
} else if (elementName == kDisplayName) {
} else if (elementName == QLatin1String(kDisplayName)) {
reg.displayName = in.readElementText();
} else if (elementName == kDescription) {
} else if (elementName == QLatin1String(kDescription)) {
reg.description = in.readElementText();
} else if (elementName == kAddressOffset) {
} else if (elementName == QLatin1String(kAddressOffset)) {
reg.addressOffset = decodeNumeric(in.readElementText());
} else if (elementName == kSize) {
} else if (elementName == QLatin1String(kSize)) {
reg.size = int(decodeNumeric(in.readElementText()));
} else if (elementName == kAccess) {
} else if (elementName == QLatin1String(kAccess)) {
reg.access = decodeAccess(in.readElementText());
} else if (elementName == kResetvalue) {
} else if (elementName == QLatin1String(kResetvalue)) {
reg.resetValue = decodeNumeric(in.readElementText());
} else if (elementName == kFields) {
} else if (elementName == QLatin1String(kFields)) {
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == kField)
if (elementName == QLatin1String(kField))
handleField(in, reg);
else
in.skipCurrentElement();
@@ -657,22 +657,22 @@ static void handleGroup(QXmlStreamReader &in, PeripheralRegisterGroups &groups)
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == kName) {
if (elementName == QLatin1String(kName)) {
group.name = in.readElementText();
} else if (elementName == kDescription) {
} else if (elementName == QLatin1String(kDescription)) {
group.description = in.readElementText();
} else if (elementName == kGroupName) {
} else if (elementName == QLatin1String(kGroupName)) {
group.displayName = in.readElementText();
} else if (elementName == kBaseAddress) {
} else if (elementName == QLatin1String(kBaseAddress)) {
group.baseAddress = decodeNumeric(in.readElementText());
} else if (elementName == kSize) {
} else if (elementName == QLatin1String(kSize)) {
group.size = int(decodeNumeric(in.readElementText()));
} else if (elementName == kAccess) {
} else if (elementName == QLatin1String(kAccess)) {
group.access = decodeAccess(in.readElementText());
} else if (elementName == kRegisters) {
} else if (elementName == QLatin1String(kRegisters)) {
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == kRegister)
if (elementName == QLatin1String(kRegister))
handleRegister(in, group);
else
in.skipCurrentElement();
@@ -694,13 +694,13 @@ static PeripheralRegisterGroups availablePeripheralRegisterGroups(const FilePath
PeripheralRegisterGroups groups;
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == kDevice) {
if (elementName == QLatin1String(kDevice)) {
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == kPeripherals) {
if (elementName == QLatin1String(kPeripherals)) {
while (in.readNextStartElement()) {
const auto elementName = in.name();
if (elementName == kPeripheral)
if (elementName == QLatin1String(kPeripheral))
handleGroup(in, groups);
else
in.skipCurrentElement();

View File

@@ -137,7 +137,9 @@ bool navigateToSlot(const QString &uiFileName,
SearchFunction searchFunc(setupUiC);
const SearchFunction::FunctionList funcs = searchFunc(generatedHeaderDoc);
if (funcs.size() != 1) {
*errorMessage = QString::fromLatin1("Internal error: The function \"%1\" could not be found in %2").arg(setupUiC, generatedHeaderFile);
*errorMessage = QString::fromLatin1(
"Internal error: The function \"%1\" could not be found in %2")
.arg(QLatin1String(setupUiC), generatedHeaderFile);
return false;
}
return true;

View File

@@ -56,6 +56,7 @@
#include <QStyle>
#include <QTextBlock>
#include <QTextCodec>
#include <QTimer>
#include <QToolBar>
#include <QToolButton>
@@ -80,9 +81,13 @@ public:
QSize sizeHint() const override;
signals:
void requestResize();
protected:
void setDisplaySettings(const DisplaySettings &ds) override;
void setMarginSettings(const MarginSettings &ms) override;
void applyFontSettings() override;
};
DescriptionEditorWidget::DescriptionEditorWidget(QWidget *parent)
@@ -133,6 +138,12 @@ void DescriptionEditorWidget::setMarginSettings(const MarginSettings &ms)
TextEditorWidget::setMarginSettings(MarginSettings());
}
void DescriptionEditorWidget::applyFontSettings()
{
TextEditorWidget::applyFontSettings();
emit requestResize();
}
///////////////////////////////// DiffEditor //////////////////////////////////
DiffEditor::DiffEditor()
@@ -145,6 +156,18 @@ DiffEditor::DiffEditor()
m_descriptionWidget = new DescriptionEditorWidget(splitter);
m_descriptionWidget->setReadOnly(true);
connect(m_descriptionWidget, &DescriptionEditorWidget::requestResize, this, [splitter](){
if (splitter->count() == 0)
return;
QList<int> sizes = splitter->sizes();
const int descHeight = splitter->widget(0)->fontMetrics().lineSpacing() * 8;
const int diff = descHeight - sizes[0];
if (diff > 0) {
sizes[0] += diff;
sizes[1] -= diff;
splitter->setSizes(sizes);
}
});
splitter->addWidget(m_descriptionWidget);
m_stackedWidget = new QStackedWidget(splitter);

View File

@@ -1008,9 +1008,9 @@ void HelpWidget::print(HelpViewer *viewer)
QPrintDialog dlg(m_printer, this);
dlg.setWindowTitle(tr("Print Documentation"));
if (!viewer->selectedText().isEmpty())
dlg.addEnabledOption(QAbstractPrintDialog::PrintSelection);
dlg.addEnabledOption(QAbstractPrintDialog::PrintPageRange);
dlg.addEnabledOption(QAbstractPrintDialog::PrintCollateCopies);
dlg.setOption(QAbstractPrintDialog::PrintSelection, true);
dlg.setOption(QAbstractPrintDialog::PrintPageRange, true);
dlg.setOption(QAbstractPrintDialog::PrintCollateCopies, true);
if (dlg.exec() == QDialog::Accepted)
viewer->print(m_printer);

View File

@@ -110,9 +110,8 @@ bool XbelReader::readFromFile(QIODevice *device)
readNext();
if (isStartElement()) {
if (name() == "xbel"
&& attributes().value("version")
== "1.0") {
if (name() == QLatin1String("xbel")
&& attributes().value("version") == QLatin1String("1.0")) {
readXBEL();
} else {
raiseError(QCoreApplication::translate("Help::Internal::XbelReader", "The file is not an XBEL version 1.0 file."));
@@ -132,9 +131,9 @@ void XbelReader::readXBEL()
break;
if (isStartElement()) {
if (name() == "folder")
if (name() == QLatin1String("folder"))
readFolder(nullptr);
else if (name() == "bookmark")
else if (name() == QLatin1String("bookmark"))
readBookmark(nullptr);
else
readUnknownElement();
@@ -161,8 +160,7 @@ void XbelReader::readFolder(QStandardItem *item)
folder->setIcon(folderIcon);
folder->setData("Folder", Qt::UserRole + 10);
bool expanded =
(attributes().value("folded") != "no");
const bool expanded = attributes().value("folded") != QLatin1String("no");
folder->setData(expanded, Qt::UserRole + 11);
while (!atEnd()) {
@@ -172,11 +170,11 @@ void XbelReader::readFolder(QStandardItem *item)
break;
if (isStartElement()) {
if (name() == "title")
if (name() == QLatin1String("title"))
folder->setText(readElementText());
else if (name() == "folder")
else if (name() == QLatin1String("folder"))
readFolder(folder);
else if (name() == "bookmark")
else if (name() == QLatin1String("bookmark"))
readBookmark(folder);
else
readUnknownElement();
@@ -199,7 +197,7 @@ void XbelReader::readBookmark(QStandardItem *item)
break;
if (isStartElement()) {
if (name() == "title")
if (name() == QLatin1String("title"))
bookmark->setText(readElementText());
else
readUnknownElement();

View File

@@ -355,7 +355,7 @@ PerfConfigEventsModel::EventDescription PerfConfigEventsModel::parseEvent(
if (event.startsWith('r') && event.length() == 4) {
bool ok = false;
const uint eventNumber = event.midRef(1).toUInt(&ok, 16);
const uint eventNumber = event.mid(1).toUInt(&ok, 16);
if (ok) {
description.eventType = EventTypeRaw;
description.numericEvent = eventNumber;

View File

@@ -179,8 +179,8 @@ QVariantMap PerfTimelineModel::details(int index) const
result.insert(tr("Name"), orUnknown(manager->string(tracePoint.name)));
const QHash<qint32, QVariant> &extraData = m_extraData[index];
for (auto it = extraData.constBegin(), end = extraData.constEnd(); it != end; ++it) {
result.insertMulti(QString::fromUtf8(manager->string(it.key())),
prettyPrintTraceData(it.value()));
result.insert(QString::fromUtf8(manager->string(it.key())),
prettyPrintTraceData(it.value()));
}
}
if (!m_resourceBlocks.isEmpty()) {

View File

@@ -112,19 +112,20 @@ void PerfResourceCounterTest::testMallocFree()
void PerfResourceCounterTest::testRandomFill()
{
auto rg = QRandomGenerator::global();
for (int i = 0; i < 100; ++i) {
SizeCounter::Container container;
SizeCounter counter(&container);
for (int i = 0; i < 10000; ++i) {
const int amount = qrand();
const int amount = rg->generate();
counter.request(amount, i);
counter.obtain(qrand());
counter.obtain(rg->generate());
if (sum(container) != counter.currentTotal())
qDebug() << "ouch";
QCOMPARE(sum(container), counter.currentTotal());
}
for (int i = 0; i < 10000; ++i) {
counter.release(qrand());
counter.release(rg->generate());
QCOMPARE(sum(container), counter.currentTotal());
}
@@ -138,9 +139,10 @@ void PerfResourceCounterTest::testUnitSized()
NoPayloadCounter::Container container;
NoPayloadCounter counter(&container);
QList<int> ids;
auto rg = QRandomGenerator::global();
for (int i = 0; i < 10000; ++i) {
counter.request(1);
const int id = qrand();
const int id = rg->generate();
counter.obtain(id);
if (id != 0) // Otherwise it's the invalid ID and that means the allocation "failed".
ids.append(id);
@@ -158,11 +160,12 @@ void PerfResourceCounterTest::testRandomAlternate()
{
NoPayloadCounter::Container container;
NoPayloadCounter counter(&container);
auto rg = QRandomGenerator::global();
for (int i = 0; i < 1000; ++i) {
for (int i = 0; i < 100; ++i) {
counter.request(qrand());
counter.obtain(qrand());
counter.release(qrand());
counter.request(rg->generate());
counter.obtain(rg->generate());
counter.release(rg->generate());
}
QCOMPARE(sum(container), counter.currentTotal());
}

View File

@@ -22,7 +22,7 @@
},
{
\"Name\" : \"-ensure-kit-for-binary\",
\"Parameter\" : \"<file path>\",
\"Parameter\" : \"file path\",
\"Description\" : \"Create kit with architecture matching a given application or library\"
},
{

View File

@@ -341,10 +341,6 @@ void AppOutputPane::clearContents()
currentWindow->clear();
}
void AppOutputPane::visibilityChanged(bool /* b */)
{
}
bool AppOutputPane::hasFocus() const
{
QWidget *widget = m_tabWidget->currentWidget();

View File

@@ -70,7 +70,6 @@ public:
QString displayName() const override;
int priorityInStatusBar() const override;
void clearContents() override;
void visibilityChanged(bool) override;
bool canFocus() const override;
bool hasFocus() const override;
void setFocus() override;

View File

@@ -215,9 +215,6 @@ void CompileOutputWindow::clearContents()
m_taskPositions.clear();
}
void CompileOutputWindow::visibilityChanged(bool)
{ }
int CompileOutputWindow::priorityInStatusBar() const
{
return 50;

View File

@@ -60,7 +60,6 @@ public:
QString displayName() const override { return tr("Compile Output"); }
int priorityInStatusBar() const override;
void clearContents() override;
void visibilityChanged(bool visible) override;
bool canFocus() const override;
bool hasFocus() const override;
void setFocus() override;

View File

@@ -44,12 +44,14 @@
#include <remotelinux/remotelinux_constants.h>
#include <utils/environment.h>
#include <utils/layoutbuilder.h>
#include <utils/persistentsettings.h>
#include <utils/pointeralgorithm.h>
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
#include <QHash>
#include <QLabel>
#include <QSettings>
#include <QStyle>
@@ -729,6 +731,24 @@ Utils::Id KitAspectWidget::kitInformationId() const
return m_kitInformation->id();
}
void KitAspectWidget::addToLayout(LayoutBuilder &builder)
{
QTC_ASSERT(!m_label, delete m_label);
m_label = new QLabel(m_kitInformation->displayName() + ':');
m_label->setToolTip(m_kitInformation->description());
builder.addRow({{m_label, 1, LayoutBuilder::AlignAsFormLabel}, mainWidget(), buttonWidget()});
}
void KitAspectWidget::setVisible(bool visible)
{
mainWidget()->setVisible(visible);
if (buttonWidget())
buttonWidget()->setVisible(visible);
QTC_ASSERT(m_label, return);
m_label->setVisible(visible);
}
QString KitAspectWidget::msgManage()
{
return tr("Manage...");

View File

@@ -37,9 +37,14 @@
#include <functional>
QT_BEGIN_NAMESPACE
class QLabel;
QT_END_NAMESPACE
namespace Utils {
class Environment;
class FilePath;
class LayoutBuilder;
class MacroExpander;
class OutputLineParser;
} // namespace Utils
@@ -136,19 +141,20 @@ public:
virtual QWidget *mainWidget() const = 0;
virtual QWidget *buttonWidget() const { return nullptr; }
void addToLayout(Utils::LayoutBuilder &builder);
void setVisible(bool visible);
bool isSticky() const { return m_isSticky; }
static QString msgManage();
Kit *kit() const { return m_kit; }
signals:
void dirty();
protected:
Kit *m_kit;
const KitAspect *m_kitInformation;
bool m_isSticky;
QLabel *m_label = nullptr;
};
class PROJECTEXPLORER_EXPORT KitManager : public QObject

View File

@@ -46,16 +46,11 @@
#include <QRegularExpression>
#include <QRegularExpressionValidator>
#include <QFileDialog>
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QMenu>
#include <QPainter>
#include <QPushButton>
#include <QToolButton>
#include <QScrollArea>
#include <QSizePolicy>
#include <QStyle>
static const char WORKING_COPY_KIT_ID[] = "modified kit";
@@ -71,14 +66,12 @@ KitManagerConfigWidget::KitManagerConfigWidget(Kit *k) :
m_kit(k),
m_modifiedKit(std::make_unique<Kit>(Utils::Id(WORKING_COPY_KIT_ID)))
{
static auto alignment
= static_cast<const Qt::Alignment>(style()->styleHint(QStyle::SH_FormLayoutLabelAlignment));
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
LayoutBuilder builder(this, LayoutBuilder::GridLayout);
QLabel *label = createLabel(tr("Name:"), tr("Kit name and icon."));
builder.addRow({{label, 1, alignment}, m_nameEdit, m_iconButton});
QLabel *label = new QLabel(tr("Name:"));
label->setToolTip(tr("Kit name and icon."));
builder.addRow({{label, 1, LayoutBuilder::AlignAsFormLabel}, m_nameEdit, m_iconButton});
QString toolTip =
tr("<html><head/><body><p>The name of the kit suitable for generating "
@@ -90,8 +83,9 @@ KitManagerConfigWidget::KitManagerConfigWidget(Kit *k) :
Q_ASSERT(fileSystemFriendlyNameRegexp.isValid());
m_fileSystemFriendlyNameLineEdit->setValidator(new QRegularExpressionValidator(fileSystemFriendlyNameRegexp, m_fileSystemFriendlyNameLineEdit));
label = createLabel(tr("File system name:"), toolTip);
builder.addRow({{label, 1, alignment}, m_fileSystemFriendlyNameLineEdit});
label = new QLabel(tr("File system name:"));
label->setToolTip(toolTip);
builder.addRow({{label, 1, LayoutBuilder::AlignAsFormLabel}, m_fileSystemFriendlyNameLineEdit});
connect(m_fileSystemFriendlyNameLineEdit, &QLineEdit::textChanged,
this, &KitManagerConfigWidget::setFileSystemFriendlyName);
@@ -222,9 +216,6 @@ void KitManagerConfigWidget::addAspectToWorkingCopy(KitAspect *aspect)
QTC_ASSERT(widget, return);
QTC_ASSERT(!m_widgets.contains(widget), return);
const QString name = aspect->displayName() + ':';
QString toolTip = aspect->description();
auto action = new QAction(tr("Mark as Mutable"), nullptr);
action->setCheckable(true);
action->setChecked(workingCopy()->isMutable(aspect->id()));
@@ -239,14 +230,9 @@ void KitManagerConfigWidget::addAspectToWorkingCopy(KitAspect *aspect)
m_actions << action;
static auto alignment
= static_cast<const Qt::Alignment>(style()->styleHint(QStyle::SH_FormLayoutLabelAlignment));
QLabel *label = createLabel(name, toolTip);
LayoutBuilder builder(layout());
builder.addRow({{label, 1, alignment}, widget->mainWidget(), widget->buttonWidget()});
widget->addToLayout(builder);
m_widgets.append(widget);
m_labels.append(label);
}
void KitManagerConfigWidget::updateVisibility()
@@ -256,10 +242,7 @@ void KitManagerConfigWidget::updateVisibility()
KitAspectWidget *widget = m_widgets.at(i);
const bool visible = widget->visibleInKit()
&& !m_modifiedKit->irrelevantAspects().contains(widget->kitInformationId());
widget->mainWidget()->setVisible(visible);
if (widget->buttonWidget())
widget->buttonWidget()->setVisible(visible);
m_labels.at(i)->setVisible(visible);
widget->setVisible(visible);
}
}
@@ -410,12 +393,5 @@ void KitManagerConfigWidget::showEvent(QShowEvent *event)
widget->refresh();
}
QLabel *KitManagerConfigWidget::createLabel(const QString &name, const QString &toolTip)
{
auto label = new QLabel(name);
label->setToolTip(toolTip);
return label;
}
} // namespace Internal
} // namespace ProjectExplorer

View File

@@ -89,13 +89,11 @@ private:
};
void showEvent(QShowEvent *event) override;
QLabel *createLabel(const QString &name, const QString &toolTip);
QToolButton *m_iconButton;
QLineEdit *m_nameEdit;
QLineEdit *m_fileSystemFriendlyNameLineEdit;
QList<KitAspectWidget *> m_widgets;
QList<QLabel *> m_labels;
Kit *m_kit;
std::unique_ptr<Kit> m_modifiedKit;
bool m_isDefaultKit = false;

View File

@@ -51,37 +51,43 @@ class ProcessStep final : public AbstractProcessStep
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::ProcessStep)
public:
ProcessStep(BuildStepList *bsl, Utils::Id id);
ProcessStep(BuildStepList *bsl, Id id);
void setupOutputFormatter(Utils::OutputFormatter *formatter);
void setupProcessParameters(ProcessParameters *pp);
StringAspect *m_command;
StringAspect *m_arguments;
StringAspect *m_workingDirectory;
void setupOutputFormatter(OutputFormatter *formatter);
};
ProcessStep::ProcessStep(BuildStepList *bsl, Utils::Id id)
ProcessStep::ProcessStep(BuildStepList *bsl, Id id)
: AbstractProcessStep(bsl, id)
{
m_command = addAspect<StringAspect>();
m_command->setSettingsKey(PROCESS_COMMAND_KEY);
m_command->setDisplayStyle(StringAspect::PathChooserDisplay);
m_command->setLabelText(tr("Command:"));
m_command->setExpectedKind(Utils::PathChooser::Command);
m_command->setHistoryCompleter("PE.ProcessStepCommand.History");
auto command = addAspect<StringAspect>();
command->setSettingsKey(PROCESS_COMMAND_KEY);
command->setDisplayStyle(StringAspect::PathChooserDisplay);
command->setLabelText(tr("Command:"));
command->setExpectedKind(PathChooser::Command);
command->setHistoryCompleter("PE.ProcessStepCommand.History");
m_arguments = addAspect<StringAspect>();
m_arguments->setSettingsKey(PROCESS_ARGUMENTS_KEY);
m_arguments->setDisplayStyle(StringAspect::LineEditDisplay);
m_arguments->setLabelText(tr("Arguments:"));
auto arguments = addAspect<StringAspect>();
arguments->setSettingsKey(PROCESS_ARGUMENTS_KEY);
arguments->setDisplayStyle(StringAspect::LineEditDisplay);
arguments->setLabelText(tr("Arguments:"));
m_workingDirectory = addAspect<StringAspect>();
m_workingDirectory->setSettingsKey(PROCESS_WORKINGDIRECTORY_KEY);
m_workingDirectory->setValue(Constants::DEFAULT_WORKING_DIR);
m_workingDirectory->setDisplayStyle(StringAspect::PathChooserDisplay);
m_workingDirectory->setLabelText(tr("Working directory:"));
m_workingDirectory->setExpectedKind(Utils::PathChooser::Directory);
auto workingDirectory = addAspect<StringAspect>();
workingDirectory->setSettingsKey(PROCESS_WORKINGDIRECTORY_KEY);
workingDirectory->setValue(Constants::DEFAULT_WORKING_DIR);
workingDirectory->setDisplayStyle(StringAspect::PathChooserDisplay);
workingDirectory->setLabelText(tr("Working directory:"));
workingDirectory->setExpectedKind(PathChooser::Directory);
setWorkingDirectoryProvider([this, workingDirectory] {
const FilePath workingDir = workingDirectory->filePath();
if (workingDir.isEmpty())
return FilePath::fromString(fallbackWorkingDirectory());
return workingDir;
});
setCommandLineProvider([command, arguments] {
return CommandLine{command->filePath(), arguments->value(), CommandLine::Raw};
});
setSummaryUpdater([this] {
QString display = displayName();
@@ -101,18 +107,6 @@ void ProcessStep::setupOutputFormatter(OutputFormatter *formatter)
AbstractProcessStep::setupOutputFormatter(formatter);
}
void ProcessStep::setupProcessParameters(ProcessParameters *pp)
{
QString workingDirectory = m_workingDirectory->value();
if (workingDirectory.isEmpty())
workingDirectory = fallbackWorkingDirectory();
pp->setMacroExpander(macroExpander());
pp->setEnvironment(buildEnvironment());
pp->setWorkingDirectory(FilePath::fromString(workingDirectory));
pp->setCommandLine({m_command->filePath(), m_arguments->value(), CommandLine::Raw});
}
// ProcessStepFactory
ProcessStepFactory::ProcessStepFactory()

View File

@@ -25,13 +25,13 @@
#pragma once
#include "curveitem.h"
#include "treeitem.h"
#include <QItemSelectionModel>
namespace DesignTools {
class CurveItem;
class TreeItem;
class NodeTreeItem;
class PropertyTreeItem;

View File

@@ -25,6 +25,7 @@
#pragma once
#include "curveitem.h"
#include "selectionmodel.h"
#include <QTreeView>
@@ -33,7 +34,6 @@ namespace DesignTools {
class AnimationCurve;
class CurveEditorModel;
class CurveItem;
struct CurveEditorStyle;

View File

@@ -395,7 +395,7 @@ QmlProfilerModelManager::rangeFilter(qint64 rangeStart, qint64 rangeEnd) const
if (type.rangeType() != MaximumRangeType) {
if (event.rangeStage() == RangeStart)
stack.push(event);
else if (event.rangeStage() == RangeEnd)
else if (event.rangeStage() == RangeEnd && !stack.isEmpty())
stack.pop();
return true;
} else if (isStateful(type)) {

View File

@@ -214,7 +214,7 @@ bool ScxmlDocument::load(QIODevice *io)
continue;
if (token == QXmlStreamReader::StartElement) {
if (xml.name() == "scxml") {
if (xml.name() == QLatin1String("scxml")) {
// Get and add namespaces
QXmlStreamNamespaceDeclarations ns = xml.namespaceDeclarations();
for (int i = 0; i < ns.count(); ++i)

View File

@@ -579,7 +579,7 @@ void ScxmlTag::readXml(QXmlStreamReader &xml, bool checkCopyId)
// Read and set attributes
QXmlStreamAttributes attributes = xml.attributes();
for (int i = 0; i < attributes.count(); ++i) {
if (m_tagType == Scxml && attributes[i].qualifiedName() == "initial")
if (m_tagType == Scxml && attributes[i].qualifiedName() == QLatin1String("initial"))
scxmlInitial = attributes[i].value().toString();
else {
QString key = attributes[i].qualifiedName().toString();

View File

@@ -210,11 +210,6 @@ void SerialOutputPane::clearContents()
currentWindow->clear();
}
void SerialOutputPane::visibilityChanged(bool)
{
// Unused but pure virtual
}
bool SerialOutputPane::canFocus() const
{
return m_tabWidget->currentWidget();

View File

@@ -76,7 +76,6 @@ public:
int priorityInStatusBar() const final;
void clearContents() final;
void visibilityChanged(bool) final;
bool canFocus() const final;
bool hasFocus() const final;
void setFocus() final;

View File

@@ -94,11 +94,6 @@ void TodoOutputPane::clearContents()
clearKeywordFilter();
}
void TodoOutputPane::visibilityChanged(bool visible)
{
Q_UNUSED(visible)
}
void TodoOutputPane::setFocus()
{
m_todoTreeView->setFocus();

View File

@@ -60,7 +60,6 @@ public:
QString displayName() const override;
int priorityInStatusBar() const override;
void clearContents() override;
void visibilityChanged(bool visible) override;
void setFocus() override;
bool hasFocus() const override;
bool canFocus() const override;

View File

@@ -304,13 +304,13 @@ XWhat Parser::Private::parseXWhat()
if (reader.isEndElement())
break;
const auto name = reader.name();
if (name == "text")
if (name == QLatin1String("text"))
what.text = blockingReadElementText();
else if (name == "leakedbytes")
else if (name == QLatin1String("leakedbytes"))
what.leakedbytes = parseInt64(blockingReadElementText(), "error/xwhat[memcheck]/leakedbytes");
else if (name == "leakedblocks")
else if (name == QLatin1String("leakedblocks"))
what.leakedblocks = parseInt64(blockingReadElementText(), "error/xwhat[memcheck]/leakedblocks");
else if (name == "hthreadid")
else if (name == QLatin1String("hthreadid"))
what.hthreadid = parseInt64(blockingReadElementText(), "error/xwhat[memcheck]/hthreadid");
else if (reader.isStartElement())
reader.skipCurrentElement();
@@ -326,15 +326,15 @@ XauxWhat Parser::Private::parseXauxWhat()
if (reader.isEndElement())
break;
const auto name = reader.name();
if (name == "text")
if (name == QLatin1String("text"))
what.text = blockingReadElementText();
else if (name == "file")
else if (name == QLatin1String("file"))
what.file = blockingReadElementText();
else if (name == "dir")
else if (name == QLatin1String("dir"))
what.dir = blockingReadElementText();
else if (name == "line")
else if (name == QLatin1String("line"))
what.line = parseInt64(blockingReadElementText(), "error/xauxwhat/line");
else if (name == "hthreadid")
else if (name == QLatin1String("hthreadid"))
what.hthreadid = parseInt64(blockingReadElementText(), "error/xauxwhat/hthreadid");
else if (reader.isStartElement())
reader.skipCurrentElement();
@@ -434,27 +434,27 @@ void Parser::Private::parseError()
if (reader.isStartElement())
lastAuxWhat++;
const auto name = reader.name();
if (name == "unique") {
if (name == QLatin1String("unique")) {
e.setUnique(parseHex(blockingReadElementText(), "unique"));
} else if (name == "tid") {
} else if (name == QLatin1String("tid")) {
e.setTid(parseInt64(blockingReadElementText(), "error/tid"));
} else if (name == "kind") { //TODO this is memcheck-specific:
} else if (name == QLatin1String("kind")) { //TODO this is memcheck-specific:
e.setKind(parseErrorKind(blockingReadElementText()));
} else if (name == "suppression") {
} else if (name == QLatin1String("suppression")) {
e.setSuppression(parseSuppression());
} else if (name == "xwhat") {
} else if (name == QLatin1String("xwhat")) {
const XWhat xw = parseXWhat();
e.setWhat(xw.text);
e.setLeakedBlocks(xw.leakedblocks);
e.setLeakedBytes(xw.leakedbytes);
e.setHelgrindThreadId(xw.hthreadid);
} else if (name == "what") {
} else if (name == QLatin1String("what")) {
e.setWhat(blockingReadElementText());
} else if (name == "xauxwhat") {
} else if (name == QLatin1String("xauxwhat")) {
if (!currentAux.text.isEmpty())
auxs.push_back(currentAux);
currentAux = parseXauxWhat();
} else if (name == "auxwhat") {
} else if (name == QLatin1String("auxwhat")) {
const QString aux = blockingReadElementText();
//concatenate multiple consecutive <auxwhat> tags
if (lastAuxWhat > 1) {
@@ -468,7 +468,7 @@ void Parser::Private::parseError()
currentAux.text.append(aux);
}
lastAuxWhat = 0;
} else if (name == "stack") {
} else if (name == QLatin1String("stack")) {
frames.push_back(parseStack());
} else if (reader.isStartElement()) {
reader.skipCurrentElement();
@@ -505,17 +505,17 @@ Frame Parser::Private::parseFrame()
break;
if (reader.isStartElement()) {
const auto name = reader.name();
if (name == "ip")
if (name == QLatin1String("ip"))
frame.setInstructionPointer(parseHex(blockingReadElementText(), "error/frame/ip"));
else if (name == "obj")
else if (name == QLatin1String("obj"))
frame.setObject(blockingReadElementText());
else if (name == "fn")
else if (name == QLatin1String("fn"))
frame.setFunctionName( blockingReadElementText());
else if (name == "dir")
else if (name == QLatin1String("dir"))
frame.setDirectory(blockingReadElementText());
else if (name == "file")
else if (name == QLatin1String("file"))
frame.setFileName(blockingReadElementText());
else if (name == "line")
else if (name == QLatin1String("line"))
frame.setLine(parseInt64(blockingReadElementText(), "error/frame/line"));
else if (reader.isStartElement())
reader.skipCurrentElement();
@@ -535,9 +535,9 @@ void Parser::Private::parseAnnounceThread()
break;
if (reader.isStartElement()) {
const auto name = reader.name();
if (name == "hthreadid")
if (name == QLatin1String("hthreadid"))
at.setHelgrindThreadId(parseInt64(blockingReadElementText(), "announcethread/hthreadid"));
else if (name == "stack")
else if (name == QLatin1String("stack"))
at.setStack(parseStack());
else if (reader.isStartElement())
reader.skipCurrentElement();
@@ -554,7 +554,7 @@ void Parser::Private::parseErrorCounts()
if (reader.isEndElement())
break;
if (reader.isStartElement()) {
if (reader.name() == "pair") {
if (reader.name() == QLatin1String("pair")) {
qint64 unique = 0;
qint64 count = 0;
while (notAtEnd()) {
@@ -563,17 +563,16 @@ void Parser::Private::parseErrorCounts()
break;
if (reader.isStartElement()) {
const auto name = reader.name();
if (name == "unique")
if (name == QLatin1String("unique"))
unique = parseHex(blockingReadElementText(), "errorcounts/pair/unique");
else if (name == "count")
else if (name == QLatin1String("count"))
count = parseInt64(blockingReadElementText(), "errorcounts/pair/count");
else if (reader.isStartElement())
reader.skipCurrentElement();
}
}
emit q->errorCount(unique, count);
}
else if (reader.isStartElement())
} else if (reader.isStartElement())
reader.skipCurrentElement();
}
}
@@ -587,7 +586,7 @@ void Parser::Private::parseSuppressionCounts()
if (reader.isEndElement())
break;
if (reader.isStartElement()) {
if (reader.name() == "pair") {
if (reader.name() == QLatin1String("pair")) {
QString pairName;
qint64 count = 0;
while (notAtEnd()) {
@@ -596,17 +595,16 @@ void Parser::Private::parseSuppressionCounts()
break;
if (reader.isStartElement()) {
const auto name = reader.name();
if (name == "name")
if (name == QLatin1String("name"))
pairName = blockingReadElementText();
else if (name == "count")
else if (name == QLatin1String("count"))
count = parseInt64(blockingReadElementText(), "suppcounts/pair/count");
else if (reader.isStartElement())
reader.skipCurrentElement();
}
}
emit q->suppressionCount(pairName, count);
}
else if (reader.isStartElement())
} else if (reader.isStartElement())
reader.skipCurrentElement();
}
}
@@ -622,9 +620,9 @@ void Parser::Private::parseStatus()
break;
if (reader.isStartElement()) {
const auto name = reader.name();
if (name == "state")
if (name == QLatin1String("state"))
s.setState(parseState(blockingReadElementText()));
else if (name == "time")
else if (name == QLatin1String("time"))
s.setTime(blockingReadElementText());
else if (reader.isStartElement())
reader.skipCurrentElement();
@@ -642,7 +640,7 @@ QVector<Frame> Parser::Private::parseStack()
if (reader.isEndElement())
break;
if (reader.isStartElement()) {
if (reader.name() == "frame")
if (reader.name() == QLatin1String("frame"))
frames.append(parseFrame());
}
}
@@ -660,9 +658,9 @@ SuppressionFrame Parser::Private::parseSuppressionFrame()
break;
if (reader.isStartElement()) {
const auto name = reader.name();
if (name == "obj")
if (name == QLatin1String("obj"))
frame.setObject(blockingReadElementText());
else if (name == "fun")
else if (name == QLatin1String("fun"))
frame.setFunction( blockingReadElementText());
else if (reader.isStartElement())
reader.skipCurrentElement();
@@ -682,15 +680,15 @@ Suppression Parser::Private::parseSuppression()
break;
if (reader.isStartElement()) {
const auto name = reader.name();
if (name == "sname")
if (name == QLatin1String("sname"))
supp.setName(blockingReadElementText());
else if (name == "skind")
else if (name == QLatin1String("skind"))
supp.setKind(blockingReadElementText());
else if (name == "skaux")
else if (name == QLatin1String("skaux"))
supp.setAuxKind(blockingReadElementText());
else if (name == "rawtext")
else if (name == QLatin1String("rawtext"))
supp.setRawText(blockingReadElementText());
else if (name == "sframe")
else if (name == QLatin1String("sframe"))
frames.push_back(parseSuppressionFrame());
}
}
@@ -708,19 +706,19 @@ void Parser::Private::parse(QIODevice *device)
while (notAtEnd()) {
blockingReadNext();
const auto name = reader.name();
if (name == "error")
if (name == QLatin1String("error"))
parseError();
else if (name == "announcethread")
else if (name == QLatin1String("announcethread"))
parseAnnounceThread();
else if (name == "status")
else if (name == QLatin1String("status"))
parseStatus();
else if (name == "errorcounts")
else if (name == QLatin1String("errorcounts"))
parseErrorCounts();
else if (name == "suppcounts")
else if (name == QLatin1String("suppcounts"))
parseSuppressionCounts();
else if (name == "protocolversion")
else if (name == QLatin1String("protocolversion"))
checkProtocolVersion(blockingReadElementText());
else if (name == "protocoltool")
else if (name == QLatin1String("protocoltool"))
checkTool(blockingReadElementText());
}
} catch (const ParserException &e) {

View File

@@ -363,12 +363,6 @@ void VcsOutputWindow::clearContents()
d->widget.clear();
}
void VcsOutputWindow::visibilityChanged(bool visible)
{
if (visible)
d->widget.setFocus();
}
void VcsOutputWindow::setFocus()
{
d->widget.setFocus();

View File

@@ -46,7 +46,6 @@ public:
int priorityInStatusBar() const override;
void clearContents() override;
void visibilityChanged(bool visible) override;
void setFocus() override;
bool hasFocus() const override;

View File

@@ -4,3 +4,37 @@ add_subdirectory(qtsingleapplication)
add_subdirectory(qtlockedfile)
add_subdirectory(help)
add_subdirectory(registryaccess)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/qbs/CMakeLists.txt)
set(BUILD_QBS_DEFAULT YES)
else()
set(BUILD_QBS_DEFAULT FALSE)
endif()
option(BUILD_QBS "Build Qbs together with Qt Creator" ${BUILD_QBS_DEFAULT})
if (BUILD_QBS)
find_package(Qt5 COMPONENTS Script QUIET)
if (TARGET Qt5::Script)
set(ENABLE_BUILD_QBS YES)
endif()
else()
set(ENABLE_BUILD_QBS NO)
endif()
add_feature_info("Build Qbs" ENABLE_BUILD_QBS "with CONDITION TARGET Qt5::Script")
if (ENABLE_BUILD_QBS)
file(RELATIVE_PATH _REL_PATH_TO_QTC "${CMAKE_BINARY_DIR}" "${PROJECT_BINARY_DIR}")
set(QBS_OUTPUT_PREFIX "${_REL_PATH_TO_QTC}/" CACHE STRING "" FORCE)
set(QBS_APP_INSTALL_DIR "${IDE_BIN_PATH}" CACHE STRING "" FORCE)
set(QBS_LIB_INSTALL_DIR "${IDE_LIBRARY_PATH}" CACHE STRING "" FORCE)
set(QBS_DLL_INSTALL_DIR "${IDE_BIN_PATH}" CACHE STRING "" FORCE)
set(QBS_LIBEXEC_INSTALL_DIR "${IDE_LIBEXEC_PATH}" CACHE STRING "" FORCE)
set(QBS_PLUGINS_INSTALL_BASE "${IDE_PLUGIN_PATH}" CACHE STRING "" FORCE)
set(QBS_RESOURCES_INSTALL_BASE "${IDE_DATA_PATH}/qbs" CACHE STRING "" FORCE)
set(QBS_HEADERS_INSTALL_DIR "${IDE_DATA_PATH}/qbs/include/qbs" CACHE STRING "" FORCE)
set(INSTALL_PUBLIC_HEADERS OFF)
set(WITH_TESTS OFF)
add_subdirectory(qbs)
endif()

View File

@@ -106,13 +106,16 @@ static Utf8String getPropertyType(const SourceLocation &location, uint propertyP
uint offset;
clang_getFileLocation(location.cx(), &cxFile, nullptr, nullptr, &offset);
const char *const contents = clang_getFileContents(location.tu(), cxFile, nullptr);
const char *const lineContents = &contents[offset - propertyPosition];
const char *typeStart = std::strstr(lineContents, "Q_PROPERTY") + 10;
const int keywordOffset = QByteArray::fromRawData(contents, propertyPosition)
.lastIndexOf("Q_PROPERTY");
if (keywordOffset == -1)
return {};
const char * const keywordStart = contents + keywordOffset;
const char *typeStart = keywordStart + 10;
typeStart += std::strspn(typeStart, "( \t\n\r");
if (typeStart - lineContents >= propertyPosition)
if (typeStart - keywordStart >= propertyPosition)
return Utf8String();
auto typeEnd = std::find_if(std::reverse_iterator<const char*>(lineContents + propertyPosition),
auto typeEnd = std::find_if(std::reverse_iterator<const char*>(keywordStart + propertyPosition),
std::reverse_iterator<const char*>(typeStart),
Utils::unequalTo(' '));

View File

@@ -8,7 +8,7 @@ endif()
add_qtc_library(qml2puppet_static
STATIC
DEPENDS
Qt5::CorePrivate Qt5::Gui
Qt5::CorePrivate Qt5::Widgets
PUBLIC_INCLUDES "${SRCDIR}/interfaces"
SOURCES_PREFIX "${SRCDIR}/interfaces"
SOURCES

View File

@@ -63,7 +63,7 @@ BacktraceCollector::~BacktraceCollector()
delete d;
}
void BacktraceCollector::run(Q_PID pid)
void BacktraceCollector::run(qint64 pid)
{
d->debugger.start(QLatin1String("gdb"), QStringList({
"--nw", // Do not use a window interface.

View File

@@ -36,7 +36,7 @@ public:
explicit BacktraceCollector(QObject *parent = 0);
~BacktraceCollector();
void run(Q_PID pid);
void run(qint64 pid);
bool isRunning() const;
void kill();

View File

@@ -46,7 +46,7 @@ static void printErrorAndExit()
exit(EXIT_FAILURE);
}
static bool hasProcessOriginFromQtCreatorBuildDir(Q_PID pid)
static bool hasProcessOriginFromQtCreatorBuildDir(qint64 pid)
{
const QString executable = QFile::symLinkTarget(QString::fromLatin1("/proc/%1/exe")
.arg(QString::number(pid)));
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
if (positionalArguments.size() != 2)
printErrorAndExit();
Q_PID parentPid = getppid();
qint64 parentPid = getppid();
if (!hasProcessOriginFromQtCreatorBuildDir(parentPid))
printErrorAndExit();

View File

@@ -511,6 +511,20 @@ struct Watcher : DumperOptions
{}
};
enum AdditionalCriteria
{
NeedsInferiorCall = 0x1,
};
static bool matchesAdditionalCriteria(int criteria)
{
#ifdef Q_OS_UNIX
return true;
#else
return !(criteria & NeedsInferiorCall);
#endif
}
struct Check
{
Check() {}
@@ -533,7 +547,8 @@ struct Check
&& gccVersionForCheck.covers(context.gccVersion)
&& clangVersionForCheck.covers(context.clangVersion)
&& msvcVersionForCheck.covers(context.msvcVersion)
&& qtVersionForCheck.covers(context.qtVersion);
&& qtVersionForCheck.covers(context.qtVersion)
&& matchesAdditionalCriteria(additionalCriteria);
}
const Check &operator%(Optional) const
@@ -595,6 +610,12 @@ struct Check
return *this;
}
const Check &operator%(AdditionalCriteria criteria) const
{
additionalCriteria = criteria;
return *this;
}
QString iname;
Name expectedName;
Value expectedValue;
@@ -607,6 +628,7 @@ struct Check
mutable VersionBase msvcVersionForCheck;
mutable QtVersion qtVersionForCheck;
mutable BoostVersion boostVersionForCheck;
mutable int additionalCriteria = 0;
mutable bool optionallyPresent = false;
};
@@ -2212,29 +2234,29 @@ void tst_Dumpers::dumper_data()
+ Check("d0", "(invalid)", "@QDate")
+ Check("d1", "Tue Jan 1 1980", "@QDate")
+ Check("d1.(ISO)", "\"1980-01-01\"", "@QString") % Optional()
+ Check("d1.toString", "\"Tue Jan 1 1980\"", "@QString") % Optional()
+ CheckType("d1.(Locale)", "@QString") % Optional()
+ CheckType("d1.(SystemLocale)", "@QString") % Optional()
+ Check("d1.(ISO)", "\"1980-01-01\"", "@QString") % NeedsInferiorCall
+ Check("d1.toString", "\"Tue Jan 1 1980\"", "@QString") % NeedsInferiorCall
+ CheckType("d1.(Locale)", "@QString") % NeedsInferiorCall
+ CheckType("d1.(SystemLocale)", "@QString") % NeedsInferiorCall
+ Check("t0", "(invalid)", "@QTime")
+ Check("t1", "13:15:32", "@QTime")
+ Check("t1.(ISO)", "\"13:15:32\"", "@QString") % Optional()
+ Check("t1.toString", "\"13:15:32\"", "@QString") % Optional()
+ CheckType("t1.(Locale)", "@QString") % Optional()
+ CheckType("t1.(SystemLocale)", "@QString") % Optional()
+ Check("t1.(ISO)", "\"13:15:32\"", "@QString") % NeedsInferiorCall
+ Check("t1.toString", "\"13:15:32\"", "@QString") % NeedsInferiorCall
+ CheckType("t1.(Locale)", "@QString") % NeedsInferiorCall
+ CheckType("t1.(SystemLocale)", "@QString") % NeedsInferiorCall
+ Check("dt0", "(invalid)", "@QDateTime")
+ Check("dt1", Value4("Tue Jan 1 13:15:32 1980"), "@QDateTime")
+ Check("dt1", Value5("Tue Jan 1 13:15:32 1980 GMT"), "@QDateTime")
+ Check("dt1.(ISO)",
"\"1980-01-01T13:15:32Z\"", "@QString") % Optional()
+ CheckType("dt1.(Locale)", "@QString") % Optional()
+ CheckType("dt1.(SystemLocale)", "@QString") % Optional()
"\"1980-01-01T13:15:32Z\"", "@QString") % NeedsInferiorCall
+ CheckType("dt1.(Locale)", "@QString") % NeedsInferiorCall
+ CheckType("dt1.(SystemLocale)", "@QString") % NeedsInferiorCall
+ Check("dt1.toString",
Value4("\"Tue Jan 1 13:15:32 1980\""), "@QString") % Optional()
Value4("\"Tue Jan 1 13:15:32 1980\""), "@QString") % NeedsInferiorCall
+ Check("dt1.toString",
Value5("\"Tue Jan 1 13:15:32 1980 GMT\""), "@QString") % Optional();
Value5("\"Tue Jan 1 13:15:32 1980 GMT\""), "@QString") % NeedsInferiorCall;
//+ Check("dt1.toUTC",
// Value4("Tue Jan 1 13:15:32 1980"), "@QDateTime") % Optional()
//+ Check("dt1.toUTC",
@@ -2724,7 +2746,7 @@ void tst_Dumpers::dumper_data()
+ CheckType("loc", "@QLocale")
+ CheckType("m", "@QLocale::MeasurementSystem")
+ Check("loc1", "\"en_US\"", "@QLocale")
+ Check("loc1", "\"en_US\"", "@QLocale") % NeedsInferiorCall
+ Check("loc1.country", "@QLocale::UnitedStates (225)", "@QLocale::Country") % Qt5
+ Check("loc1.language", "@QLocale::English (31)", "@QLocale::Language") % Qt5
+ Check("loc1.numberOptions", "@QLocale::DefaultNumberOptions (0)", "@QLocale::NumberOptions")
@@ -3306,7 +3328,7 @@ void tst_Dumpers::dumper_data()
"QT_BEGIN_NAMESPACE\n"
"uint qHash(const QMap<int, int> &) { return 0; }\n"
"uint qHash(const double & f) { return int(f); }\n"
"uint qHash(const QPointer<QObject> &p) { return (ulong)p.data(); }\n"
"uint qHash(const QPointer<QObject> &p) { return (quintptr)p.data(); }\n"
"QT_END_NAMESPACE\n",
"QSet<int> s1;\n"

View File

@@ -699,3 +699,35 @@ private:
template <int i, int j> struct S { };
template <int i> using spec = S<i, 1>;
spec<2> s;
class Property {
Q_PROPERTY(
const
volatile
unsigned
long
long
*
prop
READ
getProp
WRITE
setProp
NOTIFY
propChanged
)
};

View File

@@ -146,6 +146,7 @@ public:
static void TearDownTestCase();
SourceRange sourceRange(uint line, uint columnEnd) const;
SourceRange sourceRangeMultiLine(uint firstLine, uint lastLine, uint columnEnd) const;
protected:
static Data *d;
@@ -1574,6 +1575,14 @@ TEST_F(TokenProcessor, QtPropertyName)
ASSERT_THAT(infos[8], HasOnlyType(HighlightingType::QtProperty));
}
TEST_F(TokenProcessor, QtPropertyNameMultiLine)
{
const auto infos = translationUnit.fullTokenInfosInRange(sourceRangeMultiLine(704, 732, 14));
ASSERT_THAT(infos[0], HasOnlyType(HighlightingType::PreprocessorExpansion));
ASSERT_THAT(infos[8], HasOnlyType(HighlightingType::QtProperty));
}
TEST_F(TokenProcessor, QtPropertyFunction)
{
const auto infos = translationUnit.fullTokenInfosInRange(sourceRange(599, 103));
@@ -1581,6 +1590,13 @@ TEST_F(TokenProcessor, QtPropertyFunction)
ASSERT_THAT(infos[10], HasOnlyType(HighlightingType::Function));
}
TEST_F(TokenProcessor, QtPropertyFunctionMultiLine)
{
const auto infos = translationUnit.fullTokenInfosInRange(sourceRangeMultiLine(704, 732, 14));
ASSERT_THAT(infos[10], HasOnlyType(HighlightingType::Function));
}
TEST_F(TokenProcessor, QtPropertyInternalKeyword)
{
const auto infos = translationUnit.fullTokenInfosInRange(sourceRange(599, 103));
@@ -1588,6 +1604,13 @@ TEST_F(TokenProcessor, QtPropertyInternalKeyword)
ASSERT_THAT(infos[9], HasOnlyType(HighlightingType::Invalid));
}
TEST_F(TokenProcessor, QtPropertyInternalKeywordMultiLine)
{
const auto infos = translationUnit.fullTokenInfosInRange(sourceRangeMultiLine(704, 732, 14));
ASSERT_THAT(infos[9], HasOnlyType(HighlightingType::Invalid));
}
TEST_F(TokenProcessor, QtPropertyLastToken)
{
const auto infos = translationUnit.fullTokenInfosInRange(sourceRange(599, 103));
@@ -1595,6 +1618,13 @@ TEST_F(TokenProcessor, QtPropertyLastToken)
ASSERT_THAT(infos[14], HasOnlyType(HighlightingType::Function));
}
TEST_F(TokenProcessor, QtPropertyLastTokenMultiLine)
{
const auto infos = translationUnit.fullTokenInfosInRange(sourceRangeMultiLine(704, 732, 14));
ASSERT_THAT(infos[14], HasOnlyType(HighlightingType::Function));
}
TEST_F(TokenProcessor, QtPropertyType)
{
const auto infos = translationUnit.fullTokenInfosInRange(sourceRange(600, 46));
@@ -1747,4 +1777,10 @@ ClangBackEnd::SourceRange TokenProcessor::sourceRange(uint line, uint columnEnd)
return translationUnit.sourceRange(line, 1, line, columnEnd);
}
ClangBackEnd::SourceRange TokenProcessor::sourceRangeMultiLine(uint firstLine, uint lastLine,
uint columnEnd) const
{
return translationUnit.sourceRange(firstLine, 1, lastLine, columnEnd);
}
}