Moved model list dialog.

This commit is contained in:
Leonardo Zide 2023-04-29 20:10:50 -07:00
parent 2b16b75d75
commit fb961d2cab
11 changed files with 37 additions and 37 deletions

View file

@ -1,6 +1,6 @@
#include "lc_global.h" #include "lc_global.h"
#include "lc_qmodellistdialog.h" #include "lc_modellistdialog.h"
#include "ui_lc_qmodellistdialog.h" #include "ui_lc_modellistdialog.h"
#include "project.h" #include "project.h"
#include "lc_profile.h" #include "lc_profile.h"
#include "lc_model.h" #include "lc_model.h"
@ -11,8 +11,8 @@ enum class lcModelListRole
DuplicateModel DuplicateModel
}; };
lcQModelListDialog::lcQModelListDialog(QWidget* Parent, const lcArray<lcModel*> Models) lcModelListDialog::lcModelListDialog(QWidget* Parent, const lcArray<lcModel*> Models)
: QDialog(Parent), ui(new Ui::lcQModelListDialog) : QDialog(Parent), ui(new Ui::lcModelListDialog)
{ {
mActiveModelItem = nullptr; mActiveModelItem = nullptr;
@ -33,17 +33,17 @@ lcQModelListDialog::lcQModelListDialog(QWidget* Parent, const lcArray<lcModel*>
UpdateButtons(); UpdateButtons();
} }
lcQModelListDialog::~lcQModelListDialog() lcModelListDialog::~lcModelListDialog()
{ {
delete ui; delete ui;
} }
int lcQModelListDialog::GetActiveModelIndex() const int lcModelListDialog::GetActiveModelIndex() const
{ {
return ui->ModelList->row(mActiveModelItem); return ui->ModelList->row(mActiveModelItem);
} }
std::vector<lcModelListDialogEntry> lcQModelListDialog::GetResults() const std::vector<lcModelListDialogEntry> lcModelListDialog::GetResults() const
{ {
std::vector<lcModelListDialogEntry> Models; std::vector<lcModelListDialogEntry> Models;
Models.reserve(ui->ModelList->count()); Models.reserve(ui->ModelList->count());
@ -64,7 +64,7 @@ std::vector<lcModelListDialogEntry> lcQModelListDialog::GetResults() const
return Models; return Models;
} }
void lcQModelListDialog::UpdateButtons() void lcModelListDialog::UpdateButtons()
{ {
int ModelCount = ui->ModelList->count(); int ModelCount = ui->ModelList->count();
@ -92,7 +92,7 @@ void lcQModelListDialog::UpdateButtons()
ui->MoveDown->setEnabled(MoveDown); ui->MoveDown->setEnabled(MoveDown);
} }
void lcQModelListDialog::accept() void lcModelListDialog::accept()
{ {
if (ui->SetActiveModel->isChecked()) if (ui->SetActiveModel->isChecked())
mActiveModelItem = ui->ModelList->currentItem(); mActiveModelItem = ui->ModelList->currentItem();
@ -103,7 +103,7 @@ void lcQModelListDialog::accept()
QDialog::accept(); QDialog::accept();
} }
void lcQModelListDialog::on_NewModel_clicked() void lcModelListDialog::on_NewModel_clicked()
{ {
QStringList ModelNames; QStringList ModelNames;
@ -120,7 +120,7 @@ void lcQModelListDialog::on_NewModel_clicked()
UpdateButtons(); UpdateButtons();
} }
void lcQModelListDialog::on_DeleteModel_clicked() void lcModelListDialog::on_DeleteModel_clicked()
{ {
if (ui->ModelList->count() == 1) if (ui->ModelList->count() == 1)
{ {
@ -156,7 +156,7 @@ void lcQModelListDialog::on_DeleteModel_clicked()
UpdateButtons(); UpdateButtons();
} }
void lcQModelListDialog::on_RenameModel_clicked() void lcModelListDialog::on_RenameModel_clicked()
{ {
QList<QListWidgetItem*> SelectedItems = ui->ModelList->selectedItems(); QList<QListWidgetItem*> SelectedItems = ui->ModelList->selectedItems();
@ -180,7 +180,7 @@ void lcQModelListDialog::on_RenameModel_clicked()
} }
} }
void lcQModelListDialog::on_ExportModel_clicked() void lcModelListDialog::on_ExportModel_clicked()
{ {
QList<QListWidgetItem*> SelectedItems = ui->ModelList->selectedItems(); QList<QListWidgetItem*> SelectedItems = ui->ModelList->selectedItems();
@ -239,7 +239,7 @@ void lcQModelListDialog::on_ExportModel_clicked()
} }
} }
void lcQModelListDialog::on_DuplicateModel_clicked() void lcModelListDialog::on_DuplicateModel_clicked()
{ {
QList<QListWidgetItem*> SelectedItems = ui->ModelList->selectedItems(); QList<QListWidgetItem*> SelectedItems = ui->ModelList->selectedItems();
@ -279,7 +279,7 @@ void lcQModelListDialog::on_DuplicateModel_clicked()
UpdateButtons(); UpdateButtons();
} }
void lcQModelListDialog::on_MoveUp_clicked() void lcModelListDialog::on_MoveUp_clicked()
{ {
bool Blocked = ui->ModelList->blockSignals(true); bool Blocked = ui->ModelList->blockSignals(true);
@ -302,7 +302,7 @@ void lcQModelListDialog::on_MoveUp_clicked()
UpdateButtons(); UpdateButtons();
} }
void lcQModelListDialog::on_MoveDown_clicked() void lcModelListDialog::on_MoveDown_clicked()
{ {
bool Blocked = ui->ModelList->blockSignals(true); bool Blocked = ui->ModelList->blockSignals(true);
@ -325,14 +325,14 @@ void lcQModelListDialog::on_MoveDown_clicked()
UpdateButtons(); UpdateButtons();
} }
void lcQModelListDialog::on_ModelList_itemDoubleClicked(QListWidgetItem* Item) void lcModelListDialog::on_ModelList_itemDoubleClicked(QListWidgetItem* Item)
{ {
mActiveModelItem = Item; mActiveModelItem = Item;
accept(); accept();
} }
void lcQModelListDialog::on_ModelList_itemSelectionChanged() void lcModelListDialog::on_ModelList_itemSelectionChanged()
{ {
UpdateButtons(); UpdateButtons();
} }

View file

@ -4,7 +4,7 @@
namespace Ui namespace Ui
{ {
class lcQModelListDialog; class lcModelListDialog;
} }
struct lcModelListDialogEntry struct lcModelListDialogEntry
@ -14,13 +14,13 @@ struct lcModelListDialogEntry
lcModel* DuplicateSource; lcModel* DuplicateSource;
}; };
class lcQModelListDialog : public QDialog class lcModelListDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
lcQModelListDialog(QWidget* Parent, const lcArray<lcModel*> Models); lcModelListDialog(QWidget* Parent, const lcArray<lcModel*> Models);
~lcQModelListDialog(); ~lcModelListDialog();
int GetActiveModelIndex() const; int GetActiveModelIndex() const;
std::vector<lcModelListDialogEntry> GetResults() const; std::vector<lcModelListDialogEntry> GetResults() const;
@ -40,6 +40,6 @@ public slots:
private: private:
QListWidgetItem* mActiveModelItem; QListWidgetItem* mActiveModelItem;
void UpdateButtons(); void UpdateButtons();
Ui::lcQModelListDialog* ui; Ui::lcModelListDialog* ui;
}; };

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>lcQModelListDialog</class> <class>lcModelListDialog</class>
<widget class="QDialog" name="lcQModelListDialog"> <widget class="QDialog" name="lcModelListDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -126,7 +126,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>lcQModelListDialog</receiver> <receiver>lcModelListDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@ -142,7 +142,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>lcQModelListDialog</receiver> <receiver>lcModelListDialog</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">

View file

