mirror of
https://github.com/overte-org/overte.git
synced 2025-07-26 02:12:14 +02:00
add BakeWidget, leverage for skybox widget cancellation
This commit is contained in:
parent
8a1eb5f077
commit
95e2cc4eea
8 changed files with 90 additions and 79 deletions
46
tools/oven/src/ui/BakeWidget.cpp
Normal file
46
tools/oven/src/ui/BakeWidget.cpp
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
//
|
||||||
|
// BakeWidget.cpp
|
||||||
|
// tools/oven/src/ui
|
||||||
|
//
|
||||||
|
// Created by Stephen Birarda on 4/17/17.
|
||||||
|
// Copyright 2017 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 <QtWidgets/QStackedWidget>
|
||||||
|
|
||||||
|
#include "../Oven.h"
|
||||||
|
#include "OvenMainWindow.h"
|
||||||
|
|
||||||
|
#include "BakeWidget.h"
|
||||||
|
|
||||||
|
BakeWidget::BakeWidget(QWidget* parent, Qt::WindowFlags flags) :
|
||||||
|
QWidget(parent, flags)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BakeWidget::~BakeWidget() {
|
||||||
|
// if we're going down, our bakers are about to too
|
||||||
|
// enumerate them, send a cancelled status to the results table, and remove them
|
||||||
|
auto it = _bakers.begin();
|
||||||
|
while (it != _bakers.end()) {
|
||||||
|
auto resultRow = it->second;
|
||||||
|
auto resultsWindow = qApp->getMainWindow()->showResultsWindow();
|
||||||
|
|
||||||
|
resultsWindow->changeStatusForRow(resultRow, "Cancelled");
|
||||||
|
|
||||||
|
it = _bakers.erase(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BakeWidget::cancelButtonClicked() {
|
||||||
|
// the user wants to go back to the mode selection screen
|
||||||
|
// remove ourselves from the stacked widget and call delete later so we'll be cleaned up
|
||||||
|
auto stackedWidget = qobject_cast<QStackedWidget*>(parentWidget());
|
||||||
|
stackedWidget->removeWidget(this);
|
||||||
|
|
||||||
|
this->deleteLater();
|
||||||
|
}
|
33
tools/oven/src/ui/BakeWidget.h
Normal file
33
tools/oven/src/ui/BakeWidget.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
//
|
||||||
|
// BakeWidget.h
|
||||||
|
// tools/oven/src/ui
|
||||||
|
//
|
||||||
|
// Created by Stephen Birarda on 4/17/17.
|
||||||
|
// Copyright 2017 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_BakeWidget_h
|
||||||
|
#define hifi_BakeWidget_h
|
||||||
|
|
||||||
|
#include <QtWidgets/QWidget>
|
||||||
|
|
||||||
|
#include <Baker.h>
|
||||||
|
|
||||||
|
class BakeWidget : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
BakeWidget(QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||||
|
~BakeWidget();
|
||||||
|
|
||||||
|
void cancelButtonClicked();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
using BakerRowPair = std::pair<std::unique_ptr<Baker>, int>;
|
||||||
|
using BakerRowPairList = std::list<BakerRowPair>;
|
||||||
|
BakerRowPairList _bakers;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_BakeWidget_h
|
|
@ -16,7 +16,6 @@
|
||||||
#include <QtWidgets/QLabel>
|
#include <QtWidgets/QLabel>
|
||||||
#include <QtWidgets/QLineEdit>
|
#include <QtWidgets/QLineEdit>
|
||||||
#include <QtWidgets/QPushButton>
|
#include <QtWidgets/QPushButton>
|
||||||
#include <QtWidgets/QStackedWidget>
|
|
||||||
|
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
@ -32,7 +31,7 @@ static const QString BROWSE_START_DIR_SETTING_KEY = "domain_search_directory";
|
||||||
static const QString DESTINATION_PATH_SETTING_KEY = "destination_path";
|
static const QString DESTINATION_PATH_SETTING_KEY = "destination_path";
|
||||||
|
|
||||||
DomainBakeWidget::DomainBakeWidget(QWidget* parent, Qt::WindowFlags flags) :
|
DomainBakeWidget::DomainBakeWidget(QWidget* parent, Qt::WindowFlags flags) :
|
||||||
QWidget(parent, flags),
|
BakeWidget(parent, flags),
|
||||||
_domainNameSetting(DOMAIN_NAME_SETTING_KEY),
|
_domainNameSetting(DOMAIN_NAME_SETTING_KEY),
|
||||||
_exportDirectory(EXPORT_DIR_SETTING_KEY),
|
_exportDirectory(EXPORT_DIR_SETTING_KEY),
|
||||||
_browseStartDirectory(BROWSE_START_DIR_SETTING_KEY),
|
_browseStartDirectory(BROWSE_START_DIR_SETTING_KEY),
|
||||||
|
@ -41,20 +40,6 @@ DomainBakeWidget::DomainBakeWidget(QWidget* parent, Qt::WindowFlags flags) :
|
||||||
setupUI();
|
setupUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
DomainBakeWidget::~DomainBakeWidget() {
|
|
||||||
// if we're going down, our bakers are about to too
|
|
||||||
// enumerate them, send a cancelled status to the results table, and remove them
|
|
||||||
auto it = _bakers.begin();
|
|
||||||
while (it != _bakers.end()) {
|
|
||||||
auto resultRow = it->second;
|
|
||||||
auto resultsWindow = qApp->getMainWindow()->showResultsWindow();
|
|
||||||
|
|
||||||
resultsWindow->changeStatusForRow(resultRow, "Cancelled");
|
|
||||||
|
|
||||||
it = _bakers.erase(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DomainBakeWidget::setupUI() {
|
void DomainBakeWidget::setupUI() {
|
||||||
// setup a grid layout to hold everything
|
// setup a grid layout to hold everything
|
||||||
QGridLayout* gridLayout = new QGridLayout;
|
QGridLayout* gridLayout = new QGridLayout;
|
||||||
|
@ -296,12 +281,3 @@ void DomainBakeWidget::handleFinishedBaker() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DomainBakeWidget::cancelButtonClicked() {
|
|
||||||
// the user wants to go back to the mode selection screen
|
|
||||||
// remove ourselves from the stacked widget and call delete later so we'll be cleaned up
|
|
||||||
auto stackedWidget = qobject_cast<QStackedWidget*>(parentWidget());
|
|
||||||
stackedWidget->removeWidget(this);
|
|
||||||
|
|
||||||
this->deleteLater();
|
|
||||||
}
|
|
||||||
|
|
|
@ -17,21 +17,20 @@
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
|
|
||||||
#include "../DomainBaker.h"
|
#include "../DomainBaker.h"
|
||||||
|
#include "BakeWidget.h"
|
||||||
|
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
|
||||||
class DomainBakeWidget : public QWidget {
|
class DomainBakeWidget : public BakeWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DomainBakeWidget(QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
DomainBakeWidget(QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||||
~DomainBakeWidget();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void chooseFileButtonClicked();
|
void chooseFileButtonClicked();
|
||||||
void chooseOutputDirButtonClicked();
|
void chooseOutputDirButtonClicked();
|
||||||
void bakeButtonClicked();
|
void bakeButtonClicked();
|
||||||
void cancelButtonClicked();
|
|
||||||
|
|
||||||
void outputDirectoryChanged(const QString& newDirectory);
|
void outputDirectoryChanged(const QString& newDirectory);
|
||||||
|
|
||||||
|
@ -41,10 +40,6 @@ private slots:
|
||||||
private:
|
private:
|
||||||
void setupUI();
|
void setupUI();
|
||||||
|
|
||||||
using BakerRowPair = std::pair<std::unique_ptr<DomainBaker>, int>;
|
|
||||||
using BakerRowPairList = std::list<BakerRowPair>;
|
|
||||||
BakerRowPairList _bakers;
|
|
||||||
|
|
||||||
QLineEdit* _domainNameLineEdit;
|
QLineEdit* _domainNameLineEdit;
|
||||||
QLineEdit* _entitiesFileLineEdit;
|
QLineEdit* _entitiesFileLineEdit;
|
||||||
QLineEdit* _outputDirLineEdit;
|
QLineEdit* _outputDirLineEdit;
|
||||||
|
|
|
@ -29,27 +29,13 @@ static const auto EXPORT_DIR_SETTING_KEY = "model_export_directory";
|
||||||
static const auto MODEL_START_DIR_SETTING_KEY = "model_search_directory";
|
static const auto MODEL_START_DIR_SETTING_KEY = "model_search_directory";
|
||||||
|
|
||||||
ModelBakeWidget::ModelBakeWidget(QWidget* parent, Qt::WindowFlags flags) :
|
ModelBakeWidget::ModelBakeWidget(QWidget* parent, Qt::WindowFlags flags) :
|
||||||
QWidget(parent, flags),
|
BakeWidget(parent, flags),
|
||||||
_exportDirectory(EXPORT_DIR_SETTING_KEY),
|
_exportDirectory(EXPORT_DIR_SETTING_KEY),
|
||||||
_modelStartDirectory(MODEL_START_DIR_SETTING_KEY)
|
_modelStartDirectory(MODEL_START_DIR_SETTING_KEY)
|
||||||
{
|
{
|
||||||
setupUI();
|
setupUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelBakeWidget::~ModelBakeWidget() {
|
|
||||||
// if we're about to go down, whatever bakers we're managing are about to as well
|
|
||||||
// enumerate them, send the results table a cancelled status, and clean them up
|
|
||||||
auto it = _bakers.begin();
|
|
||||||
while (it != _bakers.end()) {
|
|
||||||
auto resultRow = it->second;
|
|
||||||
auto resultsWindow = qApp->getMainWindow()->showResultsWindow();
|
|
||||||
|
|
||||||
resultsWindow->changeStatusForRow(resultRow, "Cancelled");
|
|
||||||
|
|
||||||
it = _bakers.erase(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModelBakeWidget::setupUI() {
|
void ModelBakeWidget::setupUI() {
|
||||||
// setup a grid layout to hold everything
|
// setup a grid layout to hold everything
|
||||||
QGridLayout* gridLayout = new QGridLayout;
|
QGridLayout* gridLayout = new QGridLayout;
|
||||||
|
@ -236,12 +222,3 @@ void ModelBakeWidget::handleFinishedBaker() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelBakeWidget::cancelButtonClicked() {
|
|
||||||
// the user wants to go back to the mode selection screen
|
|
||||||
// remove ourselves from the stacked widget and call delete later so we'll be cleaned up
|
|
||||||
auto stackedWidget = qobject_cast<QStackedWidget*>(parentWidget());
|
|
||||||
stackedWidget->removeWidget(this);
|
|
||||||
|
|
||||||
this->deleteLater();
|
|
||||||
}
|
|
||||||
|
|
|
@ -18,21 +18,21 @@
|
||||||
|
|
||||||
#include <FBXBaker.h>
|
#include <FBXBaker.h>
|
||||||
|
|
||||||
|
#include "BakeWidget.h"
|
||||||
|
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
class QThread;
|
class QThread;
|
||||||
|
|
||||||
class ModelBakeWidget : public QWidget {
|
class ModelBakeWidget : public BakeWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ModelBakeWidget(QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
ModelBakeWidget(QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||||
~ModelBakeWidget();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void chooseFileButtonClicked();
|
void chooseFileButtonClicked();
|
||||||
void chooseOutputDirButtonClicked();
|
void chooseOutputDirButtonClicked();
|
||||||
void bakeButtonClicked();
|
void bakeButtonClicked();
|
||||||
void cancelButtonClicked();
|
|
||||||
|
|
||||||
void outputDirectoryChanged(const QString& newDirectory);
|
void outputDirectoryChanged(const QString& newDirectory);
|
||||||
|
|
||||||
|
@ -41,10 +41,6 @@ private slots:
|
||||||
private:
|
private:
|
||||||
void setupUI();
|
void setupUI();
|
||||||
|
|
||||||
using BakerRowPair = std::pair<std::unique_ptr<FBXBaker>, int>;
|
|
||||||
using BakerRowPairList = std::list<BakerRowPair>;
|
|
||||||
BakerRowPairList _bakers;
|
|
||||||
|
|
||||||
QLineEdit* _modelLineEdit;
|
QLineEdit* _modelLineEdit;
|
||||||
QLineEdit* _outputDirLineEdit;
|
QLineEdit* _outputDirLineEdit;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ static const auto EXPORT_DIR_SETTING_KEY = "skybox_export_directory";
|
||||||
static const auto SELECTION_START_DIR_SETTING_KEY = "skybox_search_directory";
|
static const auto SELECTION_START_DIR_SETTING_KEY = "skybox_search_directory";
|
||||||
|
|
||||||
SkyboxBakeWidget::SkyboxBakeWidget(QWidget* parent, Qt::WindowFlags flags) :
|
SkyboxBakeWidget::SkyboxBakeWidget(QWidget* parent, Qt::WindowFlags flags) :
|
||||||
QWidget(parent, flags),
|
BakeWidget(parent, flags),
|
||||||
_exportDirectory(EXPORT_DIR_SETTING_KEY),
|
_exportDirectory(EXPORT_DIR_SETTING_KEY),
|
||||||
_selectionStartDirectory(SELECTION_START_DIR_SETTING_KEY)
|
_selectionStartDirectory(SELECTION_START_DIR_SETTING_KEY)
|
||||||
{
|
{
|
||||||
|
@ -221,12 +221,3 @@ void SkyboxBakeWidget::handleFinishedBaker() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkyboxBakeWidget::cancelButtonClicked() {
|
|
||||||
// the user wants to go back to the mode selection screen
|
|
||||||
// remove ourselves from the stacked widget and call delete later so we'll be cleaned up
|
|
||||||
auto stackedWidget = qobject_cast<QStackedWidget*>(parentWidget());
|
|
||||||
stackedWidget->removeWidget(this);
|
|
||||||
|
|
||||||
this->deleteLater();
|
|
||||||
}
|
|
||||||
|
|
|
@ -18,9 +18,11 @@
|
||||||
|
|
||||||
#include <TextureBaker.h>
|
#include <TextureBaker.h>
|
||||||
|
|
||||||
|
#include "BakeWidget.h"
|
||||||
|
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
|
||||||
class SkyboxBakeWidget : public QWidget {
|
class SkyboxBakeWidget : public BakeWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -30,7 +32,6 @@ private slots:
|
||||||
void chooseFileButtonClicked();
|
void chooseFileButtonClicked();
|
||||||
void chooseOutputDirButtonClicked();
|
void chooseOutputDirButtonClicked();
|
||||||
void bakeButtonClicked();
|
void bakeButtonClicked();
|
||||||
void cancelButtonClicked();
|
|
||||||
|
|
||||||
void outputDirectoryChanged(const QString& newDirectory);
|
void outputDirectoryChanged(const QString& newDirectory);
|
||||||
|
|
||||||
|
@ -39,10 +40,6 @@ private slots:
|
||||||
private:
|
private:
|
||||||
void setupUI();
|
void setupUI();
|
||||||
|
|
||||||
using BakerRowPair = std::pair<std::unique_ptr<TextureBaker>, int>;
|
|
||||||
using BakerRowPairList = std::list<BakerRowPair>;
|
|
||||||
BakerRowPairList _bakers;
|
|
||||||
|
|
||||||
QLineEdit* _selectionLineEdit;
|
QLineEdit* _selectionLineEdit;
|
||||||
QLineEdit* _outputDirLineEdit;
|
QLineEdit* _outputDirLineEdit;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue