Add local HTML help file to help menu.

So that a manual can be viewed without an Internet connection a second
manual action has been added to  the WSJT_X help menu. This shells out
to the default web browser with a local file target.

The build has been enhanced to install and package the current version
of the  HTML user manual  as downloaded from  the project web  site at
build time

The package  file locations have  been adjusted to be  compatible with
the QStandardPaths  class so that  its locate()  method can be  used to
portably access resources like this local help file

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4359 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2014-09-24 23:46:32 +00:00
parent b06ba8ab11
commit d4e55a093d
7 changed files with 89 additions and 25 deletions

View File

@ -0,0 +1,16 @@
#
# CMake script to fetch the current HTML manual
#
message (STATUS "file: ${URL}/${NAME}")
file (
DOWNLOAD ${URL}/${NAME} contrib/${NAME}
TIMEOUT 10
STATUS manual_STATUS
LOG manual_LOG
SHOW_PROGRESS
)
list (GET manual_STATUS 0 manual_RC)
if (manual_RC)
message (WARNING "${manual_STATUS}")
message (FATAL_ERROR "${manual_LOG}")
endif (manual_RC)

View File

@ -32,14 +32,14 @@ if (CPACK_GENERATOR MATCHES "NSIS")
set (CPACK_PACKAGE_ICON "@PROJECT_SOURCE_DIR@/icons/windows-icons\\installer_logo.bmp")
# tell cpack to create links to the doc files
set (CPACK_NSIS_MENU_LINKS
"@PROJECT_MANUAL@" "WSJT-X Documentation"
"@PROJECT_MANUAL_DIRECTORY_URL@@PROJECT_MANUAL@" "WSJT-X Documentation"
"@PROJECT_HOMEPAGE@" "WSJT-X Web Site"
)
# Use the icon from wsjtx for add-remove programs
set (CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\wsjtx.exe")
set (CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
set (CPACK_NSIS_HELP_LINK "@PROJECT_MANUAL@")
set (CPACK_NSIS_HELP_LINK "@PROJECT_MANUAL_DIRECTORY_URL@@PROJECT_MANUAL@")
set (CPACK_NSIS_URL_INFO_ABOUT "@PROJECT_HOMEPAGE@")
set (CPACK_NSIS_CONTACT "${CPACK_PACKAGE_CONTACT}")
set (CPACK_NSIS_MUI_FINISHPAGE_RUN "wsjtx.exe")

View File

@ -9,7 +9,8 @@ set (PROJECT_VENDOR "Joe Taylor, K1JT")
set (PROJECT_CONTACT "Joe Taylor <k1jt@arrl.net>")
set (PROJECT_COPYRIGHT "Copyright (C) 2001-2014 by Joe Taylor, K1JT")
set (PROJECT_HOMEPAGE "http://www.physics.princeton.edu/pulsar/K1JT/wsjtx.html")
set (PROJECT_MANUAL "http://www.physics.princeton.edu/pulsar/K1JT/wsjtx-doc/wsjtx-main.html")
set (PROJECT_MANUAL wsjtx-main.html)
set (PROJECT_MANUAL_DIRECTORY_URL http://www.physics.princeton.edu/pulsar/K1JT/wsjtx-doc)
set (PROJECT_SUMMARY_DESCRIPTION "WSJT-X - JT9 and JT65 Modes for LF, MF and HF Amateur Radio.")
set (PROJECT_DESCRIPTION "${PROJECT_SUMMARY_DESCRIPTION}
WSJT-X implements JT9, a new mode designed especially for the LF, MF,
@ -81,12 +82,24 @@ CMAKE_DEPENDENT_OPTION (WSJT_ENABLE_EXPERIMENTAL_FEATURES "Enable features not f
#
set (WSJT_BIN_DESTINATION bin)
set (WSJT_LIB_DESTINATION lib)
set (WSJT_SHARE_DESTINATION share/wsjtx)
set (WSJT_DOC_DESTINATION share/doc/wsjtx)
set (WSJT_MANPAGE_DESTINATION share)
set (WSJT_SHARE_DESTINATION share)
set (WSJT_DOC_DESTINATION doc/WSJT-X)
set (WSJT_PLUGIN_DESTINATION lib/plugins)
set (WSJT_QT_CONF_DESTINATION bin)
if (WIN32)
set (WSJT_SHARE_DESTINATION bin)
set (WSJT_DOC_DESTINATION doc)
set (WSJT_PLUGIN_DESTINATION plugins)
endif (WIN32)
if (APPLE)
set (WSJT_BIN_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/MacOS)
set (WSJT_SHARE_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
set (WSJT_PLUGIN_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/PlugIns)
set (WSJT_QT_CONF_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
endif (APPLE)
#
# Project sources
@ -379,15 +392,6 @@ if (APPLE)
if (NOT "${ENDCH}" STREQUAL "/")
set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
endif ()
# install inside bundle
# set (CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}wsjtx.app")
set (WSJT_PLUGIN_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/PlugIns)
set (WSJT_QT_CONF_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
set (WSJT_SHARE_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
set (WSJT_DOC_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
set (WSJT_MANPAGE_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/Resources)
set (WSJT_BIN_DESTINATION ${CMAKE_PROJECT_NAME}.app/Contents/MacOS)
endif (APPLE)
@ -468,6 +472,17 @@ FortranCInterface_HEADER (FC.h MACRO_NAMESPACE "FC_" SYMBOL_NAMESPACE "FC_"
# sort out pre-requisites
#
#
# fetch latest HTML manual
#
add_custom_command (
OUTPUT contrib/${PROJECT_MANUAL}
COMMAND ${CMAKE_COMMAND} -D URL=${PROJECT_MANUAL_DIRECTORY_URL} -D NAME=${PROJECT_MANUAL} -P ${CMAKE_SOURCE_DIR}/CMake/download_html_manual.cmake
DEPENDS CMake/download_html_manual.cmake
COMMENT "Downloading WSJT-X HTML manual"
VERBATIM
)
#
# Setup RPATH so that built executable targets will run in both the
# build tree and the install location without having to set a
@ -652,6 +667,7 @@ add_executable (wsjtx WIN32 MACOSX_BUNDLE
${WSJTX_ICON_FILE}
${wsjtx_RESOURCES_RCC}
contrib/kvasd${CMAKE_EXECUTABLE_SUFFIX}
contrib/${PROJECT_MANUAL}
)
qt5_use_modules (wsjtx Widgets OpenGL Network Multimedia)
@ -707,6 +723,12 @@ install (PROGRAMS
RENAME rigctld-wsjtx${CMAKE_EXECUTABLE_SUFFIX}
)
install (FILES
${CMAKE_BINARY_DIR}/contrib/${PROJECT_MANUAL}
DESTINATION ${WSJT_SHARE_DESTINATION}/${WSJT_DOC_DESTINATION}
#COMPONENT Runtime
)
#
# uninstall support
@ -791,6 +813,7 @@ if (NOT is_debug_build)
# if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation
set (fixup_exe "\${CMAKE_INSTALL_PREFIX}/${WSJT_BIN_DESTINATION}/${CMAKE_PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
#get_filename_component (hamlib_lib_dir ${hamlib_LIBRARIES} PATH)
if (APPLE)
@ -881,8 +904,10 @@ file (APPEND \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${WSJT_QT_CONF_DESTINATION
include (BundleUtilities)
set (BU_CHMOD_BUNDLE_ITEMS ON)
set (gp_tool ${gp_tool})
message (STATUS \"fixup_exe: ${fixup_exe}\")
fixup_bundle (\"${fixup_exe}\" \"\${QTPLUGINS}\" \"${fixup_library_dirs}\")
# canonicalize path in install context
get_filename_component (the_exe ${fixup_exe} REALPATH)
message (STATUS \"fixup_exe: \${the_exe}\")
fixup_bundle (\"\${the_exe}\" \"\${QTPLUGINS}\" \"${fixup_library_dirs}\")
"
#COMPONENT Runtime
)

View File

@ -988,9 +988,23 @@ void MainWindow::msgBox(QString t) //msgBox
msgBox0.exec();
}
void MainWindow::on_actionOnline_Users_Guide_triggered() //Display manual
void MainWindow::on_actionOnline_User_Guide_triggered() //Display manual
{
QDesktopServices::openUrl (QUrl (PROJECT_MANUAL, QUrl::TolerantMode));
QDesktopServices::openUrl (QUrl (PROJECT_MANUAL_DIRECTORY_URL PROJECT_MANUAL));
}
//Display local copy of manual
void MainWindow::on_actionLocal_User_Guide_triggered()
{
#if !defined (Q_OS_WIN) || QT_VERSION >= 0x050300
QDir path {QStandardPaths::locate (QStandardPaths::DataLocation, WSJT_DOC_DESTINATION, QStandardPaths::LocateDirectory)};
#else
QDir path {QCoreApplication::applicationDirPath ()};
path.cd (WSJT_DOC_DESTINATION);
#endif
auto file = path.absoluteFilePath (PROJECT_MANUAL);
QDesktopServices::openUrl (QUrl {"file:///" + file});
}
void MainWindow::on_actionWide_Waterfall_triggered() //Display Waterfalls

View File

@ -96,7 +96,8 @@ private slots:
void on_autoButton_clicked (bool);
void on_stopTxButton_clicked();
void on_stopButton_clicked();
void on_actionOnline_Users_Guide_triggered();
void on_actionOnline_User_Guide_triggered();
void on_actionLocal_User_Guide_triggered();
void on_actionWide_Waterfall_triggered();
void on_actionOpen_triggered();
void on_actionOpen_next_in_directory_triggered();

View File

@ -2330,11 +2330,14 @@ list. The list can be maintained in Settings (F2).</string>
<property name="title">
<string>Help</string>
</property>
<addaction name="actionOnline_Users_Guide"/>
<addaction name="actionOnline_User_Guide"/>
<addaction name="actionLocal_User_Guide"/>
<addaction name="separator"/>
<addaction name="actionKeyboard_shortcuts"/>
<addaction name="actionSpecial_mouse_commands"/>
<addaction name="actionAbout"/>
<addaction name="actionShort_list_of_add_on_prefixes_and_suffixes"/>
<addaction name="separator"/>
<addaction name="actionAbout"/>
</widget>
<widget class="QMenu" name="menuMode">
<property name="title">
@ -2444,9 +2447,9 @@ list. The list can be maintained in Settings (F2).</string>
<string>Save all</string>
</property>
</action>
<action name="actionOnline_Users_Guide">
<action name="actionOnline_User_Guide">
<property name="text">
<string>Online User's Guide</string>
<string>Online User Guide</string>
</property>
<property name="shortcut">
<string>F1</string>
@ -2687,6 +2690,11 @@ list. The list can be maintained in Settings (F2).</string>
<string>F2</string>
</property>
</action>
<action name="actionLocal_User_Guide">
<property name="text">
<string>Local User Guide</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

View File

@ -13,9 +13,9 @@
#cmakedefine WSJT_BIN_DESTINATION "@WSJT_BIN_DESTINATION@"
#cmakedefine WSJT_LIB_DESTINATION "@WSJT_LIB_DESTINATION@"
#cmakedefine WSJT_SHARE_DESTINATION "@WSJT_SHARE_DESTINATION@"
#cmakedefine WSJT_DOC_DESTINATION "@WSJT_DOC_DESTINATION@"
#cmakedefine PROJECT_MANUAL "@PROJECT_MANUAL@"
#cmakedefine PROJECT_MANUAL_DIRECTORY_URL "@PROJECT_MANUAL_DIRECTORY_URL@"
#cmakedefine01 WSJT_SHARED_RUNTIME
#cmakedefine01 WSJT_QDEBUG_TO_FILE