@ -272,7 +272,7 @@ lcModel* Project::CreateNewModel(bool ShowModel)
void Project::ShowModelListDialog() void Project::ShowModelListDialog()
{ {
lcQModelListDialog Dialog(gMainWindow, mModels); lcModelListDialog Dialog(gMainWindow, mModels);
if (Dialog.exec() != QDialog::Accepted) if (Dialog.exec() != QDialog::Accepted)
return; return;

View file

@ -196,6 +196,7 @@ SOURCES += \
common/lc_meshloader.cpp \ common/lc_meshloader.cpp \
common/lc_minifigdialog.cpp \ common/lc_minifigdialog.cpp \
common/lc_model.cpp \ common/lc_model.cpp \
common/lc_modellistdialog.cpp \
common/lc_pagesetupdialog.cpp \ common/lc_pagesetupdialog.cpp \
common/lc_partselectionwidget.cpp \ common/lc_partselectionwidget.cpp \
common/lc_previewwidget.cpp \ common/lc_previewwidget.cpp \
@ -228,7 +229,6 @@ SOURCES += \
qt/lc_qutils.cpp \ qt/lc_qutils.cpp \
qt/lc_qpropertiestree.cpp \ qt/lc_qpropertiestree.cpp \
qt/lc_qcolorpicker.cpp \ qt/lc_qcolorpicker.cpp \
qt/lc_qmodellistdialog.cpp \
qt/lc_renderdialog.cpp \ qt/lc_renderdialog.cpp \
qt/lc_setsdatabasedialog.cpp \ qt/lc_setsdatabasedialog.cpp \
common/lc_partpalettedialog.cpp common/lc_partpalettedialog.cpp
@ -267,6 +267,7 @@ HEADERS += \
common/lc_meshloader.h \ common/lc_meshloader.h \
common/lc_minifigdialog.h \ common/lc_minifigdialog.h \
common/lc_model.h \ common/lc_model.h \
common/lc_modellistdialog.h \
common/lc_pagesetupdialog.h \ common/lc_pagesetupdialog.h \
common/lc_previewwidget.h \ common/lc_previewwidget.h \
common/lc_profile.h \ common/lc_profile.h \
@ -297,7 +298,6 @@ HEADERS += \
qt/lc_qutils.h \ qt/lc_qutils.h \
qt/lc_qpropertiestree.h \ qt/lc_qpropertiestree.h \
qt/lc_qcolorpicker.h \ qt/lc_qcolorpicker.h \
qt/lc_qmodellistdialog.h \
qt/lc_renderdialog.h \ qt/lc_renderdialog.h \
qt/lc_setsdatabasedialog.h \ qt/lc_setsdatabasedialog.h \
common/lc_partpalettedialog.h common/lc_partpalettedialog.h
@ -311,12 +311,12 @@ FORMS += \
qt/lc_qcategorydialog.ui \ qt/lc_qcategorydialog.ui \
qt/lc_qimagedialog.ui \ qt/lc_qimagedialog.ui \
qt/lc_qupdatedialog.ui \ qt/lc_qupdatedialog.ui \
qt/lc_qmodellistdialog.ui \
qt/lc_renderdialog.ui \ qt/lc_renderdialog.ui \
qt/lc_setsdatabasedialog.ui \ qt/lc_setsdatabasedialog.ui \
common/lc_aboutdialog.ui \ common/lc_aboutdialog.ui \
common/lc_groupdialog.ui \ common/lc_groupdialog.ui \
common/lc_minifigdialog.ui \ common/lc_minifigdialog.ui \
common/lc_modellistdialog.ui \
common/lc_pagesetupdialog.ui \ common/lc_pagesetupdialog.ui \
common/lc_partpalettedialog.ui common/lc_partpalettedialog.ui
OTHER_FILES += OTHER_FILES +=

View file

@ -6557,7 +6557,7 @@ GL_EXT_texture_filter_anisotropic rozšíření: %5
</message> </message>
</context> </context>
<context> <context>
<name>lcQModelListDialog</name> <name>lcModelListDialog</name>
<message> <message>
<location filename="../qt/lc_qmodellistdialog.ui" line="14"/> <location filename="../qt/lc_qmodellistdialog.ui" line="14"/>
<source>Submodels</source> <source>Submodels</source>

View file

@ -6495,7 +6495,7 @@ Anisotropic: %5
</message> </message>
</context> </context>
<context> <context>
<name>lcQModelListDialog</name> <name>lcModelListDialog</name>
<message> <message>
<location filename="../qt/lc_qmodellistdialog.ui" line="14"/> <location filename="../qt/lc_qmodellistdialog.ui" line="14"/>
<source>Submodels</source> <source>Submodels</source>

View file

@ -6604,7 +6604,7 @@ Anisotropic: %5
</message> </message>
</context> </context>
<context> <context>
<name>lcQModelListDialog</name> <name>lcModelListDialog</name>
<message> <message>
<location filename="../qt/lc_qmodellistdialog.ui" line="14"/> <location filename="../qt/lc_qmodellistdialog.ui" line="14"/>
<source>Submodels</source> <source>Submodels</source>

View file

@ -6389,7 +6389,7 @@ Anisotropic: %5
</message> </message>
</context> </context>
<context> <context>
<name>lcQModelListDialog</name> <name>lcModelListDialog</name>
<message> <message>
<location filename="../qt/lc_qmodellistdialog.ui" line="14"/> <location filename="../qt/lc_qmodellistdialog.ui" line="14"/>
<source>Submodels</source> <source>Submodels</source>

View file

@ -6389,7 +6389,7 @@ Anisotropic: %5
</message> </message>
</context> </context>
<context> <context>
<name>lcQModelListDialog</name> <name>lcModelListDialog</name>
<message> <message>
<location filename="../qt/lc_qmodellistdialog.ui" line="14"/> <location filename="../qt/lc_qmodellistdialog.ui" line="14"/>
<source>Submodels</source> <source>Submodels</source>

View file

@ -6430,7 +6430,7 @@ GL_EXT_texture_filter_anisotropic extension: %5
</message> </message>
</context> </context>
<context> <context>
<name>lcQModelListDialog</name> <name>lcModelListDialog</name>
<message> <message>
<location filename="../qt/lc_qmodellistdialog.ui" line="14"/> <location filename="../qt/lc_qmodellistdialog.ui" line="14"/>
<source>Submodels</source> <source>Submodels</source>