From 343ed3a1fd4060d764dd97566653bfec96e498ca Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 31 Dec 2014 17:05:23 +0000 Subject: [PATCH] Moved Properties to Model menu. --- common/lc_commands.cpp | 14 +++++++------- common/lc_commands.h | 2 +- common/lc_mainwindow.cpp | 8 ++++---- common/lc_model.cpp | 8 +------- qt/lc_qmainwindow.cpp | 7 +++---- qt/lc_qpropertiesdialog.cpp | 2 ++ 6 files changed, 18 insertions(+), 23 deletions(-) diff --git a/common/lc_commands.cpp b/common/lc_commands.cpp index 68fe3041..53607ca4 100644 --- a/common/lc_commands.cpp +++ b/common/lc_commands.cpp @@ -88,13 +88,6 @@ lcCommand gCommands[LC_NUM_COMMANDS] = QT_TRANSLATE_NOOP("Status", "Export the project in Wavefront OBJ format"), QT_TRANSLATE_NOOP("Shortcut", "") }, - // LC_FILE_PROPERTIES - { - "File.Properties", - QT_TRANSLATE_NOOP("Menu", "Prope&rties..."), - QT_TRANSLATE_NOOP("Status", "Display project properties"), - QT_TRANSLATE_NOOP("Shortcut", "") - }, // LC_FILE_PRINT { "File.Print", @@ -1124,6 +1117,13 @@ lcCommand gCommands[LC_NUM_COMMANDS] = QT_TRANSLATE_NOOP("Status", "Add a new model to the project"), QT_TRANSLATE_NOOP("Shortcut", "") }, + // LC_MODEL_PROPERTIES + { + "Model.Properties", + QT_TRANSLATE_NOOP("Menu", "Prope&rties..."), + QT_TRANSLATE_NOOP("Status", "Display the properties of the current model"), + QT_TRANSLATE_NOOP("Shortcut", "") + }, // LC_MODEL_LIST { "Model.List", diff --git a/common/lc_commands.h b/common/lc_commands.h index 3e301fb6..1c0b80c0 100644 --- a/common/lc_commands.h +++ b/common/lc_commands.h @@ -15,7 +15,6 @@ enum lcCommandId LC_FILE_EXPORT_CSV, LC_FILE_EXPORT_POVRAY, LC_FILE_EXPORT_WAVEFRONT, - LC_FILE_PROPERTIES, LC_FILE_PRINT, LC_FILE_PRINT_PREVIEW, LC_FILE_PRINT_BOM, @@ -171,6 +170,7 @@ enum lcCommandId LC_PIECE_SHOW_EARLIER, LC_PIECE_SHOW_LATER, LC_MODEL_NEW, + LC_MODEL_PROPERTIES, LC_MODEL_LIST, LC_MODEL_FIRST, LC_MODEL_01 = LC_MODEL_FIRST, diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index 6c2665e9..aaff00de 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -361,10 +361,6 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId) lcGetActiveProject()->ExportWavefront(); break; - case LC_FILE_PROPERTIES: - lcGetActiveModel()->ShowPropertiesDialog(); - break; - case LC_FILE_PRINT_PREVIEW: TogglePrintPreview(); break; @@ -692,6 +688,10 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId) lcGetActiveProject()->CreateNewModel(); break; + case LC_MODEL_PROPERTIES: + lcGetActiveModel()->ShowPropertiesDialog(); + break; + case LC_MODEL_LIST: lcGetActiveProject()->ShowModelListDialog(); break; diff --git a/common/lc_model.cpp b/common/lc_model.cpp index 4bac0522..02fb8981 100644 --- a/common/lc_model.cpp +++ b/common/lc_model.cpp @@ -2605,13 +2605,7 @@ void lcModel::GetPartsList(int DefaultColorIndex, lcArray& Par } if (UsedIdx == PartsList.GetSize()) - { - lcPartsListEntry& Entry = PartsList.Add(); - - Entry.Info = Piece->mPieceInfo; - Entry.ColorIndex = ColorIndex; - Entry.Count = 1; - } + Piece->mPieceInfo->GetPartsList(ColorIndex, PartsList); } } diff --git a/qt/lc_qmainwindow.cpp b/qt/lc_qmainwindow.cpp index 9af83112..c2862213 100644 --- a/qt/lc_qmainwindow.cpp +++ b/qt/lc_qmainwindow.cpp @@ -244,8 +244,6 @@ void lcQMainWindow::createMenus() exportMenu->addAction(actions[LC_FILE_EXPORT_POVRAY]); exportMenu->addAction(actions[LC_FILE_EXPORT_WAVEFRONT]); menuFile->addSeparator(); - menuFile->addAction(actions[LC_FILE_PROPERTIES]); - menuFile->addSeparator(); menuFile->addAction(actions[LC_FILE_PRINT]); menuFile->addAction(actions[LC_FILE_PRINT_PREVIEW]); // menuFile->addAction(actions[LC_FILE_PRINT_BOM]); @@ -333,11 +331,12 @@ void lcQMainWindow::createMenus() menuPiece->addAction(actions[LC_PIECE_UNHIDE_ALL]); menuModel = menuBar()->addMenu(tr("&Model")); + menuModel->addAction(actions[LC_MODEL_PROPERTIES]); menuModel->addAction(actions[LC_MODEL_NEW]); - menuModel->addAction(actions[LC_MODEL_LIST]); menuModel->addSeparator(); for (int ModelIdx = 0; ModelIdx < LC_MODEL_LAST - LC_MODEL_FIRST; ModelIdx++) menuModel->addAction(actions[LC_MODEL_FIRST + ModelIdx]); + menuModel->addAction(actions[LC_MODEL_LIST]); menuHelp = menuBar()->addMenu(tr("&Help")); menuHelp->addAction(actions[LC_HELP_HOMEPAGE]); @@ -1280,7 +1279,7 @@ void lcQMainWindow::updateModels() if (ModelIdx < Models.GetSize()) { Action->setChecked(CurrentModel == Models[ModelIdx]); - Action->setText(Models[ModelIdx]->GetProperties().mName); + Action->setText(QString::fromLatin1("&%1 %2").arg(QString::number(ModelIdx + 1), Models[ModelIdx]->GetProperties().mName)); Action->setVisible(true); } else diff --git a/qt/lc_qpropertiesdialog.cpp b/qt/lc_qpropertiesdialog.cpp index a563ec81..b142732e 100644 --- a/qt/lc_qpropertiesdialog.cpp +++ b/qt/lc_qpropertiesdialog.cpp @@ -23,6 +23,8 @@ lcQPropertiesDialog::lcQPropertiesDialog(QWidget *parent, void *data) : options = (lcPropertiesDialogOptions*)data; + setWindowTitle(tr("%1 Properties").arg(options->Properties.mName)); + ui->descriptionEdit->setText(options->Properties.mDescription); ui->authorEdit->setText(options->Properties.mAuthor); ui->commentsEdit->setText(options->Properties.mComments);