mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 04:08:13 +02:00
commit
54af969bbf
40 changed files with 125 additions and 435 deletions
12
BUILD.md
12
BUILD.md
|
@ -1,7 +1,7 @@
|
||||||
###Dependencies
|
###Dependencies
|
||||||
|
|
||||||
* [cmake](http://www.cmake.org/cmake/resources/software.html) ~> 3.3.2
|
* [cmake](http://www.cmake.org/cmake/resources/software.html) ~> 3.3.2
|
||||||
* [Qt](http://www.qt.io/download-open-source) ~> 5.5.1
|
* [Qt](http://www.qt.io/download-open-source) ~> 5.6.1
|
||||||
* [OpenSSL](https://www.openssl.org/community/binaries.html) ~> 1.0.1m
|
* [OpenSSL](https://www.openssl.org/community/binaries.html) ~> 1.0.1m
|
||||||
* IMPORTANT: Using the recommended version of OpenSSL is critical to avoid security vulnerabilities.
|
* IMPORTANT: Using the recommended version of OpenSSL is critical to avoid security vulnerabilities.
|
||||||
* [VHACD](https://github.com/virneo/v-hacd)(clone this repository)(Optional)
|
* [VHACD](https://github.com/virneo/v-hacd)(clone this repository)(Optional)
|
||||||
|
@ -41,14 +41,14 @@ If you would like to use a specific install of a dependency instead of the versi
|
||||||
Hifi uses CMake to generate build files and project files for your platform.
|
Hifi uses CMake to generate build files and project files for your platform.
|
||||||
|
|
||||||
####Qt
|
####Qt
|
||||||
In order for CMake to find the Qt5 find modules, you will need to set an ENV variable pointing to your Qt installation.
|
In order for CMake to find the Qt5 find modules, you will need to set a QT_CMAKE_PREFIX_PATH environment variable pointing to your Qt installation.
|
||||||
|
|
||||||
For example, a Qt5 5.5.1 installation to /usr/local/qt5 would require that QT_CMAKE_PREFIX_PATH be set with the following command. This can either be entered directly into your shell session before you build or in your shell profile (e.g.: ~/.bash_profile, ~/.bashrc, ~/.zshrc - this depends on your shell and environment).
|
This can either be entered directly into your shell session before you build or in your shell profile (e.g.: ~/.bash_profile, ~/.bashrc, ~/.zshrc - this depends on your shell and environment).
|
||||||
|
|
||||||
The path it needs to be set to will depend on where and how Qt5 was installed. e.g.
|
The path it needs to be set to will depend on where and how Qt5 was installed. e.g.
|
||||||
|
|
||||||
export QT_CMAKE_PREFIX_PATH=/usr/local/qt/5.5.1/clang_64/lib/cmake/
|
export QT_CMAKE_PREFIX_PATH=/usr/local/qt/5.6.1/clang_64/lib/cmake/
|
||||||
export QT_CMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.5.1/lib/cmake
|
export QT_CMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.6.1-1/lib/cmake
|
||||||
export QT_CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake
|
export QT_CMAKE_PREFIX_PATH=/usr/local/opt/qt5/lib/cmake
|
||||||
|
|
||||||
####Generating build files
|
####Generating build files
|
||||||
|
@ -65,7 +65,7 @@ Any variables that need to be set for CMake to find dependencies can be set as E
|
||||||
|
|
||||||
For example, to pass the QT_CMAKE_PREFIX_PATH variable during build file generation:
|
For example, to pass the QT_CMAKE_PREFIX_PATH variable during build file generation:
|
||||||
|
|
||||||
cmake .. -DQT_CMAKE_PREFIX_PATH=/usr/local/qt/5.5.1/lib/cmake
|
cmake .. -DQT_CMAKE_PREFIX_PATH=/usr/local/qt/5.6.1/lib/cmake
|
||||||
|
|
||||||
####Finding Dependencies
|
####Finding Dependencies
|
||||||
|
|
||||||
|
|
26
BUILD_OSX.md
26
BUILD_OSX.md
|
@ -1,25 +1,31 @@
|
||||||
Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. Only OS X specific instructions are found in this file.
|
Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. Only OS X specific instructions are found in this file.
|
||||||
|
|
||||||
###Homebrew
|
###Homebrew
|
||||||
[Homebrew](http://brew.sh/) is an excellent package manager for OS X. It makes install of all High Fidelity dependencies very simple.
|
[Homebrew](http://brew.sh/) is an excellent package manager for OS X. It makes install of some High Fidelity dependencies very simple.
|
||||||
|
|
||||||
brew tap homebrew/versions
|
brew tap homebrew/versions
|
||||||
brew install cmake openssl qt55
|
brew install cmake openssl
|
||||||
|
|
||||||
We no longer require install of qt5 via our [homebrew formulas repository](https://github.com/highfidelity/homebrew-formulas). Versions of Qt that are 5.5.x provide a mechanism to disable the wireless scanning we previously had a custom patch for.
|
###OpenSSL
|
||||||
|
|
||||||
###OpenSSL and Qt
|
Assuming you've installed OpenSSL using the homebrew instructions above, you'll need to set OPENSSL_ROOT_DIR so CMake can find your installations.
|
||||||
|
|
||||||
Assuming you've installed OpenSSL or Qt 5 using the homebrew instructions above, you'll need to set OPENSSL_ROOT_DIR and QT_CMAKE_PREFIX_PATH so CMake can find your installations.
|
|
||||||
For OpenSSL installed via homebrew, set OPENSSL_ROOT_DIR:
|
For OpenSSL installed via homebrew, set OPENSSL_ROOT_DIR:
|
||||||
|
|
||||||
export OPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2h_1/
|
export OPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2h_1/
|
||||||
|
|
||||||
For Qt 5.5.1 installed via homebrew, set QT_CMAKE_PREFIX_PATH as follows.
|
|
||||||
|
|
||||||
export QT_CMAKE_PREFIX_PATH=/usr/local/Cellar/qt55/5.5.1/lib/cmake
|
Note that this uses the version from the homebrew formula at the time of this writing, and the version in the path will likely change.
|
||||||
|
|
||||||
Note that these use the versions from homebrew formulae at the time of this writing, and the version in the path will likely change.
|
###Qt
|
||||||
|
You can use the online installer or the offline installer.
|
||||||
|
|
||||||
|
* [Download the online installer](http://www.qt.io/download-open-source/#section-2)
|
||||||
|
* When it asks you to select components, select the following:
|
||||||
|
* Qt > Qt 5.6
|
||||||
|
|
||||||
|
* [Download the offline installer](http://download.qt.io/official_releases/qt/5.6/5.6.1-1/qt-opensource-mac-x64-clang-5.6.1-1.dmg)
|
||||||
|
|
||||||
|
Once Qt is installed, you need to manually configure the following:
|
||||||
|
* Set the QT_CMAKE_PREFIX_PATH environment variable to your `Qt5.6.1/5.6/clang_64/lib/cmake/` directory.
|
||||||
|
|
||||||
###Xcode
|
###Xcode
|
||||||
If Xcode is your editor of choice, you can ask CMake to generate Xcode project files instead of Unix Makefiles.
|
If Xcode is your editor of choice, you can ask CMake to generate Xcode project files instead of Unix Makefiles.
|
||||||
|
|
12
BUILD_WIN.md
12
BUILD_WIN.md
|
@ -27,17 +27,17 @@ We expect nmake.exe to be located at the following path.
|
||||||
###Qt
|
###Qt
|
||||||
You can use the online installer or the offline installer. If you use the offline installer, be sure to select the "OpenGL" version.
|
You can use the online installer or the offline installer. If you use the offline installer, be sure to select the "OpenGL" version.
|
||||||
|
|
||||||
* [Download the online installer](http://qt-project.org/downloads)
|
* [Download the online installer](http://www.qt.io/download-open-source/#section-2)
|
||||||
* When it asks you to select components, ONLY select one of the following, 32- or 64-bit to match your build preference:
|
* When it asks you to select components, ONLY select one of the following, 32- or 64-bit to match your build preference:
|
||||||
* Qt > Qt 5.5.1 > **msvc2013 32-bit**
|
* Qt > Qt 5.6.1 > **msvc2013 32-bit**
|
||||||
* Qt > Qt 5.5.1 > **msvc2013 64-bit**
|
* Qt > Qt 5.6.1 > **msvc2013 64-bit**
|
||||||
|
|
||||||
* Download the offline installer, 32- or 64-bit to match your build preference:
|
* Download the offline installer, 32- or 64-bit to match your build preference:
|
||||||
* [32-bit](http://download.qt.io/official_releases/qt/5.5/5.5.1/qt-opensource-windows-x86-msvc2013-5.5.1.exe)
|
* [32-bit](http://download.qt.io/official_releases/qt/5.6/5.6.1-1/qt-opensource-windows-x86-msvc2013-5.6.1-1.exe)
|
||||||
* [64-bit](http://download.qt.io/official_releases/qt/5.5/5.5.1/qt-opensource-windows-x86-msvc2013_64-5.5.1.exe)
|
* [64-bit](http://download.qt.io/official_releases/qt/5.6/5.6.1-1/qt-opensource-windows-x86-msvc2013_64-5.6.1-1.exe)
|
||||||
|
|
||||||
Once Qt is installed, you need to manually configure the following:
|
Once Qt is installed, you need to manually configure the following:
|
||||||
* Set the QT_CMAKE_PREFIX_PATH environment variable to your `Qt\5.5.1\msvc2013\lib\cmake` or `Qt\5.5.1\msvc2013_64\lib\cmake` directory.
|
* Set the QT_CMAKE_PREFIX_PATH environment variable to your `Qt\5.6.1\msvc2013\lib\cmake` or `Qt\5.6.1\msvc2013_64\lib\cmake` directory.
|
||||||
* You can set an environment variable from Control Panel > System > Advanced System Settings > Environment Variables > New
|
* You can set an environment variable from Control Panel > System > Advanced System Settings > Environment Variables > New
|
||||||
|
|
||||||
###External Libraries
|
###External Libraries
|
||||||
|
|
|
@ -2,6 +2,11 @@ set(TARGET_NAME assignment-client)
|
||||||
|
|
||||||
setup_hifi_project(Core Gui Network Script Quick Widgets WebSockets)
|
setup_hifi_project(Core Gui Network Script Quick Widgets WebSockets)
|
||||||
|
|
||||||
|
# Fix up the rpath so macdeployqt works
|
||||||
|
if (APPLE)
|
||||||
|
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@executable_path/../Frameworks")
|
||||||
|
endif ()
|
||||||
|
|
||||||
# link in the shared libraries
|
# link in the shared libraries
|
||||||
link_hifi_libraries(
|
link_hifi_libraries(
|
||||||
audio avatars octree gpu model fbx entities
|
audio avatars octree gpu model fbx entities
|
||||||
|
|
|
@ -16,26 +16,6 @@ macro(fixup_interface)
|
||||||
string(REPLACE " " "\\ " ESCAPED_INSTALL_PATH ${INTERFACE_INSTALL_DIR})
|
string(REPLACE " " "\\ " ESCAPED_INSTALL_PATH ${INTERFACE_INSTALL_DIR})
|
||||||
set(_INTERFACE_INSTALL_PATH "${ESCAPED_INSTALL_PATH}/${ESCAPED_BUNDLE_NAME}.app")
|
set(_INTERFACE_INSTALL_PATH "${ESCAPED_INSTALL_PATH}/${ESCAPED_BUNDLE_NAME}.app")
|
||||||
|
|
||||||
# install QtWebProcess from Qt to the application bundle
|
|
||||||
# since it is missed by macdeployqt
|
|
||||||
# https://bugreports.qt.io/browse/QTBUG-35211
|
|
||||||
set(LIBEXEC_PATH "${_INTERFACE_INSTALL_PATH}/Contents/libexec")
|
|
||||||
install(
|
|
||||||
PROGRAMS "${QT_DIR}/libexec/QtWebProcess"
|
|
||||||
DESTINATION ${LIBEXEC_PATH}
|
|
||||||
COMPONENT ${CLIENT_COMPONENT}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(QTWEBPROCESS_PATH "\${CMAKE_INSTALL_PREFIX}/${LIBEXEC_PATH}")
|
|
||||||
|
|
||||||
# we also need a qt.conf in the directory of QtWebProcess
|
|
||||||
install(CODE "
|
|
||||||
file(WRITE ${QTWEBPROCESS_PATH}/qt.conf
|
|
||||||
\"[Paths]\nPlugins = ../PlugIns\nImports = ../Resources/qml\nQml2Imports = ../Resources/qml\"
|
|
||||||
)"
|
|
||||||
COMPONENT ${CLIENT_COMPONENT}
|
|
||||||
)
|
|
||||||
|
|
||||||
find_program(MACDEPLOYQT_COMMAND macdeployqt PATHS "${QT_DIR}/bin" NO_DEFAULT_PATH)
|
find_program(MACDEPLOYQT_COMMAND macdeployqt PATHS "${QT_DIR}/bin" NO_DEFAULT_PATH)
|
||||||
|
|
||||||
if (NOT MACDEPLOYQT_COMMAND AND (PRODUCTION_BUILD OR PR_BUILD))
|
if (NOT MACDEPLOYQT_COMMAND AND (PRODUCTION_BUILD OR PR_BUILD))
|
||||||
|
@ -49,7 +29,6 @@ macro(fixup_interface)
|
||||||
execute_process(COMMAND ${MACDEPLOYQT_COMMAND}\
|
execute_process(COMMAND ${MACDEPLOYQT_COMMAND}\
|
||||||
\${CMAKE_INSTALL_PREFIX}/${_INTERFACE_INSTALL_PATH}/\
|
\${CMAKE_INSTALL_PREFIX}/${_INTERFACE_INSTALL_PATH}/\
|
||||||
-verbose=2 -qmldir=${CMAKE_SOURCE_DIR}/interface/resources/qml/\
|
-verbose=2 -qmldir=${CMAKE_SOURCE_DIR}/interface/resources/qml/\
|
||||||
-executable=\${CMAKE_INSTALL_PREFIX}/${_INTERFACE_INSTALL_PATH}/Contents/libexec/QtWebProcess\
|
|
||||||
)"
|
)"
|
||||||
COMPONENT ${CLIENT_COMPONENT}
|
COMPONENT ${CLIENT_COMPONENT}
|
||||||
)
|
)
|
||||||
|
|
|
@ -59,7 +59,12 @@ macro(install_beside_console)
|
||||||
set(EXECUTABLE_NEEDING_FIXUP "\${CMAKE_INSTALL_PREFIX}/${COMPONENT_INSTALL_DIR}/${TARGET_NAME}")
|
set(EXECUTABLE_NEEDING_FIXUP "\${CMAKE_INSTALL_PREFIX}/${COMPONENT_INSTALL_DIR}/${TARGET_NAME}")
|
||||||
string(REPLACE " " "\\ " ESCAPED_EXECUTABLE_NAME ${EXECUTABLE_NEEDING_FIXUP})
|
string(REPLACE " " "\\ " ESCAPED_EXECUTABLE_NAME ${EXECUTABLE_NEEDING_FIXUP})
|
||||||
|
|
||||||
|
# configure Info.plist for COMPONENT_APP
|
||||||
install(CODE "
|
install(CODE "
|
||||||
|
set(MACOSX_BUNDLE_EXECUTABLE_NAME domain-server)
|
||||||
|
set(MACOSX_BUNDLE_GUI_IDENTIFIER com.highfidelity.server-components)
|
||||||
|
set(MACOSX_BUNDLE_BUNDLE_NAME Sandbox\\ Components)
|
||||||
|
configure_file(${HF_CMAKE_DIR}/templates/MacOSXBundleSandboxComponentsInfo.plist.in ${ESCAPED_BUNDLE_NAME}/Contents/Info.plist)
|
||||||
execute_process(COMMAND ${MACDEPLOYQT_COMMAND} ${ESCAPED_BUNDLE_NAME} -verbose=2 -executable=${ESCAPED_EXECUTABLE_NAME})"
|
execute_process(COMMAND ${MACDEPLOYQT_COMMAND} ${ESCAPED_BUNDLE_NAME} -verbose=2 -executable=${ESCAPED_EXECUTABLE_NAME})"
|
||||||
COMPONENT ${SERVER_COMPONENT}
|
COMPONENT ${SERVER_COMPONENT}
|
||||||
)
|
)
|
||||||
|
|
36
cmake/templates/MacOSXBundleSandboxComponentsInfo.plist.in
Normal file
36
cmake/templates/MacOSXBundleSandboxComponentsInfo.plist.in
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleLongVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>LSRequiresCarbon</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -9,6 +9,11 @@ endif ()
|
||||||
# setup the project and link required Qt modules
|
# setup the project and link required Qt modules
|
||||||
setup_hifi_project(Network)
|
setup_hifi_project(Network)
|
||||||
|
|
||||||
|
# Fix up the rpath so macdeployqt works
|
||||||
|
if (APPLE)
|
||||||
|
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@executable_path/../Frameworks")
|
||||||
|
endif ()
|
||||||
|
|
||||||
# TODO: find a solution that will handle web file changes in resources on windows without a re-build.
|
# TODO: find a solution that will handle web file changes in resources on windows without a re-build.
|
||||||
# Currently the resources are only copied on post-build. If one is changed but the domain-server is not, they will
|
# Currently the resources are only copied on post-build. If one is changed but the domain-server is not, they will
|
||||||
# not be re-copied. This is worked-around on OS X/UNIX by using a symlink.
|
# not be re-copied. This is worked-around on OS X/UNIX by using a symlink.
|
||||||
|
|
|
@ -1756,6 +1756,7 @@ bool DomainServer::handleHTTPSRequest(HTTPSConnection* connection, const QUrl &u
|
||||||
.arg(authorizationCode, oauthRedirectURL().toString(), _oauthClientID, _oauthClientSecret);
|
.arg(authorizationCode, oauthRedirectURL().toString(), _oauthClientID, _oauthClientSecret);
|
||||||
|
|
||||||
QNetworkRequest tokenRequest(tokenRequestUrl);
|
QNetworkRequest tokenRequest(tokenRequestUrl);
|
||||||
|
tokenRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
tokenRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
tokenRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
tokenRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
tokenRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
||||||
|
|
||||||
|
@ -1949,6 +1950,7 @@ QNetworkReply* DomainServer::profileRequestGivenTokenReply(QNetworkReply* tokenR
|
||||||
profileURL.setQuery(QString("%1=%2").arg(OAUTH_JSON_ACCESS_TOKEN_KEY, accessToken));
|
profileURL.setQuery(QString("%1=%2").arg(OAUTH_JSON_ACCESS_TOKEN_KEY, accessToken));
|
||||||
|
|
||||||
QNetworkRequest profileRequest(profileURL);
|
QNetworkRequest profileRequest(profileURL);
|
||||||
|
profileRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
profileRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
profileRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
return NetworkAccessManager::getInstance().get(profileRequest);
|
return NetworkAccessManager::getInstance().get(profileRequest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,6 +213,7 @@ void IceServer::requestDomainPublicKey(const QUuid& domainID) {
|
||||||
publicKeyURL.setPath(publicKeyPath);
|
publicKeyURL.setPath(publicKeyPath);
|
||||||
|
|
||||||
QNetworkRequest publicKeyRequest { publicKeyURL };
|
QNetworkRequest publicKeyRequest { publicKeyURL };
|
||||||
|
publicKeyRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
publicKeyRequest.setAttribute(QNetworkRequest::User, domainID);
|
publicKeyRequest.setAttribute(QNetworkRequest::User, domainID);
|
||||||
|
|
||||||
qDebug() << "Requesting public key for domain with ID" << domainID;
|
qDebug() << "Requesting public key for domain with ID" << domainID;
|
||||||
|
|
|
@ -42,12 +42,12 @@ endif ()
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
set(PLATFORM_QT_COMPONENTS AndroidExtras)
|
set(PLATFORM_QT_COMPONENTS AndroidExtras)
|
||||||
else ()
|
else ()
|
||||||
set(PLATFORM_QT_COMPONENTS WebEngine WebEngineWidgets WebKitWidgets)
|
set(PLATFORM_QT_COMPONENTS WebEngine WebEngineWidgets)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
find_package(
|
find_package(
|
||||||
Qt5 COMPONENTS
|
Qt5 COMPONENTS
|
||||||
Gui Multimedia Network OpenGL Qml Quick Script ScriptTools Svg
|
Gui Multimedia Network OpenGL Qml Quick Script Svg
|
||||||
${PLATFORM_QT_COMPONENTS}
|
${PLATFORM_QT_COMPONENTS}
|
||||||
WebChannel WebSockets
|
WebChannel WebSockets
|
||||||
)
|
)
|
||||||
|
@ -123,7 +123,8 @@ if (APPLE)
|
||||||
add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM})
|
add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM})
|
||||||
|
|
||||||
# make sure the output name for the .app bundle is correct
|
# make sure the output name for the .app bundle is correct
|
||||||
set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME ${INTERFACE_BUNDLE_NAME})
|
# Fix up the rpath so macdeployqt works
|
||||||
|
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH "@executable_path/../Frameworks")
|
||||||
elseif (WIN32)
|
elseif (WIN32)
|
||||||
# configure an rc file for the chosen icon
|
# configure an rc file for the chosen icon
|
||||||
set(CONFIGURE_ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/icon/${INTERFACE_ICON_FILENAME}")
|
set(CONFIGURE_ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/icon/${INTERFACE_ICON_FILENAME}")
|
||||||
|
@ -241,16 +242,10 @@ include_directories("${PROJECT_SOURCE_DIR}/src")
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
${TARGET_NAME}
|
${TARGET_NAME}
|
||||||
Qt5::Gui Qt5::Network Qt5::Multimedia Qt5::OpenGL
|
Qt5::Gui Qt5::Network Qt5::Multimedia Qt5::OpenGL
|
||||||
Qt5::Qml Qt5::Quick Qt5::Script Qt5::ScriptTools Qt5::Svg
|
Qt5::Qml Qt5::Quick Qt5::Script Qt5::Svg
|
||||||
Qt5::WebChannel Qt5::WebEngine Qt5::WebEngineWidgets Qt5::WebKitWidgets
|
Qt5::WebChannel Qt5::WebEngine
|
||||||
)
|
)
|
||||||
|
|
||||||
# Issue causes build failure unless we add this directory.
|
|
||||||
# See https://bugreports.qt.io/browse/QTBUG-43351
|
|
||||||
if (WIN32)
|
|
||||||
add_paths_to_fixup_libs(${Qt5_DIR}/../../../plugins/qtwebengine)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
target_link_libraries(${TARGET_NAME} pthread)
|
target_link_libraries(${TARGET_NAME} pthread)
|
||||||
endif(UNIX)
|
endif(UNIX)
|
||||||
|
|
|
@ -223,12 +223,12 @@ ScrollingWindow {
|
||||||
var newWindow = component.createObject(desktop);
|
var newWindow = component.createObject(desktop);
|
||||||
request.openIn(newWindow.webView)
|
request.openIn(newWindow.webView)
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
|
||||||
desktop.initWebviewProfileHandlers(webview.profile)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//profile: desktop.browserProfile
|
Component.onCompleted: {
|
||||||
|
desktop.initWebviewProfileHandlers(webview.profile)
|
||||||
|
}
|
||||||
|
|
||||||
|
profile: desktop.browserProfile
|
||||||
}
|
}
|
||||||
|
|
||||||
} // item
|
} // item
|
||||||
|
@ -245,4 +245,4 @@ ScrollingWindow {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // dialog
|
} // dialog
|
||||||
|
|
|
@ -5,7 +5,7 @@ WebEngineView {
|
||||||
id: root
|
id: root
|
||||||
property var newUrl;
|
property var newUrl;
|
||||||
|
|
||||||
profile.httpUserAgent: "Mozilla/5.0 Chrome (HighFidelityInterface)"
|
profile: desktop.browserProfile
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
console.log("Connecting JS messaging to Hifi Logging")
|
console.log("Connecting JS messaging to Hifi Logging")
|
||||||
|
@ -13,7 +13,6 @@ WebEngineView {
|
||||||
root.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
|
root.javaScriptConsoleMessage.connect(function(level, message, lineNumber, sourceID) {
|
||||||
console.log("Web Window JS message: " + sourceID + " " + lineNumber + " " + message);
|
console.log("Web Window JS message: " + sourceID + " " + lineNumber + " " + message);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME hack to get the URL with the auth token included. Remove when we move to Qt 5.6
|
// FIXME hack to get the URL with the auth token included. Remove when we move to Qt 5.6
|
||||||
|
@ -61,8 +60,4 @@ WebEngineView {
|
||||||
request.openIn(newWindow.webView);
|
request.openIn(newWindow.webView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This breaks the webchannel used for passing messages. Fixed in Qt 5.6
|
|
||||||
// See https://bugreports.qt.io/browse/QTBUG-49521
|
|
||||||
//profile: desktop.browserProfile
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ ModalWindow {
|
||||||
// Set from OffscreenUi::getOpenFile()
|
// Set from OffscreenUi::getOpenFile()
|
||||||
property int options; // <-- FIXME unused
|
property int options; // <-- FIXME unused
|
||||||
|
|
||||||
property string iconText: text !== "" ? hifi.glyphs.scriptUpload : ""
|
property string iconText: root.title !== "" ? hifi.glyphs.scriptUpload : ""
|
||||||
property int iconSize: 40
|
property int iconSize: 40
|
||||||
|
|
||||||
property bool selectDirectory: false;
|
property bool selectDirectory: false;
|
||||||
|
|
|
@ -89,6 +89,7 @@ Rectangle {
|
||||||
property int dropSamples: 9;
|
property int dropSamples: 9;
|
||||||
property int dropSpread: 0;
|
property int dropSpread: 0;
|
||||||
DropShadow {
|
DropShadow {
|
||||||
|
visible: desktop.gradientsSupported;
|
||||||
source: place;
|
source: place;
|
||||||
anchors.fill: place;
|
anchors.fill: place;
|
||||||
horizontalOffset: dropHorizontalOffset;
|
horizontalOffset: dropHorizontalOffset;
|
||||||
|
@ -99,6 +100,7 @@ Rectangle {
|
||||||
spread: dropSpread;
|
spread: dropSpread;
|
||||||
}
|
}
|
||||||
DropShadow {
|
DropShadow {
|
||||||
|
visible: desktop.gradientsSupported;
|
||||||
source: users;
|
source: users;
|
||||||
anchors.fill: users;
|
anchors.fill: users;
|
||||||
horizontalOffset: dropHorizontalOffset;
|
horizontalOffset: dropHorizontalOffset;
|
||||||
|
|
|
@ -109,7 +109,7 @@ Decoration {
|
||||||
verticalOffset: 2
|
verticalOffset: 2
|
||||||
samples: 2
|
samples: 2
|
||||||
color: hifi.colors.baseGrayShadow60
|
color: hifi.colors.baseGrayShadow60
|
||||||
visible: (window && window.focus)
|
visible: (desktop.gradientsSupported && window && window.focus)
|
||||||
cached: true
|
cached: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,6 @@
|
||||||
#include "scripting/LocationScriptingInterface.h"
|
#include "scripting/LocationScriptingInterface.h"
|
||||||
#include "scripting/MenuScriptingInterface.h"
|
#include "scripting/MenuScriptingInterface.h"
|
||||||
#include "scripting/SettingsScriptingInterface.h"
|
#include "scripting/SettingsScriptingInterface.h"
|
||||||
#include "scripting/WebWindowClass.h"
|
|
||||||
#include "scripting/WindowScriptingInterface.h"
|
#include "scripting/WindowScriptingInterface.h"
|
||||||
#include "scripting/ControllerScriptingInterface.h"
|
#include "scripting/ControllerScriptingInterface.h"
|
||||||
#include "scripting/ToolbarScriptingInterface.h"
|
#include "scripting/ToolbarScriptingInterface.h"
|
||||||
|
@ -4858,7 +4857,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
||||||
scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter,
|
scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter,
|
||||||
LocationScriptingInterface::locationSetter);
|
LocationScriptingInterface::locationSetter);
|
||||||
|
|
||||||
scriptEngine->registerFunction("WebWindow", WebWindowClass::constructor, 1);
|
|
||||||
scriptEngine->registerFunction("OverlayWebWindow", QmlWebWindowClass::constructor);
|
scriptEngine->registerFunction("OverlayWebWindow", QmlWebWindowClass::constructor);
|
||||||
scriptEngine->registerFunction("OverlayWindow", QmlWindowClass::constructor);
|
scriptEngine->registerFunction("OverlayWindow", QmlWindowClass::constructor);
|
||||||
|
|
||||||
|
@ -5034,6 +5032,7 @@ bool Application::askToLoadScript(const QString& scriptFilenameOrURL) {
|
||||||
bool Application::askToWearAvatarAttachmentUrl(const QString& url) {
|
bool Application::askToWearAvatarAttachmentUrl(const QString& url) {
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest networkRequest = QNetworkRequest(url);
|
QNetworkRequest networkRequest = QNetworkRequest(url);
|
||||||
|
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
QNetworkReply* reply = networkAccessManager.get(networkRequest);
|
QNetworkReply* reply = networkAccessManager.get(networkRequest);
|
||||||
int requestNumber = ++_avatarAttachmentRequest;
|
int requestNumber = ++_avatarAttachmentRequest;
|
||||||
|
@ -5741,4 +5740,4 @@ void Application::updateThreadPoolCount() const {
|
||||||
qDebug() << "Reserved threads " << reservedThreads;
|
qDebug() << "Reserved threads " << reservedThreads;
|
||||||
qDebug() << "Setting thread pool size to " << threadPoolSize;
|
qDebug() << "Setting thread pool size to " << threadPoolSize;
|
||||||
QThreadPool::globalInstance()->setMaxThreadCount(threadPoolSize);
|
QThreadPool::globalInstance()->setMaxThreadCount(threadPoolSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,182 +0,0 @@
|
||||||
//
|
|
||||||
// WebWindowClass.cpp
|
|
||||||
// interface/src/scripting
|
|
||||||
//
|
|
||||||
// Created by Ryan Huffman on 11/06/14.
|
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QDockWidget>
|
|
||||||
#include <QWebFrame>
|
|
||||||
#include <QWebView>
|
|
||||||
#include <QListWidget>
|
|
||||||
#include <QStyleFactory>
|
|
||||||
|
|
||||||
#include "Application.h"
|
|
||||||
#include "ui/DataWebPage.h"
|
|
||||||
#include "MainWindow.h"
|
|
||||||
#include "WebWindowClass.h"
|
|
||||||
#include "WindowScriptingInterface.h"
|
|
||||||
|
|
||||||
ScriptEventBridge::ScriptEventBridge(QObject* parent) : QObject(parent) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScriptEventBridge::emitWebEvent(const QString& data) {
|
|
||||||
emit webEventReceived(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScriptEventBridge::emitScriptEvent(const QString& data) {
|
|
||||||
emit scriptEventReceived(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
WebWindowClass::WebWindowClass(const QString& title, const QString& url, int width, int height)
|
|
||||||
: QObject(NULL), _eventBridge(new ScriptEventBridge(this)) {
|
|
||||||
auto dialogWidget = new QDialog(qApp->getWindow(), Qt::Window);
|
|
||||||
dialogWidget->setWindowTitle(title);
|
|
||||||
dialogWidget->resize(width, height);
|
|
||||||
dialogWidget->installEventFilter(this);
|
|
||||||
connect(dialogWidget, &QDialog::finished, this, &WebWindowClass::hasClosed);
|
|
||||||
|
|
||||||
auto layout = new QVBoxLayout(dialogWidget);
|
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
dialogWidget->setLayout(layout);
|
|
||||||
|
|
||||||
_webView = new QWebView(dialogWidget);
|
|
||||||
|
|
||||||
layout->addWidget(_webView);
|
|
||||||
|
|
||||||
addEventBridgeToWindowObject();
|
|
||||||
|
|
||||||
_windowWidget = dialogWidget;
|
|
||||||
|
|
||||||
auto style = QStyleFactory::create("fusion");
|
|
||||||
if (style) {
|
|
||||||
_webView->setStyle(style);
|
|
||||||
}
|
|
||||||
|
|
||||||
_webView->setPage(new DataWebPage());
|
|
||||||
if (!url.startsWith("http") && !url.startsWith("file://")) {
|
|
||||||
_webView->setUrl(QUrl::fromLocalFile(url));
|
|
||||||
} else {
|
|
||||||
_webView->setUrl(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(this, &WebWindowClass::destroyed, _windowWidget, &QWidget::deleteLater);
|
|
||||||
connect(_webView->page()->mainFrame(), &QWebFrame::javaScriptWindowObjectCleared,
|
|
||||||
this, &WebWindowClass::addEventBridgeToWindowObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
WebWindowClass::~WebWindowClass() {
|
|
||||||
}
|
|
||||||
|
|
||||||
bool WebWindowClass::eventFilter(QObject* sender, QEvent* event) {
|
|
||||||
if (sender == _windowWidget) {
|
|
||||||
if (event->type() == QEvent::Move) {
|
|
||||||
emit moved(getPosition());
|
|
||||||
}
|
|
||||||
if (event->type() == QEvent::Resize) {
|
|
||||||
emit resized(getSize());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebWindowClass::hasClosed() {
|
|
||||||
emit closed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebWindowClass::addEventBridgeToWindowObject() {
|
|
||||||
_webView->page()->mainFrame()->addToJavaScriptWindowObject("EventBridge", _eventBridge);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebWindowClass::setVisible(bool visible) {
|
|
||||||
if (visible) {
|
|
||||||
QMetaObject::invokeMethod(_windowWidget, "showNormal", Qt::AutoConnection);
|
|
||||||
QMetaObject::invokeMethod(_windowWidget, "raise", Qt::AutoConnection);
|
|
||||||
}
|
|
||||||
QMetaObject::invokeMethod(_windowWidget, "setVisible", Qt::AutoConnection, Q_ARG(bool, visible));
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebWindowClass::setURL(const QString& url) {
|
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
QMetaObject::invokeMethod(this, "setURL", Qt::AutoConnection, Q_ARG(QString, url));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_webView->setUrl(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
QSizeF WebWindowClass::getSize() const {
|
|
||||||
QSizeF size = _windowWidget->size();
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebWindowClass::setSize(QSizeF size) {
|
|
||||||
setSize(size.width(), size.height());
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebWindowClass::setSize(int width, int height) {
|
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
QMetaObject::invokeMethod(this, "setSize", Qt::AutoConnection, Q_ARG(int, width), Q_ARG(int, height));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_windowWidget->resize(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::vec2 WebWindowClass::getPosition() const {
|
|
||||||
QPoint position = _windowWidget->pos();
|
|
||||||
return glm::vec2(position.x(), position.y());
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebWindowClass::setPosition(glm::vec2 position) {
|
|
||||||
setPosition(position.x, position.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebWindowClass::setPosition(int x, int y) {
|
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
QMetaObject::invokeMethod(this, "setPosition", Qt::AutoConnection, Q_ARG(int, x), Q_ARG(int, y));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_windowWidget->move(x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebWindowClass::raise() {
|
|
||||||
QMetaObject::invokeMethod(_windowWidget, "showNormal", Qt::AutoConnection);
|
|
||||||
QMetaObject::invokeMethod(_windowWidget, "raise", Qt::AutoConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
QScriptValue WebWindowClass::constructor(QScriptContext* context, QScriptEngine* engine) {
|
|
||||||
WebWindowClass* retVal;
|
|
||||||
QString file = context->argument(0).toString();
|
|
||||||
if (context->argument(4).toBool()) {
|
|
||||||
qWarning() << "ToolWindow views with WebWindow are no longer supported. Use OverlayWebWindow instead";
|
|
||||||
return QScriptValue();
|
|
||||||
} else {
|
|
||||||
qWarning() << "WebWindow views are deprecated. Use OverlayWebWindow instead";
|
|
||||||
}
|
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<WindowScriptingInterface>().data(), "doCreateWebWindow", Qt::BlockingQueuedConnection,
|
|
||||||
Q_RETURN_ARG(WebWindowClass*, retVal),
|
|
||||||
Q_ARG(const QString&, file),
|
|
||||||
Q_ARG(QString, context->argument(1).toString()),
|
|
||||||
Q_ARG(int, context->argument(2).toInteger()),
|
|
||||||
Q_ARG(int, context->argument(3).toInteger()));
|
|
||||||
|
|
||||||
connect(engine, &QScriptEngine::destroyed, retVal, &WebWindowClass::deleteLater);
|
|
||||||
|
|
||||||
return engine->newQObject(retVal);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebWindowClass::setTitle(const QString& title) {
|
|
||||||
if (QThread::currentThread() != thread()) {
|
|
||||||
QMetaObject::invokeMethod(this, "setTitle", Qt::AutoConnection, Q_ARG(QString, title));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_windowWidget->setWindowTitle(title);
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
//
|
|
||||||
// WebWindowClass.h
|
|
||||||
// interface/src/scripting
|
|
||||||
//
|
|
||||||
// Created by Ryan Huffman on 11/06/14.
|
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef hifi_WebWindowClass_h
|
|
||||||
#define hifi_WebWindowClass_h
|
|
||||||
|
|
||||||
#include <QScriptContext>
|
|
||||||
#include <QScriptEngine>
|
|
||||||
#include <QWebView>
|
|
||||||
|
|
||||||
class ScriptEventBridge : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ScriptEventBridge(QObject* parent = NULL);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void emitWebEvent(const QString& data);
|
|
||||||
void emitScriptEvent(const QString& data);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void webEventReceived(const QString& data);
|
|
||||||
void scriptEventReceived(const QString& data);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class WebWindowClass : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PROPERTY(QObject* eventBridge READ getEventBridge)
|
|
||||||
Q_PROPERTY(QString url READ getURL)
|
|
||||||
Q_PROPERTY(glm::vec2 position READ getPosition WRITE setPosition);
|
|
||||||
Q_PROPERTY(QSizeF size READ getSize WRITE setSize);
|
|
||||||
|
|
||||||
public:
|
|
||||||
WebWindowClass(const QString& title, const QString& url, int width, int height);
|
|
||||||
~WebWindowClass();
|
|
||||||
|
|
||||||
static QScriptValue constructor(QScriptContext* context, QScriptEngine* engine);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void setVisible(bool visible);
|
|
||||||
glm::vec2 getPosition() const;
|
|
||||||
void setPosition(int x, int y);
|
|
||||||
void setPosition(glm::vec2 position);
|
|
||||||
QSizeF getSize() const;
|
|
||||||
void setSize(QSizeF size);
|
|
||||||
void setSize(int width, int height);
|
|
||||||
QString getURL() const { return _webView->url().url(); }
|
|
||||||
void setURL(const QString& url);
|
|
||||||
void raise();
|
|
||||||
ScriptEventBridge* getEventBridge() const { return _eventBridge; }
|
|
||||||
void addEventBridgeToWindowObject();
|
|
||||||
void setTitle(const QString& title);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void visibilityChanged(bool visible); // Tool window
|
|
||||||
void moved(glm::vec2 position);
|
|
||||||
void resized(QSizeF size);
|
|
||||||
void closed();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual bool eventFilter(QObject* sender, QEvent* event) override;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void hasClosed();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QWidget* _windowWidget;
|
|
||||||
QWebView* _webView;
|
|
||||||
ScriptEventBridge* _eventBridge;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
#include "OffscreenUi.h"
|
#include "OffscreenUi.h"
|
||||||
#include "WebWindowClass.h"
|
|
||||||
|
|
||||||
#include "WindowScriptingInterface.h"
|
#include "WindowScriptingInterface.h"
|
||||||
|
|
||||||
|
@ -61,10 +60,6 @@ WindowScriptingInterface::WindowScriptingInterface() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title, const QString& url, int width, int height) {
|
|
||||||
return new WebWindowClass(title, url, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
QScriptValue WindowScriptingInterface::hasFocus() {
|
QScriptValue WindowScriptingInterface::hasFocus() {
|
||||||
return qApp->hasFocus();
|
return qApp->hasFocus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,6 @@
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtScript/QScriptValue>
|
#include <QtScript/QScriptValue>
|
||||||
|
|
||||||
class WebWindowClass;
|
|
||||||
|
|
||||||
|
|
||||||
class CustomPromptResult {
|
class CustomPromptResult {
|
||||||
public:
|
public:
|
||||||
QVariant value;
|
QVariant value;
|
||||||
|
@ -65,9 +62,6 @@ signals:
|
||||||
void snapshotTaken(const QString& path, bool notify);
|
void snapshotTaken(const QString& path, bool notify);
|
||||||
void snapshotShared(const QString& error);
|
void snapshotShared(const QString& error);
|
||||||
|
|
||||||
private slots:
|
|
||||||
WebWindowClass* doCreateWebWindow(const QString& title, const QString& url, int width, int height);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString getPreviousBrowseLocation() const;
|
QString getPreviousBrowseLocation() const;
|
||||||
void setPreviousBrowseLocation(const QString& location);
|
void setPreviousBrowseLocation(const QString& location);
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
//
|
|
||||||
// DataWebPage.cpp
|
|
||||||
// interface/src/ui
|
|
||||||
//
|
|
||||||
// Created by Stephen Birarda on 2014-09-22.
|
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <qnetworkrequest.h>
|
|
||||||
|
|
||||||
#include "Application.h"
|
|
||||||
#include <AddressManager.h>
|
|
||||||
#include <OAuthNetworkAccessManager.h>
|
|
||||||
|
|
||||||
#include "DataWebPage.h"
|
|
||||||
|
|
||||||
DataWebPage::DataWebPage(QObject* parent) :
|
|
||||||
QWebPage(parent)
|
|
||||||
{
|
|
||||||
// use an OAuthNetworkAccessManager instead of regular QNetworkAccessManager so our requests are authed
|
|
||||||
setNetworkAccessManager(OAuthNetworkAccessManager::getInstance());
|
|
||||||
|
|
||||||
// give the page an empty stylesheet
|
|
||||||
settings()->setUserStyleSheetUrl(QUrl());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID) {
|
|
||||||
qDebug() << "JS console message at line" << lineNumber << "from" << sourceID << "-" << message;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DataWebPage::acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, QWebPage::NavigationType type) {
|
|
||||||
// Handle hifi:// links and links to files with particular extensions
|
|
||||||
QString urlString = request.url().toString();
|
|
||||||
if (qApp->canAcceptURL(urlString)) {
|
|
||||||
if (qApp->acceptURL(urlString)) {
|
|
||||||
return false; // we handled it, so QWebPage doesn't need to handle it
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make hyperlinks with target="_blank" open in user's Web browser
|
|
||||||
if (type == QWebPage::NavigationTypeLinkClicked && frame == nullptr) {
|
|
||||||
qApp->openUrl(request.url());
|
|
||||||
return false; // We handled it.
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DataWebPage::userAgentForUrl(const QUrl& url) const {
|
|
||||||
return HIGH_FIDELITY_USER_AGENT;
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
//
|
|
||||||
// DataWebPage.h
|
|
||||||
// interface/src/ui
|
|
||||||
//
|
|
||||||
// Created by Stephen Birarda on 2014-09-22.
|
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
|
||||||
//
|
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef hifi_DataWebPage_h
|
|
||||||
#define hifi_DataWebPage_h
|
|
||||||
|
|
||||||
#include <qwebpage.h>
|
|
||||||
|
|
||||||
class DataWebPage : public QWebPage {
|
|
||||||
public:
|
|
||||||
DataWebPage(QObject* parent = 0);
|
|
||||||
protected:
|
|
||||||
void javaScriptConsoleMessage(const QString & message, int lineNumber, const QString & sourceID) override;
|
|
||||||
bool acceptNavigationRequest(QWebFrame* frame, const QNetworkRequest& request, QWebPage::NavigationType type) override;
|
|
||||||
virtual QString userAgentForUrl(const QUrl& url) const override;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // hifi_DataWebPage_h
|
|
|
@ -228,6 +228,7 @@ void ModelHandler::update() {
|
||||||
QUrl url(_model.item(i,0)->data(Qt::UserRole).toString());
|
QUrl url(_model.item(i,0)->data(Qt::UserRole).toString());
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
|
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
QNetworkReply* reply = networkAccessManager.head(request);
|
QNetworkReply* reply = networkAccessManager.head(request);
|
||||||
connect(reply, SIGNAL(finished()), SLOT(downloadFinished()));
|
connect(reply, SIGNAL(finished()), SLOT(downloadFinished()));
|
||||||
|
@ -280,6 +281,7 @@ void ModelHandler::queryNewFiles(QString marker) {
|
||||||
url.setQuery(query);
|
url.setQuery(query);
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
|
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
QNetworkReply* reply = networkAccessManager.get(request);
|
QNetworkReply* reply = networkAccessManager.get(request);
|
||||||
connect(reply, SIGNAL(finished()), SLOT(downloadFinished()));
|
connect(reply, SIGNAL(finished()), SLOT(downloadFinished()));
|
||||||
|
|
|
@ -161,6 +161,7 @@ void ScriptEditorWidget::loadFile(const QString& scriptPath) {
|
||||||
} else {
|
} else {
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest networkRequest = QNetworkRequest(url);
|
QNetworkRequest networkRequest = QNetworkRequest(url);
|
||||||
|
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
QNetworkReply* reply = networkAccessManager.get(networkRequest);
|
QNetworkReply* reply = networkAccessManager.get(networkRequest);
|
||||||
qDebug() << "Downloading included script at" << scriptPath;
|
qDebug() << "Downloading included script at" << scriptPath;
|
||||||
|
|
|
@ -33,6 +33,7 @@ void AutoUpdater::checkForUpdate() {
|
||||||
void AutoUpdater::getLatestVersionData() {
|
void AutoUpdater::getLatestVersionData() {
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest latestVersionRequest(BUILDS_XML_URL);
|
QNetworkRequest latestVersionRequest(BUILDS_XML_URL);
|
||||||
|
latestVersionRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
latestVersionRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
latestVersionRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
QNetworkReply* reply = networkAccessManager.get(latestVersionRequest);
|
QNetworkReply* reply = networkAccessManager.get(latestVersionRequest);
|
||||||
connect(reply, &QNetworkReply::finished, this, &AutoUpdater::parseLatestVersionData);
|
connect(reply, &QNetworkReply::finished, this, &AutoUpdater::parseLatestVersionData);
|
||||||
|
|
|
@ -1206,6 +1206,7 @@ void AvatarData::updateJointMappings() {
|
||||||
if (_skeletonModelURL.fileName().toLower().endsWith(".fst")) {
|
if (_skeletonModelURL.fileName().toLower().endsWith(".fst")) {
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest networkRequest = QNetworkRequest(_skeletonModelURL);
|
QNetworkRequest networkRequest = QNetworkRequest(_skeletonModelURL);
|
||||||
|
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
QNetworkReply* networkReply = networkAccessManager.get(networkRequest);
|
QNetworkReply* networkReply = networkAccessManager.get(networkRequest);
|
||||||
connect(networkReply, &QNetworkReply::finished, this, &AvatarData::setJointMappingsFromNetworkReply);
|
connect(networkReply, &QNetworkReply::finished, this, &AvatarData::setJointMappingsFromNetworkReply);
|
||||||
|
|
|
@ -191,6 +191,7 @@ FSTReader::ModelType FSTReader::predictModelType(const QVariantHash& mapping) {
|
||||||
QVariantHash FSTReader::downloadMapping(const QString& url) {
|
QVariantHash FSTReader::downloadMapping(const QString& url) {
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest networkRequest = QNetworkRequest(url);
|
QNetworkRequest networkRequest = QNetworkRequest(url);
|
||||||
|
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
QNetworkReply* reply = networkAccessManager.get(networkRequest);
|
QNetworkReply* reply = networkAccessManager.get(networkRequest);
|
||||||
qDebug() << "Downloading avatar file at " << url;
|
qDebug() << "Downloading avatar file at " << url;
|
||||||
|
|
|
@ -282,6 +282,7 @@ QNetworkReply* OBJReader::request(QUrl& url, bool isTest) {
|
||||||
});
|
});
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest netRequest(url);
|
QNetworkRequest netRequest(url);
|
||||||
|
netRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
QNetworkReply* netReply = isTest ? networkAccessManager.head(netRequest) : networkAccessManager.get(netRequest);
|
QNetworkReply* netReply = isTest ? networkAccessManager.head(netRequest) : networkAccessManager.get(netRequest);
|
||||||
if (!qApp || aboutToQuit) {
|
if (!qApp || aboutToQuit) {
|
||||||
netReply->deleteLater();
|
netReply->deleteLater();
|
||||||
|
|
|
@ -218,7 +218,7 @@ void AccountManager::sendRequest(const QString& path,
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
|
|
||||||
QNetworkRequest networkRequest;
|
QNetworkRequest networkRequest;
|
||||||
|
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
||||||
|
|
||||||
networkRequest.setRawHeader(METAVERSE_SESSION_ID_HEADER,
|
networkRequest.setRawHeader(METAVERSE_SESSION_ID_HEADER,
|
||||||
|
@ -484,6 +484,7 @@ void AccountManager::requestAccessToken(const QString& login, const QString& pas
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
|
|
||||||
QNetworkRequest request;
|
QNetworkRequest request;
|
||||||
|
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
request.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
||||||
|
|
||||||
QUrl grantURL = _authURL;
|
QUrl grantURL = _authURL;
|
||||||
|
@ -578,6 +579,7 @@ void AccountManager::requestProfile() {
|
||||||
profileURL.setPath("/api/v1/user/profile");
|
profileURL.setPath("/api/v1/user/profile");
|
||||||
|
|
||||||
QNetworkRequest profileRequest(profileURL);
|
QNetworkRequest profileRequest(profileURL);
|
||||||
|
profileRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
profileRequest.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
profileRequest.setHeader(QNetworkRequest::UserAgentHeader, _userAgentGetter());
|
||||||
profileRequest.setRawHeader(ACCESS_TOKEN_AUTHORIZATION_HEADER, _accountInfo.getAccessToken().authorizationHeaderValue());
|
profileRequest.setRawHeader(ACCESS_TOKEN_AUTHORIZATION_HEADER, _accountInfo.getAccessToken().authorizationHeaderValue());
|
||||||
|
|
||||||
|
|
|
@ -836,6 +836,7 @@ void AddressManager::ifLocalSandboxRunningElse(std::function<void()> localSandbo
|
||||||
|
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest sandboxStatus(SANDBOX_STATUS_URL);
|
QNetworkRequest sandboxStatus(SANDBOX_STATUS_URL);
|
||||||
|
sandboxStatus.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
sandboxStatus.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
sandboxStatus.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
QNetworkReply* reply = networkAccessManager.get(sandboxStatus);
|
QNetworkReply* reply = networkAccessManager.get(sandboxStatus);
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ void HTTPResourceRequest::cleanupTimer() {
|
||||||
|
|
||||||
void HTTPResourceRequest::doSend() {
|
void HTTPResourceRequest::doSend() {
|
||||||
QNetworkRequest networkRequest(_url);
|
QNetworkRequest networkRequest(_url);
|
||||||
|
networkRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
networkRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
|
|
||||||
if (_cacheEnabled) {
|
if (_cacheEnabled) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ QNetworkReply* OAuthNetworkAccessManager::createRequest(QNetworkAccessManager::O
|
||||||
if (accountManager->hasValidAccessToken()
|
if (accountManager->hasValidAccessToken()
|
||||||
&& req.url().host() == NetworkingConstants::METAVERSE_SERVER_URL.host()) {
|
&& req.url().host() == NetworkingConstants::METAVERSE_SERVER_URL.host()) {
|
||||||
QNetworkRequest authenticatedRequest(req);
|
QNetworkRequest authenticatedRequest(req);
|
||||||
|
authenticatedRequest.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
authenticatedRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
authenticatedRequest.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
authenticatedRequest.setRawHeader(ACCESS_TOKEN_AUTHORIZATION_HEADER,
|
authenticatedRequest.setRawHeader(ACCESS_TOKEN_AUTHORIZATION_HEADER,
|
||||||
accountManager->getAccountInfo().getAccessToken().authorizationHeaderValue());
|
accountManager->getAccountInfo().getAccessToken().authorizationHeaderValue());
|
||||||
|
|
|
@ -185,6 +185,7 @@ void ScriptsModel::requestDefaultFiles(QString marker) {
|
||||||
|
|
||||||
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
QNetworkAccessManager& networkAccessManager = NetworkAccessManager::getInstance();
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
|
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
request.setHeader(QNetworkRequest::UserAgentHeader, HIGH_FIDELITY_USER_AGENT);
|
||||||
QNetworkReply* reply = networkAccessManager.get(request);
|
QNetworkReply* reply = networkAccessManager.get(request);
|
||||||
connect(reply, SIGNAL(finished()), SLOT(downloadFinished()));
|
connect(reply, SIGNAL(finished()), SLOT(downloadFinished()));
|
||||||
|
|
|
@ -45,6 +45,7 @@ XMLHttpRequestClass::XMLHttpRequestClass(QScriptEngine* engine) :
|
||||||
_timer(this),
|
_timer(this),
|
||||||
_numRedirects(0) {
|
_numRedirects(0) {
|
||||||
|
|
||||||
|
_request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
_timer.setSingleShot(true);
|
_timer.setSingleShot(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <QtGui/QVector3D>
|
#include <QtGui/QVector3D>
|
||||||
#include <QtGui/QQuaternion>
|
#include <QtGui/QQuaternion>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
|
#include <QAbstractSocket>
|
||||||
|
|
||||||
#include "RegisteredMetaTypes.h"
|
#include "RegisteredMetaTypes.h"
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ int xColorMetaTypeId = qRegisterMetaType<xColor>();
|
||||||
int pickRayMetaTypeId = qRegisterMetaType<PickRay>();
|
int pickRayMetaTypeId = qRegisterMetaType<PickRay>();
|
||||||
int collisionMetaTypeId = qRegisterMetaType<Collision>();
|
int collisionMetaTypeId = qRegisterMetaType<Collision>();
|
||||||
int qMapURLStringMetaTypeId = qRegisterMetaType<QMap<QUrl,QString>>();
|
int qMapURLStringMetaTypeId = qRegisterMetaType<QMap<QUrl,QString>>();
|
||||||
|
int socketErrorMetaTypeId = qRegisterMetaType<QAbstractSocket::SocketError>();
|
||||||
|
|
||||||
void registerMetaTypes(QScriptEngine* engine) {
|
void registerMetaTypes(QScriptEngine* engine) {
|
||||||
qScriptRegisterMetaType(engine, mat4toScriptValue, mat4FromScriptValue);
|
qScriptRegisterMetaType(engine, mat4toScriptValue, mat4FromScriptValue);
|
||||||
|
|
|
@ -155,7 +155,7 @@ void bindActionToQmlAction(QObject* qmlAction, QAction* action) {
|
||||||
QObject::connect(qmlAction, SIGNAL(triggered()), action, SLOT(trigger()));
|
QObject::connect(qmlAction, SIGNAL(triggered()), action, SLOT(trigger()));
|
||||||
}
|
}
|
||||||
|
|
||||||
class QQuickMenuItem;
|
class QQuickMenuItem1;
|
||||||
|
|
||||||
void VrMenu::addAction(QMenu* menu, QAction* action) {
|
void VrMenu::addAction(QMenu* menu, QAction* action) {
|
||||||
Q_ASSERT(!MenuUserData::hasData(action));
|
Q_ASSERT(!MenuUserData::hasData(action));
|
||||||
|
@ -167,10 +167,9 @@ void VrMenu::addAction(QMenu* menu, QAction* action) {
|
||||||
}
|
}
|
||||||
QObject* menuQml = findMenuObject(userData->uuid.toString());
|
QObject* menuQml = findMenuObject(userData->uuid.toString());
|
||||||
Q_ASSERT(menuQml);
|
Q_ASSERT(menuQml);
|
||||||
QQuickMenuItem* returnedValue { nullptr };
|
QQuickMenuItem1* returnedValue { nullptr };
|
||||||
|
|
||||||
bool invokeResult = QMetaObject::invokeMethod(menuQml, "addItem", Qt::DirectConnection,
|
bool invokeResult = QMetaObject::invokeMethod(menuQml, "addItem", Qt::DirectConnection,
|
||||||
Q_RETURN_ARG(QQuickMenuItem*, returnedValue),
|
Q_RETURN_ARG(QQuickMenuItem1*, returnedValue),
|
||||||
Q_ARG(QString, action->text()));
|
Q_ARG(QString, action->text()));
|
||||||
|
|
||||||
Q_ASSERT(invokeResult);
|
Q_ASSERT(invokeResult);
|
||||||
|
@ -206,10 +205,10 @@ void VrMenu::insertAction(QAction* before, QAction* action) {
|
||||||
beforeQml = findMenuObject(beforeUserData->uuid.toString());
|
beforeQml = findMenuObject(beforeUserData->uuid.toString());
|
||||||
}
|
}
|
||||||
QObject* menu = beforeQml->parent();
|
QObject* menu = beforeQml->parent();
|
||||||
QQuickMenuItem* returnedValue { nullptr };
|
QQuickMenuItem1* returnedValue { nullptr };
|
||||||
// FIXME this needs to find the index of the beforeQml item and call insertItem(int, object)
|
// FIXME this needs to find the index of the beforeQml item and call insertItem(int, object)
|
||||||
bool invokeResult = QMetaObject::invokeMethod(menu, "addItem", Qt::DirectConnection,
|
bool invokeResult = QMetaObject::invokeMethod(menu, "addItem", Qt::DirectConnection,
|
||||||
Q_RETURN_ARG(QQuickMenuItem*, returnedValue),
|
Q_RETURN_ARG(QQuickMenuItem1*, returnedValue),
|
||||||
Q_ARG(QString, action->text()));
|
Q_ARG(QString, action->text()));
|
||||||
Q_ASSERT(invokeResult);
|
Q_ASSERT(invokeResult);
|
||||||
QObject* result = reinterpret_cast<QObject*>(returnedValue); // returnedValue.value<QObject*>();
|
QObject* result = reinterpret_cast<QObject*>(returnedValue); // returnedValue.value<QObject*>();
|
||||||
|
|
|
@ -73,8 +73,7 @@ var toolBar = (function() {
|
||||||
width: toolWidth,
|
width: toolWidth,
|
||||||
height: toolHeight,
|
height: toolHeight,
|
||||||
alpha: 0.9,
|
alpha: 0.9,
|
||||||
visible: true,
|
visible: true
|
||||||
showButtonDown: true
|
|
||||||
});
|
});
|
||||||
|
|
||||||
toolBar.showTool(browseDirectoryButton, true);
|
toolBar.showTool(browseDirectoryButton, true);
|
||||||
|
|
|
@ -130,8 +130,6 @@ Tool = function(properties, selectable, selected) { // selectable and selected a
|
||||||
if (update) {
|
if (update) {
|
||||||
if (selectable) {
|
if (selectable) {
|
||||||
this.toggle();
|
this.toggle();
|
||||||
} else if (properties.showButtonDown) {
|
|
||||||
this.buttonDown(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -56,6 +56,7 @@ public:
|
||||||
explicit FileDownloader(QUrl imageUrl, QObject *parent = 0) : QObject(parent) {
|
explicit FileDownloader(QUrl imageUrl, QObject *parent = 0) : QObject(parent) {
|
||||||
connect(&m_WebCtrl, SIGNAL(finished(QNetworkReply*)), this, SLOT(fileDownloaded(QNetworkReply*)));
|
connect(&m_WebCtrl, SIGNAL(finished(QNetworkReply*)), this, SLOT(fileDownloaded(QNetworkReply*)));
|
||||||
QNetworkRequest request(imageUrl);
|
QNetworkRequest request(imageUrl);
|
||||||
|
request.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true);
|
||||||
m_WebCtrl.get(request);
|
m_WebCtrl.get(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue