From 8b0f4a0fc0baf46372ab46bedc3d97ce7347326b Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Tue, 17 Aug 2021 21:23:39 -0400 Subject: [PATCH] Added unix docs build to pipeline. Added navigation buttons to help window. --- pipelines/linux_build.sh | 4 +- pipelines/macOS_build.sh | 1 + src/drivers/Qt/ConsoleWindow.cpp | 2 - src/drivers/Qt/ConsoleWindow.h | 3 +- src/drivers/Qt/HelpPages.cpp | 199 +++++++++++++++++++++---------- src/drivers/Qt/HelpPages.h | 7 +- src/drivers/Qt/config.cpp | 5 - web/fceux.qhcp | 14 +++ web/fceux.qhp | 86 +++++++++++++ 9 files changed, 245 insertions(+), 76 deletions(-) create mode 100644 web/fceux.qhcp create mode 100644 web/fceux.qhp diff --git a/pipelines/linux_build.sh b/pipelines/linux_build.sh index 76e49a72..7f7ecb97 100755 --- a/pipelines/linux_build.sh +++ b/pipelines/linux_build.sh @@ -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 \ diff --git a/pipelines/macOS_build.sh b/pipelines/macOS_build.sh index 0c0a1185..43da7970 100755 --- a/pipelines/macOS_build.sh +++ b/pipelines/macOS_build.sh @@ -95,6 +95,7 @@ fi echo '**************************' echo '*** Building Project ***' echo '**************************' +./scripts/unix_make_docs.sh; mkdir build; cd build; cmake \ diff --git a/src/drivers/Qt/ConsoleWindow.cpp b/src/drivers/Qt/ConsoleWindow.cpp index 149d7532..0fa28e6f 100644 --- a/src/drivers/Qt/ConsoleWindow.cpp +++ b/src/drivers/Qt/ConsoleWindow.cpp @@ -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 ) diff --git a/src/drivers/Qt/ConsoleWindow.h b/src/drivers/Qt/ConsoleWindow.h index accd8a25..8c501d52 100644 --- a/src/drivers/Qt/ConsoleWindow.h +++ b/src/drivers/Qt/ConsoleWindow.h @@ -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); diff --git a/src/drivers/Qt/HelpPages.cpp b/src/drivers/Qt/HelpPages.cpp index 8a42ee76..15cf6891 100644 --- a/src/drivers/Qt/HelpPages.cpp +++ b/src/drivers/Qt/HelpPages.cpp @@ -24,8 +24,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -39,15 +41,15 @@ #ifdef WIN32 #include #include -#else // Linux or Unix or APPLE -#include -#include -#include +//#else // Linux or Unix or APPLE +//#include +//#include +//#include #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 + //----------------------------------------------------------------------- + + 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)) ); - hsplitter = new QSplitter( Qt::Horizontal ); - tabWgt = new QTabWidget(); - textViewer = new HelpBrowser( helpEngine ); + toolBar->addAction(act); - textViewer->setSource( - 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->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(), @@ -284,12 +328,27 @@ HelpDialog::HelpDialog(QWidget *parent) connect(helpEngine->indexWidget(), 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, diff --git a/src/drivers/Qt/HelpPages.h b/src/drivers/Qt/HelpPages.h index 6ff7e1e3..02866bea 100644 --- a/src/drivers/Qt/HelpPages.h +++ b/src/drivers/Qt/HelpPages.h @@ -2,6 +2,7 @@ #pragma once #include +#include #include #include #include @@ -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); }; diff --git a/src/drivers/Qt/config.cpp b/src/drivers/Qt/config.cpp index 3b90e81a..6626026a 100644 --- a/src/drivers/Qt/config.cpp +++ b/src/drivers/Qt/config.cpp @@ -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++) { diff --git a/web/fceux.qhcp b/web/fceux.qhcp new file mode 100644 index 00000000..d545384a --- /dev/null +++ b/web/fceux.qhcp @@ -0,0 +1,14 @@ + + + + + + fceux.qhp + fceux.qch + + + + fceux.qch + + + diff --git a/web/fceux.qhp b/web/fceux.qhp new file mode 100644 index 00000000..e6930812 --- /dev/null +++ b/web/fceux.qhp @@ -0,0 +1,86 @@ + + + TasVideos.fceux + doc + + fceux + 1.0 + + + fceux + 1.0 + +
+
+
+ + + + + + + help/* + help/img/* + help/taseditor-ru/* + help/taseditor-ru/img/* + help/taseditor-ru/js/* + help/taseditor-ru/lib/* + help/taseditor-ru/css/* + help/taseditor-ru/css/silver-theme/* + help/taseditor-ru/css/silver-theme/images/* + help/taseditor-ru/css/dynatree/chm/* + help/taseditor-ru/css/dynatree/folder/* + help/taseditor-ru/css/dynatree/vista/* + help/context/* + help/vendors/bootstrap-3.4.1/js/* + help/vendors/bootstrap-3.4.1/css/* + help/vendors/bootstrap-3.4.1/fonts/* + help/vendors/jstree-3.3.10/* + help/vendors/jstree-3.3.10/themes/default-dark/* + help/vendors/jstree-3.3.10/themes/default/* + help/vendors/interactjs-1.9.22/* + help/vendors/html5shiv-3.7.3/* + help/vendors/imageMapResizer-1.0.10/* + help/vendors/respond-1.4.2/* + help/vendors/headroom-0.11.0/* + help/vendors/markjs-8.11.1/* + help/vendors/jquery-3.5.1/* + help/vendors/uri-1.19.2/* + help/vendors/helpndoc-5/icons/* + help/taseditor/* + help/taseditor/img/* + help/taseditor/context/* + help/taseditor/vendors/bootstrap-3.4.1/js/* + help/taseditor/vendors/bootstrap-3.4.1/css/* + help/taseditor/vendors/bootstrap-3.4.1/fonts/* + help/taseditor/vendors/jstree-3.3.10/* + help/taseditor/vendors/jstree-3.3.10/themes/default-dark/* + help/taseditor/vendors/jstree-3.3.10/themes/default/* + help/taseditor/vendors/interactjs-1.9.22/* + help/taseditor/vendors/html5shiv-3.7.3/* + help/taseditor/vendors/imageMapResizer-1.0.10/* + help/taseditor/vendors/respond-1.4.2/* + help/taseditor/vendors/headroom-0.11.0/* + help/taseditor/vendors/markjs-8.11.1/* + help/taseditor/vendors/jquery-3.5.1/* + help/taseditor/vendors/uri-1.19.2/* + help/taseditor/vendors/helpndoc-5/icons/* + help/taseditor/js/* + help/taseditor/lib/* + help/taseditor/css/* + help/taseditor/css/silver-theme/* + help/taseditor/css/silver-theme/images/* + help/taseditor/css/dynatree/chm/* + help/taseditor/css/dynatree/folder/* + help/taseditor/css/dynatree/vista/* + help/js/* + help/js/context/* + help/css/* + help/css/silver-theme/* + help/css/silver-theme/images/* + help/css/dynatree/chm/* + help/css/dynatree/folder/* + help/css/dynatree/vista/* + + +