diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index 56209ef35..1ab6241e6 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -1346,9 +1346,9 @@ void TMainWindow::ShowMData() const qreal value = UnitConvertor(data->GetTableValue(meash->GetName(), mType), mUnit, pUnit); ui->labelCalculatedValue->setText(qApp->LocaleToString(value) + " " +postfix); - ui->doubleSpinBoxBaseValue->setValue(static_cast(meash->GetBase())); - ui->doubleSpinBoxInSizes->setValue(static_cast(meash->GetKsize())); - ui->doubleSpinBoxInHeights->setValue(static_cast(meash->GetKheight())); + ui->doubleSpinBoxBaseValue->setValue(meash->GetBase()); + ui->doubleSpinBoxInSizes->setValue(meash->GetKsize()); + ui->doubleSpinBoxInHeights->setValue(meash->GetKheight()); ui->labelCalculatedValue->blockSignals(false); ui->doubleSpinBoxBaseValue->blockSignals(false); @@ -1584,22 +1584,6 @@ void TMainWindow::SaveMBaseValue(double value) } const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName); - - QSharedPointer meash; - - try - { - // Translate to internal look. - meash = data->GetVariable(nameField->data(Qt::UserRole).toString()); - } - catch(const VExceptionBadId &e) - { - qCWarning(tMainWindow, "%s\n\n%s\n\n%s", - qUtf8Printable(tr("Can't find measurement '%1'.").arg(nameField->text())), - qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); - return; - } - m->SetMBaseValue(nameField->data(Qt::UserRole).toString(), value); MeasurementsWasSaved(false); @@ -1610,6 +1594,8 @@ void TMainWindow::SaveMBaseValue(double value) ui->tableWidget->blockSignals(true); ui->tableWidget->selectRow(row); ui->tableWidget->blockSignals(false); + + ShowMData(); } //--------------------------------------------------------------------------------------------------------------------- @@ -1623,22 +1609,6 @@ void TMainWindow::SaveMSizeIncrease(double value) } const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName); - - QSharedPointer meash; - - try - { - // Translate to internal look. - meash = data->GetVariable(nameField->data(Qt::UserRole).toString()); - } - catch(const VExceptionBadId &e) - { - qCWarning(tMainWindow, "%s\n\n%s\n\n%s", - qUtf8Printable(tr("Can't find measurement '%1'.").arg(nameField->text())), - qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); - return; - } - m->SetMSizeIncrease(nameField->data(Qt::UserRole).toString(), value); MeasurementsWasSaved(false); @@ -1649,6 +1619,8 @@ void TMainWindow::SaveMSizeIncrease(double value) ui->tableWidget->blockSignals(true); ui->tableWidget->selectRow(row); ui->tableWidget->blockSignals(false); + + ShowMData(); } //--------------------------------------------------------------------------------------------------------------------- @@ -1662,22 +1634,6 @@ void TMainWindow::SaveMHeightIncrease(double value) } const QTableWidgetItem *nameField = ui->tableWidget->item(ui->tableWidget->currentRow(), ColumnName); - - QSharedPointer meash; - - try - { - // Translate to internal look. - meash = data->GetVariable(nameField->data(Qt::UserRole).toString()); - } - catch(const VExceptionBadId &e) - { - qCWarning(tMainWindow, "%s\n\n%s\n\n%s", - qUtf8Printable(tr("Can't find measurement '%1'.").arg(nameField->text())), - qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation())); - return; - } - m->SetMHeightIncrease(nameField->data(Qt::UserRole).toString(), value); MeasurementsWasSaved(false); @@ -1688,6 +1644,8 @@ void TMainWindow::SaveMHeightIncrease(double value) ui->tableWidget->blockSignals(true); ui->tableWidget->selectRow(row); ui->tableWidget->blockSignals(false); + + ShowMData(); } //--------------------------------------------------------------------------------------------------------------------- @@ -2919,6 +2877,16 @@ void TMainWindow::SetDecimals() switch (mUnit) { case Unit::Cm: + ui->doubleSpinBoxBaseValue->setDecimals(2); + ui->doubleSpinBoxBaseValue->setSingleStep(0.01); + + ui->doubleSpinBoxInSizes->setDecimals(2); + ui->doubleSpinBoxInSizes->setSingleStep(0.01); + + ui->doubleSpinBoxInHeights->setDecimals(2); + ui->doubleSpinBoxInHeights->setSingleStep(0.01); + break; + case Unit::Mm: ui->doubleSpinBoxBaseValue->setDecimals(1); ui->doubleSpinBoxBaseValue->setSingleStep(0.1); @@ -2928,16 +2896,6 @@ void TMainWindow::SetDecimals() ui->doubleSpinBoxInHeights->setDecimals(1); ui->doubleSpinBoxInHeights->setSingleStep(0.1); break; - case Unit::Mm: - ui->doubleSpinBoxBaseValue->setDecimals(0); - ui->doubleSpinBoxBaseValue->setSingleStep(1); - - ui->doubleSpinBoxInSizes->setDecimals(0); - ui->doubleSpinBoxInSizes->setSingleStep(1); - - ui->doubleSpinBoxInHeights->setDecimals(0); - ui->doubleSpinBoxInHeights->setSingleStep(1); - break; case Unit::Inch: ui->doubleSpinBoxBaseValue->setDecimals(5); ui->doubleSpinBoxBaseValue->setSingleStep(0.00001); diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 129dae53a..436211ad1 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -62,7 +62,13 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent) shadows(QList()), scenes(QList()), details(QList >()), undoAction(nullptr), redoAction(nullptr), actionDockWidgetToolOptions(nullptr), actionDockWidgetGroups(nullptr), curFile(QString()), - isLayoutStale(true), margins(), paperSize(), isTiled(false) + isLayoutStale(true), + margins(), + paperSize(), + isTiled(false), + isAutoCrop(false), + isUnitePages(false) + { InitTempLayoutScene(); } @@ -130,6 +136,8 @@ bool MainWindowsNoGUI::LayoutSettings(VLayoutGenerator& lGenerator) PrepareSceneList(); margins = lGenerator.GetFields(); paperSize = QSizeF(lGenerator.GetPaperWidth(), lGenerator.GetPaperHeight()); + isAutoCrop = lGenerator.GetAutoCrop(); + isUnitePages = lGenerator.IsUnitePages(); isLayoutStale = false; if (VApplication::IsGUIMode()) { @@ -913,7 +921,16 @@ void MainWindowsNoGUI::SetPrinterSettings(QPrinter *printer, const PrintType &pr if (not isTiled) { - const QSizeF size = QSizeF(FromPixel(paperSize.width(), Unit::Mm), FromPixel(paperSize.height(), Unit::Mm)); + QSizeF size = QSizeF(FromPixel(paperSize.width(), Unit::Mm), FromPixel(paperSize.height(), Unit::Mm)); + if (isAutoCrop || isUnitePages) + { + auto *paper = qgraphicsitem_cast(papers.at(0)); + if (paper) + { + size = QSizeF(FromPixel(paperSize.width(), Unit::Mm), FromPixel(paper->rect().height(), Unit::Mm)); + } + } + const QPrinter::PageSize pSZ = FindTemplate(size); if (pSZ == QPrinter::Custom) { diff --git a/src/app/valentina/mainwindowsnogui.h b/src/app/valentina/mainwindowsnogui.h index fa37d740d..dbff87c6c 100644 --- a/src/app/valentina/mainwindowsnogui.h +++ b/src/app/valentina/mainwindowsnogui.h @@ -103,6 +103,8 @@ private: Q_DISABLE_COPY(MainWindowsNoGUI) bool isTiled; + bool isAutoCrop; + bool isUnitePages; void CreateShadows(); void CreateScenes(); diff --git a/src/app/valentina/valentina.pro b/src/app/valentina/valentina.pro index d8765cfee..f1c0ba838 100644 --- a/src/app/valentina/valentina.pro +++ b/src/app/valentina/valentina.pro @@ -437,20 +437,20 @@ win32:*-g++ { SCP_FOUND = false exists("C:/Program Files (x86)/Inno Setup 5/iscc.exe") { - INNO_ISCC = "C:/Program Files (x86)/Inno Setup 5/iscc.exe" - SCP_FOUND = true - } else { - exists(INNO_ISCC = "C:/Program Files/Inno Setup 5/iscc.exe") { - INNO_ISCC = INNO_ISCC = "C:/Program Files/Inno Setup 5/iscc.exe" - SCP_FOUND = true - } + INNO_ISCC = "C:/Program Files (x86)/Inno Setup 5/iscc.exe" + SCP_FOUND = true + } else { + exists("C:/Program Files/Inno Setup 5/iscc.exe") { + INNO_ISCC = "C:/Program Files/Inno Setup 5/iscc.exe" + SCP_FOUND = true + } } if($$SCP_FOUND) { package_inno.path = $${OUT_PWD}/../../../package package_inno.files += \ $$PWD/../../../dist/win/inno/LICENSE_VALENTINA \ - $$PWD/../../../dist/win/inno/valentina.iss + $$PWD/../../../dist/win/inno/valentina.iss INSTALLS += package_inno # Do the packaging