diff --git a/tools/nitpick/src/Nitpick.cpp b/tools/nitpick/src/Nitpick.cpp index dc9a6c605d..a21d2a1790 100644 --- a/tools/nitpick/src/Nitpick.cpp +++ b/tools/nitpick/src/Nitpick.cpp @@ -93,7 +93,7 @@ void Nitpick::setup() { if (_testRunnerMobile) { delete _testRunnerMobile; } - _testRunnerMobile = new TestRunnerMobile(); + _testRunnerMobile = new TestRunnerMobile(_ui.workingFolderRunOnMobileLabel); } void Nitpick::startTestsEvaluation(const bool isRunningFromCommandLine, @@ -324,4 +324,5 @@ void Nitpick::appendLogWindow(const QString& message) { } void Nitpick::on_setWorkingFolderRunOnMobileButton_clicked() { + _testRunnerMobile->setWorkingFolder(); } diff --git a/tools/nitpick/src/TestRunnerMobile.cpp b/tools/nitpick/src/TestRunnerMobile.cpp index 85bd122a69..0d02634484 100644 --- a/tools/nitpick/src/TestRunnerMobile.cpp +++ b/tools/nitpick/src/TestRunnerMobile.cpp @@ -16,8 +16,29 @@ #include "Nitpick.h" extern Nitpick* nitpick; -TestRunnerMobile::TestRunnerMobile(QObject* parent) : QObject(parent) { +TestRunnerMobile::TestRunnerMobile(QLabel* workingFolderLabel, QObject* parent) : QObject(parent) { + _workingFolderLabel = workingFolderLabel; } 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)); +} \ No newline at end of file diff --git a/tools/nitpick/src/TestRunnerMobile.h b/tools/nitpick/src/TestRunnerMobile.h index 50e17b64b9..368d6188c5 100644 --- a/tools/nitpick/src/TestRunnerMobile.h +++ b/tools/nitpick/src/TestRunnerMobile.h @@ -10,12 +10,19 @@ #ifndef hifi_testRunnerMobile_h #define hifi_testRunnerMobile_h +#include #include class TestRunnerMobile : public QObject { Q_OBJECT public: - explicit TestRunnerMobile(QObject* parent = 0); + explicit TestRunnerMobile(QLabel* workingFolderLabel, QObject* parent = 0); ~TestRunnerMobile(); + + void setWorkingFolder(); + +private: + QLabel* _workingFolderLabel; + QString _workingFolder; }; #endif