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 | restoreWindowTitle(); | ||||
311 | unityUpdate({ {QStringLiteral("progress-visible"), false} }); | ||||
312 | }); | ||||
313 | | ||||
314 | | ||||
307 | unityUpdate({ {QStringLiteral("progress-visible"), true}, | 315 | unityUpdate({ {QStringLiteral("progress-visible"), true}, | ||
308 | {QStringLiteral("progress"), 0 } }); | 316 | {QStringLiteral("progress"), 0 } }); | ||
309 | timer->start(); | 317 | timer->start(); | ||
310 | delayAnimation->start(); | 318 | delayAnimation->start(); | ||
311 | } | 319 | } | ||
312 | 320 | | |||
313 | void KSMainWindow::setScreenshotAndShow(const QPixmap &pixmap) | 321 | void KSMainWindow::setScreenshotAndShow(const QPixmap &pixmap) | ||
314 | { | 322 | { | ||
323 | if (!pixmap.isNull()) { | ||||
315 | mKSWidget->setScreenshotPixmap(pixmap); | 324 | mKSWidget->setScreenshotPixmap(pixmap); | ||
316 | mExportMenu->imageUpdated(); | 325 | mExportMenu->imageUpdated(); | ||
317 | | ||||
318 | setWindowTitle(i18nc("@title:window Unsaved Screenshot", "Unsaved[*]")); | 326 | 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); | 327 | setWindowModified(true); | ||
320 | 328 | } else { | |||
329 | restoreWindowTitle(); | ||||
330 | } | ||||
331 | mKSWidget->setButtonState(KSWidget::State::TakeNewScreenshot); | ||||
321 | show(); | 332 | show(); | ||
322 | activateWindow(); | 333 | activateWindow(); | ||
323 | 334 | if(pixmap.size() != QSize(0, 0)) { | |||
324 | resize(QSize(windowWidth(pixmap), DEFAULT_WINDOW_HEIGHT)); | 335 | resize(QSize(windowWidth(pixmap), DEFAULT_WINDOW_HEIGHT)); | ||
325 | } | 336 | } | ||
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… | |||||
337 | } | ||||
326 | 338 | | |||
327 | void KSMainWindow::showPrintDialog() | 339 | void KSMainWindow::showPrintDialog() | ||
328 | { | 340 | { | ||
329 | QPrinter *printer = new QPrinter(QPrinter::HighResolution); | 341 | QPrinter *printer = new QPrinter(QPrinter::HighResolution); | ||
330 | QPrintDialog printDialog(printer, this); | 342 | QPrintDialog printDialog(printer, this); | ||
331 | if (printDialog.exec() == QDialog::Accepted) { | 343 | if (printDialog.exec() == QDialog::Accepted) { | ||
332 | ExportManager::instance()->doPrint(printer); | 344 | ExportManager::instance()->doPrint(printer); | ||
333 | return; | 345 | return; | ||
▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Line(s) | 492 | { | |||
481 | SpectacleConfig::instance()->setLastUsedSaveMode(SaveMode::SaveAs); | 493 | SpectacleConfig::instance()->setLastUsedSaveMode(SaveMode::SaveAs); | ||
482 | setDefaultSaveAction(); | 494 | setDefaultSaveAction(); | ||
483 | 495 | | |||
484 | const bool quitChecked = SpectacleConfig::instance()->quitAfterSaveOrCopyChecked(); | 496 | const bool quitChecked = SpectacleConfig::instance()->quitAfterSaveOrCopyChecked(); | ||
485 | if (ExportManager::instance()->doSaveAs(this, /* notify */ quitChecked) && quitChecked) { | 497 | if (ExportManager::instance()->doSaveAs(this, /* notify */ quitChecked) && quitChecked) { | ||
486 | quit(QuitBehavior::QuitExternally); | 498 | quit(QuitBehavior::QuitExternally); | ||
487 | } | 499 | } | ||
488 | } | 500 | } | ||
501 | | ||||
502 | void KSMainWindow::restoreWindowTitle() | ||||
503 | { | ||||
504 | if (isWindowModified()) { | ||||
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? | |||||
505 | setWindowTitle(i18nc("@title:window Unsaved Screenshot", "Unsaved[*]")); | ||||
506 | } else { | ||||
507 | setWindowTitle(SpectacleConfig::instance()->lastSaveFile().fileName()); | ||||
508 | } | ||||
509 | } |
Can't you just call restoreWindowTitle() in any case?