Changeset View
Changeset View
Standalone View
Standalone View
src/Gui/SettingsDialog/SaveOptionsPage.cpp
Show All 13 Lines | |||||
14 | * You should have received a copy of the GNU Lesser General Public License | 14 | * You should have received a copy of the GNU Lesser General Public License | ||
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | * Boston, MA 02110-1301, USA. | 17 | * Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "SaveOptionsPage.h" | 20 | #include "SaveOptionsPage.h" | ||
21 | 21 | | |||
22 | #include "SpectacleCommon.h" | 22 | #include "BackendInterfaces/ScreenshotInterface.h" | ||
23 | #include "SpectacleConfig.h" | 23 | #include "SpectacleConfig.h" | ||
24 | #include "ExportManager.h" | 24 | #include "ExportManager.h" | ||
25 | 25 | | |||
26 | #include <KIOWidgets/KUrlRequester> | 26 | #include <KIOWidgets/KUrlRequester> | ||
27 | #include <KLocalizedString> | 27 | #include <KLocalizedString> | ||
28 | 28 | | |||
29 | #include <QLineEdit> | 29 | #include <QLineEdit> | ||
30 | #include <QLabel> | 30 | #include <QLabel> | ||
▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 Line(s) | 179 | { | |||
201 | 201 | | |||
202 | mChangesMade = false; | 202 | mChangesMade = false; | ||
203 | } | 203 | } | ||
204 | 204 | | |||
205 | void SaveOptionsPage::updateFilenamePreview() | 205 | void SaveOptionsPage::updateFilenamePreview() | ||
206 | { | 206 | { | ||
207 | auto lExportManager = ExportManager::instance(); | 207 | auto lExportManager = ExportManager::instance(); | ||
208 | lExportManager->setWindowTitle(QStringLiteral("Spectacle")); | 208 | lExportManager->setWindowTitle(QStringLiteral("Spectacle")); | ||
209 | Spectacle::CaptureMode lOldMode = lExportManager->captureMode(); | 209 | CaptureMode lOldMode = lExportManager->captureMode(); | ||
210 | 210 | | |||
211 | // If the grabMode is not one of those below we need to change it to have the placeholder | 211 | // If the grabMode is not one of those below we need to change it to have the placeholder | ||
212 | // replaced by the window title | 212 | // replaced by the window title | ||
213 | bool lSwitchGrabMode = !(lOldMode == Spectacle::CaptureMode::ActiveWindow || | 213 | bool lSwitchGrabMode = !(lOldMode == CaptureMode::ActiveWindow || | ||
214 | lOldMode == Spectacle::CaptureMode::TransientWithParent || | 214 | lOldMode == CaptureMode::TransientWithParent || | ||
215 | lOldMode == Spectacle::CaptureMode::WindowUnderCursor); | 215 | lOldMode == CaptureMode::WindowUnderCursor); | ||
216 | if (lSwitchGrabMode) { | 216 | if (lSwitchGrabMode) { | ||
217 | lExportManager->setCaptureMode(Spectacle::CaptureMode::ActiveWindow); | 217 | lExportManager->setCaptureMode(CaptureMode::ActiveWindow); | ||
218 | } | 218 | } | ||
219 | const QString lFileName = lExportManager->formatFilename(mSaveNameFormat->text()); | 219 | const QString lFileName = lExportManager->formatFilename(mSaveNameFormat->text()); | ||
220 | mPreviewLabel->setText(xi18nc("@info", "<filename>%1.%2</filename>", lFileName, mSaveImageFormat->currentText().toLower())); | 220 | mPreviewLabel->setText(xi18nc("@info", "<filename>%1.%2</filename>", lFileName, mSaveImageFormat->currentText().toLower())); | ||
221 | if (lSwitchGrabMode) { | 221 | if (lSwitchGrabMode) { | ||
222 | lExportManager->setCaptureMode(lOldMode); | 222 | lExportManager->setCaptureMode(lOldMode); | ||
223 | } | 223 | } | ||
224 | } | 224 | } |