Merge remote-tracking branch 'origin/11.0'

Change-Id: I2e0e8dd5f9b42533c665255f8539e837938846de
This commit is contained in:
Eike Ziller
2023-07-13 08:28:42 +02:00
39 changed files with 157 additions and 109 deletions

View File

@@ -1545,7 +1545,7 @@ CheckableDecider BoolAspect::askAgainCheckableDecider()
{
return CheckableDecider(
[this] { return value(); },
[this] { setValue(true); }
[this] { setValue(false); }
);
}

View File

@@ -34,7 +34,7 @@ public:
private:
CppEditor::SymbolFinder m_symbolFinder;
QString m_className;
const CPlusPlus::Snapshot &m_snapshot;
CPlusPlus::Snapshot m_snapshot;
QMap<QString, QtTestCodeLocationAndType> m_privSlots;
bool m_valid = false;
bool m_inherited = false;

View File

@@ -93,7 +93,7 @@ void TestCodeParser::syncTestFrameworks(const QList<ITestParser *> &parsers)
{
if (m_parserState != Idle) {
// there's a running parse
m_postponedUpdateType = UpdateType::NoUpdate;
m_postponedUpdateType = UpdateType::FullUpdate;
m_postponedFiles.clear();
ProgressManager::cancelTasks(Constants::TASK_PARSE);
}

View File

@@ -4,7 +4,9 @@
#include "testprojectsettings.h"
#include "autotestconstants.h"
#include "testcodeparser.h"
#include "testframeworkmanager.h"
#include "testtreemodel.h"
#include <projectexplorer/project.h>
#include <projectexplorer/projectmanager.h>
@@ -49,7 +51,9 @@ void TestProjectSettings::activateFramework(const Id &id, bool activate)
{
ITestFramework *framework = TestFrameworkManager::frameworkForId(id);
m_activeTestFrameworks[framework] = activate;
if (!activate)
if (TestTreeModel::instance()->parser()->isParsing())
framework->rootNode()->markForRemoval(!activate);
else if (!activate)
framework->resetRootNode();
}

View File

@@ -214,12 +214,16 @@ bool TestTreeItem::modifyLineAndColumn(const TestParseResult *result)
void TestTreeItem::markForRemoval(bool mark)
{
m_status = mark ? MarkedForRemoval : Cleared;
if (type() == Root)
m_status = mark ? ForcedRootRemoval : NewlyAdded;
else
m_status = mark ? MarkedForRemoval : Cleared;
}
void TestTreeItem::markForRemovalRecursively(bool mark)
{
markForRemoval(mark);
if (type() != Root)
markForRemoval(mark);
for (int row = 0, count = childCount(); row < count; ++row)
childItem(row)->markForRemovalRecursively(mark);
}
@@ -231,7 +235,8 @@ void TestTreeItem::markForRemovalRecursively(const QSet<FilePath> &filePaths)
child->markForRemovalRecursively(filePaths);
mark &= child->markedForRemoval();
});
markForRemoval(mark);
if (type() != Root)
markForRemoval(mark);
}
TestTreeItem *TestTreeItem::childItem(int at) const

View File

@@ -167,6 +167,7 @@ private:
{
NewlyAdded,
MarkedForRemoval,
ForcedRootRemoval, // only valid on rootNode
Cleared
};

View File

@@ -485,6 +485,10 @@ void TestTreeModel::markForRemoval(const QSet<Utils::FilePath> &filePaths)
void TestTreeModel::sweep()
{
for (TestTreeItem *frameworkRoot : frameworkRootNodes()) {
if (frameworkRoot->m_status == TestTreeItem::ForcedRootRemoval) {
frameworkRoot->framework()->resetRootNode();
continue;
}
sweepChildren(frameworkRoot);
revalidateCheckState(frameworkRoot);
}

View File

@@ -143,6 +143,7 @@ const char G_HELP[] = "QtCreator.Group.Help";
// File menu groups
const char G_FILE_NEW[] = "QtCreator.Group.File.New";
const char G_FILE_OPEN[] = "QtCreator.Group.File.Open";
const char G_FILE_SESSION[] = "QtCreator.Group.File.Recent";
const char G_FILE_PROJECT[] = "QtCreator.Group.File.Project";
const char G_FILE_SAVE[] = "QtCreator.Group.File.Save";
const char G_FILE_EXPORT[] = "QtCreator.Group.File.Export";

View File

@@ -473,6 +473,7 @@ void MainWindow::registerDefaultContainers()
filemenu->menu()->setTitle(Tr::tr("&File"));
filemenu->appendGroup(Constants::G_FILE_NEW);
filemenu->appendGroup(Constants::G_FILE_OPEN);
filemenu->appendGroup(Constants::G_FILE_SESSION);
filemenu->appendGroup(Constants::G_FILE_PROJECT);
filemenu->appendGroup(Constants::G_FILE_SAVE);
filemenu->appendGroup(Constants::G_FILE_EXPORT);

View File

@@ -100,7 +100,7 @@ SessionManager::SessionManager()
ActionContainer *msession = ActionManager::createMenu(M_SESSION);
msession->menu()->setTitle(PE::Tr::tr("S&essions"));
msession->setOnAllDisabledBehavior(ActionContainer::Show);
mfile->addMenu(msession, Core::Constants::G_FILE_OPEN);
mfile->addMenu(msession, Core::Constants::G_FILE_SESSION);
sb_d->m_sessionMenu = msession->menu();
connect(mfile->menu(), &QMenu::aboutToShow, this, [] { sb_d->updateSessionMenu(); });

View File

@@ -89,9 +89,7 @@ void updateMCUProjectTree(ProjectExplorer::Project *p)
auto qmlProjectNode = std::make_unique<McuQmlProjectNode>(FilePath(node->filePath()),
inputsJsonFile);
auto qmlProjectNodePtr = qmlProjectNode.get();
const_cast<ProjectNode *>(node)->addNode(std::move(qmlProjectNode));
ProjectExplorer::ProjectTree::emitSubtreeChanged(qmlProjectNodePtr);
const_cast<ProjectNode *>(node)->replaceSubtree(nullptr, std::move(qmlProjectNode));
});
};

View File

@@ -183,7 +183,7 @@ QList<ProjectExplorer::BuildTargetInfo> MesonProjectParser::appsTargets() const
if (target.type == Target::Type::executable) {
ProjectExplorer::BuildTargetInfo bti;
bti.displayName = target.name;
bti.buildKey = Target::fullName(m_srcDir, target);
bti.buildKey = Target::fullName(m_buildDir, target);
bti.displayNameUniquifier = bti.buildKey;
bti.targetFilePath = Utils::FilePath::fromString(target.fileName.first());
bti.workingDirectory = Utils::FilePath::fromString(target.fileName.first()).absolutePath();
@@ -237,7 +237,7 @@ void MesonProjectParser::update(const QFuture<MesonProjectParser::ParserData *>
m_rootNode = std::move(parserData->rootNode);
m_targetsNames.clear();
for (const Target &target : m_parserResult.targets) {
m_targetsNames.push_back(Target::fullName(m_srcDir, target));
m_targetsNames.push_back(Target::fullName(m_buildDir, target));
}
addMissingTargets(m_targetsNames);
m_targetsNames.sort();
@@ -253,7 +253,7 @@ ProjectExplorer::RawProjectPart MesonProjectParser::buildRawPart(
{
ProjectExplorer::RawProjectPart part;
part.setDisplayName(target.name);
part.setBuildSystemTarget(Target::fullName(m_srcDir, target));
part.setBuildSystemTarget(Target::fullName(m_buildDir, target));
part.setFiles(sources.sources + sources.generatedSources);
auto flags = splitArgs(sources.parameters);
part.setMacros(flags.macros);

View File

@@ -60,15 +60,17 @@ struct Target
const std::optional<QString> subproject;
const SourceGroupList sources;
static inline QString fullName(const Utils::FilePath &srcDir, const Target &target)
static inline QString fullName(const Utils::FilePath &buildDir, const Target &target)
{
using namespace Utils;
if (FilePath::fromString((target.fileName.first())).isAbsolutePath()) {
const auto fname = target.fileName.first().split('/').last();
QString definedIn = FilePath::fromString(target.definedIn).absolutePath().toString();
return definedIn.remove(srcDir.toString()) + '/' + fname;
auto fname = target.fileName.first();
if (FilePath::fromString(fname).isAbsolutePath()) {
fname.remove(buildDir.toString());
if (fname.startsWith('/'))
fname.remove(0, 1);
return fname;
} else {
return target.fileName.first();
return fname;
}
}