forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.9'
Conflicts: qtcreator.pri Change-Id: I278bc79cb64705471b360d0b8d06a8db17db7904
This commit is contained in:
72
dist/changes-4.8.2.md
vendored
Normal file
72
dist/changes-4.8.2.md
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
Qt Creator version 4.8.2 contains bug fixes.
|
||||
|
||||
The most important changes are listed in this document. For a complete
|
||||
list of changes, see the Git log for the Qt Creator sources that
|
||||
you can check out from the public Git repository. For example:
|
||||
|
||||
git clone git://code.qt.io/qt-creator/qt-creator.git
|
||||
git log --cherry-pick --pretty=oneline origin/v4.8.1..v4.8.2
|
||||
|
||||
Editing
|
||||
|
||||
* Fixed highlighting of search results of regular expression search
|
||||
(QTCREATORBUG-21887)
|
||||
|
||||
Autotools Projects
|
||||
|
||||
* Fixed that includes, defines and flags of `SUBDIRS` were ignored
|
||||
(QTCREATORBUG-21618)
|
||||
|
||||
C++ Support
|
||||
|
||||
* Fixed crash when expanding macros (QTCREATORBUG-21642)
|
||||
|
||||
QML Support
|
||||
|
||||
* Fixed auto-insertion of single quotes
|
||||
|
||||
Debugging
|
||||
|
||||
* GDB
|
||||
* Fixed detaching from process (QTCREATORBUG-21908)
|
||||
* LLDB
|
||||
* Fixed stopping at some breakpoints with newer LLDB (QTCREATORBUG-21615)
|
||||
* Fixed `Attach to Process` and `Run in Terminal` with newer LLDB
|
||||
* CDB
|
||||
* Fixed display of `QDateTime` (QTCREATORBUG-21864)
|
||||
|
||||
Qt Quick Designer
|
||||
|
||||
* Added support for more JavaScript functions in `.ui.qml` files
|
||||
|
||||
Test Integration
|
||||
|
||||
* Fixed handling of empty tests
|
||||
|
||||
Platform Specific
|
||||
|
||||
macOS
|
||||
|
||||
* Fixed crash when file change dialog is triggered while another modal dialog
|
||||
is open
|
||||
* Fixed running of user applications that need access to camera, microphone or
|
||||
other restricted services on macOS 10.14 (QTCREATORBUG-21887)
|
||||
|
||||
Android
|
||||
|
||||
* Fixed upload of GDB server on some devices (QTCREATORBUG-21317)
|
||||
|
||||
Credits for these changes go to:
|
||||
André Pönitz
|
||||
Christian Kandeler
|
||||
Christian Stenger
|
||||
David Schulz
|
||||
Eike Ziller
|
||||
Ivan Donchevskii
|
||||
Leena Miettinen
|
||||
Liang Qi
|
||||
Oliver Wolff
|
||||
Raoul Hecky
|
||||
Robert Löhning
|
||||
Thomas Hartmann
|
||||
Vikas Pachdha
|
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
Binary file not shown.
Before Width: | Height: | Size: 10 KiB |
BIN
doc/images/qtcreator-syntax-highlighter.png
Normal file
BIN
doc/images/qtcreator-syntax-highlighter.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
@@ -51,49 +51,32 @@
|
||||
|
||||
\section1 Generic Highlighting
|
||||
|
||||
Generic highlighting is based on highlight definition files that are
|
||||
provided by the
|
||||
\l{http://kate-editor.org/2005/03/24/writing-a-syntax-highlighting-file/}
|
||||
{Kate Editor}. You can download highlight definition files for use with \QC.
|
||||
For more information about the definition files, see
|
||||
\l{http://kde-files.org/index.php?xcontentmode=680}{KDE-Files.org}.
|
||||
Generic highlighting is provided by
|
||||
\l{https://api.kde.org/frameworks/syntax-highlighting/html/index.html}
|
||||
{KSyntaxHighlighting}, which is the syntax highlighting engine for Kate
|
||||
syntax definitions. \QC comes with most of the commonly used syntax files,
|
||||
and you can download additional files. For more information about the
|
||||
definition files, see
|
||||
\l{https://docs.kde.org/stable5/en/applications/katepart/highlight.html}
|
||||
{Working with Syntax Highlighting}.
|
||||
|
||||
If you have a Unix installation that comes with the Kate Editor, you might
|
||||
already have the definition files installed. Typically, the files are
|
||||
located in a read-only directory, and therefore, you cannot manage them. \QC
|
||||
can try to locate them and use them as fallback files, when the primary
|
||||
location does not contain the definition for the current file type. You can
|
||||
also specify the directory that contains preinstalled highlight
|
||||
definition files as the primary location.
|
||||
If the editor cannot find the highlight definition for a file that you open
|
||||
for editing, it prompts you to update the highlight definition files. Select
|
||||
\uicontrol {Update Definitions} to update the files.
|
||||
|
||||
When you open a file for editing and the editor cannot find the highlight
|
||||
definition for it, an alert appears. To suppress the alerts, you can specify
|
||||
patterns for ignoring files.
|
||||
To suppress the message for a particular file pattern, select
|
||||
\uicontrol Tools > \uicontrol Options > \uicontrol {Text Editor}
|
||||
> \uicontrol {Generic Highlighter} and add the pattern to the
|
||||
\uicontrol {Ignored file patterns} field.
|
||||
|
||||
To download highlight definition files:
|
||||
\image qtcreator-syntax-highlighter.png "Generic Highlighter options"
|
||||
|
||||
\list 1
|
||||
\li Select \uicontrol Tools > \uicontrol Options >
|
||||
\uicontrol {Text Editor} > \uicontrol {Generic Highlighter}.
|
||||
\image qtcreator-generic-highlighter.png "Generic Highlighter options"
|
||||
\li In the \uicontrol Location field, specify the path to the primary
|
||||
location for highlight definition files.
|
||||
\li Click \uicontrol {Download Definitions} to open a list of highlight
|
||||
definition files available for download.
|
||||
\image qtcreator-manage-definitions.png "Download Definitions dialog"
|
||||
\li Select highlight definition files in the list and click
|
||||
\uicontrol {Download Selected Definitions}.
|
||||
\li Select the \uicontrol {Use fallback location} check box to specify
|
||||
the secondary location where the editor will look for highlight
|
||||
definition files.
|
||||
\li Click \uicontrol Autodetect to allow \QC to look for highlight
|
||||
definition files on your system, or click \uicontrol Browse to
|
||||
locate them in the file system yourself.
|
||||
\li In the \uicontrol {Ignored file patterns} field, specify file
|
||||
patterns to suppress alerts if the highlight definitions for the
|
||||
specified files are not found.
|
||||
\li Click \uicontrol OK to save your changes.
|
||||
\endlist
|
||||
If you have written your own syntax definition files, you
|
||||
can provide an additional definition search path in the
|
||||
\uicontrol {User Highlight Definition Files} field.
|
||||
|
||||
To manually update the highlight definition files, select
|
||||
\uicontrol {Update Definitions}.
|
||||
|
||||
\section1 Highlighting and Folding Blocks
|
||||
|
||||
|
@@ -17,7 +17,7 @@ Module {
|
||||
property string qtcreator_compat_version: ide_compat_version_major + '.'
|
||||
+ ide_compat_version_minor + '.' + ide_compat_version_release
|
||||
|
||||
property string qtcreator_copyright_year: '2018'
|
||||
property string qtcreator_copyright_year: '2019'
|
||||
property string qtcreator_copyright_string: "(C) " + qtcreator_copyright_year + " The Qt Company Ltd"
|
||||
|
||||
property string ide_display_name: 'Qt Creator'
|
||||
|
@@ -5,7 +5,7 @@ QTCREATOR_VERSION = 4.9.82
|
||||
QTCREATOR_COMPAT_VERSION = 4.9.82
|
||||
VERSION = $$QTCREATOR_VERSION
|
||||
QTCREATOR_DISPLAY_VERSION = 4.10.0-beta1
|
||||
QTCREATOR_COPYRIGHT_YEAR = 2018
|
||||
QTCREATOR_COPYRIGHT_YEAR = 2019
|
||||
BINARY_ARTIFACTS_BRANCH = master
|
||||
|
||||
isEmpty(IDE_DISPLAY_NAME): IDE_DISPLAY_NAME = Qt Creator
|
||||
|
@@ -150,4 +150,7 @@ win32 {
|
||||
bindist_installer.commands ~= s,/,\\\\,g
|
||||
}
|
||||
|
||||
deployqt.CONFIG += recursive
|
||||
deployqt.recurse = src
|
||||
|
||||
QMAKE_EXTRA_TARGETS += deployqt bindist bindist_installer bindist_debug
|
||||
|
@@ -274,3 +274,5 @@
|
||||
<string>A user application wants to access the photo library.</string>
|
||||
<key>NSRemindersUsageDescription</key>
|
||||
<string>A user application wants to access the reminders.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@@ -52,3 +52,5 @@ DISTFILES += qtcreator.rc \
|
||||
QMAKE_SUBSTITUTES += $$PWD/app_version.h.in
|
||||
|
||||
CONFIG += no_batch
|
||||
|
||||
QMAKE_EXTRA_TARGETS += deployqt # dummy
|
||||
|
@@ -78,7 +78,7 @@ Definition Repository::definitionForName(const QString& defName) const
|
||||
return d->m_defs.value(defName);
|
||||
}
|
||||
|
||||
static Definition bestCandidate(QVector<Definition>& candidates)
|
||||
static Definition bestCandidate(QVector<Definition> &&candidates)
|
||||
{
|
||||
if (candidates.isEmpty())
|
||||
return Definition();
|
||||
@@ -91,6 +91,11 @@ static Definition bestCandidate(QVector<Definition>& candidates)
|
||||
}
|
||||
|
||||
Definition Repository::definitionForFileName(const QString& fileName) const
|
||||
{
|
||||
return bestCandidate(definitionsForFileName(fileName));
|
||||
}
|
||||
|
||||
QVector<Definition> Repository::definitionsForFileName(const QString &fileName) const
|
||||
{
|
||||
QFileInfo fi(fileName);
|
||||
const auto name = fi.fileName();
|
||||
@@ -106,10 +111,15 @@ Definition Repository::definitionForFileName(const QString& fileName) const
|
||||
}
|
||||
}
|
||||
|
||||
return bestCandidate(candidates);
|
||||
return candidates;
|
||||
}
|
||||
|
||||
Definition Repository::definitionForMimeType(const QString& mimeType) const
|
||||
{
|
||||
return bestCandidate(definitionsForMimeType(mimeType));
|
||||
}
|
||||
|
||||
QVector<Definition> Repository::definitionsForMimeType(const QString &mimeType) const
|
||||
{
|
||||
QVector<Definition> candidates;
|
||||
for (auto it = d->m_defs.constBegin(); it != d->m_defs.constEnd(); ++it) {
|
||||
@@ -121,8 +131,7 @@ Definition Repository::definitionForMimeType(const QString& mimeType) const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bestCandidate(candidates);
|
||||
return candidates;
|
||||
}
|
||||
|
||||
QVector<Definition> Repository::definitions() const
|
||||
|
@@ -166,6 +166,13 @@ public:
|
||||
*/
|
||||
Definition definitionForFileName(const QString &fileName) const;
|
||||
|
||||
/**
|
||||
* Returns all Definition%s for the file named @p fileName.
|
||||
* The match is performed based on the \e extensions and @e mimetype of
|
||||
* the definition files.
|
||||
*/
|
||||
QVector<Definition> definitionsForFileName(const QString &fileName) const;
|
||||
|
||||
/**
|
||||
* Returns the best matching Definition to the type named @p mimeType
|
||||
*
|
||||
@@ -176,6 +183,11 @@ public:
|
||||
*/
|
||||
Definition definitionForMimeType(const QString &mimeType) const;
|
||||
|
||||
/**
|
||||
* Returns all Definition%s to the type named @p mimeType
|
||||
*/
|
||||
QVector<Definition> definitionsForMimeType(const QString &mimeType) const;
|
||||
|
||||
/**
|
||||
* Returns all available Definition%s.
|
||||
* Definition%ss are ordered by translated section and translated names,
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "filepathview.h"
|
||||
#include "filepath.h"
|
||||
|
||||
#include <compilermacro.h>
|
||||
#include <includesearchpath.h>
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
template<typename ProjectInfo, typename OutputContainer = std::vector<std::string>>
|
||||
template<typename ProjectInfo, typename OutputContainer = Utils::SmallStringVector>
|
||||
class CommandLineBuilder
|
||||
{
|
||||
public:
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
{
|
||||
for (const IncludeSearchPath &path : projectIncludeSearchPaths) {
|
||||
commandLine.emplace_back("-I");
|
||||
commandLine.emplace_back(path.path);
|
||||
commandLine.emplace_back(NativeFilePath(FilePathView(path.path)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
for (const IncludeSearchPath &path : systemIncludeSearchPaths) {
|
||||
if (path.type != IncludeSearchPathType::BuiltIn) {
|
||||
commandLine.emplace_back(includeOption(path.type));
|
||||
commandLine.emplace_back(path.path);
|
||||
commandLine.emplace_back(NativeFilePath(FilePathView(path.path)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -238,7 +238,7 @@ public:
|
||||
for (const IncludeSearchPath &path : systemIncludeSearchPaths) {
|
||||
if (path.type == IncludeSearchPathType::BuiltIn) {
|
||||
commandLine.emplace_back(includeOption(path.type));
|
||||
commandLine.emplace_back(path.path);
|
||||
commandLine.emplace_back(NativeFilePath(FilePathView(path.path)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,23 +247,24 @@ public:
|
||||
{
|
||||
if (!outputPath.isEmpty()) {
|
||||
commandLine.emplace_back("-o");
|
||||
commandLine.emplace_back(outputPath);
|
||||
commandLine.emplace_back(NativeFilePath(outputPath));
|
||||
}
|
||||
}
|
||||
|
||||
void addSourcePath(FilePathView sourcePath)
|
||||
{
|
||||
if (!sourcePath.isEmpty())
|
||||
commandLine.emplace_back(sourcePath);
|
||||
commandLine.emplace_back(NativeFilePath(sourcePath));
|
||||
}
|
||||
|
||||
void addIncludePchPath(FilePathView includePchPath)
|
||||
{
|
||||
|
||||
if (!includePchPath.isEmpty()) {
|
||||
commandLine.emplace_back("-Xclang");
|
||||
commandLine.emplace_back("-include-pch");
|
||||
commandLine.emplace_back("-Xclang");
|
||||
commandLine.emplace_back(includePchPath);
|
||||
commandLine.emplace_back(NativeFilePath(includePchPath));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include "clangsupport_global.h"
|
||||
|
||||
#include "filepathview.h"
|
||||
#include "filepathview.h"
|
||||
#include "nativefilepath.h"
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/smallstringio.h>
|
||||
@@ -37,6 +37,8 @@
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class NativeFilePath;
|
||||
|
||||
class FilePath : public Utils::PathString
|
||||
{
|
||||
using size_type = Utils::PathString::size_type;
|
||||
|
@@ -26,13 +26,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "filepathview.h"
|
||||
#include "filepathview.h"
|
||||
#include "filepath.h"
|
||||
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/smallstringio.h>
|
||||
|
||||
namespace ClangBackEnd {
|
||||
|
||||
class FilePath;
|
||||
|
||||
class NativeFilePath
|
||||
{
|
||||
using size_type = Utils::PathString::size_type;
|
||||
@@ -50,8 +52,13 @@ public:
|
||||
NativeFilePath(NativeFilePathView filePathView)
|
||||
: m_path(filePathView.toStringView()),
|
||||
m_slashIndex(filePathView.slashIndex())
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
explicit NativeFilePath(FilePathView filePathView) { *this = fromFilePath(filePathView); }
|
||||
|
||||
explicit NativeFilePath(const FilePath &filePath)
|
||||
: NativeFilePath{FilePathView{filePath}}
|
||||
{}
|
||||
|
||||
template<size_type Size>
|
||||
NativeFilePath(const char(&string)[Size]) noexcept
|
||||
|
@@ -25,6 +25,8 @@
|
||||
|
||||
#include "languagefeatures.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace LanguageServerProtocol {
|
||||
|
||||
constexpr const char HoverRequest::methodName[];
|
||||
@@ -406,7 +408,7 @@ CodeActionResult::CodeActionResult(const QJsonValue &val)
|
||||
emplace<ResultArray>(result);
|
||||
return;
|
||||
}
|
||||
emplace<nullptr_t>(nullptr);
|
||||
emplace<std::nullptr_t>(nullptr);
|
||||
}
|
||||
|
||||
bool CodeAction::isValid(QStringList *error) const
|
||||
|
@@ -48,3 +48,5 @@ win32: isEmpty(QTC_SKIP_CDBEXT) {
|
||||
message("environment variable pointing to your CDB installation.")
|
||||
}
|
||||
}
|
||||
|
||||
QMAKE_EXTRA_TARGETS += deployqt # dummy
|
||||
|
@@ -27,6 +27,7 @@
|
||||
#include "fancylineedit.h"
|
||||
#include "historycompleter.h"
|
||||
#include "hostosinfo.h"
|
||||
#include "optional.h"
|
||||
#include "qtcassert.h"
|
||||
#include "stylehelper.h"
|
||||
#include "utilsicons.h"
|
||||
@@ -175,6 +176,14 @@ FancyLineEdit::~FancyLineEdit()
|
||||
}
|
||||
}
|
||||
|
||||
void FancyLineEdit::setTextKeepingActiveCursor(const QString &text)
|
||||
{
|
||||
optional<int> cursor = hasFocus() ? make_optional(cursorPosition()) : nullopt;
|
||||
setText(text);
|
||||
if (cursor)
|
||||
setCursorPosition(*cursor);
|
||||
}
|
||||
|
||||
void FancyLineEdit::setButtonVisible(Side side, bool visible)
|
||||
{
|
||||
d->m_iconbutton[side]->setVisible(visible);
|
||||
|
@@ -82,6 +82,8 @@ public:
|
||||
explicit FancyLineEdit(QWidget *parent = nullptr);
|
||||
~FancyLineEdit() override;
|
||||
|
||||
void setTextKeepingActiveCursor(const QString &text);
|
||||
|
||||
QIcon buttonIcon(Side side) const;
|
||||
void setButtonIcon(Side side, const QIcon &icon);
|
||||
|
||||
|
@@ -26,7 +26,6 @@
|
||||
#include "pathchooser.h"
|
||||
|
||||
#include "environment.h"
|
||||
#include "optional.h"
|
||||
#include "qtcassert.h"
|
||||
#include "macroexpander.h"
|
||||
|
||||
@@ -348,22 +347,14 @@ QString PathChooser::expandedDirectory(const QString &input, const Environment &
|
||||
return path;
|
||||
}
|
||||
|
||||
void setTextKeepingActiveCursor(QLineEdit *edit, const QString &text)
|
||||
{
|
||||
optional<int> cursor = edit->hasFocus() ? make_optional(edit->cursorPosition()) : nullopt;
|
||||
edit->setText(text);
|
||||
if (cursor)
|
||||
edit->setCursorPosition(*cursor);
|
||||
}
|
||||
|
||||
void PathChooser::setPath(const QString &path)
|
||||
{
|
||||
setTextKeepingActiveCursor(d->m_lineEdit, QDir::toNativeSeparators(path));
|
||||
d->m_lineEdit->setTextKeepingActiveCursor(QDir::toNativeSeparators(path));
|
||||
}
|
||||
|
||||
void PathChooser::setFileName(const FileName &fn)
|
||||
{
|
||||
setTextKeepingActiveCursor(d->m_lineEdit, fn.toUserOutput());
|
||||
d->m_lineEdit->setTextKeepingActiveCursor(fn.toUserOutput());
|
||||
}
|
||||
|
||||
void PathChooser::setErrorColor(const QColor &errorColor)
|
||||
|
@@ -90,8 +90,7 @@ public:
|
||||
SmallStringView(const String &string) noexcept
|
||||
: m_pointer(string.data()),
|
||||
m_size(string.size())
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
static
|
||||
SmallStringView fromUtf8(const char *const characterPointer)
|
||||
|
@@ -148,6 +148,11 @@ public:
|
||||
};
|
||||
TreeItem::insertOrderedChild(item, cmp0);
|
||||
}
|
||||
|
||||
ChildType *reverseFindAnyChild(const std::function<bool(TreeItem *)> &pred) const
|
||||
{
|
||||
return static_cast<ChildType *>(TreeItem::reverseFindAnyChild(pred));
|
||||
}
|
||||
};
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT StaticTreeItem : public TreeItem
|
||||
|
@@ -163,7 +163,7 @@ TestResultItem *TestResultItem::intermediateFor(const TestResultItem *item) cons
|
||||
QTC_ASSERT(item, return nullptr);
|
||||
const TestResult *otherResult = item->testResult();
|
||||
for (int row = childCount() - 1; row >= 0; --row) {
|
||||
TestResultItem *child = static_cast<TestResultItem *>(childAt(row));
|
||||
TestResultItem *child = childAt(row);
|
||||
const TestResult *testResult = child->testResult();
|
||||
if (testResult->result() != Result::MessageIntermediate)
|
||||
continue;
|
||||
@@ -186,7 +186,7 @@ TestResultItem *TestResultItem::createAndAddIntermediateFor(const TestResultItem
|
||||
/********************************* TestResultModel *****************************************/
|
||||
|
||||
TestResultModel::TestResultModel(QObject *parent)
|
||||
: Utils::TreeModel<>(parent)
|
||||
: Utils::TreeModel<TestResultItem>(new TestResultItem(TestResultPtr()), parent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -194,16 +194,15 @@ void TestResultModel::updateParent(const TestResultItem *item)
|
||||
{
|
||||
QTC_ASSERT(item, return);
|
||||
QTC_ASSERT(item->testResult(), return);
|
||||
Utils::TreeItem *parentItem = item->parent();
|
||||
TestResultItem *parentItem = item->parent();
|
||||
if (parentItem == rootItem()) // do not update invisible root item
|
||||
return;
|
||||
bool changed = false;
|
||||
TestResultItem *parentResultItem = static_cast<TestResultItem *>(parentItem);
|
||||
parentResultItem->updateResult(changed, item->testResult()->result());
|
||||
parentItem->updateResult(changed, item->testResult()->result());
|
||||
if (!changed)
|
||||
return;
|
||||
emit dataChanged(parentItem->index(), parentItem->index());
|
||||
updateParent(parentResultItem);
|
||||
updateParent(parentItem);
|
||||
}
|
||||
|
||||
void TestResultModel::addTestResult(const TestResultPtr &testResult, bool autoExpand)
|
||||
@@ -212,7 +211,7 @@ void TestResultModel::addTestResult(const TestResultPtr &testResult, bool autoEx
|
||||
if (testResult->result() == Result::MessageCurrentTest) {
|
||||
// MessageCurrentTest should always be the last top level item
|
||||
if (lastRow >= 0) {
|
||||
TestResultItem *current = static_cast<TestResultItem *>(rootItem()->childAt(lastRow));
|
||||
TestResultItem *current = rootItem()->childAt(lastRow);
|
||||
const TestResult *result = current->testResult();
|
||||
if (result && result->result() == Result::MessageCurrentTest) {
|
||||
current->updateDescription(testResult->description());
|
||||
@@ -235,14 +234,11 @@ void TestResultModel::addTestResult(const TestResultPtr &testResult, bool autoEx
|
||||
if (AutotestPlugin::settings()->displayApplication) {
|
||||
const QString application = testResult->id();
|
||||
if (!application.isEmpty()) {
|
||||
for (int row = rootItem()->childCount() - 1; row >= 0; --row) {
|
||||
TestResultItem *tmp = static_cast<TestResultItem *>(rootItem()->childAt(row));
|
||||
auto tmpTestResult = tmp->testResult();
|
||||
if (tmpTestResult->id() == application) {
|
||||
root = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
root = rootItem()->findFirstLevelChild([&application](TestResultItem *child) {
|
||||
QTC_ASSERT(child, return false);
|
||||
return child->testResult()->id() == application;
|
||||
});
|
||||
|
||||
if (!root) {
|
||||
TestResult *tmpAppResult = new TestResult(application, application);
|
||||
tmpAppResult->setResult(Result::Application);
|
||||
@@ -264,7 +260,7 @@ void TestResultModel::addTestResult(const TestResultPtr &testResult, bool autoEx
|
||||
updateParent(newItem);
|
||||
} else {
|
||||
if (lastRow >= 0) {
|
||||
TestResultItem *current = static_cast<TestResultItem *>(rootItem()->childAt(lastRow));
|
||||
TestResultItem *current = rootItem()->childAt(lastRow);
|
||||
const TestResult *result = current->testResult();
|
||||
if (result && result->result() == Result::MessageCurrentTest) {
|
||||
rootItem()->insertChild(current->index().row(), newItem);
|
||||
@@ -278,15 +274,11 @@ void TestResultModel::addTestResult(const TestResultPtr &testResult, bool autoEx
|
||||
|
||||
void TestResultModel::removeCurrentTestMessage()
|
||||
{
|
||||
std::vector<Utils::TreeItem *> topLevelItems(rootItem()->begin(), rootItem()->end());
|
||||
auto end = topLevelItems.rend();
|
||||
for (auto it = topLevelItems.rbegin(); it != end; ++it) {
|
||||
TestResultItem *current = static_cast<TestResultItem *>(*it);
|
||||
if (current->testResult()->result() == Result::MessageCurrentTest) {
|
||||
destroyItem(current);
|
||||
break;
|
||||
}
|
||||
}
|
||||
TestResultItem *currentMessageItem = rootItem()->findFirstLevelChild([](TestResultItem *it) {
|
||||
return (it->testResult()->result() == Result::MessageCurrentTest);
|
||||
});
|
||||
if (currentMessageItem)
|
||||
destroyItem(currentMessageItem);
|
||||
}
|
||||
|
||||
void TestResultModel::clearTestResults()
|
||||
@@ -302,7 +294,7 @@ void TestResultModel::clearTestResults()
|
||||
const TestResult *TestResultModel::testResult(const QModelIndex &idx)
|
||||
{
|
||||
if (idx.isValid())
|
||||
return static_cast<TestResultItem *>(itemForIndex(idx))->testResult();
|
||||
return itemForIndex(idx)->testResult();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -353,7 +345,7 @@ TestResultItem *TestResultModel::findParentItemFor(const TestResultItem *item,
|
||||
|
||||
if (root == nullptr && !name.isEmpty()) {
|
||||
for (int row = rootItem()->childCount() - 1; row >= 0; --row) {
|
||||
TestResultItem *tmp = static_cast<TestResultItem *>(rootItem()->childAt(row));
|
||||
TestResultItem *tmp = rootItem()->childAt(row);
|
||||
auto tmpTestResult = tmp->testResult();
|
||||
if (tmpTestResult->id() == id && tmpTestResult->name() == name) {
|
||||
root = tmp;
|
||||
@@ -369,7 +361,7 @@ TestResultItem *TestResultModel::findParentItemFor(const TestResultItem *item,
|
||||
TestResultItem *currentItem = static_cast<TestResultItem *>(it);
|
||||
return currentItem->testResult()->isDirectParentOf(result, &needsIntermediate);
|
||||
};
|
||||
TestResultItem *parent = static_cast<TestResultItem *>(root->reverseFindAnyChild(predicate));
|
||||
TestResultItem *parent = root->reverseFindAnyChild(predicate);
|
||||
if (parent) {
|
||||
if (needsIntermediate) {
|
||||
// check if the intermediate is present already
|
||||
|
@@ -37,7 +37,7 @@
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
|
||||
class TestResultItem : public Utils::TreeItem
|
||||
class TestResultItem : public Utils::TypedTreeItem<TestResultItem, TestResultItem>
|
||||
{
|
||||
public:
|
||||
explicit TestResultItem(const TestResultPtr &testResult);
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
TestResultPtr m_testResult;
|
||||
};
|
||||
|
||||
class TestResultModel : public Utils::TreeModel<>
|
||||
class TestResultModel : public Utils::TreeModel<TestResultItem>
|
||||
{
|
||||
public:
|
||||
explicit TestResultModel(QObject *parent = nullptr);
|
||||
|
@@ -291,11 +291,26 @@ void MakefileParser::parseSubDirs()
|
||||
foreach (const QString& source, parser.sources())
|
||||
m_sources.append(subDir + slash + source);
|
||||
|
||||
// Append the include paths of the sub directory
|
||||
m_includePaths.append(parser.includePaths());
|
||||
|
||||
// Append the flags of the sub directory
|
||||
m_cflags.append(parser.cflags());
|
||||
m_cxxflags.append(parser.cxxflags());
|
||||
|
||||
// Append the macros of the sub directory
|
||||
foreach (const auto& m, parser.macros())
|
||||
{
|
||||
if (!m_macros.contains(m))
|
||||
m_macros.append(m);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Duplicates might be possible in combination with several
|
||||
// "..._SUBDIRS" targets
|
||||
m_makefiles.removeDuplicates();
|
||||
m_sources.removeDuplicates();
|
||||
}
|
||||
|
||||
if (subDirs.isEmpty())
|
||||
m_success = false;
|
||||
|
@@ -63,9 +63,7 @@ enum { backEndStartTimeOutInMs = 10000 };
|
||||
|
||||
static QString backendProcessPath()
|
||||
{
|
||||
return Core::ICore::libexecPath()
|
||||
+ QStringLiteral("/clangbackend")
|
||||
+ QStringLiteral(QTC_HOST_EXE_SUFFIX);
|
||||
return Core::ICore::libexecPath() + "/clangbackend" + QTC_HOST_EXE_SUFFIX;
|
||||
}
|
||||
|
||||
namespace ClangCodeModel {
|
||||
@@ -121,7 +119,7 @@ BackendCommunicator::~BackendCommunicator()
|
||||
void BackendCommunicator::initializeBackend()
|
||||
{
|
||||
const QString clangBackEndProcessPath = backendProcessPath();
|
||||
if (!QFileInfo(clangBackEndProcessPath).exists()) {
|
||||
if (!QFileInfo::exists(clangBackEndProcessPath)) {
|
||||
logExecutableDoesNotExist();
|
||||
return;
|
||||
}
|
||||
|
@@ -133,7 +133,6 @@ void disableDiagnosticInCurrentProjectConfig(const ClangBackEnd::DiagnosticConta
|
||||
currentConfigId = globalSettings->clangDiagnosticConfigId();
|
||||
|
||||
// Get config
|
||||
const ClangDiagnosticConfigs originalConfigs = globalSettings->clangCustomDiagnosticConfigs();
|
||||
ClangDiagnosticConfigsModel configsModel(globalSettings->clangCustomDiagnosticConfigs());
|
||||
QTC_ASSERT(configsModel.hasConfigWithId(currentConfigId), return );
|
||||
ClangDiagnosticConfig config = configsModel.configWithId(currentConfigId);
|
||||
|
@@ -471,6 +471,13 @@ QList<Diagnostic> ClangTidyClazyTool::read(const QString &filePath,
|
||||
return readSerializedDiagnostics(filePath, projectRootDir, logFilePath, errorMessage);
|
||||
}
|
||||
|
||||
void ClangTidyClazyTool::onNewDiagnosticsAvailable(const QList<Diagnostic> &diagnostics)
|
||||
{
|
||||
ClangTool::onNewDiagnosticsAvailable(diagnostics);
|
||||
if (!m_diagnosticFilterModel->filterRegExp().pattern().isEmpty())
|
||||
m_diagnosticFilterModel->invalidateFilter();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ClangTools
|
||||
|
||||
|
@@ -58,6 +58,8 @@ public:
|
||||
const QString &logFilePath,
|
||||
QString *errorMessage) const final;
|
||||
|
||||
void onNewDiagnosticsAvailable(const QList<Diagnostic> &diagnostics) override;
|
||||
|
||||
private:
|
||||
void handleStateUpdate() final;
|
||||
|
||||
|
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
const QString &name() const;
|
||||
|
||||
void onNewDiagnosticsAvailable(const QList<Diagnostic> &diagnostics);
|
||||
virtual void onNewDiagnosticsAvailable(const QList<Diagnostic> &diagnostics);
|
||||
|
||||
signals:
|
||||
void finished(bool success); // For testing.
|
||||
|
@@ -57,6 +57,8 @@ QVariant FilePathItem::data(int column, int role) const
|
||||
return m_filePath;
|
||||
case Qt::DecorationRole:
|
||||
return Core::FileIconProvider::icon(m_filePath);
|
||||
case Debugger::DetailedErrorView::FullTextRole:
|
||||
return m_filePath;
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@@ -68,12 +70,14 @@ QVariant FilePathItem::data(int column, int role) const
|
||||
class ExplainingStepItem : public Utils::TreeItem
|
||||
{
|
||||
public:
|
||||
ExplainingStepItem(const ExplainingStep &step);
|
||||
ExplainingStepItem(const ExplainingStep &step, int index);
|
||||
int index() const { return m_index; }
|
||||
|
||||
private:
|
||||
QVariant data(int column, int role) const override;
|
||||
|
||||
const ExplainingStep m_step;
|
||||
const int m_index = 0;
|
||||
};
|
||||
|
||||
ClangToolsDiagnosticModel::ClangToolsDiagnosticModel(QObject *parent)
|
||||
@@ -295,15 +299,24 @@ static QString createExplainingStepString(const ExplainingStep &explainingStep,
|
||||
{
|
||||
return createExplainingStepNumberString(number)
|
||||
+ QLatin1Char(' ')
|
||||
+ explainingStep.extendedMessage
|
||||
+ explainingStep.message
|
||||
+ QLatin1Char(' ')
|
||||
+ createLocationString(explainingStep.location);
|
||||
}
|
||||
|
||||
|
||||
static QString lineColumnString(const Debugger::DiagnosticLocation &location)
|
||||
{
|
||||
return QString("%1:%2").arg(QString::number(location.line), QString::number(location.column));
|
||||
}
|
||||
|
||||
static QString fullText(const Diagnostic &diagnostic)
|
||||
{
|
||||
// Summary.
|
||||
QString text = diagnostic.category + QLatin1String(": ") + diagnostic.type;
|
||||
QString text = diagnostic.location.filePath + QLatin1Char(':');
|
||||
text += lineColumnString(diagnostic.location) + QLatin1String(": ");
|
||||
if (!diagnostic.category.isEmpty())
|
||||
text += diagnostic.category + QLatin1String(": ");
|
||||
text += diagnostic.type;
|
||||
if (diagnostic.type != diagnostic.description)
|
||||
text += QLatin1String(": ") + diagnostic.description;
|
||||
text += QLatin1Char('\n');
|
||||
@@ -339,8 +352,8 @@ DiagnosticItem::DiagnosticItem(const Diagnostic &diag,
|
||||
if (!diag.explainingSteps.isEmpty())
|
||||
m_parentModel->stepsToItemsCache[diag.explainingSteps].push_back(this);
|
||||
|
||||
foreach (const ExplainingStep &s, diag.explainingSteps)
|
||||
appendChild(new ExplainingStepItem(s));
|
||||
for (int i = 0; i < diag.explainingSteps.size(); ++i )
|
||||
appendChild(new ExplainingStepItem(diag.explainingSteps[i], i));
|
||||
}
|
||||
|
||||
DiagnosticItem::~DiagnosticItem()
|
||||
@@ -380,11 +393,6 @@ static QVariant iconData(const QString &type)
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
static QString lineColumnString(const Debugger::DiagnosticLocation &location)
|
||||
{
|
||||
return QString("%1:%2").arg(QString::number(location.line), QString::number(location.column));
|
||||
}
|
||||
|
||||
QVariant DiagnosticItem::data(int column, int role) const
|
||||
{
|
||||
if (column == DiagnosticView::FixItColumn) {
|
||||
@@ -481,9 +489,10 @@ bool DiagnosticItem::hasNewFixIts() const
|
||||
return m_parentModel->stepsToItemsCache[m_diagnostic.explainingSteps].front() == this;
|
||||
}
|
||||
|
||||
ExplainingStepItem::ExplainingStepItem(const ExplainingStep &step) : m_step(step)
|
||||
{
|
||||
}
|
||||
ExplainingStepItem::ExplainingStepItem(const ExplainingStep &step, int index)
|
||||
: m_step(step)
|
||||
, m_index(index)
|
||||
{}
|
||||
|
||||
// We expect something like "note: ..."
|
||||
static QVariant iconForExplainingStepMessage(const QString &message)
|
||||
@@ -509,28 +518,37 @@ QVariant ExplainingStepItem::data(int column, int role) const
|
||||
switch (role) {
|
||||
case Debugger::DetailedErrorView::LocationRole:
|
||||
return QVariant::fromValue(m_step.location);
|
||||
case Debugger::DetailedErrorView::FullTextRole:
|
||||
return fullText(static_cast<DiagnosticItem *>(parent())->diagnostic());
|
||||
case Debugger::DetailedErrorView::FullTextRole: {
|
||||
return QString("%1:%2: %3")
|
||||
.arg(m_step.location.filePath, lineColumnString(m_step.location), m_step.message);
|
||||
}
|
||||
case ClangToolsDiagnosticModel::TextRole:
|
||||
return m_step.message;
|
||||
case ClangToolsDiagnosticModel::DiagnosticRole:
|
||||
return QVariant::fromValue(static_cast<DiagnosticItem *>(parent())->diagnostic());
|
||||
case Qt::DisplayRole: {
|
||||
const QString mainFilePath = static_cast<DiagnosticItem *>(parent())->diagnostic().location.filePath;
|
||||
const QString locationString
|
||||
= m_step.location.filePath == mainFilePath
|
||||
? lineColumnString(m_step.location)
|
||||
: QString("%1:%2").arg(QFileInfo(m_step.location.filePath).fileName(),
|
||||
lineColumnString(m_step.location));
|
||||
|
||||
if (m_step.isFixIt) {
|
||||
if (m_step.ranges[0] == m_step.ranges[1]) {
|
||||
return QString("%1: Insertion of \"%2\".")
|
||||
.arg(lineColumnString(m_step.location), m_step.message);
|
||||
.arg(locationString, m_step.message);
|
||||
}
|
||||
if (m_step.message.isEmpty()) {
|
||||
return QString("%1: Removal of %2.")
|
||||
.arg(lineColumnString(m_step.location), rangeString(m_step.ranges));
|
||||
.arg(locationString, rangeString(m_step.ranges));
|
||||
}
|
||||
return QString("%1: Replacement of %2 with: \"%3\".")
|
||||
.arg(lineColumnString(m_step.location),
|
||||
.arg(locationString,
|
||||
rangeString(m_step.ranges),
|
||||
m_step.message);
|
||||
}
|
||||
return QString("%1: %2").arg(lineColumnString(m_step.location), m_step.message);
|
||||
return QString("%1: %2").arg(locationString, m_step.message);
|
||||
}
|
||||
case Qt::ToolTipRole:
|
||||
return createExplainingStepToolTipString(m_step);
|
||||
@@ -546,7 +564,6 @@ QVariant ExplainingStepItem::data(int column, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
DiagnosticFilterModel::DiagnosticFilterModel(QObject *parent)
|
||||
: QSortFilterProxyModel(parent)
|
||||
{
|
||||
@@ -584,14 +601,32 @@ void DiagnosticFilterModel::addSuppressedDiagnostic(
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void DiagnosticFilterModel::invalidateFilter()
|
||||
{
|
||||
QSortFilterProxyModel::invalidateFilter();
|
||||
}
|
||||
|
||||
bool DiagnosticFilterModel::filterAcceptsRow(int sourceRow,
|
||||
const QModelIndex &sourceParent) const
|
||||
{
|
||||
auto model = static_cast<ClangToolsDiagnosticModel *>(sourceModel());
|
||||
Utils::TreeItem *item = model->itemForIndex(sourceParent);
|
||||
|
||||
// FilePathItem - hide if no diagnostics match
|
||||
if (!sourceParent.isValid()) {
|
||||
const QModelIndex filePathIndex = model->index(sourceRow, 0);
|
||||
const int rowCount = model->rowCount(filePathIndex);
|
||||
if (rowCount == 0)
|
||||
return true; // Children not yet added.
|
||||
for (int row = 0; row < rowCount; ++row) {
|
||||
if (filterAcceptsRow(row, filePathIndex))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// DiagnosticItem
|
||||
if (auto filePathItem = dynamic_cast<FilePathItem *>(item)) {
|
||||
Utils::TreeItem *parentItem = model->itemForIndex(sourceParent);
|
||||
if (auto filePathItem = dynamic_cast<FilePathItem *>(parentItem)) {
|
||||
auto diagnosticItem = dynamic_cast<DiagnosticItem *>(filePathItem->childAt(sourceRow));
|
||||
QTC_ASSERT(diagnosticItem, return false);
|
||||
|
||||
@@ -612,7 +647,7 @@ bool DiagnosticFilterModel::filterAcceptsRow(int sourceRow,
|
||||
return diag.description.contains(filterRegExp());
|
||||
}
|
||||
|
||||
return true;
|
||||
return true; // ExplainingStepItem
|
||||
}
|
||||
|
||||
bool DiagnosticFilterModel::lessThan(const QModelIndex &l, const QModelIndex &r) const
|
||||
@@ -622,22 +657,34 @@ bool DiagnosticFilterModel::lessThan(const QModelIndex &l, const QModelIndex &r)
|
||||
const bool isComparingDiagnostics = !dynamic_cast<FilePathItem *>(itemLeft);
|
||||
|
||||
if (sortColumn() == Debugger::DetailedErrorView::DiagnosticColumn && isComparingDiagnostics) {
|
||||
bool result = false;
|
||||
if (dynamic_cast<DiagnosticItem *>(itemLeft)) {
|
||||
using Debugger::DiagnosticLocation;
|
||||
const int role = Debugger::DetailedErrorView::LocationRole;
|
||||
|
||||
const auto leftLoc = sourceModel()->data(l, role).value<DiagnosticLocation>();
|
||||
const auto leftText = sourceModel()->data(l, ClangToolsDiagnosticModel::TextRole).toString();
|
||||
const auto leftText
|
||||
= sourceModel()->data(l, ClangToolsDiagnosticModel::TextRole).toString();
|
||||
|
||||
const auto rightLoc = sourceModel()->data(r, role).value<DiagnosticLocation>();
|
||||
const auto rightText = sourceModel()->data(r, ClangToolsDiagnosticModel::TextRole).toString();
|
||||
const auto rightText
|
||||
= sourceModel()->data(r, ClangToolsDiagnosticModel::TextRole).toString();
|
||||
|
||||
const int result = std::tie(leftLoc.line, leftLoc.column, leftText)
|
||||
result = std::tie(leftLoc.line, leftLoc.column, leftText)
|
||||
< std::tie(rightLoc.line, rightLoc.column, rightText);
|
||||
} else if (auto left = dynamic_cast<ExplainingStepItem *>(itemLeft)) {
|
||||
const auto right = dynamic_cast<ExplainingStepItem *>(model->itemForIndex(r));
|
||||
result = left->index() < right->index();
|
||||
} else {
|
||||
QTC_CHECK(false && "Unexpected item");
|
||||
}
|
||||
|
||||
if (sortOrder() == Qt::DescendingOrder)
|
||||
return !result; // Ensure that we always sort location from top to bottom.
|
||||
return !result; // Do not change the order of these item as this might be confusing.
|
||||
return result;
|
||||
}
|
||||
|
||||
// FilePathItem
|
||||
return QSortFilterProxyModel::lessThan(l, r);
|
||||
}
|
||||
|
||||
|
@@ -146,6 +146,8 @@ public:
|
||||
void addSuppressedDiagnostic(const SuppressedDiagnostic &diag);
|
||||
ProjectExplorer::Project *project() const { return m_project; }
|
||||
|
||||
void invalidateFilter();
|
||||
|
||||
private:
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
bool lessThan(const QModelIndex &l, const QModelIndex &r) const override;
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QToolButton>
|
||||
#include <QComboBox>
|
||||
|
||||
static const char C_SUPPRESSED_WARNINGS[] = "SuppressedWarnings";
|
||||
|
||||
@@ -73,6 +74,12 @@ void InfoBarEntry::setCancelButtonInfo(const QString &_cancelButtonText, CallBac
|
||||
m_cancelButtonCallBack = callBack;
|
||||
}
|
||||
|
||||
void InfoBarEntry::setComboInfo(const QStringList &list, InfoBarEntry::ComboCallBack callBack)
|
||||
{
|
||||
m_comboCallBack = callBack;
|
||||
m_comboInfo = list;
|
||||
}
|
||||
|
||||
void InfoBarEntry::removeCancelButton()
|
||||
{
|
||||
m_useCancelButton = false;
|
||||
@@ -242,7 +249,7 @@ void InfoBarDisplay::update()
|
||||
|
||||
QLabel *infoWidgetLabel = new QLabel(info.m_infoText);
|
||||
infoWidgetLabel->setWordWrap(true);
|
||||
hbox->addWidget(infoWidgetLabel);
|
||||
hbox->addWidget(infoWidgetLabel, 1);
|
||||
|
||||
if (info.m_detailsWidgetCreator) {
|
||||
if (m_isShowingDetailsWidget) {
|
||||
@@ -270,6 +277,16 @@ void InfoBarDisplay::update()
|
||||
m_isShowingDetailsWidget = false;
|
||||
}
|
||||
|
||||
if (!info.m_comboInfo.isEmpty()) {
|
||||
auto cb = new QComboBox();
|
||||
cb->addItems(info.m_comboInfo);
|
||||
connect(cb, &QComboBox::currentTextChanged, [info](const QString &text) {
|
||||
info.m_comboCallBack(text);
|
||||
});
|
||||
|
||||
hbox->addWidget(cb);
|
||||
}
|
||||
|
||||
if (!info.m_buttonText.isEmpty()) {
|
||||
auto infoWidgetButton = new QToolButton;
|
||||
infoWidgetButton->setText(info.m_buttonText);
|
||||
|
@@ -61,6 +61,8 @@ public:
|
||||
void setCustomButtonInfo(const QString &_buttonText, CallBack callBack);
|
||||
void setCancelButtonInfo(CallBack callBack);
|
||||
void setCancelButtonInfo(const QString &_cancelButtonText, CallBack callBack);
|
||||
using ComboCallBack = std::function<void(const QString &)>;
|
||||
void setComboInfo(const QStringList &list, ComboCallBack callBack);
|
||||
void removeCancelButton();
|
||||
|
||||
using DetailsWidgetCreator = std::function<QWidget*()>;
|
||||
@@ -76,6 +78,8 @@ private:
|
||||
GlobalSuppressionMode m_globalSuppression;
|
||||
DetailsWidgetCreator m_detailsWidgetCreator;
|
||||
bool m_useCancelButton = true;
|
||||
ComboCallBack m_comboCallBack;
|
||||
QStringList m_comboInfo;
|
||||
friend class InfoBar;
|
||||
friend class InfoBarDisplay;
|
||||
};
|
||||
|
@@ -33,8 +33,6 @@ namespace Internal {
|
||||
class CppAutoCompleter : public TextEditor::AutoCompleter
|
||||
{
|
||||
public:
|
||||
CppAutoCompleter() {}
|
||||
|
||||
bool contextAllowsAutoBrackets(const QTextCursor &cursor,
|
||||
const QString &textToInsert = QString()) const override;
|
||||
bool contextAllowsAutoQuotes(const QTextCursor &cursor,
|
||||
|
@@ -85,8 +85,6 @@ QSizePolicy sizePolicyWithStretchFactor(int stretchFactor)
|
||||
|
||||
class DepthFinder : public SymbolVisitor {
|
||||
public:
|
||||
DepthFinder() : m_symbol(0), m_depth(-1), m_foundDepth(-1), m_stop(false) {}
|
||||
|
||||
int operator()(const Document::Ptr &document, Symbol *symbol)
|
||||
{
|
||||
m_symbol = symbol;
|
||||
@@ -94,7 +92,7 @@ public:
|
||||
return m_foundDepth;
|
||||
}
|
||||
|
||||
bool preVisit(Symbol *symbol)
|
||||
bool preVisit(Symbol *symbol) override
|
||||
{
|
||||
if (m_stop)
|
||||
return false;
|
||||
@@ -111,17 +109,17 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
void postVisit(Symbol *symbol)
|
||||
void postVisit(Symbol *symbol) override
|
||||
{
|
||||
if (symbol->asScope())
|
||||
--m_depth;
|
||||
}
|
||||
|
||||
private:
|
||||
Symbol *m_symbol;
|
||||
int m_depth;
|
||||
int m_foundDepth;
|
||||
bool m_stop;
|
||||
Symbol *m_symbol = nullptr;
|
||||
int m_depth = -1;
|
||||
int m_foundDepth = -1;
|
||||
bool m_stop = false;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
@@ -169,12 +167,12 @@ FilterableView::FilterableView(QWidget *parent)
|
||||
QPushButton *clearButton = new QPushButton(QLatin1String("&Clear"), this);
|
||||
QObject::connect(clearButton, &QAbstractButton::clicked, this, &FilterableView::clearFilter);
|
||||
|
||||
QHBoxLayout *filterBarLayout = new QHBoxLayout();
|
||||
auto filterBarLayout = new QHBoxLayout();
|
||||
filterBarLayout->addWidget(label);
|
||||
filterBarLayout->addWidget(lineEdit);
|
||||
filterBarLayout->addWidget(clearButton);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout();
|
||||
auto mainLayout = new QVBoxLayout();
|
||||
mainLayout->addWidget(view);
|
||||
mainLayout->addLayout(filterBarLayout);
|
||||
|
||||
@@ -222,10 +220,10 @@ public:
|
||||
|
||||
enum Columns { FileKindColumn, FilePathColumn, ColumnCount };
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
private:
|
||||
ProjectFiles m_files;
|
||||
@@ -305,10 +303,10 @@ public:
|
||||
|
||||
enum Columns { TypeColumn, PathColumn, ColumnCount };
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
private:
|
||||
ProjectExplorer::HeaderPaths m_paths;
|
||||
@@ -377,7 +375,7 @@ class KeyValueModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef QList<QPair<QString, QString> > Table;
|
||||
using Table = QList<QPair<QString, QString>>;
|
||||
|
||||
KeyValueModel(QObject *parent);
|
||||
void configure(const Table &table);
|
||||
@@ -385,10 +383,10 @@ public:
|
||||
|
||||
enum Columns { KeyColumn, ValueColumn, ColumnCount };
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
private:
|
||||
Table m_table;
|
||||
@@ -465,10 +463,10 @@ public:
|
||||
|
||||
enum Columns { SymbolCountColumn, SharedColumn, FilePathColumn, ColumnCount };
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
private:
|
||||
QList<Document::Ptr> m_documents;
|
||||
@@ -498,7 +496,7 @@ QModelIndex SnapshotModel::indexForDocument(const QString &filePath)
|
||||
if (document->fileName() == filePath)
|
||||
return index(i, FilePathColumn);
|
||||
}
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
|
||||
int SnapshotModel::rowCount(const QModelIndex &/*parent*/) const
|
||||
@@ -565,10 +563,10 @@ public:
|
||||
|
||||
enum Columns { ResolvedOrNotColumn, LineNumberColumn, FilePathsColumn, ColumnCount };
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
private:
|
||||
QList<Document::Include> m_includes;
|
||||
@@ -667,10 +665,10 @@ public:
|
||||
|
||||
enum Columns { LevelColumn, LineColumnNumberColumn, MessageColumn, ColumnCount };
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
private:
|
||||
QList<Document::DiagnosticMessage> m_messages;
|
||||
@@ -716,8 +714,7 @@ QVariant DiagnosticMessagesModel::data(const QModelIndex &index, int role) const
|
||||
static const QBrush darkRedBrushQColor(QColor(139, 0, 0));
|
||||
|
||||
const Document::DiagnosticMessage message = m_messages.at(index.row());
|
||||
const Document::DiagnosticMessage::Level level
|
||||
= static_cast<Document::DiagnosticMessage::Level>(message.level());
|
||||
const auto level = static_cast<Document::DiagnosticMessage::Level>(message.level());
|
||||
|
||||
if (role == Qt::DisplayRole) {
|
||||
const int column = index.column();
|
||||
@@ -775,10 +772,10 @@ public:
|
||||
|
||||
enum Columns { LineNumberColumn, MacroColumn, ColumnCount };
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
private:
|
||||
QList<CPlusPlus::Macro> m_macros;
|
||||
@@ -854,12 +851,12 @@ public:
|
||||
|
||||
enum Columns { SymbolColumn, LineNumberColumn, ColumnCount };
|
||||
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent) const;
|
||||
QModelIndex parent(const QModelIndex &child) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent) const override;
|
||||
QModelIndex parent(const QModelIndex &child) const override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
private:
|
||||
Document::Ptr m_document;
|
||||
@@ -886,21 +883,19 @@ void SymbolsModel::clear()
|
||||
|
||||
static Symbol *indexToSymbol(const QModelIndex &index)
|
||||
{
|
||||
if (Symbol *symbol = static_cast<Symbol*>(index.internalPointer()))
|
||||
return symbol;
|
||||
return 0;
|
||||
return static_cast<Symbol*>(index.internalPointer());
|
||||
}
|
||||
|
||||
static Scope *indexToScope(const QModelIndex &index)
|
||||
{
|
||||
if (Symbol *symbol = indexToSymbol(index))
|
||||
return symbol->asScope();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QModelIndex SymbolsModel::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
Scope *scope = 0;
|
||||
Scope *scope = nullptr;
|
||||
if (parent.isValid())
|
||||
scope = indexToScope(parent);
|
||||
else if (m_document)
|
||||
@@ -911,13 +906,13 @@ QModelIndex SymbolsModel::index(int row, int column, const QModelIndex &parent)
|
||||
return createIndex(row, column, scope->memberAt(row));
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
|
||||
QModelIndex SymbolsModel::parent(const QModelIndex &child) const
|
||||
{
|
||||
if (!child.isValid())
|
||||
return QModelIndex();
|
||||
return {};
|
||||
|
||||
if (Symbol *symbol = indexToSymbol(child)) {
|
||||
if (Scope *scope = symbol->enclosingScope()) {
|
||||
@@ -926,7 +921,7 @@ QModelIndex SymbolsModel::parent(const QModelIndex &child) const
|
||||
}
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
|
||||
int SymbolsModel::rowCount(const QModelIndex &parent) const
|
||||
@@ -994,10 +989,10 @@ public:
|
||||
BytesAndCodePointsColumn, GeneratedColumn, ExpandedColumn, WhiteSpaceColumn,
|
||||
NewlineColumn, ColumnCount };
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
private:
|
||||
struct TokenInfo {
|
||||
@@ -1126,10 +1121,10 @@ public:
|
||||
|
||||
enum Columns { PartNameColumn, PartFilePathColumn, ColumnCount };
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
private:
|
||||
QList<ProjectPart::Ptr> m_projectPartsList;
|
||||
@@ -1161,7 +1156,7 @@ void ProjectPartsModel::configure(const QList<ProjectInfo> &projectInfos,
|
||||
QModelIndex ProjectPartsModel::indexForCurrentEditorsProjectPart() const
|
||||
{
|
||||
if (m_currentEditorsProjectPartIndex == -1)
|
||||
return QModelIndex();
|
||||
return {};
|
||||
return createIndex(m_currentEditorsProjectPartIndex, PartFilePathColumn);
|
||||
}
|
||||
|
||||
@@ -1232,10 +1227,10 @@ public:
|
||||
|
||||
enum Columns { RevisionColumn, FilePathColumn, ColumnCount };
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
private:
|
||||
struct WorkingCopyEntry {
|
||||
@@ -1275,7 +1270,7 @@ QModelIndex WorkingCopyModel::indexForFile(const QString &filePath)
|
||||
if (entry.filePath == filePath)
|
||||
return index(i, FilePathColumn);
|
||||
}
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
|
||||
int WorkingCopyModel::rowCount(const QModelIndex &/*parent*/) const
|
||||
@@ -1542,11 +1537,11 @@ void CppCodeModelInspectorDialog::refresh()
|
||||
dumper.dumpSnapshot(globalSnapshot, globalSnapshotTitle, /*isGlobalSnapshot=*/ true);
|
||||
|
||||
TextEditor::BaseTextEditor *editor = currentEditor();
|
||||
CppTools::CppEditorDocumentHandle *cppEditorDocument = 0;
|
||||
CppTools::CppEditorDocumentHandle *cppEditorDocument = nullptr;
|
||||
if (editor) {
|
||||
const QString editorFilePath = editor->document()->filePath().toString();
|
||||
cppEditorDocument = cmmi->cppEditorDocument(editorFilePath);
|
||||
if (auto *documentProcessor = CppToolsBridge::baseEditorDocumentProcessor(editorFilePath)) {
|
||||
if (auto documentProcessor = CppToolsBridge::baseEditorDocumentProcessor(editorFilePath)) {
|
||||
const Snapshot editorSnapshot = documentProcessor->snapshot();
|
||||
m_snapshotInfos->append(SnapshotInfo(editorSnapshot, SnapshotInfo::EditorSnapshot));
|
||||
const QString editorSnapshotTitle
|
||||
@@ -1555,7 +1550,7 @@ void CppCodeModelInspectorDialog::refresh()
|
||||
dumper.dumpSnapshot(editorSnapshot, editorSnapshotTitle);
|
||||
m_ui->snapshotSelector->addItem(editorSnapshotTitle);
|
||||
}
|
||||
CppEditorWidget *cppEditorWidget = qobject_cast<CppEditorWidget *>(editor->editorWidget());
|
||||
auto cppEditorWidget = qobject_cast<CppEditorWidget *>(editor->editorWidget());
|
||||
if (cppEditorWidget) {
|
||||
SemanticInfo semanticInfo = cppEditorWidget->semanticInfo();
|
||||
Snapshot snapshot;
|
||||
@@ -1855,7 +1850,7 @@ void CppCodeModelInspectorDialog::updateProjectPartData(const ProjectPart::Ptr &
|
||||
bool CppCodeModelInspectorDialog::event(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::ShortcutOverride) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(e);
|
||||
auto ke = static_cast<QKeyEvent *>(e);
|
||||
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
||||
ke->accept();
|
||||
close();
|
||||
|
@@ -65,8 +65,8 @@ class CppCodeModelInspectorDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CppCodeModelInspectorDialog(QWidget *parent = 0);
|
||||
~CppCodeModelInspectorDialog();
|
||||
explicit CppCodeModelInspectorDialog(QWidget *parent = nullptr);
|
||||
~CppCodeModelInspectorDialog() override;
|
||||
|
||||
private:
|
||||
void onRefreshRequested();
|
||||
@@ -90,7 +90,7 @@ private:
|
||||
void clearProjectPartData();
|
||||
void updateProjectPartData(const CppTools::ProjectPart::Ptr &part);
|
||||
|
||||
bool event(QEvent *e);
|
||||
bool event(QEvent *e) override;
|
||||
|
||||
private:
|
||||
Ui::CppCodeModelInspectorDialog *m_ui;
|
||||
|
@@ -173,7 +173,7 @@ bool handleDoxygenCppStyleContinuation(QTextCursor &cursor)
|
||||
return false;
|
||||
|
||||
QString newLine(QLatin1Char('\n'));
|
||||
newLine.append(text.left(offset)); // indent correctly
|
||||
newLine.append(text.leftRef(offset)); // indent correctly
|
||||
newLine.append(commentMarker);
|
||||
newLine.append(QLatin1Char(' '));
|
||||
|
||||
|
@@ -80,7 +80,10 @@ public:
|
||||
mm()->registerCppEditorDocument(this);
|
||||
}
|
||||
|
||||
~CppEditorDocumentHandleImpl() { mm()->unregisterCppEditorDocument(m_registrationFilePath); }
|
||||
~CppEditorDocumentHandleImpl() override
|
||||
{
|
||||
mm()->unregisterCppEditorDocument(m_registrationFilePath);
|
||||
}
|
||||
|
||||
QString filePath() const override { return m_cppEditorDocument->filePath().toString(); }
|
||||
QByteArray contents() const override { return m_cppEditorDocument->contentsText(); }
|
||||
@@ -100,12 +103,7 @@ private:
|
||||
};
|
||||
|
||||
CppEditorDocument::CppEditorDocument()
|
||||
: m_fileIsBeingReloaded(false)
|
||||
, m_isObjCEnabled(false)
|
||||
, m_cachedContentsRevision(-1)
|
||||
, m_processorRevision(0)
|
||||
, m_completionAssistProvider(0)
|
||||
, m_minimizableInfoBars(*infoBar())
|
||||
: m_minimizableInfoBars(*infoBar())
|
||||
{
|
||||
setId(CppEditor::Constants::CPPEDITOR_ID);
|
||||
setSyntaxHighlighter(new CppHighlighter);
|
||||
@@ -352,7 +350,7 @@ unsigned CppEditorDocument::contentsRevision() const
|
||||
void CppEditorDocument::releaseResources()
|
||||
{
|
||||
if (m_processor)
|
||||
disconnect(m_processor.data(), 0, this, 0);
|
||||
disconnect(m_processor.data(), nullptr, this, nullptr);
|
||||
m_processor.reset();
|
||||
}
|
||||
|
||||
|
@@ -115,19 +115,19 @@ private:
|
||||
void initializeTimer();
|
||||
|
||||
private:
|
||||
bool m_fileIsBeingReloaded;
|
||||
bool m_isObjCEnabled;
|
||||
bool m_fileIsBeingReloaded = false;
|
||||
bool m_isObjCEnabled = false;
|
||||
|
||||
// Caching contents
|
||||
mutable QMutex m_cachedContentsLock;
|
||||
mutable QByteArray m_cachedContents;
|
||||
mutable int m_cachedContentsRevision;
|
||||
mutable int m_cachedContentsRevision = -1;
|
||||
|
||||
unsigned m_processorRevision;
|
||||
unsigned m_processorRevision = 0;
|
||||
QTimer m_processorTimer;
|
||||
QScopedPointer<CppTools::BaseEditorDocumentProcessor> m_processor;
|
||||
|
||||
CppTools::CppCompletionAssistProvider *m_completionAssistProvider;
|
||||
CppTools::CppCompletionAssistProvider *m_completionAssistProvider = nullptr;
|
||||
|
||||
// (Un)Registration in CppModelManager
|
||||
QScopedPointer<CppTools::CppEditorDocumentHandle> m_editorDocumentHandle;
|
||||
|
@@ -310,7 +310,7 @@ static CppEditorWidget *currentCppEditorWidget()
|
||||
{
|
||||
if (IEditor *currentEditor = EditorManager::currentEditor())
|
||||
return qobject_cast<CppEditorWidget*>(currentEditor->widget());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CppEditorPlugin::switchDeclarationDefinition()
|
||||
|
@@ -40,7 +40,7 @@ class CppEditorPlugin : public ExtensionSystem::IPlugin
|
||||
|
||||
public:
|
||||
CppEditorPlugin();
|
||||
~CppEditorPlugin();
|
||||
~CppEditorPlugin() override;
|
||||
|
||||
static CppEditorPlugin *instance();
|
||||
|
||||
|
@@ -261,7 +261,7 @@ void CppEditorWidget::finalizeInitialization()
|
||||
void CppEditorWidget::finalizeInitializationAfterDuplication(TextEditorWidget *other)
|
||||
{
|
||||
QTC_ASSERT(other, return);
|
||||
CppEditorWidget *cppEditorWidget = qobject_cast<CppEditorWidget *>(other);
|
||||
auto cppEditorWidget = qobject_cast<CppEditorWidget *>(other);
|
||||
QTC_ASSERT(cppEditorWidget, return);
|
||||
|
||||
if (cppEditorWidget->isSemanticInfoValidExceptLocalUses())
|
||||
@@ -278,10 +278,7 @@ void CppEditorWidget::finalizeInitializationAfterDuplication(TextEditorWidget *o
|
||||
d->m_cppEditorDocument->parseContextModel().areMultipleAvailable());
|
||||
}
|
||||
|
||||
CppEditorWidget::~CppEditorWidget()
|
||||
{
|
||||
// non-inline destructor, see section "Forward Declared Pointers" of QScopedPointer.
|
||||
}
|
||||
CppEditorWidget::~CppEditorWidget() = default;
|
||||
|
||||
CppEditorDocument *CppEditorWidget::cppEditorDocument() const
|
||||
{
|
||||
@@ -357,7 +354,7 @@ static QString getDocumentLine(const QTextDocument &document, int line)
|
||||
static QString getFileLine(const QString &path, int line)
|
||||
{
|
||||
const IDocument *document = DocumentModel::documentForFilePath(path);
|
||||
const TextDocument *textDocument = qobject_cast<const TextDocument *>(document);
|
||||
const auto textDocument = qobject_cast<const TextDocument *>(document);
|
||||
if (textDocument)
|
||||
return getDocumentLine(*textDocument->document(), line);
|
||||
|
||||
@@ -543,7 +540,7 @@ ProjectPart *findProjectPartForCurrentProject(const QList<ProjectPart::Ptr> &pro
|
||||
if (found != projectParts.cend())
|
||||
return (*found).data();
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -551,7 +548,7 @@ ProjectPart *findProjectPartForCurrentProject(const QList<ProjectPart::Ptr> &pro
|
||||
ProjectPart *CppEditorWidget::projectPart() const
|
||||
{
|
||||
if (!d->m_modelManager)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
auto projectParts = fetchProjectParts(d->m_modelManager, textDocument()->filePath());
|
||||
|
||||
@@ -668,14 +665,13 @@ void CppEditorWidget::switchDeclarationDefinition(bool inNextSplit)
|
||||
return;
|
||||
|
||||
// Find function declaration or definition under cursor
|
||||
Function *functionDefinitionSymbol = 0;
|
||||
Symbol *functionDeclarationSymbol = 0;
|
||||
Function *functionDefinitionSymbol = nullptr;
|
||||
Symbol *functionDeclarationSymbol = nullptr;
|
||||
|
||||
ASTPath astPathFinder(d->m_lastSemanticInfo.doc);
|
||||
const QList<AST *> astPath = astPathFinder(textCursor());
|
||||
|
||||
for (int i = 0, size = astPath.size(); i < size; ++i) {
|
||||
AST *ast = astPath.at(i);
|
||||
for (AST *ast : astPath) {
|
||||
if (FunctionDefinitionAST *functionDefinitionAST = ast->asFunctionDefinition()) {
|
||||
if ((functionDefinitionSymbol = functionDefinitionAST->symbol))
|
||||
break; // Function definition found!
|
||||
@@ -999,7 +995,7 @@ AssistInterface *CppEditorWidget::createAssistInterface(AssistKind kind, AssistR
|
||||
} else {
|
||||
return TextEditorWidget::createAssistInterface(kind, reason);
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QSharedPointer<FunctionDeclDefLink> CppEditorWidget::declDefLink() const
|
||||
|
@@ -96,19 +96,17 @@ static bool findDeclOrDef(const Document::Ptr &doc, int line, int column,
|
||||
// by CompoundStatement/CtorInitializer
|
||||
// for function declarations, look for SimpleDeclarations with a single Declarator
|
||||
// with a FunctionDeclarator postfix
|
||||
FunctionDefinitionAST *funcDef = 0;
|
||||
SimpleDeclarationAST *simpleDecl = 0;
|
||||
*decl = 0;
|
||||
*decl = nullptr;
|
||||
for (int i = path.size() - 1; i > 0; --i) {
|
||||
AST *ast = path.at(i);
|
||||
if (ast->asCompoundStatement() || ast->asCtorInitializer())
|
||||
break;
|
||||
if ((funcDef = ast->asFunctionDefinition()) != 0) {
|
||||
if (FunctionDefinitionAST *funcDef = ast->asFunctionDefinition()) {
|
||||
*parent = funcDef;
|
||||
*decl = funcDef->declarator;
|
||||
break;
|
||||
}
|
||||
if ((simpleDecl = ast->asSimpleDeclaration()) != 0) {
|
||||
if (SimpleDeclarationAST *simpleDecl = ast->asSimpleDeclaration()) {
|
||||
*parent = simpleDecl;
|
||||
if (!simpleDecl->declarator_list || !simpleDecl->declarator_list->value)
|
||||
break;
|
||||
@@ -142,12 +140,12 @@ static void declDefLinkStartEnd(const CppRefactoringFileConstPtr &file,
|
||||
static DeclaratorIdAST *getDeclaratorId(DeclaratorAST *declarator)
|
||||
{
|
||||
if (!declarator || !declarator->core_declarator)
|
||||
return 0;
|
||||
return nullptr;
|
||||
if (DeclaratorIdAST *id = declarator->core_declarator->asDeclaratorId())
|
||||
return id;
|
||||
if (NestedDeclaratorAST *nested = declarator->core_declarator->asNestedDeclarator())
|
||||
return getDeclaratorId(nested->declarator);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static QSharedPointer<FunctionDeclDefLink> findLinkHelper(QSharedPointer<FunctionDeclDefLink> link, CppRefactoringChanges changes)
|
||||
@@ -156,7 +154,7 @@ static QSharedPointer<FunctionDeclDefLink> findLinkHelper(QSharedPointer<Functio
|
||||
const Snapshot &snapshot = changes.snapshot();
|
||||
|
||||
// find the matching decl/def symbol
|
||||
Symbol *target = 0;
|
||||
Symbol *target = nullptr;
|
||||
SymbolFinder finder;
|
||||
if (FunctionDefinitionAST *funcDef = link->sourceDeclaration->asFunctionDefinition()) {
|
||||
QList<Declaration *> nameMatch, argumentCountMatch, typeMatch;
|
||||
@@ -178,9 +176,9 @@ static QSharedPointer<FunctionDeclDefLink> findLinkHelper(QSharedPointer<Functio
|
||||
if (!targetFile->isValid())
|
||||
return noResult;
|
||||
|
||||
DeclarationAST *targetParent = 0;
|
||||
FunctionDeclaratorAST *targetFuncDecl = 0;
|
||||
DeclaratorAST *targetDeclarator = 0;
|
||||
DeclarationAST *targetParent = nullptr;
|
||||
FunctionDeclaratorAST *targetFuncDecl = nullptr;
|
||||
DeclaratorAST *targetDeclarator = nullptr;
|
||||
if (!findDeclOrDef(targetFile->cppDocument(), target->line(), target->column(),
|
||||
&targetParent, &targetDeclarator, &targetFuncDecl))
|
||||
return noResult;
|
||||
@@ -213,9 +211,9 @@ void FunctionDeclDefLinkFinder::startFindLinkAt(
|
||||
QTextCursor cursor, const Document::Ptr &doc, const Snapshot &snapshot)
|
||||
{
|
||||
// check if cursor is on function decl/def
|
||||
DeclarationAST *parent = 0;
|
||||
FunctionDeclaratorAST *funcDecl = 0;
|
||||
DeclaratorAST *declarator = 0;
|
||||
DeclarationAST *parent = nullptr;
|
||||
FunctionDeclaratorAST *funcDecl = nullptr;
|
||||
DeclaratorAST *declarator = nullptr;
|
||||
if (!findDeclOrDef(doc, cursor.blockNumber() + 1, cursor.columnNumber() + 1,
|
||||
&parent, &declarator, &funcDecl))
|
||||
return;
|
||||
@@ -455,10 +453,10 @@ static SpecifierAST *findFirstReplaceableSpecifier(TranslationUnit *translationU
|
||||
if (canReplaceSpecifier(translationUnit, it->value))
|
||||
return it->value;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
typedef QVarLengthArray<int, 10> IndicesList;
|
||||
using IndicesList = QVarLengthArray<int, 10>;
|
||||
|
||||
template <class IndicesListType>
|
||||
static int findUniqueTypeMatch(int sourceParamIndex, Function *sourceFunction, Function *newFunction,
|
||||
@@ -597,8 +595,8 @@ ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targetOffse
|
||||
Control *control = sourceContext.bindings()->control().data();
|
||||
|
||||
// get return type start position and declarator info from declaration
|
||||
DeclaratorAST *declarator = 0;
|
||||
SpecifierAST *firstReplaceableSpecifier = 0;
|
||||
DeclaratorAST *declarator = nullptr;
|
||||
SpecifierAST *firstReplaceableSpecifier = nullptr;
|
||||
TranslationUnit *targetTranslationUnit = targetFile->cppDocument()->translationUnit();
|
||||
if (SimpleDeclarationAST *simple = targetDeclaration->asSimpleDeclaration()) {
|
||||
declarator = simple->declarator_list->value;
|
||||
@@ -790,7 +788,7 @@ ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targetOffse
|
||||
if (hasCommentedName(targetFile->cppDocument()->translationUnit(),
|
||||
QString::fromUtf8(targetFile->cppDocument()->utf8Source()),
|
||||
targetFunctionDeclarator, existingParamIndex))
|
||||
replacementName = 0;
|
||||
replacementName = nullptr;
|
||||
|
||||
// track renames
|
||||
if (replacementName != targetParam->name() && replacementName)
|
||||
@@ -914,8 +912,8 @@ ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targetOffse
|
||||
changes.insert(targetFile->endOf(targetFunctionDeclarator->rparen_token), cvString);
|
||||
// modify/remove existing specifiers
|
||||
} else {
|
||||
SimpleSpecifierAST *constSpecifier = 0;
|
||||
SimpleSpecifierAST *volatileSpecifier = 0;
|
||||
SimpleSpecifierAST *constSpecifier = nullptr;
|
||||
SimpleSpecifierAST *volatileSpecifier = nullptr;
|
||||
for (SpecifierListAST *it = targetFunctionDeclarator->cv_qualifier_list; it; it = it->next) {
|
||||
if (SimpleSpecifierAST *simple = it->value->asSimpleSpecifier()) {
|
||||
unsigned kind = targetFile->tokenAt(simple->specifier_token).kind();
|
||||
|
@@ -45,7 +45,7 @@ class FunctionDeclDefLinkFinder : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FunctionDeclDefLinkFinder(QObject *parent = 0);
|
||||
FunctionDeclDefLinkFinder(QObject *parent = nullptr);
|
||||
|
||||
void startFindLinkAt(QTextCursor cursor,
|
||||
const CPlusPlus::Document::Ptr &doc,
|
||||
|
@@ -41,7 +41,7 @@ class CppHighlighter : public TextEditor::SyntaxHighlighter
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CppHighlighter(QTextDocument *document = 0);
|
||||
CppHighlighter(QTextDocument *document = nullptr);
|
||||
|
||||
void setLanguageFeatures(const CPlusPlus::LanguageFeatures &languageFeatures);
|
||||
void highlightBlock(const QString &text) override;
|
||||
|
@@ -80,7 +80,7 @@ static Snapshot globalSnapshot()
|
||||
|
||||
struct FileAndLine
|
||||
{
|
||||
FileAndLine() {}
|
||||
FileAndLine() = default;
|
||||
FileAndLine(const QString &f, int l) : file(f), line(l) {}
|
||||
|
||||
QString file;
|
||||
@@ -122,7 +122,7 @@ class CppIncludeHierarchyItem
|
||||
{
|
||||
public:
|
||||
enum SubTree { RootItem, InIncludes, InIncludedBy };
|
||||
CppIncludeHierarchyItem() {}
|
||||
CppIncludeHierarchyItem() = default;
|
||||
|
||||
void createChild(const QString &filePath, SubTree subTree,
|
||||
int line = 0, bool definitelyNoChildren = false)
|
||||
@@ -348,7 +348,7 @@ class CppIncludeHierarchyWidget : public QWidget
|
||||
|
||||
public:
|
||||
CppIncludeHierarchyWidget();
|
||||
~CppIncludeHierarchyWidget() { delete m_treeView; }
|
||||
~CppIncludeHierarchyWidget() override { delete m_treeView; }
|
||||
|
||||
void perform();
|
||||
|
||||
@@ -509,9 +509,9 @@ void CppIncludeHierarchyWidget::syncFromEditorManager()
|
||||
|
||||
// Use cppDocumentUpdated to catch parsing finished and later file updates.
|
||||
// The timer limits the amount of hierarchy updates.
|
||||
connect(document, &CppEditorDocument::cppDocumentUpdated, this, [this]() {
|
||||
m_timer->start();
|
||||
}, Qt::UniqueConnection);
|
||||
connect(document, &CppEditorDocument::cppDocumentUpdated,
|
||||
m_timer, QOverload<>::of(&QTimer::start),
|
||||
Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
// CppIncludeHierarchyFactory
|
||||
|
@@ -38,7 +38,7 @@ class CppIncludeHierarchyItem;
|
||||
class CppIncludeHierarchyModel : public Utils::TreeModel<CppIncludeHierarchyItem>
|
||||
{
|
||||
Q_OBJECT
|
||||
typedef Utils::TreeModel<CppIncludeHierarchyItem> base_type;
|
||||
using base_type = Utils::TreeModel<CppIncludeHierarchyItem>;
|
||||
|
||||
public:
|
||||
CppIncludeHierarchyModel();
|
||||
|
@@ -92,8 +92,8 @@ public:
|
||||
ModeImplementationFile = 0x00000008
|
||||
};
|
||||
|
||||
InsertVirtualMethodsDialog(QWidget *parent = 0);
|
||||
~InsertVirtualMethodsDialog();
|
||||
InsertVirtualMethodsDialog(QWidget *parent = nullptr);
|
||||
~InsertVirtualMethodsDialog() override;
|
||||
void initGui();
|
||||
void initData();
|
||||
virtual void saveSettings();
|
||||
@@ -113,20 +113,20 @@ private:
|
||||
void updateOverrideReplacementsComboBox();
|
||||
|
||||
private:
|
||||
QTreeView *m_view;
|
||||
QLineEdit *m_filter;
|
||||
QCheckBox *m_hideReimplementedFunctions;
|
||||
QComboBox *m_insertMode;
|
||||
QCheckBox *m_virtualKeyword;
|
||||
QCheckBox *m_overrideReplacementCheckBox;
|
||||
QComboBox *m_overrideReplacementComboBox;
|
||||
QToolButton *m_clearUserAddedReplacementsButton;
|
||||
QDialogButtonBox *m_buttons;
|
||||
QTreeView *m_view = nullptr;
|
||||
QLineEdit *m_filter = nullptr;
|
||||
QCheckBox *m_hideReimplementedFunctions = nullptr;
|
||||
QComboBox *m_insertMode = nullptr;
|
||||
QCheckBox *m_virtualKeyword = nullptr;
|
||||
QCheckBox *m_overrideReplacementCheckBox = nullptr;
|
||||
QComboBox *m_overrideReplacementComboBox = nullptr;
|
||||
QToolButton *m_clearUserAddedReplacementsButton = nullptr;
|
||||
QDialogButtonBox *m_buttons = nullptr;
|
||||
QList<bool> m_expansionStateNormal;
|
||||
QList<bool> m_expansionStateReimp;
|
||||
QStringList m_availableOverrideReplacements;
|
||||
bool m_hasImplementationFile;
|
||||
bool m_hasReimplementedFunctions;
|
||||
bool m_hasImplementationFile = false;
|
||||
bool m_hasReimplementedFunctions = false;
|
||||
|
||||
protected:
|
||||
VirtualMethodsSettings *m_settings;
|
||||
@@ -149,15 +149,11 @@ namespace {
|
||||
class InsertVirtualMethodsItem
|
||||
{
|
||||
public:
|
||||
InsertVirtualMethodsItem(InsertVirtualMethodsItem *parent) :
|
||||
row(-1),
|
||||
m_parent(parent)
|
||||
{
|
||||
}
|
||||
InsertVirtualMethodsItem(InsertVirtualMethodsItem *parent)
|
||||
: m_parent(parent)
|
||||
{}
|
||||
|
||||
virtual ~InsertVirtualMethodsItem()
|
||||
{
|
||||
}
|
||||
virtual ~InsertVirtualMethodsItem() = default;
|
||||
|
||||
virtual QString description() const = 0;
|
||||
virtual Qt::ItemFlags flags() const = 0;
|
||||
@@ -165,10 +161,10 @@ public:
|
||||
|
||||
InsertVirtualMethodsItem *parent() { return m_parent; }
|
||||
|
||||
int row;
|
||||
int row = -1;
|
||||
|
||||
private:
|
||||
InsertVirtualMethodsItem *m_parent;
|
||||
InsertVirtualMethodsItem *m_parent = nullptr;
|
||||
};
|
||||
|
||||
class FunctionItem;
|
||||
@@ -177,11 +173,11 @@ class ClassItem : public InsertVirtualMethodsItem
|
||||
{
|
||||
public:
|
||||
ClassItem(const QString &className, const Class *clazz);
|
||||
~ClassItem();
|
||||
~ClassItem() override;
|
||||
|
||||
QString description() const { return name; }
|
||||
Qt::ItemFlags flags() const;
|
||||
Qt::CheckState checkState() const;
|
||||
QString description() const override { return name; }
|
||||
Qt::ItemFlags flags() const override;
|
||||
Qt::CheckState checkState() const override;
|
||||
void removeFunction(int row);
|
||||
|
||||
const Class *klass;
|
||||
@@ -193,9 +189,9 @@ class FunctionItem : public InsertVirtualMethodsItem
|
||||
{
|
||||
public:
|
||||
FunctionItem(const Function *func, const QString &functionName, ClassItem *parent);
|
||||
QString description() const;
|
||||
Qt::ItemFlags flags() const;
|
||||
Qt::CheckState checkState() const { return checked ? Qt::Checked : Qt::Unchecked; }
|
||||
QString description() const override;
|
||||
Qt::ItemFlags flags() const override;
|
||||
Qt::CheckState checkState() const override { return checked ? Qt::Checked : Qt::Unchecked; }
|
||||
|
||||
const Function *function = nullptr;
|
||||
InsertionPointLocator::AccessSpec accessSpec = InsertionPointLocator::Invalid;
|
||||
@@ -209,7 +205,7 @@ private:
|
||||
};
|
||||
|
||||
ClassItem::ClassItem(const QString &className, const Class *clazz) :
|
||||
InsertVirtualMethodsItem(0),
|
||||
InsertVirtualMethodsItem(nullptr),
|
||||
klass(clazz),
|
||||
name(className)
|
||||
{
|
||||
@@ -339,7 +335,7 @@ public:
|
||||
bool insertOverrideReplacement = false;
|
||||
|
||||
private:
|
||||
typedef QLatin1String _;
|
||||
using _ = QLatin1String;
|
||||
static QString group() { return _("QuickFix/InsertVirtualMethods"); }
|
||||
static QString insertVirtualKeywordKey() { return _("insertKeywordVirtual"); }
|
||||
static QString insertOverrideReplacementKey() { return _("insertOverrideReplacement"); }
|
||||
@@ -352,13 +348,13 @@ private:
|
||||
class InsertVirtualMethodsModel : public QAbstractItemModel
|
||||
{
|
||||
public:
|
||||
InsertVirtualMethodsModel(QObject *parent = 0) : QAbstractItemModel(parent)
|
||||
InsertVirtualMethodsModel(QObject *parent = nullptr) : QAbstractItemModel(parent)
|
||||
{
|
||||
const FontSettings &fs = TextEditorSettings::fontSettings();
|
||||
formatReimpFunc = fs.formatFor(C_DISABLED_CODE);
|
||||
}
|
||||
|
||||
~InsertVirtualMethodsModel()
|
||||
~InsertVirtualMethodsModel() override
|
||||
{
|
||||
clear();
|
||||
}
|
||||
@@ -371,26 +367,26 @@ public:
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent) const
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent) const override
|
||||
{
|
||||
if (column != 0)
|
||||
return QModelIndex();
|
||||
return {};
|
||||
if (parent.isValid()) {
|
||||
ClassItem *classItem = static_cast<ClassItem *>(parent.internalPointer());
|
||||
auto classItem = static_cast<ClassItem *>(parent.internalPointer());
|
||||
return createIndex(row, column, classItem->functions.at(row));
|
||||
}
|
||||
return createIndex(row, column, classes.at(row));
|
||||
}
|
||||
|
||||
QModelIndex parent(const QModelIndex &child) const
|
||||
QModelIndex parent(const QModelIndex &child) const override
|
||||
{
|
||||
if (!child.isValid())
|
||||
return QModelIndex();
|
||||
return {};
|
||||
InsertVirtualMethodsItem *parent = itemForIndex(child)->parent();
|
||||
return parent ? createIndex(parent->row, 0, parent) : QModelIndex();
|
||||
}
|
||||
|
||||
int rowCount(const QModelIndex &parent) const
|
||||
int rowCount(const QModelIndex &parent) const override
|
||||
{
|
||||
if (!parent.isValid())
|
||||
return classes.count();
|
||||
@@ -400,7 +396,7 @@ public:
|
||||
return static_cast<ClassItem *>(item)->functions.count();
|
||||
}
|
||||
|
||||
int columnCount(const QModelIndex &) const
|
||||
int columnCount(const QModelIndex &) const override
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -416,13 +412,13 @@ public:
|
||||
|
||||
void removeFunction(FunctionItem *funcItem)
|
||||
{
|
||||
ClassItem *classItem = static_cast<ClassItem *>(funcItem->parent());
|
||||
auto classItem = static_cast<ClassItem *>(funcItem->parent());
|
||||
beginRemoveRows(createIndex(classItem->row, 0, classItem), funcItem->row, funcItem->row);
|
||||
classItem->removeFunction(funcItem->row);
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const
|
||||
QVariant data(const QModelIndex &index, int role) const override
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
@@ -446,7 +442,7 @@ public:
|
||||
break;
|
||||
case InsertVirtualMethodsDialog::Reimplemented:
|
||||
if (item->parent()) {
|
||||
FunctionItem *function = static_cast<FunctionItem *>(item);
|
||||
auto function = static_cast<FunctionItem *>(item);
|
||||
return QVariant(function->alreadyFound);
|
||||
}
|
||||
|
||||
@@ -454,7 +450,7 @@ public:
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role) override
|
||||
{
|
||||
if (!index.isValid())
|
||||
return false;
|
||||
@@ -464,7 +460,7 @@ public:
|
||||
case Qt::CheckStateRole: {
|
||||
bool checked = value.toInt() == Qt::Checked;
|
||||
if (item->parent()) {
|
||||
FunctionItem *funcItem = static_cast<FunctionItem *>(item);
|
||||
auto funcItem = static_cast<FunctionItem *>(item);
|
||||
while (funcItem->checked != checked) {
|
||||
funcItem->checked = checked;
|
||||
const QModelIndex funcIndex = createIndex(funcItem->row, 0, funcItem);
|
||||
@@ -475,7 +471,7 @@ public:
|
||||
funcItem = funcItem->nextOverride;
|
||||
}
|
||||
} else {
|
||||
ClassItem *classItem = static_cast<ClassItem *>(item);
|
||||
auto classItem = static_cast<ClassItem *>(item);
|
||||
foreach (FunctionItem *funcItem, classItem->functions) {
|
||||
if (funcItem->alreadyFound || funcItem->checked == checked)
|
||||
continue;
|
||||
@@ -489,7 +485,7 @@ public:
|
||||
return QAbstractItemModel::setData(index, value, role);
|
||||
}
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override
|
||||
{
|
||||
if (!index.isValid())
|
||||
return Qt::NoItemFlags;
|
||||
@@ -586,7 +582,7 @@ public:
|
||||
if (!name || name->asDestructorNameId())
|
||||
continue;
|
||||
|
||||
const Function *firstVirtual = 0;
|
||||
const Function *firstVirtual = nullptr;
|
||||
const bool isVirtual = FunctionUtils::isVirtualFunction(
|
||||
func, interface.context(), &firstVirtual);
|
||||
if (!isVirtual)
|
||||
@@ -594,7 +590,7 @@ public:
|
||||
|
||||
if (func->isFinal()) {
|
||||
if (FunctionItem *first = virtualFunctions[firstVirtual]) {
|
||||
FunctionItem *next = 0;
|
||||
FunctionItem *next = nullptr;
|
||||
for (FunctionItem *removed = first; next != first; removed = next) {
|
||||
next = removed->nextOverride;
|
||||
m_factory->classFunctionModel->removeFunction(removed);
|
||||
@@ -643,7 +639,7 @@ public:
|
||||
itemName += QLatin1String(" : ") + itemReturnTypeString;
|
||||
if (isReimplemented)
|
||||
itemName += QLatin1String(" (redeclared)");
|
||||
FunctionItem *funcItem = new FunctionItem(func, itemName, itemBase);
|
||||
auto funcItem = new FunctionItem(func, itemName, itemBase);
|
||||
if (isReimplemented) {
|
||||
factory->setHasReimplementedFunctions(true);
|
||||
funcItem->reimplemented = true;
|
||||
@@ -734,7 +730,7 @@ public:
|
||||
return spec;
|
||||
}
|
||||
|
||||
void perform()
|
||||
void perform() override
|
||||
{
|
||||
if (!m_factory->gather())
|
||||
return;
|
||||
@@ -897,12 +893,11 @@ class InsertVirtualMethodsFilterModel : public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
InsertVirtualMethodsFilterModel(QObject *parent = 0)
|
||||
InsertVirtualMethodsFilterModel(QObject *parent = nullptr)
|
||||
: QSortFilterProxyModel(parent)
|
||||
, m_hideReimplemented(false)
|
||||
{}
|
||||
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
|
||||
{
|
||||
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||
|
||||
@@ -941,22 +936,11 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_hideReimplemented;
|
||||
bool m_hideReimplemented = false;
|
||||
};
|
||||
|
||||
InsertVirtualMethodsDialog::InsertVirtualMethodsDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, m_view(0)
|
||||
, m_filter(0)
|
||||
, m_hideReimplementedFunctions(0)
|
||||
, m_insertMode(0)
|
||||
, m_virtualKeyword(0)
|
||||
, m_overrideReplacementCheckBox(0)
|
||||
, m_overrideReplacementComboBox(0)
|
||||
, m_clearUserAddedReplacementsButton(0)
|
||||
, m_buttons(0)
|
||||
, m_hasImplementationFile(false)
|
||||
, m_hasReimplementedFunctions(false)
|
||||
, m_settings(new VirtualMethodsSettings)
|
||||
, classFunctionModel(new InsertVirtualMethodsModel(this))
|
||||
, classFunctionFilterModel(new InsertVirtualMethodsFilterModel(this))
|
||||
@@ -976,11 +960,11 @@ void InsertVirtualMethodsDialog::initGui()
|
||||
return;
|
||||
|
||||
setWindowTitle(tr("Insert Virtual Functions"));
|
||||
QVBoxLayout *globalVerticalLayout = new QVBoxLayout;
|
||||
auto globalVerticalLayout = new QVBoxLayout;
|
||||
|
||||
// View
|
||||
QGroupBox *groupBoxView = new QGroupBox(tr("&Functions to insert:"), this);
|
||||
QVBoxLayout *groupBoxViewLayout = new QVBoxLayout(groupBoxView);
|
||||
auto groupBoxViewLayout = new QVBoxLayout(groupBoxView);
|
||||
m_filter = new QLineEdit(this);
|
||||
m_filter->setClearButtonEnabled(true);
|
||||
m_filter->setPlaceholderText(tr("Filter"));
|
||||
@@ -995,7 +979,7 @@ void InsertVirtualMethodsDialog::initGui()
|
||||
|
||||
// Insertion options
|
||||
QGroupBox *groupBoxImplementation = new QGroupBox(tr("&Insertion options:"), this);
|
||||
QVBoxLayout *groupBoxImplementationLayout = new QVBoxLayout(groupBoxImplementation);
|
||||
auto groupBoxImplementationLayout = new QVBoxLayout(groupBoxImplementation);
|
||||
m_insertMode = new QComboBox(this);
|
||||
m_insertMode->addItem(tr("Insert only declarations"), ModeOnlyDeclarations);
|
||||
m_insertMode->addItem(tr("Insert definitions inside class"), ModeInsideClass);
|
||||
@@ -1012,7 +996,7 @@ void InsertVirtualMethodsDialog::initGui()
|
||||
connect(m_overrideReplacementCheckBox, &QCheckBox::clicked,
|
||||
m_overrideReplacementComboBox, &QComboBox::setEnabled);
|
||||
|
||||
QAction *clearUserAddedReplacements = new QAction(this);
|
||||
auto clearUserAddedReplacements = new QAction(this);
|
||||
clearUserAddedReplacements->setIcon(Utils::Icons::CLEAN_TOOLBAR.icon());
|
||||
clearUserAddedReplacements->setText(tr("Clear Added \"override\" Equivalents"));
|
||||
connect(clearUserAddedReplacements, &QAction::triggered, [this]() {
|
||||
@@ -1023,7 +1007,7 @@ void InsertVirtualMethodsDialog::initGui()
|
||||
m_clearUserAddedReplacementsButton = new QToolButton(this);
|
||||
m_clearUserAddedReplacementsButton->setDefaultAction(clearUserAddedReplacements);
|
||||
|
||||
QHBoxLayout *overrideWidgetsLayout = new QHBoxLayout(this);
|
||||
auto overrideWidgetsLayout = new QHBoxLayout(this);
|
||||
overrideWidgetsLayout->setSpacing(0);
|
||||
overrideWidgetsLayout->setMargin(0);
|
||||
overrideWidgetsLayout->addWidget(m_overrideReplacementCheckBox);
|
||||
@@ -1145,8 +1129,7 @@ void InsertVirtualMethodsDialog::setHasReimplementedFunctions(bool functions)
|
||||
|
||||
void InsertVirtualMethodsDialog::setHideReimplementedFunctions(bool hide)
|
||||
{
|
||||
InsertVirtualMethodsFilterModel *model =
|
||||
qobject_cast<InsertVirtualMethodsFilterModel *>(classFunctionFilterModel);
|
||||
auto model = qobject_cast<InsertVirtualMethodsFilterModel *>(classFunctionFilterModel);
|
||||
|
||||
if (m_expansionStateNormal.isEmpty() && m_expansionStateReimp.isEmpty()) {
|
||||
model->setHideReimplementedFunctions(hide);
|
||||
@@ -1172,8 +1155,7 @@ void InsertVirtualMethodsDialog::updateOverrideReplacementsComboBox()
|
||||
|
||||
void InsertVirtualMethodsDialog::saveExpansionState()
|
||||
{
|
||||
InsertVirtualMethodsFilterModel *model =
|
||||
qobject_cast<InsertVirtualMethodsFilterModel *>(classFunctionFilterModel);
|
||||
auto model = qobject_cast<InsertVirtualMethodsFilterModel *>(classFunctionFilterModel);
|
||||
|
||||
QList<bool> &state = model->hideReimplemented() ? m_expansionStateReimp
|
||||
: m_expansionStateNormal;
|
||||
@@ -1184,8 +1166,7 @@ void InsertVirtualMethodsDialog::saveExpansionState()
|
||||
|
||||
void InsertVirtualMethodsDialog::restoreExpansionState()
|
||||
{
|
||||
InsertVirtualMethodsFilterModel *model =
|
||||
qobject_cast<InsertVirtualMethodsFilterModel *>(classFunctionFilterModel);
|
||||
auto model = qobject_cast<InsertVirtualMethodsFilterModel *>(classFunctionFilterModel);
|
||||
|
||||
const QList<bool> &state = model->hideReimplemented() ? m_expansionStateReimp
|
||||
: m_expansionStateNormal;
|
||||
|
@@ -36,9 +36,9 @@ class InsertVirtualMethods : public CppQuickFixFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
InsertVirtualMethods(InsertVirtualMethodsDialog *dialog = 0);
|
||||
~InsertVirtualMethods();
|
||||
void match(const CppQuickFixInterface &interface, TextEditor::QuickFixOperations &result);
|
||||
InsertVirtualMethods(InsertVirtualMethodsDialog *dialog = nullptr);
|
||||
~InsertVirtualMethods() override;
|
||||
void match(const CppQuickFixInterface &interface, TextEditor::QuickFixOperations &result) override;
|
||||
#ifdef WITH_TESTS
|
||||
static InsertVirtualMethods *createTestFactory();
|
||||
#endif
|
||||
|
@@ -51,7 +51,7 @@ public:
|
||||
static Actions createShowInfoBarActions(const ActionCreator &actionCreator);
|
||||
|
||||
public:
|
||||
explicit MinimizableInfoBars(Core::InfoBar &infoBar, QObject *parent = 0);
|
||||
explicit MinimizableInfoBars(Core::InfoBar &infoBar, QObject *parent = nullptr);
|
||||
|
||||
// Expected call order: processHasProjectPart(), processHeaderDiagnostics()
|
||||
void processHasProjectPart(bool hasProjectPart);
|
||||
|
@@ -38,9 +38,9 @@ class CppPreProcessorDialog : public QDialog
|
||||
|
||||
public:
|
||||
explicit CppPreProcessorDialog(const QString &filePath, QWidget *parent);
|
||||
~CppPreProcessorDialog();
|
||||
~CppPreProcessorDialog() override;
|
||||
|
||||
int exec();
|
||||
int exec() override;
|
||||
|
||||
QString extraPreprocessorDirectives() const;
|
||||
|
||||
|
@@ -39,5 +39,4 @@ CppQuickFixOperation::CppQuickFixOperation(const CppQuickFixInterface &interface
|
||||
: QuickFixOperation(priority), CppQuickFixInterface(interface)
|
||||
{}
|
||||
|
||||
CppQuickFixOperation::~CppQuickFixOperation()
|
||||
{}
|
||||
CppQuickFixOperation::~CppQuickFixOperation() = default;
|
||||
|
@@ -39,7 +39,7 @@ class CPPEDITOR_EXPORT CppQuickFixOperation
|
||||
{
|
||||
public:
|
||||
explicit CppQuickFixOperation(const CppQuickFixInterface &interface, int priority = -1);
|
||||
~CppQuickFixOperation();
|
||||
~CppQuickFixOperation() override;
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -60,7 +60,7 @@ class CPPEDITOR_EXPORT CppQuickFixFactory : public QObject
|
||||
|
||||
public:
|
||||
CppQuickFixFactory();
|
||||
~CppQuickFixFactory();
|
||||
~CppQuickFixFactory() override;
|
||||
|
||||
using QuickFixOperations = TextEditor::QuickFixOperations;
|
||||
|
||||
|
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace CppTools {
|
||||
class CppRefactoringFile;
|
||||
typedef QSharedPointer<CppRefactoringFile> CppRefactoringFilePtr;
|
||||
using CppRefactoringFilePtr = QSharedPointer<CppRefactoringFile>;
|
||||
}
|
||||
|
||||
namespace CppEditor {
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -65,7 +65,7 @@ class AddIncludeForUndefinedIdentifierOp: public CppQuickFixOperation
|
||||
public:
|
||||
AddIncludeForUndefinedIdentifierOp(const CppQuickFixInterface &interface, int priority,
|
||||
const QString &include);
|
||||
void perform();
|
||||
void perform() override;
|
||||
|
||||
private:
|
||||
QString m_include;
|
||||
@@ -383,7 +383,7 @@ public:
|
||||
class ExtractFunction : public CppQuickFixFactory
|
||||
{
|
||||
public:
|
||||
typedef std::function<QString ()> FunctionNameGetter;
|
||||
using FunctionNameGetter = std::function<QString()>;
|
||||
|
||||
ExtractFunction(FunctionNameGetter functionNameGetter = FunctionNameGetter());
|
||||
void match(const CppQuickFixInterface &interface, TextEditor::QuickFixOperations &result) override;
|
||||
|
@@ -59,7 +59,7 @@ enum ItemRole {
|
||||
|
||||
QStandardItem *itemForClass(const CppClass &cppClass)
|
||||
{
|
||||
QStandardItem *item = new QStandardItem;
|
||||
auto item = new QStandardItem;
|
||||
item->setFlags(item->flags() | Qt::ItemIsDragEnabled);
|
||||
item->setData(cppClass.name, Qt::DisplayRole);
|
||||
if (cppClass.name != cppClass.qualifiedName)
|
||||
@@ -88,8 +88,7 @@ namespace CppEditor {
|
||||
namespace Internal {
|
||||
|
||||
// CppTypeHierarchyWidget
|
||||
CppTypeHierarchyWidget::CppTypeHierarchyWidget() :
|
||||
QWidget(0)
|
||||
CppTypeHierarchyWidget::CppTypeHierarchyWidget()
|
||||
{
|
||||
m_inspectedClass = new TextEditor::TextEditorLinkLabel(this);
|
||||
m_inspectedClass->setMargin(5);
|
||||
@@ -114,7 +113,7 @@ CppTypeHierarchyWidget::CppTypeHierarchyWidget() :
|
||||
m_noTypeHierarchyAvailableLabel->setBackgroundRole(QPalette::Base);
|
||||
|
||||
m_hierarchyWidget = new QWidget(this);
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
auto layout = new QVBoxLayout;
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
layout->addWidget(m_inspectedClass);
|
||||
@@ -130,18 +129,17 @@ CppTypeHierarchyWidget::CppTypeHierarchyWidget() :
|
||||
connect(CppEditorPlugin::instance(), &CppEditorPlugin::typeHierarchyRequested, this, &CppTypeHierarchyWidget::perform);
|
||||
}
|
||||
|
||||
CppTypeHierarchyWidget::~CppTypeHierarchyWidget()
|
||||
{}
|
||||
CppTypeHierarchyWidget::~CppTypeHierarchyWidget() = default;
|
||||
|
||||
void CppTypeHierarchyWidget::perform()
|
||||
{
|
||||
showNoTypeHierarchyLabel();
|
||||
|
||||
CppEditor *editor = qobject_cast<CppEditor *>(Core::EditorManager::currentEditor());
|
||||
auto editor = qobject_cast<CppEditor *>(Core::EditorManager::currentEditor());
|
||||
if (!editor)
|
||||
return;
|
||||
|
||||
CppEditorWidget *widget = qobject_cast<CppEditorWidget *>(editor->widget());
|
||||
auto widget = qobject_cast<CppEditorWidget *>(editor->widget());
|
||||
if (!widget)
|
||||
return;
|
||||
|
||||
|
@@ -61,9 +61,9 @@ class CppTypeHierarchyModel : public QStandardItemModel
|
||||
public:
|
||||
CppTypeHierarchyModel(QObject *parent);
|
||||
|
||||
Qt::DropActions supportedDragActions() const;
|
||||
QStringList mimeTypes() const;
|
||||
QMimeData *mimeData(const QModelIndexList &indexes) const;
|
||||
Qt::DropActions supportedDragActions() const override;
|
||||
QStringList mimeTypes() const override;
|
||||
QMimeData *mimeData(const QModelIndexList &indexes) const override;
|
||||
};
|
||||
|
||||
class CppTypeHierarchyWidget : public QWidget
|
||||
@@ -71,7 +71,7 @@ class CppTypeHierarchyWidget : public QWidget
|
||||
Q_OBJECT
|
||||
public:
|
||||
CppTypeHierarchyWidget();
|
||||
virtual ~CppTypeHierarchyWidget();
|
||||
~CppTypeHierarchyWidget() override;
|
||||
|
||||
void perform();
|
||||
|
||||
|
@@ -44,7 +44,7 @@ class CppUseSelectionsUpdater : public QObject
|
||||
|
||||
public:
|
||||
explicit CppUseSelectionsUpdater(TextEditor::TextEditorWidget *editorWidget);
|
||||
~CppUseSelectionsUpdater();
|
||||
~CppUseSelectionsUpdater() override;
|
||||
|
||||
void scheduleUpdate();
|
||||
void abortSchedule();
|
||||
|
@@ -204,8 +204,7 @@ QString ResourcePreviewHoverHandler::makeTooltip() const
|
||||
ret += QString("<img src=\"file:///%1\" /><br/>").arg(m_resPath);
|
||||
|
||||
ret += QString("<a href=\"file:///%1\">%2</a>")
|
||||
.arg(m_resPath)
|
||||
.arg(QDir::toNativeSeparators(m_resPath));
|
||||
.arg(m_resPath, QDir::toNativeSeparators(m_resPath));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -50,7 +50,7 @@ namespace {
|
||||
|
||||
CursorInfo::Range toRange(const SemanticInfo::Use &use)
|
||||
{
|
||||
return CursorInfo::Range(use.line, use.column, use.length);
|
||||
return {use.line, use.column, use.length};
|
||||
}
|
||||
|
||||
CursorInfo::Range toRange(int tokenIndex, TranslationUnit *translationUnit)
|
||||
@@ -60,10 +60,9 @@ CursorInfo::Range toRange(int tokenIndex, TranslationUnit *translationUnit)
|
||||
if (column)
|
||||
--column; // adjust the column position.
|
||||
|
||||
return CursorInfo::Range(
|
||||
line,
|
||||
return {line,
|
||||
column + 1,
|
||||
translationUnit->tokenAt(static_cast<unsigned>(tokenIndex)).utf16chars());
|
||||
translationUnit->tokenAt(static_cast<unsigned>(tokenIndex)).utf16chars()};
|
||||
}
|
||||
|
||||
CursorInfo::Range toRange(const QTextCursor &textCursor,
|
||||
@@ -74,10 +73,9 @@ CursorInfo::Range toRange(const QTextCursor &textCursor,
|
||||
cursor.setPosition(static_cast<int>(utf16offset));
|
||||
const QTextBlock textBlock = cursor.block();
|
||||
|
||||
return CursorInfo::Range(
|
||||
static_cast<unsigned>(textBlock.blockNumber() + 1),
|
||||
return {static_cast<unsigned>(textBlock.blockNumber() + 1),
|
||||
static_cast<unsigned>(cursor.position() - textBlock.position() + 1),
|
||||
length);
|
||||
length};
|
||||
}
|
||||
|
||||
CursorInfo::Ranges toRanges(const SemanticUses &uses)
|
||||
@@ -216,8 +214,8 @@ private:
|
||||
|
||||
bool good = false;
|
||||
foreach (const CppTools::SemanticInfo::Use &use, uses) {
|
||||
unsigned l = static_cast<unsigned>(m_line);
|
||||
unsigned c = static_cast<unsigned>(m_column);
|
||||
const auto l = static_cast<unsigned>(m_line);
|
||||
const auto c = static_cast<unsigned>(m_column);
|
||||
if (l == use.line && c >= use.column && c <= (use.column + use.length)) {
|
||||
good = true;
|
||||
break;
|
||||
|
@@ -51,6 +51,8 @@
|
||||
#include <QStringListModel>
|
||||
#include <QUuid>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
using namespace Constants;
|
||||
@@ -383,7 +385,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
QVariant data(const QModelIndex &fullIndex, int role = Qt::DisplayRole) const override final
|
||||
QVariant data(const QModelIndex &fullIndex, int role = Qt::DisplayRole) const final
|
||||
{
|
||||
if (!fullIndex.isValid() || role == Qt::DecorationRole)
|
||||
return QVariant();
|
||||
@@ -447,7 +449,7 @@ private:
|
||||
|
||||
QModelIndex indexForTree(const ClazyChecksTree *tree) const {
|
||||
if (!tree)
|
||||
return QModelIndex();
|
||||
return {};
|
||||
|
||||
QModelIndex result;
|
||||
traverse(index(0, 0, QModelIndex()), [&](const QModelIndex &index){
|
||||
@@ -989,11 +991,11 @@ static void setupTreeView(QTreeView *view, QAbstractItemModel *model, int expand
|
||||
|
||||
void ClangDiagnosticConfigsWidget::setupTabs()
|
||||
{
|
||||
m_clangBaseChecks.reset(new CppTools::Ui::ClangBaseChecks);
|
||||
m_clangBaseChecks = std::make_unique<CppTools::Ui::ClangBaseChecks>();
|
||||
m_clangBaseChecksWidget = new QWidget();
|
||||
m_clangBaseChecks->setupUi(m_clangBaseChecksWidget);
|
||||
|
||||
m_clazyChecks.reset(new CppTools::Ui::ClazyChecks);
|
||||
m_clazyChecks = std::make_unique<CppTools::Ui::ClazyChecks>();
|
||||
m_clazyChecksWidget = new QWidget();
|
||||
m_clazyChecks->setupUi(m_clazyChecksWidget);
|
||||
m_clazySortFilterProxyModel = new ClazyChecksSortFilterModel(this);
|
||||
@@ -1030,7 +1032,7 @@ void ClangDiagnosticConfigsWidget::setupTabs()
|
||||
= codeModelSettings()->enableLowerClazyLevels() ? Qt::Checked : Qt::Unchecked;
|
||||
m_clazyChecks->enableLowerLevelsCheckBox->setCheckState(checkEnableLowerClazyLevels);
|
||||
|
||||
m_tidyChecks.reset(new CppTools::Ui::TidyChecks);
|
||||
m_tidyChecks = std::make_unique<CppTools::Ui::TidyChecks>();
|
||||
m_tidyChecksWidget = new QWidget();
|
||||
m_tidyChecks->setupUi(m_tidyChecksWidget);
|
||||
setupTreeView(m_tidyChecks->checksPrefixesTree, m_tidyTreeModel.get());
|
||||
|
@@ -666,7 +666,7 @@ CodeFormatter::State CodeFormatter::state(int belowTop) const
|
||||
if (belowTop < m_currentState.size())
|
||||
return m_currentState.at(m_currentState.size() - 1 - belowTop);
|
||||
else
|
||||
return State();
|
||||
return {};
|
||||
}
|
||||
|
||||
int CodeFormatter::tokenIndex() const
|
||||
|
@@ -36,7 +36,7 @@
|
||||
using namespace CppTools;
|
||||
|
||||
static Core::Id initialClangDiagnosticConfigId()
|
||||
{ return Core::Id(Constants::CPP_CLANG_BUILTIN_CONFIG_ID_EVERYTHING_WITH_EXCEPTIONS); }
|
||||
{ return {Constants::CPP_CLANG_BUILTIN_CONFIG_ID_EVERYTHING_WITH_EXCEPTIONS}; }
|
||||
|
||||
static CppCodeModelSettings::PCHUsage initialPchUsage()
|
||||
{ return CppCodeModelSettings::PchUse_BuildSystem; }
|
||||
@@ -90,7 +90,7 @@ static QString convertToNewClazyChecksFormat(const QString &checks)
|
||||
|
||||
if (checks.size() == 6 && checks.startsWith("level")) {
|
||||
bool ok = false;
|
||||
const int level = checks.mid(5).toInt(&ok);
|
||||
const int level = checks.midRef(5).toInt(&ok);
|
||||
QTC_ASSERT(ok, return QString());
|
||||
return clazyChecksForLevel(level);
|
||||
}
|
||||
|
@@ -76,7 +76,7 @@ CppCodeStyleSettings CppCodeStylePreferences::currentCodeStyleSettings() const
|
||||
QVariant v = currentValue();
|
||||
if (!v.canConvert<CppCodeStyleSettings>()) {
|
||||
// warning
|
||||
return CppCodeStyleSettings();
|
||||
return {};
|
||||
}
|
||||
return v.value<CppCodeStyleSettings>();
|
||||
}
|
||||
|
@@ -67,30 +67,7 @@ using namespace CppTools;
|
||||
|
||||
// ------------------ CppCodeStyleSettingsWidget
|
||||
|
||||
CppCodeStyleSettings::CppCodeStyleSettings() :
|
||||
indentBlockBraces(false)
|
||||
, indentBlockBody(true)
|
||||
, indentClassBraces(false)
|
||||
, indentEnumBraces(false)
|
||||
, indentNamespaceBraces(false)
|
||||
, indentNamespaceBody(false)
|
||||
, indentAccessSpecifiers(false)
|
||||
, indentDeclarationsRelativeToAccessSpecifiers(true)
|
||||
, indentFunctionBody(true)
|
||||
, indentFunctionBraces(false)
|
||||
, indentSwitchLabels(false)
|
||||
, indentStatementsRelativeToSwitchLabels(true)
|
||||
, indentBlocksRelativeToSwitchLabels(false)
|
||||
, indentControlFlowRelativeToSwitchLabels(true)
|
||||
, bindStarToIdentifier(true)
|
||||
, bindStarToTypeName(false)
|
||||
, bindStarToLeftSpecifier(false)
|
||||
, bindStarToRightSpecifier(false)
|
||||
, extraPaddingForConditionsIfConfusingAlign(true)
|
||||
, alignAssignments(false)
|
||||
, preferGetterNameWithoutGetPrefix(true)
|
||||
{
|
||||
}
|
||||
CppCodeStyleSettings::CppCodeStyleSettings() = default;
|
||||
|
||||
void CppCodeStyleSettings::toSettings(const QString &category, QSettings *s) const
|
||||
{
|
||||
@@ -203,21 +180,20 @@ bool CppCodeStyleSettings::equals(const CppCodeStyleSettings &rhs) const
|
||||
Utils::optional<CppCodeStyleSettings> CppCodeStyleSettings::currentProjectCodeStyle()
|
||||
{
|
||||
ProjectExplorer::Project *project = ProjectExplorer::ProjectTree::currentProject();
|
||||
using OptSettings = Utils::optional<CppCodeStyleSettings>;
|
||||
if (!project)
|
||||
return OptSettings();
|
||||
return {};
|
||||
|
||||
ProjectExplorer::EditorConfiguration *editorConfiguration = project->editorConfiguration();
|
||||
QTC_ASSERT(editorConfiguration, return OptSettings());
|
||||
QTC_ASSERT(editorConfiguration, return {});
|
||||
|
||||
TextEditor::ICodeStylePreferences *codeStylePreferences
|
||||
= editorConfiguration->codeStyle(Constants::CPP_SETTINGS_ID);
|
||||
QTC_ASSERT(codeStylePreferences, return OptSettings());
|
||||
QTC_ASSERT(codeStylePreferences, return {});
|
||||
|
||||
auto cppCodeStylePreferences =
|
||||
dynamic_cast<const CppCodeStylePreferences *>(codeStylePreferences);
|
||||
if (!cppCodeStylePreferences)
|
||||
return OptSettings();
|
||||
return {};
|
||||
|
||||
return cppCodeStylePreferences->currentCodeStyleSettings();
|
||||
}
|
||||
|
@@ -45,26 +45,26 @@ class CPPTOOLS_EXPORT CppCodeStyleSettings
|
||||
public:
|
||||
CppCodeStyleSettings();
|
||||
|
||||
bool indentBlockBraces;
|
||||
bool indentBlockBody;
|
||||
bool indentClassBraces;
|
||||
bool indentEnumBraces;
|
||||
bool indentNamespaceBraces;
|
||||
bool indentNamespaceBody;
|
||||
bool indentAccessSpecifiers;
|
||||
bool indentDeclarationsRelativeToAccessSpecifiers;
|
||||
bool indentFunctionBody;
|
||||
bool indentFunctionBraces;
|
||||
bool indentSwitchLabels;
|
||||
bool indentStatementsRelativeToSwitchLabels;
|
||||
bool indentBlocksRelativeToSwitchLabels;
|
||||
bool indentControlFlowRelativeToSwitchLabels;
|
||||
bool indentBlockBraces = false;
|
||||
bool indentBlockBody = true;
|
||||
bool indentClassBraces = false;
|
||||
bool indentEnumBraces = false;
|
||||
bool indentNamespaceBraces = false;
|
||||
bool indentNamespaceBody = false;
|
||||
bool indentAccessSpecifiers = false;
|
||||
bool indentDeclarationsRelativeToAccessSpecifiers = true;
|
||||
bool indentFunctionBody = true;
|
||||
bool indentFunctionBraces = false;
|
||||
bool indentSwitchLabels = false;
|
||||
bool indentStatementsRelativeToSwitchLabels = true;
|
||||
bool indentBlocksRelativeToSwitchLabels = false;
|
||||
bool indentControlFlowRelativeToSwitchLabels = true;
|
||||
|
||||
// Formatting of pointer and reference declarations, see Overview::StarBindFlag.
|
||||
bool bindStarToIdentifier;
|
||||
bool bindStarToTypeName;
|
||||
bool bindStarToLeftSpecifier;
|
||||
bool bindStarToRightSpecifier;
|
||||
bool bindStarToIdentifier = true;
|
||||
bool bindStarToTypeName = false;
|
||||
bool bindStarToLeftSpecifier = false;
|
||||
bool bindStarToRightSpecifier = false;
|
||||
|
||||
// false: if (a &&
|
||||
// b)
|
||||
@@ -75,15 +75,15 @@ public:
|
||||
// but always: while (a &&
|
||||
// b)
|
||||
// foo;
|
||||
bool extraPaddingForConditionsIfConfusingAlign;
|
||||
bool extraPaddingForConditionsIfConfusingAlign = true;
|
||||
|
||||
// false: a = a +
|
||||
// b;
|
||||
// true: a = a +
|
||||
// b
|
||||
bool alignAssignments;
|
||||
bool alignAssignments = false;
|
||||
|
||||
bool preferGetterNameWithoutGetPrefix;
|
||||
bool preferGetterNameWithoutGetPrefix = true;
|
||||
|
||||
void toSettings(const QString &category, QSettings *s) const;
|
||||
void fromSettings(const QString &category, const QSettings *s);
|
||||
|
@@ -1737,9 +1737,8 @@ void InternalCppCompletionAssistProcessor::addClassMembersToCompletion(Scope *sc
|
||||
else
|
||||
addCompletionItem(member);
|
||||
}
|
||||
std::set<Class *>::const_iterator citEnd = nestedAnonymouses.end();
|
||||
for (std::set<Class *>::const_iterator cit = nestedAnonymouses.begin(); cit != citEnd; ++cit)
|
||||
addClassMembersToCompletion(*cit, staticLookup);
|
||||
for (Class *klass : nestedAnonymouses)
|
||||
addClassMembersToCompletion(klass, staticLookup);
|
||||
}
|
||||
|
||||
bool InternalCppCompletionAssistProcessor::completeQtMethod(const QList<LookupItem> &results,
|
||||
|
@@ -47,7 +47,7 @@ ProjectFileCategorizer::ProjectFileCategorizer(const QString &projectPartName,
|
||||
QString ProjectFileCategorizer::partName(const QString &languageName) const
|
||||
{
|
||||
if (hasMultipleParts())
|
||||
return QString::fromLatin1("%1 (%2)").arg(m_partName).arg(languageName);
|
||||
return QString::fromLatin1("%1 (%2)").arg(m_partName, languageName);
|
||||
|
||||
return m_partName;
|
||||
}
|
||||
|
@@ -179,7 +179,7 @@ CppCodeStyleSettings CppQtStyleIndenter::codeStyleSettings() const
|
||||
{
|
||||
if (m_cppCodeStylePreferences)
|
||||
return m_cppCodeStylePreferences->currentCodeStyleSettings();
|
||||
return CppCodeStyleSettings();
|
||||
return {};
|
||||
}
|
||||
|
||||
TextEditor::IndentationForBlock CppQtStyleIndenter::indentationForBlocks(
|
||||
|
@@ -198,12 +198,12 @@ Utils::ChangeSet::Range CppRefactoringFile::range(unsigned tokenIndex) const
|
||||
unsigned line, column;
|
||||
cppDocument()->translationUnit()->getPosition(token.utf16charsBegin(), &line, &column);
|
||||
const int start = document()->findBlockByNumber(line - 1).position() + column - 1;
|
||||
return Utils::ChangeSet::Range(start, start + token.utf16chars());
|
||||
return {start, static_cast<int>(start + token.utf16chars())};
|
||||
}
|
||||
|
||||
Utils::ChangeSet::Range CppRefactoringFile::range(AST *ast) const
|
||||
{
|
||||
return Utils::ChangeSet::Range(startOf(ast), endOf(ast));
|
||||
return {startOf(ast), endOf(ast)};
|
||||
}
|
||||
|
||||
int CppRefactoringFile::startOf(unsigned index) const
|
||||
|
@@ -560,7 +560,6 @@ void CppSelectionChanger::fineTuneASTNodePositions(ASTNodePositions &positions)
|
||||
qDebug() << "Is raw literal.";
|
||||
|
||||
// Start from positions that include quotes.
|
||||
int newPosStart = positions.astPosStart;
|
||||
int newPosEnd = positions.astPosEnd;
|
||||
|
||||
// Decrement last position to skip last quote.
|
||||
@@ -572,7 +571,7 @@ void CppSelectionChanger::fineTuneASTNodePositions(ASTNodePositions &positions)
|
||||
|
||||
// Start position will be the end position minus the size of the actual contents of the
|
||||
// literal.
|
||||
newPosStart = newPosEnd - static_cast<int>(firstToken.string->size());
|
||||
int newPosStart = newPosEnd - static_cast<int>(firstToken.string->size());
|
||||
|
||||
// Skip raw literal parentheses.
|
||||
if (isRawLiteral)
|
||||
@@ -591,13 +590,8 @@ void CppSelectionChanger::fineTuneASTNodePositions(ASTNodePositions &positions)
|
||||
if (debug)
|
||||
qDebug() << "Selecting inner contents of char literal.";
|
||||
|
||||
int newPosStart = positions.astPosStart;
|
||||
int newPosEnd = positions.astPosEnd;
|
||||
newPosEnd = newPosEnd - 1;
|
||||
newPosStart = newPosEnd - static_cast<int>(firstToken.literal->size());
|
||||
|
||||
positions.astPosStart = newPosStart;
|
||||
positions.astPosEnd = newPosEnd;
|
||||
positions.astPosEnd = positions.astPosEnd - 1;
|
||||
positions.astPosStart = positions.astPosEnd - int(firstToken.literal->size());
|
||||
}
|
||||
}
|
||||
} else if (ForStatementAST *forStatementAST = ast->asForStatement()) {
|
||||
|
@@ -42,12 +42,7 @@
|
||||
using namespace CppTools;
|
||||
using namespace CPlusPlus;
|
||||
|
||||
DoxygenGenerator::DoxygenGenerator()
|
||||
: m_addLeadingAsterisks(true)
|
||||
, m_generateBrief(true)
|
||||
, m_startComment(true)
|
||||
, m_style(QtStyle)
|
||||
{}
|
||||
DoxygenGenerator::DoxygenGenerator() = default;
|
||||
|
||||
void DoxygenGenerator::setStyle(DocumentationStyle style)
|
||||
{
|
||||
|
@@ -85,10 +85,10 @@ private:
|
||||
void assignCommentOffset(QTextCursor cursor);
|
||||
QString offsetString() const;
|
||||
|
||||
bool m_addLeadingAsterisks;
|
||||
bool m_generateBrief;
|
||||
bool m_startComment;
|
||||
DocumentationStyle m_style;
|
||||
bool m_addLeadingAsterisks = true;
|
||||
bool m_generateBrief = true;
|
||||
bool m_startComment = true;
|
||||
DocumentationStyle m_style = QtStyle;
|
||||
CPlusPlus::Overview m_printer;
|
||||
QString m_commentOffset;
|
||||
};
|
||||
|
@@ -248,10 +248,7 @@ private:
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
||||
InsertionLocation::InsertionLocation()
|
||||
: m_line(0)
|
||||
, m_column(0)
|
||||
{}
|
||||
InsertionLocation::InsertionLocation() = default;
|
||||
|
||||
InsertionLocation::InsertionLocation(const QString &fileName,
|
||||
const QString &prefix,
|
||||
@@ -316,11 +313,9 @@ class HighestValue
|
||||
{
|
||||
Key _key;
|
||||
Value _value;
|
||||
bool _set;
|
||||
bool _set = false;
|
||||
public:
|
||||
HighestValue()
|
||||
: _key(), _set(false)
|
||||
{}
|
||||
HighestValue() = default;
|
||||
|
||||
HighestValue(const Key &initialKey, const Value &initialValue)
|
||||
: _key(initialKey)
|
||||
|
@@ -63,8 +63,8 @@ private:
|
||||
QString m_fileName;
|
||||
QString m_prefix;
|
||||
QString m_suffix;
|
||||
unsigned m_line;
|
||||
unsigned m_column;
|
||||
unsigned m_line = 0;
|
||||
unsigned m_column = 0;
|
||||
};
|
||||
|
||||
class CPPTOOLS_EXPORT InsertionPointLocator
|
||||
|
@@ -41,7 +41,7 @@ namespace CppTools {
|
||||
class SearchSymbols: protected CPlusPlus::SymbolVisitor
|
||||
{
|
||||
public:
|
||||
typedef SymbolSearcher::SymbolTypes SymbolTypes;
|
||||
using SymbolTypes = SymbolSearcher::SymbolTypes;
|
||||
|
||||
static SymbolTypes AllTypes;
|
||||
|
||||
|
@@ -248,9 +248,9 @@ QString SymbolsFindFilter::toolTip(FindFlags findFlags) const
|
||||
if (m_symbolsToSearch & SymbolSearcher::Declarations)
|
||||
types.append(tr("Declarations"));
|
||||
return tr("Scope: %1\nTypes: %2\nFlags: %3")
|
||||
.arg(searchScope() == SymbolSearcher::SearchGlobal ? tr("All") : tr("Projects"))
|
||||
.arg(types.join(tr(", ")))
|
||||
.arg(IFindFilter::descriptionForFindFlags(findFlags));
|
||||
.arg(searchScope() == SymbolSearcher::SearchGlobal ? tr("All") : tr("Projects"),
|
||||
types.join(", "),
|
||||
IFindFilter::descriptionForFindFlags(findFlags));
|
||||
}
|
||||
|
||||
// #pragma mark -- SymbolsFindFilterConfigWidget
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "perftracepointdialog.h"
|
||||
#include "ui_perftracepointdialog.h"
|
||||
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/session.h>
|
||||
@@ -46,17 +47,26 @@ PerfTracePointDialog::PerfTracePointDialog() :
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
Project *currentProject = SessionManager::startupProject();
|
||||
QTC_ASSERT(currentProject, return);
|
||||
|
||||
const Target *target = currentProject->activeTarget();
|
||||
QTC_ASSERT(target, return);
|
||||
|
||||
if (Project *currentProject = SessionManager::startupProject()) {
|
||||
if (const Target *target = currentProject->activeTarget()) {
|
||||
const Kit *kit = target->kit();
|
||||
QTC_ASSERT(kit, return);
|
||||
|
||||
m_device = DeviceKitInformation::device(kit);
|
||||
if (!m_device) {
|
||||
m_ui->textEdit->setPlainText(tr("Error: No device available for active target."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_device) {
|
||||
const DeviceManager *deviceManager = DeviceManager::instance();
|
||||
|
||||
// There should at least be a desktop device.
|
||||
m_device = deviceManager->defaultDevice(Constants::DESKTOP_DEVICE_TYPE);
|
||||
QTC_ASSERT(m_device, return);
|
||||
}
|
||||
|
||||
QFile file(":/perfprofiler/tracepoints.sh");
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
|
@@ -133,3 +133,5 @@ for(p, SUBDIRS) {
|
||||
linux-* {
|
||||
SUBDIRS += debugger/ptracepreload.pro
|
||||
}
|
||||
|
||||
QMAKE_EXTRA_TARGETS += deployqt # dummy
|
||||
|
@@ -86,7 +86,7 @@ BuildConfiguration::BuildConfiguration(Target *target, Core::Id id)
|
||||
|
||||
Utils::FileName BuildConfiguration::buildDirectory() const
|
||||
{
|
||||
const QString path = macroExpander()->expand(QDir::cleanPath(environment().expandVariables(m_buildDirectory.toString())));
|
||||
const QString path = QDir::cleanPath(macroExpander()->expand(environment().expandVariables(m_buildDirectory.toString())));
|
||||
return Utils::FileName::fromString(QDir::cleanPath(QDir(target()->project()->projectDirectory().toString()).absoluteFilePath(path)));
|
||||
}
|
||||
|
||||
|
@@ -390,8 +390,11 @@ void ToolChainKitInformation::addToMacroExpander(Kit *kit, Utils::MacroExpander
|
||||
|
||||
IOutputParser *ToolChainKitInformation::createOutputParser(const Kit *k) const
|
||||
{
|
||||
ToolChain *tc = toolChain(k, Constants::CXX_LANGUAGE_ID);
|
||||
return tc ? tc->outputParser() : nullptr;
|
||||
for (const Core::Id langId : {Constants::CXX_LANGUAGE_ID, Constants::C_LANGUAGE_ID}) {
|
||||
if (const ToolChain * const tc = toolChain(k, langId))
|
||||
return tc->outputParser();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QSet<Core::Id> ToolChainKitInformation::availableFeatures(const Kit *k) const
|
||||
|
@@ -282,7 +282,7 @@ void BaseStringAspect::update()
|
||||
}
|
||||
|
||||
if (d->m_lineEditDisplay) {
|
||||
d->m_lineEditDisplay->setText(displayedString);
|
||||
d->m_lineEditDisplay->setTextKeepingActiveCursor(displayedString);
|
||||
d->m_lineEditDisplay->setEnabled(enabled);
|
||||
}
|
||||
|
||||
|
@@ -110,6 +110,7 @@
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
#include <coreplugin/editormanager/documentmodel.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/findplaceholder.h>
|
||||
#include <coreplugin/vcsmanager.h>
|
||||
@@ -360,6 +361,7 @@ public:
|
||||
void handleRenameFile();
|
||||
void handleSetStartupProject();
|
||||
void setStartupProject(ProjectExplorer::Project *project);
|
||||
bool closeAllFilesInProject(const Project *project);
|
||||
|
||||
void updateRecentProjectMenu();
|
||||
void clearRecentProjects();
|
||||
@@ -441,6 +443,8 @@ public:
|
||||
QAction *m_openFileAction;
|
||||
QAction *m_projectTreeCollapseAllAction;
|
||||
QAction *m_projectTreeExpandAllAction;
|
||||
Utils::ParameterAction *m_closeProjectFilesActionFileMenu;
|
||||
Utils::ParameterAction *m_closeProjectFilesActionContextMenu;
|
||||
QAction *m_searchOnFileSystem;
|
||||
QAction *m_showInGraphicalShell;
|
||||
QAction *m_openTerminalHere;
|
||||
@@ -933,6 +937,15 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
cmd->setDescription(dd->m_unloadAction->text());
|
||||
mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);
|
||||
|
||||
dd->m_closeProjectFilesActionFileMenu = new Utils::ParameterAction(
|
||||
tr("Close All Files in Project"), tr("Close All Files in Project \"%1\""),
|
||||
Utils::ParameterAction::AlwaysEnabled, this);
|
||||
cmd = ActionManager::registerAction(dd->m_closeProjectFilesActionFileMenu,
|
||||
"ProjectExplorer.CloseProjectFilesFileMenu");
|
||||
cmd->setAttribute(Command::CA_UpdateText);
|
||||
cmd->setDescription(dd->m_closeProjectFilesActionFileMenu->text());
|
||||
mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);
|
||||
|
||||
ActionContainer *munload =
|
||||
ActionManager::createMenu(Constants::M_UNLOADPROJECTS);
|
||||
munload->menu()->setTitle(tr("Close Pro&ject"));
|
||||
@@ -1140,6 +1153,15 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
cmd->setDescription(dd->m_unloadActionContextMenu->text());
|
||||
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST);
|
||||
|
||||
dd->m_closeProjectFilesActionContextMenu = new Utils::ParameterAction(
|
||||
tr("Close All Files"), tr("Close All Files in Project \"%1\""),
|
||||
Utils::ParameterAction::EnabledWithParameter, this);
|
||||
cmd = ActionManager::registerAction(dd->m_closeProjectFilesActionContextMenu,
|
||||
"ProjectExplorer.CloseAllFilesInProjectContextMenu");
|
||||
cmd->setAttribute(Command::CA_UpdateText);
|
||||
cmd->setDescription(dd->m_closeProjectFilesActionContextMenu->text());
|
||||
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST);
|
||||
|
||||
// file properties action
|
||||
dd->m_filePropertiesAction = new QAction(tr("Properties..."), this);
|
||||
cmd = ActionManager::registerAction(dd->m_filePropertiesAction, Constants::FILEPROPERTIES,
|
||||
@@ -1442,6 +1464,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
dd, &ProjectExplorerPluginPrivate::handleRenameFile);
|
||||
connect(dd->m_setStartupProjectAction, &QAction::triggered,
|
||||
dd, &ProjectExplorerPluginPrivate::handleSetStartupProject);
|
||||
connect(dd->m_closeProjectFilesActionFileMenu, &QAction::triggered,
|
||||
dd, [] { dd->closeAllFilesInProject(SessionManager::projects().first()); });
|
||||
connect(dd->m_closeProjectFilesActionContextMenu, &QAction::triggered,
|
||||
dd, [] { dd->closeAllFilesInProject(ProjectTree::currentProject()); });
|
||||
connect(dd->m_projectTreeCollapseAllAction, &QAction::triggered,
|
||||
ProjectTree::instance(), &ProjectTree::collapseAll);
|
||||
connect(dd->m_projectTreeExpandAllAction, &QAction::triggered,
|
||||
@@ -1674,6 +1700,9 @@ void ProjectExplorerPlugin::unloadProject(Project *project)
|
||||
if (!DocumentManager::saveModifiedDocumentSilently(document))
|
||||
return;
|
||||
|
||||
if (!dd->closeAllFilesInProject(project))
|
||||
return;
|
||||
|
||||
dd->addToRecentProjects(document->filePath().toString(), project->displayName());
|
||||
|
||||
SessionManager::removeProject(project);
|
||||
@@ -1824,6 +1853,26 @@ void ProjectExplorerPluginPrivate::setStartupProject(Project *project)
|
||||
updateActions();
|
||||
}
|
||||
|
||||
bool ProjectExplorerPluginPrivate::closeAllFilesInProject(const Project *project)
|
||||
{
|
||||
QTC_ASSERT(project, return false);
|
||||
const Utils::FileNameList filesInProject = project->files(Project::AllFiles);
|
||||
QList<IDocument *> openFiles = DocumentModel::openedDocuments();
|
||||
Utils::erase(openFiles, [filesInProject](const IDocument *doc) {
|
||||
return !filesInProject.contains(doc->filePath());
|
||||
});
|
||||
for (const Project * const otherProject : SessionManager::projects()) {
|
||||
if (otherProject == project)
|
||||
continue;
|
||||
const Utils::FileNameList filesInOtherProject
|
||||
= otherProject->files(Project::AllFiles);
|
||||
Utils::erase(openFiles, [filesInOtherProject](const IDocument *doc) {
|
||||
return filesInOtherProject.contains(doc->filePath());
|
||||
});
|
||||
}
|
||||
return EditorManager::closeDocuments(openFiles);
|
||||
}
|
||||
|
||||
void ProjectExplorerPluginPrivate::savePersistentSettings()
|
||||
{
|
||||
if (dd->m_shuttingDown)
|
||||
@@ -2332,6 +2381,8 @@ void ProjectExplorerPluginPrivate::updateActions()
|
||||
|
||||
m_unloadAction->setParameter(projectName);
|
||||
m_unloadActionContextMenu->setParameter(projectNameContextMenu);
|
||||
m_closeProjectFilesActionFileMenu->setParameter(projectName);
|
||||
m_closeProjectFilesActionContextMenu->setParameter(projectNameContextMenu);
|
||||
|
||||
// mode bar build action
|
||||
QAction * const buildAction = ActionManager::command(Constants::BUILD)->action();
|
||||
@@ -2390,6 +2441,9 @@ void ProjectExplorerPluginPrivate::updateActions()
|
||||
m_unloadAction->setVisible(SessionManager::projects().size() <= 1);
|
||||
m_unloadAction->setEnabled(SessionManager::projects().size() == 1);
|
||||
m_unloadActionContextMenu->setEnabled(SessionManager::hasProjects());
|
||||
m_closeProjectFilesActionFileMenu->setVisible(SessionManager::projects().size() <= 1);
|
||||
m_closeProjectFilesActionFileMenu->setEnabled(SessionManager::projects().size() == 1);
|
||||
m_closeProjectFilesActionContextMenu->setEnabled(SessionManager::hasProjects());
|
||||
|
||||
ActionContainer *aci =
|
||||
ActionManager::actionContainer(Constants::M_UNLOADPROJECTS);
|
||||
|
@@ -179,12 +179,6 @@ Internal::QbsProject *QbsBuildConfiguration::project() const
|
||||
return qobject_cast<Internal::QbsProject *>(BuildConfiguration::project());
|
||||
}
|
||||
|
||||
IOutputParser *QbsBuildConfiguration::createOutputParser() const
|
||||
{
|
||||
ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit(), ProjectExplorer::Constants::CXX_LANGUAGE_ID);
|
||||
return tc ? tc->outputParser() : nullptr;
|
||||
}
|
||||
|
||||
bool QbsBuildConfiguration::isEnabled() const
|
||||
{
|
||||
return !project()->isParsing() && project()->hasParseResult();
|
||||
|
@@ -57,8 +57,6 @@ public:
|
||||
|
||||
Internal::QbsProject *project() const override;
|
||||
|
||||
ProjectExplorer::IOutputParser *createOutputParser() const;
|
||||
|
||||
bool isEnabled() const override;
|
||||
QString disabledReason() const override;
|
||||
|
||||
|
@@ -152,12 +152,6 @@ static int devicePixelHeight(const QPixmap &pixmap)
|
||||
return pixmap.height() / pixmap.devicePixelRatioF();
|
||||
}
|
||||
|
||||
static QString iconPath()
|
||||
{
|
||||
return Core::ICore::resourcePath()
|
||||
+ QLatin1String("/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/images/");
|
||||
}
|
||||
|
||||
void TimelineFrameHandle::paint(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem * /*option*/,
|
||||
QWidget * /*widget*/)
|
||||
|
@@ -120,7 +120,7 @@ void TimelineMoveTool::mouseReleaseEvent(TimelineMovableAbstractItem *item,
|
||||
Q_UNUSED(event);
|
||||
|
||||
if (auto *current = currentItem()) {
|
||||
if (auto *playhead = current->asTimelineFrameHandle()) {
|
||||
if (current->asTimelineFrameHandle()) {
|
||||
double mousePos = event->pos().x();
|
||||
double start = current->mapFromFrameToScene(scene()->startFrame());
|
||||
double end = current->mapFromFrameToScene(scene()->endFrame());
|
||||
@@ -142,7 +142,7 @@ void TimelineMoveTool::mouseReleaseEvent(TimelineMovableAbstractItem *item,
|
||||
|
||||
current->commitPosition(mapToItem(current, current->rect().center()));
|
||||
|
||||
if (TimelineKeyframeItem *currentKeyframe = current->asTimelineKeyframeItem()) {
|
||||
if (current->asTimelineKeyframeItem()) {
|
||||
double frame = std::round(
|
||||
current->mapFromSceneToFrame(current->rect().center().x()));
|
||||
|
||||
|
@@ -53,7 +53,7 @@ public:
|
||||
: qmlError("(" QT_QML_URL_REGEXP // url
|
||||
":\\d+" // colon, line
|
||||
"(?::\\d+)?)" // colon, column (optional)
|
||||
"[: \t)]") // colon, space, tab or brace
|
||||
"\\b") // word boundary
|
||||
, qtError("Object::.*in (.*:\\d+)")
|
||||
, qtAssert(QT_ASSERT_REGEXP)
|
||||
, qtAssertX(QT_ASSERT_X_REGEXP)
|
||||
@@ -364,6 +364,26 @@ void QtSupportPlugin::testQtOutputFormatter_data()
|
||||
<< 0 << 19 << "file:///main.qml:20"
|
||||
<< "/main.qml" << 20 << -1;
|
||||
|
||||
QTest::newRow("File link without further text")
|
||||
<< "file:///home/user/main.cpp:157"
|
||||
<< 0 << 30 << "file:///home/user/main.cpp:157"
|
||||
<< "/home/user/main.cpp" << 157 << -1;
|
||||
|
||||
QTest::newRow("File link with text before")
|
||||
<< "Text before: file:///home/user/main.cpp:157"
|
||||
<< 13 << 43 << "file:///home/user/main.cpp:157"
|
||||
<< "/home/user/main.cpp" << 157 << -1;
|
||||
|
||||
QTest::newRow("File link with text afterwards")
|
||||
<< "file:///home/user/main.cpp:157: Text afterwards"
|
||||
<< 0 << 30 << "file:///home/user/main.cpp:157"
|
||||
<< "/home/user/main.cpp" << 157 << -1;
|
||||
|
||||
QTest::newRow("File link with text before and afterwards")
|
||||
<< "Text before file:///home/user/main.cpp:157 and text afterwards"
|
||||
<< 12 << 42 << "file:///home/user/main.cpp:157"
|
||||
<< "/home/user/main.cpp" << 157 << -1;
|
||||
|
||||
QTest::newRow("Unix file link with timestamp")
|
||||
<< "file:///home/user/main.cpp:157 2018-03-21 10:54:45.706"
|
||||
<< 0 << 30 << "file:///home/user/main.cpp:157"
|
||||
|
@@ -80,17 +80,26 @@ DocumentContentCompletionProcessor::~DocumentContentCompletionProcessor()
|
||||
m_watcher.cancel();
|
||||
}
|
||||
|
||||
static void createProposal(QFutureInterface<QStringList> &future, const QString text)
|
||||
static void createProposal(QFutureInterface<QStringList> &future, const QString &text,
|
||||
const QString &wordUnderCursor)
|
||||
{
|
||||
const QRegularExpression wordRE("([a-zA-Z_][a-zA-Z0-9_]{2,})");
|
||||
|
||||
QSet<QString> words;
|
||||
QRegularExpressionMatchIterator it = wordRE.globalMatch(text);
|
||||
int wordUnderCursorFound = 0;
|
||||
while (it.hasNext()) {
|
||||
if (future.isCanceled())
|
||||
return;
|
||||
QRegularExpressionMatch match = it.next();
|
||||
const QString &word = match.captured();
|
||||
if (word == wordUnderCursor) {
|
||||
// Only add the word under cursor if it
|
||||
// already appears elsewhere in the text
|
||||
if (++wordUnderCursorFound < 2)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!words.contains(word))
|
||||
words.insert(word);
|
||||
}
|
||||
@@ -113,16 +122,18 @@ IAssistProposal *DocumentContentCompletionProcessor::perform(const AssistInterfa
|
||||
} while (chr.isLetterOrNumber() || chr == '_');
|
||||
|
||||
++pos;
|
||||
int length = interface->position() - pos;
|
||||
|
||||
if (interface->reason() == IdleEditor) {
|
||||
QChar characterUnderCursor = interface->characterAt(interface->position());
|
||||
if (characterUnderCursor.isLetterOrNumber() || interface->position() - pos < 3)
|
||||
if (characterUnderCursor.isLetterOrNumber() || length < 3)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const QString wordUnderCursor = interface->textAt(pos, length);
|
||||
const QString text = interface->textDocument()->toPlainText();
|
||||
|
||||
m_watcher.setFuture(Utils::runAsync(&createProposal, text));
|
||||
m_watcher.setFuture(Utils::runAsync(&createProposal, text, wordUnderCursor));
|
||||
QObject::connect(&m_watcher, &QFutureWatcher<QStringList>::resultReadyAt,
|
||||
&m_watcher, [this, pos](int index){
|
||||
const TextEditor::SnippetAssistCollector snippetCollector(
|
||||
|
@@ -32,6 +32,7 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <utils/mimetypes/mimedatabase.h>
|
||||
|
||||
#include <Format>
|
||||
#include <Repository>
|
||||
@@ -99,16 +100,48 @@ Highlighter::Highlighter()
|
||||
&categoryForTextStyle);
|
||||
}
|
||||
|
||||
KSyntaxHighlighting::Definition Highlighter::definitionForMimeType(const QString &mimeType)
|
||||
Highlighter::Definition Highlighter::definitionForDocument(const TextDocument *document)
|
||||
{
|
||||
const Utils::MimeType mimeType = Utils::mimeTypeForName(document->mimeType());
|
||||
Definition definition;
|
||||
if (mimeType.isValid())
|
||||
definition = Highlighter::definitionForMimeType(mimeType.name());
|
||||
if (!definition.isValid())
|
||||
definition = Highlighter::definitionForFileName(document->filePath().fileName());
|
||||
return definition;
|
||||
}
|
||||
|
||||
Highlighter::Definition Highlighter::definitionForMimeType(const QString &mimeType)
|
||||
{
|
||||
return highlightRepository()->definitionForMimeType(mimeType);
|
||||
}
|
||||
|
||||
KSyntaxHighlighting::Definition Highlighter::definitionForFileName(const QString &fileName)
|
||||
Highlighter::Definition Highlighter::definitionForFileName(const QString &fileName)
|
||||
{
|
||||
return highlightRepository()->definitionForFileName(fileName);
|
||||
}
|
||||
|
||||
Highlighter::Definitions Highlighter::definitionsForDocument(const TextDocument *document)
|
||||
{
|
||||
const Utils::MimeType mimeType = Utils::mimeTypeForName(document->mimeType());
|
||||
Definitions definitions;
|
||||
if (mimeType.isValid())
|
||||
definitions = Highlighter::definitionsForMimeType(mimeType.name());
|
||||
if (definitions.isEmpty())
|
||||
definitions = Highlighter::definitionsForFileName(document->filePath().fileName());
|
||||
return definitions;
|
||||
}
|
||||
|
||||
Highlighter::Definitions Highlighter::definitionsForMimeType(const QString &mimeType)
|
||||
{
|
||||
return highlightRepository()->definitionsForMimeType(mimeType).toList();
|
||||
}
|
||||
|
||||
Highlighter::Definitions Highlighter::definitionsForFileName(const QString &fileName)
|
||||
{
|
||||
return highlightRepository()->definitionsForFileName(fileName).toList();
|
||||
}
|
||||
|
||||
void Highlighter::addCustomHighlighterPath(const Utils::FileName &path)
|
||||
{
|
||||
highlightRepository()->addCustomSearchPath(path.toString());
|
||||
|
@@ -34,14 +34,22 @@
|
||||
|
||||
namespace TextEditor {
|
||||
class FontSettings;
|
||||
class TextDocument;
|
||||
|
||||
class Highlighter : public SyntaxHighlighter, public KSyntaxHighlighting::AbstractHighlighter
|
||||
{
|
||||
public:
|
||||
using Definition = KSyntaxHighlighting::Definition;
|
||||
using Definitions = QList<Definition>;
|
||||
Highlighter();
|
||||
|
||||
static KSyntaxHighlighting::Definition definitionForMimeType(const QString &mimeType);
|
||||
static KSyntaxHighlighting::Definition definitionForFileName(const QString &fileName);
|
||||
static Definition definitionForDocument(const TextDocument *document);
|
||||
static Definition definitionForMimeType(const QString &mimeType);
|
||||
static Definition definitionForFileName(const QString &fileName);
|
||||
|
||||
static Definitions definitionsForDocument(const TextDocument *document);
|
||||
static Definitions definitionsForMimeType(const QString &mimeType);
|
||||
static Definitions definitionsForFileName(const QString &fileName);
|
||||
|
||||
static void addCustomHighlighterPath(const Utils::FileName &path);
|
||||
static void updateDefinitions(std::function<void()> callback = nullptr);
|
||||
|
@@ -91,11 +91,10 @@ public:
|
||||
}
|
||||
|
||||
// By default just calls indent with default settings.
|
||||
virtual Replacements format(const QTextCursor &cursor,
|
||||
const TabSettings &tabSettings,
|
||||
int cursorPositionInEditor = -1)
|
||||
virtual Replacements format(const QTextCursor &/*cursor*/,
|
||||
const TabSettings &/*tabSettings*/,
|
||||
int /*cursorPositionInEditor*/ = -1)
|
||||
{
|
||||
indent(cursor, QChar::Null, tabSettings, cursorPositionInEditor);
|
||||
return Replacements();
|
||||
}
|
||||
|
||||
|
@@ -611,6 +611,8 @@ public:
|
||||
void updateCodeFoldingVisible();
|
||||
|
||||
void reconfigure();
|
||||
void updateSyntaxInfoBar(bool showInfo);
|
||||
void configureGenericHighlighter(const KSyntaxHighlighting::Definition &definition);
|
||||
|
||||
public:
|
||||
TextEditorWidget *q;
|
||||
@@ -768,8 +770,6 @@ public:
|
||||
|
||||
QScopedPointer<ClipboardAssistProvider> m_clipboardAssistProvider;
|
||||
|
||||
bool m_isMissingSyntaxDefinition = false;
|
||||
|
||||
QScopedPointer<AutoCompleter> m_autoCompleter;
|
||||
CommentDefinition m_commentDefinition;
|
||||
|
||||
@@ -904,33 +904,6 @@ void TextEditorWidgetPrivate::showTextMarksToolTip(const QPoint &pos,
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
/*!
|
||||
* Test if syntax highlighter is available (or unneeded) for \a widget.
|
||||
* If not found, show a warning with a link to the relevant settings page.
|
||||
*/
|
||||
static void updateEditorInfoBar(TextEditorWidget *widget)
|
||||
{
|
||||
Id id(Constants::INFO_SYNTAX_DEFINITION);
|
||||
InfoBar *infoBar = widget->textDocument()->infoBar();
|
||||
if (!widget->isMissingSyntaxDefinition()) {
|
||||
infoBar->removeInfo(id);
|
||||
} else if (infoBar->canInfoBeAdded(id)) {
|
||||
InfoBarEntry info(id,
|
||||
BaseTextEditor::tr("A highlight definition was not found for this file. "
|
||||
"Would you like to update highlight definition files?"),
|
||||
InfoBarEntry::GlobalSuppressionEnabled);
|
||||
info.setCustomButtonInfo(BaseTextEditor::tr("Update Definitions"), [id, widget]() {
|
||||
widget->textDocument()->infoBar()->removeInfo(id);
|
||||
Highlighter::updateDefinitions([widget = QPointer<TextEditorWidget>(widget)]() {
|
||||
if (widget)
|
||||
widget->configureGenericHighlighter();
|
||||
});
|
||||
});
|
||||
|
||||
infoBar->addInfo(info);
|
||||
}
|
||||
}
|
||||
|
||||
QString TextEditorWidget::plainTextFromSelection(const QTextCursor &cursor) const
|
||||
{
|
||||
// Copy the selected text as plain text
|
||||
@@ -3301,6 +3274,49 @@ void TextEditorWidgetPrivate::reconfigure()
|
||||
q->configureGenericHighlighter();
|
||||
}
|
||||
|
||||
void TextEditorWidgetPrivate::updateSyntaxInfoBar(bool showInfo)
|
||||
{
|
||||
Id id(Constants::INFO_SYNTAX_DEFINITION);
|
||||
InfoBar *infoBar = m_document->infoBar();
|
||||
|
||||
if (showInfo) {
|
||||
InfoBarEntry info(id,
|
||||
BaseTextEditor::tr(
|
||||
"A highlight definition was not found for this file. "
|
||||
"Would you like to update highlight definition files?"),
|
||||
InfoBarEntry::GlobalSuppressionEnabled);
|
||||
info.setCustomButtonInfo(BaseTextEditor::tr("Update Definitions"), [&]() {
|
||||
m_document->infoBar()->removeInfo(id);
|
||||
Highlighter::updateDefinitions([widget = QPointer<TextEditorWidget>(q)]() {
|
||||
if (widget)
|
||||
widget->configureGenericHighlighter();
|
||||
});
|
||||
});
|
||||
infoBar->addInfo(info);
|
||||
} else {
|
||||
infoBar->removeInfo(id);
|
||||
}
|
||||
}
|
||||
|
||||
void TextEditorWidgetPrivate::configureGenericHighlighter(
|
||||
const KSyntaxHighlighting::Definition &definition)
|
||||
{
|
||||
auto highlighter = new Highlighter();
|
||||
m_document->setSyntaxHighlighter(highlighter);
|
||||
|
||||
if (definition.isValid()) {
|
||||
highlighter->setDefinition(definition);
|
||||
m_commentDefinition.singleLine = definition.singleLineCommentMarker();
|
||||
m_commentDefinition.multiLineStart = definition.multiLineCommentMarker().first;
|
||||
m_commentDefinition.multiLineEnd = definition.multiLineCommentMarker().second;
|
||||
q->setCodeFoldingSupported(true);
|
||||
} else {
|
||||
q->setCodeFoldingSupported(false);
|
||||
}
|
||||
|
||||
m_document->setFontSettings(TextEditorSettings::fontSettings());
|
||||
}
|
||||
|
||||
bool TextEditorWidget::codeFoldingVisible() const
|
||||
{
|
||||
return d->m_codeFoldingVisible;
|
||||
@@ -8498,36 +8514,11 @@ QString TextEditorWidget::textAt(int from, int to) const
|
||||
|
||||
void TextEditorWidget::configureGenericHighlighter()
|
||||
{
|
||||
auto highlighter = new Highlighter();
|
||||
textDocument()->setSyntaxHighlighter(highlighter);
|
||||
|
||||
setCodeFoldingSupported(false);
|
||||
|
||||
const QString type = textDocument()->mimeType();
|
||||
const MimeType mimeType = Utils::mimeTypeForName(type);
|
||||
const QString fileName = textDocument()->filePath().fileName();
|
||||
KSyntaxHighlighting::Definition definition;
|
||||
if (mimeType.isValid())
|
||||
definition = Highlighter::definitionForMimeType(mimeType.name());
|
||||
if (!definition.isValid())
|
||||
definition = Highlighter::definitionForFileName(fileName);
|
||||
|
||||
if (definition.isValid()) {
|
||||
highlighter->setDefinition(definition);
|
||||
d->m_isMissingSyntaxDefinition = false;
|
||||
d->m_commentDefinition.singleLine = definition.singleLineCommentMarker();
|
||||
d->m_commentDefinition.multiLineStart = definition.multiLineCommentMarker().first;
|
||||
d->m_commentDefinition.multiLineEnd = definition.multiLineCommentMarker().second;
|
||||
|
||||
setCodeFoldingSupported(true);
|
||||
} else {
|
||||
d->m_isMissingSyntaxDefinition =
|
||||
!TextEditorSettings::highlighterSettings().isIgnoredFilePattern(fileName);
|
||||
}
|
||||
|
||||
textDocument()->setFontSettings(TextEditorSettings::fontSettings());
|
||||
|
||||
updateEditorInfoBar(this);
|
||||
const Highlighter::Definition definition = Highlighter::definitionForDocument(textDocument());
|
||||
d->configureGenericHighlighter(definition);
|
||||
d->updateSyntaxInfoBar(!definition.isValid()
|
||||
&& !TextEditorSettings::highlighterSettings().isIgnoredFilePattern(
|
||||
textDocument()->filePath().fileName()));
|
||||
}
|
||||
|
||||
int TextEditorWidget::blockNumberForVisibleRow(int row) const
|
||||
@@ -8562,11 +8553,6 @@ HighlightScrollBarController *TextEditorWidget::highlightScrollBarController() c
|
||||
return d->m_highlightScrollBarController;
|
||||
}
|
||||
|
||||
bool TextEditorWidget::isMissingSyntaxDefinition() const
|
||||
{
|
||||
return d->m_isMissingSyntaxDefinition;
|
||||
}
|
||||
|
||||
// The remnants of PlainTextEditor.
|
||||
void TextEditorWidget::setupGenericHighlighter()
|
||||
{
|
||||
@@ -8574,8 +8560,6 @@ void TextEditorWidget::setupGenericHighlighter()
|
||||
|
||||
connect(textDocument(), &IDocument::filePathChanged,
|
||||
d, &TextEditorWidgetPrivate::reconfigure);
|
||||
|
||||
updateEditorInfoBar(this);
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -332,7 +332,6 @@ public:
|
||||
|
||||
// the blocks list must be sorted
|
||||
void setIfdefedOutBlocks(const QList<BlockRange> &blocks);
|
||||
bool isMissingSyntaxDefinition() const;
|
||||
|
||||
enum Side { Left, Right };
|
||||
QAction *insertExtraToolBarWidget(Side side, QWidget *widget);
|
||||
|
28
src/shared/shared.pro
Normal file
28
src/shared/shared.pro
Normal file
@@ -0,0 +1,28 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
QBS_DIRS = \
|
||||
qbscorelib \
|
||||
qbsqtprofilesetup \
|
||||
qbsapps \
|
||||
qbslibexec \
|
||||
qbsplugins \
|
||||
qbsstatic
|
||||
|
||||
qbscorelib.subdir = qbs/src/lib/corelib
|
||||
qbsqtprofilesetup.subdir = qbs/src/lib/qtprofilesetup
|
||||
qbsqtprofilesetup.depends = qbscorelib
|
||||
qbsapps.subdir = qbs/src/app
|
||||
qbsapps.depends = qbsqtprofilesetup
|
||||
qbslibexec.subdir = qbs/src/libexec
|
||||
qbslibexec.depends = qbscorelib
|
||||
qbsplugins.subdir = qbs/src/plugins
|
||||
qbsplugins.depends = qbscorelib
|
||||
qbsstatic.file = qbs/static.pro
|
||||
|
||||
exists(qbs/qbs.pro) {
|
||||
isEmpty(QBS_INSTALL_DIR):QBS_INSTALL_DIR = $$(QBS_INSTALL_DIR)
|
||||
isEmpty(QBS_INSTALL_DIR):SUBDIRS += $$QBS_DIRS
|
||||
}
|
||||
TR_EXCLUDE = qbs
|
||||
|
||||
QMAKE_EXTRA_TARGETS += deployqt # dummy
|
32
src/src.pro
32
src/src.pro
@@ -1,36 +1,16 @@
|
||||
include(../qtcreator.pri)
|
||||
|
||||
TEMPLATE = subdirs
|
||||
CONFIG += ordered
|
||||
|
||||
QBS_DIRS = \
|
||||
qbscorelib \
|
||||
qbsqtprofilesetup \
|
||||
qbsapps \
|
||||
qbslibexec \
|
||||
qbsplugins \
|
||||
qbsstatic
|
||||
|
||||
qbscorelib.subdir = shared/qbs/src/lib/corelib
|
||||
qbsqtprofilesetup.subdir = shared/qbs/src/lib/qtprofilesetup
|
||||
qbsqtprofilesetup.depends = qbscorelib
|
||||
qbsapps.subdir = shared/qbs/src/app
|
||||
qbsapps.depends = qbsqtprofilesetup
|
||||
qbslibexec.subdir = shared/qbs/src/libexec
|
||||
qbslibexec.depends = qbscorelib
|
||||
qbsplugins.subdir = shared/qbs/src/plugins
|
||||
qbsstatic.file = shared/qbs/static.pro
|
||||
|
||||
exists(shared/qbs/qbs.pro) {
|
||||
isEmpty(QBS_INSTALL_DIR):QBS_INSTALL_DIR = $$(QBS_INSTALL_DIR)
|
||||
isEmpty(QBS_INSTALL_DIR):SUBDIRS += $$QBS_DIRS
|
||||
}
|
||||
TR_EXCLUDE = shared/qbs
|
||||
|
||||
SUBDIRS += \
|
||||
shared \
|
||||
libs \
|
||||
app \
|
||||
plugins \
|
||||
tools \
|
||||
share/qtcreator/data.pro \
|
||||
share/3rdparty/data.pro
|
||||
|
||||
# delegate deployqt target
|
||||
deployqt.CONFIG += recursive
|
||||
deployqt.recurse = shared libs app plugins tools
|
||||
QMAKE_EXTRA_TARGETS += deployqt
|
||||
|
@@ -82,15 +82,6 @@ bool PchCreator::generatePch()
|
||||
return tool.run(action.get()) != 1;
|
||||
}
|
||||
|
||||
FilePath PchCreator::generatePchHeaderFilePath() const
|
||||
{
|
||||
std::uniform_int_distribution<std::mt19937_64::result_type> distribution;
|
||||
|
||||
return FilePathView{Utils::PathString{Utils::SmallString(m_environment.pchBuildDirectory()),
|
||||
"/",
|
||||
std::to_string(distribution(randomNumberGenator)),
|
||||
".h"}};
|
||||
}
|
||||
|
||||
FilePath PchCreator::generatePchFilePath() const
|
||||
{
|
||||
@@ -103,8 +94,7 @@ FilePath PchCreator::generatePchFilePath() const
|
||||
".pch"}};
|
||||
}
|
||||
|
||||
std::vector<std::string> PchCreator::generateClangCompilerArguments(
|
||||
const PchTask &pchTask,
|
||||
Utils::SmallStringVector PchCreator::generateClangCompilerArguments(const PchTask &pchTask,
|
||||
FilePathView sourceFilePath,
|
||||
FilePathView pchOutputPath)
|
||||
{
|
||||
@@ -121,15 +111,14 @@ void PchCreator::generatePch(PchTask &&pchTask)
|
||||
{
|
||||
long long lastModified = QDateTime::currentSecsSinceEpoch();
|
||||
auto content = generatePchIncludeFileContent(pchTask.includes);
|
||||
auto pchSourceFilePath = generatePchHeaderFilePath();
|
||||
auto pchOutputPath = generatePchFilePath();
|
||||
generateFileWithContent(pchSourceFilePath, content);
|
||||
|
||||
m_clangTool.addFile(
|
||||
pchSourceFilePath.directory(),
|
||||
pchSourceFilePath.name(),
|
||||
"",
|
||||
generateClangCompilerArguments(pchTask, pchSourceFilePath, pchOutputPath));
|
||||
FilePath headerFilePath{m_environment.pchBuildDirectory().toStdString(), "dummy.h"};
|
||||
Utils::SmallStringVector commandLine = generateClangCompilerArguments(pchTask,
|
||||
headerFilePath,
|
||||
pchOutputPath);
|
||||
|
||||
m_clangTool.addFile(std::move(headerFilePath), std::move(content), std::move(commandLine));
|
||||
|
||||
bool success = generatePch();
|
||||
|
||||
@@ -179,17 +168,4 @@ const FilePathCaching &PchCreator::filePathCache()
|
||||
return m_filePathCache;
|
||||
}
|
||||
|
||||
std::unique_ptr<QFile> PchCreator::generateFileWithContent(const Utils::SmallString &filePath,
|
||||
const Utils::SmallString &content)
|
||||
{
|
||||
std::unique_ptr<QFile> precompiledIncludeFile(new QFile(QString(filePath)));
|
||||
|
||||
precompiledIncludeFile->open(QIODevice::WriteOnly);
|
||||
|
||||
precompiledIncludeFile->write(content.data(), qint64(content.size()));
|
||||
precompiledIncludeFile->close();
|
||||
|
||||
return precompiledIncludeFile;
|
||||
}
|
||||
|
||||
} // namespace ClangBackEnd
|
||||
|
@@ -83,13 +83,10 @@ public:
|
||||
Utils::SmallString generatePchIncludeFileContent(const FilePathIds &includeIds) const;
|
||||
bool generatePch();
|
||||
|
||||
FilePath generatePchHeaderFilePath() const;
|
||||
FilePath generatePchFilePath() const;
|
||||
static std::vector<std::string> generateClangCompilerArguments(const PchTask &pchTask,
|
||||
static Utils::SmallStringVector generateClangCompilerArguments(const PchTask &pchTask,
|
||||
FilePathView includePchHeaderPath,
|
||||
FilePathView pchPath);
|
||||
static std::unique_ptr<QFile> generateFileWithContent(const Utils::SmallString &filePath,
|
||||
const Utils::SmallString &content);
|
||||
|
||||
const ClangTool &clangTool() const
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user