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

View File

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