Added unix docs build to pipeline. Added navigation buttons to help window.

This commit is contained in:
mjbudd77 2021-08-17 21:23:39 -04:00
parent db6c1b8291
commit 8b0f4a0fc0
9 changed files with 245 additions and 76 deletions

View File

@ -76,7 +76,7 @@ echo '****************************************'
echo 'Install Dependency Qt5'
echo '****************************************'
sudo apt-get --assume-yes install qt5-default
sudo apt-get --assume-yes install qttools5-dev
sudo apt-get --assume-yes install qttools5-dev # For Qt Help
# Install x264
echo '****************************************'
@ -102,6 +102,8 @@ echo '**************************'
mkdir -p $INSTALL_PREFIX/usr;
echo "Num CPU: `nproc`";
./scripts/unix_make_docs.sh
mkdir buildQT; cd buildQT;
cmake \
-DCMAKE_BUILD_TYPE=Release \

View File

@ -95,6 +95,7 @@ fi
echo '**************************'
echo '*** Building Project ***'
echo '**************************'
./scripts/unix_make_docs.sh;
mkdir build;
cd build;
cmake \

View File

@ -4175,8 +4175,6 @@ void consoleWin_t::updatePeriodic(void)
recWavAct->setEnabled( FCEU_IsValidUI( FCEUI_RECORDMOVIE ) && !FCEUI_WaveRecordRunning() );
recAsWavAct->setEnabled( FCEU_IsValidUI( FCEUI_RECORDMOVIE ) && !FCEUI_WaveRecordRunning() );
stopWavAct->setEnabled( FCEUI_WaveRecordRunning() );
helpPageMaint();
}
if ( errorMsgValid )

View File

@ -299,9 +299,8 @@ class consoleWin_t : public QMainWindow
void loadState(int slot);
void transferVideoBuffer(void);
void syncAutoFirePatternMenu(void);
void helpPageMaint(void);
std::string find_chm(void);
std::string findHelpFile(void);
public slots:
void openDebugWindow(void);

View File

