Archived
1
Fork 0

Rename inspector

This commit is contained in:
Joshua Goins 2018-12-25 23:04:32 -05:00
parent b5bbd15bd8
commit 4a01dab006
5 changed files with 32 additions and 32 deletions

View file

@ -1,7 +1,7 @@
set(INCLUDE_FILES
include/mainwindow.h
include/hierarchy.h
include/inspector.h)
include/properties.h)
qt5_wrap_cpp(EDITOR_SRC ${INCLUDE_FILES})
@ -9,7 +9,7 @@ add_executable(LevelEditor
src/main.cpp
src/mainwindow.cpp
src/hierarchy.cpp
src/inspector.cpp
src/properties.cpp
${EDITOR_SRC})
target_include_directories(LevelEditor PRIVATE include)
target_link_libraries(LevelEditor Qt5::Widgets Engine ToolWindowManager EditorCommon)

View file

@ -13,7 +13,7 @@ public:
private:
void addSceneView();
void addHierarchy();
void addInspector();
void addProperties();
Context& context;
ToolWindowManager* manager = nullptr;

View file

@ -9,18 +9,18 @@ struct TransformComponent;
struct MeshComponent;
struct LightComponent;
class Inspector : public QWidget {
class Properties : public QWidget {
Q_OBJECT
public:
Inspector(Context& context, QWidget* parent = nullptr);
Properties(Context& context, QWidget* parent = nullptr);
private:
void rebuild();
void addInfoInspector(InfoComponent* info);
void addTransformInspector(TransformComponent* transform);
void addMeshInspector(MeshComponent* mesh);
void addLightInspector(LightComponent* light);
void addInfoSection(InfoComponent* info);
void addTransformSection(TransformComponent* transform);
void addMeshSection(MeshComponent* mesh);
void addLightSection(LightComponent* light);
QVBoxLayout* layout = nullptr;

View file

@ -11,7 +11,7 @@
#include "renderwindow.h"
#include "renderer.h"
#include "hierarchy.h"
#include "inspector.h"
#include "properties.h"
MainWindow::MainWindow(Context& context) : context(context) {
setWindowTitle("Level Editor");
@ -124,10 +124,10 @@ MainWindow::MainWindow(Context& context) : context(context) {
addHierarchy->setIcon(QIcon::fromTheme("view-sort-ascending"));
newViewMenu->addAction(addHierarchy);
QAction* addInspector = new QAction("Inspector");
connect(addInspector, &QAction::triggered, this, &MainWindow::addInspector);
addInspector->setIcon(QIcon::fromTheme("edit-cut"));
newViewMenu->addAction(addInspector);
QAction* addProperties = new QAction("Properties");
connect(addProperties, &QAction::triggered, this, &MainWindow::addProperties);
addProperties->setIcon(QIcon::fromTheme("document-properties"));
newViewMenu->addAction(addProperties);
}
mainMenuBar->addSeparator();
@ -144,7 +144,7 @@ MainWindow::MainWindow(Context& context) : context(context) {
addSceneView();
addHierarchy();
addInspector();
addProperties();
}
void MainWindow::addSceneView() {
@ -164,9 +164,9 @@ void MainWindow::addHierarchy() {
manager->addToolWindow(hierarchy, ToolWindowManager::AreaReference(ToolWindowManager::EmptySpace));
}
void MainWindow::addInspector() {
Inspector* inspector = new Inspector(context);
void MainWindow::addProperties() {
Properties* properties = new Properties(context);
manager->addToolWindow(inspector, ToolWindowManager::AreaReference(ToolWindowManager::EmptySpace));
manager->addToolWindow(properties, ToolWindowManager::AreaReference(ToolWindowManager::EmptySpace));
}

View file

@ -1,4 +1,4 @@
#include "inspector.h"
#include "properties.h"
#include <QIcon>
#include <QLabel>
@ -12,9 +12,9 @@
#include "collapsesection.h"
#include "coloredit.h"
Inspector::Inspector(Context& context, QWidget* parent) : QWidget(parent), context(context) {
setWindowTitle("Inspector");
setWindowIcon(QIcon::fromTheme("edit-cut"));
Properties::Properties(Context& context, QWidget* parent) : QWidget(parent), context(context) {
setWindowTitle("Properties");
setWindowIcon(QIcon::fromTheme("document-properties"));
layout = new QVBoxLayout();
layout->setAlignment(Qt::AlignTop);
@ -24,10 +24,10 @@ Inspector::Inspector(Context& context, QWidget* parent) : QWidget(parent), conte
rebuild();
connect(&context, &Context::selectionChanged, this, &Inspector::rebuild);
connect(&context, &Context::selectionChanged, this, &Properties::rebuild);
}
void Inspector::rebuild() {
void Properties::rebuild() {
for(auto section : sections) {
layout->removeWidget(section);
delete section;
@ -42,22 +42,22 @@ void Inspector::rebuild() {
InfoComponent* info = ECS::getComponent<InfoComponent>(entity);
if(info)
addInfoInspector(info);
addInfoSection(info);
TransformComponent* transform = ECS::getComponent<TransformComponent>(entity);
if(transform)
addTransformInspector(transform);
addTransformSection(transform);
MeshComponent* mesh = ECS::getComponent<MeshComponent>(entity);
if(mesh)
addMeshInspector(mesh);
addMeshSection(mesh);
LightComponent* light = ECS::getComponent<LightComponent>(entity);
if(light)
addLightInspector(light);
addLightSection(light);
}
void Inspector::addInfoInspector(InfoComponent* info) {
void Properties::addInfoSection(InfoComponent* info) {
CollapseSection* section = new CollapseSection("Info");
layout->addWidget(section);
sections.push_back(section);
@ -77,7 +77,7 @@ void Inspector::addInfoInspector(InfoComponent* info) {
layout->addWidget(nameEdit, 0, 1);
}
void Inspector::addTransformInspector(TransformComponent* transform) {
void Properties::addTransformSection(TransformComponent* transform) {
CollapseSection* section = new CollapseSection("Transform");
layout->addWidget(section);
sections.push_back(section);
@ -92,7 +92,7 @@ void Inspector::addTransformInspector(TransformComponent* transform) {
layout->addWidget(positionEdit, 0, 1);
}
void Inspector::addMeshInspector(MeshComponent* mesh) {
void Properties::addMeshSection(MeshComponent* mesh) {
CollapseSection* section = new CollapseSection("Mesh", true);
layout->addWidget(section);
sections.push_back(section);
@ -101,7 +101,7 @@ void Inspector::addMeshInspector(MeshComponent* mesh) {
section->setLayout(layout);
}
void Inspector::addLightInspector(LightComponent* light) {
void Properties::addLightSection(LightComponent* light) {
CollapseSection* section = new CollapseSection("Light", true);
layout->addWidget(section);
sections.push_back(section);