windows installer: another attempt to make help work. the 'contents' are shown now but for some reason the 'index' is not.
This commit is contained in:
parent
494fff65b7
commit
262d37fb47
|
@ -92,5 +92,10 @@ jobs:
|
|||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Build
|
||||
name: installer
|
||||
path: win_installer/Build/
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: deploy
|
||||
path: Build\gui
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
#include "assistant.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QDir>
|
||||
#include <QLibraryInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
|
||||
Assistant::Assistant()
|
||||
: mProc(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
Assistant::~Assistant()
|
||||
{
|
||||
if (mProc && mProc->state() == QProcess::Running) {
|
||||
mProc->terminate();
|
||||
mProc->waitForFinished(3000);
|
||||
}
|
||||
delete mProc;
|
||||
}
|
||||
|
||||
void Assistant::showDocumentation(const QString &page)
|
||||
{
|
||||
if (!startAssistant())
|
||||
return;
|
||||
|
||||
QByteArray ba("SetSource ");
|
||||
ba.append("qthelp://cppcheck.sourceforge.net/doc/");
|
||||
|
||||
mProc->write(ba + page.toLocal8Bit() + '\n');
|
||||
}
|
||||
|
||||
bool Assistant::startAssistant()
|
||||
{
|
||||
if (!mProc)
|
||||
mProc = new QProcess();
|
||||
|
||||
if (mProc->state() != QProcess::Running) {
|
||||
QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator();
|
||||
#if !defined(Q_OS_MAC)
|
||||
app += QLatin1String("assistant");
|
||||
#else
|
||||
app += QLatin1String("Assistant.app/Contents/MacOS/Assistant");
|
||||
#endif
|
||||
|
||||
QStringList args;
|
||||
args << QLatin1String("-collectionFile")
|
||||
<< QLatin1String("online-help.qhc")
|
||||
<< QLatin1String("-enableRemoteControl");
|
||||
|
||||
mProc->start(app, args);
|
||||
|
||||
if (!mProc->waitForStarted()) {
|
||||
QMessageBox::critical(nullptr,
|
||||
tr("Cppcheck"),
|
||||
tr("Unable to launch Qt Assistant (%1)").arg(app));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
#ifndef ASSISTANT_H
|
||||
#define ASSISTANT_H
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QString>
|
||||
|
||||
class QProcess;
|
||||
|
||||
class Assistant {
|
||||
Q_DECLARE_TR_FUNCTIONS(Assistant)
|
||||
|
||||
public:
|
||||
Assistant();
|
||||
~Assistant();
|
||||
void showDocumentation(const QString &file);
|
||||
|
||||
private:
|
||||
bool startAssistant();
|
||||
QProcess *mProc;
|
||||
};
|
||||
|
||||
#endif // ASSISTANT_H
|
|
@ -68,6 +68,7 @@ FORMS = about.ui \
|
|||
application.ui \
|
||||
file.ui \
|
||||
functioncontractdialog.ui \
|
||||
helpdialog.ui \
|
||||
mainwindow.ui \
|
||||
projectfiledialog.ui \
|
||||
resultsview.ui \
|
||||
|
@ -106,7 +107,6 @@ HEADERS += aboutdialog.h \
|
|||
application.h \
|
||||
applicationdialog.h \
|
||||
applicationlist.h \
|
||||
assistant.h \
|
||||
checkstatistics.h \
|
||||
checkthread.h \
|
||||
codeeditstylecontrols.h \
|
||||
|
@ -119,6 +119,7 @@ HEADERS += aboutdialog.h \
|
|||
filelist.h \
|
||||
fileviewdialog.h \
|
||||
functioncontractdialog.h \
|
||||
helpdialog.h \
|
||||
mainwindow.h \
|
||||
platforms.h \
|
||||
printablereport.h \
|
||||
|
@ -148,7 +149,6 @@ SOURCES += aboutdialog.cpp \
|
|||
application.cpp \
|
||||
applicationdialog.cpp \
|
||||
applicationlist.cpp \
|
||||
assistant.cpp \
|
||||
checkstatistics.cpp \
|
||||
checkthread.cpp \
|
||||
codeeditorstyle.cpp \
|
||||
|
@ -161,6 +161,7 @@ SOURCES += aboutdialog.cpp \
|
|||
filelist.cpp \
|
||||
fileviewdialog.cpp \
|
||||
functioncontractdialog.cpp \
|
||||
helpdialog.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp\
|
||||
platforms.cpp \
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
#include "helpdialog.h"
|
||||
#include "ui_helpdialog.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QHelpEngine>
|
||||
#include <QHelpContentWidget>
|
||||
#include <QHelpIndexWidget>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
void HelpBrowser::setHelpEngine(QHelpEngine *helpEngine)
|
||||
{
|
||||
mHelpEngine = helpEngine;
|
||||
}
|
||||
|
||||
QVariant HelpBrowser::loadResource(int type, const QUrl &name)
|
||||
{
|
||||
if (name.scheme() == "qthelp") {
|
||||
QString url(name.toString());
|
||||
while (url.indexOf("/./") > 0)
|
||||
url.remove(url.indexOf("/./"), 2);
|
||||
return QVariant(mHelpEngine->fileData(QUrl(url)));
|
||||
}
|
||||
return QTextBrowser::loadResource(type, name);
|
||||
}
|
||||
|
||||
static QString getHelpFile()
|
||||
{
|
||||
QSettings settings;
|
||||
const QString datadir = settings.value("DATADIR", QString()).toString();
|
||||
|
||||
QStringList paths;
|
||||
paths << (datadir + "/help")
|
||||
<< datadir
|
||||
<< (QApplication::applicationDirPath() + "/help")
|
||||
<< QApplication::applicationDirPath();
|
||||
for (QString p: paths) {
|
||||
QString filename = p + "/online-help.qhc";
|
||||
if (QFileInfo(filename).exists())
|
||||
return filename;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
HelpDialog::HelpDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
mUi(new Ui::HelpDialog)
|
||||
{
|
||||
mUi->setupUi(this);
|
||||
|
||||
QString helpFile = getHelpFile();
|
||||
if (helpFile.isEmpty()) {
|
||||
const QString msg = tr("Helpfile '%1' was not found").arg("online-help.qhc");
|
||||
QMessageBox msgBox(QMessageBox::Warning,
|
||||
tr("Cppcheck"),
|
||||
msg,
|
||||
QMessageBox::Ok,
|
||||
this);
|
||||
msgBox.exec();
|
||||
mHelpEngine = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
mHelpEngine = new QHelpEngine(helpFile);
|
||||
mHelpEngine->setupData();
|
||||
|
||||
mUi->contents->addWidget(mHelpEngine->contentWidget());
|
||||
mUi->index->addWidget(mHelpEngine->indexWidget());
|
||||
|
||||
mUi->textBrowser->setHelpEngine(mHelpEngine);
|
||||
|
||||
mUi->textBrowser->setSource(QUrl("qthelp://cppcheck.sourceforge.net/doc/index.html"));
|
||||
connect(mHelpEngine->contentWidget(),
|
||||
SIGNAL(linkActivated(QUrl)),
|
||||
mUi->textBrowser,
|
||||
SLOT(setSource(QUrl)));
|
||||
|
||||
connect(mHelpEngine->indexWidget(),
|
||||
SIGNAL(linkActivated(QUrl, QString)),
|
||||
mUi->textBrowser,
|
||||
SLOT(setSource(QUrl)));
|
||||
}
|
||||
|
||||
HelpDialog::~HelpDialog()
|
||||
{
|
||||
delete mUi;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef HELPDIALOG_H
|
||||
#define HELPDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTextBrowser>
|
||||
|
||||
namespace Ui {
|
||||
class HelpDialog;
|
||||
}
|
||||
|
||||
class QHelpEngine;
|
||||
|
||||
class HelpBrowser : public QTextBrowser {
|
||||
public:
|
||||
HelpBrowser(QWidget* parent = 0) : QTextBrowser(parent), mHelpEngine(nullptr) {}
|
||||
void setHelpEngine(QHelpEngine *helpEngine);
|
||||
QVariant loadResource(int type, const QUrl& name);
|
||||
private:
|
||||
QHelpEngine* mHelpEngine;
|
||||
};
|
||||
|
||||
class HelpDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HelpDialog(QWidget *parent = nullptr);
|
||||
~HelpDialog();
|
||||
|
||||
private:
|
||||
Ui::HelpDialog *mUi;
|
||||
QHelpEngine* mHelpEngine;
|
||||
};
|
||||
|
||||
#endif // HELPDIALOG_H
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>HelpDialog</class>
|
||||
<widget class="QDialog" name="HelpDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>635</width>
|
||||
<height>446</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Cppcheck GUI help</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QTabWidget" name="tabs">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabContents">
|
||||
<attribute name="title">
|
||||
<string>Contents</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="contents"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabIndex">
|
||||
<attribute name="title">
|
||||
<string>Index</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="index"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="HelpBrowser" name="textBrowser"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>HelpBrowser</class>
|
||||
<extends>QTextBrowser</extends>
|
||||
<header>helpdialog.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -33,11 +33,11 @@
|
|||
|
||||
#include "applicationlist.h"
|
||||
#include "aboutdialog.h"
|
||||
#include "assistant.h"
|
||||
#include "common.h"
|
||||
#include "filelist.h"
|
||||
#include "fileviewdialog.h"
|
||||
#include "functioncontractdialog.h"
|
||||
#include "helpdialog.h"
|
||||
#include "librarydialog.h"
|
||||
#include "projectfile.h"
|
||||
#include "projectfiledialog.h"
|
||||
|
@ -223,8 +223,6 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
|
|||
mUI.mActionEnforceCpp->setActionGroup(mSelectLanguageActions);
|
||||
mUI.mActionAutoDetectLanguage->setActionGroup(mSelectLanguageActions);
|
||||
|
||||
mAssistant = new Assistant;
|
||||
|
||||
// For Windows platforms default to Win32 checked platform.
|
||||
// For other platforms default to unspecified/default which means the
|
||||
// platform Cppcheck GUI was compiled on.
|
||||
|
@ -241,7 +239,6 @@ MainWindow::~MainWindow()
|
|||
{
|
||||
delete mProjectFile;
|
||||
delete mScratchPad;
|
||||
delete mAssistant;
|
||||
}
|
||||
|
||||
void MainWindow::handleCLIParams(const QStringList ¶ms)
|
||||
|
@ -1493,7 +1490,8 @@ void MainWindow::openHelpContents()
|
|||
|
||||
void MainWindow::openOnlineHelp()
|
||||
{
|
||||
mAssistant->showDocumentation("index.html");
|
||||
HelpDialog *helpDialog = new HelpDialog;
|
||||
helpDialog->showMaximized();
|
||||
}
|
||||
|
||||
void MainWindow::openProjectFile()
|
||||
|
|
|
@ -35,7 +35,6 @@ class TranslationHandler;
|
|||
class ScratchPad;
|
||||
class ProjectFile;
|
||||
class QAction;
|
||||
class Assistant;
|
||||
|
||||
/// @addtogroup GUI
|
||||
/// @{
|
||||
|
@ -472,8 +471,6 @@ private:
|
|||
* List of MRU menu actions. Needs also to store the separator.
|
||||
*/
|
||||
QAction *mRecentProjectActs[MaxRecentProjects + 1];
|
||||
|
||||
Assistant *mAssistant;
|
||||
};
|
||||
/// @}
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -39,12 +39,10 @@
|
|||
</File>
|
||||
<File Id='onlinehelpqhc' Name='online-help.qhc' Source='$(var.GuiHelpDir)\online-help.qhc' />
|
||||
<File Id='onlinehelpqch' Name='online-help.qch' Source='$(var.GuiHelpDir)\online-help.qch' />
|
||||
<File Id='assistantexe' Name='assistant.exe' Source='$(var.QtDllDir)\assistant.exe' />
|
||||
<File Id='Qt5Coredll' Name='Qt5Core.dll' Source='$(var.QtDllDir)\Qt5Core.dll' />
|
||||
<File Id='Qt5Guidll' Name='Qt5Gui.dll' Source='$(var.QtDllDir)\Qt5Gui.dll' />
|
||||
<File Id='Qt5Helpdll' Name='Qt5Help.dll' Source='$(var.QtDllDir)\Qt5Help.dll' />
|
||||
<File Id='Qt5Sqldll' Name='Qt5Sql.dll' Source='$(var.QtDllDir)\Qt5Sql.dll' />
|
||||
<File Id='qsqlitedll' Name='qsqlite.dll' Source='$(var.QtDllDir)\..\plugins\sqldrivers\qsqlite.dll' />
|
||||
<File Id='Qt5Widgetsdll' Name='Qt5Widgets.dll' Source='$(var.QtDllDir)\Qt5Widgets.dll' />
|
||||
<File Id='Qt5PrintSupportdll' Name='Qt5PrintSupport.dll' Source='$(var.QtDllDir)\Qt5PrintSupport.dll' />
|
||||
<?if $(var.Platform) = x64 ?>
|
||||
|
@ -61,6 +59,13 @@
|
|||
<File Id='qwindowsvistastyledll' Name='qwindowsvistastyle.dll' Source='$(var.QtDllDir)\styles\qwindowsvistastyle.dll' />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id='QtSqlDriversFolder' Name='sqldrivers'>
|
||||
<Component Id='QtSqlDrivers' DiskId='1' Guid='$(var.qtsqldriversGUID)'>
|
||||
<File Id='qsqlitedll' Name='qsqlite.dll' Source='$(var.QtDllDir)\sqldrivers\qsqlite.dll' />
|
||||
<File Id='qsqlodbcdll' Name='qsqlodbc.dll' Source='$(var.QtDllDir)\sqldrivers\qsqlodbc.dll' />
|
||||
<File Id='qsqlpsqldll' Name='qsqlpsql.dll' Source='$(var.QtDllDir)\sqldrivers\qsqlpsql.dll' />
|
||||
</Component>
|
||||
</Directory>
|
||||
<Directory Id='TranslationsFolder' Name='lang'>
|
||||
<Component Id='GuiTranslations' Guid='$(var.guiTranslationsGUID)'>
|
||||
<File Id='cppcheck_de.qm' Name='cppcheck_de.qm' Source='$(var.TranslationsDir)\cppcheck_de.qm' />
|
||||
|
@ -183,6 +188,7 @@
|
|||
<ComponentRef Id='GuiExecutable' />
|
||||
<ComponentRef Id='QtPlatforms' />
|
||||
<ComponentRef Id='QtStyles' />
|
||||
<ComponentRef Id='QtSqlDrivers' />
|
||||
<Feature Id='Translations' Title='GUI Translations' AllowAdvertise='no' Description='Translations for graphical user interface' Level='1'>
|
||||
<ComponentRef Id='GuiTranslations' />
|
||||
</Feature>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<?define guiGUID = "D7D3FF8E-1D82-4215-B59B-4715A748C540" ?>
|
||||
<?define qtplatformsGUID = "E2C326DF-11F1-4C05-A955-2E2D2A3B0515" ?>
|
||||
<?define qtstylesGUID = "A9CC70D0-52BA-4A8E-9EAF-FABF8DDEB200" ?>
|
||||
<?define qtsqldriversGUID = "619FF989-BA0B-48D7-BE49-CE48C6E899E8" ?>
|
||||
<?define guiTranslationsGUID = "24738151-890D-4fcc-824C-DA7FF63E0D7F" ?>
|
||||
<?define mandatoryCfgsGUID = "EE95621C-25E7-491A-8DE9-EA6E6967C176" ?>
|
||||
<?define optionalCfgsGUID = "3A8AE067-5F41-4D29-A35C-CC0FAB648608" ?>
|
||||
|
|
Loading…
Reference in New Issue