mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:49: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() {
|
void Nitpick::on_setWorkingFolderRunOnDesktopButton_clicked() {
|
||||||
_testRunnerDesktop->setWorkingFolder();
|
_testRunnerDesktop->setWorkingFolderAndEnableControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Nitpick::enableRunTabControls() {
|
void Nitpick::enableRunTabControls() {
|
||||||
|
@ -324,7 +324,7 @@ void Nitpick::appendLogWindow(const QString& message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Nitpick::on_setWorkingFolderRunOnMobileButton_clicked() {
|
void Nitpick::on_setWorkingFolderRunOnMobileButton_clicked() {
|
||||||
_testRunnerMobile->setWorkingFolder();
|
_testRunnerMobile->setWorkingFolderAndEnableControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Nitpick::on_readDeviceButton_clicked() {
|
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() {
|
void TestRunnerDesktop::setWorkingFolderAndEnableControls() {
|
||||||
// Everything will be written to this folder
|
setWorkingFolder(_workingFolderLabel);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
_installationFolder = _workingFolder + "/High Fidelity";
|
_installationFolder = _workingFolder + "/High Fidelity";
|
||||||
|
@ -95,7 +81,6 @@ void TestRunnerDesktop::setWorkingFolder() {
|
||||||
_logFile.setFileName(_workingFolder + "/log.txt");
|
_logFile.setFileName(_workingFolder + "/log.txt");
|
||||||
|
|
||||||
nitpick->enableRunTabControls();
|
nitpick->enableRunTabControls();
|
||||||
_workingFolderLabel->setText(QDir::toNativeSeparators(_workingFolder));
|
|
||||||
|
|
||||||
_timer = new QTimer(this);
|
_timer = new QTimer(this);
|
||||||
connect(_timer, SIGNAL(timeout()), this, SLOT(checkTime()));
|
connect(_timer, SIGNAL(timeout()), this, SLOT(checkTime()));
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include <QTimeEdit>
|
#include <QTimeEdit>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include "TestRunner.h"
|
||||||
|
|
||||||
class BuildInformation {
|
class BuildInformation {
|
||||||
public:
|
public:
|
||||||
QString build;
|
QString build;
|
||||||
|
@ -29,7 +31,7 @@ public:
|
||||||
|
|
||||||
class Worker;
|
class Worker;
|
||||||
|
|
||||||
class TestRunnerDesktop : public QObject {
|
class TestRunnerDesktop : public QObject, public TestRunner {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit TestRunnerDesktop(std::vector<QCheckBox*> dayCheckboxes,
|
explicit TestRunnerDesktop(std::vector<QCheckBox*> dayCheckboxes,
|
||||||
|
@ -44,7 +46,7 @@ public:
|
||||||
|
|
||||||
~TestRunnerDesktop();
|
~TestRunnerDesktop();
|
||||||
|
|
||||||
void setWorkingFolder();
|
void setWorkingFolderAndEnableControls();
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
|
|
|
@ -24,24 +24,8 @@ TestRunnerMobile::TestRunnerMobile(QLabel* workingFolderLabel, QPushButton *read
|
||||||
TestRunnerMobile::~TestRunnerMobile() {
|
TestRunnerMobile::~TestRunnerMobile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestRunnerMobile::setWorkingFolder() {
|
void TestRunnerMobile::setWorkingFolderAndEnableControls() {
|
||||||
// Everything will be written to this folder
|
setWorkingFolder(_workingFolderLabel);
|
||||||
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));
|
|
||||||
|
|
||||||
_readDeviceButton->setEnabled(true);
|
_readDeviceButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,17 +10,20 @@
|
||||||
|
|
||||||
#ifndef hifi_testRunnerMobile_h
|
#ifndef hifi_testRunnerMobile_h
|
||||||
#define hifi_testRunnerMobile_h
|
#define hifi_testRunnerMobile_h
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
|
||||||
class TestRunnerMobile : public QObject {
|
#include "TestRunner.h"
|
||||||
|
|
||||||
|
class TestRunnerMobile : public QObject, public TestRunner {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit TestRunnerMobile(QLabel* workingFolderLabel, QPushButton *readDeviceButton, QObject* parent = 0);
|
explicit TestRunnerMobile(QLabel* workingFolderLabel, QPushButton *readDeviceButton, QObject* parent = 0);
|
||||||
~TestRunnerMobile();
|
~TestRunnerMobile();
|
||||||
|
|
||||||
void setWorkingFolder();
|
void setWorkingFolderAndEnableControls();
|
||||||
void readDevice();
|
void readDevice();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue