Skip to content
Permalink
Browse files

Dropped QtWebEngine

  • Loading branch information...
Dax89 committed Apr 4, 2019
1 parent e8de985 commit 711f330bae0e6642e0c41a8d45b19166c7170e1d
@@ -28,8 +28,6 @@ endif()
find_package(Qt5Core CONFIG REQUIRED)
find_package(Qt5Gui CONFIG REQUIRED)
find_package(Qt5Widgets CONFIG REQUIRED)
find_package(Qt5WebEngine CONFIG REQUIRED)
find_package(Qt5WebEngineWidgets CONFIG REQUIRED)
find_package(Git)

if(GIT_FOUND)
@@ -45,6 +43,7 @@ endif()
set(REDASM_BUILD_VERSION "${REDASM_BUILD_TIMESTAMP}.${REDASM_GIT_VERSION}")
add_definitions(-DREDASM_VERSION="${REDASM_BUILD_VERSION}")


add_subdirectory(LibREDasm)
add_subdirectory(QHexView)

@@ -130,8 +129,6 @@ target_link_libraries(${PROJECT_NAME}
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::WebEngine
Qt5::WebEngineWidgets
LibREDasm)

if(WIN32)
@@ -104,9 +104,6 @@ See [COMPILE.md](COMPILE.md) (for Windows and Linux).
- [MiniZ](https://github.com/richgel999/miniz) : ZLib's drop in replacement
- [Capstone](https://github.com/aquynh/capstone) : Capstone provides the most common architectures
- [JSON](https://github.com/nlohmann/json): A single header library for JSON
- [D3](https://github.com/d3/d3): Used by QtWebEngine for Graph Rendering
- [Dagre](https://github.com/dagrejs/dagre): Used for Graph Layout
- [Dagre-D3](https://github.com/dagrejs/dagre-d3): Graph Layout Rendering with D3
- [UndName](https://github.com/wine-mirror/wine/blob/master/dlls/msvcrt/undname.c): MSVC Demangler
- [Libiberty](https://github.com/bminor/binutils-gdb/tree/master/libiberty): Binutils Demangler
- [Visit-Struct](https://github.com/cbeck88/visit_struct): C++ Reflection
@@ -1,7 +1,6 @@
#include "mainwindow.h"
#include "themeprovider.h"
#include <QApplication>
#include <QtWebEngine>
#include <QStyleFactory>
#include "redasmsettings.h"

@@ -24,8 +23,6 @@ int main(int argc, char *argv[])
a.setApplicationName("redasm");
a.setApplicationDisplayName("REDasm 2.1-" + QString::fromUtf8(REDASM_VERSION));

QtWebEngine::initialize();

REDasmSettings::setDefaultFormat(REDasmSettings::IniFormat);
ThemeProvider::applyTheme();
MainWindow w;
@@ -7,16 +7,13 @@
#include "redasmsettings.h"
#include "themeprovider.h"
#include <redasm/database/database.h>
#include <QWebEngineSettings>
#include <QWebEngineProfile>
#include <QtWidgets>
#include <QtCore>
#include <QtGui>

MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->configureWebEngine();

REDasm::ContextSettings ctxsettings;
ctxsettings.tempPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation).toStdString();
@@ -459,20 +456,6 @@ void MainWindow::setViewWidgetsVisible(bool b)
ui->dockListingMap->setVisible(b);
}

void MainWindow::configureWebEngine()
{
QWebEngineProfile* profile = QWebEngineProfile::defaultProfile();
profile->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
profile->setHttpCacheType(QWebEngineProfile::NoCache);

QWebEngineSettings* settings = profile->settings();
settings->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, false);
settings->setAttribute(QWebEngineSettings::LocalStorageEnabled, false);
settings->setAttribute(QWebEngineSettings::XSSAuditingEnabled, false);
settings->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
settings->setAttribute(QWebEngineSettings::AutoLoadIconsForPage, false);
}

void MainWindow::onAboutClicked()
{
AboutDialog dlgabout(this);
@@ -1,19 +1,4 @@
#include "listinggraphrenderer.h"
#include "listingrenderercommon.h"
#include <QTextDocument>

ListingGraphRenderer::ListingGraphRenderer(REDasm::DisassemblerAPI *disassembler): REDasm::ListingRenderer(disassembler)
{
this->setFlags(ListingGraphRenderer::HideSegmentName);
}

void ListingGraphRenderer::renderLine(const REDasm::RendererLine &rl)
{
QTextDocument* textdocument = static_cast<QTextDocument*>(rl.userdata);
ListingRendererCommon lrc(textdocument, m_document);

if(!rl.index)
lrc.insertHtmlText(rl);
else
lrc.insertHtmlLine(rl);
}
ListingGraphRenderer::ListingGraphRenderer(REDasm::DisassemblerAPI *disassembler): ListingPopupRenderer(disassembler) { this->setFlags(ListingGraphRenderer::HideSegmentName); }
@@ -1,15 +1,12 @@
#ifndef LISTINGGRAPHRENDERER_H
#define LISTINGGRAPHRENDERER_H

#include <redasm/disassembler/listing/listingrenderer.h>
#include "listingpopuprenderer.h"

class ListingGraphRenderer: public REDasm::ListingRenderer
class ListingGraphRenderer: public ListingPopupRenderer
{
public:
ListingGraphRenderer(REDasm::DisassemblerAPI* disassembler);

protected:
virtual void renderLine(const REDasm::RendererLine& rl);
};

#endif // LISTINGGRAPHRENDERER_H
@@ -10,10 +10,12 @@

ListingTextRenderer::ListingTextRenderer(const QFont &font, REDasm::DisassemblerAPI *disassembler): REDasm::ListingRenderer(disassembler), m_font(font), m_fontmetrics(font), m_firstline(0), m_cursoractive(false)
{
m_maxwidth = 0;
m_rgxwords.setPattern(REDASM_WORD_REGEX);
m_textoption.setWrapMode(QTextOption::NoWrap);
}

int ListingTextRenderer::maxWidth() const { return m_maxwidth; }
void ListingTextRenderer::setFirstVisibleLine(u64 line) { m_firstline = line; }

REDasm::ListingCursor::Position ListingTextRenderer::hitTest(const QPointF &pos, int firstline)
@@ -25,7 +27,7 @@ REDasm::ListingCursor::Position ListingTextRenderer::hitTest(const QPointF &pos,
REDasm::RendererLine rl;

if(!this->getRendererLine(cp.first, rl))
cp.second = 0;
cp.second = 0;

std::string s = rl.text;

@@ -74,6 +76,13 @@ void ListingTextRenderer::renderLine(const REDasm::RendererLine &rl)
textdocument.setDefaultTextOption(m_textoption);
textdocument.setDefaultFont(m_font);

QFontMetrics fm(textdocument.defaultFont());

if(rl.index > 0)
m_maxwidth = std::max(m_maxwidth, fm.boundingRect(QString::fromStdString(rl.text)).width());
else
m_maxwidth = fm.boundingRect(QString::fromStdString(rl.text)).width();

ListingRendererCommon lrc(&textdocument, m_document);
lrc.insertText(rl, m_cursoractive);

@@ -15,6 +15,7 @@ class ListingTextRenderer: public REDasm::ListingRenderer
public:
ListingTextRenderer(const QFont& font, REDasm::DisassemblerAPI* disassembler);
virtual ~ListingTextRenderer() = default;
int maxWidth() const;
void setFirstVisibleLine(u64 line);

public:
@@ -36,6 +37,7 @@ class ListingTextRenderer: public REDasm::ListingRenderer
QTextOption m_textoption;
QRegularExpression m_rgxwords;
u64 m_firstline;
int m_maxwidth;
bool m_cursoractive;
};

@@ -26,11 +26,4 @@
<file>res/dark/save.png</file>
<file>res/logo_big_dark.png</file>
</qresource>
<qresource prefix="/web">
<file alias="d3.js">web/d3.v5.min.js</file>
<file alias="dagre-d3.js">web/dagre-d3.min.js</file>
<file alias="dagre.js">web/dagre.min.js</file>
<file alias="graph.html">web/graph.html</file>
<file alias="graph.js">web/graph.js</file>
</qresource>
</RCC>

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.

0 comments on commit 711f330

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