Changeset View
Changeset View
Standalone View
Standalone View
src/SpectacleConfig.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
44 | QString SpectacleConfig::defaultTimestampTemplate() const | 44 | QString SpectacleConfig::defaultTimestampTemplate() const | ||
45 | { | 45 | { | ||
46 | // includes separator at the front | 46 | // includes separator at the front | ||
47 | return QStringLiteral("_%Y%M%D_%H%m%S"); | 47 | return QStringLiteral("_%Y%M%D_%H%m%S"); | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | // lastSaveAsLocation | 50 | // lastSaveAsLocation | ||
51 | 51 | | |||
52 | QUrl SpectacleConfig::lastSaveAsFile() const | ||||
53 | { | ||||
54 | return mGeneralConfig.readEntry(QStringLiteral("lastSaveAsFile"), | ||||
55 | QUrl(this->defaultSaveLocation())); | ||||
56 | } | ||||
57 | | ||||
58 | void SpectacleConfig::setLastSaveAsFile(const QUrl &location) | ||||
59 | { | ||||
60 | mGeneralConfig.writeEntry(QStringLiteral("lastSaveAsFile"), location); | ||||
61 | mGeneralConfig.sync(); | ||||
62 | } | ||||
63 | | ||||
52 | QUrl SpectacleConfig::lastSaveAsLocation() const | 64 | QUrl SpectacleConfig::lastSaveAsLocation() const | ||
53 | { | 65 | { | ||
54 | return mGeneralConfig.readEntry(QStringLiteral("lastSaveAsLocation"), | 66 | return this->lastSaveAsFile().adjusted(QUrl::RemoveFilename); | ||
55 | QUrl::fromUserInput(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + QStringLiteral("/"))); | | |||
56 | } | 67 | } | ||
57 | 68 | | |||
58 | void SpectacleConfig::setLastSaveAsLocation(const QUrl &location) | 69 | // lastSaveLocation | ||
70 | | ||||
71 | QUrl SpectacleConfig::lastSaveFile() const | ||||
72 | { | ||||
73 | return mGeneralConfig.readEntry(QStringLiteral("lastSaveFile"), | ||||
74 | QUrl(this->defaultSaveLocation())); | ||||
75 | } | ||||
76 | | ||||
77 | void SpectacleConfig::setLastSaveFile(const QUrl &location) | ||||
59 | { | 78 | { | ||
60 | mGeneralConfig.writeEntry(QStringLiteral("lastSaveAsLocation"), location); | 79 | mGeneralConfig.writeEntry(QStringLiteral("lastSaveFile"), location); | ||
61 | mGeneralConfig.sync(); | 80 | mGeneralConfig.sync(); | ||
62 | } | 81 | } | ||
63 | 82 | | |||
83 | QUrl SpectacleConfig::lastSaveLocation() const | ||||
84 | { | ||||
85 | return this->lastSaveFile().adjusted(QUrl::RemoveFilename); | ||||
86 | } | ||||
87 | | ||||
64 | // cropRegion | 88 | // cropRegion | ||
65 | 89 | | |||
66 | QRect SpectacleConfig::cropRegion() const | 90 | QRect SpectacleConfig::cropRegion() const | ||
67 | { | 91 | { | ||
68 | return mGuiConfig.readEntry(QStringLiteral("cropRegion"), QRect()); | 92 | return mGuiConfig.readEntry(QStringLiteral("cropRegion"), QRect()); | ||
69 | } | 93 | } | ||
70 | 94 | | |||
71 | void SpectacleConfig::setCropRegion(const QRect ®ion) | 95 | void SpectacleConfig::setCropRegion(const QRect ®ion) | ||
▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Line(s) | |||||
234 | void SpectacleConfig::setAutoSaveFilenameFormat(const QString &format) | 258 | void SpectacleConfig::setAutoSaveFilenameFormat(const QString &format) | ||
235 | { | 259 | { | ||
236 | mGeneralConfig.writeEntry(QStringLiteral("save-filename-format"), format); | 260 | mGeneralConfig.writeEntry(QStringLiteral("save-filename-format"), format); | ||
237 | mGeneralConfig.sync(); | 261 | mGeneralConfig.sync(); | ||
238 | } | 262 | } | ||
239 | 263 | | |||
240 | // autosave location | 264 | // autosave location | ||
241 | 265 | | |||
242 | QString SpectacleConfig::autoSaveLocation() const | 266 | QString SpectacleConfig::defaultSaveLocation() const | ||
243 | { | 267 | { | ||
244 | return mGeneralConfig.readPathEntry(QStringLiteral("default-save-location"), | 268 | return mGeneralConfig.readPathEntry(QStringLiteral("default-save-location"), | ||
245 | QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)); | 269 | QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)); | ||
246 | } | 270 | } | ||
247 | 271 | | |||
248 | void SpectacleConfig::setAutoSaveLocation(const QString &location) | 272 | void SpectacleConfig::setDefaultSaveLocation(const QString &location) | ||
249 | { | 273 | { | ||
250 | mGeneralConfig.writePathEntry(QStringLiteral("default-save-location"), location); | 274 | mGeneralConfig.writePathEntry(QStringLiteral("default-save-location"), location); | ||
251 | mGeneralConfig.sync(); | 275 | mGeneralConfig.sync(); | ||
252 | } | 276 | } | ||
253 | 277 | | |||
254 | // copy file location to clipboard after saving | 278 | // copy file location to clipboard after saving | ||
255 | 279 | | |||
256 | bool SpectacleConfig::copySaveLocationToClipboard() const | 280 | bool SpectacleConfig::copySaveLocationToClipboard() const | ||
Show All 23 Lines |