[spectacle] /: Clean up and standardize Settings dialog

Nathaniel Graham null at kde.org
Mon Nov 6 04:51:10 UTC 2017


Git commit 02ce6a91d2d33e77b8058263699d8cc631f73062 by Nathaniel Graham.
Committed on 06/11/2017 at 04:51.
Pushed by ngraham into branch 'master'.

Clean up and standardize Settings dialog

Summary: Cleaned up and standardized Spectacle's Settings page, which was a bit bloated with unnecessary information and nonstandard formatting, terminology, and icons, and lacked any room to add any new settings (such as one for 372408)

Test Plan:
Tested in KDE Neon; all options still work, and Docbook is up to date with the new item labels. The best way to see what this patch does is to just look at before-and-after screenshots:

General page before:
{F5453807}

General page after:
{F5453820}

Save page before:
{F5453809}

Save page after:
{F5453821}

Reviewers: #spectacle, broulik, #kde_applications, #vdg, abetts, bgupta, jensreuterberg

Reviewed By: #vdg, abetts

Subscribers: bgupta

Tags: #spectacle

Differential Revision: https://phabricator.kde.org/D8530

M  +10   -18   doc/index.docbook
M  +14   -71   src/Gui/SettingsDialog/GeneralOptionsPage.cpp
M  +26   -40   src/Gui/SettingsDialog/SaveOptionsPage.cpp
M  +6    -6    src/Gui/SettingsDialog/SettingsDialog.cpp

https://commits.kde.org/spectacle/02ce6a91d2d33e77b8058263699d8cc631f73062

diff --git a/doc/index.docbook b/doc/index.docbook
index ad8bbde..5552edd 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -223,42 +223,40 @@
 		</sect1>
 
 		<sect1>
-			<title>Configure Options</title>
+			<title>Configure</title>
 				<para>Use <menuchoice><guimenu>Save & Exit</guimenu><guimenuitem>Preferences</guimenuitem></menuchoice> to open the configuration dialog.</para>
 			<sect2>
-			<title>Application Preferences</title>
+			<title>General</title>
 				<mediaobject>
 					<imageobject>
 						<imagedata fileref="ApplicationPreferences.png" format="PNG"/>
 					</imageobject>
 					<textobject>
-						<phrase>Application Preferences</phrase>
+						<phrase>General</phrase>
 					</textobject>
 				</mediaobject>
 			<variablelist>
 				<varlistentry>
-					<term><guilabel>Dynamic Save Button</guilabel></term>
+					<term><guilabel>Remember last used save mode</guilabel></term>
 					<listitem>
-						<para>The default behavior of the dynamic save button is to <guibutton>Save & Exit</guibutton>. Enable this option to change the save button to
-						either <guibutton>Save</guibutton>, <guibutton>Save As</guibutton> or <guibutton>Save & Exit</guibutton>, according to the save action you
-						perform, every time you save an image.</para>
+						<para>The default behavior of the save button is to <guibutton>Save & Exit</guibutton>. Enable this option to make the button remember the last used save command so you don't need to open the dropdown menu to access it. This is useful if you want to take multiple screenshots and use Save As to give them unique names or save them to different places.</para>
 					</listitem>
 				</varlistentry>
 				<varlistentry>
-					<term><guilabel>Copy Save Location to Clipboard</guilabel></term>
+					<term><guilabel>Copy save location to clipboard</guilabel></term>
 					<listitem>
 						<para>When a screenshot is saved, copy the location at which the file was saved to the clipboard. You can then paste it anywhere that accepts
 						text input. Note that you must be running a clipboard manager in order to keep the path in the clipboard after &spectacle; quits.</para>
 					</listitem>
 				</varlistentry>
 				<varlistentry>
-					<term><guilabel>Light Background For Rectangular Region</guilabel></term>
+					<term><guilabel>Use light background</guilabel></term>
 					<listitem>
 						<para>Use a light background color to mask the cropped-out area in the rectangular region selector. This may make dark cursors easier to see.</para>
 					</listitem>
 				</varlistentry>
 				<varlistentry>
-					<term><guilabel>Remember Rectangular Region</guilabel></term>
+					<term><guilabel>Remember selected area</guilabel></term>
 					<listitem>
 						<para>By default, &spectacle; does not show an initial selection when you take a screenshot of a rectangular region. Enable this option to remember
 						the last selected region of the screen, and set it as the initial selection when you use the rectangular region selector the next time.</para>
@@ -267,7 +265,7 @@
 			</variablelist>
 			</sect2>
 			<sect2>
-			<title>Configure Save Options</title>
+			<title>Save</title>
 			<para>When you use the <guilabel>Save & Exit</guilabel> or the <guilabel>Save</guilabel> functions, &spectacle; saves the image with a default filename, in your Pictures folder under your home folder. The default filename includes the date and time when the image was taken.</para>
 
 			<para>The <guilabel>Save Options</guilabel> page allows you to set the default save location and filename. Clicking this option brings up a dialog box like the following:
@@ -276,7 +274,7 @@
 						<imagedata fileref="SaveOptions.png" format="PNG"/>
 					</imageobject>
 					<textobject>
-						<phrase>Configure Save Options</phrase>
+						<phrase>Save</phrase>
 					</textobject>
 				</mediaobject>
 			</para>
@@ -305,12 +303,6 @@
 						<para>Typing an extension into the filename will automatically set the image format correctly and remove the extension from the filename field.</para>
 					</listitem>
 				</varlistentry>
-				<varlistentry>
-					<term>Use light background color</term>
-					<listitem>
-						<para>Use a light background color to mask the cropped-out area in the rectangular region selector. This may make dark cursors easier to see.</para>
-					</listitem>
-				</varlistentry>
 			</variablelist>
 			</sect2>
 		</sect1>
diff --git a/src/Gui/SettingsDialog/GeneralOptionsPage.cpp b/src/Gui/SettingsDialog/GeneralOptionsPage.cpp
index 1ffddd9..f948c7e 100644
--- a/src/Gui/SettingsDialog/GeneralOptionsPage.cpp
+++ b/src/Gui/SettingsDialog/GeneralOptionsPage.cpp
@@ -37,98 +37,41 @@ GeneralOptionsPage::GeneralOptionsPage(QWidget *parent) :
 
     // dynamic save button
 
-    QGroupBox *dsGroup = new QGroupBox(i18n("Dynamic Save Button"));
-    QVBoxLayout *dsLayout = new QVBoxLayout;
-    dsGroup->setLayout(dsLayout);
-    dsGroup->setStyleSheet(QStringLiteral("QGroupBox { font-weight: bold; }"));
-
-    QLabel *dsHelpText = new QLabel;
-    dsHelpText->setWordWrap(true);
-    dsHelpText->setText(i18n("The default behavior of the save button is to <b>Save & Exit</b>. Enable this "
-                             "option to change the save button to either <b>Save</b>, <b>Save As</b> or "
-                             "<b>Save & Exit</b>, according to the save action you perform, every time you "
-                             "save an image."));
-    dsLayout->addWidget(dsHelpText);
-
     mUseLastSaveAction = new QCheckBox;
-    mUseLastSaveAction->setText(i18n("Set save button action to last used save method"));
+    mUseLastSaveAction->setText(i18n("Remember last used Save mode"));
     connect(mUseLastSaveAction, &QCheckBox::toggled, this, &GeneralOptionsPage::markDirty);
-
-    QVBoxLayout *dsCLayout = new QVBoxLayout;
-    dsCLayout->setContentsMargins(15, 10, 0, 10);
-    dsCLayout->addWidget(mUseLastSaveAction);
-    dsLayout->addLayout(dsCLayout);
-    mainLayout->addWidget(dsGroup, 1);
+    mainLayout->addWidget(mUseLastSaveAction, 1);
 
     // copy save path to clipboard
 
