diff --git a/src/Gui/KSWidget.cpp b/src/Gui/KSWidget.cpp --- a/src/Gui/KSWidget.cpp +++ b/src/Gui/KSWidget.cpp @@ -112,8 +112,8 @@ mCaptureTransientOnly->setEnabled(false); connect(mCaptureTransientOnly, &QCheckBox::clicked, lConfigMgr, &SpectacleConfig::setCaptureTransientWindowOnlyChecked); - mQuitAfterSaveOrCopy = new QCheckBox(i18n("Quit after Save or Copy"), this); - mQuitAfterSaveOrCopy->setToolTip(i18n("Quit Spectacle after saving or copying the image")); + mQuitAfterSaveOrCopy = new QCheckBox(i18n("Quit after manual Save or Copy"), this); + mQuitAfterSaveOrCopy->setToolTip(i18n("Quit Spectacle after manually saving or copying the image")); connect(mQuitAfterSaveOrCopy, &QCheckBox::clicked, lConfigMgr, &SpectacleConfig::setQuitAfterSaveOrCopyChecked); mContentOptionsForm = new QVBoxLayout; diff --git a/src/Gui/SettingsDialog/GeneralOptionsPage.cpp b/src/Gui/SettingsDialog/GeneralOptionsPage.cpp --- a/src/Gui/SettingsDialog/GeneralOptionsPage.cpp +++ b/src/Gui/SettingsDialog/GeneralOptionsPage.cpp @@ -36,11 +36,13 @@ { QFormLayout *mainLayout = new QFormLayout(this); setLayout(mainLayout); - + + // When spectacle is running settings KTitleWidget* runningTitle = new KTitleWidget(this); runningTitle->setText(i18n("When Spectacle is Running")); runningTitle->setLevel(2); mainLayout->addRow(runningTitle); + QRadioButton* takeNew = new QRadioButton(i18n("Take a new screenshot"), this); QRadioButton* startNewInstance = new QRadioButton(i18n("Open a new Spectacle window"), this); mPrintKeyActionGroup = new QButtonGroup(this); @@ -62,19 +64,24 @@ // copy file or file location to clipboard after taking a screenshot QRadioButton *doNothing = new QRadioButton(i18n("Do nothing"), this); QRadioButton *copyImageToClipboard = new QRadioButton(i18n("Copy image to clipboard"), this); + QRadioButton *autoSaveImage = new QRadioButton(i18n("Autosave the image to the default location"), this); mAfterTakingScreenshotGroup = new QButtonGroup(this); mAfterTakingScreenshotGroup->setExclusive(true); mAfterTakingScreenshotGroup->addButton(doNothing, SpectacleConfig::AfterTakingScreenshotAction::DoNothing); mAfterTakingScreenshotGroup->addButton(copyImageToClipboard, SpectacleConfig::AfterTakingScreenshotAction::CopyImageToClipboard); + mAfterTakingScreenshotGroup->addButton(autoSaveImage, SpectacleConfig::AfterTakingScreenshotAction::AutoSaveImage); connect(mAfterTakingScreenshotGroup, qOverload(&QButtonGroup::buttonToggled), this, &GeneralOptionsPage::markDirty); mainLayout->addRow(i18n("After taking a screenshot:"), doNothing); mainLayout->addRow(QString(), copyImageToClipboard); + mainLayout->addRow(QString(), autoSaveImage); + + mainLayout->addItem(new QSpacerItem(0, 18, QSizePolicy::Fixed, QSizePolicy::Fixed)); // Rectangular Region settings - KTitleWidget *titleWidget = new KTitleWidget(this); - titleWidget->setText(i18n("Rectangular Region")); - titleWidget->setLevel(2); - mainLayout->addRow(titleWidget); + KTitleWidget *rectangularRegionWidget = new KTitleWidget(this); + rectangularRegionWidget->setText(i18n("Rectangular Region")); + rectangularRegionWidget->setLevel(2); + mainLayout->addRow(rectangularRegionWidget); // use light background mUseLightBackground = new QCheckBox(i18n("Use light background"), this); diff --git a/src/SpectacleConfig.h b/src/SpectacleConfig.h --- a/src/SpectacleConfig.h +++ b/src/SpectacleConfig.h @@ -57,7 +57,8 @@ enum AfterTakingScreenshotAction : int { DoNothing = 0, - CopyImageToClipboard + CopyImageToClipboard, + AutoSaveImage }; KActionCollection* shortCutActions; diff --git a/src/SpectacleCore.cpp b/src/SpectacleCore.cpp --- a/src/SpectacleCore.cpp +++ b/src/SpectacleCore.cpp @@ -277,6 +277,11 @@ KMessageWidget::Information); } break; + case Actions::AutoSaveImage: + { + QUrl lSavePath = (mFileNameUrl.isValid() && mFileNameUrl.isLocalFile()) ? mFileNameUrl : QUrl(); + lExportManager->doSave(lSavePath); + } } } }