Warn about stale layout only in GUI mode.

This commit is contained in:
Roman Telezhynskyi 2021-07-09 15:38:53 +03:00
parent a1d4ea13c4
commit 7043d59858
3 changed files with 19 additions and 13 deletions

View File

@ -1,6 +1,7 @@
# Valentina 0.7.50 (unreleased)
- Fix regression. Minimal seam allowance width is less than the point accuracy values.
- Call autosave only in GUI mode.
- Warn about stale layout only in GUI mode.
# Valentina 0.7.49 July 1, 2021
- Fix crash.

View File

@ -744,16 +744,21 @@ auto VPrintLayout::WatermarkData() const -> VWatermarkData
//---------------------------------------------------------------------------------------------------------------------
auto VPrintLayout::ContinueIfLayoutStale(QWidget *parent) -> int
{
QMessageBox msgBox(parent);
msgBox.setIcon(QMessageBox::Question);
msgBox.setWindowTitle(tr("The layout is stale."));
msgBox.setText(tr("The layout was not updated since last pattern modification. Do you want to continue?"));
msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
const int width = 500;
auto* horizontalSpacer = new QSpacerItem(width, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
auto* layout = qobject_cast<QGridLayout*>(msgBox.layout());
SCASSERT(layout != nullptr)
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
return msgBox.exec();
if (VAbstractApplication::VApp()->IsAppInGUIMode())
{
QMessageBox msgBox(parent);
msgBox.setIcon(QMessageBox::Question);
msgBox.setWindowTitle(tr("The layout is stale."));
msgBox.setText(tr("The layout was not updated since last pattern modification. Do you want to continue?"));
msgBox.setStandardButtons(QMessageBox::Yes|QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::No);
const int width = 500;
auto* horizontalSpacer = new QSpacerItem(width, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
auto* layout = qobject_cast<QGridLayout*>(msgBox.layout());
SCASSERT(layout != nullptr)
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
return msgBox.exec();
}
return QMessageBox::Yes;
}

View File

@ -138,7 +138,7 @@ private:
bool m_isAutoCropWidth{false};
bool m_isUnitePages{false};
QString m_layoutPrinterName{};
bool m_isLayoutStale{true};
bool m_isLayoutStale{false};
QMarginsF m_tiledMargins{};
PageOrientation m_tiledPDFOrientation{PageOrientation::Portrait};
QSizeF m_tiledPDFPaperSize{};