-    QGroupBox *cpGroup = new QGroupBox(i18n("Copy Save Location to Clipboard"));
-    QVBoxLayout *cpLayout = new QVBoxLayout;
-    cpGroup->setLayout(cpLayout);
-    cpGroup->setStyleSheet(QStringLiteral("QGroupBox { font-weight: bold; }"));
-
-    QLabel *cpHelpText = new QLabel;
-    cpHelpText->setWordWrap(true);
-    cpHelpText->setText(i18n("When a screenshot is saved, copy the location at which the file was saved "
-                             "to the clipboard. You can then paste it anywhere that accepts text input. "
-                             "Note that you must be running a clipboard manager in order to keep the path "
-                             "in the clipboard after Spectacle quits."));
-    cpLayout->addWidget(cpHelpText);
-
     mCopyPathToClipboard = new QCheckBox;
     mCopyPathToClipboard->setText(i18n("Copy save location to the clipboard"));
     connect(mCopyPathToClipboard, &QCheckBox::toggled, this, &GeneralOptionsPage::markDirty);
+    mainLayout->addWidget(mCopyPathToClipboard, 1);
 
-    QVBoxLayout *cpCLayout = new QVBoxLayout;
-    cpCLayout->setContentsMargins(15, 10, 0, 10);
-    cpCLayout->addWidget(mCopyPathToClipboard);
-    cpLayout->addLayout(cpCLayout);
-    mainLayout->addWidget(cpGroup, 1);
 
-    // use a light background for the rectangular region grabber
+    // Rectangular Region settings
 
-    QGroupBox *lbGroup = new QGroupBox(i18n("Light Background For Rectangular Region"));
-    QVBoxLayout *lbLayout = new QVBoxLayout;
-    lbGroup->setLayout(lbLayout);
-    lbGroup->setStyleSheet(QStringLiteral("QGroupBox { font-weight: bold; }"));
+    QGroupBox *rrGroup = new QGroupBox(i18n("Rectangular Region"));
+    QVBoxLayout *rrLayout = new QVBoxLayout;
+    rrGroup->setLayout(rrLayout);
 
-    QLabel *lbHelpText = new QLabel;
-    lbHelpText->setWordWrap(true);
-    lbHelpText->setText(i18n("Use a light background color to mask the cropped-out area in the rectangular "
-                             "region selector. This may make dark cursors easier to see."));
-    lbLayout->addWidget(lbHelpText);
+    // use light background
 
     mUseLightBackground = new QCheckBox;
-    mUseLightBackground->setText(i18n("Use light background color"));
+    mUseLightBackground->setText(i18n("Use light background"));
     connect(mUseLightBackground, &QCheckBox::toggled, this, &GeneralOptionsPage::markDirty);
+    mainLayout->addWidget(mUseLightBackground, 1);
 
-    QVBoxLayout *lbCLayout = new QVBoxLayout;
-    lbCLayout->setContentsMargins(15, 10, 0, 10);
-    lbCLayout->addWidget(mUseLightBackground);
-    lbLayout->addLayout(lbCLayout);
-    mainLayout->addWidget(lbGroup, 1);
-
-    // remember rectangular region
-
-    QGroupBox *rrGroup = new QGroupBox(i18n("Remember Rectangular Region"));
-    QVBoxLayout *rrLayout = new QVBoxLayout;
-    rrGroup->setLayout(rrLayout);
-    rrGroup->setStyleSheet(QStringLiteral("QGroupBox { font-weight: bold; }"));
-
-    QLabel *rrHelpText = new QLabel;
-    rrHelpText->setWordWrap(true);
-    rrHelpText->setText(i18n("By default, Spectacle does not show an initial selection when you take a "
-                             "screenshot of a rectangular region. Enable this option to remember the last "
-                             "selected region of the screen, and set it as the initial selection when you "
-                             "use the rectangular region selector the next time."));
-    rrLayout->addWidget(rrHelpText);
+    // remember Rectangular Region box
 
     mRememberRect = new QCheckBox;
