Added offline help pages for windows Qt GUI.

This commit is contained in:
mjbudd77 2021-08-15 20:42:51 -04:00
parent 1e13f3f7c3
commit 90d8dbd411
5 changed files with 51 additions and 1 deletions

View File

@ -460,6 +460,7 @@ set(SRC_DRIVERS_SDL
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/PaletteEditor.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ColorMenu.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/GuiConf.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/HelpPages.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/MoviePlay.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/MovieRecord.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/MovieOptions.cpp

View File

@ -68,6 +68,7 @@
#include "Qt/HotKeyConf.h"
#include "Qt/PaletteConf.h"
#include "Qt/PaletteEditor.h"
#include "Qt/HelpPages.h"
#include "Qt/GuiConf.h"
#include "Qt/AviRecord.h"
#include "Qt/MoviePlay.h"
@ -1888,13 +1889,23 @@ void consoleWin_t::createMainMenu(void)
helpMenu->addAction(msgLogAct);
// Help -> Documentation
// Help -> Documentation Online
act = new QAction(tr("&Docs (Online)"), this);
act->setStatusTip(tr("Documentation"));
act->setIcon( style()->standardIcon( QStyle::SP_DialogHelpButton ) );
connect(act, SIGNAL(triggered()), this, SLOT(openOnlineDocs(void)) );
helpMenu->addAction(act);
#ifdef WIN32
// Help -> Documentation Offline
act = new QAction(tr("&Docs (Offline)"), this);
act->setStatusTip(tr("Documentation"));
act->setIcon( style()->standardIcon( QStyle::SP_DialogHelpButton ) );
connect(act, SIGNAL(triggered()), this, SLOT(openOfflineDocs(void)) );
helpMenu->addAction(act);
#endif
};
//---------------------------------------------------------------------------
int consoleWin_t::loadVideoDriver( int driverId )
@ -3908,6 +3919,12 @@ void consoleWin_t::openOnlineDocs(void)
return;
}
void consoleWin_t::openOfflineDocs(void)
{
OpenHelpWindow();
return;
}
#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
int consoleWin_t::setNicePriority( int value )
{

View File

@ -312,6 +312,7 @@ class consoleWin_t : public QMainWindow
void aboutFCEUX(void);
void aboutQt(void);
void openOnlineDocs(void);
void openOfflineDocs(void);
void openMsgLogWin(void);
void openInputConfWin(void);
void openGameSndConfWin(void);

View File

@ -0,0 +1,28 @@
// HelpPages.cpp
#include <string>
#include "Qt/HelpPages.h"
#ifdef WIN32
#include <htmlhelp.h>
void OpenHelpWindow(std::string subpage)
{
std::string helpFileName = BaseDirectory;
helpFileName += "\\fceux.chm";
if (subpage.length() > 0)
{
helpFileName = helpFileName + "::/" + subpage + ".htm";
}
HtmlHelp(GetDesktopWindow(), helpFileName.c_str(), HH_DISPLAY_TOPIC, (DWORD)NULL);
}
#else
void OpenHelpWindow(std::string subpage)
{
printf("Local CHM Help File Reference is only supported on Windows OS\n");
}
#endif

View File

@ -0,0 +1,3 @@
// HelpPages.h
void OpenHelpWindow(std::string subpage = "");