From fa1b99f7d48deda6f87a65f3d683aa8986c9933d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 28 Jun 2020 21:51:54 -0400 Subject: [PATCH] CModelEditorWindow: Make use of Qt 5 signals and slots --- src/Editor/ModelEditor/CModelEditorWindow.cpp | 93 +++++++++---------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/src/Editor/ModelEditor/CModelEditorWindow.cpp b/src/Editor/ModelEditor/CModelEditorWindow.cpp index 9feb0509..c361abf6 100644 --- a/src/Editor/ModelEditor/CModelEditorWindow.cpp +++ b/src/Editor/ModelEditor/CModelEditorWindow.cpp @@ -12,7 +12,6 @@ #include #include -#include #include #include @@ -87,54 +86,54 @@ CModelEditorWindow::CModelEditorWindow(CModel *pModel, QWidget *pParent) ui->AnimParamCSpinBox->setProperty ("ModelEditorWidgetType", (int) EModelEditorWidget::AnimParamCSpinBox); ui->AnimParamDSpinBox->setProperty ("ModelEditorWidgetType", (int) EModelEditorWidget::AnimParamDSpinBox); - connect(ui->ActionImport, SIGNAL(triggered()), this, SLOT(Import())); - connect(ui->ActionSave, SIGNAL(triggered()), this, SLOT(Save())); - connect(ui->ActionConvertToDDS, SIGNAL(triggered()), this, SLOT(ConvertToDDS())); - connect(ui->ActionConvertToTXTR, SIGNAL(triggered()), this, SLOT(ConvertToTXTR())); - connect(ui->MeshPreviewButton, SIGNAL(clicked()), this, SLOT(SetMeshPreview())); - connect(ui->SpherePreviewButton, SIGNAL(clicked()), this, SLOT(SetSpherePreview())); - connect(ui->FlatPreviewButton, SIGNAL(clicked()), this, SLOT(SetFlatPreview())); - connect(ui->ClearColorPicker, SIGNAL(ColorChanged(QColor)), this, SLOT(ClearColorChanged(QColor))); - connect(ui->CameraModeButton, SIGNAL(clicked()), this, SLOT(ToggleCameraMode())); - connect(ui->ToggleGridButton, SIGNAL(toggled(bool)), this, SLOT(ToggleGrid(bool))); + connect(ui->ActionImport, &QAction::triggered, this, &CModelEditorWindow::Import); + connect(ui->ActionSave, &QAction::triggered, this, &CModelEditorWindow::Save); + connect(ui->ActionConvertToDDS, &QAction::triggered, this, &CModelEditorWindow::ConvertToDDS); + connect(ui->ActionConvertToTXTR, &QAction::triggered, this, &CModelEditorWindow::ConvertToTXTR); + connect(ui->MeshPreviewButton, &QPushButton::clicked, this, &CModelEditorWindow::SetMeshPreview); + connect(ui->SpherePreviewButton, &QPushButton::clicked, this, &CModelEditorWindow::SetSpherePreview); + connect(ui->FlatPreviewButton, &QPushButton::clicked, this, &CModelEditorWindow::SetFlatPreview); + connect(ui->ClearColorPicker, &WColorPicker::ColorChanged, this, &CModelEditorWindow::ClearColorChanged); + connect(ui->CameraModeButton, &QPushButton::clicked, this, &CModelEditorWindow::ToggleCameraMode); + connect(ui->ToggleGridButton, &QPushButton::toggled, this, &CModelEditorWindow::ToggleGrid); - connect(ui->SetSelectionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateUI(int))); - connect(ui->MatSelectionComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateUI(int))); - connect(ui->EnableTransparencyCheck, SIGNAL(toggled(bool)), this, SLOT(UpdateMaterial(bool))); - connect(ui->EnablePunchthroughCheck, SIGNAL(toggled(bool)), this, SLOT(UpdateMaterial(bool))); - connect(ui->EnableReflectionCheck, SIGNAL(toggled(bool)), this, SLOT(UpdateMaterial(bool))); - connect(ui->EnableSurfaceReflectionCheck, SIGNAL(toggled(bool)), this, SLOT(UpdateMaterial(bool))); - connect(ui->EnableDepthWriteCheck, SIGNAL(toggled(bool)), this, SLOT(UpdateMaterial(bool))); - connect(ui->EnableOccluderCheck, SIGNAL(toggled(bool)), this, SLOT(UpdateMaterial(bool))); - connect(ui->EnableLightmapCheck, SIGNAL(toggled(bool)), this, SLOT(UpdateMaterial(bool))); - connect(ui->EnableDynamicLightingCheck, SIGNAL(toggled(bool)), this, SLOT(UpdateMaterial(bool))); - connect(ui->SourceBlendComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->DestBlendComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->KonstColorPickerA, SIGNAL(ColorChanged(QColor)), this, SLOT(UpdateMaterial(QColor))); - connect(ui->KonstColorPickerB, SIGNAL(ColorChanged(QColor)), this, SLOT(UpdateMaterial(QColor))); - connect(ui->KonstColorPickerC, SIGNAL(ColorChanged(QColor)), this, SLOT(UpdateMaterial(QColor))); - connect(ui->KonstColorPickerD, SIGNAL(ColorChanged(QColor)), this, SLOT(UpdateMaterial(QColor))); - connect(ui->PassTable, SIGNAL(cellClicked(int,int)), this, SLOT(UpdateMaterial(int, int))); - connect(ui->TevKColorSelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->TevKAlphaSelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->TevRasSelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->TexCoordSrcComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); + connect(ui->SetSelectionComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateUI)); + connect(ui->MatSelectionComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateUI)); + connect(ui->EnableTransparencyCheck, &QCheckBox::toggled, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->EnablePunchthroughCheck, &QCheckBox::toggled, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->EnableReflectionCheck, &QCheckBox::toggled, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->EnableSurfaceReflectionCheck, &QCheckBox::toggled, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->EnableDepthWriteCheck, &QCheckBox::toggled, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->EnableOccluderCheck, &QCheckBox::toggled, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->EnableLightmapCheck, &QCheckBox::toggled, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->EnableDynamicLightingCheck, &QCheckBox::toggled, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->SourceBlendComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->DestBlendComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->KonstColorPickerA, &WColorPicker::ColorChanged, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->KonstColorPickerB, &WColorPicker::ColorChanged, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->KonstColorPickerC, &WColorPicker::ColorChanged, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->KonstColorPickerD, &WColorPicker::ColorChanged, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->PassTable, &QTableWidget::cellClicked, this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TevKColorSelComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TevKAlphaSelComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TevRasSelComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TexCoordSrcComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); connect(ui->PassTextureResSelector, SIGNAL(ResourceChanged(QString)), this, SLOT(UpdateMaterial(QString))); - connect(ui->TevColor1ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->TevColor2ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->TevColor3ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->TevColor4ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->TevColorOutputComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->TevAlpha1ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->TevAlpha2ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->TevAlpha3ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->TevAlpha4ComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->TevAlphaOutputComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->AnimTypeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateMaterial(int))); - connect(ui->AnimParamASpinBox, SIGNAL(valueChanged(double)), this, SLOT(UpdateMaterial(double))); - connect(ui->AnimParamBSpinBox, SIGNAL(valueChanged(double)), this, SLOT(UpdateMaterial(double))); - connect(ui->AnimParamCSpinBox, SIGNAL(valueChanged(double)), this, SLOT(UpdateMaterial(double))); - connect(ui->AnimParamDSpinBox, SIGNAL(valueChanged(double)), this, SLOT(UpdateMaterial(double))); + connect(ui->TevColor1ComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TevColor2ComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TevColor3ComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TevColor4ComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TevColorOutputComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TevAlpha1ComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TevAlpha2ComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TevAlpha3ComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TevAlpha4ComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->TevAlphaOutputComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->AnimTypeComboBox, qOverload(&QComboBox::currentIndexChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->AnimParamASpinBox, qOverload(&WDraggableSpinBox::valueChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->AnimParamBSpinBox, qOverload(&WDraggableSpinBox::valueChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->AnimParamCSpinBox, qOverload(&WDraggableSpinBox::valueChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); + connect(ui->AnimParamDSpinBox, qOverload(&WDraggableSpinBox::valueChanged), this, qOverload(&CModelEditorWindow::UpdateMaterial)); // That was fun SetActiveModel(pModel);