| 89 | } |
| 90 | |
| 91 | void WidgetSettingFrames::OnErrorValue() { |
| 92 | QPalette palette; |
| 93 | palette.setColor(QPalette::Base, QColor(255, 192, 192)); |
| 94 | this->field->setPalette(palette); |
| 95 | |
| 96 | Configurator& configurator = Configurator::Get(); |
| 97 | |
| 98 | if (!configurator.Get(HIDE_MESSAGE_WIDGET_SETTING_FRAMES)) { |
| 99 | const std::string text = |
| 100 | format("The setting input '%s' is invalid. Use list of comma separated integer ranges. Example: '0-2,16'.", |
| 101 | this->data().GetValue()); |
| 102 | const std::string info = |
| 103 | format("Do you want to reset to the setting default value? '%s'", this->meta.default_value.c_str()); |
| 104 | |
| 105 | QMessageBox alert; |
| 106 | alert.setWindowTitle(format("Invalid '%s' setting value", meta.label.c_str()).c_str()); |
| 107 | alert.setText(text.c_str()); |
| 108 | alert.setInformativeText(info.c_str()); |
| 109 | alert.setStandardButtons(QMessageBox::Yes | QMessageBox::No); |
| 110 | alert.setDefaultButton(QMessageBox::Yes); |
| 111 | alert.setIcon(QMessageBox::Critical); |
| 112 | alert.setCheckBox(new QCheckBox("Do not show again.")); |
| 113 | if (alert.exec() == QMessageBox::Yes) { |
| 114 | this->data().SetValue(this->meta.default_value.c_str()); |
| 115 | this->field->setText(this->meta.default_value.c_str()); |
| 116 | this->field->setPalette(default_palette); |
| 117 | this->Resize(); |
| 118 | } |
| 119 | if (alert.checkBox()->isChecked()) { |
| 120 | configurator.Set(HIDE_MESSAGE_WIDGET_SETTING_FRAMES); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | this->timer_error->stop(); |
| 125 | |
| 126 | emit refreshEnableOnly(); |
| 127 | } |
| 128 | |
| 129 | void WidgetSettingFrames::OnValidValue() { |
| 130 | emit refreshEnableOnly(); |