Changeset View
Changeset View
Standalone View
Standalone View
src/Gui/KSMainWindow.cpp
Show All 35 Lines | |||||
36 | #include <KLocalizedString> | 36 | #include <KLocalizedString> | ||
37 | #include <KGuiItem> | 37 | #include <KGuiItem> | ||
38 | #include <KStandardAction> | 38 | #include <KStandardAction> | ||
39 | #include <KStandardGuiItem> | 39 | #include <KStandardGuiItem> | ||
40 | #include <KHelpMenu> | 40 | #include <KHelpMenu> | ||
41 | #include <KAboutData> | 41 | #include <KAboutData> | ||
42 | #include <KWindowSystem> | 42 | #include <KWindowSystem> | ||
43 | #include <KIO/OpenFileManagerWindowJob> | 43 | #include <KIO/OpenFileManagerWindowJob> | ||
44 | #include <KNS3/KMoreToolsMenuFactory> | ||||
44 | 45 | | |||
45 | #include "SettingsDialog/SettingsDialog.h" | 46 | #include "SettingsDialog/SettingsDialog.h" | ||
46 | #include "ExportMenu.h" | 47 | #include "ExportMenu.h" | ||
47 | #include "ExportManager.h" | 48 | #include "ExportManager.h" | ||
48 | #include "SpectacleConfig.h" | 49 | #include "SpectacleConfig.h" | ||
49 | 50 | | |||
50 | static const int DEFAULT_WINDOW_HEIGHT = 420; | 51 | static const int DEFAULT_WINDOW_HEIGHT = 420; | ||
51 | static const int DEFAULT_WINDOW_WIDTH = 840; | 52 | static const int DEFAULT_WINDOW_WIDTH = 840; | ||
Show All 9 Lines | 55 | KSMainWindow::KSMainWindow(bool onClickAvailable, QWidget *parent) : | |||
61 | mSendToButton(new QPushButton), | 62 | mSendToButton(new QPushButton), | ||
62 | mClipboardButton(new QToolButton), | 63 | mClipboardButton(new QToolButton), | ||
63 | mSaveButton(new QToolButton), | 64 | mSaveButton(new QToolButton), | ||
64 | mSaveMenu(new QMenu), | 65 | mSaveMenu(new QMenu), | ||
65 | mSaveAsAction(new QAction), | 66 | mSaveAsAction(new QAction), | ||
66 | mSaveAction(new QAction), | 67 | mSaveAction(new QAction), | ||
67 | mMessageWidget(new KMessageWidget), | 68 | mMessageWidget(new KMessageWidget), | ||
68 | mToolsMenu(new QMenu), | 69 | mToolsMenu(new QMenu), | ||
70 | mScreenRecorderToolsMenu(new QMenu), | ||||
69 | mExportMenu(new ExportMenu(this)), | 71 | mExportMenu(new ExportMenu(this)), | ||
70 | mOnClickAvailable(onClickAvailable) | 72 | mOnClickAvailable(onClickAvailable) | ||
71 | { | 73 | { | ||
72 | // before we do anything, we need to set a window property | 74 | // before we do anything, we need to set a window property | ||
73 | // that skips the close/hide window animation on kwin. this | 75 | // that skips the close/hide window animation on kwin. this | ||
74 | // fixes a ghost image of the spectacle window that appears | 76 | // fixes a ghost image of the spectacle window that appears | ||
75 | // on subsequent screenshots taken with the take new screenshot | 77 | // on subsequent screenshots taken with the take new screenshot | ||
76 | // button | 78 | // button | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 123 | { | |||
145 | mConfigureButton->setText(i18n("Configure...")); | 147 | mConfigureButton->setText(i18n("Configure...")); | ||
146 | mConfigureButton->setToolTip(i18n("Change Spectacle's settings.")); | 148 | mConfigureButton->setToolTip(i18n("Change Spectacle's settings.")); | ||
147 | mConfigureButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | 149 | mConfigureButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | ||
148 | mDialogButtonBox->addButton(mConfigureButton, QDialogButtonBox::ResetRole); | 150 | mDialogButtonBox->addButton(mConfigureButton, QDialogButtonBox::ResetRole); | ||
149 | 151 | | |||
150 | KGuiItem::assign(mToolsButton, KGuiItem(i18n("Tools"))); | 152 | KGuiItem::assign(mToolsButton, KGuiItem(i18n("Tools"))); | ||
151 | mToolsButton->setIcon(QIcon::fromTheme(QStringLiteral("application-menu"))); | 153 | mToolsButton->setIcon(QIcon::fromTheme(QStringLiteral("application-menu"))); | ||
152 | mDialogButtonBox->addButton(mToolsButton, QDialogButtonBox::ActionRole); | 154 | mDialogButtonBox->addButton(mToolsButton, QDialogButtonBox::ActionRole); | ||
155 | mScreenRecorderToolsMenu = mToolsMenu->addMenu(i18n("Record Screen")); | ||||
156 | connect(mScreenRecorderToolsMenu, &QMenu::aboutToShow, [this]() | ||||
rkflx: You could use the three-argument `connect` by removing the last `mScreenRecorderToolsMenu`. | |||||
157 | { | ||||
158 | mScreenrecorderToolsMenuFactory.reset(new KMoreToolsMenuFactory(QStringLiteral("spectacle/screenrecorder-tools"))); | ||||
rkflx: Is `this->` needed? | |||||
159 | mScreenRecorderToolsMenu->clear(); | ||||
160 | mScreenrecorderToolsMenuFactory->fillMenuFromGroupingNames(mScreenRecorderToolsMenu, { QStringLiteral("screenrecorder") }); | ||||
161 | } ); | ||||
153 | mToolsButton->setMenu(mToolsMenu); | 162 | mToolsButton->setMenu(mToolsMenu); | ||
154 | 163 | | |||
155 | KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export"))); | 164 | KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export"))); | ||
156 | mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share"))); | 165 | mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share"))); | ||
157 | mDialogButtonBox->addButton(mSendToButton, QDialogButtonBox::ActionRole); | 166 | mDialogButtonBox->addButton(mSendToButton, QDialogButtonBox::ActionRole); | ||
158 | 167 | | |||
159 | mClipboardButton->setDefaultAction(KStandardAction::copy(this, SLOT(sendToClipboard()), this)); | 168 | mClipboardButton->setDefaultAction(KStandardAction::copy(this, SLOT(sendToClipboard()), this)); | ||
160 | mClipboardButton->setText(i18n("Copy To Clipboard")); | 169 | mClipboardButton->setText(i18n("Copy To Clipboard")); | ||
▲ Show 20 Lines • Show All 235 Lines • Show Last 20 Lines |
You could use the three-argument connect by removing the last mScreenRecorderToolsMenu.