Changeset View
Changeset View
Standalone View
Standalone View
src/ExportManager.cpp
Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Line(s) | 149 | { | |||
---|---|---|---|---|---|
153 | constexpr auto maxCounterLength = 20; // std::numeric_limits<quint64>::max() == 18446744073709551615 | 153 | constexpr auto maxCounterLength = 20; // std::numeric_limits<quint64>::max() == 18446744073709551615 | ||
154 | constexpr auto maxLength = maxFilenameLength - maxCounterLength - maxExtensionLength; | 154 | constexpr auto maxLength = maxFilenameLength - maxCounterLength - maxExtensionLength; | ||
155 | result.truncate(maxLength); | 155 | result.truncate(maxLength); | ||
156 | return result; | 156 | return result; | ||
157 | } | 157 | } | ||
158 | 158 | | |||
159 | QString ExportManager::makeAutosaveFilename() | 159 | QString ExportManager::makeAutosaveFilename() | ||
160 | { | 160 | { | ||
161 | return formatFilename(SpectacleConfig::instance()->autoSaveFilenameFormat()); | ||||
162 | } | ||||
163 | | ||||
164 | QString ExportManager::formatFilename(const QString &nameTemplate) | ||||
165 | { | ||||
161 | const QDateTime timestamp = mPixmapTimestamp; | 166 | const QDateTime timestamp = mPixmapTimestamp; | ||
162 | QString baseName = SpectacleConfig::instance()->autoSaveFilenameFormat(); | 167 | QString baseName = nameTemplate; | ||
163 | const QString baseDir = defaultSaveLocation(); | 168 | const QString baseDir = defaultSaveLocation(); | ||
164 | QString title; | 169 | QString title; | ||
165 | 170 | | |||
166 | if (mGrabMode == ImageGrabber::GrabMode::ActiveWindow || | 171 | if (mGrabMode == ImageGrabber::GrabMode::ActiveWindow || | ||
167 | mGrabMode == ImageGrabber::GrabMode::TransientWithParent || | 172 | mGrabMode == ImageGrabber::GrabMode::TransientWithParent || | ||
168 | mGrabMode == ImageGrabber::GrabMode::WindowUnderCursor) { | 173 | mGrabMode == ImageGrabber::GrabMode::WindowUnderCursor) { | ||
169 | title = mWindowTitle.replace(QLatin1String("/"), QLatin1String("_")); // POSIX doesn't allow "/" in filenames | 174 | title = mWindowTitle.replace(QLatin1String("/"), QLatin1String("_")); // POSIX doesn't allow "/" in filenames | ||
170 | } else { | 175 | } else { | ||
▲ Show 20 Lines • Show All 358 Lines • Show Last 20 Lines |