forked from qt-creator/qt-creator
Python: Remove pluginInstance() and convert users
Change-Id: I43179961cdee855b710fc082568a7d0d9a0f0719 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include "pyside.h"
|
||||
|
||||
#include "pipsupport.h"
|
||||
#include "pythonplugin.h"
|
||||
#include "pythontr.h"
|
||||
#include "pythonutils.h"
|
||||
|
||||
@@ -36,23 +35,17 @@ namespace Python::Internal {
|
||||
|
||||
const char installPySideInfoBarId[] = "Python::InstallPySide";
|
||||
|
||||
PySideInstaller *PySideInstaller::instance()
|
||||
{
|
||||
static PySideInstaller *instance = new PySideInstaller; // FIXME: Leaks.
|
||||
return instance;
|
||||
}
|
||||
|
||||
void PySideInstaller::checkPySideInstallation(const FilePath &python,
|
||||
TextEditor::TextDocument *document)
|
||||
{
|
||||
document->infoBar()->removeInfo(installPySideInfoBarId);
|
||||
if (QPointer<QFutureWatcher<bool>> watcher = instance()->m_futureWatchers.value(document))
|
||||
if (QPointer<QFutureWatcher<bool>> watcher = pySideInstaller().m_futureWatchers.value(document))
|
||||
watcher->cancel();
|
||||
if (!python.exists())
|
||||
return;
|
||||
const QString pySide = importedPySide(document->plainText());
|
||||
if (pySide == "PySide2" || pySide == "PySide6")
|
||||
instance()->runPySideChecker(python, pySide, document);
|
||||
pySideInstaller().runPySideChecker(python, pySide, document);
|
||||
}
|
||||
|
||||
bool PySideInstaller::missingPySideInstallation(const FilePath &pythonPath,
|
||||
@@ -80,9 +73,7 @@ QString PySideInstaller::importedPySide(const QString &text)
|
||||
return match.captured(2);
|
||||
}
|
||||
|
||||
PySideInstaller::PySideInstaller()
|
||||
: QObject(pluginInstance())
|
||||
{}
|
||||
PySideInstaller::PySideInstaller() = default;
|
||||
|
||||
void PySideInstaller::installPyside(const FilePath &python,
|
||||
const QString &pySide,
|
||||
@@ -228,4 +219,10 @@ void PySideInstaller::runPySideChecker(const FilePath &python,
|
||||
m_futureWatchers[document] = watcher;
|
||||
}
|
||||
|
||||
PySideInstaller &pySideInstaller()
|
||||
{
|
||||
static PySideInstaller thePySideInstaller;
|
||||
return thePySideInstaller;
|
||||
}
|
||||
|
||||
} // Python::Internal
|
||||
|
||||
Reference in New Issue
Block a user