Open HTML help from Help-menu in Windows.
This commit is contained in:
parent
e38694ccfc
commit
279e66a1d6
|
@ -69,7 +69,7 @@ SOURCES += main.cpp \
|
||||||
win32 {
|
win32 {
|
||||||
RC_FILE = cppcheck-gui.rc
|
RC_FILE = cppcheck-gui.rc
|
||||||
HEADERS += ../cli/resource.h
|
HEADERS += ../cli/resource.h
|
||||||
LIBS += -lshlwapi
|
LIBS += -lshlwapi -lhtmlhelp
|
||||||
}
|
}
|
||||||
|
|
||||||
# run lrelease before build
|
# run lrelease before build
|
||||||
|
|
15
gui/main.ui
15
gui/main.ui
|
@ -66,7 +66,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>640</width>
|
<width>640</width>
|
||||||
<height>22</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="mMenuFile">
|
<widget class="QMenu" name="mMenuFile">
|
||||||
|
@ -101,8 +101,10 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&Help</string>
|
<string>&Help</string>
|
||||||
</property>
|
</property>
|
||||||
|
<addaction name="mActionHelpContents"/>
|
||||||
<addaction name="mActionLicense"/>
|
<addaction name="mActionLicense"/>
|
||||||
<addaction name="mActionAuthors"/>
|
<addaction name="mActionAuthors"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="mActionAbout"/>
|
<addaction name="mActionAbout"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="mMenuCheck">
|
<widget class="QMenu" name="mMenuCheck">
|
||||||
|
@ -312,6 +314,17 @@
|
||||||
<string>&Toolbar</string>
|
<string>&Toolbar</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="mActionHelpContents">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Contents</string>
|
||||||
|
</property>
|
||||||
|
<property name="statusTip">
|
||||||
|
<string>Open the help contents</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>F1</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
@ -34,6 +34,12 @@
|
||||||
#include "report.h"
|
#include "report.h"
|
||||||
#include "../lib/filelister.h"
|
#include "../lib/filelister.h"
|
||||||
|
|
||||||
|
// HTMLHelp is only available in Windows
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#include <htmlhelp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
MainWindow::MainWindow() :
|
MainWindow::MainWindow() :
|
||||||
mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)),
|
mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)),
|
||||||
mApplications(new ApplicationList(this)),
|
mApplications(new ApplicationList(this)),
|
||||||
|
@ -74,6 +80,13 @@ MainWindow::MainWindow() :
|
||||||
connect(mUI.mResults, SIGNAL(GotResults()), this, SLOT(ResultsAdded()));
|
connect(mUI.mResults, SIGNAL(GotResults()), this, SLOT(ResultsAdded()));
|
||||||
connect(mUI.mMenuView, SIGNAL(aboutToShow()), this, SLOT(AboutToShowViewMenu()));
|
connect(mUI.mMenuView, SIGNAL(aboutToShow()), this, SLOT(AboutToShowViewMenu()));
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
connect(mUI.mActionHelpContents, SIGNAL(triggered()), this, SLOT(OpenHelpContents()));
|
||||||
|
#else
|
||||||
|
// Hide if not Windows
|
||||||
|
mUI.mActionHelpContents.setVisible(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
CreateLanguageMenuItems();
|
CreateLanguageMenuItems();
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
|
||||||
|
@ -640,3 +653,19 @@ void MainWindow::StopChecking()
|
||||||
mThread->Stop();
|
mThread->Stop();
|
||||||
mUI.mResults->DisableProgressbar();
|
mUI.mResults->DisableProgressbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::OpenHelpContents()
|
||||||
|
{
|
||||||
|
OpenHtmlHelpContents();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::OpenHtmlHelpContents()
|
||||||
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
QString file("/cppcheck.chm");
|
||||||
|
QString exeFolder = QDir::currentPath();
|
||||||
|
exeFolder += file;
|
||||||
|
exeFolder = QDir::toNativeSeparators(exeFolder);
|
||||||
|
HtmlHelp(NULL, exeFolder.utf16(), HH_DISPLAY_TOPIC, NULL);
|
||||||
|
#endif // WIN32
|
||||||
|
}
|
||||||
|
|
|
@ -179,6 +179,12 @@ protected slots:
|
||||||
*/
|
*/
|
||||||
void StopChecking();
|
void StopChecking();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Open help file contents
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void OpenHelpContents();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -268,6 +274,11 @@ protected:
|
||||||
*/
|
*/
|
||||||
void FormatAndSetTitle(const QString &text = QString());
|
void FormatAndSetTitle(const QString &text = QString());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Show help contents
|
||||||
|
*/
|
||||||
|
void OpenHtmlHelpContents();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Program settings
|
* @brief Program settings
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue