Skip to content

Commit

Permalink
Issue robert7#171: make QtWebEngine usage for OAuth optional and not …
Browse files Browse the repository at this point in the history
…enabled by default, hide it behind qmake config option
  • Loading branch information
d1vanov committed Mar 30, 2023
1 parent 083ed30 commit 1c2a55d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ qrc_*.*
# Vim backup files
*~

# Vim temporary files
.*.swp

# Nixnote database backup files
*.nnex

Expand Down Expand Up @@ -72,4 +75,5 @@ testsrc/qmake-build-*

/_build_dir_.txt


# Autogenerated VersionInfo.h header in build dir
VersionInfo.h
21 changes: 18 additions & 3 deletions development/build-with-qmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -xe
BUILD_TYPE=${1}
CLEAN=${2}
TIDY_LIB_DIR=${3}
WITH_QT_WEB_ENGINE=${4}
CDIR=`pwd`

function error_exit {
Expand Down Expand Up @@ -44,6 +45,15 @@ if [ ! -d "${TIDY_LIB_DIR}" ]; then
fi
echo "$0: libtidy is expected in: ${TIDY_LIB_DIR}"

if [ -z "${WITH_QT_WEB_ENGINE}" ]; then
# by default will use QtWebEngine for OAuth because with default shipped QtWebKit it no longer works properly
WITH_QT_WEB_ENGINE=1
elif [ "${WITH_QT_WEB_ENGINE}" == "webengine" ]; then
WITH_QT_WEB_ENGINE=1
else
WITH_QT_WEB_ENGINE=0
fi

if [ ! -d "${BUILD_DIR}" ]; then
mkdir ${BUILD_DIR}
fi
Expand Down Expand Up @@ -71,10 +81,15 @@ elif [ -d ${TIDY_LIB_DIR}/pkgconfig ] ; then
export PKG_CONFIG_PATH=${TIDY_LIB_DIR}/pkgconfig
fi

if [ "$WITH_QT_WEB_ENGINE" == "1" ]; then
echo ${QMAKE_BINARY} CONFIG+=${BUILD_TYPE} CONFIG+=oauth_webengine PREFIX=appdir/usr QMAKE_RPATHDIR+=${TIDY_LIB_DIR} QMAKE_CXX="ccache g++" || error_exit "$0: qmake"
${QMAKE_BINARY} CONFIG+=${BUILD_TYPE} CONFIG+=oauth_webengine PREFIX=appdir/usr QMAKE_RPATHDIR+=${TIDY_LIB_DIR} QMAKE_CXX="ccache g++" || error_exit "$0: qmake"
else
echo ${QMAKE_BINARY} CONFIG+=${BUILD_TYPE} PREFIX=appdir/usr QMAKE_RPATHDIR+=${TIDY_LIB_DIR} QMAKE_CXX="ccache g++" || error_exit "$0: qmake"
${QMAKE_BINARY} CONFIG+=${BUILD_TYPE} PREFIX=appdir/usr QMAKE_RPATHDIR+=${TIDY_LIB_DIR} QMAKE_CXX="ccache g++" || error_exit "$0: qmake"
fi

echo ${QMAKE_BINARY} CONFIG+=${BUILD_TYPE} PREFIX=appdir/usr QMAKE_RPATHDIR+=${TIDY_LIB_DIR} || error_exit "$0: qmake"
${QMAKE_BINARY} CONFIG+=${BUILD_TYPE} PREFIX=appdir/usr QMAKE_RPATHDIR+=${TIDY_LIB_DIR} || error_exit "$0: qmake"

make clean
make -j$(nproc) || error_exit "$0: make"
make -j$(nproc) install || error_exit "$0: make install"

Expand Down
27 changes: 25 additions & 2 deletions nixnote2.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
QT += core gui widgets printsupport webkit webkitwidgets webengine webenginewidgets sql network xml dbus qml
QT += core gui widgets printsupport webkit webkitwidgets sql network xml dbus qml

DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
DEFINES += QEVERCLOUD_USE_QT_WEB_ENGINE=1
unix {
CONFIG += link_pkgconfig
PKGCONFIG += poppler-qt5 libcurl tidy hunspell
Expand All @@ -17,6 +17,7 @@ win32:LIBS += -L"$$PWD/winlib" -lhunspell-$$[HUNSPELL_VERSION]
win32:RC_ICONS += "$$PWD/resources/images/windowIcon.ico"

INCLUDEPATH += "$$PWD/src/qevercloud/QEverCloud/headers"
INCLUDEPATH += "$$OUT_PWD"

mac {
TARGET = NixNote2
Expand All @@ -41,6 +42,28 @@ CONFIG(debug, debug|release) {
OBJECTS_DIR = $${DESTDIR}
MOC_DIR = $${DESTDIR}

oauth_webengine {
win32-g++ {
error("Cannot use QtWebEngine with MinGW build")
} else {
message("Using QtWebEngine for OAuth")
QT += webengine webenginewidgets
QEVERCLOUD_USE_QT_WEB_ENGINE = 1
DEFINES += QEVERCLOUD_USE_QT_WEB_ENGINE=1
}
} else {
message("Using QtWebKit for OAuth")
!win32-g++ {
warning("Consider adding CONFIG+=oauth_webengine to qmake invocation to use QtWebEngine for OAuth; QtWebKit has known problems with it, OAuth may not work!")
}
QEVERCLOUD_USE_QT_WEB_ENGINE = 0
DEFINES += QEVERCLOUD_USE_QT_WEB_ENGINE=0
}

qevercloud_version_info.input = src/qevercloud/QEverCloud/headers/VersionInfo.h.in
qevercloud_version_info.output = $$OUT_PWD/VersionInfo.h
QMAKE_SUBSTITUTES += qevercloud_version_info

SOURCES += \
src/application.cpp \
src/global.cpp \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef QEVERCLOUD_VERSION_INFO_H
#define QEVERCLOUD_VERSION_INFO_H

#include "Export.h"
#include \"Export.h\"

#include <QString>

Expand All @@ -26,7 +26,7 @@
* This macro tells whether QEverCloud library uses QtWebEngine backend for
* OAuth support (if it was built with OAuth support)
*/
#define QEVERCLOUD_USE_QT_WEB_ENGINE 1
#define QEVERCLOUD_USE_QT_WEB_ENGINE $$QEVERCLOUD_USE_QT_WEB_ENGINE

/**
* This macro tells whether QEverCloud library was built with use of Q_NAMESPACE
Expand All @@ -38,7 +38,7 @@
* This macro is set to a string holding the information about
* the current QEverCloud build
*/
#define QEVERCLOUD_BUILD_INFO "nixnote2 integrated"
#define QEVERCLOUD_BUILD_INFO \"nixnote2 integrated\"

/**
* This macro is set to the major version number of QEverCloud
Expand Down

0 comments on commit 1c2a55d

Please sign in to comment.