Changeset View
Changeset View
Standalone View
Standalone View
src/ExportManager.cpp
Show First 20 Lines • Show All 320 Lines • ▼ Show 20 Line(s) | 317 | if (save(savePath)) { | |||
---|---|---|---|---|---|
321 | 321 | | |||
322 | emit imageSaved(savePath); | 322 | emit imageSaved(savePath); | ||
323 | if (notify) { | 323 | if (notify) { | ||
324 | emit forceNotify(savePath); | 324 | emit forceNotify(savePath); | ||
325 | } | 325 | } | ||
326 | } | 326 | } | ||
327 | } | 327 | } | ||
328 | 328 | | |||
329 | void ExportManager::doSaveAs(QWidget *parentWindow) | 329 | bool ExportManager::doSaveAs(QWidget *parentWindow, bool notify) | ||
330 | { | 330 | { | ||
331 | QStringList supportedFilters; | 331 | QStringList supportedFilters; | ||
332 | QMimeDatabase db; | 332 | QMimeDatabase db; | ||
333 | SpectacleConfig *config = SpectacleConfig::instance(); | 333 | SpectacleConfig *config = SpectacleConfig::instance(); | ||
334 | 334 | | |||
335 | // construct the supported mimetype list | 335 | // construct the supported mimetype list | ||
336 | Q_FOREACH (auto mimeType, QImageWriter::supportedMimeTypes()) { | 336 | Q_FOREACH (auto mimeType, QImageWriter::supportedMimeTypes()) { | ||
337 | supportedFilters.append(QString::fromUtf8(mimeType).trimmed()); | 337 | supportedFilters.append(QString::fromUtf8(mimeType).trimmed()); | ||
Show All 11 Lines | |||||
349 | 349 | | |||
350 | // launch the dialog | 350 | // launch the dialog | ||
351 | if (dialog.exec() == QFileDialog::Accepted) { | 351 | if (dialog.exec() == QFileDialog::Accepted) { | ||
352 | const QUrl saveUrl = dialog.selectedUrls().first(); | 352 | const QUrl saveUrl = dialog.selectedUrls().first(); | ||
353 | if (saveUrl.isValid()) { | 353 | if (saveUrl.isValid()) { | ||
354 | if (save(saveUrl)) { | 354 | if (save(saveUrl)) { | ||
355 | emit imageSaved(saveUrl); | 355 | emit imageSaved(saveUrl); | ||
356 | config->setLastSaveAsLocation(saveUrl.adjusted(QUrl::RemoveFilename)); | 356 | config->setLastSaveAsLocation(saveUrl.adjusted(QUrl::RemoveFilename)); | ||
357 | | ||||
358 | if (notify) { | ||||
359 | emit forceNotify(saveUrl); | ||||
357 | } | 360 | } | ||
361 | return true; | ||||
358 | } | 362 | } | ||
359 | } | 363 | } | ||
360 | } | 364 | } | ||
365 | return false; | ||||
366 | } | ||||
361 | 367 | | |||
362 | // misc helpers | 368 | // misc helpers | ||
363 | 369 | | |||
364 | void ExportManager::doCopyToClipboard() | 370 | void ExportManager::doCopyToClipboard() | ||
365 | { | 371 | { | ||
366 | QApplication::clipboard()->setPixmap(mSavePixmap, QClipboard::Clipboard); | 372 | QApplication::clipboard()->setPixmap(mSavePixmap, QClipboard::Clipboard); | ||
367 | } | 373 | } | ||
368 | 374 | | |||
Show All 21 Lines |