From 80ea68245cdb8181d4898109dc87a7761c7c5f22 Mon Sep 17 00:00:00 2001 From: Leonardo Zide Date: Sat, 2 May 2026 16:06:27 -0700 Subject: [PATCH] Move Select Dialog. --- common/lc_mainwindow.cpp | 25 +++++++++++++++++-- common/lc_mainwindow.h | 1 + common/lc_model.cpp | 17 ------------- common/lc_model.h | 1 - .../lc_selectdialog.cpp | 4 +-- .../lc_selectdialog.h | 0 .../lc_selectdialog.ui | 0 leocad.pro | 10 ++++---- resources/leocad_cs.ts | 8 +++--- resources/leocad_de.ts | 8 +++--- resources/leocad_es.ts | 8 +++--- resources/leocad_fr.ts | 8 +++--- resources/leocad_pt.ts | 8 +++--- resources/leocad_ru.ts | 8 +++--- resources/leocad_uk.ts | 8 +++--- resources/leocad_zh_CN.ts | 8 +++--- 16 files changed, 63 insertions(+), 59 deletions(-) rename qt/lc_qselectdialog.cpp => common/lc_selectdialog.cpp (98%) rename qt/lc_qselectdialog.h => common/lc_selectdialog.h (100%) rename qt/lc_qselectdialog.ui => common/lc_selectdialog.ui (100%) diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index 47214ade..3ff4476c 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -10,6 +10,7 @@ #include "lc_qutils.h" #include "lc_updatedialog.h" #include "lc_aboutdialog.h" +#include "lc_selectdialog.h" #include "lc_setsdatabasedialog.h" #include "lc_htmldialog.h" #include "lc_renderdialog.h" @@ -1384,6 +1385,27 @@ void lcMainWindow::ShowImageDialog() lcGetActiveProject()->SaveImage(Options); } +void lcMainWindow::ShowSelectDialog() +{ + lcModel* ActiveModel = GetActiveModel(); + + if (!ActiveModel) + return; + + if (ActiveModel->GetPieces().empty() && ActiveModel->GetCameras().empty() && ActiveModel->GetLights().empty()) + { + QMessageBox::information(this, tr("LeoCAD"), tr("Nothing to select.")); + return; + } + + lcSelectDialog Dialog(this, ActiveModel); + + if (Dialog.exec() != QDialog::Accepted) + return; + + ActiveModel->SetSelectionAndFocusAction(Dialog.mObjects, nullptr, 0, lcSelectionMode::Single); +} + void lcMainWindow::SetShadingMode(lcShadingMode ShadingMode) { lcGetPreferences().mShadingMode = ShadingMode; @@ -2818,8 +2840,7 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId) break; case LC_EDIT_SELECT_BY_NAME: - if (ActiveModel) - ActiveModel->ShowSelectByNameDialog(); + ShowSelectDialog(); break; case LC_EDIT_SELECTION_SINGLE: diff --git a/common/lc_mainwindow.h b/common/lc_mainwindow.h index 84b21c64..5efb4d37 100644 --- a/common/lc_mainwindow.h +++ b/common/lc_mainwindow.h @@ -329,6 +329,7 @@ protected: void ShowInstructionsDialog(); void ShowPrintDialog(); void ShowImageDialog(); + void ShowSelectDialog(); void CreatePreviewWidget(); bool OpenProjectFile(const QString& FileName); diff --git a/common/lc_model.cpp b/common/lc_model.cpp index 5d5679e3..5e4e62a2 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -15,7 +15,6 @@ #include "lc_view.h" #include "minifig.h" #include "lc_arraydialog.h" -#include "lc_qselectdialog.h" #include "lc_minifigdialog.h" #include "lc_groupdialog.h" #include "lc_editgroupsdialog.h" @@ -5431,22 +5430,6 @@ void lcModel::ShowPropertiesDialog() EndHistorySequence(tr("Change Model Properties")); } -void lcModel::ShowSelectByNameDialog() -{ - if (mPieces.empty() && mCameras.empty() && mLights.empty()) - { - QMessageBox::information(gMainWindow, tr("LeoCAD"), tr("Nothing to select.")); - return; - } - - lcSelectDialog Dialog(gMainWindow, this); - - if (Dialog.exec() != QDialog::Accepted) - return; - - SetSelectionAndFocusAction(Dialog.mObjects, nullptr, 0, lcSelectionMode::Single); -} - void lcModel::ShowArrayDialog() { lcVector3 Center; diff --git a/common/lc_model.h b/common/lc_model.h index 8c7534ad..71a1ddc3 100644 --- a/common/lc_model.h +++ b/common/lc_model.h @@ -384,7 +384,6 @@ public: void SetCameraProjection(lcCamera* Camera, lcCameraProjection CameraProjection); void ShowPropertiesDialog(); - void ShowSelectByNameDialog(); void ShowArrayDialog(); void ShowMinifigDialog(); void UpdateInterface(); diff --git a/qt/lc_qselectdialog.cpp b/common/lc_selectdialog.cpp similarity index 98% rename from qt/lc_qselectdialog.cpp rename to common/lc_selectdialog.cpp index 358612ad..a76ca600 100644 --- a/qt/lc_qselectdialog.cpp +++ b/common/lc_selectdialog.cpp @@ -1,6 +1,6 @@ #include "lc_global.h" -#include "lc_qselectdialog.h" -#include "ui_lc_qselectdialog.h" +#include "lc_selectdialog.h" +#include "ui_lc_selectdialog.h" #include "lc_model.h" #include "piece.h" #include "camera.h" diff --git a/qt/lc_qselectdialog.h b/common/lc_selectdialog.h similarity index 100% rename from qt/lc_qselectdialog.h rename to common/lc_selectdialog.h diff --git a/qt/lc_qselectdialog.ui b/common/lc_selectdialog.ui similarity index 100% rename from qt/lc_qselectdialog.ui rename to common/lc_selectdialog.ui diff --git a/leocad.pro b/leocad.pro index 03f8c4ed..6bd0c7b0 100644 --- a/leocad.pro +++ b/leocad.pro @@ -221,6 +221,7 @@ SOURCES += \ common/lc_profile.cpp \ common/lc_propertieswidget.cpp \ common/lc_scene.cpp \ + common/lc_selectdialog.cpp \ common/lc_shortcuts.cpp \ common/lc_string.cpp \ common/lc_stringcache.cpp \ @@ -236,7 +237,6 @@ SOURCES += \ common/lc_viewwidget.cpp \ common/lc_zipfile.cpp \ qt/qtmain.cpp \ - qt/lc_qselectdialog.cpp \ qt/lc_qpropertiesdialog.cpp \ qt/lc_qpreferencesdialog.cpp \ qt/lc_qutils.cpp \ @@ -294,12 +294,14 @@ HEADERS += \ common/lc_modellistdialog.h \ common/lc_objectproperty.h \ common/lc_pagesetupdialog.h \ + common/lc_partpalettedialog.h \ common/lc_partselectionpopup.h \ common/lc_partselectionwidget.h \ common/lc_previewwidget.h \ common/lc_profile.h \ common/lc_propertieswidget.h \ common/lc_scene.h \ + common/lc_selectdialog.h \ common/lc_shortcuts.h \ common/lc_string.h \ common/lc_stringcache.h \ @@ -314,13 +316,11 @@ HEADERS += \ common/lc_viewsphere.h \ common/lc_viewwidget.h \ common/lc_zipfile.h \ - qt/lc_qselectdialog.h \ qt/lc_qpropertiesdialog.h \ qt/lc_qpreferencesdialog.h \ qt/lc_qutils.h \ qt/lc_renderdialog.h \ - qt/lc_setsdatabasedialog.h \ - common/lc_partpalettedialog.h + qt/lc_setsdatabasedialog.h FORMS += \ common/lc_aboutdialog.ui \ common/lc_arraydialog.ui \ @@ -333,8 +333,8 @@ FORMS += \ common/lc_modellistdialog.ui \ common/lc_pagesetupdialog.ui \ common/lc_partpalettedialog.ui \ + common/lc_selectdialog.ui \ common/lc_updatedialog.ui \ - qt/lc_qselectdialog.ui \ qt/lc_qpropertiesdialog.ui \ qt/lc_qpreferencesdialog.ui \ qt/lc_renderdialog.ui \ diff --git a/resources/leocad_cs.ts b/resources/leocad_cs.ts index 6ec875b0..372da6d1 100644 --- a/resources/leocad_cs.ts +++ b/resources/leocad_cs.ts @@ -8052,22 +8052,22 @@ GL_EXT_texture_filter_anisotropic rozšíření: %5 lcSelectDialog - + Select Objects Vybrat objekty - + All Vše - + None Žádné - + Invert Invertovat diff --git a/resources/leocad_de.ts b/resources/leocad_de.ts index 2b99f5ba..546ac143 100644 --- a/resources/leocad_de.ts +++ b/resources/leocad_de.ts @@ -7942,22 +7942,22 @@ Anisotropic: %5 lcSelectDialog - + Select Objects Objekte auswählen - + All Alle - + None Keine - + Invert Umkehren diff --git a/resources/leocad_es.ts b/resources/leocad_es.ts index e2db7e71..a33a903d 100644 --- a/resources/leocad_es.ts +++ b/resources/leocad_es.ts @@ -8085,22 +8085,22 @@ Anisotropic: %5 lcSelectDialog - + Select Objects Seleccionar objetos - + All Todos - + None Ninguno - + Invert Invertir diff --git a/resources/leocad_fr.ts b/resources/leocad_fr.ts index 99ddc488..f4192fbc 100644 --- a/resources/leocad_fr.ts +++ b/resources/leocad_fr.ts @@ -7816,22 +7816,22 @@ Anisotropic: %5 lcSelectDialog - + Select Objects Sélectionner des objets - + All Tous - + None Aucun - + Invert Inverser diff --git a/resources/leocad_pt.ts b/resources/leocad_pt.ts index 4aec452e..950d96dd 100644 --- a/resources/leocad_pt.ts +++ b/resources/leocad_pt.ts @@ -7812,22 +7812,22 @@ Anisotropic: %5 lcSelectDialog - + Select Objects Selecionar Objetos - + All Todos - + None Nenhum - + Invert Inverter diff --git a/resources/leocad_ru.ts b/resources/leocad_ru.ts index 021406e1..ceb4fedb 100644 --- a/resources/leocad_ru.ts +++ b/resources/leocad_ru.ts @@ -7954,22 +7954,22 @@ GL_EXT_texture_filter_anisotropic extension: %5 lcSelectDialog - + Select Objects Выделение объектов - + All Все - + None Ни одного - + Invert Инвертировать diff --git a/resources/leocad_uk.ts b/resources/leocad_uk.ts index fae3d476..4e46eb49 100644 --- a/resources/leocad_uk.ts +++ b/resources/leocad_uk.ts @@ -7878,22 +7878,22 @@ GL_EXT_texture_filter_anisotropic extension: %5 lcSelectDialog - + Select Objects Виділити об'єкти - + All Усі - + None Нічого - + Invert Інвертувати diff --git a/resources/leocad_zh_CN.ts b/resources/leocad_zh_CN.ts index 5b454236..be79e276 100644 --- a/resources/leocad_zh_CN.ts +++ b/resources/leocad_zh_CN.ts @@ -7740,22 +7740,22 @@ Anisotropic: %5 lcSelectDialog - + Select Objects 选择物体 - + All 全部 - + None - + Invert 反选