Commit 1243e0e0 authored by Srevin Saju's avatar Srevin Saju 🎲 Committed by Nate Graham
Browse files

feat: use radio buttons for after screenshot clipboard actions

Move UI elements, and remove unnecessary Save location
radiobutton code

fix: disable 'copy to clipboard' checkbox when 'copy file location' is also selected

spectacle previously allowed copying both the image as well as file
location simultaneously to the clipboard. This MR also attempts to fix a corner case which
requires 'Autosave image' to be enabled to 'copy file location to clipboard'.
Previously, if 'Autosave Image' checkbox was not enabled, it was still possible for the user
to copy the file location to clipboard. However, this had indirectly triggered an autosave first.
This is confusing, as spectacle saves the file to its default save location without it
being asked to. So it would be ideal to disable 'Copy file location' if 'Auto Save' option was
not enabled in the first place

fix: typo in label name
parent 4ad9752c
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>463</width>
<height>558</height>
<height>542</height>
</rect>
</property>
<layout class="QFormLayout">
......@@ -21,25 +21,11 @@
<item row="0" column="1">
<widget class="QCheckBox" name="kcfg_autoSaveImage">
<property name="text">
<string>Autosave the image to the default location</string>
<string>Autosave file to default folder</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="kcfg_copyImageToClipboard">
<property name="text">
<string>Copy image to clipboard</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="kcfg_copySaveLocation">
<property name="text">
<string>Copy file location to clipboard after saving</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="2" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -55,21 +41,21 @@
</property>
</spacer>
</item>
<item row="4" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="KTitleWidget" name="runningTitle">
<property name="text">
<string>While Spectacle is running</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="4" column="0">
<widget class="QLabel" name="printKeyActionLabel">
<property name="text">
<string>Press screenshot key to:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="4" column="1">
<widget class="QGroupBox" name="kcfg_printKeyActionRunning">
<property name="title">
<string/>
......@@ -108,7 +94,7 @@
</layout>
</widget>
</item>
<item row="6" column="0" colspan="2">
<item row="5" column="0" colspan="2">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -124,50 +110,67 @@
</property>
</spacer>
</item>
<item row="7" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="KTitleWidget" name="regionTitle">
<property name="text">
<string>Rectangular Region</string>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="7" column="0">
<widget class="QLabel" name="generalLabel">
<property name="text">
<string>General:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="7" column="1">
<widget class="QCheckBox" name="kcfg_useLightMaskColour">
<property name="text">
<string>Use light background</string>
</property>
</widget>
</item>
<item row="9" column="1">
<item row="8" column="1">
<widget class="QCheckBox" name="kcfg_showMagnifier">
<property name="text">
<string>Show magnifier</string>
</property>
</widget>
</item>
<item row="10" column="1">
<item row="9" column="1">
<widget class="QCheckBox" name="kcfg_useReleaseToCapture">
<property name="text">
<string>Accept on click-and-release</string>
</property>
</widget>
</item>
<item row="12" column="0">
<item row="10" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="0">
<widget class="QLabel" name="rememberLabel">
<property name="text">
<string>Remember selected area:</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QRadioButton" name="neverRemeberButton">
<item row="11" column="1">
<widget class="QRadioButton" name="
">
<property name="text">
<string>Never</string>
</property>
......@@ -179,7 +182,7 @@
</attribute>
</widget>
</item>
<item row="13" column="1">
<item row="12" column="1">
<widget class="QRadioButton" name="kcfg_alwaysRememberRegion">
<property name="text">
<string>Always</string>
......@@ -189,7 +192,7 @@
</attribute>
</widget>
</item>
<item row="14" column="1">
<item row="13" column="1">
<widget class="QRadioButton" name="kcfg_rememberLastRectangularRegion">
<property name="text">
<string>Until Spectacle is closed</string>
......@@ -199,21 +202,44 @@
</attribute>
</widget>
</item>
<item row="11" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<item row="1" column="1">
<widget class="QGroupBox" name="kcfg_clipboardGroup">
<property name="title">
<string/>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>18</height>
</size>
<property name="flat">
<bool>true</bool>
</property>
</spacer>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<item>
<widget class="QRadioButton" name="doNothingButton">
<property name="text">
<string>Do nothing</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="copyImageButton">
<property name="text">
<string>Copy image to clipboard</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="copyFileLocationButton">
<property name="text">
<string>Copy file location to clipboard</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
......@@ -225,9 +251,7 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>kcfg_copyImageToClipboard</tabstop>
<tabstop>kcfg_autoSaveImage</tabstop>
<tabstop>kcfg_copySaveLocation</tabstop>
<tabstop>newScreenshotButton</tabstop>
<tabstop>newWindowButton</tabstop>
<tabstop>activateWindowButton</tabstop>
......
......@@ -23,9 +23,6 @@ GeneralOptionsPage::GeneralOptionsPage(QWidget *parent)
m_ui->runningTitle->setLevel(2);
m_ui->regionTitle->setLevel(2);
connect(m_ui->kcfg_copyImageToClipboard, &QCheckBox::stateChanged, this, &GeneralOptionsPage::updateAutomaticActions);
connect(m_ui->kcfg_autoSaveImage, &QCheckBox::stateChanged, this, &GeneralOptionsPage::updateAutomaticActions);
//On Wayland we can't programmatically raise and focus the window so we have to hide the option
if (KWindowSystem::isPlatformWayland() || qstrcmp(qgetenv("XDG_SESSION_TYPE").data(), "wayland") == 0) {
delete m_ui->activateWindowButton;
......@@ -33,14 +30,3 @@ GeneralOptionsPage::GeneralOptionsPage(QWidget *parent)
}
GeneralOptionsPage::~GeneralOptionsPage() = default;
void GeneralOptionsPage::updateAutomaticActions() {
if (m_ui->kcfg_copyImageToClipboard->isChecked() && m_ui->kcfg_autoSaveImage->isChecked()) {
m_ui->kcfg_copySaveLocation->setCheckState(Qt::CheckState::Unchecked);
m_ui->kcfg_copySaveLocation->setCheckable(false);
m_ui->kcfg_copySaveLocation->setDisabled(true);
} else {
m_ui->kcfg_copySaveLocation->setCheckable(true);
m_ui->kcfg_copySaveLocation->setEnabled(true);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment