diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,7 @@ WindowSystem DocTools Declarative + NewStuff ) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -75,6 +75,7 @@ KF5::WindowSystem KF5::XmlGui KF5::Declarative + KF5::NewStuff ) if(XCB_FOUND) diff --git a/src/Gui/KSMainWindow.h b/src/Gui/KSMainWindow.h --- a/src/Gui/KSMainWindow.h +++ b/src/Gui/KSMainWindow.h @@ -32,6 +32,8 @@ #include "ExportMenu.h" #include "KSWidget.h" +class KMoreToolsMenuFactory; + class KSMainWindow : public QDialog { Q_OBJECT @@ -79,6 +81,8 @@ QMenu *mSaveMenu; KMessageWidget *mMessageWidget; ExportMenu *mExportMenu; + QPushButton *mScreenrecorderButton; + QScopedPointer mScreenrecorderToolsMenuFactory; bool mOnClickAvailable; }; diff --git a/src/Gui/KSMainWindow.cpp b/src/Gui/KSMainWindow.cpp --- a/src/Gui/KSMainWindow.cpp +++ b/src/Gui/KSMainWindow.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #include "SettingsDialog/SettingsDialog.h" #include "ExportMenu.h" @@ -57,6 +58,7 @@ mSaveMenu(new QMenu), mMessageWidget(new KMessageWidget), mExportMenu(new ExportMenu(this)), + mScreenrecorderButton(new QPushButton), mOnClickAvailable(onClickAvailable) { // before we do anything, we need to set a window property @@ -125,6 +127,17 @@ mDialogButtonBox->setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Discard); + // Screenrecorder tools button: + mScreenrecorderButton->setText(i18n("Record screen")); + mScreenrecorderButton->setMenu(new QMenu(this)); + mDialogButtonBox->addButton(mScreenrecorderButton, QDialogButtonBox::ActionRole); + connect(mScreenrecorderButton->menu(), &QMenu::aboutToShow, mScreenrecorderButton->menu(), [this]() + { + this->mScreenrecorderToolsMenuFactory.reset(new KMoreToolsMenuFactory(QStringLiteral("spectacle/screenrecorder-tools"))); + this->mScreenrecorderButton->menu()->clear(); + this->mScreenrecorderToolsMenuFactory->fillMenuFromGroupingNames(this->mScreenrecorderButton->menu(), { QStringLiteral("screenrecorder") }); + } ); + KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export Image..."))); mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("application-x-executable"))); mDialogButtonBox->addButton(mSendToButton, QDialogButtonBox::ActionRole);