Git commit 45c37a64e1cc9f683ee51bdf6398db89fc241b23 by Gregor Mi.
Committed on 15/02/2018 at 09:09.
Pushed by gregormi into branch 'master'.

Add new button "Record screen" that allows to select a Screen Recording tool

Summary:
Adds a new button "Record screen" that allows to select a screen recording 
tool, currently Peek and SimpleScreenRecorder (and soon vokoscreen: 
https://phabricator.kde.org/D10390)

{F5698788}

Moved from Reviewboard: https://git.reviewboard.kde.org/r/130215/

Reviewers: ngraham, #spectacle, rkflx

Reviewed By: ngraham, #spectacle, rkflx

Subscribers: rkflx

Maniphest Tasks: T7841

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

M  +1    -0    CMakeLists.txt
M  +15   -7    doc/index.docbook
M  +1    -0    src/CMakeLists.txt
M  +9    -0    src/Gui/KSMainWindow.cpp
M  +4    -0    src/Gui/KSMainWindow.h

https://commits.kde.org/spectacle/45c37a64e1cc9f683ee51bdf6398db89fc241b23

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a640df..5cae6ee 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,6 +56,7 @@ find_package(
         WindowSystem
         DocTools
         Declarative
+        NewStuff
 )
 
 add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
diff --git a/doc/index.docbook b/doc/index.docbook
index b0af19f..e3d87a5 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -189,31 +189,39 @@
                <sect1>
                        <title>Buttons</title>
 
-                       <para>There are six buttons located at the bottom of 
the &spectacle; window. Their functions are described below:</para>
+                       <para>There are some buttons located at the bottom of 
the &spectacle; window. Their functions are described below:</para>
 
                        <variablelist>
                                <varlistentry>
                                        <term><guibutton>Help</guibutton></term>
                                        <listitem>
-                                               <para>This button gives you the 
common menu items described in the <ulink 
url="help:/fundamentals/ui.html#menus-help">Help Menu</ulink> of the &kde; 
Fundamentals.</para>
+                                               <para>Gives you the common menu 
items described in the <ulink url="help:/fundamentals/ui.html#menus-help">Help 
Menu</ulink> of the &kde; Fundamentals.</para>
                                        </listitem>
                                </varlistentry>
                                <varlistentry>
                                        
<term><guibutton>Configure...</guibutton></term>
                                        <listitem>
-                                               <para>This button gives you 
access to Spectacle's Configure window where you can change the capture 
settings and default save location and filename.</para>
+                                               <para>Gives you access to 
Spectacle's Configure window where you can change the capture settings and 
default save location and filename.</para>
                                        </listitem>
                                </varlistentry>
                                <varlistentry>
                                        
<term><guibutton>Tools</guibutton></term>
                                        <listitem>
-                                               <para>Clicking on this button 
shows a drop-down menu, offering access to various functions. You can open the 
<guimenuitem>Print</guimenuitem> dialog, and <guimenuitem>Open Screenshots 
Folder</guimenuitem> is a shortcut to highlight the last saved screenshot in 
the default file manager.</para>
+                        <para>Opens a drop-down menu which offers various 
tools:</para>
+                        <itemizedlist>
+                            <listitem>
+                                <para>the print dialog</para>
+                            </listitem>
+                            <listitem>
+                                <para>a range of external programs for Screen 
Recording</para>
+                            </listitem>
+                        </itemizedlist>
                                        </listitem>
                                </varlistentry>
                                <varlistentry>
                                        
<term><guibutton>Export</guibutton></term>
                                        <listitem>
-                                               <para>This drop-down menu will 
allow you to directly open the screenshot with all programs that are associated 
with the PNG (Portable Network Graphics) &MIME; type. Depending on what 
programs are installed, you will be able to open and edit the snapshot in your 
graphics applications or viewers.</para>
+                                               <para>Opens a drop-down menu 
that will allow you to directly open the screenshot with all programs that are 
associated with the PNG (Portable Network Graphics) &MIME; type. Depending on 
what programs are installed, you will be able to open and edit the snapshot in 
your graphics applications or viewers.</para>
 
                                                <para>Furthermore, if you have 
the <application>KIPI Plugins</application> installed, you will be able to 
email your screenshots and export them directly to some social networks and 
websites.</para>
                                        </listitem>
@@ -221,13 +229,13 @@
                                <varlistentry>
                                        <term><guibutton>Copy To 
Clipboard</guibutton></term>
                                        <listitem>
-                                               <para>This button copies the 
current screenshot to the clipboard. You can also use the <keycombo 
action="simul">&Ctrl;<keycap>C</keycap></keycombo> keyboard shortcut for 
this.</para>
+                                               <para>Copies the current 
screenshot to the clipboard. You can also use the <keycombo 
action="simul">&Ctrl;<keycap>C</keycap></keycombo> keyboard shortcut for 
this.</para>
                                        </listitem>
                                </varlistentry>
                                <varlistentry>
                                        <term><guibutton>Save 
As</guibutton></term>
                                        <listitem>
-                                               <para>Clicking this button 
saves the screenshot as a PNG image to a location of your choosing. Clicking on 
the arrow on the side will expose the other save mode, 
<guimenuitem>Save</guimenuitem>, which will save the screenshot as a PNG image 
to the standard location (which defaults to your Pictures folder). By default, 
the last-used save mode is remembered for next time.</para>
+                                               <para>Saves the screenshot as a 
PNG image in your default Pictures folder and immediately exits the 
application.</para>
                                        </listitem>
                                </varlistentry>
                        </variablelist>
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 057da34..71d22ed 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -75,6 +75,7 @@ target_link_libraries(
         KF5::WindowSystem
         KF5::XmlGui
         KF5::Declarative
+        KF5::NewStuff
 )
 
 if(XCB_FOUND)
diff --git a/src/Gui/KSMainWindow.cpp b/src/Gui/KSMainWindow.cpp
index 8c6aa5b..02f8a8a 100644
--- a/src/Gui/KSMainWindow.cpp
+++ b/src/Gui/KSMainWindow.cpp
@@ -41,6 +41,7 @@
 #include <KAboutData>
 #include <KWindowSystem>
 #include <KIO/OpenFileManagerWindowJob>
+#include <KNS3/KMoreToolsMenuFactory>
 
 #include "SettingsDialog/SettingsDialog.h"
 #include "ExportMenu.h"
@@ -66,6 +67,7 @@ KSMainWindow::KSMainWindow(bool onClickAvailable, QWidget 
*parent) :
     mSaveAction(new QAction),
     mMessageWidget(new KMessageWidget),
     mToolsMenu(new QMenu),
+    mScreenRecorderToolsMenu(new QMenu),
     mExportMenu(new ExportMenu(this)),
     mOnClickAvailable(onClickAvailable)
 {
@@ -150,6 +152,13 @@ void KSMainWindow::init()
     KGuiItem::assign(mToolsButton, KGuiItem(i18n("Tools")));
     
mToolsButton->setIcon(QIcon::fromTheme(QStringLiteral("application-menu")));
     mDialogButtonBox->addButton(mToolsButton, QDialogButtonBox::ActionRole);
+    mScreenRecorderToolsMenu = mToolsMenu->addMenu(i18n("Record Screen"));
+    connect(mScreenRecorderToolsMenu, &QMenu::aboutToShow, [this]()
+    {
+        mScreenrecorderToolsMenuFactory.reset(new 
KMoreToolsMenuFactory(QStringLiteral("spectacle/screenrecorder-tools")));
+        mScreenRecorderToolsMenu->clear();
+        
mScreenrecorderToolsMenuFactory->fillMenuFromGroupingNames(mScreenRecorderToolsMenu,
 { QStringLiteral("screenrecorder") });
+    } );
     mToolsButton->setMenu(mToolsMenu);
 
     KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export")));
diff --git a/src/Gui/KSMainWindow.h b/src/Gui/KSMainWindow.h
index 1fb0e1d..0b8086c 100644
--- a/src/Gui/KSMainWindow.h
+++ b/src/Gui/KSMainWindow.h
@@ -33,6 +33,8 @@
 #include "KSWidget.h"
 #include "SpectacleConfig.h"
 
+class KMoreToolsMenuFactory;
+
 class KSMainWindow : public QDialog
 {
     Q_OBJECT
@@ -89,6 +91,8 @@ class KSMainWindow : public QDialog
     QAction          *mSaveAction;
     KMessageWidget   *mMessageWidget;
     QMenu            *mToolsMenu;
+    QMenu            *mScreenRecorderToolsMenu;
+    QScopedPointer<KMoreToolsMenuFactory> mScreenrecorderToolsMenuFactory;
     ExportMenu       *mExportMenu;
     bool              mOnClickAvailable;
 };

Reply via email to