@ -24,8 +24,10 @@
#include <QFileDialog>
#include <QStandardPaths>
#include <QMenuBar>
#include <QToolBar>
#include <QMenu>
#include <QAction>
#include <QSettings>
#include <QHelpEngine>
#include <QHelpIndexModel>
#include <QHelpContentWidget>
@ -39,15 +41,15 @@
#ifdef WIN32
#include <Windows.h>
#include <htmlhelp.h>
#else // Linux or Unix or APPLE
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
//#else // Linux or Unix or APPLE
//#include <unistd.h>
//#include <sys/types.h>
//#include <sys/wait.h>
#endif
#if defined(__linux__) || defined(__unix__) || defined(__APPLE__)
static int forkHelpFileViewer( const char *chmViewer, const char *filepath );
#endif
//#if defined(__linux__) || defined(__unix__) || defined(__APPLE__)
//static int forkHelpFileViewer( const char *chmViewer, const char *filepath );
//#endif
void consoleWin_t::OpenHelpWindow(std::string subpage)
{
@ -57,13 +59,25 @@ void consoleWin_t::OpenHelpWindow(std::string subpage)
if ( helpFileName.length() == 0 )
{
std::string helpFileName = FCEUI_GetBaseDirectory();
#ifdef WIN32
helpFileName = FCEUI_GetBaseDirectory();
helpFileName += "\\..\\doc\\fceux.chm";
#else
helpFileName = "/usr/share/fceux/fceux.qhc";
#endif
#ifdef __APPLE__
if ( !QFile( QString::fromStdString(helpFileName) ).exists() )
{
// Search for MacOSX DragNDrop Resources
helpFileName = QApplication::applicationDirPath().toStdString() + "/../Resources/fceux.qhc";
}
#endif
}
if ( !QFile( QString::fromStdString(helpFileName) ).exists() )
{
helpFileName = find_chm();
helpFileName = findHelpFile();
}
if ( helpFileName.length() == 0 )
@ -95,40 +109,37 @@ void consoleWin_t::OpenHelpWindow(std::string subpage)
printf("There is already a CHM Viewer open somewhere...\n");
return;
}
std::string helpFileViewer;
g_config->getOption ("SDL.HelpFileViewer", &helpFileViewer );
//helpWin = forkHelpFileViewer( helpFileViewer.c_str(), helpFileName.c_str() );
HelpDialog *win = new HelpDialog(this);
HelpDialog *win = new HelpDialog( helpFileName.c_str(), this);
win->show();
#endif
}
void consoleWin_t::helpPageMaint(void)
{
#ifdef WIN32
// Does any help page cleanup need to be done in windows?
#else
if ( helpWin > 0 )
{ // Calling waitpid is important to ensure that CHM viewer process is cleaned up
// in the event that it exits. Otherwise zombie processes will be left.
int pid, wstat=0;
pid = waitpid( -1, &wstat, WNOHANG );
if ( pid == helpWin )
{
//printf("Help CHM Viewer Closed\n");
helpWin = 0;
}
}
#endif
}
std::string consoleWin_t::find_chm(void)
//void consoleWin_t::helpPageMaint(void)
//{
//#ifdef WIN32
// // Does any help page cleanup need to be done in windows?
//#else
// if ( helpWin > 0 )
// { // Calling waitpid is important to ensure that CHM viewer process is cleaned up
// // in the event that it exits. Otherwise zombie processes will be left.
// int pid, wstat=0;
//
// pid = waitpid( -1, &wstat, WNOHANG );
//
// if ( pid == helpWin )
// {
// //printf("Help CHM Viewer Closed\n");
// helpWin = 0;
// }
// }
//
//#endif
//}
std::string consoleWin_t::findHelpFile(void)
{
int ret, useNativeFileDialogVal;
QString filename;
@ -145,7 +156,11 @@ std::string consoleWin_t::find_chm(void)
dialog.setFileMode(QFileDialog::ExistingFile);
#ifdef WIN32
dialog.setNameFilter(tr("Compiled HTML Files (*.chm *.CHM) ;; All files (*)"));
#else
dialog.setNameFilter(tr("QHelp Files (*.qhc *.QHC) ;; All files (*)"));
#endif
dialog.setViewMode(QFileDialog::List);
dialog.setFilter( QDir::AllEntries | QDir::AllDirs | QDir::Hidden );
@ -194,43 +209,46 @@ std::string consoleWin_t::find_chm(void)
return filename.toStdString();
}
#if defined(__linux__) || defined(__unix__) || defined(__APPLE__)
static int forkHelpFileViewer( const char *chmViewer, const char *filepath )
{
int pid = 0;
if ( chmViewer[0] == 0 )
{
return -1;
}
pid = fork();
if ( pid == 0 )
{ // Child process
execl( chmViewer, chmViewer, filepath, NULL );
exit(0);
}
return pid;
}
#endif
//#if defined(__linux__) || defined(__unix__) || defined(__APPLE__)
//static int forkHelpFileViewer( const char *chmViewer, const char *filepath )
//{
// int pid = 0;
//
// if ( chmViewer[0] == 0 )
// {
// return -1;
// }
//
// pid = fork();
//
// if ( pid == 0 )
// { // Child process
// execl( chmViewer, chmViewer, filepath, NULL );
// exit(0);
// }
// return pid;
//}
//#endif
//-----------------------------------------------------------------------------------------------
//--- Help Page Dialog
//-----------------------------------------------------------------------------------------------
HelpDialog::HelpDialog(QWidget *parent)
HelpDialog::HelpDialog( const char *helpFileName, QWidget *parent)
: QDialog(parent, Qt::Window)
{
int useNativeMenuBar;
QMenu *fileMenu;
QMenuBar *menuBar;
QToolBar *toolBar;
QAction *act;
QVBoxLayout *mainLayoutv;
QSettings settings;
mainLayoutv = new QVBoxLayout();
setLayout( mainLayoutv );
toolBar = new QToolBar(this);
menuBar = new QMenuBar(this);
mainLayoutv->setMenuBar( menuBar );
@ -239,6 +257,16 @@ HelpDialog::HelpDialog(QWidget *parent)
menuBar->setNativeMenuBar( useNativeMenuBar ? true : false );
helpEngine = new QHelpEngine( helpFileName, this );
helpEngine->setupData();
hsplitter = new QSplitter( Qt::Horizontal );
tabWgt = new QTabWidget();
textViewer = new HelpBrowser( helpEngine );
textViewer->setSource(
QUrl("qthelp://TasVideos.fceux/doc/help/fceux.html"));
//-----------------------------------------------------------------------
// Menu Start
//-----------------------------------------------------------------------
@ -257,17 +285,32 @@ HelpDialog::HelpDialog(QWidget *parent)
// Menu End
//-----------------------------------------------------------------------
helpEngine = new QHelpEngine(
QApplication::applicationDirPath() +
"/fceux.qhc", this);
helpEngine->setupData();
//-----------------------------------------------------------------------
// Tool Bar Setup Start
//-----------------------------------------------------------------------
hsplitter = new QSplitter( Qt::Horizontal );
tabWgt = new QTabWidget();
textViewer = new HelpBrowser( helpEngine );
backButton = act = new QAction(tr("&Backward"), this);
//act->setShortcut( QKeySequence(tr("Ctrl+A") ));
act->setToolTip(tr("Navigate Backward"));
act->setIcon( style()->standardIcon(QStyle::SP_ArrowBack) );
connect(act, SIGNAL(triggered(void)), textViewer, SLOT(backward(void)) );
textViewer->setSource(
QUrl("qthelp://TasVideos.fceux/doc/../web/help/fceux.html"));
toolBar->addAction(act);
forwardButton = act = new QAction(tr("&Forward"), this);
//act->setShortcut( QKeySequence(tr("Ctrl+A") ));
act->setToolTip(tr("Navigate Forward"));
act->setIcon( style()->standardIcon(QStyle::SP_ArrowForward) );
connect(act, SIGNAL(triggered(void)), textViewer, SLOT(forward(void)) );
toolBar->addAction(act);
//-----------------------------------------------------------------------
// Tool Bar Setup End
//-----------------------------------------------------------------------
backButton->setEnabled(false);
forwardButton->setEnabled(false);
tabWgt->addTab( helpEngine->contentWidget(), tr("Contents") );
tabWgt->addTab( helpEngine->indexWidget() , tr("Index") );
@ -275,6 +318,7 @@ HelpDialog::HelpDialog(QWidget *parent)
hsplitter->addWidget( tabWgt );
hsplitter->addWidget( textViewer );
mainLayoutv->addWidget( toolBar );
mainLayoutv->addWidget( hsplitter );
connect(helpEngine->contentWidget(),
@ -285,11 +329,26 @@ HelpDialog::HelpDialog(QWidget *parent)
SIGNAL(linkActivated(QUrl, QString)),
textViewer, SLOT(setSource(QUrl)));
connect( textViewer, SIGNAL(backwardAvailable(bool)), this, SLOT(navBackwardAvailable(bool)) );
connect( textViewer, SIGNAL(forwardAvailable(bool)) , this, SLOT(navForwardAvailable(bool)) );
// Restore Window Geometry
restoreGeometry(settings.value("HelpPage/geometry").toByteArray());
// Restore Horizontal Panel State
hsplitter->restoreState( settings.value("HelpPage/hPanelState").toByteArray() );
}
//-----------------------------------------------------------------------------------------------
HelpDialog::~HelpDialog(void)
{
QSettings settings;
// Save Horizontal Panel State
settings.setValue("HelpPage/hPanelState", hsplitter->saveState());
// Save Window Geometry
settings.setValue("HelpPage/geometry", saveGeometry());
}
//-----------------------------------------------------------------------------------------------
void HelpDialog::closeEvent(QCloseEvent *event)
@ -307,6 +366,16 @@ void HelpDialog::closeWindow(void)
deleteLater();
}
//-----------------------------------------------------------------------------------------------
void HelpDialog::navBackwardAvailable(bool avail)
{
backButton->setEnabled( avail );
}
//-----------------------------------------------------------------------------------------------
void HelpDialog::navForwardAvailable(bool avail)
{
forwardButton->setEnabled( avail );
}
//-----------------------------------------------------------------------------------------------
//---- Help Browser Class
//-----------------------------------------------------------------------------------------------
HelpBrowser::HelpBrowser(QHelpEngine* helpEngine,

View File

@ -2,6 +2,7 @@
#pragma once
#include <QDialog>
#include <QAction>
#include <QSplitter>
#include <QTabWidget>
#include <QTextBrowser>
@ -22,7 +23,7 @@ class HelpDialog : public QDialog
Q_OBJECT
public:
HelpDialog( QWidget *parent = 0);
HelpDialog( const char *helpFileName, QWidget *parent = 0);
~HelpDialog(void);
protected:
@ -32,7 +33,11 @@ class HelpDialog : public QDialog
QSplitter *hsplitter;
QTabWidget *tabWgt;
HelpBrowser *textViewer;
QAction *backButton;
QAction *forwardButton;
public slots:
void closeWindow(void);
void navBackwardAvailable(bool);
void navForwardAvailable(bool);
};

View File

@ -708,11 +708,6 @@ InitConfig()
config->addOption("_lastopenmovie", "SDL.LastOpenMovie", movPath);
config->addOption("_lastloadlua", "SDL.LastLoadLua", "");
config->addOption("SDL.HelpFilePath", "");
#ifdef WIN32
config->addOption("SDL.HelpFileViewer", "");
#else
config->addOption("SDL.HelpFileViewer", "/usr/bin/xchm");
#endif
for (unsigned int i=0; i<10; i++)
{

14
web/fceux.qhcp Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<QHelpCollectionProject version="1.0">
<docFiles>
<generate>
<file>
<input>fceux.qhp</input>
<output>fceux.qch</output>
</file>
</generate>
<register>
<file>fceux.qch</file>
</register>
</docFiles>
</QHelpCollectionProject>

86
web/fceux.qhp Normal file
View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<QtHelpProject version="1.0">
<namespace>TasVideos.fceux</namespace>
<virtualFolder>doc</virtualFolder>
<customFilter name="FCEUX Application 1.0">
<filterAttribute>fceux</filterAttribute>
<filterAttribute>1.0</filterAttribute>
</customFilter>
<filterSection>
<filterAttribute>fceux</filterAttribute>
<filterAttribute>1.0</filterAttribute>
<toc>
<section title="FCEUX Manual" ref="help/fceux.html">
<section title="Introduction" ref="help/Intro.html"/>
</section>
</toc>
<keywords>
<keyword name="foo" id="MyApplication::foo" ref="doc.html#foo"/>
<keyword name="bar" ref="doc.html#bar"/>
</keywords>
<files>
<file>help/*</file>
<file>help/img/*</file>
<file>help/taseditor-ru/*</file>
<file>help/taseditor-ru/img/*</file>
<file>help/taseditor-ru/js/*</file>
<file>help/taseditor-ru/lib/*</file>
<file>help/taseditor-ru/css/*</file>
<file>help/taseditor-ru/css/silver-theme/*</file>
<file>help/taseditor-ru/css/silver-theme/images/*</file>
<file>help/taseditor-ru/css/dynatree/chm/*</file>
<file>help/taseditor-ru/css/dynatree/folder/*</file>
<file>help/taseditor-ru/css/dynatree/vista/*</file>
<file>help/context/*</file>
<file>help/vendors/bootstrap-3.4.1/js/*</file>
<file>help/vendors/bootstrap-3.4.1/css/*</file>
<file>help/vendors/bootstrap-3.4.1/fonts/*</file>
<file>help/vendors/jstree-3.3.10/*</file>
<file>help/vendors/jstree-3.3.10/themes/default-dark/*</file>
<file>help/vendors/jstree-3.3.10/themes/default/*</file>
<file>help/vendors/interactjs-1.9.22/*</file>
<file>help/vendors/html5shiv-3.7.3/*</file>
<file>help/vendors/imageMapResizer-1.0.10/*</file>
<file>help/vendors/respond-1.4.2/*</file>
<file>help/vendors/headroom-0.11.0/*</file>
<file>help/vendors/markjs-8.11.1/*</file>
<file>help/vendors/jquery-3.5.1/*</file>
<file>help/vendors/uri-1.19.2/*</file>
<file>help/vendors/helpndoc-5/icons/*</file>
<file>help/taseditor/*</file>
<file>help/taseditor/img/*</file>
<file>help/taseditor/context/*</file>
<file>help/taseditor/vendors/bootstrap-3.4.1/js/*</file>
<file>help/taseditor/vendors/bootstrap-3.4.1/css/*</file>
<file>help/taseditor/vendors/bootstrap-3.4.1/fonts/*</file>
<file>help/taseditor/vendors/jstree-3.3.10/*</file>
<file>help/taseditor/vendors/jstree-3.3.10/themes/default-dark/*</file>
<file>help/taseditor/vendors/jstree-3.3.10/themes/default/*</file>
<file>help/taseditor/vendors/interactjs-1.9.22/*</file>
<file>help/taseditor/vendors/html5shiv-3.7.3/*</file>
<file>help/taseditor/vendors/imageMapResizer-1.0.10/*</file>
<file>help/taseditor/vendors/respond-1.4.2/*</file>
<file>help/taseditor/vendors/headroom-0.11.0/*</file>
<file>help/taseditor/vendors/markjs-8.11.1/*</file>
<file>help/taseditor/vendors/jquery-3.5.1/*</file>
<file>help/taseditor/vendors/uri-1.19.2/*</file>
<file>help/taseditor/vendors/helpndoc-5/icons/*</file>
<file>help/taseditor/js/*</file>
<file>help/taseditor/lib/*</file>
<file>help/taseditor/css/*</file>
<file>help/taseditor/css/silver-theme/*</file>
<file>help/taseditor/css/silver-theme/images/*</file>
<file>help/taseditor/css/dynatree/chm/*</file>
<file>help/taseditor/css/dynatree/folder/*</file>
<file>help/taseditor/css/dynatree/vista/*</file>
<file>help/js/*</file>
<file>help/js/context/*</file>
<file>help/css/*</file>
<file>help/css/silver-theme/*</file>
<file>help/css/silver-theme/images/*</file>
<file>help/css/dynatree/chm/*</file>
<file>help/css/dynatree/folder/*</file>
<file>help/css/dynatree/vista/*</file>
</files>
</filterSection>
</QtHelpProject>