mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 10:22:52 +01:00
clang-format files in rwviewer/views
This commit is contained in:
parent
46628d98d9
commit
11a9907f07
@ -1,93 +1,86 @@
|
||||
#include "ModelViewer.hpp"
|
||||
#include <QDebug>
|
||||
#include <widgets/ModelFramesWidget.hpp>
|
||||
#include <data/Skeleton.hpp>
|
||||
#include <engine/Animator.hpp>
|
||||
#include <objects/GameObject.hpp>
|
||||
#include "ViewerWidget.hpp"
|
||||
#include <fstream>
|
||||
#include <objects/GameObject.hpp>
|
||||
#include <widgets/ModelFramesWidget.hpp>
|
||||
#include "ViewerWidget.hpp"
|
||||
|
||||
ModelViewer::ModelViewer(ViewerWidget* viewer, QWidget* parent, Qt::WindowFlags f)
|
||||
: ViewerInterface(parent, f), viewing(nullptr), skeleton(nullptr)
|
||||
{
|
||||
mainSplit = new QSplitter;
|
||||
mainLayout = new QVBoxLayout;
|
||||
ModelViewer::ModelViewer(ViewerWidget* viewer, QWidget* parent,
|
||||
Qt::WindowFlags f)
|
||||
: ViewerInterface(parent, f), viewing(nullptr), skeleton(nullptr) {
|
||||
mainSplit = new QSplitter;
|
||||
mainLayout = new QVBoxLayout;
|
||||
|
||||
viewerWidget = viewer;
|
||||
viewerWidget->setMinimumSize(250,250);
|
||||
viewerWidget = viewer;
|
||||
viewerWidget->setMinimumSize(250, 250);
|
||||
|
||||
animationWidget = new AnimationListWidget;
|
||||
connect(animationWidget, SIGNAL(selectedAnimationChanged(Animation*)),
|
||||
SLOT(playAnimation(Animation*)));
|
||||
animationWidget = new AnimationListWidget;
|
||||
connect(animationWidget, SIGNAL(selectedAnimationChanged(Animation*)),
|
||||
SLOT(playAnimation(Animation*)));
|
||||
|
||||
frames = new ModelFramesWidget;
|
||||
frames->setMaximumWidth(300);
|
||||
frames = new ModelFramesWidget;
|
||||
frames->setMaximumWidth(300);
|
||||
|
||||
mainSplit->addWidget(frames);
|
||||
mainSplit->addWidget(animationWidget);
|
||||
mainLayout->addWidget(mainSplit);
|
||||
mainSplit->addWidget(frames);
|
||||
mainSplit->addWidget(animationWidget);
|
||||
mainLayout->addWidget(mainSplit);
|
||||
|
||||
this->setLayout(mainLayout);
|
||||
this->setLayout(mainLayout);
|
||||
|
||||
connect(frames, SIGNAL(selectedFrameChanged(ModelFrame*)),
|
||||
viewerWidget, SLOT(selectFrame(ModelFrame*)));
|
||||
setViewerWidget(viewerWidget);
|
||||
connect(frames, SIGNAL(selectedFrameChanged(ModelFrame*)), viewerWidget,
|
||||
SLOT(selectFrame(ModelFrame*)));
|
||||
setViewerWidget(viewerWidget);
|
||||
}
|
||||
|
||||
void ModelViewer::setViewerWidget(ViewerWidget* widget)
|
||||
{
|
||||
viewerWidget = widget;
|
||||
mainSplit->addWidget(viewerWidget);
|
||||
showModel(viewing);
|
||||
void ModelViewer::setViewerWidget(ViewerWidget* widget) {
|
||||
viewerWidget = widget;
|
||||
mainSplit->addWidget(viewerWidget);
|
||||
showModel(viewing);
|
||||
}
|
||||
|
||||
void ModelViewer::showModel(Model* model)
|
||||
{
|
||||
viewing = model;
|
||||
if( skeleton )
|
||||
{
|
||||
delete skeleton;
|
||||
}
|
||||
skeleton = new Skeleton();
|
||||
viewerWidget->showModel(model);
|
||||
frames->setModel(model, nullptr);
|
||||
void ModelViewer::showModel(Model* model) {
|
||||
viewing = model;
|
||||
if (skeleton) {
|
||||
delete skeleton;
|
||||
}
|
||||
skeleton = new Skeleton();
|
||||
viewerWidget->showModel(model);
|
||||
frames->setModel(model, nullptr);
|
||||
}
|
||||
|
||||
void ModelViewer::showObject(uint16_t object)
|
||||
{
|
||||
viewerWidget->showObject(object);
|
||||
viewing = viewerWidget->currentModel();
|
||||
skeleton = viewerWidget->currentObject()->skeleton;
|
||||
frames->setModel(viewing, skeleton);
|
||||
void ModelViewer::showObject(uint16_t object) {
|
||||
viewerWidget->showObject(object);
|
||||
viewing = viewerWidget->currentModel();
|
||||
skeleton = viewerWidget->currentObject()->skeleton;
|
||||
frames->setModel(viewing, skeleton);
|
||||
}
|
||||
|
||||
void ModelViewer::loadAnimations(const QString& file)
|
||||
{
|
||||
std::ifstream dfile(file.toStdString().c_str(), std::ios_base::binary);
|
||||
AnimationList anims;
|
||||
void ModelViewer::loadAnimations(const QString& file) {
|
||||
std::ifstream dfile(file.toStdString().c_str(), std::ios_base::binary);
|
||||
AnimationList anims;
|
||||
|
||||
if(dfile.is_open())
|
||||
{
|
||||
dfile.seekg(0, std::ios_base::end);
|
||||
size_t length = dfile.tellg();
|
||||
dfile.seekg(0);
|
||||
char *file = new char[length];
|
||||
dfile.read(file, length);
|
||||
if (dfile.is_open()) {
|
||||
dfile.seekg(0, std::ios_base::end);
|
||||
size_t length = dfile.tellg();
|
||||
dfile.seekg(0);
|
||||
char* file = new char[length];
|
||||
dfile.read(file, length);
|
||||
|
||||
LoaderIFP loader;
|
||||
if( loader.loadFromMemory(file) ) {
|
||||
for(auto& f : loader.animations) {
|
||||
anims.push_back(f);
|
||||
}
|
||||
}
|
||||
LoaderIFP loader;
|
||||
if (loader.loadFromMemory(file)) {
|
||||
for (auto& f : loader.animations) {
|
||||
anims.push_back(f);
|
||||
}
|
||||
}
|
||||
|
||||
delete[] file;
|
||||
}
|
||||
delete[] file;
|
||||
}
|
||||
|
||||
animationWidget->setAnimations(anims);
|
||||
animationWidget->setAnimations(anims);
|
||||
}
|
||||
|
||||
void ModelViewer::playAnimation(Animation* anim)
|
||||
{
|
||||
viewerWidget->currentObject()->animator->playAnimation(0, anim, 1.f, true);
|
||||
void ModelViewer::playAnimation(Animation* anim) {
|
||||
viewerWidget->currentObject()->animator->playAnimation(0, anim, 1.f, true);
|
||||
}
|
||||
|
@ -7,11 +7,11 @@
|
||||
|
||||
#include "ViewerInterface.hpp"
|
||||
|
||||
#include <QTreeView>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QSplitter>
|
||||
#include <QLayout>
|
||||
#include <QSplitter>
|
||||
#include <QTreeView>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
class ViewerWidget;
|
||||
class Model;
|
||||
@ -19,41 +19,41 @@ class Skeleton;
|
||||
class ModelFramesWidget;
|
||||
class Animation;
|
||||
|
||||
class ModelViewer : public ViewerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
class ModelViewer : public ViewerInterface {
|
||||
Q_OBJECT
|
||||
|
||||
Model* viewing;
|
||||
Skeleton* skeleton;
|
||||
Model* viewing;
|
||||
Skeleton* skeleton;
|
||||
|
||||
QSplitter* mainSplit;
|
||||
QVBoxLayout* mainLayout;
|
||||
ViewerWidget* viewerWidget;
|
||||
QSplitter* mainSplit;
|
||||
QVBoxLayout* mainLayout;
|
||||
ViewerWidget* viewerWidget;
|
||||
|
||||
ModelFramesWidget* frames;
|
||||
ModelFramesWidget* frames;
|
||||
|
||||
AnimationList loadedAnimations;
|
||||
AnimationListWidget* animationWidget;
|
||||
|
||||
AnimationList loadedAnimations;
|
||||
AnimationListWidget *animationWidget;
|
||||
public:
|
||||
ModelViewer(ViewerWidget* viewer = 0, QWidget* parent = 0,
|
||||
Qt::WindowFlags f = 0);
|
||||
|
||||
ModelViewer(ViewerWidget *viewer = 0, QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||
|
||||
void setViewerWidget( ViewerWidget* widget ) override;
|
||||
void setViewerWidget(ViewerWidget* widget) override;
|
||||
|
||||
public slots:
|
||||
|
||||
/**
|
||||
* Display a raw model
|
||||
*/
|
||||
void showModel(Model* model);
|
||||
/**
|
||||
* Display a raw model
|
||||
*/
|
||||
void showModel(Model* model);
|
||||
|
||||
/**
|
||||
* Display a game object's model
|
||||
*/
|
||||
void showObject(uint16_t object);
|
||||
/**
|
||||
* Display a game object's model
|
||||
*/
|
||||
void showObject(uint16_t object);
|
||||
|
||||
void loadAnimations(const QString& file);
|
||||
void playAnimation(Animation* anim);
|
||||
void loadAnimations(const QString& file);
|
||||
void playAnimation(Animation* anim);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,123 +1,107 @@
|
||||
#include "ObjectViewer.hpp"
|
||||
#include <models/ObjectListModel.hpp>
|
||||
#include "ViewerWidget.hpp"
|
||||
#include <QDebug>
|
||||
#include <QMenu>
|
||||
#include <models/ObjectListModel.hpp>
|
||||
#include "ViewerWidget.hpp"
|
||||
|
||||
ObjectViewer::ObjectViewer(ViewerWidget* viewer, QWidget* parent, Qt::WindowFlags f)
|
||||
: ViewerInterface(parent, f)
|
||||
{
|
||||
mainLayout = new QHBoxLayout;
|
||||
ObjectViewer::ObjectViewer(ViewerWidget* viewer, QWidget* parent,
|
||||
Qt::WindowFlags f)
|
||||
: ViewerInterface(parent, f) {
|
||||
mainLayout = new QHBoxLayout;
|
||||
|
||||
objectList = new QTableView;
|
||||
objectList = new QTableView;
|
||||
|
||||
objectMenu = new QMenu(objectList);
|
||||
objectList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
auto viewModelAction = new QAction("View Model", objectMenu);
|
||||
objectMenu->addAction(viewModelAction);
|
||||
connect(viewModelAction, SIGNAL(triggered()), this, SLOT(menuViewModel()));
|
||||
connect(objectList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenu(QPoint)));
|
||||
objectMenu = new QMenu(objectList);
|
||||
objectList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
auto viewModelAction = new QAction("View Model", objectMenu);
|
||||
objectMenu->addAction(viewModelAction);
|
||||
connect(viewModelAction, SIGNAL(triggered()), this, SLOT(menuViewModel()));
|
||||
connect(objectList, SIGNAL(customContextMenuRequested(QPoint)), this,
|
||||
SLOT(onCustomContextMenu(QPoint)));
|
||||
|
||||
mainLayout->addWidget(objectList);
|
||||
mainLayout->addWidget(objectList);
|
||||
|
||||
previewWidget = viewer;
|
||||
previewWidget->setMinimumSize(250,250);
|
||||
previewWidget = viewer;
|
||||
previewWidget->setMinimumSize(250, 250);
|
||||
|
||||
infoLayout = new QGridLayout;
|
||||
infoLayout = new QGridLayout;
|
||||
|
||||
previewID = new QLabel;
|
||||
previewModel = new QLabel;
|
||||
previewClass = new QLabel;
|
||||
infoLayout->addWidget(new QLabel("ID"), 1, 0);
|
||||
infoLayout->addWidget(previewID, 1, 1);
|
||||
infoLayout->addWidget(new QLabel("Type"), 2, 0);
|
||||
infoLayout->addWidget(previewClass, 2, 1);
|
||||
infoLayout->addWidget(new QLabel("Model"), 3, 0);
|
||||
infoLayout->addWidget(previewModel, 3, 1);
|
||||
previewID = new QLabel;
|
||||
previewModel = new QLabel;
|
||||
previewClass = new QLabel;
|
||||
infoLayout->addWidget(new QLabel("ID"), 1, 0);
|
||||
infoLayout->addWidget(previewID, 1, 1);
|
||||
infoLayout->addWidget(new QLabel("Type"), 2, 0);
|
||||
infoLayout->addWidget(previewClass, 2, 1);
|
||||
infoLayout->addWidget(new QLabel("Model"), 3, 0);
|
||||
infoLayout->addWidget(previewModel, 3, 1);
|
||||
|
||||
mainLayout->addLayout(infoLayout);
|
||||
mainLayout->addLayout(infoLayout);
|
||||
|
||||
this->setLayout(mainLayout);
|
||||
this->setLayout(mainLayout);
|
||||
|
||||
setViewerWidget(previewWidget);
|
||||
setViewerWidget(previewWidget);
|
||||
}
|
||||
|
||||
void ObjectViewer::setViewerWidget(ViewerWidget* widget)
|
||||
{
|
||||
//widgetLayout->removeWidget(previewWidget);
|
||||
previewWidget = widget;
|
||||
infoLayout->addWidget(previewWidget, 0, 0, 1, 2);
|
||||
void ObjectViewer::setViewerWidget(ViewerWidget* widget) {
|
||||
// widgetLayout->removeWidget(previewWidget);
|
||||
previewWidget = widget;
|
||||
infoLayout->addWidget(previewWidget, 0, 0, 1, 2);
|
||||
}
|
||||
|
||||
void ObjectViewer::worldChanged()
|
||||
{
|
||||
if( objectList->model() )
|
||||
{
|
||||
delete objectList->model();
|
||||
}
|
||||
void ObjectViewer::worldChanged() {
|
||||
if (objectList->model()) {
|
||||
delete objectList->model();
|
||||
}
|
||||
|
||||
objectList->setModel(new ObjectListModel(world()->data, objectList));
|
||||
connect(objectList->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(showItem(QModelIndex)));
|
||||
objectList->setModel(new ObjectListModel(world()->data, objectList));
|
||||
connect(objectList->selectionModel(),
|
||||
SIGNAL(currentChanged(QModelIndex, QModelIndex)), this,
|
||||
SLOT(showItem(QModelIndex)));
|
||||
}
|
||||
|
||||
static std::map<ObjectInformation::ObjectClass, QString> gDataType =
|
||||
{
|
||||
{ ObjectInformation::_class("OBJS"), "Object" },
|
||||
{ ObjectInformation::_class("CARS"), "Vehicle" },
|
||||
{ ObjectInformation::_class("PEDS"), "Pedestrian" },
|
||||
{ ObjectInformation::_class("HIER"), "Cutscene" }
|
||||
};
|
||||
static std::map<ObjectInformation::ObjectClass, QString> gDataType = {
|
||||
{ObjectInformation::_class("OBJS"), "Object"},
|
||||
{ObjectInformation::_class("CARS"), "Vehicle"},
|
||||
{ObjectInformation::_class("PEDS"), "Pedestrian"},
|
||||
{ObjectInformation::_class("HIER"), "Cutscene"}};
|
||||
|
||||
void ObjectViewer::showItem(qint16 item)
|
||||
{
|
||||
auto def = world()->data->objectTypes[item];
|
||||
void ObjectViewer::showItem(qint16 item) {
|
||||
auto def = world()->data->objectTypes[item];
|
||||
|
||||
if( def )
|
||||
{
|
||||
previewID->setText(QString::number(def->ID));
|
||||
previewClass->setText(gDataType[def->class_type]);
|
||||
if (def) {
|
||||
previewID->setText(QString::number(def->ID));
|
||||
previewClass->setText(gDataType[def->class_type]);
|
||||
|
||||
if(def->class_type == ObjectData::class_id)
|
||||
{
|
||||
auto v = std::static_pointer_cast<ObjectData>(def);
|
||||
previewModel->setText(QString::fromStdString(v->modelName));
|
||||
}
|
||||
else if(def->class_type == VehicleData::class_id)
|
||||
{
|
||||
auto v = std::static_pointer_cast<VehicleData>(def);
|
||||
previewModel->setText(QString::fromStdString(v->modelName));
|
||||
}
|
||||
else if(def->class_type == CharacterData::class_id)
|
||||
{
|
||||
auto v = std::static_pointer_cast<CharacterData>(def);
|
||||
previewModel->setText(QString::fromStdString(v->modelName));
|
||||
}
|
||||
if (def->class_type == ObjectData::class_id) {
|
||||
auto v = std::static_pointer_cast<ObjectData>(def);
|
||||
previewModel->setText(QString::fromStdString(v->modelName));
|
||||
} else if (def->class_type == VehicleData::class_id) {
|
||||
auto v = std::static_pointer_cast<VehicleData>(def);
|
||||
previewModel->setText(QString::fromStdString(v->modelName));
|
||||
} else if (def->class_type == CharacterData::class_id) {
|
||||
auto v = std::static_pointer_cast<CharacterData>(def);
|
||||
previewModel->setText(QString::fromStdString(v->modelName));
|
||||
}
|
||||
|
||||
previewWidget->showObject(item);
|
||||
}
|
||||
previewWidget->showObject(item);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectViewer::showItem(QModelIndex model)
|
||||
{
|
||||
showItem(model.internalId());
|
||||
void ObjectViewer::showItem(QModelIndex model) {
|
||||
showItem(model.internalId());
|
||||
}
|
||||
|
||||
void ObjectViewer::onCustomContextMenu(const QPoint& p)
|
||||
{
|
||||
contextMenuIndex = objectList->indexAt(p);
|
||||
if ( contextMenuIndex.isValid() )
|
||||
{
|
||||
void ObjectViewer::onCustomContextMenu(const QPoint& p) {
|
||||
contextMenuIndex = objectList->indexAt(p);
|
||||
if (contextMenuIndex.isValid()) {
|
||||
objectMenu->exec(objectList->mapToGlobal(p));
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectViewer::menuViewModel()
|
||||
{
|
||||
if( contextMenuIndex.isValid() )
|
||||
{
|
||||
auto id = contextMenuIndex.internalId();
|
||||
showObjectModel(id);
|
||||
}
|
||||
void ObjectViewer::menuViewModel() {
|
||||
if (contextMenuIndex.isValid()) {
|
||||
auto id = contextMenuIndex.internalId();
|
||||
showObjectModel(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,54 +6,54 @@
|
||||
|
||||
#include "ViewerInterface.hpp"
|
||||
|
||||
#include <QTableView>
|
||||
#include <QLabel>
|
||||
#include <QGridLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QTableView>
|
||||
|
||||
class ViewerWidget;
|
||||
class Model;
|
||||
|
||||
class ObjectViewer : public ViewerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
class ObjectViewer : public ViewerInterface {
|
||||
Q_OBJECT
|
||||
|
||||
QTableView* objectList;
|
||||
QTableView* objectList;
|
||||
|
||||
QHBoxLayout* mainLayout;
|
||||
QGridLayout* infoLayout;
|
||||
ViewerWidget* previewWidget;
|
||||
QLabel* previewID;
|
||||
QLabel* previewModel;
|
||||
QLabel* previewClass;
|
||||
QHBoxLayout* mainLayout;
|
||||
QGridLayout* infoLayout;
|
||||
ViewerWidget* previewWidget;
|
||||
QLabel* previewID;
|
||||
QLabel* previewModel;
|
||||
QLabel* previewClass;
|
||||
|
||||
QMenu* objectMenu;
|
||||
QModelIndex contextMenuIndex;
|
||||
|
||||
QMenu* objectMenu;
|
||||
QModelIndex contextMenuIndex;
|
||||
public:
|
||||
ObjectViewer(ViewerWidget* viewer = 0, QWidget* parent = 0,
|
||||
Qt::WindowFlags f = 0);
|
||||
|
||||
ObjectViewer(ViewerWidget *viewer = 0, QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||
|
||||
void setViewerWidget( ViewerWidget* widget );
|
||||
void setViewerWidget(ViewerWidget* widget);
|
||||
|
||||
protected:
|
||||
void worldChanged() override;
|
||||
void worldChanged() override;
|
||||
|
||||
signals:
|
||||
|
||||
void modelChanged(Model* model);
|
||||
void modelChanged(Model* model);
|
||||
|
||||
void showObjectModel(uint16_t object);
|
||||
void showObjectModel(uint16_t object);
|
||||
|
||||
public slots:
|
||||
|
||||
void showItem(qint16 item);
|
||||
void showItem(qint16 item);
|
||||
|
||||
private slots:
|
||||
|
||||
void showItem(QModelIndex model);
|
||||
void showItem(QModelIndex model);
|
||||
|
||||
void onCustomContextMenu(const QPoint &);
|
||||
void menuViewModel();
|
||||
void onCustomContextMenu(const QPoint&);
|
||||
void menuViewModel();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -6,33 +6,31 @@
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class ViewerInterface : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
class ViewerInterface : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ViewerInterface(QWidget* parent = 0, Qt::WindowFlags f = 0)
|
||||
: QWidget(parent, f)
|
||||
, m_world(nullptr)
|
||||
{
|
||||
ViewerInterface(QWidget* parent = 0, Qt::WindowFlags f = 0)
|
||||
: QWidget(parent, f), m_world(nullptr) {
|
||||
}
|
||||
|
||||
}
|
||||
virtual void setViewerWidget(ViewerWidget* widget) = 0;
|
||||
|
||||
virtual void setViewerWidget( ViewerWidget* widget ) = 0;
|
||||
|
||||
GameWorld* world() { return m_world; }
|
||||
GameWorld* world() {
|
||||
return m_world;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void worldChanged() { }
|
||||
virtual void worldChanged() {
|
||||
}
|
||||
|
||||
public slots:
|
||||
void showData(GameWorld* world)
|
||||
{
|
||||
m_world = world;
|
||||
worldChanged();
|
||||
}
|
||||
void showData(GameWorld* world) {
|
||||
m_world = world;
|
||||
worldChanged();
|
||||
}
|
||||
|
||||
private:
|
||||
GameWorld* m_world;
|
||||
GameWorld* m_world;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -3,36 +3,32 @@
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
WorldViewer::WorldViewer(ViewerWidget* viewer, QWidget* parent, Qt::WindowFlags f)
|
||||
: ViewerInterface(parent, f)
|
||||
{
|
||||
mainLayout = new QVBoxLayout;
|
||||
WorldViewer::WorldViewer(ViewerWidget* viewer, QWidget* parent,
|
||||
Qt::WindowFlags f)
|
||||
: ViewerInterface(parent, f) {
|
||||
mainLayout = new QVBoxLayout;
|
||||
|
||||
viewerWidget = viewer;
|
||||
viewerWidget->setMinimumSize(250,250);
|
||||
viewerWidget = viewer;
|
||||
viewerWidget->setMinimumSize(250, 250);
|
||||
|
||||
this->setLayout(mainLayout);
|
||||
this->setLayout(mainLayout);
|
||||
}
|
||||
|
||||
void WorldViewer::setViewerWidget(ViewerWidget* widget)
|
||||
{
|
||||
viewerWidget = widget;
|
||||
// Clear the active model
|
||||
widget->showModel(nullptr);
|
||||
mainLayout->addWidget(viewerWidget);
|
||||
void WorldViewer::setViewerWidget(ViewerWidget* widget) {
|
||||
viewerWidget = widget;
|
||||
// Clear the active model
|
||||
widget->showModel(nullptr);
|
||||
mainLayout->addWidget(viewerWidget);
|
||||
}
|
||||
|
||||
void WorldViewer::loadPlacements(const QString& file)
|
||||
{
|
||||
world()->placeItems(file.toStdString());
|
||||
placementsLoaded(file);
|
||||
void WorldViewer::loadPlacements(const QString& file) {
|
||||
world()->placeItems(file.toStdString());
|
||||
placementsLoaded(file);
|
||||
}
|
||||
|
||||
void WorldViewer::loadPlacements()
|
||||
{
|
||||
QFileDialog dialog(this, "Open Placements", "", "Placement (*.ipl)");
|
||||
if(dialog.exec()) {
|
||||
loadPlacements(dialog.selectedFiles()[0]);
|
||||
}
|
||||
void WorldViewer::loadPlacements() {
|
||||
QFileDialog dialog(this, "Open Placements", "", "Placement (*.ipl)");
|
||||
if (dialog.exec()) {
|
||||
loadPlacements(dialog.selectedFiles()[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,29 +5,30 @@
|
||||
|
||||
#include "ViewerInterface.hpp"
|
||||
|
||||
#include <QTreeView>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QSplitter>
|
||||
#include <QLayout>
|
||||
#include <QSplitter>
|
||||
#include <QTreeView>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
class WorldViewer : public ViewerInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
class WorldViewer : public ViewerInterface {
|
||||
Q_OBJECT
|
||||
|
||||
QVBoxLayout* mainLayout;
|
||||
ViewerWidget* viewerWidget;
|
||||
|
||||
QVBoxLayout* mainLayout;
|
||||
ViewerWidget* viewerWidget;
|
||||
public:
|
||||
WorldViewer(ViewerWidget *viewer = 0, QWidget* parent = 0, Qt::WindowFlags f = 0);
|
||||
WorldViewer(ViewerWidget* viewer = 0, QWidget* parent = 0,
|
||||
Qt::WindowFlags f = 0);
|
||||
|
||||
void setViewerWidget( ViewerWidget* widget ) override;
|
||||
void setViewerWidget(ViewerWidget* widget) override;
|
||||
|
||||
signals:
|
||||
void placementsLoaded(const QString& file);
|
||||
void placementsLoaded(const QString& file);
|
||||
|
||||
public slots:
|
||||
void loadPlacements(const QString& file);
|
||||
void loadPlacements();
|
||||
void loadPlacements(const QString& file);
|
||||
void loadPlacements();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user