Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

366 geometry editor map #367

Merged
merged 6 commits into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ else()
endif()
find_file(icudtl NAMES icudtl.dat PATHS "${QT_INSTALL_DIR}/resources/" "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Resources" NO_DEFAULT_PATH)
find_file(qweb_resources NAMES qtwebengine_resources.pak PATHS "${QT_INSTALL_DIR}/resources/" "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Resources" NO_DEFAULT_PATH)
find_file(qweb_resources_devtools NAMES qtwebengine_devtools_resources.pak PATHS "${QT_INSTALL_DIR}/resources/" "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Resources" NO_DEFAULT_PATH)
find_file(qweb_resources_100 NAMES qtwebengine_resources_100p.pak PATHS "${QT_INSTALL_DIR}/resources/" "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Resources" NO_DEFAULT_PATH)
find_file(qweb_resources_200 NAMES qtwebengine_resources_200p.pak PATHS "${QT_INSTALL_DIR}/resources/" "${QT_INSTALL_DIR}/lib/QtWebEngineCore.framework/Resources" NO_DEFAULT_PATH)

Expand Down
2 changes: 2 additions & 0 deletions src/openstudio_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ elseif( UNIX )
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${icudtl} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_devtools} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_100} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_200} $<TARGET_FILE_DIR:${target_name}>/resources/
#COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/translations $<TARGET_FILE_DIR:${target_name}>/translations/
Expand Down Expand Up @@ -270,6 +271,7 @@ elseif( WIN32 )
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${icudtl} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_devtools} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_100} $<TARGET_FILE_DIR:${target_name}>/resources/
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${qweb_resources_200} $<TARGET_FILE_DIR:${target_name}>/resources/
#COMMAND ${CMAKE_COMMAND} -E copy_directory ${QT_INSTALL_DIR}/translations $<TARGET_FILE_DIR:${target_name}>/translations/
Expand Down
16 changes: 16 additions & 0 deletions src/openstudio_lib/OSWebEnginePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,25 @@

#include <QDesktopServices>
#include <QWebEngineCertificateError>
#include <QWebEngineProfile>

namespace openstudio {

OSUrlRequestInterceptor::OSUrlRequestInterceptor(QObject* parent) : QWebEngineUrlRequestInterceptor(parent) {}
OSUrlRequestInterceptor::~OSUrlRequestInterceptor() {}

void OSUrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo& info) {
info.setHttpHeader("Accept-Language", "en-US,en;q=0.9,es;q=0.8,de;q=0.7");
info.setHttpHeader("Access-Control-Allow-Origin", "*");
}

OSWebEnginePage::OSWebEnginePage(QObject* parent) : QWebEnginePage(parent) {
OSUrlRequestInterceptor* interceptor = new OSUrlRequestInterceptor(this->profile());
this->profile()->setUrlRequestInterceptor(interceptor);
}

OSWebEnginePage::~OSWebEnginePage() {}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to free the OSUrlRequestInterceptor*. You should perhaps just use a unique_ptr?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

welllll I guess you do pass this as a parent : OSUrlRequestInterceptor* interceptor = new OSUrlRequestInterceptor(this);...


bool OSWebEnginePage::acceptNavigationRequest(const QUrl& url, QWebEnginePage::NavigationType type, bool isMainFrame) {
if (type == QWebEnginePage::NavigationTypeLinkClicked) {
// QString s = url.toString();
Expand Down
13 changes: 12 additions & 1 deletion src/openstudio_lib/OSWebEnginePage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,28 @@
#define OPENSTUDIO_OSWEBENGINEPAGE_HPP

#include <QWebEnginePage>
#include <QWebEngineUrlRequestInfo>
#include <QWebEngineUrlRequestInterceptor>

#include <openstudio/utilities/core/Logger.hpp>

namespace openstudio {

class OSUrlRequestInterceptor : public QWebEngineUrlRequestInterceptor
{
public:
OSUrlRequestInterceptor(QObject* parent = 0);
virtual ~OSUrlRequestInterceptor();
void interceptRequest(QWebEngineUrlRequestInfo& info) final;
};

class OSWebEnginePage : public QWebEnginePage
{
Q_OBJECT

public:
OSWebEnginePage(QObject* parent = 0) : QWebEnginePage(parent) {}
OSWebEnginePage(QObject* parent = 0);
virtual ~OSWebEnginePage();

protected:
virtual bool certificateError(const QWebEngineCertificateError& certificateError) override;
Expand Down