Changeset View
Changeset View
Standalone View
Standalone View
mainWindow/kpMainWindow.cpp
Show First 20 Lines • Show All 232 Lines • ▼ Show 20 Line(s) | 195 | #endif | |||
---|---|---|---|---|---|
233 | 233 | | |||
234 | // no tabbed docks; does not make sense with only 2 dock widgets | 234 | // no tabbed docks; does not make sense with only 2 dock widgets | ||
235 | setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks); | 235 | setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks); | ||
236 | 236 | | |||
237 | addDockWidget(Qt::BottomDockWidgetArea, d->colorToolBar, Qt::Horizontal); | 237 | addDockWidget(Qt::BottomDockWidgetArea, d->colorToolBar, Qt::Horizontal); | ||
238 | 238 | | |||
239 | d->scrollView = new kpViewScrollableContainer (this); | 239 | d->scrollView = new kpViewScrollableContainer (this); | ||
240 | d->scrollView->setObjectName ( QLatin1String("scrollView" )); | 240 | d->scrollView->setObjectName ( QLatin1String("scrollView" )); | ||
241 | connect (d->scrollView, SIGNAL (beganDocResize()), | | |||
242 | this, SLOT (slotBeganDocResize())); | | |||
243 | connect (d->scrollView, SIGNAL (continuedDocResize(QSize)), | | |||
244 | this, SLOT (slotContinuedDocResize(QSize))); | | |||
245 | connect (d->scrollView, SIGNAL (cancelledDocResize()), | | |||
246 | this, SLOT (slotCancelledDocResize())); | | |||
247 | connect (d->scrollView, SIGNAL (endedDocResize(QSize)), | | |||
248 | this, SLOT (slotEndedDocResize(QSize))); | | |||
249 | 241 | | |||
250 | connect (d->scrollView, SIGNAL (statusMessageChanged(QString)), | 242 | connect (d->scrollView, &kpViewScrollableContainer::beganDocResize, | ||
251 | this, SLOT (slotDocResizeMessageChanged(QString))); | 243 | this, &kpMainWindow::slotBeganDocResize); | ||
252 | 244 | | |||
253 | connect (d->scrollView, SIGNAL(contentsMoved()), | 245 | connect (d->scrollView, &kpViewScrollableContainer::continuedDocResize, | ||
254 | this, SLOT(slotScrollViewAfterScroll())); | 246 | this, &kpMainWindow::slotContinuedDocResize); | ||
247 | | ||||
248 | connect (d->scrollView, &kpViewScrollableContainer::cancelledDocResize, | ||||
249 | this, &kpMainWindow::slotCancelledDocResize); | ||||
250 | | ||||
251 | connect (d->scrollView, &kpViewScrollableContainer::endedDocResize, | ||||
252 | this, &kpMainWindow::slotEndedDocResize); | ||||
253 | | ||||
254 | connect (d->scrollView, &kpViewScrollableContainer::statusMessageChanged, | ||||
255 | this, &kpMainWindow::slotDocResizeMessageChanged); | ||||
256 | | ||||
257 | connect (d->scrollView, &kpViewScrollableContainer::contentsMoved, | ||||
258 | this, &kpMainWindow::slotScrollViewAfterScroll); | ||||
255 | 259 | | |||
256 | setCentralWidget (d->scrollView); | 260 | setCentralWidget (d->scrollView); | ||
257 | 261 | | |||
258 | // | 262 | // | ||
259 | // set initial pos/size of GUI | 263 | // set initial pos/size of GUI | ||
260 | // | 264 | // | ||
261 | 265 | | |||
262 | setAutoSaveSettings (); | 266 | setAutoSaveSettings (); | ||
▲ Show 20 Lines • Show All 408 Lines • ▼ Show 20 Line(s) | 663 | #endif | |||
671 | d->scrollView->setView (d->mainView); | 675 | d->scrollView->setView (d->mainView); | ||
672 | d->mainView->show (); | 676 | d->mainView->show (); | ||
673 | 677 | | |||
674 | #if DEBUG_KP_MAIN_WINDOW | 678 | #if DEBUG_KP_MAIN_WINDOW | ||
675 | qCDebug(kpLogMainWindow) << "\thooking up document signals"; | 679 | qCDebug(kpLogMainWindow) << "\thooking up document signals"; | ||
676 | #endif | 680 | #endif | ||
677 | 681 | | |||
678 | // Copy/Cut/Deselect/Delete | 682 | // Copy/Cut/Deselect/Delete | ||
679 | connect (d->document, SIGNAL (selectionEnabled(bool)), | 683 | connect (d->document, &kpDocument::selectionEnabled, | ||
680 | d->actionCut, SLOT (setEnabled(bool))); | 684 | d->actionCut, &QAction::setEnabled); | ||
681 | connect (d->document, SIGNAL (selectionEnabled(bool)), | 685 | | ||
682 | d->actionCopy, SLOT (setEnabled(bool))); | 686 | connect (d->document, &kpDocument::selectionEnabled, | ||
683 | connect (d->document, SIGNAL (selectionEnabled(bool)), | 687 | d->actionCopy, &QAction::setEnabled); | ||
684 | d->actionDelete, SLOT (setEnabled(bool))); | 688 | | ||
685 | connect (d->document, SIGNAL (selectionEnabled(bool)), | 689 | connect (d->document, &kpDocument::selectionEnabled, | ||
686 | d->actionDeselect, SLOT (setEnabled(bool))); | 690 | d->actionDelete, &QAction::setEnabled); | ||
687 | connect (d->document, SIGNAL (selectionEnabled(bool)), | 691 | | ||
688 | d->actionCopyToFile, SLOT (setEnabled(bool))); | 692 | connect (d->document, &kpDocument::selectionEnabled, | ||
693 | d->actionDeselect, &QAction::setEnabled); | ||||
694 | | ||||
695 | connect (d->document, &kpDocument::selectionEnabled, | ||||
696 | d->actionCopyToFile, &QAction::setEnabled); | ||||
689 | 697 | | |||
690 | // this code won't actually enable any actions at this stage | 698 | // this code won't actually enable any actions at this stage | ||
691 | // (fresh document) but better safe than sorry | 699 | // (fresh document) but better safe than sorry | ||
692 | d->actionCopy->setEnabled (d->document->selection ()); | 700 | d->actionCopy->setEnabled (d->document->selection ()); | ||
693 | d->actionCut->setEnabled (d->document->selection ()); | 701 | d->actionCut->setEnabled (d->document->selection ()); | ||
694 | d->actionDeselect->setEnabled (d->document->selection ()); | 702 | d->actionDeselect->setEnabled (d->document->selection ()); | ||
695 | d->actionDelete->setEnabled (d->document->selection ()); | 703 | d->actionDelete->setEnabled (d->document->selection ()); | ||
696 | d->actionCopyToFile->setEnabled (d->document->selection ()); | 704 | d->actionCopyToFile->setEnabled (d->document->selection ()); | ||
697 | 705 | | |||
698 | connect (d->document, SIGNAL (selectionEnabled(bool)), | 706 | connect (d->document, &kpDocument::selectionEnabled, | ||
699 | this, SLOT (slotImageMenuUpdateDueToSelection())); | 707 | this, &kpMainWindow::slotImageMenuUpdateDueToSelection); | ||
700 | connect (d->document, SIGNAL (selectionIsTextChanged(bool)), | 708 | | ||
701 | this, SLOT (slotImageMenuUpdateDueToSelection())); | 709 | connect (d->document, &kpDocument::selectionIsTextChanged, | ||
710 | this, &kpMainWindow::slotImageMenuUpdateDueToSelection); | ||||
702 | 711 | | |||
703 | // Status bar | 712 | // Status bar | ||
704 | connect (d->document, SIGNAL (documentOpened()), | 713 | connect (d->document, &kpDocument::documentOpened, | ||
705 | this, SLOT (recalculateStatusBar())); | 714 | this, &kpMainWindow::recalculateStatusBar); | ||
706 | 715 | | |||
707 | connect (d->document, SIGNAL (sizeChanged(QSize)), | 716 | connect (d->document, SIGNAL (sizeChanged(QSize)), | ||
708 | this, SLOT (setStatusBarDocSize(QSize))); | 717 | this, SLOT (setStatusBarDocSize(QSize))); | ||
709 | 718 | | |||
710 | // Caption (url, modified) | 719 | // Caption (url, modified) | ||
711 | connect (d->document, SIGNAL (documentModified()), | 720 | connect (d->document, &kpDocument::documentModified, | ||
712 | this, SLOT (slotUpdateCaption())); | 721 | this, &kpMainWindow::slotUpdateCaption); | ||
713 | connect (d->document, SIGNAL (documentOpened()), | 722 | | ||
714 | this, SLOT (slotUpdateCaption())); | 723 | connect (d->document, &kpDocument::documentOpened, | ||
715 | connect (d->document, SIGNAL (documentSaved()), | 724 | this, &kpMainWindow::slotUpdateCaption); | ||
716 | this, SLOT (slotUpdateCaption())); | 725 | | ||
726 | connect (d->document, &kpDocument::documentSaved, | ||||
727 | this, &kpMainWindow::slotUpdateCaption); | ||||
717 | 728 | | |||
718 | // File/Reload action only available with non-empty URL | 729 | // File/Reload action only available with non-empty URL | ||
719 | connect (d->document, SIGNAL (documentSaved()), | 730 | connect (d->document, &kpDocument::documentSaved, | ||
720 | this, SLOT (slotEnableReload())); | 731 | this, &kpMainWindow::slotEnableReload); | ||
721 | 732 | | |||
722 | connect (d->document, SIGNAL (documentSaved()), | 733 | connect (d->document, &kpDocument::documentSaved, | ||
723 | this, SLOT (slotEnableSettingsShowPath())); | 734 | this, &kpMainWindow::slotEnableSettingsShowPath); | ||
724 | 735 | | |||
725 | // Command history | 736 | // Command history | ||
726 | Q_ASSERT (d->commandHistory); | 737 | Q_ASSERT (d->commandHistory); | ||
727 | connect (d->commandHistory, SIGNAL (documentRestored()), | 738 | connect (d->commandHistory, &kpCommandHistory::documentRestored, | ||
728 | this, SLOT (slotDocumentRestored())); // caption "!modified" | 739 | this, &kpMainWindow::slotDocumentRestored); // caption "!modified" | ||
729 | connect (d->document, SIGNAL (documentSaved()), | 740 | | ||
730 | d->commandHistory, SLOT (documentSaved())); | 741 | connect (d->document, &kpDocument::documentSaved, | ||
742 | d->commandHistory, &kpCommandHistory::documentSaved); | ||||
731 | 743 | | |||
732 | // Sync document -> views | 744 | // Sync document -> views | ||
733 | connect (d->document, SIGNAL (contentsChanged(QRect)), | 745 | connect (d->document, &kpDocument::contentsChanged, | ||
734 | d->viewManager, SLOT (updateViews(QRect))); | 746 | d->viewManager, &kpViewManager::updateViews); | ||
735 | connect (d->document, SIGNAL (sizeChanged(int,int)), | 747 | | ||
736 | d->viewManager, SLOT (adjustViewsToEnvironment())); | 748 | connect (d->document, static_cast<void (kpDocument::*)(int, int)>(&kpDocument::sizeChanged), | ||
749 | d->viewManager, &kpViewManager::adjustViewsToEnvironment); | ||||
750 | | ||||
751 | connect (d->document, | ||||
752 | static_cast<void (kpDocument::*)(int, int)>(&kpDocument::sizeChanged), | ||||
753 | d->viewManager, &kpViewManager::adjustViewsToEnvironment); | ||||
737 | 754 | | |||
738 | #if DEBUG_KP_MAIN_WINDOW | 755 | #if DEBUG_KP_MAIN_WINDOW | ||
739 | qCDebug(kpLogMainWindow) << "\tenabling actions"; | 756 | qCDebug(kpLogMainWindow) << "\tenabling actions"; | ||
740 | #endif | 757 | #endif | ||
741 | 758 | | |||
742 | // sync with the bit marked "sync" above | 759 | // sync with the bit marked "sync" above | ||
743 | 760 | | |||
744 | Q_ASSERT (d->colorToolBar); | 761 | Q_ASSERT (d->colorToolBar); | ||
▲ Show 20 Lines • Show All 235 Lines • Show Last 20 Lines |