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