Changeset View
Standalone View
src/Gui/KSMainWindow.cpp
Show First 20 Lines • Show All 298 Lines • ▼ Show 20 Line(s) | 277 | { | |||
---|---|---|---|---|---|
299 | }); | 299 | }); | ||
300 | connect(timer, &QTimer::timeout, this, [=] { | 300 | connect(timer, &QTimer::timeout, this, [=] { | ||
301 | this->hide(); | 301 | this->hide(); | ||
302 | timer->deleteLater(); | 302 | timer->deleteLater(); | ||
303 | unityUpdate({ {QStringLiteral("progress-visible"), false} }); | 303 | unityUpdate({ {QStringLiteral("progress-visible"), false} }); | ||
304 | emit newScreenshotRequest(theCaptureMode, 0, theIncludePointer, theIncludeDecorations); | 304 | emit newScreenshotRequest(theCaptureMode, 0, theIncludePointer, theIncludeDecorations); | ||
305 | }); | 305 | }); | ||
306 | 306 | | |||
307 | connect(mKSWidget, &KSWidget::screenshotCanceled, timer, [=] { | ||||
308 | timer->stop(); | ||||
309 | timer->deleteLater(); | ||||
310 | unityUpdate({ {QStringLiteral("progress-visible"), false} }); | ||||
311 | }); | ||||
312 | | ||||
313 | | ||||
307 | unityUpdate({ {QStringLiteral("progress-visible"), true}, | 314 | unityUpdate({ {QStringLiteral("progress-visible"), true}, | ||
308 | {QStringLiteral("progress"), 0 } }); | 315 | {QStringLiteral("progress"), 0 } }); | ||
309 | timer->start(); | 316 | timer->start(); | ||
310 | delayAnimation->start(); | 317 | delayAnimation->start(); | ||
311 | } | 318 | } | ||
312 | 319 | | |||
313 | void KSMainWindow::setScreenshotAndShow(const QPixmap &pixmap) | 320 | void KSMainWindow::setScreenshotAndShow(const QPixmap &pixmap) | ||
314 | { | 321 | { | ||
322 | if (!pixmap.isNull()) { | ||||
315 | mKSWidget->setScreenshotPixmap(pixmap); | 323 | mKSWidget->setScreenshotPixmap(pixmap); | ||
316 | mExportMenu->imageUpdated(); | 324 | mExportMenu->imageUpdated(); | ||
317 | | ||||
318 | setWindowTitle(i18nc("@title:window Unsaved Screenshot", "Unsaved[*]")); | 325 | setWindowTitle(i18nc("@title:window Unsaved Screenshot", "Unsaved[*]")); | ||
broulik: Can't you just call `restoreWindowTitle()` in any case? | |||||
No because if you saved a screenshot and then take a new one we want to the title to be "Unsaved" and not the filename of the previous saved file. davidre: No because if you saved a screenshot and then take a new one we want to the title to be… | |||||
319 | setWindowModified(true); | 326 | setWindowModified(true); | ||
320 | 327 | } | |||
328 | mKSWidget->setButtonTakeNewScreenshot(); | ||||
321 | show(); | 329 | show(); | ||
322 | activateWindow(); | 330 | activateWindow(); | ||
323 | 331 | if(pixmap.size() != QSize(0, 0)) { | |||
324 | resize(QSize(windowWidth(pixmap), DEFAULT_WINDOW_HEIGHT)); | 332 | resize(QSize(windowWidth(pixmap), DEFAULT_WINDOW_HEIGHT)); | ||
325 | } | 333 | } | ||
What is this supposed to do? Do you mean pixmap.isNull() or pixmap.size().isEmpty()? Looks unrelated to the patch, though. broulik: What is this supposed to do? Do you mean `pixmap.isNull()` or `pixmap.size().isEmpty()`? Looks… | |||||
In this patch I also changed that we go through this function if the region selection is canceled (to reset title and and button). davidre: In this patch I also changed that we go through this function if the region selection is… | |||||
334 | } | ||||
326 | 335 | | |||
327 | void KSMainWindow::showPrintDialog() | 336 | void KSMainWindow::showPrintDialog() | ||
328 | { | 337 | { | ||
329 | QPrinter *printer = new QPrinter(QPrinter::HighResolution); | 338 | QPrinter *printer = new QPrinter(QPrinter::HighResolution); | ||
330 | QPrintDialog printDialog(printer, this); | 339 | QPrintDialog printDialog(printer, this); | ||
331 | if (printDialog.exec() == QDialog::Accepted) { | 340 | if (printDialog.exec() == QDialog::Accepted) { | ||
332 | ExportManager::instance()->doPrint(printer); | 341 | ExportManager::instance()->doPrint(printer); | ||
333 | return; | 342 | return; | ||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Line(s) | |||||
480 | { | 489 | { | ||
481 | SpectacleConfig::instance()->setLastUsedSaveMode(SaveMode::SaveAs); | 490 | SpectacleConfig::instance()->setLastUsedSaveMode(SaveMode::SaveAs); | ||
482 | setDefaultSaveAction(); | 491 | setDefaultSaveAction(); | ||
483 | 492 | | |||
484 | const bool quitChecked = SpectacleConfig::instance()->quitAfterSaveOrCopyChecked(); | 493 | const bool quitChecked = SpectacleConfig::instance()->quitAfterSaveOrCopyChecked(); | ||
485 | if (ExportManager::instance()->doSaveAs(this, /* notify */ quitChecked) && quitChecked) { | 494 | if (ExportManager::instance()->doSaveAs(this, /* notify */ quitChecked) && quitChecked) { | ||
486 | quit(QuitBehavior::QuitExternally); | 495 | quit(QuitBehavior::QuitExternally); | ||
487 | } | 496 | } | ||
488 | } | 497 | } | ||
Can you perhaps move the setWindowModified() handling into this method, too? broulik: Can you perhaps move the `setWindowModified()` handling into this method, too? | |||||
Do you think of making this a general method to handle windowModified and title setting? Because otherwise I see no need because windowModified doesn't change when we restore the title. davidre: Do you think of making this a general method to handle windowModified and title setting? |
Can't you just call restoreWindowTitle() in any case?