Merge "Merge remote-tracking branch 'origin/13.0'"

This commit is contained in:
The Qt Project
2024-03-12 08:28:18 +00:00
77 changed files with 3193 additions and 972 deletions

View File

@@ -18,7 +18,7 @@
--- ---
Language: Cpp Language: Cpp
AccessModifierOffset: -4 AccessModifierOffset: -4
AlignAfterOpenBracket: Align AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: None AlignConsecutiveAssignments: None
AlignConsecutiveDeclarations: None AlignConsecutiveDeclarations: None
AlignEscapedNewlines: DontAlign AlignEscapedNewlines: DontAlign

View File

@@ -9,7 +9,7 @@
</div> </div>
<div class="indexboxcont indexboxbar"> <div class="indexboxcont indexboxbar">
<ul> <ul>
<li><a href="creator-overview.html">IDE Overview</a></li> <li><a href="creator-overview.html">Overview</a></li>
<li><a href="creator-quick-tour.html">User Interface</a></li> <li><a href="creator-quick-tour.html">User Interface</a></li>
<li><a href="creator-configuring.html">Configuring Qt Creator</a></li> <li><a href="creator-configuring.html">Configuring Qt Creator</a></li>
<li><a href="creator-build-example-application.html">Building and Running an Example</a></li> <li><a href="creator-build-example-application.html">Building and Running an Example</a></li>
@@ -23,15 +23,7 @@
</div> </div>
<ul> <ul>
<li><a href="creator-editor-functions.html">Writing Code</a></li> <li><a href="creator-editor-functions.html">Writing Code</a></li>
<li><a href="creator-finding-overview.html">Finding</a></li>
<li><a href="creator-editor-refactoring.html">Refactoring</a></li>
<li><a href="creator-editor-quick-fixes.html">Applying Refactoring Actions</a></li>
<li><a href="creator-beautifier.html">Beautifying Source Code</a></li>
<li><a href="creator-editor-options.html">Configuring the Editor</a></li> <li><a href="creator-editor-options.html">Configuring the Editor</a></li>
<li><a href="creator-language-servers.html">Using Language Servers</a></li>
<li><a href="creator-mime-types.html">Editing MIME Types</a></li>
<li><a href="creator-modeling.html">Modeling</a></li>
<li><a href="creator-scxml.html">Editing State Charts</a></li>
</ul> </ul>
</div> </div>
<div class="sectionlist normallist"> <div class="sectionlist normallist">
@@ -41,20 +33,17 @@
<ul> <ul>
<li><a href="creator-live-preview.html">Validating with Target Hardware</a></li> <li><a href="creator-live-preview.html">Validating with Target Hardware</a></li>
<li><a href="creator-building-targets.html">Building for Multiple Platforms</a></li> <li><a href="creator-building-targets.html">Building for Multiple Platforms</a></li>
<li><a href="creator-running-targets.html">Running on Multiple Platforms</a></li>
<li><a href="creator-deployment.html">Deploying to Devices</a></li> <li><a href="creator-deployment.html">Deploying to Devices</a></li>
<li><a href="creator-connecting-mobile.html">Connecting Devices</a></li> <li><a href="creator-connecting-mobile.html">Connecting Devices</a></li>
<li><a href="creator-build-process-customizing.html">Customizing the Build Process</a></li>
</ul> </ul>
</div> </div>
<div class="sectionlist normallist"> <div class="sectionlist normallist">
<div class="heading"> <div class="heading">
<h2>Testing</h2> <h2>Debugging and Analyzing</h2>
</div> </div>
<ul> <ul>
<li><a href="creator-debugging.html">Debugging</a></li> <li><a href="creator-debugging.html">Debugging</a></li>
<li><a href="creator-analyze-mode.html">Analyzing Code</a></li> <li><a href="creator-analyze-mode.html">Analyzing Code</a></li>
<li><a href="creator-autotest.html">Running Autotests</a></li>
<li><a href="creator-squish.html">Using Squish</a></li> <li><a href="creator-squish.html">Using Squish</a></li>
</ul> </ul>
</div> </div>
@@ -65,11 +54,14 @@
<ul> <ul>
<li><a href="creator-how-tos.html#analyze">Analyze</a></li> <li><a href="creator-how-tos.html#analyze">Analyze</a></li>
<li><a href="creator-how-tos.html#build-and-run">Build and Run</a></li> <li><a href="creator-how-tos.html#build-and-run">Build and Run</a></li>
<li><a href="creator-how-tos.html#create-models-and-diagrams">Create Models and Diagrams</a></li>
<li><a href="creator-how-tos.html#debug">Debug</a></li> <li><a href="creator-how-tos.html#debug">Debug</a></li>
<li><a href="creator-how-tos.html#design-uis">Design UIs</a></li> <li><a href="creator-how-tos.html#design-uis">Design UIs</a></li>
<li><a href="creator-how-tos.html#edit-code">Edit Code</a></li> <li><a href="creator-how-tos.html#edit-code">Edit Code</a></li>
<li><a href="creator-how-tos.html#manage-kits">Manage Kits</a></li>
<li><a href="creator-how-tos.html#manage-projects">Manage Projects</a></li> <li><a href="creator-how-tos.html#manage-projects">Manage Projects</a></li>
<li><a href="creator-how-tos.html#read-documentation">Read Documentation</a></li> <li><a href="creator-how-tos.html#read-documentation">Read Documentation</a></li>
<li><a href="creator-how-tos.html#test">Test</a></li>
<li><a href="creator-how-tos.html#use-qt-creator">Use Qt Creator</a></li> <li><a href="creator-how-tos.html#use-qt-creator">Use Qt Creator</a></li>
<li><a href="creator-how-tos.html#use-the-ui">Use the UI</a></li> <li><a href="creator-how-tos.html#use-the-ui">Use the UI</a></li>
<li><a href="creator-how-tos.html">See All</a></li> <li><a href="creator-how-tos.html">See All</a></li>
@@ -81,15 +73,20 @@
</div> </div>
<ul> <ul>
<li><a href="creator-acknowledgements.html">Acknowledgements</a></li> <li><a href="creator-acknowledgements.html">Acknowledgements</a></li>
<li><a href="creator-project-other.html">Build Systems</a></li>
<li><a href="creator-cli.html">Command-Line Options</a></li> <li><a href="creator-cli.html">Command-Line Options</a></li>
<li><a href="creator-project-wizards.html">Custom Wizards</a></li> <li><a href="creator-project-wizards.html">Custom Wizards</a></li>
<li><a href="creator-faq.html">FAQ</a></li> <li><a href="creator-faq.html">FAQ</a></li>
<li><a href="creator-glossary.html">Glossary</a></li> <li><a href="creator-glossary.html">Glossary</a></li>
<li><a href="creator-keyboard-shortcuts.html">Keyboard Shortcuts</a></li> <li><a href="creator-keyboard-shortcuts.html">Keyboard Shortcuts</a></li>
<li><a href="creator-known-issues.html">Known Issues</a></li> <li><a href="creator-known-issues.html">Known Issues</a></li>
<li><a href="creator-os-supported-platforms.html">Supported Platforms</a></li>
<li><a href="technical-support.html">Technical Support</a></li> <li><a href="technical-support.html">Technical Support</a></li>
<li><a href="creator-reference.html#build-systems">Build Systems</a></li>
<li><a href="creator-reference.html#Editors">Editors</a></li>
<li><a href="creator-reference.html#platforms">Platforms</a></li>
<li><a href="creator-reference.html#preferences">Preferences</a></li>
<li><a href="creator-reference.html#ui-design">UI Design</a></li>
<li><a href="creator-version-control.html">Version Control Systems</a></li>
<li><a href="creator-reference.html#views">Views</a></li>
<li><a href="creator-reference.html">See All</a></li> <li><a href="creator-reference.html">See All</a></li>
</ul> </ul>
</div> </div>

View File

@@ -5,21 +5,22 @@
Token_Basic_Black=ff131313 Token_Basic_Black=ff131313
Token_Basic_White=fff8f8f8 Token_Basic_White=fff8f8f8
Token_Accent_Default=ff23b26a Token_Accent_Default=ff1F9B5D
Token_Accent_Muted=ff1f9b5d Token_Accent_Muted=ff228C57
Token_Accent_Subtle=ff1a8550 Token_Accent_Subtle=ff1F7A4D
Token_Background_Default=ff1f1f1f Token_Background_Default=ff1f1f1f
Token_Background_Muted=ff262626 Token_Background_Muted=ff262626
Token_Background_Subtle=ff2e2e2e Token_Background_Subtle=ff2e2e2e
Token_Foreground_Default=ff5a5a5a Token_Foreground_Default=ff474747
Token_Foreground_Muted=ff3e3e3e Token_Foreground_Muted=ff353535
Token_Foreground_Subtle=ff303030 Token_Foreground_Subtle=ff2A2A2A
Token_Text_Default=fff8f8f8 Token_Text_Default=ffF8F8F8
Token_Text_Muted=ffaeaeae Token_Text_Muted=ffAEAEAE
Token_Text_Subtle=ff595959 Token_Text_Subtle=ff595959
Token_Text_Accent=ff23B26A
Token_Stroke_Strong=ffeeeeee Token_Stroke_Strong=ffeeeeee
Token_Stroke_Muted=ff727272 Token_Stroke_Muted=ff727272

View File

@@ -10,16 +10,17 @@ Token_Accent_Muted=ff1f9b5d
Token_Accent_Subtle=ff1a8550 Token_Accent_Subtle=ff1a8550
Token_Background_Default=fffcfcfc Token_Background_Default=fffcfcfc
Token_Background_Muted=ffefefef Token_Background_Muted=ffF2F2F2
Token_Background_Subtle=ffe7e7e7 Token_Background_Subtle=ffe7e7e7
Token_Foreground_Default=ffcdcdcd Token_Foreground_Default=ffD8D8D8
Token_Foreground_Muted=ffd5d5d5 Token_Foreground_Muted=ffE3E3E3
Token_Foreground_Subtle=ffdddddd Token_Foreground_Subtle=ffEFEFEF
Token_Text_Default=ff393939 Token_Text_Default=ff393939
Token_Text_Muted=ff6a6a6a Token_Text_Muted=ff6a6a6a
Token_Text_Subtle=ffbebebe Token_Text_Subtle=ffbebebe
Token_Text_Accent=ff28C878
Token_Stroke_Strong=ff464646 Token_Stroke_Strong=ff464646
Token_Stroke_Muted=ff727272 Token_Stroke_Muted=ff727272

File diff suppressed because it is too large Load Diff

View File

@@ -507,7 +507,9 @@ void DiagramSceneModel::selectItem(QGraphicsItem *item, bool multiSelect)
{ {
if (!multiSelect) { if (!multiSelect) {
if (!item->isSelected()) { if (!item->isSelected()) {
for (QGraphicsItem *selectedItem : std::as_const(m_selectedItems)) { // We have to create a copy since "setSelected" may modify m_selectedItems
const QSet<QGraphicsItem *> copy = m_selectedItems;
for (QGraphicsItem *selectedItem : copy) {
if (selectedItem != item) if (selectedItem != item)
selectedItem->setSelected(false); selectedItem->setSelected(false);
} }

View File

@@ -239,6 +239,7 @@ public:
Token_Text_Default, Token_Text_Default,
Token_Text_Muted, Token_Text_Muted,
Token_Text_Subtle, Token_Text_Subtle,
Token_Text_Accent,
Token_Stroke_Strong, Token_Stroke_Strong,
Token_Stroke_Muted, Token_Stroke_Muted,
Token_Stroke_Subtle, Token_Stroke_Subtle,

View File

@@ -1470,8 +1470,7 @@ void AndroidConfigurations::updateAutomaticKitList()
} }
// cleanup any mess that might have existed before, by removing all Android kits that // cleanup any mess that might have existed before, by removing all Android kits that
// existed before, but weren't re-used // existed before, but weren't re-used
for (Kit *k : unhandledKits) KitManager::deregisterKits(unhandledKits);
KitManager::deregisterKit(k);
} }
Environment AndroidConfig::toolsEnvironment() const Environment AndroidConfig::toolsEnvironment() const

View File

@@ -782,7 +782,7 @@ void AndroidRunnerWorker::handleJdbSettled()
return false; return false;
}; };
const QStringList commands{"suspend", "resume", "cont", "exit"}; const QStringList commands{"ignore uncaught java.lang.Throwable", "threads", "cont", "exit"};
for (const QString &command : commands) { for (const QString &command : commands) {
if (waitForCommand()) { if (waitForCommand()) {

View File

@@ -56,6 +56,7 @@ class SummaryWidget : public QWidget
public: public:
InfoLabel *m_infoLabel = nullptr; InfoLabel *m_infoLabel = nullptr;
bool m_valid = false; bool m_valid = false;
QString m_validText;
}; };
public: public:
@@ -73,6 +74,7 @@ public:
for (auto itr = validationPoints.cbegin(); itr != validationPoints.cend(); ++itr) { for (auto itr = validationPoints.cbegin(); itr != validationPoints.cend(); ++itr) {
RowData data; RowData data;
data.m_infoLabel = new InfoLabel(itr.value()); data.m_infoLabel = new InfoLabel(itr.value());
data.m_validText = itr.value();
layout->addWidget(data.m_infoLabel); layout->addWidget(data.m_infoLabel);
m_validationData[itr.key()] = data; m_validationData[itr.key()] = data;
setPointValid(itr.key(), false); setPointValid(itr.key(), false);
@@ -81,13 +83,20 @@ public:
setContentsMargins(0, 0, 0, 0); setContentsMargins(0, 0, 0, 0);
} }
void setPointValid(int key, bool valid) template<class T>
void setPointValid(int key, const expected_str<T> &test)
{
setPointValid(key, test.has_value(), test.has_value() ? QString{} : test.error());
}
void setPointValid(int key, bool valid, const QString errorText = {})
{ {
if (!m_validationData.contains(key)) if (!m_validationData.contains(key))
return; return;
RowData &data = m_validationData[key]; RowData &data = m_validationData[key];
data.m_valid = valid; data.m_valid = valid;
data.m_infoLabel->setType(valid ? InfoLabel::Ok : InfoLabel::NotOk); data.m_infoLabel->setType(valid ? InfoLabel::Ok : InfoLabel::NotOk);
data.m_infoLabel->setText(valid || errorText.isEmpty() ? data.m_validText : errorText);
updateUi(); updateUi();
} }
@@ -598,7 +607,7 @@ void AndroidSettingsWidget::validateJdk()
androidConfig().setOpenJDKLocation(m_openJdkLocationPathChooser->filePath()); androidConfig().setOpenJDKLocation(m_openJdkLocationPathChooser->filePath());
expected_str<void> test = testJavaC(androidConfig().openJDKLocation()); expected_str<void> test = testJavaC(androidConfig().openJDKLocation());
m_androidSummary->setPointValid(JavaPathExistsAndWritableRow, test.has_value()); m_androidSummary->setPointValid(JavaPathExistsAndWritableRow, test);
updateUI(); updateUI();

View File

@@ -25,15 +25,20 @@
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
#include <QButtonGroup> #include <QButtonGroup>
#include <QClipboard>
#include <QComboBox> #include <QComboBox>
#include <QDesktopServices>
#include <QFormLayout> #include <QFormLayout>
#include <QGridLayout> #include <QGridLayout>
#include <QGuiApplication>
#include <QHeaderView> #include <QHeaderView>
#include <QLabel> #include <QLabel>
#include <QMenu>
#include <QPushButton> #include <QPushButton>
#include <QScrollArea> #include <QScrollArea>
#include <QStackedWidget> #include <QStackedWidget>
#include <QToolButton> #include <QToolButton>
#include <QUrlQuery>
#include <map> #include <map>
@@ -197,6 +202,8 @@ struct LinkWithColumns
QList<int> columns; QList<int> columns;
}; };
static bool issueListContextMenuEvent(const ItemViewEvent &ev); // impl at bottom
class IssueListItem final : public ListItem class IssueListItem final : public ListItem
{ {
public: public:
@@ -235,6 +242,10 @@ public:
if (!m_id.isEmpty()) if (!m_id.isEmpty())
fetchIssueInfo(m_id); fetchIssueInfo(m_id);
return true; return true;
} else if (role == BaseTreeView::ItemViewEventRole) {
ItemViewEvent ev = value.value<ItemViewEvent>();
if (ev.as<QContextMenuEvent>())
return issueListContextMenuEvent(ev);
} }
return ListItem::setData(column, value, role); return ListItem::setData(column, value, role);
} }
@@ -252,13 +263,14 @@ public:
explicit IssuesWidget(QWidget *parent = nullptr); explicit IssuesWidget(QWidget *parent = nullptr);
void updateUi(); void updateUi();
const std::optional<Dto::TableInfoDto> currentTableInfo() const { return m_currentTableInfo; }
IssueListSearch searchFromUi() const;
private: private:
void updateTable(); void updateTable();
void addIssues(const Dto::IssueTableDto &dto, int startRow); void addIssues(const Dto::IssueTableDto &dto, int startRow);
void onSearchParameterChanged(); void onSearchParameterChanged();
void updateBasicProjectInfo(std::optional<Dto::ProjectInfoDto> info); void updateBasicProjectInfo(const std::optional<Dto::ProjectInfoDto> &info);
void setFiltersEnabled(bool enabled); void setFiltersEnabled(bool enabled);
IssueListSearch searchFromUi() const;
void fetchTable(); void fetchTable();
void fetchIssues(const IssueListSearch &search); void fetchIssues(const IssueListSearch &search);
void onFetchRequested(int startRow, int limit); void onFetchRequested(int startRow, int limit);
@@ -363,7 +375,7 @@ IssuesWidget::IssuesWidget(QWidget *parent)
void IssuesWidget::updateUi() void IssuesWidget::updateUi()
{ {
setFiltersEnabled(false); setFiltersEnabled(false);
std::optional<Dto::ProjectInfoDto> projectInfo = Internal::projectInfo(); const std::optional<Dto::ProjectInfoDto> projectInfo = Internal::projectInfo();
updateBasicProjectInfo(projectInfo); updateBasicProjectInfo(projectInfo);
if (!projectInfo) if (!projectInfo)
@@ -523,7 +535,7 @@ void IssuesWidget::onSearchParameterChanged()
fetchIssues(search); fetchIssues(search);
} }
void IssuesWidget::updateBasicProjectInfo(std::optional<Dto::ProjectInfoDto> info) void IssuesWidget::updateBasicProjectInfo(const std::optional<Dto::ProjectInfoDto> &info)
{ {
auto cleanOld = [this] { auto cleanOld = [this] {
const QList<QAbstractButton *> originalList = m_typesButtonGroup->buttons(); const QList<QAbstractButton *> originalList = m_typesButtonGroup->buttons();
@@ -770,6 +782,61 @@ public:
} }
} }
bool handleContextMenu(const QString &issue, const ItemViewEvent &e)
{
auto issues = static_cast<IssuesWidget *>(m_outputWidget->widget(1));
std::optional<Dto::TableInfoDto> tableInfoOpt = issues ? issues->currentTableInfo()
: std::nullopt;
if (!tableInfoOpt)
return false;
const QString baseUri = tableInfoOpt->issueBaseViewUri.value_or(QString());
if (baseUri.isEmpty())
return false;
auto info = currentDashboardInfo();
if (!info)
return false;
QUrl issueBaseUrl = info->source.resolved(baseUri).resolved(issue);
QUrl dashboardUrl = info->source.resolved(baseUri);
QUrlQuery baseQuery;
IssueListSearch search = issues->searchFromUi();
baseQuery.addQueryItem("kind", search.kind);
if (!search.versionStart.isEmpty())
baseQuery.addQueryItem("start", search.versionStart);
if (!search.versionEnd.isEmpty())
baseQuery.addQueryItem("end", search.versionEnd);
issueBaseUrl.setQuery(baseQuery);
if (!search.owner.isEmpty())
baseQuery.addQueryItem("user", search.owner);
if (!search.filter_path.isEmpty())
baseQuery.addQueryItem("filter_any path", search.filter_path);
if (!search.state.isEmpty())
baseQuery.addQueryItem("state", search.state);
dashboardUrl.setQuery(baseQuery);
QMenu *menu = new QMenu;
// FIXME Tr::tr() in before QC14
auto action = new QAction("Open issue in Dashboard", menu);
menu->addAction(action);
QObject::connect(action, &QAction::triggered, menu, [issueBaseUrl] {
QDesktopServices::openUrl(issueBaseUrl);
});
action = new QAction("Open table in Dashboard", menu);
QObject::connect(action, &QAction::triggered, menu, [dashboardUrl] {
QDesktopServices::openUrl(dashboardUrl);
});
menu->addAction(action);
action = new QAction("Copy Dashboard link to clipboard", menu);
QObject::connect(action, &QAction::triggered, menu, [dashboardUrl] {
if (auto clipboard = QGuiApplication::clipboard())
clipboard->setText(dashboardUrl.toString());
});
menu->addAction(action);
QObject::connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater);
menu->popup(e.globalPos());
return true;
}
private: private:
QStackedWidget *m_outputWidget = nullptr; QStackedWidget *m_outputWidget = nullptr;
QToolButton *m_showDashboard = nullptr; QToolButton *m_showDashboard = nullptr;
@@ -790,4 +857,15 @@ void updateDashboard()
theAxivionOutputPane->updateDashboard(); theAxivionOutputPane->updateDashboard();
} }
static bool issueListContextMenuEvent(const ItemViewEvent &ev)
{
QTC_ASSERT(theAxivionOutputPane, return false);
const QModelIndexList selectedIndices = ev.selectedRows();
const QModelIndex first = selectedIndices.isEmpty() ? QModelIndex() : selectedIndices.first();
if (!first.isValid())
return false;
const QString issue = first.data().toString();
return theAxivionOutputPane->handleContextMenu(issue, ev);
}
} // Axivion::Internal } // Axivion::Internal

View File

@@ -119,13 +119,15 @@ static QString apiTokenDescription()
return "Automatically created by " + ua + " on " + user + "@" + QSysInfo::machineHostName(); return "Automatically created by " + ua + " on " + user + "@" + QSysInfo::machineHostName();
} }
static QString credentialKey() static QString escapeKey(const QString &string)
{ {
const auto escape = [](const QString &string) {
QString escaped = string; QString escaped = string;
return escaped.replace('\\', "\\\\").replace('@', "\\@"); return escaped.replace('\\', "\\\\").replace('@', "\\@");
}; }
return escape(settings().server.username) + '@' + escape(settings().server.dashboard);
static QString credentialKey()
{
return escapeKey(settings().server.username) + '@' + escapeKey(settings().server.dashboard);
} }
template <typename DtoType> template <typename DtoType>
@@ -440,24 +442,33 @@ static Group dtoRecipe(const Storage<DtoStorageType<DtoType>> &dtoStorage)
return DoneResult::Success; return DoneResult::Success;
} }
const auto getError = [&]() -> Error { QString errorString;
if (contentType == s_jsonContentType) { if (contentType == s_jsonContentType) {
try { const Utils::expected_str<Dto::ErrorDto> error
return DashboardError(reply->url(), statusCode, = Dto::ErrorDto::deserializeExpected(reply->readAll());
if (error) {
if constexpr (std::is_same_v<DtoType, Dto::DashboardInfoDto>) {
// Suppress logging error on unauthorized dashboard fetch
if (!dtoStorage->credential && error->type == "UnauthenticatedException")
return DoneResult::Error;
}
errorString = Error(DashboardError(reply->url(), statusCode,
reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString(), reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString(),
Dto::ErrorDto::deserialize(reply->readAll())); *error)).message();
} catch (const Dto::invalid_dto_exception &) { } else {
// ignore errorString = error.error();
} }
} } else if (statusCode != 0) {
if (statusCode != 0) { errorString = Error(HttpError(reply->url(), statusCode,
return HttpError(reply->url(), statusCode,
reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString(), reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString(),
QString::fromUtf8(reply->readAll())); // encoding? QString::fromUtf8(reply->readAll()))).message(); // encoding?
} else {
errorString = Error(NetworkError(reply->url(), error, reply->errorString())).message();
} }
return NetworkError(reply->url(), error, reply->errorString());
}; MessageManager::writeDisrupting(QString("Axivion: %1").arg(errorString));
MessageManager::writeDisrupting(QString("Axivion: %1").arg(getError().message()));
return DoneResult::Error; return DoneResult::Error;
}; };
@@ -1007,6 +1018,12 @@ void fetchIssueInfo(const QString &id)
dd->fetchIssueInfo(id); dd->fetchIssueInfo(id);
} }
const std::optional<DashboardInfo> currentDashboardInfo()
{
QTC_ASSERT(dd, return std::nullopt);
return dd->m_dashboardInfo;
}
} // Axivion::Internal } // Axivion::Internal
#include "axivionplugin.moc" #include "axivionplugin.moc"

View File

@@ -77,5 +77,7 @@ QIcon iconForIssue(const std::optional<Dto::IssueKind> &issueKind);
QString anyToSimpleString(const Dto::Any &any); QString anyToSimpleString(const Dto::Any &any);
void fetchIssueInfo(const QString &id); void fetchIssueInfo(const QString &id);
const std::optional<DashboardInfo> currentDashboardInfo();
} // Axivion::Internal } // Axivion::Internal

View File

@@ -5,6 +5,8 @@
#include "qdbconstants.h" #include "qdbconstants.h"
#include <perfprofiler/perfprofilerconstants.h>
#include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runcontrol.h> #include <projectexplorer/runcontrol.h>
@@ -88,13 +90,10 @@ public:
upperPort = qmlServerPort; upperPort = qmlServerPort;
} }
if (m_usePerf) { if (m_usePerf) {
Store settingsData = runControl()->settingsData("Analyzer.Perf.Settings"); const Store perfArgs = runControl()->settingsData(PerfProfiler::Constants::PerfSettingsId);
QVariant perfRecordArgs = settingsData.value("Analyzer.Perf.RecordArguments"); const QString recordArgs = perfArgs[PerfProfiler::Constants::PerfRecordArgsId].toString();
QString args = Utils::transform(perfRecordArgs.toStringList(), [](QString arg) {
return arg.replace(',', ",,");
}).join(',');
cmd.addArg("--profile-perf"); cmd.addArg("--profile-perf");
cmd.addArg(args); cmd.addArgs(recordArgs, CommandLine::Raw);
lowerPort = upperPort = perfPort; lowerPort = upperPort = perfPort;
} }
cmd.addArg("--port-range"); cmd.addArg("--port-range");

View File

@@ -405,6 +405,7 @@ ClangdClient::ClangdClient(Project *project, const Utils::FilePath &jsonDbDir, c
setSupportedLanguage(langFilter); setSupportedLanguage(langFilter);
setActivateDocumentAutomatically(true); setActivateDocumentAutomatically(true);
setCompletionAssistProvider(new ClangdCompletionAssistProvider(this)); setCompletionAssistProvider(new ClangdCompletionAssistProvider(this));
setFunctionHintAssistProvider(new ClangdFunctionHintProvider(this));
setQuickFixAssistProvider(new ClangdQuickFixProvider(this)); setQuickFixAssistProvider(new ClangdQuickFixProvider(this));
symbolSupport().setLimitRenamingToProjects(true); symbolSupport().setLimitRenamingToProjects(true);
symbolSupport().setRenameResultsEnhancer([](const SearchResultItems &symbolOccurrencesInCode) { symbolSupport().setRenameResultsEnhancer([](const SearchResultItems &symbolOccurrencesInCode) {

View File

@@ -102,13 +102,52 @@ private:
QElapsedTimer m_timer; QElapsedTimer m_timer;
}; };
class ClangdFunctionHintProposalModel : public FunctionHintProposalModel
{
public:
using FunctionHintProposalModel::FunctionHintProposalModel;
private:
int activeArgument(const QString &prefix) const override
{
const int arg = activeArgumenForPrefix(prefix);
if (arg < 0)
return -1;
m_currentArg = arg;
return arg;
}
QString text(int index) const override
{
using Parameters = QList<ParameterInformation>;
if (index < 0 || m_sigis.signatures().size() <= index)
return {};
const SignatureInformation signature = m_sigis.signatures().at(index);
QString label = signature.label();
const QList<QString> parameters = Utils::transform(signature.parameters().value_or(Parameters()),
&ParameterInformation::label);
if (parameters.size() <= m_currentArg)
return label;
const QString &parameterText = parameters.at(m_currentArg);
const int start = label.indexOf(parameterText);
const int end = start + parameterText.length();
return label.mid(0, start).toHtmlEscaped() + "<b>" + parameterText.toHtmlEscaped() + "</b>"
+ label.mid(end).toHtmlEscaped();
}
mutable int m_currentArg = 0;
};
class ClangdFunctionHintProcessor : public FunctionHintProcessor class ClangdFunctionHintProcessor : public FunctionHintProcessor
{ {
public: public:
ClangdFunctionHintProcessor(ClangdClient *client); ClangdFunctionHintProcessor(ClangdClient *client, int basePosition);
private: private:
IAssistProposal *perform() override; IAssistProposal *perform() override;
IFunctionHintProposalModel *createModel(const SignatureHelp &signatureHelp) const override;
ClangdClient * const m_client; ClangdClient * const m_client;
}; };
@@ -138,7 +177,8 @@ IAssistProcessor *ClangdCompletionAssistProvider::createProcessor(
switch (contextAnalyzer.completionAction()) { switch (contextAnalyzer.completionAction()) {
case ClangCompletionContextAnalyzer::PassThroughToLibClangAfterLeftParen: case ClangCompletionContextAnalyzer::PassThroughToLibClangAfterLeftParen:
qCDebug(clangdLogCompletion) << "creating function hint processor"; qCDebug(clangdLogCompletion) << "creating function hint processor";
return new ClangdFunctionHintProcessor(m_client); return new ClangdFunctionHintProcessor(m_client,
contextAnalyzer.positionForProposal());
case ClangCompletionContextAnalyzer::CompletePreprocessorDirective: case ClangCompletionContextAnalyzer::CompletePreprocessorDirective:
qCDebug(clangdLogCompletion) << "creating macro processor"; qCDebug(clangdLogCompletion) << "creating macro processor";
return new CustomAssistProcessor(m_client, return new CustomAssistProcessor(m_client,
@@ -606,8 +646,8 @@ QList<AssistProposalItemInterface *> ClangdCompletionAssistProcessor::generateCo
return itemGenerator(items); return itemGenerator(items);
} }
ClangdFunctionHintProcessor::ClangdFunctionHintProcessor(ClangdClient *client) ClangdFunctionHintProcessor::ClangdFunctionHintProcessor(ClangdClient *client, int basePosition)
: FunctionHintProcessor(client) : FunctionHintProcessor(client, basePosition)
, m_client(client) , m_client(client)
{} {}
@@ -621,6 +661,12 @@ IAssistProposal *ClangdFunctionHintProcessor::perform()
return FunctionHintProcessor::perform(); return FunctionHintProcessor::perform();
} }
IFunctionHintProposalModel *ClangdFunctionHintProcessor::createModel(
const SignatureHelp &signatureHelp) const
{
return new ClangdFunctionHintProposalModel(signatureHelp);
}
ClangdCompletionCapabilities::ClangdCompletionCapabilities(const JsonObject &object) ClangdCompletionCapabilities::ClangdCompletionCapabilities(const JsonObject &object)
: TextDocumentClientCapabilities::CompletionCapabilities(object) : TextDocumentClientCapabilities::CompletionCapabilities(object)
{ {
@@ -631,4 +677,18 @@ ClangdCompletionCapabilities::ClangdCompletionCapabilities(const JsonObject &obj
} }
} }
ClangdFunctionHintProvider::ClangdFunctionHintProvider(ClangdClient *client)
: FunctionHintAssistProvider(client)
, m_client(client)
{}
IAssistProcessor *ClangdFunctionHintProvider::createProcessor(
const AssistInterface *interface) const
{
ClangCompletionContextAnalyzer contextAnalyzer(interface->textDocument(),
interface->position(), false, {});
contextAnalyzer.analyze();
return new ClangdFunctionHintProcessor(m_client, contextAnalyzer.positionForProposal());
}
} // namespace ClangCodeModel::Internal } // namespace ClangCodeModel::Internal

View File

@@ -1,11 +1,10 @@
#include <languageclient/languageclientcompletionassist.h>
// Copyright (C) 2022 The Qt Company Ltd. // Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once #pragma once
#include <languageclient/languageclientcompletionassist.h> #include <languageclient/languageclientcompletionassist.h>
#include <languageclient/languageclientfunctionhint.h>
#include <languageserverprotocol/clientcapabilities.h> #include <languageserverprotocol/clientcapabilities.h>
namespace TextEditor { class IAssistProcessor; } namespace TextEditor { class IAssistProcessor; }
@@ -37,4 +36,16 @@ public:
explicit ClangdCompletionCapabilities(const JsonObject &object); explicit ClangdCompletionCapabilities(const JsonObject &object);
}; };
class ClangdFunctionHintProvider : public LanguageClient::FunctionHintAssistProvider
{
public:
ClangdFunctionHintProvider(ClangdClient *client);
private:
TextEditor::IAssistProcessor *createProcessor(
const TextEditor::AssistInterface *assistInterface) const override;
ClangdClient * const m_client;
};
} // namespace ClangCodeModel::Internal } // namespace ClangCodeModel::Internal

View File

@@ -29,6 +29,7 @@
#include <texteditor/blockrange.h> #include <texteditor/blockrange.h>
#include <texteditor/codeassist/assistproposaliteminterface.h> #include <texteditor/codeassist/assistproposaliteminterface.h>
#include <texteditor/codeassist/genericproposal.h> #include <texteditor/codeassist/genericproposal.h>
#include <texteditor/codeassist/ifunctionhintproposalmodel.h>
#include <texteditor/codeassist/textdocumentmanipulatorinterface.h> #include <texteditor/codeassist/textdocumentmanipulatorinterface.h>
#include <texteditor/semantichighlighter.h> #include <texteditor/semantichighlighter.h>
#include <texteditor/textmark.h> #include <texteditor/textmark.h>
@@ -1832,12 +1833,12 @@ void ClangdTestCompletion::testFunctionHints()
QVERIFY(proposal); QVERIFY(proposal);
QVERIFY(hasItem(proposal, "f() -> void")); QVERIFY(hasItem(proposal, "f() -> void"));
QVERIFY(hasItem(proposal, "f(int a) -> void")); QVERIFY(hasItem(proposal, "f(<b>int a</b>) -&gt; void"));
QVERIFY(hasItem(proposal, "f(const QString &s) -> void")); QVERIFY(hasItem(proposal, "f(<b>const QString &amp;s</b>) -&gt; void"));
QVERIFY(hasItem(proposal, "f(char c, int optional = 3) -> void")); QVERIFY(hasItem(proposal, "f(<b>char c</b>, int optional = 3) -&gt; void"));
QVERIFY(hasItem(proposal, "f(char c, int optional1 = 3, int optional2 = 3) -> void")); QVERIFY(hasItem(proposal, "f(<b>char c</b>, int optional1 = 3, int optional2 = 3) -&gt; void"));
QVERIFY(hasItem(proposal, "f(const TType<QString> *t) -> void")); QVERIFY(hasItem(proposal, "f(<b>const TType&lt;QString&gt; *t</b>) -&gt; void"));
QVERIFY(hasItem(proposal, "f(bool) -> TType<QString>")); QVERIFY(hasItem(proposal, "f(<b>bool</b>) -&gt; TType&lt;QString&gt;"));
} }
void ClangdTestCompletion::testFunctionHintsFiltered() void ClangdTestCompletion::testFunctionHintsFiltered()
@@ -1855,7 +1856,6 @@ void ClangdTestCompletion::testFunctionHintsFiltered()
QVERIFY(proposal); QVERIFY(proposal);
QCOMPARE(proposal->size(), 2); QCOMPARE(proposal->size(), 2);
QVERIFY(hasItem(proposal, "func(const S &amp;s, <b>int j</b>) -&gt; void")); QVERIFY(hasItem(proposal, "func(const S &amp;s, <b>int j</b>) -&gt; void"));
QEXPECT_FAIL("", "QTCREATORBUG-26346", Abort);
QVERIFY(hasItem(proposal, "func(const S &amp;s, <b>int j</b>, int k) -&gt; void")); QVERIFY(hasItem(proposal, "func(const S &amp;s, <b>int j</b>, int k) -&gt; void"));
} }
@@ -1868,7 +1868,6 @@ void ClangdTestCompletion::testFunctionHintConstructor()
QVERIFY(!hasItem(proposal, "globalVariable")); QVERIFY(!hasItem(proposal, "globalVariable"));
QVERIFY(!hasItem(proposal, " class")); QVERIFY(!hasItem(proposal, " class"));
QVERIFY(hasItem(proposal, "Foo(<b>int</b>)")); QVERIFY(hasItem(proposal, "Foo(<b>int</b>)"));
QEXPECT_FAIL("", "QTCREATORBUG-26346", Abort);
QVERIFY(hasItem(proposal, "Foo(<b>int</b>, double)")); QVERIFY(hasItem(proposal, "Foo(<b>int</b>, double)"));
} }
@@ -2066,7 +2065,8 @@ void ClangdTestCompletion::getProposal(const QString &fileName,
{ {
const TextDocument * const doc = document(fileName); const TextDocument * const doc = document(fileName);
QVERIFY(doc); QVERIFY(doc);
const int pos = doc->document()->toPlainText().indexOf(" /* COMPLETE HERE */"); const QString docContent = doc->document()->toPlainText();
const int pos = docContent.indexOf(" /* COMPLETE HERE */");
QVERIFY(pos != -1); QVERIFY(pos != -1);
if (cursorPos) if (cursorPos)
*cursorPos = pos; *cursorPos = pos;
@@ -2110,6 +2110,13 @@ void ClangdTestCompletion::getProposal(const QString &fileName,
QVERIFY(timer.isActive()); QVERIFY(timer.isActive());
QVERIFY(proposal); QVERIFY(proposal);
proposalModel = proposal->model(); proposalModel = proposal->model();
if (auto functionHintModel = proposalModel.dynamicCast<IFunctionHintProposalModel>()) {
const int proposalBasePos = proposal->basePosition();
// The language client function hint model expects that activeArgument was called before the
// text of individual hints is accessed. This is usually done by the proposal widget. But
// since we don't have a proposal widget in this test, we have to call it manually.
functionHintModel->activeArgument(docContent.mid(proposalBasePos, pos - proposalBasePos));
}
delete proposal; delete proposal;
// The "dot" test files are only used once. // The "dot" test files are only used once.

View File

@@ -277,6 +277,7 @@ void ClangFormatGlobalConfigWidget::initCustomSettingsCheckBox()
!m_useCustomSettingsCheckBox->isChecked()); !m_useCustomSettingsCheckBox->isChecked());
m_codeStyle->currentPreferences()->setIsAdditionalTabVisible( m_codeStyle->currentPreferences()->setIsAdditionalTabVisible(
m_useCustomSettingsCheckBox->isEnabled()); m_useCustomSettingsCheckBox->isEnabled());
m_codeStyle->currentPreferences()->setAdditionalTabExist(true);
ClangFormatSettings::instance().write(); ClangFormatSettings::instance().write();
emit m_codeStyle->currentPreferencesChanged(m_codeStyle->currentPreferences()); emit m_codeStyle->currentPreferencesChanged(m_codeStyle->currentPreferences());
}; };

View File

@@ -353,18 +353,25 @@ void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
if (buffer.startsWith("${") && buffer.endsWith("}")) if (buffer.startsWith("${") && buffer.endsWith("}"))
buffer = buffer.mid(2, buffer.size() - 3); buffer = buffer.mid(2, buffer.size() - 3);
if (cbs->cmakeSymbolsHash().contains(buffer)) { QString functionName;
if (funcStart > funcEnd) {
int funcStartPos = findWordStart(funcStart);
functionName = textDocument()->textAt(funcStartPos, funcStart - funcStartPos);
}
bool skipTarget = false;
if (functionName.toLower() == "add_subdirectory") {
skipTarget = cbs->projectImportedTargets().contains(buffer)
|| cbs->buildTargetTitles().contains(buffer);
}
if (!skipTarget && cbs->cmakeSymbolsHash().contains(buffer)) {
link = cbs->cmakeSymbolsHash().value(buffer); link = cbs->cmakeSymbolsHash().value(buffer);
addTextStartEndToLink(link); addTextStartEndToLink(link);
return processLinkCallback(link); return processLinkCallback(link);
} }
// Handle include(CMakeFileWithoutSuffix) and find_package(Package) // Handle include(CMakeFileWithoutSuffix) and find_package(Package)
QString functionName; if (!functionName.isEmpty()) {
if (funcStart > funcEnd) {
int funcStartPos = findWordStart(funcStart);
functionName = textDocument()->textAt(funcStartPos, funcStart - funcStartPos);
struct FunctionToHash struct FunctionToHash
{ {
QString functionName; QString functionName;

View File

@@ -250,12 +250,8 @@ void GeneralSettingsWidget::fillLanguageBox() const
void GeneralSettingsWidget::apply() void GeneralSettingsWidget::apply()
{ {
bool showRestart = generalSettings().provideSplitterCursors.volatileValue()
!= generalSettings().provideSplitterCursors.value();
generalSettings().apply(); generalSettings().apply();
generalSettings().writeSettings(); generalSettings().writeSettings();
if (showRestart)
ICore::askForRestart(Tr::tr("The cursors for resizing views will change after restart."));
int currentIndex = m_languageBox->currentIndex(); int currentIndex = m_languageBox->currentIndex();
setLanguage(m_languageBox->itemData(currentIndex, Qt::UserRole).toString()); setLanguage(m_languageBox->itemData(currentIndex, Qt::UserRole).toString());

View File

@@ -1910,8 +1910,6 @@ void ICorePrivate::registerDefaultActions()
// Full Screen Action // Full Screen Action
ActionBuilder toggleFullScreenAction(this, Constants::TOGGLE_FULLSCREEN); ActionBuilder toggleFullScreenAction(this, Constants::TOGGLE_FULLSCREEN);
toggleFullScreenAction.setText(Tr::tr("Full Screen")); toggleFullScreenAction.setText(Tr::tr("Full Screen"));
toggleFullScreenAction.setCheckable(!HostOsInfo::isMacHost());
toggleFullScreenAction.setEnabled(false); // actual implementation in WindowSupport
toggleFullScreenAction.setDefaultKeySequence(Tr::tr("Ctrl+Meta+F"), Tr::tr("Ctrl+Shift+F11")); toggleFullScreenAction.setDefaultKeySequence(Tr::tr("Ctrl+Meta+F"), Tr::tr("Ctrl+Shift+F11"));
if (HostOsInfo::isMacHost()) if (HostOsInfo::isMacHost())
toggleFullScreenAction.setCommandAttribute(Command::CA_UpdateText); toggleFullScreenAction.setCommandAttribute(Command::CA_UpdateText);

View File

@@ -8,6 +8,7 @@
#include <utils/stylehelper.h> #include <utils/stylehelper.h>
#include <utils/theme/theme.h> #include <utils/theme/theme.h>
#include <QApplication>
#include <QPaintEvent> #include <QPaintEvent>
#include <QPainter> #include <QPainter>
#include <QSplitterHandle> #include <QSplitterHandle>
@@ -15,8 +16,14 @@
namespace Core { namespace Core {
namespace Internal { namespace Internal {
static QBitmap scaledBitmap(const QBitmap &other, qreal factor)
{
QTransform trans = QTransform::fromScale(factor, factor);
return other.transformed(trans);
}
// cursor images / masks taken from qplatformcursor.cpp // cursor images / masks taken from qplatformcursor.cpp
static QCursor hsplitCursor() static QCursor hsplitCursor(qreal ratio)
{ {
static const uchar hsplit_bits[] = { static const uchar hsplit_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -42,14 +49,13 @@ static QCursor hsplitCursor()
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static QBitmap cursorImg = QBitmap::fromData({32, 32}, hsplit_bits); static QBitmap cursorImg = QBitmap::fromData({32, 32}, hsplit_bits);
static QBitmap mask = QBitmap::fromData({32, 32}, hsplitm_bits); static QBitmap mask = QBitmap::fromData({32, 32}, hsplitm_bits);
static QCursor cursor(cursorImg, mask, 15, 15); return QCursor(scaledBitmap(cursorImg, ratio), scaledBitmap(mask, ratio),
return cursor; 15 * ratio, 15 * ratio);
} }
static QCursor vsplitCursor() static QCursor vsplitCursor(qreal ratio)
{ {
static const uchar vsplit_bits[] = { static const uchar vsplit_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -77,8 +83,8 @@ static QCursor vsplitCursor()
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static QBitmap cursorImg = QBitmap::fromData({32, 32}, vsplit_bits); static QBitmap cursorImg = QBitmap::fromData({32, 32}, vsplit_bits);
static QBitmap mask = QBitmap::fromData({32, 32}, vsplitm_bits); static QBitmap mask = QBitmap::fromData({32, 32}, vsplitm_bits);
static QCursor cursor(cursorImg, mask, 15, 15); return QCursor(scaledBitmap(cursorImg, ratio), scaledBitmap(mask, ratio),
return cursor; 15 * ratio, 15 * ratio);
} }
class MiniSplitterHandle : public QSplitterHandle class MiniSplitterHandle : public QSplitterHandle
@@ -90,10 +96,9 @@ public:
{ {
setMask(QRegion(contentsRect())); setMask(QRegion(contentsRect()));
setAttribute(Qt::WA_MouseNoMask, true); setAttribute(Qt::WA_MouseNoMask, true);
if (generalSettings().provideSplitterCursors())
setCursor(orientation == Qt::Horizontal ? hsplitCursor() : vsplitCursor());
} }
protected: protected:
bool event(QEvent *event) override;
void resizeEvent(QResizeEvent *event) override; void resizeEvent(QResizeEvent *event) override;
void paintEvent(QPaintEvent *event) override; void paintEvent(QPaintEvent *event) override;
@@ -107,6 +112,19 @@ private:
using namespace Core; using namespace Core;
using namespace Core::Internal; using namespace Core::Internal;
bool MiniSplitterHandle::event(QEvent *event)
{
if (generalSettings().provideSplitterCursors()) {
if (event->type() == QEvent::HoverEnter) {
const qreal ratio = screen()->devicePixelRatio();
setCursor(orientation() == Qt::Horizontal ? hsplitCursor(ratio) : vsplitCursor(ratio));
} else if (event->type() == QEvent::HoverLeave) {
unsetCursor();
}
}
return QSplitterHandle::event(event);
}
void MiniSplitterHandle::resizeEvent(QResizeEvent *event) void MiniSplitterHandle::resizeEvent(QResizeEvent *event)
{ {
if (orientation() == Qt::Horizontal) if (orientation() == Qt::Horizontal)

View File

@@ -104,7 +104,7 @@ SystemSettings::SystemSettings()
autoSuspendMinDocumentCount.setSettingsKey("EditorManager/AutoSuspendMinDocuments"); autoSuspendMinDocumentCount.setSettingsKey("EditorManager/AutoSuspendMinDocuments");
autoSuspendMinDocumentCount.setRange(1, 500); autoSuspendMinDocumentCount.setRange(1, 500);
autoSuspendMinDocumentCount.setDefaultValue(30); autoSuspendMinDocumentCount.setDefaultValue(10);
autoSuspendMinDocumentCount.setLabelText(Tr::tr("Files to keep open:")); autoSuspendMinDocumentCount.setLabelText(Tr::tr("Files to keep open:"));
autoSuspendMinDocumentCount.setToolTip( autoSuspendMinDocumentCount.setToolTip(
Tr::tr("Minimum number of open documents that should be kept in memory. Increasing this " Tr::tr("Minimum number of open documents that should be kept in memory. Increasing this "

View File

@@ -111,13 +111,12 @@ static const TextFormat &buttonTF(Button::Role role, WidgetState state)
static const TextFormat smallListDefaultTF static const TextFormat smallListDefaultTF
{Theme::Token_Text_Default, StyleHelper::UiElement::UiElementIconStandard, {Theme::Token_Text_Default, StyleHelper::UiElement::UiElementIconStandard,
Qt::AlignLeft | Qt::AlignVCenter | Qt::TextDontClip}; Qt::AlignLeft | Qt::AlignVCenter | Qt::TextDontClip};
static const TextFormat smallListCheckedTF static const TextFormat smallListCheckedTF = smallListDefaultTF;
{smallListDefaultTF.themeColor, StyleHelper::UiElement::UiElementIconActive,
smallListDefaultTF.drawTextFlags};
static const TextFormat smallLinkDefaultTF static const TextFormat smallLinkDefaultTF
{Theme::Token_Text_Default, smallListDefaultTF.uiElement, smallListDefaultTF.drawTextFlags}; {Theme::Token_Text_Default, StyleHelper::UiElement::UiElementIconStandard,
smallListDefaultTF.drawTextFlags};
static const TextFormat smallLinkHoveredTF static const TextFormat smallLinkHoveredTF
{Theme::Token_Accent_Default, smallListCheckedTF.uiElement, {Theme::Token_Text_Accent, smallLinkDefaultTF.uiElement,
smallLinkDefaultTF.drawTextFlags}; smallLinkDefaultTF.drawTextFlags};
switch (role) { switch (role) {
@@ -134,12 +133,10 @@ static const TextFormat &buttonTF(Button::Role role, WidgetState state)
} }
Button::Button(const QString &text, Role role, QWidget *parent) Button::Button(const QString &text, Role role, QWidget *parent)
: QPushButton(text, parent) : QAbstractButton(parent)
, m_role(role) , m_role(role)
{ {
// Prevent QMacStyle::subElementRect(SE_PushButtonLayoutItem) from changing our geometry setText(text);
setFlat(true);
updateMargins(); updateMargins();
if (m_role == SmallList) if (m_role == SmallList)
setCheckable(true); setCheckable(true);
@@ -149,11 +146,16 @@ Button::Button(const QString &text, Role role, QWidget *parent)
QSize Button::minimumSizeHint() const QSize Button::minimumSizeHint() const
{ {
const TextFormat &tf = buttonTF(m_role, WidgetStateHovered); int maxTextWidth = 0;
for (WidgetState state : {WidgetStateDefault, WidgetStateChecked, WidgetStateHovered} ) {
const TextFormat &tf = buttonTF(m_role, state);
const QFontMetrics fm(tf.font()); const QFontMetrics fm(tf.font());
const QSize textS = fm.size(Qt::TextShowMnemonic, text()); const QSize textS = fm.size(Qt::TextShowMnemonic, text());
maxTextWidth = qMax(maxTextWidth, textS.width());
}
const TextFormat &tf = buttonTF(m_role, WidgetStateDefault);
const QMargins margins = contentsMargins(); const QMargins margins = contentsMargins();
return {margins.left() + textS.width() + margins.right(), return {margins.left() + maxTextWidth + margins.right(),
margins.top() + tf.lineHeight() + margins.bottom()}; margins.top() + tf.lineHeight() + margins.bottom()};
} }
@@ -751,7 +753,7 @@ bool ListModelFilter::leaveFilterAcceptsRowBeforeFiltering(const ListItem *, boo
constexpr TextFormat titleTF {Theme::Token_Text_Default, StyleHelper::UiElementIconActive}; constexpr TextFormat titleTF {Theme::Token_Text_Default, StyleHelper::UiElementIconActive};
constexpr TextFormat descriptionTF {titleTF.themeColor, StyleHelper::UiElementCaption}; constexpr TextFormat descriptionTF {titleTF.themeColor, StyleHelper::UiElementCaption};
constexpr TextFormat tagsLabelTF {Theme::Token_Text_Muted, StyleHelper::UiElementCaptionStrong}; constexpr TextFormat tagsLabelTF {Theme::Token_Text_Muted, StyleHelper::UiElementCaptionStrong};
constexpr TextFormat tagsTF {Theme::Token_Accent_Default, tagsLabelTF.uiElement}; constexpr TextFormat tagsTF {Theme::Token_Text_Accent, tagsLabelTF.uiElement};
constexpr qreal itemOutlineWidth = 1; constexpr qreal itemOutlineWidth = 1;
constexpr qreal itemCornerRounding = 6; constexpr qreal itemCornerRounding = 6;
@@ -1154,7 +1156,7 @@ static QLabel *createTitleLabel(const QString &text, QWidget *parent = nullptr)
static QLabel *createLinkLabel(const QString &text, QWidget *parent) static QLabel *createLinkLabel(const QString &text, QWidget *parent)
{ {
constexpr TextFormat headerLinkTF {Theme::Token_Accent_Default, StyleHelper::UiElementH6}; constexpr TextFormat headerLinkTF {Theme::Token_Text_Accent, StyleHelper::UiElementH6};
const QString linkColor = themeColor(headerLinkTF.themeColor).name(); const QString linkColor = themeColor(headerLinkTF.themeColor).name();
auto link = new QLabel("<a href=\"link\" style=\"color: " + linkColor + ";\">" auto link = new QLabel("<a href=\"link\" style=\"color: " + linkColor + ";\">"
+ text + "</a>", parent); + text + "</a>", parent);

View File

@@ -61,7 +61,7 @@ CORE_EXPORT void setBackgroundColor(QWidget *widget, Utils::Theme::Color colorRo
constexpr qreal defaultCardBackgroundRounding = 3.75; constexpr qreal defaultCardBackgroundRounding = 3.75;
constexpr Utils::Theme::Color cardDefaultBackground = Utils::Theme::Token_Background_Muted; constexpr Utils::Theme::Color cardDefaultBackground = Utils::Theme::Token_Background_Muted;
constexpr Utils::Theme::Color cardDefaultStroke = Utils::Theme::Token_Stroke_Subtle; constexpr Utils::Theme::Color cardDefaultStroke = Utils::Theme::Token_Stroke_Subtle;
constexpr Utils::Theme::Color cardHoverBackground = Utils::Theme::Token_Foreground_Subtle; constexpr Utils::Theme::Color cardHoverBackground = Utils::Theme::Token_Background_Subtle;
constexpr Utils::Theme::Color cardHoverStroke = cardHoverBackground; constexpr Utils::Theme::Color cardHoverStroke = cardHoverBackground;
CORE_EXPORT void drawCardBackground(QPainter *painter, const QRectF &rect, CORE_EXPORT void drawCardBackground(QPainter *painter, const QRectF &rect,
const QBrush &fill, const QPen &pen = QPen(Qt::NoPen), const QBrush &fill, const QPen &pen = QPen(Qt::NoPen),
@@ -70,7 +70,7 @@ CORE_EXPORT QWidget *createRule(Qt::Orientation orientation, QWidget *parent = n
} // namespace WelcomePageHelpers } // namespace WelcomePageHelpers
class CORE_EXPORT Button : public QPushButton class CORE_EXPORT Button : public QAbstractButton
{ {
public: public:
enum Role { enum Role {

View File

@@ -63,9 +63,12 @@ WindowSupport::WindowSupport(QWidget *window, const Context &context, const Cont
connect(m_closeAction, &QAction::triggered, m_window, &QWidget::close, Qt::QueuedConnection); connect(m_closeAction, &QAction::triggered, m_window, &QWidget::close, Qt::QueuedConnection);
} }
auto cmd = ActionManager::command(Constants::TOGGLE_FULLSCREEN); // created in registerDefaultActions()
if (QTC_GUARD(cmd))
m_toggleFullScreenAction = cmd->action();
else
m_toggleFullScreenAction = new QAction(this); m_toggleFullScreenAction = new QAction(this);
updateFullScreenAction(); updateFullScreenAction();
ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, ac);
connect(m_toggleFullScreenAction, &QAction::triggered, this, &WindowSupport::toggleFullScreen); connect(m_toggleFullScreenAction, &QAction::triggered, this, &WindowSupport::toggleFullScreen);
m_windowList->addWindow(window); m_windowList->addWindow(window);
@@ -124,15 +127,12 @@ void WindowSupport::toggleFullScreen()
void WindowSupport::updateFullScreenAction() void WindowSupport::updateFullScreenAction()
{ {
if (m_window->isFullScreen()) { if (m_window->isFullScreen()) {
if (Utils::HostOsInfo::isMacHost())
m_toggleFullScreenAction->setText(Tr::tr("Exit Full Screen")); m_toggleFullScreenAction->setText(Tr::tr("Exit Full Screen"));
else
m_toggleFullScreenAction->setChecked(true);
} else { } else {
if (Utils::HostOsInfo::isMacHost()) if (Utils::HostOsInfo::isMacHost())
m_toggleFullScreenAction->setText(Tr::tr("Enter Full Screen")); m_toggleFullScreenAction->setText(Tr::tr("Enter Full Screen"));
else else
m_toggleFullScreenAction->setChecked(false); m_toggleFullScreenAction->setText(Tr::tr("Full Screen"));
} }
} }

View File

@@ -452,9 +452,11 @@ void CppCodeStylePreferencesWidget::slotCurrentPreferencesChanged(ICodeStylePref
const bool enable = !preferences->isReadOnly() && (!preferences->isTemporarilyReadOnly() const bool enable = !preferences->isReadOnly() && (!preferences->isTemporarilyReadOnly()
|| !preferences->isAdditionalTabVisible()); || !preferences->isAdditionalTabVisible());
if (preferences->additionalTabExist()) {
d->m_categoryTab->setTabVisible(0, preferences->isAdditionalTabVisible()); d->m_categoryTab->setTabVisible(0, preferences->isAdditionalTabVisible());
for (int i = 1; i < d->m_categoryTab->count(); ++i) for (int i = 1; i < d->m_categoryTab->count(); ++i)
d->m_categoryTab->setTabVisible(i, !preferences->isAdditionalTabVisible()); d->m_categoryTab->setTabVisible(i, !preferences->isAdditionalTabVisible());
}
for (QWidget *widget : d->m_controllers) for (QWidget *widget : d->m_controllers)
widget->setEnabled(enable); widget->setEnabled(enable);

View File

@@ -372,27 +372,11 @@ QString CppFunctionHintModel::text(int index) const
int CppFunctionHintModel::activeArgument(const QString &prefix) const int CppFunctionHintModel::activeArgument(const QString &prefix) const
{ {
int argnr = 0; const int arg = activeArgumenForPrefix(prefix);
int parcount = 0; if (arg < 0)
SimpleLexer tokenize;
Tokens tokens = tokenize(prefix);
for (int i = 0; i < tokens.count(); ++i) {
const Token &tk = tokens.at(i);
if (tk.is(T_LPAREN))
++parcount;
else if (tk.is(T_RPAREN))
--parcount;
else if (!parcount && tk.is(T_COMMA))
++argnr;
}
if (parcount < 0)
return -1; return -1;
m_currentArg = arg;
if (argnr != m_currentArg) return arg;
m_currentArg = argnr;
return argnr;
} }
// --------------------------- // ---------------------------

View File

@@ -219,6 +219,28 @@ bool isValidIdentifier(const QString &s)
return true; return true;
} }
int activeArgumenForPrefix(const QString &prefix)
{
int argnr = 0;
int parcount = 0;
SimpleLexer tokenize;
Tokens tokens = tokenize(prefix);
for (int i = 0; i < tokens.count(); ++i) {
const Token &tk = tokens.at(i);
if (tk.is(T_LPAREN))
++parcount;
else if (tk.is(T_RPAREN))
--parcount;
else if (!parcount && tk.is(T_COMMA))
++argnr;
}
if (parcount < 0)
return -1;
return argnr;
}
bool isQtKeyword(QStringView text) bool isQtKeyword(QStringView text)
{ {
switch (text.length()) { switch (text.length()) {
@@ -859,5 +881,5 @@ void decorateCppEditor(TextEditor::TextEditorWidget *editor)
editor->setAutoCompleter(new CppAutoCompleter); editor->setAutoCompleter(new CppAutoCompleter);
} }
} // namespace Internal } // Internal
} // CppEditor } // CppEditor

View File

@@ -45,6 +45,8 @@ bool CPPEDITOR_EXPORT isValidFirstIdentifierChar(const QChar &ch);
bool CPPEDITOR_EXPORT isValidIdentifierChar(const QChar &ch); bool CPPEDITOR_EXPORT isValidIdentifierChar(const QChar &ch);
bool CPPEDITOR_EXPORT isValidIdentifier(const QString &s); bool CPPEDITOR_EXPORT isValidIdentifier(const QString &s);
int CPPEDITOR_EXPORT activeArgumenForPrefix(const QString &prefix);
QStringList CPPEDITOR_EXPORT identifierWordsUnderCursor(const QTextCursor &tc); QStringList CPPEDITOR_EXPORT identifierWordsUnderCursor(const QTextCursor &tc);
QString CPPEDITOR_EXPORT identifierUnderCursor(QTextCursor *cursor); QString CPPEDITOR_EXPORT identifierUnderCursor(QTextCursor *cursor);

View File

@@ -237,15 +237,6 @@ void CdbEngine::adjustOperateByInstruction(bool operateByInstruction)
runCommand({QLatin1String(m_lastOperateByInstruction ? "l-t" : "l+t"), NoFlags}); runCommand({QLatin1String(m_lastOperateByInstruction ? "l-t" : "l+t"), NoFlags});
} }
bool CdbEngine::canHandleToolTip(const DebuggerToolTipContext &context) const
{
Q_UNUSED(context)
// Tooltips matching local variables are already handled in the
// base class. We don't handle anything else here in CDB
// as it can slow debugging down.
return false;
}
// Determine full path to the CDB extension library. // Determine full path to the CDB extension library.
QString CdbEngine::extensionLibraryName(bool is64Bit, bool isArm) QString CdbEngine::extensionLibraryName(bool is64Bit, bool isArm)
{ {

View File

@@ -26,8 +26,6 @@ public:
explicit CdbEngine(); explicit CdbEngine();
~CdbEngine() override; ~CdbEngine() override;
bool canHandleToolTip(const DebuggerToolTipContext &context) const override;
void setupEngine() override; void setupEngine() override;
void runEngine(); void runEngine();
void shutdownInferior() override; void shutdownInferior() override;

View File

@@ -29,9 +29,9 @@ GdbSettings &gdbSettings()
GdbSettings::GdbSettings() GdbSettings::GdbSettings()
{ {
setAutoApply(false); setAutoApply(false);
setSettingsGroup("DebugMode"); const Key debugModeGroup("DebugMode");
useMessageBoxForSignals.setSettingsKey("UseMessageBoxForSignals"); useMessageBoxForSignals.setSettingsKey(debugModeGroup, "UseMessageBoxForSignals");
useMessageBoxForSignals.setDefaultValue(true); useMessageBoxForSignals.setDefaultValue(true);
useMessageBoxForSignals.setLabelText(Tr::tr( useMessageBoxForSignals.setLabelText(Tr::tr(
"Show a message box when receiving a signal")); "Show a message box when receiving a signal"));
@@ -49,7 +49,7 @@ GdbSettings::GdbSettings()
"breakpoint markers in such cases to the location of the true " "breakpoint markers in such cases to the location of the true "
"breakpoint.")); "breakpoint."));
adjustBreakpointLocations.setDefaultValue(true); adjustBreakpointLocations.setDefaultValue(true);
adjustBreakpointLocations.setSettingsKey("AdjustBreakpointLocations"); adjustBreakpointLocations.setSettingsKey(debugModeGroup, "AdjustBreakpointLocations");
adjustBreakpointLocations.setLabelText(Tr::tr( adjustBreakpointLocations.setLabelText(Tr::tr(
"Adjust breakpoint locations")); "Adjust breakpoint locations"));
adjustBreakpointLocations.setToolTip(Tr::tr( adjustBreakpointLocations.setToolTip(Tr::tr(
@@ -61,41 +61,41 @@ GdbSettings::GdbSettings()
breakOnThrow.setLabelText(Tr::tr("Break on \"throw\"")); breakOnThrow.setLabelText(Tr::tr("Break on \"throw\""));
breakOnThrow.setSettingsKey("BreakOnThrow"); breakOnThrow.setSettingsKey(debugModeGroup, "BreakOnThrow");
breakOnCatch.setLabelText(Tr::tr("Break on \"catch\"")); breakOnCatch.setLabelText(Tr::tr("Break on \"catch\""));
breakOnCatch.setSettingsKey("BreakOnCatch"); breakOnCatch.setSettingsKey(debugModeGroup, "BreakOnCatch");
breakOnWarning.setLabelText(Tr::tr("Break on \"qWarning\"")); breakOnWarning.setLabelText(Tr::tr("Break on \"qWarning\""));
breakOnWarning.setSettingsKey("BreakOnWarning"); breakOnWarning.setSettingsKey(debugModeGroup, "BreakOnWarning");
// FIXME: Move to common settings page. // FIXME: Move to common settings page.
breakOnWarning.setLabelText(msgSetBreakpointAtFunction("qWarning")); breakOnWarning.setLabelText(msgSetBreakpointAtFunction("qWarning"));
breakOnWarning.setToolTip(msgSetBreakpointAtFunctionToolTip("qWarning")); breakOnWarning.setToolTip(msgSetBreakpointAtFunctionToolTip("qWarning"));
breakOnFatal.setLabelText(Tr::tr("Break on \"qFatal\"")); breakOnFatal.setLabelText(Tr::tr("Break on \"qFatal\""));
breakOnFatal.setSettingsKey("BreakOnFatal"); breakOnFatal.setSettingsKey(debugModeGroup, "BreakOnFatal");
breakOnFatal.setLabelText(msgSetBreakpointAtFunction("qFatal")); breakOnFatal.setLabelText(msgSetBreakpointAtFunction("qFatal"));
breakOnFatal.setToolTip(msgSetBreakpointAtFunctionToolTip("qFatal")); breakOnFatal.setToolTip(msgSetBreakpointAtFunctionToolTip("qFatal"));
breakOnAbort.setLabelText(Tr::tr("Break on \"abort\"")); breakOnAbort.setLabelText(Tr::tr("Break on \"abort\""));
breakOnAbort.setSettingsKey("BreakOnAbort"); breakOnAbort.setSettingsKey(debugModeGroup, "BreakOnAbort");
breakOnAbort.setLabelText(msgSetBreakpointAtFunction("abort")); breakOnAbort.setLabelText(msgSetBreakpointAtFunction("abort"));
breakOnAbort.setToolTip(msgSetBreakpointAtFunctionToolTip("abort")); breakOnAbort.setToolTip(msgSetBreakpointAtFunctionToolTip("abort"));
loadGdbInit.setSettingsKey("LoadGdbInit"); loadGdbInit.setSettingsKey(debugModeGroup, "LoadGdbInit");
loadGdbInit.setDefaultValue(true); loadGdbInit.setDefaultValue(true);
loadGdbInit.setLabelText(Tr::tr("Load .gdbinit file on startup")); loadGdbInit.setLabelText(Tr::tr("Load .gdbinit file on startup"));
loadGdbInit.setToolTip(Tr::tr( loadGdbInit.setToolTip(Tr::tr(
"Allows or inhibits reading the user's default\n" "Allows or inhibits reading the user's default\n"
".gdbinit file on debugger startup.")); ".gdbinit file on debugger startup."));
loadGdbDumpers.setSettingsKey("LoadGdbDumpers2"); loadGdbDumpers.setSettingsKey(debugModeGroup, "LoadGdbDumpers2");
loadGdbDumpers.setLabelText(Tr::tr("Load system GDB pretty printers")); loadGdbDumpers.setLabelText(Tr::tr("Load system GDB pretty printers"));
loadGdbDumpers.setToolTip(Tr::tr( loadGdbDumpers.setToolTip(Tr::tr(
"Uses the default GDB pretty printers installed in your " "Uses the default GDB pretty printers installed in your "
"system or linked to the libraries your application uses.")); "system or linked to the libraries your application uses."));
autoEnrichParameters.setSettingsKey("AutoEnrichParameters"); autoEnrichParameters.setSettingsKey(debugModeGroup, "AutoEnrichParameters");
autoEnrichParameters.setDefaultValue(true); autoEnrichParameters.setDefaultValue(true);
autoEnrichParameters.setLabelText(Tr::tr( autoEnrichParameters.setLabelText(Tr::tr(
"Use common locations for debug information")); "Use common locations for debug information"));
@@ -104,7 +104,7 @@ GdbSettings::GdbSettings()
"of debug information such as <i>/usr/src/debug</i> " "of debug information such as <i>/usr/src/debug</i> "
"when starting GDB.</body></html>")); "when starting GDB.</body></html>"));
useDynamicType.setSettingsKey("UseDynamicType"); useDynamicType.setSettingsKey(debugModeGroup, "UseDynamicType");
useDynamicType.setDefaultValue(true); useDynamicType.setDefaultValue(true);
useDynamicType.setDisplayName(Tr::tr("Use Dynamic Object Type for Display")); useDynamicType.setDisplayName(Tr::tr("Use Dynamic Object Type for Display"));
useDynamicType.setLabelText(Tr::tr( useDynamicType.setLabelText(Tr::tr(
@@ -113,7 +113,7 @@ GdbSettings::GdbSettings()
"Specifies whether the dynamic or the static type of objects will be " "Specifies whether the dynamic or the static type of objects will be "
"displayed. Choosing the dynamic type might be slower.")); "displayed. Choosing the dynamic type might be slower."));
targetAsync.setSettingsKey("TargetAsync"); targetAsync.setSettingsKey(debugModeGroup, "TargetAsync");
targetAsync.setLabelText(Tr::tr( targetAsync.setLabelText(Tr::tr(
"Use asynchronous mode to control the inferior")); "Use asynchronous mode to control the inferior"));
@@ -125,7 +125,7 @@ GdbSettings::GdbSettings()
"<p>To execute arbitrary Python scripts, " "<p>To execute arbitrary Python scripts, "
"use <i>python execfile('/path/to/script.py')</i>.</p>"); "use <i>python execfile('/path/to/script.py')</i>.</p>");
gdbStartupCommands.setSettingsKey("GdbStartupCommands"); gdbStartupCommands.setSettingsKey(debugModeGroup, "GdbStartupCommands");
gdbStartupCommands.setDisplayStyle(StringAspect::TextEditDisplay); gdbStartupCommands.setDisplayStyle(StringAspect::TextEditDisplay);
gdbStartupCommands.setUseGlobalMacroExpander(); gdbStartupCommands.setUseGlobalMacroExpander();
gdbStartupCommands.setToolTip("<html><head/><body><p>" + Tr::tr( gdbStartupCommands.setToolTip("<html><head/><body><p>" + Tr::tr(
@@ -134,7 +134,7 @@ GdbSettings::GdbSettings()
"attached, and before the debugging helpers are initialized.") + "</p>" "attached, and before the debugging helpers are initialized.") + "</p>"
+ howToUsePython + "</body></html>"); + howToUsePython + "</body></html>");
gdbPostAttachCommands.setSettingsKey("GdbPostAttachCommands"); gdbPostAttachCommands.setSettingsKey(debugModeGroup, "GdbPostAttachCommands");
gdbPostAttachCommands.setDisplayStyle(StringAspect::TextEditDisplay); gdbPostAttachCommands.setDisplayStyle(StringAspect::TextEditDisplay);
gdbPostAttachCommands.setUseGlobalMacroExpander(); gdbPostAttachCommands.setUseGlobalMacroExpander();
gdbPostAttachCommands.setToolTip("<html><head/><body><p>" + Tr::tr( gdbPostAttachCommands.setToolTip("<html><head/><body><p>" + Tr::tr(
@@ -144,22 +144,22 @@ GdbSettings::GdbSettings()
"such as \"monitor reset\" or \"load\".") + "</p>" "such as \"monitor reset\" or \"load\".") + "</p>"
+ howToUsePython + "</body></html>"); + howToUsePython + "</body></html>");
multiInferior.setSettingsKey("MultiInferior"); multiInferior.setSettingsKey(debugModeGroup, "MultiInferior");
multiInferior.setLabelText(Tr::tr("Debug all child processes")); multiInferior.setLabelText(Tr::tr("Debug all child processes"));
multiInferior.setToolTip(Tr::tr( multiInferior.setToolTip(Tr::tr(
"<html><head/><body>Keeps debugging all children after a fork." "<html><head/><body>Keeps debugging all children after a fork."
"</body></html>")); "</body></html>"));
intelFlavor.setSettingsKey("IntelFlavor"); intelFlavor.setSettingsKey(debugModeGroup, "IntelFlavor");
intelFlavor.setLabelText(Tr::tr("Use Intel style disassembly")); intelFlavor.setLabelText(Tr::tr("Use Intel style disassembly"));
intelFlavor.setToolTip(Tr::tr("GDB shows by default AT&&T style disassembly.")); intelFlavor.setToolTip(Tr::tr("GDB shows by default AT&&T style disassembly."));
usePseudoTracepoints.setSettingsKey("UsePseudoTracepoints"); usePseudoTracepoints.setSettingsKey(debugModeGroup, "UsePseudoTracepoints");
usePseudoTracepoints.setLabelText(Tr::tr("Use pseudo message tracepoints")); usePseudoTracepoints.setLabelText(Tr::tr("Use pseudo message tracepoints"));
usePseudoTracepoints.setToolTip(Tr::tr("Uses Python to extend the ordinary GDB breakpoint class.")); usePseudoTracepoints.setToolTip(Tr::tr("Uses Python to extend the ordinary GDB breakpoint class."));
usePseudoTracepoints.setDefaultValue(true); usePseudoTracepoints.setDefaultValue(true);
useIndexCache.setSettingsKey("UseIndexCache"); useIndexCache.setSettingsKey(debugModeGroup, "UseIndexCache");
useIndexCache.setLabelText(Tr::tr("Use automatic symbol cache")); useIndexCache.setLabelText(Tr::tr("Use automatic symbol cache"));
useIndexCache.setToolTip(Tr::tr("It is possible for GDB to automatically save a copy of " useIndexCache.setToolTip(Tr::tr("It is possible for GDB to automatically save a copy of "
"its symbol index in a cache on disk and retrieve it from there when loading the same " "its symbol index in a cache on disk and retrieve it from there when loading the same "
@@ -172,7 +172,7 @@ GdbSettings::GdbSettings()
useDebugInfoD.setToolTip(Tr::tr("Lets GDB attempt to automatically retrieve " useDebugInfoD.setToolTip(Tr::tr("Lets GDB attempt to automatically retrieve "
"debug information for system packages.")); "debug information for system packages."));
skipKnownFrames.setSettingsKey("SkipKnownFrames"); skipKnownFrames.setSettingsKey(debugModeGroup, "SkipKnownFrames");
skipKnownFrames.setDisplayName(Tr::tr("Skip Known Frames")); skipKnownFrames.setDisplayName(Tr::tr("Skip Known Frames"));
skipKnownFrames.setLabelText(Tr::tr("Skip known frames when stepping")); skipKnownFrames.setLabelText(Tr::tr("Skip known frames when stepping"));
skipKnownFrames.setToolTip(Tr::tr( skipKnownFrames.setToolTip(Tr::tr(
@@ -182,7 +182,7 @@ GdbSettings::GdbSettings()
"counting code is skipped, and a single <i>Step Into</i> for a signal\n" "counting code is skipped, and a single <i>Step Into</i> for a signal\n"
"emission ends up directly in the slot connected to it.")); "emission ends up directly in the slot connected to it."));
enableReverseDebugging.setSettingsKey("EnableReverseDebugging"); enableReverseDebugging.setSettingsKey(debugModeGroup, "EnableReverseDebugging");
enableReverseDebugging.setIcon(Icons::REVERSE_MODE.icon()); enableReverseDebugging.setIcon(Icons::REVERSE_MODE.icon());
enableReverseDebugging.setDisplayName(Tr::tr("Enable Reverse Debugging")); enableReverseDebugging.setDisplayName(Tr::tr("Enable Reverse Debugging"));
enableReverseDebugging.setLabelText(Tr::tr("Enable reverse debugging")); enableReverseDebugging.setLabelText(Tr::tr("Enable reverse debugging"));
@@ -192,7 +192,7 @@ GdbSettings::GdbSettings()
"It exhibits unpredictable behavior when going backwards over system " "It exhibits unpredictable behavior when going backwards over system "
"calls and is very likely to destroy your debugging session.</p></body></html>")); "calls and is very likely to destroy your debugging session.</p></body></html>"));
gdbWatchdogTimeout.setSettingsKey("WatchdogTimeout"); gdbWatchdogTimeout.setSettingsKey(debugModeGroup, "WatchdogTimeout");
gdbWatchdogTimeout.setDefaultValue(40); gdbWatchdogTimeout.setDefaultValue(40);
gdbWatchdogTimeout.setSuffix(Tr::tr("sec")); gdbWatchdogTimeout.setSuffix(Tr::tr("sec"));
gdbWatchdogTimeout.setRange(10, 1000000); gdbWatchdogTimeout.setRange(10, 1000000);

View File

@@ -1820,13 +1820,20 @@ bool WatchModel::contextMenuEvent(const ItemViewEvent &ev)
menu->addSeparator(); menu->addSeparator();
DebuggerSettings &s = settings(); DebuggerSettings &s = settings();
menu->addAction(s.useDebuggingHelpers.action()); QAction *debugHelperAction = s.useDebuggingHelpers.action();
menu->addAction(debugHelperAction);
menu->addAction(s.useToolTipsInLocalsView.action()); menu->addAction(s.useToolTipsInLocalsView.action());
menu->addAction(s.autoDerefPointers.action()); menu->addAction(s.autoDerefPointers.action());
menu->addAction(s.sortStructMembers.action()); menu->addAction(s.sortStructMembers.action());
menu->addAction(s.useDynamicType.action()); QAction *dynamicTypeAction = s.useDynamicType.action();
menu->addAction(dynamicTypeAction);
menu->addAction(s.settingsDialog.action()); menu->addAction(s.settingsDialog.action());
// useDebuggingHelpers/useDynamicType have no auto-apply, but need to be persisted on triggered
connect(debugHelperAction, &QAction::triggered,
&s.useDebuggingHelpers, &BoolAspect::writeSettings, Qt::UniqueConnection);
connect(dynamicTypeAction, &QAction::triggered,
&s.useDynamicType, &BoolAspect::writeSettings, Qt::UniqueConnection);
connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater); connect(menu, &QMenu::aboutToHide, menu, &QObject::deleteLater);
menu->popup(ev.globalPos()); menu->popup(ev.globalPos());
return true; return true;

View File

@@ -9,10 +9,10 @@
#include <QWidget> #include <QWidget>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAbstractButton;
class QItemSelectionModel; class QItemSelectionModel;
class QLineEdit; class QLineEdit;
class QListView; class QListView;
class QPushButton;
class QSortFilterProxyModel; class QSortFilterProxyModel;
QT_END_NAMESPACE QT_END_NAMESPACE
@@ -58,7 +58,7 @@ private:
QScopedPointer<QStandardItemModel> m_model; QScopedPointer<QStandardItemModel> m_model;
QLineEdit *m_searchBox; QLineEdit *m_searchBox;
QPushButton *m_updateButton; QAbstractButton *m_updateButton;
QListView *m_extensionsView; QListView *m_extensionsView;
QItemSelectionModel *m_selectionModel = nullptr; QItemSelectionModel *m_selectionModel = nullptr;
QSortFilterProxyModel *m_filterProxyModel; QSortFilterProxyModel *m_filterProxyModel;

View File

@@ -71,10 +71,7 @@ CreateSimulatorDialog::CreateSimulatorDialog(QWidget *parent)
populateRuntimes(DeviceTypeInfo()); populateRuntimes(DeviceTypeInfo());
} }
CreateSimulatorDialog::~CreateSimulatorDialog() CreateSimulatorDialog::~CreateSimulatorDialog() = default;
{
m_futureSync.waitForFinished();
}
/*! /*!
Returns the simulator name entered by user. Returns the simulator name entered by user.

View File

@@ -35,12 +35,12 @@ private:
void populateDeviceTypes(const QList<DeviceTypeInfo> &deviceTypes); void populateDeviceTypes(const QList<DeviceTypeInfo> &deviceTypes);
void populateRuntimes(const DeviceTypeInfo &deviceType); void populateRuntimes(const DeviceTypeInfo &deviceType);
Utils::FutureSynchronizer m_futureSync;
QList<RuntimeInfo> m_runtimes; QList<RuntimeInfo> m_runtimes;
QLineEdit *m_nameEdit; QLineEdit *m_nameEdit;
QComboBox *m_deviceTypeCombo; QComboBox *m_deviceTypeCombo;
QComboBox *m_runtimeCombo; QComboBox *m_runtimeCombo;
Utils::FutureSynchronizer m_futureSync; // Keep me last
}; };
} // Ios::Internal } // Ios::Internal

View File

@@ -305,8 +305,7 @@ void IosConfigurations::updateAutomaticKitList()
existingKits.subtract(resultingKits); existingKits.subtract(resultingKits);
qCDebug(kitSetupLog) << "Removing unused kits:"; qCDebug(kitSetupLog) << "Removing unused kits:";
printKits(existingKits); printKits(existingKits);
for (Kit *kit : std::as_const(existingKits)) KitManager::deregisterKits(toList(existingKits));
KitManager::deregisterKit(kit);
} }
static IosConfigurations *m_instance = nullptr; static IosConfigurations *m_instance = nullptr;

View File

@@ -1630,6 +1630,12 @@ void Client::setCompletionAssistProvider(LanguageClientCompletionAssistProvider
d->m_clientProviders.completionAssistProvider = provider; d->m_clientProviders.completionAssistProvider = provider;
} }
void Client::setFunctionHintAssistProvider(FunctionHintAssistProvider *provider)
{
delete d->m_clientProviders.functionHintProvider;
d->m_clientProviders.functionHintProvider = provider;
}
void Client::setQuickFixAssistProvider(LanguageClientQuickFixProvider *provider) void Client::setQuickFixAssistProvider(LanguageClientQuickFixProvider *provider)
{ {
delete d->m_clientProviders.quickFixAssistProvider; delete d->m_clientProviders.quickFixAssistProvider;

View File

@@ -39,6 +39,7 @@ class ClientPrivate;
class DiagnosticManager; class DiagnosticManager;
class DocumentSymbolCache; class DocumentSymbolCache;
class DynamicCapabilities; class DynamicCapabilities;
class FunctionHintAssistProvider;
class HoverHandler; class HoverHandler;
class InterfaceController; class InterfaceController;
class LanguageClientCompletionAssistProvider; class LanguageClientCompletionAssistProvider;
@@ -171,6 +172,7 @@ public:
void setSemanticTokensHandler(const SemanticTokensHandler &handler); void setSemanticTokensHandler(const SemanticTokensHandler &handler);
void setSnippetsGroup(const QString &group); void setSnippetsGroup(const QString &group);
void setCompletionAssistProvider(LanguageClientCompletionAssistProvider *provider); void setCompletionAssistProvider(LanguageClientCompletionAssistProvider *provider);
void setFunctionHintAssistProvider(FunctionHintAssistProvider *provider);
void setQuickFixAssistProvider(LanguageClientQuickFixProvider *provider); void setQuickFixAssistProvider(LanguageClientQuickFixProvider *provider);
virtual bool supportsDocumentSymbols(const TextEditor::TextDocument *doc) const; virtual bool supportsDocumentSymbols(const TextEditor::TextDocument *doc) const;
virtual bool fileBelongsToProject(const Utils::FilePath &filePath) const; virtual bool fileBelongsToProject(const Utils::FilePath &filePath) const;

View File

@@ -17,24 +17,6 @@ using namespace LanguageServerProtocol;
namespace LanguageClient { namespace LanguageClient {
class FunctionHintProposalModel : public IFunctionHintProposalModel
{
public:
explicit FunctionHintProposalModel(SignatureHelp signature)
: m_sigis(signature)
{}
void reset() override {}
int size() const override
{ return m_sigis.signatures().size(); }
QString text(int index) const override;
int activeArgument(const QString &/*prefix*/) const override
{ return m_sigis.activeParameter().value_or(0); }
private:
LanguageServerProtocol::SignatureHelp m_sigis;
};
QString FunctionHintProposalModel::text(int index) const QString FunctionHintProposalModel::text(int index) const
{ {
using Parameters = QList<ParameterInformation>; using Parameters = QList<ParameterInformation>;
@@ -62,18 +44,19 @@ QString FunctionHintProposalModel::text(int index) const
+ label.mid(end).toHtmlEscaped(); + label.mid(end).toHtmlEscaped();
} }
FunctionHintProcessor::FunctionHintProcessor(Client *client) FunctionHintProcessor::FunctionHintProcessor(Client *client, int basePosition)
: m_client(client) : m_client(client)
, m_pos(basePosition)
{} {}
IAssistProposal *FunctionHintProcessor::perform() IAssistProposal *FunctionHintProcessor::perform()
{ {
QTC_ASSERT(m_client, return nullptr); QTC_ASSERT(m_client, return nullptr);
if (m_pos < 0)
m_pos = interface()->position(); m_pos = interface()->position();
QTextCursor cursor(interface()->textDocument());
cursor.setPosition(m_pos);
auto uri = m_client->hostPathToServerUri(interface()->filePath()); auto uri = m_client->hostPathToServerUri(interface()->filePath());
SignatureHelpRequest request((TextDocumentPositionParams(TextDocumentIdentifier(uri), Position(cursor)))); SignatureHelpRequest request(
(TextDocumentPositionParams(TextDocumentIdentifier(uri), Position(interface()->cursor()))));
request.setResponseCallback([this](auto response) { this->handleSignatureResponse(response); }); request.setResponseCallback([this](auto response) { this->handleSignatureResponse(response); });
m_client->addAssistProcessor(this); m_client->addAssistProcessor(this);
m_client->sendMessage(request); m_client->sendMessage(request);
@@ -91,6 +74,12 @@ void FunctionHintProcessor::cancel()
} }
} }
IFunctionHintProposalModel *FunctionHintProcessor::createModel(
const SignatureHelp &signatureHelp) const
{
return new FunctionHintProposalModel(signatureHelp);
}
void FunctionHintProcessor::handleSignatureResponse(const SignatureHelpRequest::Response &response) void FunctionHintProcessor::handleSignatureResponse(const SignatureHelpRequest::Response &response)
{ {
QTC_ASSERT(m_client, setAsyncProposalAvailable(nullptr); return); QTC_ASSERT(m_client, setAsyncProposalAvailable(nullptr); return);
@@ -107,7 +96,7 @@ void FunctionHintProcessor::handleSignatureResponse(const SignatureHelpRequest::
if (signatureHelp.signatures().isEmpty()) { if (signatureHelp.signatures().isEmpty()) {
setAsyncProposalAvailable(nullptr); setAsyncProposalAvailable(nullptr);
} else { } else {
FunctionHintProposalModelPtr model(new FunctionHintProposalModel(signatureHelp)); FunctionHintProposalModelPtr model(createModel(signatureHelp));
setAsyncProposalAvailable(new FunctionHintProposal(m_pos, model)); setAsyncProposalAvailable(new FunctionHintProposal(m_pos, model));
} }
} }

View File

@@ -8,6 +8,7 @@
#include <languageserverprotocol/languagefeatures.h> #include <languageserverprotocol/languagefeatures.h>
#include <texteditor/codeassist/completionassistprovider.h> #include <texteditor/codeassist/completionassistprovider.h>
#include <texteditor/codeassist/iassistprocessor.h> #include <texteditor/codeassist/iassistprocessor.h>
#include <texteditor/codeassist/ifunctionhintproposalmodel.h>
#include <QPointer> #include <QPointer>
@@ -43,13 +44,15 @@ private:
class LANGUAGECLIENT_EXPORT FunctionHintProcessor : public TextEditor::IAssistProcessor class LANGUAGECLIENT_EXPORT FunctionHintProcessor : public TextEditor::IAssistProcessor
{ {
public: public:
explicit FunctionHintProcessor(Client *client); explicit FunctionHintProcessor(Client *client, int basePosition = -1);
TextEditor::IAssistProposal *perform() override; TextEditor::IAssistProposal *perform() override;
bool running() override { return m_currentRequest.has_value(); } bool running() override { return m_currentRequest.has_value(); }
bool needsRestart() const override { return true; } bool needsRestart() const override { return true; }
void cancel() override; void cancel() override;
private: private:
virtual TextEditor::IFunctionHintProposalModel *createModel(
const LanguageServerProtocol::SignatureHelp &signatureHelp) const;
void handleSignatureResponse( void handleSignatureResponse(
const LanguageServerProtocol::SignatureHelpRequest::Response &response); const LanguageServerProtocol::SignatureHelpRequest::Response &response);
@@ -58,4 +61,22 @@ private:
int m_pos = -1; int m_pos = -1;
}; };
class LANGUAGECLIENT_EXPORT FunctionHintProposalModel
: public TextEditor::IFunctionHintProposalModel
{
public:
explicit FunctionHintProposalModel(LanguageServerProtocol::SignatureHelp signature)
: m_sigis(signature)
{}
void reset() override {}
int size() const override { return m_sigis.signatures().size(); }
QString text(int index) const override;
int activeArgument(const QString &/*prefix*/) const override
{ return m_sigis.activeParameter().value_or(0); }
protected:
LanguageServerProtocol::SignatureHelp m_sigis;
};
} // namespace LanguageClient } // namespace LanguageClient

View File

@@ -110,8 +110,9 @@ void LanguageClient::LanguageClientManager::addClient(Client *client)
managerInstance, [client]() { managerInstance, [client]() {
QTC_ASSERT(!managerInstance->m_clients.contains(client), QTC_ASSERT(!managerInstance->m_clients.contains(client),
managerInstance->m_clients.removeAll(client)); managerInstance->m_clients.removeAll(client));
for (QList<Client *> &clients : managerInstance->m_clientsForSetting) for (QList<Client *> &clients : managerInstance->m_clientsForSetting) {
QTC_CHECK(clients.removeAll(client) == 0); QTC_CHECK(clients.removeAll(client) == 0);
}
}); });
ProjectExplorer::Project *project = client->project(); ProjectExplorer::Project *project = client->project();

View File

@@ -42,12 +42,12 @@ McuPackage::McuPackage(const SettingsHandler::Ptr &settingsHandler,
const QString &downloadUrl, const QString &downloadUrl,
const McuPackageVersionDetector *versionDetector, const McuPackageVersionDetector *versionDetector,
const bool addToSystemPath, const bool addToSystemPath,
const Utils::PathChooser::Kind &valueType) const Utils::PathChooser::Kind &valueType,
const bool useNewestVersionKey)
: settingsHandler(settingsHandler) : settingsHandler(settingsHandler)
, m_label(label) , m_label(label)
, m_defaultPath(settingsHandler->getPath(settingsKey, QSettings::SystemScope, defaultPath))
, m_detectionPaths(detectionPaths) , m_detectionPaths(detectionPaths)
, m_settingsKey(settingsKey) , m_settingsKey(settingsHandler->getVersionedKey(settingsKey, QSettings::SystemScope, versions, useNewestVersionKey))
, m_versionDetector(versionDetector) , m_versionDetector(versionDetector)
, m_versions(versions) , m_versions(versions)
, m_cmakeVariableName(cmakeVarName) , m_cmakeVariableName(cmakeVarName)
@@ -56,7 +56,8 @@ McuPackage::McuPackage(const SettingsHandler::Ptr &settingsHandler,
, m_addToSystemPath(addToSystemPath) , m_addToSystemPath(addToSystemPath)
, m_valueType(valueType) , m_valueType(valueType)
{ {
m_path = this->settingsHandler->getPath(settingsKey, QSettings::UserScope, m_defaultPath); m_defaultPath = settingsHandler->getPath(m_settingsKey, QSettings::SystemScope, defaultPath);
m_path = settingsHandler->getPath(m_settingsKey, QSettings::UserScope, m_defaultPath);
if (m_path.isEmpty()) { if (m_path.isEmpty()) {
m_path = FilePath::fromUserInput(qtcEnvironmentVariable(m_environmentVariableName)); m_path = FilePath::fromUserInput(qtcEnvironmentVariable(m_environmentVariableName));
} }

View File

@@ -40,7 +40,8 @@ public:
const McuPackageVersionDetector *versionDetector = nullptr, const McuPackageVersionDetector *versionDetector = nullptr,
const bool addToPath = false, const bool addToPath = false,
const Utils::PathChooser::Kind &valueType const Utils::PathChooser::Kind &valueType
= Utils::PathChooser::Kind::ExistingDirectory); = Utils::PathChooser::Kind::ExistingDirectory,
const bool useNewestVersionKey = false);
~McuPackage() override = default; ~McuPackage() override = default;

View File

@@ -54,7 +54,13 @@ McuPackagePtr createQtForMCUsPackage(const SettingsHandler::Ptr &settingsHandler
.withExecutableSuffix()}, // detectionPaths .withExecutableSuffix()}, // detectionPaths
Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK, // settingsKey Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK, // settingsKey
Legacy::Constants::QUL_CMAKE_VAR, Legacy::Constants::QUL_CMAKE_VAR,
Legacy::Constants::QUL_ENV_VAR)}; Legacy::Constants::QUL_ENV_VAR,
{}, // versions
{}, // downloadUrl
nullptr, // versionDetector
false, // addToPath
Utils::PathChooser::Kind::ExistingDirectory, // valueType
true)}; // useNewestVersionKey
} }
namespace Legacy { namespace Legacy {

View File

@@ -10,6 +10,9 @@
#include <utils/filepath.h> #include <utils/filepath.h>
#include <utils/store.h> #include <utils/store.h>
#include <QRegularExpression>
#include <QVersionNumber>
using namespace Utils; using namespace Utils;
namespace McuSupport::Internal { namespace McuSupport::Internal {
@@ -27,6 +30,68 @@ static FilePath packagePathFromSettings(const Key &settingsKey,
return FilePath::fromUserInput(path); return FilePath::fromUserInput(path);
} }
static Key getKeyForNewestVersion(const Key &plainKey,
QtcSettings &settings)
{
const Key baseKey = Key(Constants::SETTINGS_KEY_PACKAGE_PREFIX + plainKey);
// Versioned keys have their version string after the last underscore character
// Only version strings on the format x[.y.z] are considered.
settings.beginGroup(Constants::SETTINGS_GROUP);
const QRegularExpression re(QString("%1_\\d+(\\.\\d+){0,2}$").arg(stringFromKey(baseKey)));
const QStringList matchingKeys = stringsFromKeys(settings.childKeys()).filter(re);
settings.endGroup();
if (matchingKeys.isEmpty()) {
return plainKey;
}
QVersionNumber newestVersion;
for (const auto &k: matchingKeys) {
const QString currentVersionStr = k.mid(k.lastIndexOf("_") + 1);
const auto currentVersion = QVersionNumber::fromString(currentVersionStr);
if (newestVersion.isNull() || newestVersion < currentVersion) {
newestVersion = currentVersion;
}
}
const QString newestVersionStr = QString("_%1").arg(newestVersion.toString());
return Key(plainKey + newestVersionStr.toLocal8Bit());
}
static Key getVersionedKeyFromSettings(const Key &plainKey,
QtcSettings &settings,
const QStringList &versions,
bool allowNewerVersions = false)
{
const Key keyBase = Key(Constants::SETTINGS_GROUP) + '/'
+ Constants::SETTINGS_KEY_PACKAGE_PREFIX;
// Always prefer one of the versions listed in the kit
for (const auto &versionString: versions) {
const Key versionedKey = plainKey + QString("_%1").arg(versionString).toLocal8Bit();
if (settings.contains(keyBase + versionedKey)) {
return versionedKey;
}
}
// Maybe find the newest version listed in the settings
if (allowNewerVersions) {
return getKeyForNewestVersion(plainKey, settings);
}
// Fall back to the plain key if no versioned key is found
return plainKey;
}
Key SettingsHandler::getVersionedKey(const Key &plainKey,
QSettings::Scope scope,
const QStringList &versions,
bool allowNewer) const
{
return getVersionedKeyFromSettings(plainKey, *Core::ICore::settings(scope), versions, allowNewer);
}
FilePath SettingsHandler::getPath(const Key &settingsKey, FilePath SettingsHandler::getPath(const Key &settingsKey,
QSettings::Scope scope, QSettings::Scope scope,
const FilePath &defaultPath) const const FilePath &defaultPath) const

View File

@@ -18,6 +18,10 @@ public:
virtual Utils::FilePath getPath(const Utils::Key &settingsKey, virtual Utils::FilePath getPath(const Utils::Key &settingsKey,
QSettings::Scope scope, QSettings::Scope scope,
const Utils::FilePath &m_defaultPath) const; const Utils::FilePath &m_defaultPath) const;
Utils::Key getVersionedKey(const Utils::Key &plainKey,
QSettings::Scope scope,
const QStringList &versions,
bool allowNewer) const;
virtual bool write(const Utils::Key &settingsKey, virtual bool write(const Utils::Key &settingsKey,
const Utils::FilePath &path, const Utils::FilePath &path,

View File

@@ -7,12 +7,13 @@
#include "modeleditor_constants.h" #include "modeleditor_constants.h"
#include "modeleditortr.h" #include "modeleditortr.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/icon.h> #include <utils/icon.h>
#include <utils/stringutils.h>
#include <utils/utilsicons.h> #include <utils/utilsicons.h>
#include <QAction> #include <QAction>
@@ -161,11 +162,17 @@ void ActionHandler::createActions()
QKeySequence(), QIcon(":/modelinglib/48x48/class.png")); QKeySequence(), QIcon(":/modelinglib/48x48/class.png"));
registerCommand(Constants::ACTION_ADD_CANVAS_DIAGRAM, nullptr, Core::Context(), Tr::tr("Add Canvas Diagram"), registerCommand(Constants::ACTION_ADD_CANVAS_DIAGRAM, nullptr, Core::Context(), Tr::tr("Add Canvas Diagram"),
QKeySequence(), QIcon(":/modelinglib/48x48/canvas-diagram.png")); QKeySequence(), QIcon(":/modelinglib/48x48/canvas-diagram.png"));
d->synchronizeBrowserAction = registerCommand( d->synchronizeBrowserAction
Constants::ACTION_SYNC_BROWSER, nullptr, Core::Context(), = registerCommand(
Constants::ACTION_SYNC_BROWSER,
nullptr,
Core::Context(),
Tr::tr("Synchronize Browser and Diagram"),
QKeySequence(),
Utils::Icons::LINK_TOOLBAR.icon(),
Tr::tr("Synchronize Browser and Diagram") + "<br><i><small>" Tr::tr("Synchronize Browser and Diagram") + "<br><i><small>"
+ Tr::tr("Press && Hold for Options") + "</small></i>", QKeySequence(), + Utils::stripAccelerator(Tr::tr("Press && Hold for Options")) + "</small></i>")
Utils::Icons::LINK_TOOLBAR.icon())->action(); ->action();
d->synchronizeBrowserAction->setCheckable(true); d->synchronizeBrowserAction->setCheckable(true);
auto editPropertiesAction = new QAction(Tr::tr("Edit Element Properties"), auto editPropertiesAction = new QAction(Tr::tr("Edit Element Properties"),
@@ -205,13 +212,20 @@ std::function<void()> invokeOnCurrentModelEditor(void (ModelEditor::*function)()
}; };
} }
Core::Command *ActionHandler::registerCommand(const Utils::Id &id, void (ModelEditor::*function)(), Core::Command *ActionHandler::registerCommand(
const Core::Context &context, const QString &title, const Utils::Id &id,
const QKeySequence &keySequence, const QIcon &icon) void (ModelEditor::*function)(),
const Core::Context &context,
const QString &title,
const QKeySequence &keySequence,
const QIcon &icon,
const QString &toolTip)
{ {
auto action = new QAction(title, this); auto action = new QAction(title, this);
if (!icon.isNull()) if (!icon.isNull())
action->setIcon(icon); action->setIcon(icon);
if (!toolTip.isEmpty())
action->setToolTip(toolTip);
Core::Command *command = Core::ActionManager::registerAction(action, id, context, /*scriptable=*/true); Core::Command *command = Core::ActionManager::registerAction(action, id, context, /*scriptable=*/true);
if (!keySequence.isEmpty()) if (!keySequence.isEmpty())
command->setDefaultKeySequence(keySequence); command->setDefaultKeySequence(keySequence);

View File

@@ -56,10 +56,14 @@ private:
void onEditProperties(); void onEditProperties();
void onEditItem(); void onEditItem();
Core::Command *registerCommand(const Utils::Id &id, void (ModelEditor::*function)(), Core::Command *registerCommand(
const Core::Context &context, const QString &title = QString(), const Utils::Id &id,
void (ModelEditor::*function)(),
const Core::Context &context,
const QString &title = QString(),
const QKeySequence &keySequence = QKeySequence(), const QKeySequence &keySequence = QKeySequence(),
const QIcon &icon = QIcon()); const QIcon &icon = QIcon(),
const QString &toolTip = {});
private: private:
ActionHandlerPrivate *d; ActionHandlerPrivate *d;

View File

@@ -29,6 +29,7 @@ const char AnalyzerSettingsGroupId[] = "Analyzer";
const char PerfSettingsId[] = "Analyzer.Perf.Settings"; const char PerfSettingsId[] = "Analyzer.Perf.Settings";
const char PerfCallgraphDwarf[] = "dwarf"; const char PerfCallgraphDwarf[] = "dwarf";
const char PerfRecordArgsId[] = "PerfRecordArgsId";
const char PerfStreamMagic[] = "QPERFSTREAM"; const char PerfStreamMagic[] = "QPERFSTREAM";
const char PerfZqfileMagic[] = "PTQFILE4.10"; const char PerfZqfileMagic[] = "PTQFILE4.10";

View File

@@ -6,8 +6,6 @@
#include "perfdatareader.h" #include "perfdatareader.h"
#include "perfprofilertool.h" #include "perfprofilertool.h"
#include "perfprofilertr.h" #include "perfprofilertr.h"
#include "perfrunconfigurationaspect.h"
#include "perfsettings.h"
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/messagemanager.h> #include <coreplugin/messagemanager.h>
@@ -97,11 +95,6 @@ public:
void start() final void start() final
{ {
auto perfAspect = runControl()->aspectData<PerfRunConfigurationAspect>();
QTC_ASSERT(perfAspect, reportFailure(); return);
PerfSettings *settings = static_cast<PerfSettings *>(perfAspect->currentSettings);
QTC_ASSERT(settings, reportFailure(); return);
m_process = new Process(this); m_process = new Process(this);
connect(m_process, &Process::started, this, &RunWorker::reportStarted); connect(m_process, &Process::started, this, &RunWorker::reportStarted);
@@ -121,8 +114,11 @@ public:
reportStopped(); reportStopped();
}); });
const Store perfArgs = runControl()->settingsData(PerfProfiler::Constants::PerfSettingsId);
const QString recordArgs = perfArgs[Constants::PerfRecordArgsId].toString();
CommandLine cmd({device()->filePath("perf"), {"record"}}); CommandLine cmd({device()->filePath("perf"), {"record"}});
settings->addPerfRecordArguments(&cmd); cmd.addArgs(recordArgs, CommandLine::Raw);
cmd.addArgs({"-o", "-", "--"}); cmd.addArgs({"-o", "-", "--"});
cmd.addCommandLineAsArgs(runControl()->commandLine(), CommandLine::Raw); cmd.addCommandLineAsArgs(runControl()->commandLine(), CommandLine::Raw);

View File

@@ -8,7 +8,7 @@
#include <debugger/analyzer/analyzerrunconfigwidget.h> #include <debugger/analyzer/analyzerrunconfigwidget.h>
namespace PerfProfiler { namespace PerfProfiler::Internal {
PerfRunConfigurationAspect::PerfRunConfigurationAspect(ProjectExplorer::Target *target) PerfRunConfigurationAspect::PerfRunConfigurationAspect(ProjectExplorer::Target *target)
{ {
@@ -21,4 +21,4 @@ PerfRunConfigurationAspect::PerfRunConfigurationAspect(ProjectExplorer::Target *
setConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); }); setConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); });
} }
} // namespace PerfProfiler } // PerfProfiler::Internal

View File

@@ -3,20 +3,14 @@
#pragma once #pragma once
#include "perfprofiler_global.h"
#include <projectexplorer/runconfiguration.h> #include <projectexplorer/runconfiguration.h>
#include <QObject> namespace PerfProfiler::Internal {
namespace PerfProfiler { class PerfRunConfigurationAspect final : public ProjectExplorer::GlobalOrProjectAspect
class PERFPROFILER_EXPORT PerfRunConfigurationAspect :
public ProjectExplorer::GlobalOrProjectAspect
{ {
Q_OBJECT
public: public:
PerfRunConfigurationAspect(ProjectExplorer::Target *target); explicit PerfRunConfigurationAspect(ProjectExplorer::Target *target);
}; };
} // namespace PerfProfiler } // PerfProfiler::Internal

View File

@@ -371,6 +371,8 @@ PerfSettings &globalSettings()
PerfSettings::PerfSettings(ProjectExplorer::Target *target) PerfSettings::PerfSettings(ProjectExplorer::Target *target)
{ {
setAutoApply(false); setAutoApply(false);
setId(Constants::PerfSettingsId);
period.setSettingsKey("Analyzer.Perf.Frequency"); period.setSettingsKey("Analyzer.Perf.Frequency");
period.setRange(250, 2147483647); period.setRange(250, 2147483647);
period.setDefaultValue(250); period.setDefaultValue(250);
@@ -448,7 +450,13 @@ void PerfSettings::writeGlobalSettings() const
settings->endGroup(); settings->endGroup();
} }
void PerfSettings::addPerfRecordArguments(CommandLine *cmd) const void PerfSettings::toMap(Store &map) const
{
AspectContainer::toMap(map);
map[Constants::PerfRecordArgsId] = perfRecordArguments();
}
QString PerfSettings::perfRecordArguments() const
{ {
QString callgraphArg = callgraphMode.itemValue().toString(); QString callgraphArg = callgraphMode.itemValue().toString();
if (callgraphArg == Constants::PerfCallgraphDwarf) if (callgraphArg == Constants::PerfCallgraphDwarf)
@@ -463,11 +471,13 @@ void PerfSettings::addPerfRecordArguments(CommandLine *cmd) const
} }
} }
cmd->addArgs({"-e", events, CommandLine cmd;
cmd.addArgs({"-e", events,
"--call-graph", callgraphArg, "--call-graph", callgraphArg,
sampleMode.itemValue().toString(), sampleMode.itemValue().toString(),
QString::number(period())}); QString::number(period())});
cmd->addArgs(extraArguments(), CommandLine::Raw); cmd.addArgs(extraArguments(), CommandLine::Raw);
return cmd.arguments();
} }
void PerfSettings::resetToDefault() void PerfSettings::resetToDefault()

View File

@@ -20,7 +20,8 @@ public:
void readGlobalSettings(); void readGlobalSettings();
void writeGlobalSettings() const; void writeGlobalSettings() const;
void addPerfRecordArguments(Utils::CommandLine *cmd) const; void toMap(Utils::Store &map) const override;
QString perfRecordArguments() const;
void resetToDefault(); void resetToDefault();

View File

@@ -650,16 +650,30 @@ Kit *KitManager::registerKit(const std::function<void (Kit *)> &init, Utils::Id
void KitManager::deregisterKit(Kit *k) void KitManager::deregisterKit(Kit *k)
{ {
QTC_ASSERT(KitManager::isLoaded(), return); deregisterKits({k});
}
if (!k || !Utils::contains(d->m_kitList, k)) void KitManager::deregisterKits(const QList<Kit *> kitList)
return; {
auto taken = Utils::take(d->m_kitList, k); QTC_ASSERT(KitManager::isLoaded(), return);
if (defaultKit() == k) { std::vector<std::unique_ptr<Kit>> removed; // to keep them alive until the end of the function
Kit *newDefault = Utils::findOrDefault(kits(), [](Kit *k) { return k->isValid(); }); bool defaultKitRemoved = false;
setDefaultKit(newDefault); for (Kit *k : kitList) {
QTC_ASSERT(k, continue);
std::optional<std::unique_ptr<Kit>> taken = Utils::take(d->m_kitList, k);
QTC_ASSERT(taken, continue);
if (defaultKit() == k)
defaultKitRemoved = true;
removed.push_back(std::move(*taken));
} }
emit instance()->kitRemoved(k);
if (defaultKitRemoved) {
d->m_defaultKit = Utils::findOrDefault(kits(), &Kit::isValid);
emit instance()->defaultkitChanged();
}
for (auto it = removed.cbegin(); it != removed.cend(); ++it)
emit instance()->kitRemoved(it->get());
emit instance()->kitsChanged(); emit instance()->kitsChanged();
} }

View File

@@ -153,6 +153,7 @@ public:
static Kit *registerKit(const std::function<void(Kit *)> &init, Utils::Id id = {}); static Kit *registerKit(const std::function<void(Kit *)> &init, Utils::Id id = {});
static void deregisterKit(Kit *k); static void deregisterKit(Kit *k);
static void deregisterKits(const QList<Kit *> kits);
static void setDefaultKit(Kit *k); static void setDefaultKit(Kit *k);
static void saveKits(); static void saveKits();

View File

@@ -47,7 +47,7 @@ const char PROJECT_BASE_ID[] = "Welcome.OpenRecentProject";
namespace ProjectExplorer { namespace ProjectExplorer {
namespace Internal { namespace Internal {
constexpr TextFormat projectNameTF {Theme::Token_Accent_Default, StyleHelper::UiElementH5}; constexpr TextFormat projectNameTF {Theme::Token_Text_Accent, StyleHelper::UiElementH5};
constexpr TextFormat projectPathTF {Theme::Token_Text_Muted, StyleHelper::UiElementIconActive}; constexpr TextFormat projectPathTF {Theme::Token_Text_Muted, StyleHelper::UiElementIconActive};
constexpr TextFormat sessionNameTF {projectNameTF.themeColor, projectNameTF.uiElement}; constexpr TextFormat sessionNameTF {projectNameTF.themeColor, projectNameTF.uiElement};
constexpr TextFormat sessionProjetNameTF {Theme::Token_Text_Default, projectNameTF.uiElement}; constexpr TextFormat sessionProjetNameTF {Theme::Token_Text_Default, projectNameTF.uiElement};

View File

@@ -44,6 +44,7 @@ public:
setDisplayName(Tr::tr("Create Application Manager package with CMake")); setDisplayName(Tr::tr("Create Application Manager package with CMake"));
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
setSupportedProjectType(CMakeProjectManager::Constants::CMAKE_PROJECT_ID);
} }
}; };

View File

@@ -16,6 +16,7 @@
#include <boot2qt/qdbconstants.h> #include <boot2qt/qdbconstants.h>
#include <remotelinux/remotelinux_constants.h> #include <remotelinux/remotelinux_constants.h>
#include <cmakeprojectmanager/cmakeprojectconstants.h>
using namespace ProjectExplorer; using namespace ProjectExplorer;
@@ -37,6 +38,7 @@ public:
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType); addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
addSupportedTargetDeviceType(Qdb::Constants::QdbLinuxOsType); addSupportedTargetDeviceType(Qdb::Constants::QdbLinuxOsType);
setSupportedProjectType(CMakeProjectManager::Constants::CMAKE_PROJECT_ID);
addInitialStep(Constants::CMAKE_PACKAGE_STEP_ID); addInitialStep(Constants::CMAKE_PACKAGE_STEP_ID);
addInitialStep(Constants::DEPLOY_PACKAGE_STEP_ID, isNecessaryToDeploy); addInitialStep(Constants::DEPLOY_PACKAGE_STEP_ID, isNecessaryToDeploy);

View File

@@ -12,13 +12,13 @@
#include "appmanagerutilities.h" #include "appmanagerutilities.h"
#include <debugger/debuggerengine.h> #include <debugger/debuggerengine.h>
#include <debugger/debuggerrunconfigurationaspect.h>
#include <debugger/debuggerruncontrol.h> #include <debugger/debuggerruncontrol.h>
#include <debugger/debuggerkitaspect.h> #include <debugger/debuggerkitaspect.h>
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildsystem.h> #include <projectexplorer/buildsystem.h>
#include <projectexplorer/buildtargetinfo.h> #include <projectexplorer/buildtargetinfo.h>
#include <projectexplorer/environmentaspect.h>
#include <projectexplorer/project.h> #include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runcontrol.h> #include <projectexplorer/runcontrol.h>

View File

@@ -637,10 +637,11 @@ private:
}; };
CropAndTrimDialog::CropAndTrimDialog(const ClipInfo &clip, QWidget *parent) CropAndTrimDialog::CropAndTrimDialog(const ClipInfo &clip, QWidget *parent)
: QDialog(parent, Qt::Window) : QDialog(parent)
, m_clipInfo(clip) , m_clipInfo(clip)
{ {
setWindowTitle(Tr::tr("Crop and Trim")); setWindowTitle(Tr::tr("Crop and Trim"));
setWindowFlags(Qt::Dialog | Qt::WindowMinMaxButtonsHint); // Make maximizable
m_cropWidget = new CropWidget; m_cropWidget = new CropWidget;

View File

@@ -25,6 +25,7 @@ public:
bool m_readOnly = false; bool m_readOnly = false;
bool m_temporarilyReadOnly = false; bool m_temporarilyReadOnly = false;
bool m_isAdditionalTabVisible = false; bool m_isAdditionalTabVisible = false;
bool m_isAdditionalTabExist = false;
Key m_settingsSuffix; Key m_settingsSuffix;
}; };
@@ -92,6 +93,16 @@ void ICodeStylePreferences::setIsAdditionalTabVisible(bool on)
d->m_isAdditionalTabVisible = on; d->m_isAdditionalTabVisible = on;
} }
bool ICodeStylePreferences::additionalTabExist() const
{
return d->m_isAdditionalTabExist;
}
void ICodeStylePreferences::setAdditionalTabExist(bool on)
{
d->m_isAdditionalTabExist = on;
}
void ICodeStylePreferences::setTabSettings(const TabSettings &settings) void ICodeStylePreferences::setTabSettings(const TabSettings &settings)
{ {
if (d->m_tabSettings == settings) if (d->m_tabSettings == settings)

View File

@@ -44,6 +44,9 @@ public:
bool isAdditionalTabVisible() const; bool isAdditionalTabVisible() const;
void setIsAdditionalTabVisible(bool on); void setIsAdditionalTabVisible(bool on);
bool additionalTabExist() const;
void setAdditionalTabExist(bool on);
void setTabSettings(const TabSettings &settings); void setTabSettings(const TabSettings &settings);
TabSettings tabSettings() const; TabSettings tabSettings() const;
TabSettings currentTabSettings() const; TabSettings currentTabSettings() const;

View File

@@ -206,8 +206,11 @@ void SyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int ch
vecRes << resStart; vecRes << resStart;
while (block.isValid() && (block.position() < endPosition || forceHighlightOfNextBlock)) { while (block.isValid() && (block.position() < endPosition || forceHighlightOfNextBlock)) {
if (QThread::currentThread()->isInterruptionRequested()) if (QThread::currentThread()->isInterruptionRequested() || q->isInterrupted()) {
break; inReformatBlocks = false;
emit q->resultsReady({});
return;
}
const int stateBeforeHighlight = block.userState(); const int stateBeforeHighlight = block.userState();
@@ -767,9 +770,7 @@ void SyntaxHighlighter::setExtraFormats(const QTextBlock &block,
res.m_formatRanges = block.layout()->formats(); res.m_formatRanges = block.layout()->formats();
res.fillByBlock(block); res.fillByBlock(block);
res.m_state = SyntaxHighlighter::State::Extras; res.m_state = SyntaxHighlighter::State::Extras;
SyntaxHighlighter::Result resDone; emit resultsReady({std::move(res)});
resDone.m_state = SyntaxHighlighter::State::Done;
emit resultsReady({res, resDone});
document()->markContentsDirty(block.position(), blockLength - 1); document()->markContentsDirty(block.position(), blockLength - 1);
d->inReformatBlocks = wasInReformatBlocks; d->inReformatBlocks = wasInReformatBlocks;
@@ -796,9 +797,7 @@ void SyntaxHighlighter::clearExtraFormats(const QTextBlock &block)
res.m_formatRanges = block.layout()->formats(); res.m_formatRanges = block.layout()->formats();
res.fillByBlock(block); res.fillByBlock(block);
res.m_state = SyntaxHighlighter::State::Extras; res.m_state = SyntaxHighlighter::State::Extras;
SyntaxHighlighter::Result resDone; emit resultsReady({std::move(res)});
resDone.m_state = SyntaxHighlighter::State::Done;
emit resultsReady({res, resDone});
document()->markContentsDirty(block.position(), blockLength - 1); document()->markContentsDirty(block.position(), blockLength - 1);
d->inReformatBlocks = wasInReformatBlocks; d->inReformatBlocks = wasInReformatBlocks;

View File

@@ -56,15 +56,15 @@ public:
enum State { enum State {
Start, Start,
InProgress, InProgress,
Extras, Done,
Done Extras
}; };
struct Result struct Result
{ {
void fillByBlock(const QTextBlock &block) void fillByBlock(const QTextBlock &block)
{ {
m_blockNumber = block.position(); m_blockNumber = block.blockNumber();
m_userState = block.userState(); m_userState = block.userState();
TextBlockUserData *userDate = TextDocumentLayout::textUserData(block); TextBlockUserData *userDate = TextDocumentLayout::textUserData(block);
@@ -117,6 +117,8 @@ public:
State m_state = InProgress; State m_state = InProgress;
}; };
void setInterrupted(bool interrupted) { m_interrupted = interrupted; }
bool isInterrupted() { return m_interrupted; }
void setExtraFormats(const QTextBlock &block, const QList<QTextLayout::FormatRange> &formats); void setExtraFormats(const QTextBlock &block, const QList<QTextLayout::FormatRange> &formats);
virtual void setLanguageFeaturesFlags(unsigned int /*flags*/) {}; // needed for CppHighlighting virtual void setLanguageFeaturesFlags(unsigned int /*flags*/) {}; // needed for CppHighlighting
virtual void setEnabled(bool /*enabled*/) {}; // needed for DiffAndLogHighlighter virtual void setEnabled(bool /*enabled*/) {}; // needed for DiffAndLogHighlighter
@@ -126,6 +128,7 @@ public slots:
virtual void rehighlight(); virtual void rehighlight();
void rehighlightBlock(const QTextBlock &block); void rehighlightBlock(const QTextBlock &block);
void clearExtraFormats(const QTextBlock &block); void clearExtraFormats(const QTextBlock &block);
void reformatBlocks(int from, int charsRemoved, int charsAdded);
void clearAllExtraFormats(); void clearAllExtraFormats();
protected: protected:
@@ -165,10 +168,10 @@ signals:
private: private:
void setTextFormatCategories(const QList<std::pair<int, TextStyle>> &categories); void setTextFormatCategories(const QList<std::pair<int, TextStyle>> &categories);
void reformatBlocks(int from, int charsRemoved, int charsAdded);
void delayedRehighlight(); void delayedRehighlight();
QScopedPointer<SyntaxHighlighterPrivate> d_ptr; QScopedPointer<SyntaxHighlighterPrivate> d_ptr;
std::atomic<bool> m_interrupted = false;
#ifdef WITH_TESTS #ifdef WITH_TESTS
friend class tst_highlighter; friend class tst_highlighter;

View File

@@ -35,11 +35,11 @@ public:
if (async) { if (async) {
m_document = new QTextDocument(this); m_document = new QTextDocument(this);
m_document->setDocumentLayout(new TextDocumentLayout(m_document)); m_document->setDocumentLayout(new TextDocumentLayout(m_document));
m_highlighter->setParent(m_document);
} else { } else {
m_document = document; m_document = document;
} }
m_highlighter->setParent(m_document);
m_highlighter->setDocument(m_document); m_highlighter->setDocument(m_document);
connect(m_highlighter, connect(m_highlighter,
@@ -66,45 +66,104 @@ public:
void setExtraFormats(const QMap<int, QList<QTextLayout::FormatRange>> &formatMap) void setExtraFormats(const QMap<int, QList<QTextLayout::FormatRange>> &formatMap)
{ {
QTC_ASSERT(m_highlighter, return);
for (auto it = formatMap.cbegin(); it != formatMap.cend(); ++it) for (auto it = formatMap.cbegin(); it != formatMap.cend(); ++it)
m_highlighter->setExtraFormats(m_document->findBlockByNumber(it.key()), it.value()); m_highlighter->setExtraFormats(m_document->findBlockByNumber(it.key()), it.value());
} }
void clearExtraFormats(const QList<int> &blockNumbers) void clearExtraFormats(const QList<int> &blockNumbers)
{ {
QTC_ASSERT(m_highlighter, return);
for (auto it = blockNumbers.cbegin(); it != blockNumbers.cend(); ++it) for (auto it = blockNumbers.cbegin(); it != blockNumbers.cend(); ++it)
m_highlighter->clearExtraFormats(m_document->findBlockByNumber(*it)); m_highlighter->clearExtraFormats(m_document->findBlockByNumber(*it));
} }
void clearAllExtraFormats() { m_highlighter->clearAllExtraFormats(); } void clearAllExtraFormats()
{
QTC_ASSERT(m_highlighter, return);
m_highlighter->clearAllExtraFormats();
}
void setFontSettings(const TextEditor::FontSettings &fontSettings) void setFontSettings(const TextEditor::FontSettings &fontSettings)
{ {
QTC_ASSERT(m_highlighter, return);
m_highlighter->setFontSettings(fontSettings); m_highlighter->setFontSettings(fontSettings);
rehighlight();
} }
void setDefinitionName(const QString &name) void setDefinitionName(const QString &name)
{ {
return m_highlighter->setDefinitionName(name); QTC_ASSERT(m_highlighter, return);
m_highlighter->setDefinitionName(name);
} }
void setLanguageFeaturesFlags(unsigned int flags) void setLanguageFeaturesFlags(unsigned int flags)
{ {
QTC_ASSERT(m_highlighter, return);
m_highlighter->setLanguageFeaturesFlags(flags); m_highlighter->setLanguageFeaturesFlags(flags);
} }
void setEnabled(bool enabled) { m_highlighter->setEnabled(enabled); } void setEnabled(bool enabled)
{
QTC_ASSERT(m_highlighter, return);
m_highlighter->setEnabled(enabled);
}
void rehighlight() { m_highlighter->rehighlight(); } void rehighlight()
{
QTC_ASSERT(m_highlighter, return);
m_highlighter->rehighlight();
}
SyntaxHighlighter *m_highlighter = nullptr; void reformatBlocks(int from, int charsRemoved, int charsAdded)
{
QTC_ASSERT(m_highlighter, return);
m_highlighter->reformatBlocks(from, charsRemoved, charsAdded);
}
void setInterrupted(bool interrupted)
{
QTC_ASSERT(m_highlighter, return);
m_highlighter->setInterrupted(interrupted);
}
QPointer<SyntaxHighlighter> m_highlighter = nullptr;
QTextDocument *m_document = nullptr; QTextDocument *m_document = nullptr;
signals: signals:
void resultsReady(const QList<SyntaxHighlighter::Result> &result); void resultsReady(const QList<SyntaxHighlighter::Result> &result);
}; };
void SyntaxHighlighterRunner::HighlightingStatus::notInterrupted(int from,
int charsRemoved,
int charsAdded)
{
m_from = from;
m_addedChars = charsAdded;
m_removedChars = charsRemoved;
m_current = from;
m_newFrom = from + m_addedChars;
m_interruptionRequested = false;
}
void SyntaxHighlighterRunner::HighlightingStatus::interrupted(int from,
int charsRemoved,
int charsAdded)
{
m_newFrom = std::min(m_newFrom, from);
m_newFrom = std::min(m_current, m_newFrom);
m_removedChars += charsRemoved;
m_addedChars += charsAdded;
m_interruptionRequested = true;
}
void SyntaxHighlighterRunner::HighlightingStatus::applyNewFrom()
{
m_from = m_newFrom;
m_current = m_newFrom;
m_interruptionRequested = false;
}
SyntaxHighlighterRunner::SyntaxHighlighterRunner(SyntaxHighlighter *highlighter, SyntaxHighlighterRunner::SyntaxHighlighterRunner(SyntaxHighlighter *highlighter,
QTextDocument *document, QTextDocument *document,
bool async) bool async)
@@ -124,8 +183,8 @@ SyntaxHighlighterRunner::SyntaxHighlighterRunner(SyntaxHighlighter *highlighter,
this, this,
&SyntaxHighlighterRunner::applyFormatRanges); &SyntaxHighlighterRunner::applyFormatRanges);
changeDocument(0, 0, document->characterCount()); changeDocument(0, 0, m_document->characterCount());
connect(document, connect(m_document,
&QTextDocument::contentsChange, &QTextDocument::contentsChange,
this, this,
&SyntaxHighlighterRunner::changeDocument); &SyntaxHighlighterRunner::changeDocument);
@@ -136,10 +195,15 @@ SyntaxHighlighterRunner::SyntaxHighlighterRunner(SyntaxHighlighter *highlighter,
&SyntaxHighlighterRunnerPrivate::resultsReady, &SyntaxHighlighterRunnerPrivate::resultsReady,
this, this,
[this](const QList<SyntaxHighlighter::Result> &result) { [this](const QList<SyntaxHighlighter::Result> &result) {
if (result.size() == 1
&& result.at(0).m_state == SyntaxHighlighter::State::Extras)
return;
auto done = std::find_if(result.cbegin(), auto done = std::find_if(result.cbegin(),
result.cend(), result.cend(),
[](const SyntaxHighlighter::Result &res) { [](const SyntaxHighlighter::Result &res) {
return res.m_state == SyntaxHighlighter::State::Done; return res.m_state
== SyntaxHighlighter::State::Done;
}); });
if (done != result.cend()) { if (done != result.cend()) {
m_syntaxInfoUpdated = SyntaxHighlighter::State::Done; m_syntaxInfoUpdated = SyntaxHighlighter::State::Done;
@@ -158,7 +222,6 @@ SyntaxHighlighterRunner::~SyntaxHighlighterRunner()
m_thread->quit(); m_thread->quit();
m_thread->wait(); m_thread->wait();
} else { } else {
delete d->m_highlighter;
delete d; delete d;
} }
} }
@@ -168,6 +231,34 @@ void SyntaxHighlighterRunner::applyFormatRanges(const QList<SyntaxHighlighter::R
if (m_document == nullptr) if (m_document == nullptr)
return; return;
if (m_highlightingStatus.m_interruptionRequested) {
d->setInterrupted(false);
m_highlightingStatus.applyNewFrom();
reformatBlocks(m_highlightingStatus.m_newFrom,
m_highlightingStatus.m_removedChars,
m_highlightingStatus.m_addedChars);
return;
}
auto processResult = [this](SyntaxHighlighter::Result result, QTextBlock docBlock) {
if (!docBlock.isValid())
return;
result.copyToBlock(docBlock);
m_highlightingStatus.m_current = docBlock.position() + docBlock.length() - 1;
if (result.m_formatRanges != docBlock.layout()->formats()) {
docBlock.layout()->setFormats(result.m_formatRanges);
m_document->markContentsDirty(docBlock.position(), docBlock.length());
}
};
if (results.size() == 1 && results.at(0).m_state == SyntaxHighlighter::State::Extras) {
QTextBlock docBlock = m_document->findBlockByNumber(results.at(0).m_blockNumber);
processResult(results.at(0), docBlock);
return;
}
for (const SyntaxHighlighter::Result &result : results) { for (const SyntaxHighlighter::Result &result : results) {
m_syntaxInfoUpdated = result.m_state; m_syntaxInfoUpdated = result.m_state;
if (m_syntaxInfoUpdated == SyntaxHighlighter::State::Start) { if (m_syntaxInfoUpdated == SyntaxHighlighter::State::Start) {
@@ -180,17 +271,8 @@ void SyntaxHighlighterRunner::applyFormatRanges(const QList<SyntaxHighlighter::R
return; return;
} }
QTextBlock docBlock = m_document->findBlock(result.m_blockNumber); QTextBlock docBlock = m_document->findBlockByNumber(result.m_blockNumber);
if (!docBlock.isValid()) processResult(result, docBlock);
return;
result.copyToBlock(docBlock);
if (result.m_formatRanges != docBlock.layout()->formats()) {
docBlock.layout()->setFormats(result.m_formatRanges);
m_document->markContentsDirty(docBlock.position(), docBlock.length());
}
if (m_syntaxInfoUpdated != SyntaxHighlighter::State::Extras)
m_foldValidator.process(docBlock); m_foldValidator.process(docBlock);
} }
} }
@@ -198,7 +280,9 @@ void SyntaxHighlighterRunner::applyFormatRanges(const QList<SyntaxHighlighter::R
void SyntaxHighlighterRunner::changeDocument(int from, int charsRemoved, int charsAdded) void SyntaxHighlighterRunner::changeDocument(int from, int charsRemoved, int charsAdded)
{ {
QTC_ASSERT(m_document, return); QTC_ASSERT(m_document, return);
SyntaxHighlighter::State prevSyntaxInfoUpdated = m_syntaxInfoUpdated;
m_syntaxInfoUpdated = SyntaxHighlighter::State::InProgress; m_syntaxInfoUpdated = SyntaxHighlighter::State::InProgress;
QMap<int, BlockPreeditData> blocksPreedit; QMap<int, BlockPreeditData> blocksPreedit;
QTextBlock block = m_document->findBlock(from); QTextBlock block = m_document->findBlock(from);
const QTextBlock endBlock = m_document->findBlock(from + charsAdded); const QTextBlock endBlock = m_document->findBlock(from + charsAdded);
@@ -213,6 +297,14 @@ void SyntaxHighlighterRunner::changeDocument(int from, int charsRemoved, int cha
QMetaObject::invokeMethod(d, [this, from, charsRemoved, text, blocksPreedit] { QMetaObject::invokeMethod(d, [this, from, charsRemoved, text, blocksPreedit] {
d->changeDocument(from, charsRemoved, text, blocksPreedit); d->changeDocument(from, charsRemoved, text, blocksPreedit);
}); });
if (prevSyntaxInfoUpdated == SyntaxHighlighter::State::InProgress) {
m_highlightingStatus.interrupted(from, charsRemoved, charsAdded);
d->setInterrupted(true);
} else {
m_highlightingStatus.notInterrupted(from, charsRemoved, charsAdded);
d->setInterrupted(false);
}
} }
bool SyntaxHighlighterRunner::useGenericHighlighter() const bool SyntaxHighlighterRunner::useGenericHighlighter() const
@@ -239,6 +331,7 @@ void SyntaxHighlighterRunner::clearAllExtraFormats()
void SyntaxHighlighterRunner::setFontSettings(const TextEditor::FontSettings &fontSettings) void SyntaxHighlighterRunner::setFontSettings(const TextEditor::FontSettings &fontSettings)
{ {
QMetaObject::invokeMethod(d, [this, fontSettings] { d->setFontSettings(fontSettings); }); QMetaObject::invokeMethod(d, [this, fontSettings] { d->setFontSettings(fontSettings); });
rehighlight();
} }
void SyntaxHighlighterRunner::setLanguageFeaturesFlags(unsigned int flags) void SyntaxHighlighterRunner::setLanguageFeaturesFlags(unsigned int flags)
@@ -253,7 +346,24 @@ void SyntaxHighlighterRunner::setEnabled(bool enabled)
void SyntaxHighlighterRunner::rehighlight() void SyntaxHighlighterRunner::rehighlight()
{ {
if (m_syntaxInfoUpdated == SyntaxHighlighter::State::InProgress) {
m_highlightingStatus.interrupted(0, 0, m_document->characterCount());
d->setInterrupted(true);
} else {
m_highlightingStatus.notInterrupted(0, 0, m_document->characterCount());
d->setInterrupted(false);
QMetaObject::invokeMethod(d, [this] { d->rehighlight(); }); QMetaObject::invokeMethod(d, [this] { d->rehighlight(); });
}
}
void SyntaxHighlighterRunner::reformatBlocks(int from, int charsRemoved, int charsAdded)
{
QMetaObject::invokeMethod(
d,
[this, from, charsRemoved, charsAdded] {
d->reformatBlocks(from, charsRemoved, charsAdded);
});
} }
QString SyntaxHighlighterRunner::definitionName() QString SyntaxHighlighterRunner::definitionName()

View File

@@ -34,6 +34,7 @@ public:
void setLanguageFeaturesFlags(unsigned int flags); void setLanguageFeaturesFlags(unsigned int flags);
void setEnabled(bool enabled); void setEnabled(bool enabled);
void rehighlight(); void rehighlight();
void reformatBlocks(int from, int charsRemoved, int charsAdded);
QString definitionName(); QString definitionName();
void setDefinitionName(const QString &name); void setDefinitionName(const QString &name);
@@ -53,6 +54,21 @@ private:
SyntaxHighlighterRunnerPrivate *d; SyntaxHighlighterRunnerPrivate *d;
QPointer<QTextDocument> m_document = nullptr; QPointer<QTextDocument> m_document = nullptr;
SyntaxHighlighter::State m_syntaxInfoUpdated = SyntaxHighlighter::State::Done; SyntaxHighlighter::State m_syntaxInfoUpdated = SyntaxHighlighter::State::Done;
struct HighlightingStatus
{
int m_from = 0;
int m_addedChars = 0;
int m_current = 0;
int m_removedChars = 0;
int m_newFrom = 0;
bool m_interruptionRequested = false;
void notInterrupted(int from, int charsRemoved, int charsAdded);
void interrupted(int from, int charsRemoved, int charsAdded);
void applyNewFrom();
} m_highlightingStatus;
bool m_useGenericHighlighter = false; bool m_useGenericHighlighter = false;
QString m_definitionName; QString m_definitionName;
std::optional<QThread> m_thread; std::optional<QThread> m_thread;

View File

@@ -914,19 +914,23 @@ bool TextDocument::reload(QString *errorString, ReloadFlag flag, ChangeType type
void TextDocument::resetSyntaxHighlighter(const std::function<SyntaxHighlighter *()> &creator, void TextDocument::resetSyntaxHighlighter(const std::function<SyntaxHighlighter *()> &creator,
bool threaded) bool threaded)
{ {
if (d->m_highlighterRunner)
delete d->m_highlighterRunner; delete d->m_highlighterRunner;
static const bool envValue static const std::optional<bool> envValue = []() -> std::optional<bool> {
= qtcEnvironmentVariable("QTC_USE_THREADED_HIGHLIGHTER", "TRUE").toUpper() const QString key("QTC_USE_THREADED_HIGHLIGHTER");
== QLatin1String("TRUE"); if (qtcEnvironmentVariableIsSet(key)) {
const QString value = qtcEnvironmentVariable(key).toUpper();
return value != "FALSE" && value != "0";
}
return {};
}();
SyntaxHighlighter *highlighter = creator(); SyntaxHighlighter *highlighter = creator();
highlighter->setFontSettings(TextEditorSettings::fontSettings()); highlighter->setFontSettings(TextEditorSettings::fontSettings());
highlighter->setMimeType(mimeType()); highlighter->setMimeType(mimeType());
d->m_highlighterRunner = new SyntaxHighlighterRunner(highlighter, d->m_highlighterRunner = new SyntaxHighlighterRunner(highlighter,
document(), document(),
threaded && envValue); envValue.value_or(threaded));
} }
void TextDocument::cleanWhitespace(const QTextCursor &cursor) void TextDocument::cleanWhitespace(const QTextCursor &cursor)

View File

@@ -127,7 +127,7 @@ public:
QTextDocument *document() const; QTextDocument *document() const;
using SyntaxHighLighterCreator = std::function<SyntaxHighlighter *()>; using SyntaxHighLighterCreator = std::function<SyntaxHighlighter *()>;
void resetSyntaxHighlighter(const SyntaxHighLighterCreator &creator, bool threaded = true); void resetSyntaxHighlighter(const SyntaxHighLighterCreator &creator, bool threaded = false);
SyntaxHighlighterRunner *syntaxHighlighterRunner() const; SyntaxHighlighterRunner *syntaxHighlighterRunner() const;
bool reload(QString *errorString, QTextCodec *codec); bool reload(QString *errorString, QTextCodec *codec);

View File

@@ -73,7 +73,7 @@ private:
TopArea *m_topArea; TopArea *m_topArea;
SideArea *m_sideArea; SideArea *m_sideArea;
QList<IWelcomePage *> m_pluginList; QList<IWelcomePage *> m_pluginList;
QList<QPushButton *> m_pageButtons; QList<QAbstractButton *> m_pageButtons;
QButtonGroup *m_buttonGroup; QButtonGroup *m_buttonGroup;
Id m_activePage; Id m_activePage;
Id m_defaultPage; Id m_defaultPage;
@@ -156,12 +156,16 @@ public:
using namespace Layouting; using namespace Layouting;
Column {
Row { Row {
ideIconLabel, ideIconLabel,
welcomeLabel, welcomeLabel,
st, st,
spacing(ExVPaddingGapXl), spacing(ExVPaddingGapXl),
customMargin({HPaddingM, VPaddingM, HPaddingM, VPaddingM}), customMargin({HPaddingM, VPaddingM, HPaddingM, VPaddingM}),
},
createRule(Qt::Horizontal),
noMargin(), spacing(0),
}.attachTo(this); }.attachTo(this);
} }
}; };
@@ -182,7 +186,7 @@ public:
using namespace Layouting; using namespace Layouting;
Column mainLayout { Column mainColumn {
spacing(0), spacing(0),
customMargin({ExVPaddingGapXl, 0, ExVPaddingGapXl, 0}), customMargin({ExVPaddingGapXl, 0, ExVPaddingGapXl, 0}),
}; };
@@ -224,8 +228,8 @@ public:
} }
essentials.attachTo(m_essentials); essentials.attachTo(m_essentials);
mainLayout.addItem(m_essentials); mainColumn.addItem(m_essentials);
mainLayout.addItem(st); mainColumn.addItem(st);
{ {
auto label = new Label(Tr::tr("Explore more"), Label::Secondary); auto label = new Label(Tr::tr("Explore more"), Label::Secondary);
@@ -263,10 +267,17 @@ public:
m_links = new QWidget; m_links = new QWidget;
linksLayout.attachTo(m_links); linksLayout.attachTo(m_links);
mainLayout.addItem(m_links); mainColumn.addItem(m_links);
} }
QWidget *mainWidget = mainLayout.emerge(); QWidget *mainWidget = new QWidget;
Row {
mainColumn,
createRule(Qt::Vertical),
noMargin(), spacing(0),
}.attachTo(mainWidget);
setWidget(mainWidget); setWidget(mainWidget);
} }
@@ -327,10 +338,8 @@ WelcomeMode::WelcomeMode()
Column { Column {
new StyledBar, new StyledBar,
m_topArea, m_topArea,
createRule(Qt::Horizontal),
Row { Row {
m_sideArea, m_sideArea,
createRule(Qt::Vertical),
m_pageStack, m_pageStack,
}, },
noMargin(), noMargin(),

View File

@@ -169,7 +169,8 @@ void f3(int parameter1, int parameter2, int parameter3);
void f3( void f3(
int parameter1, int parameter2, int parameter3, int parameter4, int parameter5, int parameter6); int parameter1, int parameter2, int parameter3, int parameter4, int parameter5, int parameter6);
void f3(int parameter1, void f3(
int parameter1,
int parameter2, int parameter2,
int parameter3, int parameter3,
int parameter4, int parameter4,
@@ -291,7 +292,8 @@ int functionToCall(
return 1; return 1;
} }
int functionToCall(int paramter1, int functionToCall(
int paramter1,
int parameter2, int parameter2,
int parameter3, int parameter3,
int parameter4, int parameter4,
@@ -327,23 +329,24 @@ void penaltyTests(bool isThatTrue)
const auto someValue10 = functionToCall(valueX, valueY, valueXTimesY); const auto someValue10 = functionToCall(valueX, valueY, valueXTimesY);
const auto someValue11 const auto someValue11
= functionToCall(valueX, valueY, valueXTimesY, unbelievableBigValue, unbelievableBigValue); = functionToCall(valueX, valueY, valueXTimesY, unbelievableBigValue, unbelievableBigValue);
const auto someValue12 = functionToCall(valueX, const auto someValue12 = functionToCall(
valueX,
valueY, valueY,
valueXTimesY, valueXTimesY,
unbelievableBigValue, unbelievableBigValue,
unbelievableBigValue * unbelievableBigValue, unbelievableBigValue * unbelievableBigValue,
unbelievableBigValue); unbelievableBigValue);
const auto someValue13 = functionToCall(valueX, const auto someValue13 = functionToCall(
valueX,
valueY, valueY,
valueXTimesY, valueXTimesY,
unbelievableBigValue, unbelievableBigValue,
functionToCall(functionToCall(valueX), functionToCall(functionToCall(valueX), functionToCall(valueY)),
functionToCall(valueY)),
unbelievableBigValue); unbelievableBigValue);
const auto someValue14WithAnOutstandingLongName const auto someValue14WithAnOutstandingLongName = functionToCall(
= functionToCall(valueX, valueX,
valueY, valueY,
valueXTimesY, valueXTimesY,
unbelievableBigValue, unbelievableBigValue,
@@ -354,17 +357,17 @@ void penaltyTests(bool isThatTrue)
const bool someValue21 = functionToCall(valueX, valueY, valueXTimesY) const bool someValue21 = functionToCall(valueX, valueY, valueXTimesY)
|| functionToCall(valueX, valueY); || functionToCall(valueX, valueY);
emitAddOutput(QCoreApplication::tr("Starting: \"%1\" %2") emitAddOutput(
QCoreApplication::tr("Starting: \"%1\" %2")
.arg("/some/very/very/very/very/long/path/to/an/executable", arguments), .arg("/some/very/very/very/very/long/path/to/an/executable", arguments),
functionToCall(3), functionToCall(3),
functionToCall(3) | valueX); functionToCall(3) | valueX);
emitAddOutput(QCoreApplication::tr("Starting: \"%1\" %2") emitAddOutput(
.arg("/some/very/very/very/very/long/path/to/an/executable", QCoreApplication::tr("Starting: \"%1\" %2")
argumentsVeryLong), .arg("/some/very/very/very/very/long/path/to/an/executable", argumentsVeryLong),
functionToCall(3), functionToCall(3),
functionToCall(3) | unlimitedValueunbelievableBigValue functionToCall(3) | unlimitedValueunbelievableBigValue | unlimitedValueunbelievableBigValue);
| unlimitedValueunbelievableBigValue);
const QString path; const QString path;
const bool someLongerNameNNNNNNNNNN const bool someLongerNameNNNNNNNNNN
@@ -400,7 +403,8 @@ public:
, data3(d2) , data3(d2)
{} {}
MyClass(int initialData1, MyClass(
int initialData1,
int initialData2, int initialData2,
int initialData3, int initialData3,
int initialData4, int initialData4,
@@ -636,20 +640,24 @@ void extremeFunction(
"super duper long"); "super duper long");
} }
void extremeFunction2(int parameter1, void extremeFunction2(
int parameter1,
int parameter2, int parameter2,
int parameter3WithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVerVeryVeryLong) int parameter3WithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVerVeryVeryLong)
{ {
extremeFunction2(parameter1, extremeFunction2(
parameter1,
parameter2, parameter2,
parameter3WithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVerVeryVeryLong); parameter3WithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVerVeryVeryLong);
} }
void extremeFunction3(int parameter1, void extremeFunction3(
int parameter1,
int parameter2, int parameter2,
int parameter3WithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVerVeryVeryLongNameX) int parameter3WithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVerVeryVeryLongNameX)
{ {
extremeFunction3(parameter1, extremeFunction3(
parameter1,
parameter2, parameter2,
parameter3WithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVerVeryVeryLongNameX); parameter3WithAVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVerVeryVeryLongNameX);
} }

View File

@@ -25,13 +25,21 @@ def toggleIssuesFilter(filterName, checked):
def getBuildIssues(ignoreCodeModel=True): def getBuildIssues(ignoreCodeModel=True):
# Heuristically determine whether the ClandCodeModel is loaded.
# The current implementation is inaccurate:
# The value may be "True" although the CCM was not loaded due to existing settings or
# insufficient memory. This would result in a slightly longer execution and false positive
# warnings. Since neither would cause an actual damage and a precise handling would require
# a bigger refactoring, this seems acceptable.
clangLoaded = " -noload ClangCodeModel" not in currentApplicationContext().commandLine
ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton" , silent=True) ensureChecked(":Qt Creator_Issues_Core::Internal::OutputPaneToggleButton" , silent=True)
model = waitForObject(":Qt Creator.Issues_QListView").model() model = waitForObject(":Qt Creator.Issues_QListView").model()
if ignoreCodeModel: if ignoreCodeModel and clangLoaded:
# filter out possible code model issues present inside the Issues pane # filter out possible code model issues present inside the Issues pane
toggleIssuesFilter("Clang Code Model", False) toggleIssuesFilter("Clang Code Model", False)
result = dumpBuildIssues(model) result = dumpBuildIssues(model)
if ignoreCodeModel: if ignoreCodeModel and clangLoaded:
# reset the filter # reset the filter
toggleIssuesFilter("Clang Code Model", True) toggleIssuesFilter("Clang Code Model", True)
return result return result

View File

@@ -6,7 +6,7 @@ def __childrenOfType__(parentObject, typeName):
def getWelcomeScreenSideBarButton(buttonLabel): def getWelcomeScreenSideBarButton(buttonLabel):
return ("{text='%s' type='QPushButton' unnamed='1' visible='1' " return ("{text='%s' type='QAbstractButton' unnamed='1' visible='1' "
"window=':Qt Creator_Core::Internal::MainWindow'}" % buttonLabel) "window=':Qt Creator_Core::Internal::MainWindow'}" % buttonLabel)