mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-12-16 16:37:02 +00:00
Initial commit of current work on Prime World Editor
This commit is contained in:
54
UI/WorldEditor/CLayerEditor.cpp
Normal file
54
UI/WorldEditor/CLayerEditor.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#include "CLayerEditor.h"
|
||||
#include "ui_CLayerEditor.h"
|
||||
|
||||
CLayerEditor::CLayerEditor(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CLayerEditor)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
mpArea = nullptr;
|
||||
mpModel = new CLayerModel(this);
|
||||
ui->LayerSelectComboBox->setModel(mpModel);
|
||||
|
||||
connect(ui->LayerSelectComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCurrentIndex(int)));
|
||||
connect(ui->NameLineEdit, SIGNAL(textEdited(QString)), this, SLOT(EditLayerName(QString)));
|
||||
connect(ui->ActiveCheckBox, SIGNAL(toggled(bool)), this, SLOT(EditLayerActive(bool)));
|
||||
}
|
||||
|
||||
CLayerEditor::~CLayerEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CLayerEditor::SetArea(CGameArea *pArea)
|
||||
{
|
||||
mpArea = pArea;
|
||||
mpModel->SetArea(pArea);
|
||||
SetCurrentIndex(0);
|
||||
}
|
||||
|
||||
// ************ SLOTS ************
|
||||
void CLayerEditor::SetCurrentIndex(int index)
|
||||
{
|
||||
ui->LayerSelectComboBox->blockSignals(true);
|
||||
ui->LayerSelectComboBox->setCurrentIndex(index);
|
||||
ui->LayerSelectComboBox->blockSignals(false);
|
||||
|
||||
QModelIndex ModelIndex = mpModel->index(index);
|
||||
mpCurrentLayer = mpModel->Layer(ModelIndex);
|
||||
|
||||
ui->NameLineEdit->setText(QString::fromStdString(mpCurrentLayer->Name()));
|
||||
ui->ActiveCheckBox->setChecked(mpCurrentLayer->IsActive());
|
||||
}
|
||||
|
||||
void CLayerEditor::EditLayerName(const QString &name)
|
||||
{
|
||||
mpCurrentLayer->SetName(name.toStdString());
|
||||
ui->LayerSelectComboBox->update();
|
||||
}
|
||||
|
||||
void CLayerEditor::EditLayerActive(bool active)
|
||||
{
|
||||
mpCurrentLayer->SetActive(active);
|
||||
}
|
||||
Reference in New Issue
Block a user