Move the unit schema into Project Information and remove all Project Unit System code (#11266)

* Add unit system to Project Information and store with document.

* Remove the project unit system

* Restore correct document activation signalling to fix test fail

* Remove commented out dead lines

* Restore ignore option for project unit schemas

* Whitespace fix

* Refresh after changing units

* Remove field label

* Property editor changes applied to unit system
This commit is contained in:
bgbsww
2023-12-04 14:04:53 -05:00
committed by GitHub
parent 0aa328622d
commit c2bab7a2fa
12 changed files with 125 additions and 150 deletions

View File

@@ -30,10 +30,12 @@
#include <App/Document.h>
#include <App/License.h>
#include <Base/UnitsApi.h>
#include "DlgProjectInformationImp.h"
#include "ui_DlgProjectInformation.h"
#include "MainWindow.h"
#if 0 // needed for Qt's lupdate utility
qApp->translate("Gui::Dialog::DlgSettingsDocument", "All rights reserved");
@@ -76,6 +78,14 @@ DlgProjectInformationImp::DlgProjectInformationImp(App::Document* doc, QWidget*
ui->lineEditLastModDate->setText(QString::fromUtf8(doc->LastModifiedDate.getValue()));
ui->lineEditCompany->setText(QString::fromUtf8(doc->Company.getValue()));
// Load comboBox with unit systems
int num = static_cast<int>(Base::UnitSystem::NumUnitSystemTypes);
for (int i = 0; i < num; i++) {
QString item = Base::UnitsApi::getDescription(static_cast<Base::UnitSystem>(i));
ui->comboBox_unitSystem->addItem(item, i);
}
ui->comboBox_unitSystem->setCurrentIndex(doc->UnitSystem.getValue());
// load comboBox with license names
for (const auto& item : App::licenseItems) {
const char* name {item.at(App::posnOfFullName)};
@@ -130,6 +140,7 @@ void DlgProjectInformationImp::accept()
_doc->CreatedBy.setValue(ui->lineEditCreator->text().toUtf8());
_doc->LastModifiedBy.setValue(ui->lineEditCreator->text().toUtf8());
_doc->Company.setValue(ui->lineEditCompany->text().toUtf8());
getMainWindow()->setUserSchema(ui->comboBox_unitSystem->currentIndex());
QByteArray licenseName {ui->comboLicense->currentData().toByteArray()};
// Is this really necessary?
if (licenseName.isEmpty()) {