Factored out Worker class.

This commit is contained in:
NissimHadar 2019-01-23 10:33:02 -08:00
parent b7a0fae00e
commit c25e493f20
4 changed files with 34 additions and 19 deletions

View file

@ -12,12 +12,31 @@
#define hifi_testRunner_h #define hifi_testRunner_h
#include <QLabel> #include <QLabel>
#include <QObject>
class Worker;
class TestRunner { class TestRunner {
public: public:
void setWorkingFolder(QLabel* workingFolderLabel); void setWorkingFolder(QLabel* workingFolderLabel);
private: protected:
QString _workingFolder; QString _workingFolder;
}; };
class Worker : public QObject {
Q_OBJECT
public:
void setCommandLine(const QString& commandLine);
public slots:
int runCommand();
signals:
void commandComplete();
private:
QString _commandLine;
};
#endif #endif

View file

@ -41,7 +41,7 @@ TestRunnerDesktop::TestRunnerDesktop(std::vector<QCheckBox*> dayCheckboxes,
_runNow = runNow; _runNow = runNow;
_installerThread = new QThread(); _installerThread = new QThread();
_installerWorker = new Worker(); _installerWorker = new InstallerWorker();
_installerWorker->moveToThread(_installerThread); _installerWorker->moveToThread(_installerThread);
_installerThread->start(); _installerThread->start();
@ -49,7 +49,7 @@ TestRunnerDesktop::TestRunnerDesktop(std::vector<QCheckBox*> dayCheckboxes,
connect(_installerWorker, SIGNAL(commandComplete()), this, SLOT(installationComplete())); connect(_installerWorker, SIGNAL(commandComplete()), this, SLOT(installationComplete()));
_interfaceThread = new QThread(); _interfaceThread = new QThread();
_interfaceWorker = new Worker(); _interfaceWorker = new InterfaceWorker();
_interfaceThread->start(); _interfaceThread->start();
_interfaceWorker->moveToThread(_interfaceThread); _interfaceWorker->moveToThread(_interfaceThread);

View file

@ -29,7 +29,8 @@ public:
QString url; QString url;
}; };
class Worker; class InterfaceWorker;
class InstallerWorker;
class TestRunnerDesktop : public QObject, public TestRunner { class TestRunnerDesktop : public QObject, public TestRunner {
Q_OBJECT Q_OBJECT
@ -109,7 +110,6 @@ private:
QDir _appDataFolder; QDir _appDataFolder;
QDir _savedAppDataFolder; QDir _savedAppDataFolder;
QString _workingFolder;
QString _installationFolder; QString _installationFolder;
QString _snapshotFolder; QString _snapshotFolder;
@ -136,26 +136,21 @@ private:
QThread* _installerThread; QThread* _installerThread;
QThread* _interfaceThread; QThread* _interfaceThread;
Worker* _installerWorker; InstallerWorker* _installerWorker;
Worker* _interfaceWorker; InterfaceWorker* _interfaceWorker;
BuildInformation _buildInformation; BuildInformation _buildInformation;
}; };
class Worker : public QObject { class InstallerWorker : public Worker {
Q_OBJECT Q_OBJECT
public:
void setCommandLine(const QString& commandLine);
public slots:
int runCommand();
signals: signals:
void commandComplete();
void startInstaller(); void startInstaller();
};
class InterfaceWorker : public Worker {
Q_OBJECT
signals:
void startInterface(); void startInterface();
private:
QString _commandLine;
}; };
#endif #endif

View file

@ -31,4 +31,5 @@ void TestRunnerMobile::setWorkingFolderAndEnableControls() {
} }
void TestRunnerMobile::readDevice() { void TestRunnerMobile::readDevice() {
} }