call init() to draw graph after loading index.html

This commit is contained in:
Alvaro Muñoz 2017-04-23 01:47:02 +02:00
parent 78737c3f7b
commit 4572fec9b3
2 changed files with 3 additions and 9 deletions

View File

@ -20,8 +20,7 @@
<script type="text/javascript" src="qrc:/graph/html/graph/lib/js/jquery-1.9.0.js"></script> <script type="text/javascript" src="qrc:/graph/html/graph/lib/js/jquery-1.9.0.js"></script>
<script type="text/javascript" src="qrc:/graph/html/graph/lib/js/graph_panel.js"></script> <script type="text/javascript" src="qrc:/graph/html/graph/lib/js/graph_panel.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready( function() { function init() {
// Load r2 settings (TODO: Do we need this?) // Load r2 settings (TODO: Do we need this?)
r2.load_settings(); r2.load_settings();
@ -31,7 +30,7 @@
r2ui.graph_panel.init_handlers(); r2ui.graph_panel.init_handlers();
//r2ui.graph_panel.init_context_menu(); //r2ui.graph_panel.init_context_menu();
r2ui.graph_panel.render("light"); r2ui.graph_panel.render("light");
}); }
</script> </script>
</head> </head>
<body style="margin: 0px"> <body style="margin: 0px">

View File

@ -1510,12 +1510,6 @@ void MemoryWidget::fillOffsetInfo(QString off)
void MemoryWidget::create_graph(QString off) void MemoryWidget::create_graph(QString off)
{ {
// No Cache enabled in 5.7
// ui->graphWebView->page()->profile()->setHttpCacheType(QWebEngineProfile::NoCache);
// force reload by first loading a blank page
// this is a workaround since it shows a white glitch
ui->graphWebView->setUrl(QUrl("about:blank"));
ui->graphWebView->setZoomFactor(0.85); ui->graphWebView->setZoomFactor(0.85);
this->main->add_debug_output("Graph Offset: '" + off + "'"); this->main->add_debug_output("Graph Offset: '" + off + "'");
if (off == "") if (off == "")
@ -1527,6 +1521,7 @@ void MemoryWidget::create_graph(QString off)
ui->graphWebView->setUrl(QUrl("qrc:/graph/html/graph/index.html#" + off)); ui->graphWebView->setUrl(QUrl("qrc:/graph/html/graph/index.html#" + off));
QString port = this->main->core->config("http.port"); QString port = this->main->core->config("http.port");
ui->graphWebView->page()->runJavaScript(QString("r2.root=\"http://localhost:%1\"").arg(port)); ui->graphWebView->page()->runJavaScript(QString("r2.root=\"http://localhost:%1\"").arg(port));
ui->graphWebView->page()->runJavaScript(QString("init();"));
} }
QString MemoryWidget::normalize_addr(QString addr) QString MemoryWidget::normalize_addr(QString addr)