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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -708,11 +708,6 @@ InitConfig()
config->addOption("_lastopenmovie", "SDL.LastOpenMovie", movPath); config->addOption("_lastopenmovie", "SDL.LastOpenMovie", movPath);
config->addOption("_lastloadlua", "SDL.LastLoadLua", ""); config->addOption("_lastloadlua", "SDL.LastLoadLua", "");
config->addOption("SDL.HelpFilePath", ""); 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++) 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>