Merge remote-tracking branch 'origin/10.0'

Conflicts:
	src/plugins/python/pipsupport.cpp
	src/plugins/qtsupport/exampleslistmodel.cpp
	src/plugins/qtsupport/examplesparser.cpp
	tests/auto/examples/tst_examples.cpp

Change-Id: I00273622423fa99d41621969f6ecbbdaa0e18664
This commit is contained in:
Eike Ziller
2023-04-13 15:59:08 +02:00
97 changed files with 550 additions and 328 deletions

View File

@@ -18,6 +18,7 @@ add_qtc_plugin(Python
pythonrunconfiguration.cpp pythonrunconfiguration.h
pythonscanner.cpp pythonscanner.h
pythonsettings.cpp pythonsettings.h
pythontr.h
pythonutils.cpp pythonutils.h
pythonwizardpage.cpp pythonwizardpage.h
)

View File

@@ -156,20 +156,13 @@ Pip *Pip::instance(const FilePath &python)
return it.value();
}
QFuture<PipPackageInfo> Pip::info(const PipPackage &package)
{
return Utils::asyncRun(&Pip::infoImpl, this, package);
}
PipPackageInfo Pip::infoImpl(const PipPackage &package)
static PipPackageInfo infoImpl(const PipPackage &package, const FilePath &python)
{
PipPackageInfo result;
QtcProcess pip;
pip.setCommand(CommandLine(m_python, {"-m", "pip", "show", "-f", package.packageName}));
m_lock.lock();
pip.setCommand(CommandLine(python, {"-m", "pip", "show", "-f", package.packageName}));
pip.runBlocking();
m_lock.unlock();
QString fieldName;
QStringList data;
const QString pipOutput = pip.allOutput();
@@ -193,6 +186,11 @@ PipPackageInfo Pip::infoImpl(const PipPackage &package)
return result;
}
QFuture<PipPackageInfo> Pip::info(const PipPackage &package)
{
return Utils::asyncRun(infoImpl, package, m_python);
}
Pip::Pip(const Utils::FilePath &python)
: QObject(PythonPlugin::instance())
, m_python(python)

View File

@@ -55,9 +55,6 @@ public:
private:
Pip(const Utils::FilePath &python);
PipPackageInfo infoImpl(const PipPackage &package);
QMutex m_lock;
Utils::FilePath m_python;
};

View File

@@ -18,9 +18,11 @@
#include <projectexplorer/taskhub.h>
#include <utils/fsengine/fileiconprovider.h>
#include <utils/futuresynchronizer.h>
#include <utils/theme/theme.h>
using namespace ProjectExplorer;
using namespace Utils;
namespace Python::Internal {
@@ -36,6 +38,7 @@ public:
PySideBuildConfigurationFactory buildConfigFactory;
SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}};
PythonSettings settings;
FutureSynchronizer m_futureSynchronizer;
};
PythonPlugin::PythonPlugin()
@@ -54,6 +57,12 @@ PythonPlugin *PythonPlugin::instance()
return m_instance;
}
FutureSynchronizer *PythonPlugin::futureSynchronizer()
{
QTC_ASSERT(m_instance, return nullptr);
return &m_instance->d->m_futureSynchronizer;
}
void PythonPlugin::initialize()
{
d = new PythonPluginPrivate;
@@ -66,9 +75,9 @@ void PythonPlugin::initialize()
void PythonPlugin::extensionsInitialized()
{
// Add MIME overlay icons (these icons displayed at Project dock panel)
QString imageFile = Utils::creatorTheme()->imageFile(Utils::Theme::IconOverlayPro,
::Constants::FILEOVERLAY_PY);
Utils::FileIconProvider::registerIconOverlayForSuffix(imageFile, "py");
const QString imageFile = Utils::creatorTheme()->imageFile(Theme::IconOverlayPro,
::Constants::FILEOVERLAY_PY);
FileIconProvider::registerIconOverlayForSuffix(imageFile, "py");
TaskHub::addCategory(PythonErrorTaskCategory, "Python", true);
}

View File

@@ -5,6 +5,8 @@
#include <extensionsystem/iplugin.h>
namespace Utils { class FutureSynchronizer; }
namespace Python::Internal {
class PythonPlugin final : public ExtensionSystem::IPlugin
@@ -17,6 +19,7 @@ public:
~PythonPlugin() final;
static PythonPlugin *instance();
static Utils::FutureSynchronizer *futureSynchronizer();
private:
void initialize() final;

View File

@@ -9,6 +9,7 @@
#include "pysideuicextracompiler.h"
#include "pythonconstants.h"
#include "pythonlanguageclient.h"
#include "pythonplugin.h"
#include "pythonproject.h"
#include "pythonsettings.h"
#include "pythontr.h"
@@ -31,6 +32,7 @@
#include <utils/aspects.h>
#include <utils/fileutils.h>
#include <utils/futuresynchronizer.h>
#include <utils/layoutbuilder.h>
#include <utils/outputformatter.h>
#include <utils/theme/theme.h>
@@ -241,15 +243,12 @@ void PythonRunConfigurationPrivate::checkForPySide(const FilePath &python,
{
const PipPackage package(pySidePackageName);
QObject::disconnect(m_watcherConnection);
m_watcherConnection = QObject::connect(&m_watcher,
&QFutureWatcher<PipPackageInfo>::finished,
q,
[=]() {
handlePySidePackageInfo(m_watcher.result(),
python,
pySidePackageName);
});
m_watcher.setFuture(Pip::instance(python)->info(package));
m_watcherConnection = QObject::connect(&m_watcher, &QFutureWatcherBase::finished, q, [=] {
handlePySidePackageInfo(m_watcher.result(), python, pySidePackageName);
});
const auto future = Pip::instance(python)->info(package);
m_watcher.setFuture(future);
PythonPlugin::futureSynchronizer()->addFuture(future);
}
void PythonRunConfigurationPrivate::handlePySidePackageInfo(const PipPackageInfo &pySideInfo,