-    mRememberRect->setText(i18n("Remember rectangular region"));
+    mRememberRect->setText(i18n("Remember selected area"));
     connect(mRememberRect, &QCheckBox::toggled, this, &GeneralOptionsPage::markDirty);
 
     QVBoxLayout *rrCLayout = new QVBoxLayout;
-    rrCLayout->setContentsMargins(15, 10, 0, 10);
+//     rrCLayout->setContentsMargins(15, 10, 0, 10);
+    rrCLayout->addWidget(mUseLightBackground);
     rrCLayout->addWidget(mRememberRect);
     rrLayout->addLayout(rrCLayout);
     mainLayout->addWidget(rrGroup, 1);
diff --git a/src/Gui/SettingsDialog/SaveOptionsPage.cpp b/src/Gui/SettingsDialog/SaveOptionsPage.cpp
index d8bcd96..9a8fb09 100644
--- a/src/Gui/SettingsDialog/SaveOptionsPage.cpp
+++ b/src/Gui/SettingsDialog/SaveOptionsPage.cpp
@@ -38,16 +38,9 @@ SaveOptionsPage::SaveOptionsPage(QWidget *parent) :
 {
     // set up the layout. start with the directory
 
-    QGroupBox *dirGroup = new QGroupBox(i18n("Default Save Directory"));
+    QGroupBox *dirGroup = new QGroupBox(i18n("Default Save Location"));
     QVBoxLayout *dirLayout = new QVBoxLayout;
     dirGroup->setLayout(dirLayout);
-    dirGroup->setStyleSheet(QStringLiteral("QGroupBox { font-weight: bold; }"));
-
-    QLabel *dirHelpText = new QLabel;
-    dirHelpText->setWordWrap(true);
-    dirHelpText->setText(i18n("Set the directory where you'd like to save your screenshots when you press "
-                              "<b>Save</b> or <b>Save & Exit</b>."));
-    dirLayout->addWidget(dirHelpText);
 
     QHBoxLayout *urlRequesterLayout = new QHBoxLayout;
     urlRequesterLayout->addWidget(new QLabel(i18n("Location:")));
@@ -59,42 +52,11 @@ SaveOptionsPage::SaveOptionsPage(QWidget *parent) :
 
     dirLayout->addLayout(urlRequesterLayout);
 
-    // now the save filename format layout
+    // filename chooser text field
 
     QGroupBox *fmtGroup = new QGroupBox(i18n("Default Save Filename"));
     QVBoxLayout *fmtLayout = new QVBoxLayout;
     fmtGroup->setLayout(fmtLayout);
-    fmtGroup->setStyleSheet(QStringLiteral("QGroupBox { font-weight: bold; }"));
-
-    const QString helpText = i18n(
-        "<p>Set a default filename for saved screenshots.</p>"
-
-        "<p>You can use the following placeholders in the filename, which will be replaced "
-        "with actual text when the file is saved:</p>"
-
-        "<blockquote>"
-            "<b>%Y</b>: Year (4 digit)<br />"
-            "<b>%y</b>: Year (2 digit)<br />"
-            "<b>%M</b>: Month<br />"
-            "<b>%D</b>: Day<br />"
-            "<b>%H</b>: Hour<br />"
-            "<b>%m</b>: Minute<br />"
-            "<b>%S</b>: Second"
-        "</blockquote>"
-
-        "<p>If a file with this name already exists, a serial number will be appended to the filename. "
-        "For example, if the filename is \"Screenshot\", and \"Screenshot.png\" already "
-        "exists, the image will be saved as \"Screenshot-1.png\".</p>"
-
-        "<p>Typing an extension into the filename will automatically set the image format correctly "
-        "and remove the extension from the filename field.</p>"
-    );
-
-    QLabel *fmtHelpText = new QLabel;
-    fmtHelpText->setWordWrap(true);
-    fmtHelpText->setText(helpText);
-    fmtHelpText->setTextFormat(Qt::RichText);
-    fmtLayout->addWidget(fmtHelpText);
 
     QHBoxLayout *saveNameLayout = new QHBoxLayout;
     saveNameLayout->addWidget(new QLabel(i18n("Filename:")));
@@ -128,6 +90,29 @@ SaveOptionsPage::SaveOptionsPage(QWidget *parent) :
 
     fmtLayout->addLayout(saveNameLayout);
 
+    // now the save filename format layout
+
+    const QString helpText = i18n(
+        "<p>You can use the following placeholders in the filename, which will be replaced "
+        "with actual text when the file is saved:</p>"
+
+        "<blockquote>"
+            "<b>%Y</b>: Year (4 digit)<br />"
+            "<b>%y</b>: Year (2 digit)<br />"
+            "<b>%M</b>: Month<br />"
+            "<b>%D</b>: Day<br />"
+            "<b>%H</b>: Hour<br />"
+            "<b>%m</b>: Minute<br />"
+            "<b>%S</b>: Second"
+        "</blockquote>"
+    );
+
+    QLabel *fmtHelpText = new QLabel;
+    fmtHelpText->setWordWrap(true);
+    fmtHelpText->setText(helpText);
+    fmtHelpText->setTextFormat(Qt::RichText);
+    fmtLayout->addWidget(fmtHelpText);
+
     // read in the data
 
     resetChanges();
@@ -139,6 +124,7 @@ SaveOptionsPage::SaveOptionsPage(QWidget *parent) :
     mainLayout->addWidget(dirGroup);
     mainLayout->addWidget(fmtGroup);
 
+    mainLayout->addStretch(4);
     setLayout(mainLayout);
 }
 
