| 75 | } |
| 76 | |
| 77 | HelpDialog::HelpDialog(QWidget *parent) : |
| 78 | QDialog(parent), |
| 79 | mUi(new Ui::HelpDialog) |
| 80 | { |
| 81 | mUi->setupUi(this); |
| 82 | |
| 83 | QString helpFile = getHelpFile(); |
| 84 | if (helpFile.isEmpty()) { |
| 85 | const QString msg = tr("Helpfile '%1' was not found").arg("online-help.qhc"); |
| 86 | QMessageBox msgBox(QMessageBox::Warning, |
| 87 | tr("Cppcheck"), |
| 88 | msg, |
| 89 | QMessageBox::Ok, |
| 90 | this); |
| 91 | msgBox.exec(); |
| 92 | mHelpEngine = nullptr; |
| 93 | return; |
| 94 | } |
| 95 | |
| 96 | mHelpEngine = new QHelpEngine(helpFile); |
| 97 | // Disable the timestamp check of online-help.qhc by setting _q_readonly |
| 98 | mHelpEngine->setProperty("_q_readonly", QVariant::fromValue<bool>(true)); |
| 99 | mHelpEngine->setupData(); |
| 100 | |
| 101 | mUi->contents->addWidget(mHelpEngine->contentWidget()); |
| 102 | mUi->index->addWidget(mHelpEngine->indexWidget()); |
| 103 | |
| 104 | mUi->textBrowser->setHelpEngine(mHelpEngine); |
| 105 | |
| 106 | mUi->textBrowser->setSource(QUrl("qthelp://cppcheck.sourceforge.io/doc/index.html")); |
| 107 | connect(mHelpEngine->contentWidget(), |
| 108 | SIGNAL(linkActivated(QUrl)), |
| 109 | mUi->textBrowser, |
| 110 | SLOT(setSource(QUrl))); |
| 111 | |
| 112 | connect(mHelpEngine->indexWidget(), |
| 113 | SIGNAL(linkActivated(QUrl,QString)), |
| 114 | mUi->textBrowser, |
| 115 | SLOT(setSource(QUrl))); |
| 116 | } |
| 117 | |
| 118 | HelpDialog::~HelpDialog() |
| 119 | { |
nothing calls this directly
no test coverage detected