diff --git a/README.md b/README.md index ae7611e..f06c5d4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -##Lightscreen +## Lightscreen [![Build status](https://ci.appveyor.com/api/projects/status/26q7pg1q5u4ukxbg?svg=true)](https://ci.appveyor.com/project/ckaiser/lightscreen) [![Coverity status](https://scan.coverity.com/projects/6066/badge.svg)](https://scan.coverity.com/projects/ckaiser-lightscreen) A screenshot tool. diff --git a/dialogs/namingdialog.cpp b/dialogs/namingdialog.cpp index 188571f..89c0ae9 100644 --- a/dialogs/namingdialog.cpp +++ b/dialogs/namingdialog.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,8 @@ NamingDialog::NamingDialog(Screenshot::Naming naming, QWidget *parent) : ui.dateFormatComboBox->setCurrentIndex(ui.dateFormatComboBox->count() - 1); } + updateDatePreview(); + ui.leadingZerosSpinBox->setValue(settings->value("options/naming/leadingZeros", 0).toInt()); // Signals/Slots @@ -55,6 +58,7 @@ NamingDialog::NamingDialog(Screenshot::Naming naming, QWidget *parent) : connect(ui.dateHelpLabel, &QLabel::linkActivated, this, [](const QUrl &url) { QDesktopServices::openUrl(QUrl(url)); }); + connect(ui.dateFormatComboBox, &QComboBox::currentTextChanged, this, &NamingDialog::updateDatePreview); // Stack & window size adjustments ui.stack->setCurrentIndex((int)naming); @@ -68,15 +72,35 @@ bool NamingDialog::eventFilter(QObject *object, QEvent *event) if (event->type() == QEvent::KeyPress && object == ui.dateFormatComboBox) { QKeyEvent *keyEvent = (QKeyEvent *)(event); +#ifdef Q_OS_WIN if (QRegExp("[?:\\\\/*\"<>|]").exactMatch(keyEvent->text())) { event->ignore(); return true; } +#endif + +#ifdef Q_OS_MACOS + if (keyEvent->text().contains(":")) { + event->ignore(); + return true; + } +#endif + +#ifdef Q_OS_UNIX + if (keyEvent->text().contains("/")) { + event->ignore(); + return true; + } +#endif } return QDialog::eventFilter(object, event); } +void NamingDialog::updateDatePreview() { + ui.datePreviewLabel->setText(tr("Preview: ") + QDateTime::currentDateTime().toString(ui.dateFormatComboBox->currentText())); +} + void NamingDialog::saveSettings() { auto settings = ScreenshotManager::instance()->settings(); settings->setValue("options/flip" , ui.flipNamingCheckBox->isChecked()); diff --git a/dialogs/namingdialog.h b/dialogs/namingdialog.h index 2a71f5f..8c64fb4 100644 --- a/dialogs/namingdialog.h +++ b/dialogs/namingdialog.h @@ -36,6 +36,7 @@ class NamingDialog : public QDialog public slots: void saveSettings(); + void updateDatePreview(); private: Ui::NamingDialog ui; diff --git a/dialogs/namingdialog.ui b/dialogs/namingdialog.ui index af5baa9..d3f38bd 100644 --- a/dialogs/namingdialog.ui +++ b/dialogs/namingdialog.ui @@ -130,10 +130,21 @@ 0 - - + + + + + 10 + + + + margin-left: 4px + - Date Format: + <a href="https://lightscreen.com.ar/help#date">[?]</a> + + + Qt::AlignCenter @@ -150,21 +161,10 @@ - - - - - 10 - - - - margin-left: 4px - + + - <a href="https://lightscreen.com.ar/help#date">[?]</a> - - - Qt::AlignCenter + Date Format: @@ -183,6 +183,23 @@ yyyy-MM-dd HH.mm.ss + + + ddd MMMM d yy + + + + + dddd d of MMMM + + + + + + + + + diff --git a/dialogs/optionsdialog.ui b/dialogs/optionsdialog.ui index a90bce3..33d44e5 100644 --- a/dialogs/optionsdialog.ui +++ b/dialogs/optionsdialog.ui @@ -198,11 +198,6 @@ BMP - - - WEBP - -