! Create document view and setup signal-slot connections. */
| 3770 | Create document view and setup signal-slot connections. |
| 3771 | */ |
| 3772 | WizDocumentView* WizMainWindow::createDocumentView() |
| 3773 | { |
| 3774 | //FIXME: This function will take about 1200 milliseconds. |
| 3775 | WizDocumentView* newDocView = new WizDocumentView(*this); |
| 3776 | auto newWebView = newDocView->web(); |
| 3777 | |
| 3778 | // Binding signals |
| 3779 | //------------------------------------------------------------------- |
| 3780 | |
| 3781 | connect(newWebView, &WizDocumentWebView::loadDocumentRequested, m_docLoader, &WizDocumentLoaderThread::load); |
| 3782 | connect(m_docLoader, &WizDocumentLoaderThread::loaded, newWebView, &WizDocumentWebView::onDocumentReady, Qt::QueuedConnection); |
| 3783 | connect(m_docLoader, &WizDocumentLoaderThread::loadFailed, [this] { |
| 3784 | QMessageBox::critical(this, tr("Error"), tr("Can't view note: (Can't unzip note data)")); |
| 3785 | }); |
| 3786 | |
| 3787 | connect(newWebView, &WizDocumentWebView::saveDocumentRequested, m_docSaver, &WizDocumentSaverThread::save); |
| 3788 | connect(m_docSaver, &WizDocumentSaverThread::saved, newWebView, &WizDocumentWebView::onDocumentSaved, Qt::QueuedConnection); |
| 3789 | |
| 3790 | connect(newDocView, &WizDocumentView::shareDocumentByLinkRequest, |
| 3791 | this, &WizMainWindow::on_shareDocumentByLink_request); |
| 3792 | connect(newDocView, SIGNAL(documentSaved(QString,WizDocumentView*)), |
| 3793 | m_singleViewMgr, SIGNAL(documentChanged(QString,WizDocumentView*))); |
| 3794 | connect(m_singleViewMgr, SIGNAL(documentChanged(QString,WizDocumentView*)), |
| 3795 | newDocView, SLOT(on_document_data_changed(QString,WizDocumentView*))); |
| 3796 | connect(newDocView->titleBar(), SIGNAL(viewNoteInSeparateWindow_request()), |
| 3797 | SLOT(viewCurrentNoteInSeparateWindow())); |
| 3798 | connect(newDocView->web(), SIGNAL(statusChanged(const QString&)), SLOT(on_editor_statusChanged(const QString&))); |
| 3799 | |
| 3800 | connect(newDocView, &WizDocumentView::viewNoteInExternalEditorRequest, |
| 3801 | m_externalEditorLauncher, &ExternalEditorLauncher::handleViewNoteInExternalEditorRequest); |
| 3802 | |
| 3803 | // Setup document view UI |
| 3804 | //------------------------------------------------------------------- |
| 3805 | |
| 3806 | newDocView->web()->setInSeperateWindow(false); |
| 3807 | //newDocView->commentWidget()->setMinimumWidth(195); |
| 3808 | //newDocView->web()->setMinimumWidth(576); |
| 3809 | |
| 3810 | return newDocView; |
| 3811 | } |
| 3812 | |
| 3813 | /** |
| 3814 | * @brief 在当前文档视图中载入笔记数据 |
nothing calls this directly
no test coverage detected