From d790ad69dfb7fe6b158e9a9038d1e98af7e484ae Mon Sep 17 00:00:00 2001 From: Hugo Teso Date: Wed, 5 Apr 2017 16:03:36 +0200 Subject: [PATCH] Sync switch theme with graph view. Still has bugs --- src/html/graph/lib/css/graph_dark.css | 2 +- src/widgets/memwidget/memorywidget.cpp | 13 +++++++++++++ src/widgets/memwidget/memorywidget.h | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/html/graph/lib/css/graph_dark.css b/src/html/graph/lib/css/graph_dark.css index bd50b8ba..af6051ad 100644 --- a/src/html/graph/lib/css/graph_dark.css +++ b/src/html/graph/lib/css/graph_dark.css @@ -35,7 +35,7 @@ .ec_gui_cflow {color: rgb(255,255,0);} .ec_gui_dataoffset {color: rgb(127,127,0);} .ec_gui_background {background-color: rgb(255,255,255); } -.ec_gui_alt_background {background-color: rgb(50, 50, 50); } +.ec_gui_alt_background {background-color: rgb(64, 64, 64); } .ec_gui_border {border-color: rgb(0, 0, 0); } .autohighlight { background-color: #8AFF77 !important; } diff --git a/src/widgets/memwidget/memorywidget.cpp b/src/widgets/memwidget/memorywidget.cpp index b87a0519..096cbdfb 100644 --- a/src/widgets/memwidget/memorywidget.cpp +++ b/src/widgets/memwidget/memorywidget.cpp @@ -167,6 +167,8 @@ MemoryWidget::MemoryWidget(MainWindow *main, QWidget *parent) : // Control Disasm and Hex scroll to add more contents 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))); } /* @@ -1720,3 +1722,14 @@ void MemoryWidget::seek_back() { //this->main->add_debug_output("Back!"); this->main->on_backButton_clicked(); } + +void MemoryWidget::frameLoadFinished(bool ok) { + //qDebug() << "LOAD FRAME: " << ok; + if (ok) { + QSettings settings; + if (settings.value("dark").toBool()) { + QString js = "r2ui.graph_panel.set_theme('dark');"; + qDebug() << ui->graphWebView->page()->mainFrame()->evaluateJavaScript(js); + } + } +} diff --git a/src/widgets/memwidget/memorywidget.h b/src/widgets/memwidget/memorywidget.h index 6684228a..8b300ad0 100644 --- a/src/widgets/memwidget/memorywidget.h +++ b/src/widgets/memwidget/memorywidget.h @@ -82,6 +82,8 @@ public slots: void selectHexPreview(); + void frameLoadFinished(bool ok); + protected: bool eventFilter(QObject *obj, QEvent *event) override;