Changeset View
Changeset View
Standalone View
Standalone View
src/Gui/KSMainWindow.cpp
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
47 | #include "SpectacleConfig.h" | 47 | #include "SpectacleConfig.h" | ||
48 | 48 | | |||
49 | KSMainWindow::KSMainWindow(bool onClickAvailable, QWidget *parent) : | 49 | KSMainWindow::KSMainWindow(bool onClickAvailable, QWidget *parent) : | ||
50 | QDialog(parent), | 50 | QDialog(parent), | ||
51 | mKSWidget(new KSWidget), | 51 | mKSWidget(new KSWidget), | ||
52 | mDivider(new QFrame), | 52 | mDivider(new QFrame), | ||
53 | mDialogButtonBox(new QDialogButtonBox), | 53 | mDialogButtonBox(new QDialogButtonBox), | ||
54 | mSendToButton(new QPushButton), | 54 | mSendToButton(new QPushButton), | ||
55 | mConfigureButton(new QToolButton), | ||||
55 | mClipboardButton(new QToolButton), | 56 | mClipboardButton(new QToolButton), | ||
56 | mSaveButton(new QToolButton), | 57 | mSaveButton(new QToolButton), | ||
57 | mSaveMenu(new QMenu), | 58 | mSaveMenu(new QMenu), | ||
58 | mMessageWidget(new KMessageWidget), | 59 | mMessageWidget(new KMessageWidget), | ||
59 | mExportMenu(new ExportMenu(this)), | 60 | mExportMenu(new ExportMenu(this)), | ||
60 | mOnClickAvailable(onClickAvailable) | 61 | mOnClickAvailable(onClickAvailable) | ||
61 | { | 62 | { | ||
62 | // before we do anything, we need to set a window property | 63 | // before we do anything, we need to set a window property | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 106 | { | |||
120 | 121 | | |||
121 | connect(mKSWidget, &KSWidget::newScreenshotRequest, this, &KSMainWindow::captureScreenshot); | 122 | connect(mKSWidget, &KSWidget::newScreenshotRequest, this, &KSMainWindow::captureScreenshot); | ||
122 | connect(mKSWidget, &KSWidget::dragInitiated, this, &KSMainWindow::dragAndDropRequest); | 123 | connect(mKSWidget, &KSWidget::dragInitiated, this, &KSMainWindow::dragAndDropRequest); | ||
123 | 124 | | |||
124 | // the Button Bar | 125 | // the Button Bar | ||
125 | 126 | | |||
126 | mDialogButtonBox->setStandardButtons(QDialogButtonBox::Help); | 127 | mDialogButtonBox->setStandardButtons(QDialogButtonBox::Help); | ||
127 | 128 | | |||
129 | mConfigureButton->setDefaultAction(KStandardAction::preferences(this, SLOT(showPreferencesDialog()), this)); | ||||
130 | mConfigureButton->setText(i18n("Configure...")); | ||||
131 | mConfigureButton->setToolTip(i18n("Change Spectacle's settings.")); | ||||
132 | mConfigureButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | ||||
rkflx: As far as I can see we don't need to set this, because the default is the same? (Same thing for… | |||||
133 | mDialogButtonBox->addButton(mConfigureButton, QDialogButtonBox::ResetRole); | ||||
134 | | ||||
@ngraham Using QDialogButtonBox::ResetRole will do what we want. rkflx: @ngraham Using `QDialogButtonBox::ResetRole` will do what we want. | |||||
128 | KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export Image..."))); | 135 | KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export Image..."))); | ||
129 | mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share"))); | 136 | mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share"))); | ||
130 | mDialogButtonBox->addButton(mSendToButton, QDialogButtonBox::ActionRole); | 137 | mDialogButtonBox->addButton(mSendToButton, QDialogButtonBox::ActionRole); | ||
131 | 138 | | |||
132 | mClipboardButton->setDefaultAction(KStandardAction::copy(this, SLOT(sendToClipboard()), this)); | 139 | mClipboardButton->setDefaultAction(KStandardAction::copy(this, SLOT(sendToClipboard()), this)); | ||
133 | mClipboardButton->setText(i18n("Copy To Clipboard")); | 140 | mClipboardButton->setText(i18n("Copy To Clipboard")); | ||
134 | mClipboardButton->setToolTip(i18n("Copy the current screenshot image to the clipboard.")); | 141 | mClipboardButton->setToolTip(i18n("Copy the current screenshot image to the clipboard.")); | ||
135 | mClipboardButton->setIcon(QIcon::fromTheme(QStringLiteral("edit-copy"))); | | |||
136 | mClipboardButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | 142 | mClipboardButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | ||
137 | mDialogButtonBox->addButton(mClipboardButton, QDialogButtonBox::ActionRole); | 143 | mDialogButtonBox->addButton(mClipboardButton, QDialogButtonBox::ActionRole); | ||
138 | 144 | | |||
139 | mSaveButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | 145 | mSaveButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | ||
140 | mSaveButton->setMenu(mSaveMenu); | 146 | mSaveButton->setMenu(mSaveMenu); | ||
141 | mSaveButton->setPopupMode(QToolButton::MenuButtonPopup); | 147 | mSaveButton->setPopupMode(QToolButton::MenuButtonPopup); | ||
142 | buildSaveMenu(); | 148 | buildSaveMenu(); | ||
143 | mDialogButtonBox->addButton(mSaveButton, QDialogButtonBox::ActionRole); | 149 | mDialogButtonBox->addButton(mSaveButton, QDialogButtonBox::ActionRole); | ||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Line(s) | 217 | case 2: | |||
212 | mSaveButton->setDefaultAction(actionSaveExit); | 218 | mSaveButton->setDefaultAction(actionSaveExit); | ||
213 | mSaveMenu->addAction(actionSave); | 219 | mSaveMenu->addAction(actionSave); | ||
214 | mSaveMenu->addAction(actionSaveAs); | 220 | mSaveMenu->addAction(actionSaveAs); | ||
215 | break; | 221 | break; | ||
216 | } | 222 | } | ||
217 | 223 | | |||
218 | // finish off building the menu | 224 | // finish off building the menu | ||
219 | mSaveMenu->addAction(KStandardAction::print(this, SLOT(showPrintDialog()), this)); | 225 | mSaveMenu->addAction(KStandardAction::print(this, SLOT(showPrintDialog()), this)); | ||
220 | mSaveMenu->addSeparator(); | | |||
221 | mSaveMenu->addAction(QIcon::fromTheme(QStringLiteral("applications-system")), i18n("Preferences"), | | |||
222 | this, SLOT(showPreferencesDialog())); | | |||
223 | } | 226 | } | ||
224 | 227 | | |||
225 | // overrides | 228 | // overrides | ||
226 | 229 | | |||
227 | void KSMainWindow::moveEvent(QMoveEvent *event) | 230 | void KSMainWindow::moveEvent(QMoveEvent *event) | ||
228 | { | 231 | { | ||
229 | Q_UNUSED(event); | 232 | Q_UNUSED(event); | ||
230 | 233 | | |||
▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines |
As far as I can see we don't need to set this, because the default is the same? (Same thing for mClipboardButton.)