forked from qt-creator/qt-creator
Squish: Move ownership of SquishTools into plugin
Change-Id: I9b5ed4ea37c2945642d644ec672f6e8cd2986c29 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -46,16 +46,10 @@ static SquishFileHandler *m_instance = nullptr;
|
||||
|
||||
SquishFileHandler::SquishFileHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_squishTools(new SquishTools)
|
||||
{
|
||||
m_instance = this;
|
||||
}
|
||||
|
||||
SquishFileHandler::~SquishFileHandler()
|
||||
{
|
||||
delete m_squishTools;
|
||||
}
|
||||
|
||||
SquishFileHandler *SquishFileHandler::instance()
|
||||
{
|
||||
if (!m_instance)
|
||||
@@ -154,7 +148,7 @@ void SquishFileHandler::runTestCase(const QString &suiteName, const QString &tes
|
||||
{
|
||||
QTC_ASSERT(!suiteName.isEmpty() && !testCaseName.isEmpty(), return );
|
||||
|
||||
if (m_squishTools->state() != SquishTools::Idle)
|
||||
if (SquishTools::instance()->state() != SquishTools::Idle)
|
||||
return;
|
||||
|
||||
const QDir suitePath = QFileInfo(m_suites.value(suiteName)).absoluteDir();
|
||||
@@ -168,14 +162,14 @@ void SquishFileHandler::runTestCase(const QString &suiteName, const QString &tes
|
||||
return;
|
||||
}
|
||||
|
||||
m_squishTools->runTestCases(suitePath.absolutePath(), QStringList(testCaseName));
|
||||
SquishTools::instance()->runTestCases(suitePath.absolutePath(), QStringList(testCaseName));
|
||||
}
|
||||
|
||||
void SquishFileHandler::runTestSuite(const QString &suiteName)
|
||||
{
|
||||
QTC_ASSERT(!suiteName.isEmpty(), return );
|
||||
|
||||
if (m_squishTools->state() != SquishTools::Idle)
|
||||
if (SquishTools::instance()->state() != SquishTools::Idle)
|
||||
return;
|
||||
|
||||
const QString suiteConf = m_suites.value(suiteName);
|
||||
@@ -190,7 +184,7 @@ void SquishFileHandler::runTestSuite(const QString &suiteName)
|
||||
}
|
||||
|
||||
QStringList testCases = SquishTestTreeModel::instance()->getSelectedSquishTestCases(suiteConf);
|
||||
m_squishTools->runTestCases(suitePath.absolutePath(), testCases);
|
||||
SquishTools::instance()->runTestCases(suitePath.absolutePath(), testCases);
|
||||
}
|
||||
|
||||
void addAllEntriesRecursively(SquishTestTreeItem *item)
|
||||
|
@@ -34,14 +34,12 @@
|
||||
namespace Squish {
|
||||
namespace Internal {
|
||||
|
||||
class SquishTools;
|
||||
|
||||
class SquishFileHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SquishFileHandler(QObject *parent = nullptr);
|
||||
~SquishFileHandler() override;
|
||||
~SquishFileHandler() override = default;
|
||||
static SquishFileHandler *instance();
|
||||
void openTestSuites();
|
||||
void closeTestSuite(const QString &suiteName);
|
||||
@@ -62,7 +60,6 @@ signals:
|
||||
private:
|
||||
QMap<QString, QString> m_suites;
|
||||
QStringList m_sharedFolders;
|
||||
SquishTools *m_squishTools;
|
||||
|
||||
void modifySuiteItem(const QString &suiteName,
|
||||
const QString &filePath,
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "squishoutputpane.h"
|
||||
#include "squishsettings.h"
|
||||
#include "squishtesttreemodel.h"
|
||||
#include "squishtools.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
@@ -54,6 +55,7 @@ SquishPlugin::~SquishPlugin()
|
||||
delete m_objectsMapEditorFactory;
|
||||
delete m_navigationWidgetFactory;
|
||||
delete m_outputPane;
|
||||
delete m_squishTools;
|
||||
}
|
||||
|
||||
SquishPlugin *SquishPlugin::instance()
|
||||
@@ -74,6 +76,7 @@ bool SquishPlugin::initialize(const QStringList &arguments, QString *errorString
|
||||
Q_UNUSED(errorString)
|
||||
|
||||
m_squishSettings.readSettings(ICore::settings());
|
||||
m_squishTools = new SquishTools;
|
||||
|
||||
initializeMenuEntries();
|
||||
|
||||
|
@@ -38,6 +38,7 @@ class ObjectsMapEditorFactory;
|
||||
class SquishNavigationWidgetFactory;
|
||||
class SquishOutputPane;
|
||||
class SquishTestTreeModel;
|
||||
class SquishTools;
|
||||
|
||||
class SquishPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
@@ -59,7 +60,8 @@ public:
|
||||
private:
|
||||
void initializeMenuEntries();
|
||||
|
||||
SquishTestTreeModel *m_treeModel;
|
||||
SquishTools * m_squishTools = nullptr;
|
||||
SquishTestTreeModel *m_treeModel = nullptr;
|
||||
SquishSettings m_squishSettings;
|
||||
|
||||
SquishSettingsPage m_settingsPage{&m_squishSettings};
|
||||
|
Reference in New Issue
Block a user