| 421 | } |
| 422 | |
| 423 | void OptionsDialog::updatePreview() |
| 424 | { |
| 425 | Screenshot::NamingOptions options; |
| 426 | |
| 427 | options.naming = (Screenshot::Naming) ui.namingComboBox->currentIndex(); |
| 428 | options.flip = settings()->value("options/flip", false).toBool(); |
| 429 | options.leadingZeros = settings()->value("options/naming/leadingZeros", 0).toInt(); |
| 430 | options.dateFormat = settings()->value("options/naming/dateFormat", "yyyy-MM-dd").toString(); |
| 431 | |
| 432 | if (ui.fileGroupBox->isChecked()) { // Only change the naming button when file options are enabled. |
| 433 | ui.namingOptionsButton->setDisabled((options.naming == Screenshot::Empty)); |
| 434 | } |
| 435 | |
| 436 | QString preview = Screenshot::getName(options, |
| 437 | ui.prefixLineEdit->text(), |
| 438 | QDir(ui.targetLineEdit->text())); |
| 439 | |
| 440 | preview = QString("%1.%2").arg(preview).arg(ui.formatComboBox->currentText().toLower()); |
| 441 | |
| 442 | if (preview.length() >= 40) { |
| 443 | preview.truncate(37); |
| 444 | preview.append("..."); |
| 445 | } |
| 446 | |
| 447 | ui.previewLabel->setText(preview); |
| 448 | |
| 449 | ui.qualitySlider->setEnabled(ui.formatComboBox->currentText() != "PNG"); |
| 450 | ui.qualityLabel->setEnabled(ui.qualitySlider->isEnabled()); |
| 451 | } |
| 452 | |
| 453 | void OptionsDialog::viewHistory() |
| 454 | { |