| 79 | } |
| 80 | |
| 81 | void TutorialOverlay::next() |
| 82 | { |
| 83 | cleanupChapter(); |
| 84 | |
| 85 | if(cnt == chapter.count()) { |
| 86 | // stop story |
| 87 | finish(); |
| 88 | return; |
| 89 | } |
| 90 | if(cnt > 0) |
| 91 | Q_EMIT chapter[cnt - 1]->chapterFinished(); |
| 92 | |
| 93 | Q_EMIT chapter[cnt]->chapterStarted(); |
| 94 | |
| 95 | initPopupWidget(); |
| 96 | m_popupWidget->setDescription(chapter[cnt]->description); |
| 97 | overlay->raise(); |
| 98 | overlay->clearHoles(); |
| 99 | |
| 100 | QList<QWidget *> subjects = chapter[cnt]->subjects; |
| 101 | if(!subjects.isEmpty()) { |
| 102 | overlay->setHoles(subjects); |
| 103 | |
| 104 | m_hoverWidget = new HoverWidget(m_popupWidget, chapter[cnt]->mainSubject, qApp->activeWindow()); |
| 105 | m_hoverWidget->setContentPos(chapter[cnt]->content); |
| 106 | m_hoverWidget->setAnchorPos(chapter[cnt]->anchor); |
| 107 | m_hoverWidget->setAnchorOffset(QPoint(chapter[cnt]->x_offset, chapter[cnt]->y_offset)); |
| 108 | |
| 109 | m_hoverWidget->raise(); |
| 110 | m_hoverWidget->setVisible(true); |
| 111 | for(QWidget *subj : qAsConst(subjects)) { |
| 112 | subj->raise(); |
| 113 | m_popupWidget->setFocusOnContinueButton(); |
| 114 | auto *highlight = new TintedOverlay(subj, QColor(255, 255, 255, 35)); |
| 115 | highlight->raise(); |
| 116 | highlight->show(); |
| 117 | highlights.append(highlight); |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | QString storyTitle = title + " " + QString::number(cnt + 1) + "/" + QString::number(chapter.count()); |
| 122 | m_popupWidget->setTitle(storyTitle); |
| 123 | |
| 124 | raise(); |
| 125 | show(); |
| 126 | m_popupWidget->raise(); |
| 127 | |
| 128 | cnt++; |
| 129 | if(cnt == chapter.count()) |
| 130 | m_popupWidget->getContinueBtn()->setText("Finish"); |
| 131 | } |
| 132 | |
| 133 | void TutorialOverlay::finish() |
| 134 | { |
no test coverage detected