Skip to content
Permalink
Browse files

Made Qt5WebEngine optional. If not installed, desktop web browser is …

…launched for showing user's guide.

Updated Readme.txt for compiling Canorus on Windows.
  • Loading branch information...
matevz committed Jun 9, 2018
1 parent ac614c9 commit 13c991bec15cbde58a652bf19fa2cfc58d9f8619
Showing with 45 additions and 15 deletions.
  1. +1 −1 CMakeLists.txt
  2. +13 −7 src/CMakeLists.txt
  3. +10 −0 src/control/helpctl.cpp
  4. +1 −2 src/control/helpctl.h
  5. +8 −0 src/ui/mainwin.cpp
  6. +8 −1 src/ui/mainwin.h
  7. +4 −4 windows/Readme.txt
@@ -99,7 +99,7 @@ FIND_PACKAGE(Qt5LinguistTools REQUIRED)
FIND_PACKAGE(Qt5Xml REQUIRED)
FIND_PACKAGE(Qt5Help REQUIRED)
FIND_PACKAGE(Qt5PrintSupport REQUIRED)
FIND_PACKAGE(Qt5WebEngineWidgets REQUIRED)
FIND_PACKAGE(Qt5WebEngineWidgets)

# in the following lines all the requires include directories are added
INCLUDE_DIRECTORIES(src)
@@ -165,7 +165,6 @@ SET(Canorus_Gui_MOCs # List of classes which Qt needs to produce MOCs for them (
widgets/pyconsole.h
widgets/midirecorderview.h
widgets/resourceview.h
widgets/helpbrowser.h
widgets/actionseditor.h
widgets/progressstatusbar.h
widgets/tabwidget.h
@@ -194,8 +193,13 @@ SET(Canorus_Core_MOCs # MOCs compiled into scripting library as well
interface/pluginaction.h
)

IF(Qt5WebEngineWidgets_LIBRARIES)
SET(Canorus_Gui_MOCs ${Canorus_Gui_MOCs} widgets/helpbrowser.h)
SET(Canorus_Widget_Srcs ${Canorus_Widget_Srcs} widgets/helpbrowser.cpp)
ENDIF(Qt5WebEngineWidgets_LIBRARIES)

################
# Qt4 settings #
# Qt5 settings #
################
# Enable needed Qt modules for Canorus
SET(QT_USE_QTXML True) # Save/Load
@@ -314,7 +318,6 @@ SET(Canorus_Widget_Srcs # Sources for all custom widgets present in Canorus
widgets/pyconsole.cpp
widgets/midirecorderview.cpp
widgets/resourceview.cpp
widgets/helpbrowser.cpp
widgets/actionseditor.cpp
widgets/progressstatusbar.cpp
widgets/tabwidget.cpp
@@ -335,8 +338,8 @@ SET(Canorus_Ui_Srcs # Implementations of widgets that have their own .ui qt-des
SET(Canorus_Gui_Ctl_Srcs # Control instances for user interface or views
control/previewctl.cpp
control/printctl.cpp
control/helpctl.cpp
control/mainwinprogressctl.cpp
control/helpctl.cpp

scorectl/keysignaturectl.cpp
)
@@ -667,7 +670,10 @@ ENDIF(USE_PYTHON)
# command. Never remove that line :-)
# Add ${QT_QTTEST_LIBRARY} below to add the Qt Test library as well
# Add ${POPPLERQT4_LIBRARY} ${POPPLER_LIBRARY} to reactivate poppler libraries
TARGET_LINK_LIBRARIES(canorus Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Svg Qt5::Xml Qt5::PrintSupport Qt5::WebEngineWidgets ${RUBY_LIBRARY} ${PYTHON_LIBRARY} z pthread )
TARGET_LINK_LIBRARIES(canorus Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Svg Qt5::Xml Qt5::PrintSupport ${RUBY_LIBRARY} ${PYTHON_LIBRARY} z pthread )
IF(Qt5WebEngineWidgets_LIBRARIES)
TARGET_LINK_LIBRARIES(canorus Qt5::WebEngineWidgets)
ENDIF(Qt5WebEngineWidgets_LIBRARIES)
# Duma leads to a crash on libfontconfig with Ubuntu (10.04/12.04)
# duma )

@@ -734,7 +740,7 @@ IF(${CANORUS_DEV_INSTALL} MATCHES True)
ADD_CUSTOM_COMMAND(
TARGET canorus
POST_BUILD
COMMAND make install
COMMAND ${CMAKE_MAKE_PROGRAM} install
)
ENDIF(${CANORUS_DEV_INSTALL} MATCHES True)

@@ -776,7 +782,7 @@ INSTALL( DIRECTORY ${Canorus_Examples} DESTINATION "${CMAKE_INSTALL_PREFIX}/${CA

IF(MINGW)
# Install Qt libs
INSTALL( FILES ${QT_BIN_DIR}/Qt5Core.dll ${QT_BIN_DIR}/Qt5Gui.dll ${QT_BIN_DIR}/Qt5Widgets.dll ${QT_BIN_DIR}/Qt5Svg.dll ${QT_BIN_DIR}/Qt5Xml.dll ${QT_BIN_DIR}/Qt5Sql.dll ${QT_BIN_DIR}/Qt5Network.dll ${QT_BIN_DIR}/Qt5CLucene.dll ${QT_BIN_DIR}/Qt5PrintSupport.dll DESTINATION ${CMAKE_INSTALL_PREFIX}/${CANORUS_INSTALL_BIN_DIR} )
INSTALL( FILES ${QT_BIN_DIR}/Qt5Core.dll ${QT_BIN_DIR}/Qt5Gui.dll ${QT_BIN_DIR}/Qt5Widgets.dll ${QT_BIN_DIR}/Qt5Svg.dll ${QT_BIN_DIR}/Qt5Xml.dll ${QT_BIN_DIR}/Qt5Sql.dll ${QT_BIN_DIR}/Qt5Network.dll ${QT_BIN_DIR}/Qt5PrintSupport.dll DESTINATION ${CMAKE_INSTALL_PREFIX}/${CANORUS_INSTALL_BIN_DIR} )

# Install qsvg plugin for rendering SVG icons
get_target_property(QSvgIcon_loc Qt5::QSvgIconPlugin LOCATION)
@@ -7,11 +7,15 @@

#include <QStringList>
#include <QDockWidget>
#include <QDesktopServices>

#include "canorus.h"
#include "control/helpctl.h"
#include "ui/mainwin.h"

#ifdef QT_WEBENGINEWIDGETS_LIB
#include "widgets/helpbrowser.h"
#endif

/*!
\class CAHelpCtl
@@ -77,7 +81,11 @@ bool CAHelpCtl::showUsersGuide( QString chapter, QWidget *helpWidget ) {
}

if (!url.path().isEmpty()) {
#ifdef QT_WEBENGINEWIDGETS_LIB
displayHelp( url, helpWidget );
#else
QDesktopServices::openUrl( url );
#endif
return true;
}

@@ -88,6 +96,7 @@ bool CAHelpCtl::showUsersGuide( QString chapter, QWidget *helpWidget ) {
Activates the user's guide help at the given url.
*/
void CAHelpCtl::displayHelp( QUrl url, QWidget *helpWidget ) {
#ifdef QT_WEBENGINEWIDGETS_LIB
CAHelpBrowser *browser=0;
if ( !helpWidget ) {
browser = new CAHelpBrowser;
@@ -101,4 +110,5 @@ void CAHelpCtl::displayHelp( QUrl url, QWidget *helpWidget ) {
if (browser) {
browser->setUrl( url );
}
#endif
}
@@ -11,15 +11,14 @@
#include <QString>
#include <QUrl>

class QHelpEngine;
class QWidget;

class CAHelpCtl {
public:
CAHelpCtl();
virtual ~CAHelpCtl();

bool showUsersGuide( QString chapter="", QWidget *helpWidget=0 );
bool showUsersGuide( QString chapter="", QWidget *helpWidget=nullptr );

private:
QUrl _homeUrl;
@@ -54,7 +54,9 @@
#include "widgets/undotoolbutton.h"
#include "widgets/lcdnumber.h"
#include "widgets/midirecorderview.h"
#ifdef QT_WEBENGINEWIDGETS_LIB
#include "widgets/helpbrowser.h"
#endif

#include "widgets/view.h"
#include "widgets/viewcontainer.h"
@@ -586,8 +588,10 @@ void CAMainWin::createCustomActions() {
uiHelpDock = new QDockWidget(tr("Help"), this);
uiHelpDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
uiHelpDock->setMaximumWidth(400);
#ifdef QT_WEBENGINEWIDGETS_LIB
uiHelpWidget = new CAHelpBrowser( uiHelpDock );
uiHelpDock->setWidget( uiHelpWidget );
#endif

#ifdef USE_PYTHON
uiPyConsoleDock = new QDockWidget(tr("Canorus console"), this);
@@ -4231,7 +4235,11 @@ void CAMainWin::sourceViewCommit(QString inputString) {
}

void CAMainWin::on_uiUsersGuide_triggered() {
#ifdef QT_WEBENGINEWIDGETS_LIB
CACanorus::help()->showUsersGuide( "playback", this );
#else
CACanorus::help()->showUsersGuide( "playback" );
#endif
}

void CAMainWin::on_uiAboutQt_triggered() {
@@ -45,7 +45,11 @@ class QAction;
class CAKeySignatureUI;

class CAMainWinProgressCtl;

#ifdef QT_WEBENGINEWIDGETS_LIB
class CAHelpBrowser;
#endif

class CAMenuToolButton;
class CAUndoToolButton;
class CALCDNumber;
@@ -148,8 +152,9 @@ class CAMainWin : public QMainWindow, private Ui::uiMainWindow
CAPyConsoleInterface* pyConsoleIface;

QDockWidget *helpDock() { return uiHelpDock; }
#ifdef QT_WEBENGINEWIDGETS_LIB
CAHelpBrowser *helpWidget() { return uiHelpWidget; }

#endif
private slots:
///////////////////////////
// ToolBar/Menus actions //
@@ -541,6 +546,8 @@ private slots:

// Help widget
QDockWidget *uiHelpDock;
#ifdef QT_WEBENGINEWIDGETS_LIB
CAHelpBrowser *uiHelpWidget;
#endif
};
#endif /* MAINWIN_H_ */
@@ -7,7 +7,7 @@ Installing prerequisites:
1) Install Qt 5.x open source SDK for Windows including the mingw compiler.
Note: If the installation under Wine produces some warnings, click on Ignore
button.
2) Go to C:\Qt\Qt5.5.0\Tools\mingw492_32\bin and rename mingw32-make.exe to
2) Go to C:\Qt\Tools\mingw530_32\bin and rename mingw32-make.exe to
make.exe:
copy mingw32-make.exe make.exe
3) Install cmake 3.x from the official site and add cmake to path.
@@ -18,12 +18,12 @@ Installing prerequisites:
Canorus Windows builds:
=======================
1) Add gcc, g++ and make, and qmake to PATH:
set PATH=%PATH%;C:\Qt\Qt5.5.0\Tools\mingw492_32\bin;C:\Qt\Qt5.5.0\5.5\mingw492_32\bin
set PATH=%PATH%;C:\Qt\Tools\mingw530_32\bin;C:\Qt\5.9.5\mingw53_32\bin

2) Configure Canorus with cmake and set CMAKE_INSTALL_PREFIX to windows/canorus
directory:
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -D QT_QMAKE_EXECUTABLE=C:\Qt\Qt5.5.0\5.5\mingw492_32\bin\qmake.exe -D CMAKE_INSTALL_PREFIX=windows\canorus .

c:\cmake-3.11.3-win64-x64\bin\cmake.exe -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe -DCMAKE_BUILD_TYPE=Release -D QT_QMAKE_EXECUTABLE=C:\Qt\5.9.5\mingw53_32\bin\qmake.exe -D CMAKE_INSTALL_PREFIX=windows\canorus .
3) If you want to enable scripting support, you should append the following to the cmake command:
-D SWIG_DIR=C:\swigwin-3.0.7 -D SWIG_EXECUTABLE=C:\swigwin-3.0.7\swig.exe -D PYTHON_LIBRARIES=C:\python25\libs -D PYTHON_LIBRARY=C:\python25\python25.dll -D PYTHON_INCLUDE_PATH=C:\python25\include

0 comments on commit 13c991b

Please sign in to comment.
You can’t perform that action at this time.