mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-07 10:02:24 +02:00
Added common class to simplify code.
This commit is contained in:
parent
089c71b047
commit
b7a0fae00e
7 changed files with 70 additions and 41 deletions
|
@ -165,7 +165,7 @@ void Nitpick::on_createTestRailRunButton_clicked() {
|
|||
}
|
||||
|
||||
void Nitpick::on_setWorkingFolderRunOnDesktopButton_clicked() {
|
||||
_testRunnerDesktop->setWorkingFolder();
|
||||
_testRunnerDesktop->setWorkingFolderAndEnableControls();
|
||||
}
|
||||
|
||||
void Nitpick::enableRunTabControls() {
|
||||
|
@ -324,7 +324,7 @@ void Nitpick::appendLogWindow(const QString& message) {
|
|||
}
|
||||
|
||||
void Nitpick::on_setWorkingFolderRunOnMobileButton_clicked() {
|
||||
_testRunnerMobile->setWorkingFolder();
|
||||
_testRunnerMobile->setWorkingFolderAndEnableControls();
|
||||
}
|
||||
|
||||
void Nitpick::on_readDeviceButton_clicked() {
|
||||
|
|
32
tools/nitpick/src/TestRunner.cpp
Normal file
32
tools/nitpick/src/TestRunner.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// TestRunner.cpp
|
||||
//
|
||||
// Created by Nissim Hadar on 23 Jan 2019.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include "TestRunner.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
void TestRunner::setWorkingFolder(QLabel* workingFolderLabel) {
|
||||
// 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 working folder for temporary files", parent,
|
||||
QFileDialog::ShowDirsOnly);
|
||||
|
||||
// If user canceled then restore previous selection and return
|
||||
if (_workingFolder == "") {
|
||||
_workingFolder = previousSelection;
|
||||
return;
|
||||
}
|
||||
|
||||
workingFolderLabel->setText(QDir::toNativeSeparators(_workingFolder));
|
||||
}
|
23
tools/nitpick/src/TestRunner.h
Normal file
23
tools/nitpick/src/TestRunner.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// TestRunner.h
|
||||
//
|
||||
// Created by Nissim Hadar on 23 Jan 2019.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_testRunner_h
|
||||
#define hifi_testRunner_h
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
class TestRunner {
|
||||
public:
|
||||
void setWorkingFolder(QLabel* workingFolderLabel);
|
||||
|
||||
private:
|
||||
QString _workingFolder;
|
||||
};
|
||||
#endif
|
|
@ -69,22 +69,8 @@ TestRunnerDesktop::~TestRunnerDesktop() {
|
|||
}
|
||||
}
|
||||
|
||||
void TestRunnerDesktop::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;
|
||||
}
|
||||
void TestRunnerDesktop::setWorkingFolderAndEnableControls() {
|
||||
setWorkingFolder(_workingFolderLabel);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
_installationFolder = _workingFolder + "/High Fidelity";
|
||||
|
@ -95,7 +81,6 @@ void TestRunnerDesktop::setWorkingFolder() {
|
|||
_logFile.setFileName(_workingFolder + "/log.txt");
|
||||
|
||||
nitpick->enableRunTabControls();
|
||||
_workingFolderLabel->setText(QDir::toNativeSeparators(_workingFolder));
|
||||
|
||||
_timer = new QTimer(this);
|
||||
connect(_timer, SIGNAL(timeout()), this, SLOT(checkTime()));
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include <QTimeEdit>
|
||||
#include <QTimer>
|
||||
|
||||
#include "TestRunner.h"
|
||||
|
||||
class BuildInformation {
|
||||
public:
|
||||
QString build;
|
||||
|
@ -29,7 +31,7 @@ public:
|
|||
|
||||
class Worker;
|
||||
|
||||
class TestRunnerDesktop : public QObject {
|
||||
class TestRunnerDesktop : public QObject, public TestRunner {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TestRunnerDesktop(std::vector<QCheckBox*> dayCheckboxes,
|
||||
|
@ -44,7 +46,7 @@ public:
|
|||
|
||||
~TestRunnerDesktop();
|
||||
|
||||
void setWorkingFolder();
|
||||
void setWorkingFolderAndEnableControls();
|
||||
|
||||
void run();
|
||||
|
||||
|
|
|
@ -24,24 +24,8 @@ TestRunnerMobile::TestRunnerMobile(QLabel* workingFolderLabel, QPushButton *read
|
|||
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 working folder for temporary files", parent,
|
||||
QFileDialog::ShowDirsOnly);
|
||||
|
||||
// If user canceled then restore previous selection and return
|
||||
if (_workingFolder == "") {
|
||||
_workingFolder = previousSelection;
|
||||
return;
|
||||
}
|
||||
|
||||
_workingFolderLabel->setText(QDir::toNativeSeparators(_workingFolder));
|
||||
void TestRunnerMobile::setWorkingFolderAndEnableControls() {
|
||||
setWorkingFolder(_workingFolderLabel);
|
||||
|
||||
_readDeviceButton->setEnabled(true);
|
||||
}
|
||||
|
|
|
@ -10,17 +10,20 @@
|
|||
|
||||
#ifndef hifi_testRunnerMobile_h
|
||||
#define hifi_testRunnerMobile_h
|
||||
|
||||
#include <QLabel>
|
||||
#include <QObject>
|
||||
#include <QPushButton>
|
||||
|
||||
class TestRunnerMobile : public QObject {
|
||||
#include "TestRunner.h"
|
||||
|
||||
class TestRunnerMobile : public QObject, public TestRunner {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TestRunnerMobile(QLabel* workingFolderLabel, QPushButton *readDeviceButton, QObject* parent = 0);
|
||||
~TestRunnerMobile();
|
||||
|
||||
void setWorkingFolder();
|
||||
void setWorkingFolderAndEnableControls();
|
||||
void readDevice();
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue