Add Don't ask again for Stale layout question dialog.

This commit is contained in:
Roman Telezhynskyi 2021-10-19 11:36:26 +03:00
parent 8f5bf16b4d
commit 4b3b7a8987
5 changed files with 38 additions and 11 deletions

View File

@ -14,6 +14,7 @@
- Show tooltip about defined user material in the label placeholder list.
- Fix reading tiled page margins in console mode.
- Fix handling numeric values passed in console mode.
- Add Don't ask again for Stale layout question dialog.
# Valentina 0.7.49 July 1, 2021
- Fix crash.

View File

@ -116,6 +116,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
settings->SetConfirmItemDelete(true);
settings->SetConfirmFormatRewriting(true);
settings->SetAskContinueIfLayoutStale(true);
});
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();

View File

@ -50,6 +50,7 @@
#include "../ifc/xml/vwatermarkconverter.h"
#include "../ifc/exception/vexception.h"
#include "../vmisc/vmath.h"
#include "../vpropertyexplorer/checkablemessagebox.h"
namespace
{
@ -722,21 +723,29 @@ auto VPrintLayout::ContinueIfLayoutStale(QWidget *parent) -> int
{
if (VAbstractApplication::VApp()->IsAppInGUIMode())
{
QMessageBox msgBox(parent);
msgBox.setIcon(QMessageBox::Question);
if (not VAbstractApplication::VApp()->Settings()->GetAskContinueIfLayoutStale())
{
return QMessageBox::Yes;
}
Utils::CheckableMessageBox msgBox(parent);
msgBox.setIconPixmap(QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(32, 32) );
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();
msgBox.setStandardButtons(QDialogButtonBox::Yes|QDialogButtonBox::No);
msgBox.setDefaultButton(QDialogButtonBox::No);
int dialogResult = msgBox.exec();
if (msgBox.isChecked())
{
VAbstractApplication::VApp()->Settings()->SetAskContinueIfLayoutStale(false);
}
return dialogResult == QDialog::Accepted ? QMessageBox::Yes : QMessageBox::No;
}
return QMessageBox::Yes;
return QDialogButtonBox::Yes;
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -88,6 +88,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPMSystemCode, (QLatin1String("co
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationUnit, (QLatin1String("configuration/unit")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmItemDeletion, (QLatin1String("configuration/confirm_item_deletion")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmFormatRewriting, (QLatin1String("configuration/confirm_format_rewriting")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationAskContinueIfLayoutStale, (QLatin1String("configuration/askContinueIfLayoutStale")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle, (QLatin1String("configuration/tool_bar_style")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode, (QLatin1String("configuration/freeCurveMode")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDoubleClickZoomFitBestCurrentPP, (QLatin1String("configuration/doubleClickZoomFitBestCurrentPP")))
@ -599,6 +600,18 @@ void VCommonSettings::SetConfirmFormatRewriting(const bool &value)
setValue(*settingConfigurationConfirmFormatRewriting, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetAskContinueIfLayoutStale() const
{
return value(*settingConfigurationAskContinueIfLayoutStale, 1).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetAskContinueIfLayoutStale(const bool &value)
{
setValue(*settingConfigurationAskContinueIfLayoutStale, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VCommonSettings::GetToolBarStyle() const
{

View File

@ -108,6 +108,9 @@ public:
bool GetConfirmFormatRewriting() const;
void SetConfirmFormatRewriting(const bool &value);
bool GetAskContinueIfLayoutStale() const;
void SetAskContinueIfLayoutStale(const bool &value);
bool GetToolBarStyle() const;
void SetToolBarStyle(const bool &value);