Changeset View
Changeset View
Standalone View
Standalone View
src/Gui/KSMainWindow.cpp
Show All 24 Lines | |||||
25 | #include "Config.h" | 25 | #include "Config.h" | ||
26 | #include "SettingsDialog/SettingsDialog.h" | 26 | #include "SettingsDialog/SettingsDialog.h" | ||
27 | 27 | | |||
28 | #include <QApplication> | 28 | #include <QApplication> | ||
29 | #include <QClipboard> | 29 | #include <QClipboard> | ||
30 | #include <QDesktopServices> | 30 | #include <QDesktopServices> | ||
31 | #include <QDBusConnection> | 31 | #include <QDBusConnection> | ||
32 | #include <QDBusMessage> | 32 | #include <QDBusMessage> | ||
33 | #include <QKeyEvent> | ||||
33 | #include <QPrintDialog> | 34 | #include <QPrintDialog> | ||
34 | #include <QPushButton> | 35 | #include <QPushButton> | ||
35 | #include <QTimer> | 36 | #include <QTimer> | ||
36 | #include <QtMath> | 37 | #include <QtMath> | ||
37 | #include <QVariantAnimation> | 38 | #include <QVariantAnimation> | ||
38 | #include <QVBoxLayout> | 39 | #include <QVBoxLayout> | ||
39 | 40 | | |||
40 | #ifdef XCB_FOUND | 41 | #ifdef XCB_FOUND | ||
▲ Show 20 Lines • Show All 88 Lines • ▼ Show 20 Line(s) | 116 | { | |||
129 | // the KSGWidget | 130 | // the KSGWidget | ||
130 | 131 | | |||
131 | connect(mKSWidget, &KSWidget::newScreenshotRequest, this, &KSMainWindow::captureScreenshot); | 132 | connect(mKSWidget, &KSWidget::newScreenshotRequest, this, &KSMainWindow::captureScreenshot); | ||
132 | connect(mKSWidget, &KSWidget::dragInitiated, this, &KSMainWindow::dragAndDropRequest); | 133 | connect(mKSWidget, &KSWidget::dragInitiated, this, &KSMainWindow::dragAndDropRequest); | ||
133 | 134 | | |||
134 | // the Button Bar | 135 | // the Button Bar | ||
135 | 136 | | |||
136 | mDialogButtonBox->setStandardButtons(QDialogButtonBox::Help); | 137 | mDialogButtonBox->setStandardButtons(QDialogButtonBox::Help); | ||
138 | mDialogButtonBox->button(QDialogButtonBox::Help)->setAutoDefault(false); | ||||
137 | 139 | | |||
138 | mConfigureButton->setDefaultAction(KStandardAction::preferences(this, SLOT(showPreferencesDialog()), this)); | 140 | mConfigureButton->setDefaultAction(KStandardAction::preferences(this, SLOT(showPreferencesDialog()), this)); | ||
139 | mConfigureButton->setText(i18n("Configure...")); | 141 | mConfigureButton->setText(i18n("Configure...")); | ||
140 | mConfigureButton->setToolTip(i18n("Change Spectacle's settings.")); | 142 | mConfigureButton->setToolTip(i18n("Change Spectacle's settings.")); | ||
141 | mConfigureButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | 143 | mConfigureButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | ||
142 | mDialogButtonBox->addButton(mConfigureButton, QDialogButtonBox::ResetRole); | 144 | mDialogButtonBox->addButton(mConfigureButton, QDialogButtonBox::ResetRole); | ||
143 | 145 | | |||
144 | KGuiItem::assign(mToolsButton, KGuiItem(i18n("Tools"))); | 146 | KGuiItem::assign(mToolsButton, KGuiItem(i18n("Tools"))); | ||
145 | mToolsButton->setIcon(QIcon::fromTheme(QStringLiteral("tools"), | 147 | mToolsButton->setIcon(QIcon::fromTheme(QStringLiteral("tools"), | ||
146 | QIcon::fromTheme(QStringLiteral("application-menu")))); | 148 | QIcon::fromTheme(QStringLiteral("application-menu")))); | ||
149 | mToolsButton->setAutoDefault(false); | ||||
147 | mDialogButtonBox->addButton(mToolsButton, QDialogButtonBox::ActionRole); | 150 | mDialogButtonBox->addButton(mToolsButton, QDialogButtonBox::ActionRole); | ||
148 | mToolsButton->setMenu(mToolsMenu); | 151 | mToolsButton->setMenu(mToolsMenu); | ||
149 | 152 | | |||
150 | KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export"))); | 153 | KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export"))); | ||
151 | mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share"))); | 154 | mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share"))); | ||
155 | mSendToButton->setAutoDefault(false); | ||||
152 | mDialogButtonBox->addButton(mSendToButton, QDialogButtonBox::ActionRole); | 156 | mDialogButtonBox->addButton(mSendToButton, QDialogButtonBox::ActionRole); | ||
153 | 157 | | |||
154 | mClipboardButton->setDefaultAction(KStandardAction::copy(this, SLOT(sendToClipboard()), this)); | 158 | mClipboardButton->setDefaultAction(KStandardAction::copy(this, SLOT(sendToClipboard()), this)); | ||
155 | mClipboardButton->setText(i18n("Copy to Clipboard")); | 159 | mClipboardButton->setText(i18n("Copy to Clipboard")); | ||
156 | mClipboardButton->setToolTip(i18n("Copy the current screenshot image to the clipboard.")); | 160 | mClipboardButton->setToolTip(i18n("Copy the current screenshot image to the clipboard.")); | ||
157 | mClipboardButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | 161 | mClipboardButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | ||
158 | mDialogButtonBox->addButton(mClipboardButton, QDialogButtonBox::ActionRole); | 162 | mDialogButtonBox->addButton(mClipboardButton, QDialogButtonBox::ActionRole); | ||
159 | 163 | | |||
▲ Show 20 Lines • Show All 348 Lines • ▼ Show 20 Line(s) | |||||
508 | void KSMainWindow::restoreWindowTitle() | 512 | void KSMainWindow::restoreWindowTitle() | ||
509 | { | 513 | { | ||
510 | if (isWindowModified()) { | 514 | if (isWindowModified()) { | ||
511 | setWindowTitle(i18nc("@title:window Unsaved Screenshot", "Unsaved[*]")); | 515 | setWindowTitle(i18nc("@title:window Unsaved Screenshot", "Unsaved[*]")); | ||
512 | } else { | 516 | } else { | ||
513 | setWindowTitle(SpectacleConfig::instance()->lastSaveFile().fileName()); | 517 | setWindowTitle(SpectacleConfig::instance()->lastSaveFile().fileName()); | ||
514 | } | 518 | } | ||
515 | } | 519 | } | ||
520 | #include <QDebug> | ||||
aprcela: This one got here by accident? :) | |||||
521 | void KSMainWindow::keyPressEvent(QKeyEvent* event) | ||||
522 | { | ||||
523 | if (event->key() == Qt::Key_Return) { | ||||
524 | QWidget *fw = focusWidget(); | ||||
525 | auto pb = qobject_cast<QPushButton*>(fw); | ||||
526 | if (pb) { | ||||
527 | pb->animateClick(); | ||||
528 | return; | ||||
529 | } | ||||
530 | auto tb = qobject_cast<QToolButton*>(fw); | ||||
531 | if (tb) { | ||||
532 | tb->animateClick(); | ||||
533 | return; | ||||
534 | } | ||||
535 | } | ||||
536 | QDialog::keyPressEvent(event); | ||||
537 | } |
This one got here by accident? :)