Changeset View
Changeset View
Standalone View
Standalone View
lib/documentview/documentview.cpp
Show First 20 Lines • Show All 534 Lines • ▼ Show 20 Line(s) | |||||
535 | void DocumentView::openUrl(const QUrl &url, const DocumentView::Setup& setup) | 535 | void DocumentView::openUrl(const QUrl &url, const DocumentView::Setup& setup) | ||
536 | { | 536 | { | ||
537 | if (d->mDocument) { | 537 | if (d->mDocument) { | ||
538 | if (url == d->mDocument->url()) { | 538 | if (url == d->mDocument->url()) { | ||
539 | return; | 539 | return; | ||
540 | } | 540 | } | ||
541 | disconnect(d->mDocument.data(), nullptr, this, nullptr); | 541 | disconnect(d->mDocument.data(), nullptr, this, nullptr); | ||
542 | } | 542 | } | ||
543 | | ||||
544 | // because some loading will be going on right now, also display the indicator right now | ||||
545 | // it will be hidden again in slotBusyChanged() | ||||
546 | d->showLoadingIndicator(); | ||||
547 | | ||||
543 | d->mSetup = setup; | 548 | d->mSetup = setup; | ||
544 | d->mDocument = DocumentFactory::instance()->load(url); | 549 | d->mDocument = DocumentFactory::instance()->load(url); | ||
545 | connect(d->mDocument.data(), &Document::busyChanged, this, &DocumentView::slotBusyChanged); | 550 | connect(d->mDocument.data(), &Document::busyChanged, this, &DocumentView::slotBusyChanged); | ||
546 | connect(d->mDocument.data(), &Document::modified, this, [this]() { | 551 | connect(d->mDocument.data(), &Document::modified, this, [this]() { | ||
547 | d->updateZoomSnapValues(); | 552 | d->updateZoomSnapValues(); | ||
548 | }); | 553 | }); | ||
549 | 554 | | |||
550 | if (d->mDocument->loadingState() < Document::KindDetermined) { | 555 | if (d->mDocument->loadingState() < Document::KindDetermined) { | ||
551 | MessageViewAdapter* messageViewAdapter = qobject_cast<MessageViewAdapter*>(d->mAdapter.data()); | 556 | MessageViewAdapter* messageViewAdapter = qobject_cast<MessageViewAdapter*>(d->mAdapter.data()); | ||
552 | if (messageViewAdapter) { | 557 | if (messageViewAdapter) { | ||
553 | messageViewAdapter->setInfoMessage(QString()); | 558 | messageViewAdapter->setInfoMessage(QString()); | ||
554 | } | 559 | } | ||
555 | d->showLoadingIndicator(); | | |||
556 | connect(d->mDocument.data(), &Document::kindDetermined, | 560 | connect(d->mDocument.data(), &Document::kindDetermined, | ||
557 | this, &DocumentView::finishOpenUrl); | 561 | this, &DocumentView::finishOpenUrl); | ||
558 | } else { | 562 | } else { | ||
559 | QMetaObject::invokeMethod(this, "finishOpenUrl", Qt::QueuedConnection); | 563 | QMetaObject::invokeMethod(this, "finishOpenUrl", Qt::QueuedConnection); | ||
560 | } | 564 | } | ||
561 | d->setupBirdEyeView(); | 565 | d->setupBirdEyeView(); | ||
562 | } | 566 | } | ||
563 | 567 | | |||
▲ Show 20 Lines • Show All 542 Lines • Show Last 20 Lines |