diff --git a/src/Gui/SettingsDialog/SettingsDialog.cpp b/src/Gui/SettingsDialog/SettingsDialog.cpp
index 7cfe8e2..8b260fb 100644
--- a/src/Gui/SettingsDialog/SettingsDialog.cpp
+++ b/src/Gui/SettingsDialog/SettingsDialog.cpp
@@ -33,9 +33,9 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
     KPageDialog(parent)
 {
     // set up window options and geometry
-    setWindowTitle(i18n("Preferences"));
+    setWindowTitle(i18n("Configure"));
     setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
-    resize(500, 700);
+    resize(500, 470);
 
     // init all pages
     QMetaObject::invokeMethod(this, "initPages", Qt::QueuedConnection);
@@ -44,13 +44,13 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
 void SettingsDialog::initPages()
 {
     KPageWidgetItem *generalOptions = new KPageWidgetItem(new GeneralOptionsPage(this), i18n("General"));
-    generalOptions->setHeader(i18n("Application Preferences"));
-    generalOptions->setIcon(QIcon::fromTheme(QStringLiteral("applications-system")));
+    generalOptions->setHeader(i18n("General"));
+    generalOptions->setIcon(QIcon::fromTheme(QStringLiteral("view-preview"))); // This is what Dolphin uses for the icon on its General page...
     addPage(generalOptions);
     mPages.insert(generalOptions);
 
-    KPageWidgetItem *saveOptions = new KPageWidgetItem(new SaveOptionsPage(this), i18n("Save Options"));
-    saveOptions->setHeader(i18n("Default Save Settings"));
+    KPageWidgetItem *saveOptions = new KPageWidgetItem(new SaveOptionsPage(this), i18n("Save"));
+    saveOptions->setHeader(i18n("Save"));
     saveOptions->setIcon(QIcon::fromTheme(QStringLiteral("document-save")));
     addPage(saveOptions);
     mPages.insert(saveOptions);


More information about the kde-doc-english mailing list