From eae419ef3b2177cb1d50a1fea474b0bfeafce32e Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Wed, 12 Apr 2017 18:49:01 +0200 Subject: [PATCH] compile and work on qt 5.6 (this needs testing!) (#123) * compile and work on qt 5.6 (this needs testing!) * updated travis * updated r2 * sync submodules wtf * updated CMake files --- .travis.yml | 4 ++-- src/CMakeLists.txt | 4 ++-- src/iaito.pro | 3 +-- src/widgets/dashboard.ui | 8 ++++---- src/widgets/memorywidget.cpp | 19 ++++++++++--------- src/widgets/memorywidget.h | 6 +++--- src/widgets/memorywidget.ui | 12 ++++++------ 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 779a434d..1cefdf24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,11 @@ sudo: require dist: trusty before_install: - - sudo add-apt-repository ppa:beineri/opt-qt532-trusty -y + - sudo add-apt-repository ppa:beineri/opt-qt562-trusty -y - sudo apt-get update -qq install: - - sudo apt-get -y install qt53base qt53webkit-examples + - sudo apt-get -y install qt56base qt56webengine - source /opt/qt5*/bin/qt5*-env.sh script: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 71c41cda..c6c2d6ac 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,7 +11,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) -find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui WebKit WebKitWidgets) +find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui WebEngine WebEngineWidgets) if(WIN32) @@ -137,5 +137,5 @@ add_definitions("-DAPP_VERSION=\"${IAITO_VERSION_FULL}\"") add_executable(iaito ${UI_FILES} ${QRC_FILES} ${SOURCE_FILES} ${HEADER_FILES}) -qt5_use_modules(iaito Core Widgets Gui WebKit WebKitWidgets) +qt5_use_modules(iaito Core Widgets Gui WebEngine WebEngineWidgets) target_link_libraries(iaito ${RADARE2_LIBRARIES}) diff --git a/src/iaito.pro b/src/iaito.pro index e4991231..6c4798cf 100644 --- a/src/iaito.pro +++ b/src/iaito.pro @@ -11,8 +11,7 @@ win32 { ICON = img/Enso.icns -QT += core gui webkit webkitwidgets -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +QT += core gui widgets webengine webenginewidgets QT_CONFIG -= no-pkg-config diff --git a/src/widgets/dashboard.ui b/src/widgets/dashboard.ui index 8c4b9595..52abebc4 100644 --- a/src/widgets/dashboard.ui +++ b/src/widgets/dashboard.ui @@ -1055,7 +1055,7 @@ QTabBar::tab:hover { 0 - + 0 @@ -1104,7 +1104,7 @@ QTabBar::tab:hover { 0 - + 0 @@ -1187,9 +1187,9 @@ QTabBar::tab:hover { - QWebView + QWebEngineView QWidget -
QtWebKitWidgets/QWebView
+
QtWebEngineWidgets/QWebEngineView
diff --git a/src/widgets/memorywidget.cpp b/src/widgets/memorywidget.cpp index 15b29138..6b7e0e0d 100644 --- a/src/widgets/memorywidget.cpp +++ b/src/widgets/memorywidget.cpp @@ -11,10 +11,11 @@ #include #include #include -#include +#include #include #include #include +#include MemoryWidget::MemoryWidget(MainWindow *main) : QDockWidget(main), @@ -69,17 +70,17 @@ MemoryWidget::MemoryWidget(MainWindow *main) : graph_bar->setVisible(false); // Hide graph webview scrollbars - ui->graphWebView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); - ui->graphWebView->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); + ui->graphWebView->page()->runJavaScript("document.body.style.overflow='hidden';"); // Allows the local resources (qrc://) to access http content - if (!ui->graphWebView->settings()->testAttribute(QWebSettings::LocalContentCanAccessRemoteUrls)) + if (!ui->graphWebView->settings()->testAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls)) { - ui->graphWebView->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, true); + ui->graphWebView->settings()->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls, true); } // Debug console - QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); + // For QWebEngine debugging see: https://doc.qt.io/qt-5/qtwebengine-debugging.html + //QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); // Add margin to function name line edit ui->fcnNameEdit->setTextMargins(5, 0, 0, 0); @@ -184,7 +185,7 @@ MemoryWidget::MemoryWidget(MainWindow *main) : connect(this->disasTextEdit->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(disasmScrolled())); connect(this->hexASCIIText->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(hexScrolled())); - connect(ui->graphWebView->page()->mainFrame(), SIGNAL(loadFinished(bool)), this, SLOT(frameLoadFinished(bool))); + connect(ui->graphWebView->page(), SIGNAL(loadFinished(bool)), this, SLOT(frameLoadFinished(bool))); } /* @@ -1520,7 +1521,7 @@ void MemoryWidget::create_graph(QString off) ui->graphWebView->setUrl(QUrl("qrc:/graph/html/graph/index.html#" + off)); QString port = this->main->core->config("http.port"); - ui->graphWebView->page()->mainFrame()->evaluateJavaScript(QString("r2.root=\"http://localhost:" + port + "\"")); + ui->graphWebView->page()->runJavaScript(QString("r2.root=\"http://localhost:%1\"").arg(port)); } QString MemoryWidget::normalize_addr(QString addr) @@ -1929,7 +1930,7 @@ void MemoryWidget::frameLoadFinished(bool ok) if (settings.value("dark").toBool()) { QString js = "r2ui.graph_panel.render('dark');"; - ui->graphWebView->page()->mainFrame()->evaluateJavaScript(js); + ui->graphWebView->page()->runJavaScript(js); } } } diff --git a/src/widgets/memorywidget.h b/src/widgets/memorywidget.h index 6a97e4ce..307917cc 100644 --- a/src/widgets/memorywidget.h +++ b/src/widgets/memorywidget.h @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -40,8 +40,8 @@ public: QTreeWidget *xrefToTreeWidget_2; QTreeWidget *xreFromTreeWidget_2; QTabWidget *memTabWidget; - QWebView *graphWebView; - QWebView *histoWebView; + QWebEngineView *graphWebView; + QWebEngineView *histoWebView; Highlighter *highlighter; Highlighter *highlighter_5; diff --git a/src/widgets/memorywidget.ui b/src/widgets/memorywidget.ui index 03713d18..414318dd 100644 --- a/src/widgets/memorywidget.ui +++ b/src/widgets/memorywidget.ui @@ -933,7 +933,7 @@ QToolTip { 0 - + 0 @@ -1229,7 +1229,7 @@ p, li { white-space: pre-wrap; } 0 - + Qt::DefaultContextMenu @@ -1629,7 +1629,7 @@ QToolTip { 0 - + 0 @@ -1678,7 +1678,7 @@ QToolTip { 0 - + 0 @@ -3036,9 +3036,9 @@ QToolTip { - QWebView + QWebEngineView QWidget -
QtWebKitWidgets/QWebView
+
QtWebEngineWidgets/QWebEngineView