Changeset View
Changeset View
Standalone View
Standalone View
mainWindow/kpMainWindow.cpp
Show First 20 Lines • Show All 393 Lines • ▼ Show 20 Line(s) | 386 | { | |||
---|---|---|---|---|---|
394 | // Similarly for height() and constructorHeight(). | 394 | // Similarly for height() and constructorHeight(). | ||
395 | const QSize docSize (d->document->constructorWidth (), | 395 | const QSize docSize (d->document->constructorWidth (), | ||
396 | d->document->constructorHeight ()); | 396 | d->document->constructorHeight ()); | ||
397 | #if DEBUG_KP_MAIN_WINDOW | 397 | #if DEBUG_KP_MAIN_WINDOW | ||
398 | qCDebug(kpLogMainWindow) << "\tnot from url; doc size=" << docSize; | 398 | qCDebug(kpLogMainWindow) << "\tnot from url; doc size=" << docSize; | ||
399 | #endif | 399 | #endif | ||
400 | configGroup.writeEntry (kpSessionSettingNotFromUrlDocumentSize, docSize); | 400 | configGroup.writeEntry (kpSessionSettingNotFromUrlDocumentSize, docSize); | ||
401 | } | 401 | } | ||
402 | | ||||
403 | | ||||
404 | // Local session save i.e. queryClose() was not called beforehand | | |||
405 | // (see QApplication::saveState())? | | |||
406 | #if 0 | | |||
407 | if (d->document->isModified ()) | | |||
408 | { | | |||
409 | // TODO: Implement by saving the current image to a persistent file. | | |||
410 | // We do this instead of saving/mutating the backing image file | | |||
411 | // as no one expects a file save on a session save without a | | |||
412 | // "do you want to save" dialog first. | | |||
413 | // | | |||
414 | // I don't think any KDE application implements local session saving. | | |||
415 | // | | |||
416 | // --- The below code does not compile but shows you want to do --- | | |||
417 | | ||||
418 | // Create unique name for the document in this main window. | | |||
419 | const QUrl tempURL = homeDir + | | |||
420 | "kolourpaint session " + sessionID + | | |||
421 | mainWindowPtrToString + ".png"; | | |||
422 | // TODO: Use lossless PNG saving options. | | |||
423 | kpDocumentSaveOptions pngSaveOptions; | | |||
424 | | ||||
425 | if (kpDocument::savePixmapToFile (d->document->pixmapWithSelection (), | | |||
426 | tempURL, | | |||
427 | pngSaveOptions, *d->document->metaInfo (), | | |||
428 | false/*no overwrite prompt*/, | | |||
429 | false/*no lossy prompt*/, | | |||
430 | this)) | | |||
431 | { | | |||
432 | // readProperties() will still open kpSessionSettingDocumentUrl | | |||
433 | // (as that's the expected URL) and will then add commands to: | | |||
434 | // | | |||
435 | // 1. Resize the document to the size of image at | | |||
436 | // kpSessionSettingDocumentUnsavedContentsUrl, if the sizes | | |||
437 | // differ. | | |||
438 | // 2. Paste the kpSessionSettingDocumentUnsavedContentsUrl image | | |||
439 | // (setting the main window's selection mode to opaque beforehand). | | |||
440 | // | | |||
441 | // It will then delete the file at | | |||
442 | // kpSessionSettingDocumentUnsavedContentsUrl. | | |||
443 | configGroup.writeEntry (kpSessionSettingDocumentUnsavedContentsUrl, | | |||
444 | tempURL.url ()); | | |||
445 | } | | |||
446 | else | | |||
447 | { | | |||
448 | // Not much we can do - we aren't allowed to throw up a dialog. | | |||
449 | } | | |||
450 | } | | |||
451 | #endif | | |||
452 | } | 402 | } | ||
453 | } | 403 | } | ||
454 | 404 | | |||
455 | //--------------------------------------------------------------------- | 405 | //--------------------------------------------------------------------- | ||
456 | 406 | | |||
457 | 407 | | |||
458 | kpMainWindow::~kpMainWindow () | 408 | kpMainWindow::~kpMainWindow () | ||
459 | { | 409 | { | ||
▲ Show 20 Lines • Show All 303 Lines • ▼ Show 20 Line(s) | 707 | #endif | |||
763 | 713 | | |||
764 | 714 | | |||
765 | // Hide the text toolbar - it will be shown by kpToolText::begin() | 715 | // Hide the text toolbar - it will be shown by kpToolText::begin() | ||
766 | enableTextToolBarActions (false); | 716 | enableTextToolBarActions (false); | ||
767 | 717 | | |||
768 | enableToolsDocumentActions (true); | 718 | enableToolsDocumentActions (true); | ||
769 | 719 | | |||
770 | enableDocumentActions (true); | 720 | enableDocumentActions (true); | ||
771 | | ||||
772 | // TODO: The thumbnail auto zoom doesn't work because it thinks its | | |||
773 | // width == 1 when !this->isShown(). So for consistency, | | |||
774 | // never create the thumbnail. | | |||
775 | #if 0 | | |||
776 | if (d->configThumbnailShown) | | |||
777 | { | | |||
778 | if (isShown ()) | | |||
779 | { | | |||
780 | #if DEBUG_KP_MAIN_WINDOW | | |||
781 | qCDebug(kpLogMainWindow) << "\tcreating thumbnail immediately"; | | |||
782 | #endif | | |||
783 | slotCreateThumbnail (); | | |||
784 | } | | |||
785 | // this' geometry is weird ATM | | |||
786 | else | | |||
787 | { | | |||
788 | #if DEBUG_KP_MAIN_WINDOW | | |||
789 | qCDebug(kpLogMainWindow) << "\tcreating thumbnail LATER"; | | |||
790 | #endif | | |||
791 | QTimer::singleShot (0, this, SLOT (slotCreateThumbnail())); | | |||
792 | } | | |||
793 | } | | |||
794 | #endif | | |||
795 | } | 721 | } | ||
796 | 722 | | |||
797 | #if DEBUG_KP_MAIN_WINDOW | 723 | #if DEBUG_KP_MAIN_WINDOW | ||
798 | qCDebug(kpLogMainWindow) << "\tupdating mainWindow elements"; | 724 | qCDebug(kpLogMainWindow) << "\tupdating mainWindow elements"; | ||
799 | #endif | 725 | #endif | ||
800 | 726 | | |||
801 | slotImageMenuUpdateDueToSelection (); | 727 | slotImageMenuUpdateDueToSelection (); | ||
802 | recalculateStatusBar (); | 728 | recalculateStatusBar (); | ||
▲ Show 20 Lines • Show All 194 Lines • Show Last 20 Lines |