Can select temporary folder.

This commit is contained in:
NissimHadar 2019-01-22 17:14:48 -08:00
parent 5cffdafd22
commit 0728794e38
3 changed files with 32 additions and 3 deletions

View file

@ -93,7 +93,7 @@ void Nitpick::setup() {
if (_testRunnerMobile) { if (_testRunnerMobile) {
delete _testRunnerMobile; delete _testRunnerMobile;
} }
_testRunnerMobile = new TestRunnerMobile(); _testRunnerMobile = new TestRunnerMobile(_ui.workingFolderRunOnMobileLabel);
} }
void Nitpick::startTestsEvaluation(const bool isRunningFromCommandLine, void Nitpick::startTestsEvaluation(const bool isRunningFromCommandLine,
@ -324,4 +324,5 @@ void Nitpick::appendLogWindow(const QString& message) {
} }
void Nitpick::on_setWorkingFolderRunOnMobileButton_clicked() { void Nitpick::on_setWorkingFolderRunOnMobileButton_clicked() {
_testRunnerMobile->setWorkingFolder();
} }

View file

@ -16,8 +16,29 @@
#include "Nitpick.h" #include "Nitpick.h"
extern Nitpick* nitpick; extern Nitpick* nitpick;
TestRunnerMobile::TestRunnerMobile(QObject* parent) : QObject(parent) { TestRunnerMobile::TestRunnerMobile(QLabel* workingFolderLabel, QObject* parent) : QObject(parent) {
_workingFolderLabel = workingFolderLabel;
} }
TestRunnerMobile::~TestRunnerMobile() { TestRunnerMobile::~TestRunnerMobile() {
} }
void TestRunnerMobile::setWorkingFolder() {
// Everything will be written to this folder
QString previousSelection = _workingFolder;
QString parent = previousSelection.left(previousSelection.lastIndexOf('/'));
if (!parent.isNull() && parent.right(1) != "/") {
parent += "/";
}
_workingFolder = QFileDialog::getExistingDirectory(nullptr, "Please select a temporary folder for installation", parent,
QFileDialog::ShowDirsOnly);
// If user canceled then restore previous selection and return
if (_workingFolder == "") {
_workingFolder = previousSelection;
return;
}
_workingFolderLabel->setText(QDir::toNativeSeparators(_workingFolder));
}

View file

@ -10,12 +10,19 @@
#ifndef hifi_testRunnerMobile_h #ifndef hifi_testRunnerMobile_h
#define hifi_testRunnerMobile_h #define hifi_testRunnerMobile_h
#include <QLabel>
#include <QObject> #include <QObject>
class TestRunnerMobile : public QObject { class TestRunnerMobile : public QObject {
Q_OBJECT Q_OBJECT
public: public:
explicit TestRunnerMobile(QObject* parent = 0); explicit TestRunnerMobile(QLabel* workingFolderLabel, QObject* parent = 0);
~TestRunnerMobile(); ~TestRunnerMobile();
void setWorkingFolder();
private:
QLabel* _workingFolderLabel;
QString _workingFolder;
}; };
#endif #endif