Changeset View
Changeset View
Standalone View
Standalone View
src/Gui/KSMainWindow.cpp
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 58 | KSMainWindow::KSMainWindow(const Platform::GrabModes &theGrabModes, const Platform::ShutterModes &theShutterModes, QWidget *parent) : | |||
---|---|---|---|---|---|
68 | mSaveMenu(new QMenu(this)), | 68 | mSaveMenu(new QMenu(this)), | ||
69 | mSaveAsAction(new QAction(this)), | 69 | mSaveAsAction(new QAction(this)), | ||
70 | mSaveAction(new QAction(this)), | 70 | mSaveAction(new QAction(this)), | ||
71 | mMessageWidget(new KMessageWidget(this)), | 71 | mMessageWidget(new KMessageWidget(this)), | ||
72 | mToolsMenu(new QMenu(this)), | 72 | mToolsMenu(new QMenu(this)), | ||
73 | mScreenRecorderToolsMenu(new QMenu(this)), | 73 | mScreenRecorderToolsMenu(new QMenu(this)), | ||
74 | mExportMenu(new ExportMenu(this)), | 74 | mExportMenu(new ExportMenu(this)), | ||
75 | mShutterModes(theShutterModes) | 75 | mShutterModes(theShutterModes) | ||
76 | #ifdef KIMAGEANNOTATOR_FOUND | ||||
77 | ,mAnnotateButton(new QToolButton(this)) | ||||
78 | ,mAnnotatorActive(false) | ||||
79 | #endif | ||||
76 | { | 80 | { | ||
77 | // before we do anything, we need to set a window property | 81 | // before we do anything, we need to set a window property | ||
78 | // that skips the close/hide window animation on kwin. this | 82 | // that skips the close/hide window animation on kwin. this | ||
79 | // fixes a ghost image of the spectacle window that appears | 83 | // fixes a ghost image of the spectacle window that appears | ||
80 | // on subsequent screenshots taken with the take new screenshot | 84 | // on subsequent screenshots taken with the take new screenshot | ||
81 | // button | 85 | // button | ||
82 | // | 86 | // | ||
83 | // credits for this goes to Thomas Lübking <thomas.luebking@gmail.com> | 87 | // credits for this goes to Thomas Lübking <thomas.luebking@gmail.com> | ||
▲ Show 20 Lines • Show All 53 Lines • ▼ Show 20 Line(s) | 120 | { | |||
137 | mDialogButtonBox->setStandardButtons(QDialogButtonBox::Help); | 141 | mDialogButtonBox->setStandardButtons(QDialogButtonBox::Help); | ||
138 | 142 | | |||
139 | mConfigureButton->setDefaultAction(KStandardAction::preferences(this, SLOT(showPreferencesDialog()), this)); | 143 | mConfigureButton->setDefaultAction(KStandardAction::preferences(this, SLOT(showPreferencesDialog()), this)); | ||
140 | mConfigureButton->setText(i18n("Configure...")); | 144 | mConfigureButton->setText(i18n("Configure...")); | ||
141 | mConfigureButton->setToolTip(i18n("Change Spectacle's settings.")); | 145 | mConfigureButton->setToolTip(i18n("Change Spectacle's settings.")); | ||
142 | mConfigureButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | 146 | mConfigureButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | ||
143 | mDialogButtonBox->addButton(mConfigureButton, QDialogButtonBox::ResetRole); | 147 | mDialogButtonBox->addButton(mConfigureButton, QDialogButtonBox::ResetRole); | ||
144 | 148 | | |||
149 | #ifdef KIMAGEANNOTATOR_FOUND | ||||
150 | mAnnotateButton->setText(i18n("Annotate")); | ||||
151 | mAnnotateButton->setToolTip(i18n("Add annotation to the screenshot")); | ||||
152 | mAnnotateButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); | ||||
153 | mAnnotateButton->setIcon(QIcon::fromTheme(QStringLiteral("document-edit"))); | ||||
154 | connect(mAnnotateButton, &QToolButton::pressed, this, [this] { | ||||
155 | | ||||
156 | if (mAnnotatorActive) { | ||||
157 | mKSWidget->hideAnnotator(); | ||||
158 | mAnnotateButton->setText(i18n("Annotate")); | ||||
159 | } else { | ||||
160 | mKSWidget->showAnnotator(); | ||||
161 | mAnnotateButton->setText(i18n("Annotation done")); | ||||
162 | } | ||||
163 | mAnnotatorActive = !mAnnotatorActive; | ||||
164 | | ||||
165 | mToolsButton->setEnabled(!mAnnotatorActive); | ||||
166 | mSendToButton->setEnabled(!mAnnotatorActive); | ||||
167 | mClipboardButton->setEnabled(!mAnnotatorActive); | ||||
168 | mSaveButton->setEnabled(!mAnnotatorActive); | ||||
169 | }); | ||||
170 | | ||||
171 | mDialogButtonBox->addButton(mAnnotateButton, QDialogButtonBox::ActionRole); | ||||
172 | #endif | ||||
173 | | ||||
145 | KGuiItem::assign(mToolsButton, KGuiItem(i18n("Tools"))); | 174 | KGuiItem::assign(mToolsButton, KGuiItem(i18n("Tools"))); | ||
146 | mToolsButton->setIcon(QIcon::fromTheme(QStringLiteral("tools"), | 175 | mToolsButton->setIcon(QIcon::fromTheme(QStringLiteral("tools"), | ||
147 | QIcon::fromTheme(QStringLiteral("application-menu")))); | 176 | QIcon::fromTheme(QStringLiteral("application-menu")))); | ||
148 | mDialogButtonBox->addButton(mToolsButton, QDialogButtonBox::ActionRole); | 177 | mDialogButtonBox->addButton(mToolsButton, QDialogButtonBox::ActionRole); | ||
149 | mToolsButton->setMenu(mToolsMenu); | 178 | mToolsButton->setMenu(mToolsMenu); | ||
150 | 179 | | |||
151 | KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export"))); | 180 | KGuiItem::assign(mSendToButton, KGuiItem(i18n("Export"))); | ||
152 | mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share"))); | 181 | mSendToButton->setIcon(QIcon::fromTheme(QStringLiteral("document-share"))); | ||
▲ Show 20 Lines • Show All 330 Lines • Show Last 20 Lines |