diff --git a/common/lc_basewindow.h b/common/lc_basewindow.h index 7781eaf4..cccbcf91 100644 --- a/common/lc_basewindow.h +++ b/common/lc_basewindow.h @@ -3,19 +3,10 @@ #include "lc_math.h" #include "lc_array.h" #include "lc_application.h" -#include "lc_model.h" #include "lc_category.h" #include "lc_shortcuts.h" #include "image.h" -struct lcPropertiesDialogOptions -{ - lcModelProperties Properties; - bool SetDefault; - - lcPartsList PartsList; -}; - struct lcPreferencesDialogOptions { lcPreferences Preferences; diff --git a/common/lc_model.cpp b/common/lc_model.cpp index e62ebce8..9b1bcfe7 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -4264,7 +4264,6 @@ void lcModel::ShowPropertiesDialog() lcPropertiesDialogOptions Options; Options.Properties = mProperties; - Options.SetDefault = false; GetPartsList(gDefaultColor, true, false, Options.PartsList); @@ -4272,9 +4271,6 @@ void lcModel::ShowPropertiesDialog() if (Dialog.exec() != QDialog::Accepted) return; - if (Options.SetDefault) - Options.Properties.SaveDefaults(); - if (mProperties == Options.Properties) return; diff --git a/qt/lc_qpropertiesdialog.cpp b/qt/lc_qpropertiesdialog.cpp index f5b58647..9ef4b17f 100644 --- a/qt/lc_qpropertiesdialog.cpp +++ b/qt/lc_qpropertiesdialog.cpp @@ -24,27 +24,31 @@ public: if (((const lcPartsTableWidgetItem&)Other).mLast) return true; + if (column() > 0) + { + int Count = text().toInt(); + int OtherCount = Other.text().toInt(); + return Count < OtherCount; + } + return QTableWidgetItem::operator<(Other); } bool mLast; }; -lcQPropertiesDialog::lcQPropertiesDialog(QWidget* Parent, void* Data) - : QDialog(Parent), - ui(new Ui::lcQPropertiesDialog) +lcQPropertiesDialog::lcQPropertiesDialog(QWidget* Parent, lcPropertiesDialogOptions* Options) + : QDialog(Parent), mOptions(Options), ui(new Ui::lcQPropertiesDialog) { ui->setupUi(this); - options = (lcPropertiesDialogOptions*)Data; + setWindowTitle(tr("%1 Properties").arg(mOptions->Properties.mFileName)); - setWindowTitle(tr("%1 Properties").arg(options->Properties.mFileName)); + ui->descriptionEdit->setText(mOptions->Properties.mDescription); + ui->authorEdit->setText(mOptions->Properties.mAuthor); + ui->commentsEdit->setText(mOptions->Properties.mComments); - ui->descriptionEdit->setText(options->Properties.mDescription); - ui->authorEdit->setText(options->Properties.mAuthor); - ui->commentsEdit->setText(options->Properties.mComments); - - const lcPartsList& PartsList = options->PartsList; + const lcPartsList& PartsList = mOptions->PartsList; QStringList horizontalLabels; QVector ColorsUsed(gNumUserColors); @@ -141,9 +145,9 @@ lcQPropertiesDialog::~lcQPropertiesDialog() void lcQPropertiesDialog::accept() { - options->Properties.mDescription = ui->descriptionEdit->text(); - options->Properties.mAuthor = ui->authorEdit->text(); - options->Properties.mComments = ui->commentsEdit->toPlainText(); + mOptions->Properties.mDescription = ui->descriptionEdit->text(); + mOptions->Properties.mAuthor = ui->authorEdit->text(); + mOptions->Properties.mComments = ui->commentsEdit->toPlainText(); QDialog::accept(); } diff --git a/qt/lc_qpropertiesdialog.h b/qt/lc_qpropertiesdialog.h index 88fe6160..2be0f794 100644 --- a/qt/lc_qpropertiesdialog.h +++ b/qt/lc_qpropertiesdialog.h @@ -1,9 +1,16 @@ #pragma once -#include -struct lcPropertiesDialogOptions; +#include "lc_model.h" -namespace Ui { +struct lcPropertiesDialogOptions +{ + lcModelProperties Properties; + + lcPartsList PartsList; +}; + +namespace Ui +{ class lcQPropertiesDialog; } @@ -12,15 +19,15 @@ class lcQPropertiesDialog : public QDialog Q_OBJECT public: - lcQPropertiesDialog(QWidget* Parent, void* Data); + lcQPropertiesDialog(QWidget* Parent, lcPropertiesDialogOptions* Options); ~lcQPropertiesDialog(); - lcPropertiesDialogOptions *options; + lcPropertiesDialogOptions* mOptions; public slots: void accept() override; private: - Ui::lcQPropertiesDialog *ui; + Ui::lcQPropertiesDialog* ui; };