From 48e9767a665ef99179fb7c417618c2b798cfbbf0 Mon Sep 17 00:00:00 2001 From: xarkes Date: Sat, 14 Oct 2017 11:45:11 +0200 Subject: [PATCH] Removed RadareWebServer (useless) --- src/MainWindow.cpp | 33 +-------------------- src/MainWindow.h | 5 ---- src/RadareWebServer.cpp | 56 ------------------------------------ src/RadareWebServer.h | 26 ----------------- src/cutter.pro | 2 -- src/widgets/Sidebar.cpp | 5 ---- src/widgets/Sidebar.h | 2 -- src/widgets/Sidebar.ui | 64 +---------------------------------------- 8 files changed, 2 insertions(+), 191 deletions(-) delete mode 100644 src/RadareWebServer.cpp delete mode 100644 src/RadareWebServer.h diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 5416825a..0dc8e662 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -108,8 +108,7 @@ MainWindow::MainWindow(QWidget *parent) : sdbDock(nullptr), sidebar_action(nullptr), sectionsDock(nullptr), - consoleWidget(nullptr), - webserver(core) + consoleWidget(nullptr) { doLock = false; configuration = new Configuration(); @@ -372,7 +371,6 @@ void MainWindow::finalizeOpen() // Add fortune message addOutput("\n" + core->cmd("fo")); //previewDock->setWindowTitle("entry0"); - start_web_server(); showMaximized(); // Initialize syntax highlighters notepadDock->highlightPreview(); @@ -388,30 +386,6 @@ void MainWindow::saveProject() this->addOutput(tr("Project saved: ") + project_name); } -void MainWindow::start_web_server() -{ - // Start web server - webserver.start(); -} - - -void MainWindow::setWebServerState(bool start) -{ - if (start) - { - webserver.start(); - - // Open web interface on default browser - // ballessay: well isn't this possible with =H& - //QString link = "http://localhost:9090/"; - //QDesktopServices::openUrl(QUrl(link)); - } - else - { - webserver.stop(); - } -} - void MainWindow::toggleSideBarTheme() { sideBar->themesButtonToggle(); @@ -744,11 +718,6 @@ void MainWindow::on_actionAssembler_triggered() } } -void MainWindow::on_actionStart_Web_Server_triggered() -{ - setWebServerState(ui->actionStart_Web_Server->isChecked()); -} - void MainWindow::on_actionDisasAdd_comment_triggered() { CommentsDialog *c = new CommentsDialog(this); diff --git a/src/MainWindow.h b/src/MainWindow.h index 7c8a4ef9..87166ceb 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -4,7 +4,6 @@ #include #include #include -#include "RadareWebServer.h" #include "widgets/DisassemblyWidget.h" #include "widgets/SidebarWidget.h" #include "widgets/HexdumpWidget.h" @@ -70,7 +69,6 @@ public: void addOutput(const QString &msg); void addDebugOutput(const QString &msg); void sendToNotepad(const QString &txt); - void setWebServerState(bool start); void toggleSideBarTheme(); void refreshOmniBar(const QStringList &flags); @@ -131,8 +129,6 @@ private slots: void on_actionAssembler_triggered(); - void on_actionStart_Web_Server_triggered(); - void on_actionDisasAdd_comment_triggered(); void restoreDocks(); @@ -209,7 +205,6 @@ private: QAction *sidebar_action; SectionsDock *sectionsDock; ConsoleWidget *consoleWidget; - RadareWebServer webserver; void openProject(const QString &project_name); void openNewFile(const QString &fn, int anal_level, QList advanced); diff --git a/src/RadareWebServer.cpp b/src/RadareWebServer.cpp deleted file mode 100644 index 81f3ae72..00000000 --- a/src/RadareWebServer.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include -#include -#include "cutter.h" -#include "RadareWebServer.h" - -RadareWebServer::RadareWebServer(CutterCore *core) : - core(core), - started(false) -{ - // MEOW -} - -RadareWebServer::~RadareWebServer() -{ -} - -void RadareWebServer::start() -{ - assert(core != nullptr); - - // FIXME: quick & dirty work around to get this in AppImage working - QProcessEnvironment env(QProcessEnvironment::systemEnvironment()); - if (env.contains("APPIMAGE") && env.contains("APPDIR") && env.contains("OWD")) - { - // pretty sure now cutter runs as AppImage - - //QString defaultPath("/usr/share/radare2/1.5.0-git/www"); - QString defaultHttpRoot(core->getConfig("http.root")); - if (defaultHttpRoot.startsWith("/usr")) - { - QString path(QCoreApplication::applicationDirPath()); - path.replace("bin/", defaultHttpRoot.remove("/usr")); - - core->setConfig("http.root", path); - } - } - - if (!started && core != nullptr) - { - // command: see libr/core/rtr.c - core->cmd("=h&"); - core->core()->http_up = R_TRUE; - started = true; - } -} - -void RadareWebServer::stop() -{ - // TODO: =h- waits for ^C -} - -bool RadareWebServer::isStarted() const -{ - return started; -} diff --git a/src/RadareWebServer.h b/src/RadareWebServer.h deleted file mode 100644 index a10e0b43..00000000 --- a/src/RadareWebServer.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef RADARE_WEBSERVER_H -#define RADARE_WEBSERVER_H - -#include -#include - -class CutterCore; - -class RadareWebServer -{ -public: - - explicit RadareWebServer(CutterCore *core); - ~RadareWebServer(); - - void start(); - void stop(); - - bool isStarted() const; - -private: - CutterCore *core; - bool started; -}; - -#endif // RADARE_WEBSERVER_H diff --git a/src/cutter.pro b/src/cutter.pro index 4be129fb..b50ccdae 100644 --- a/src/cutter.pro +++ b/src/cutter.pro @@ -52,7 +52,6 @@ SOURCES += \ dialogs/AsmOptionsDialog.cpp \ dialogs/CreateNewDialog.cpp \ dialogs/NewFileDialog.cpp \ - RadareWebServer.cpp \ AnalThread.cpp \ widgets/CodeGraphic.cpp \ widgets/CommentsWidget.cpp \ @@ -100,7 +99,6 @@ HEADERS += \ dialogs/OptionsDialog.h \ dialogs/CreateNewDialog.h \ dialogs/NewFileDialog.h \ - RadareWebServer.h \ AnalThread.h \ widgets/CodeGraphic.h \ widgets/CommentsWidget.h \ diff --git a/src/widgets/Sidebar.cpp b/src/widgets/Sidebar.cpp index fed68c96..e9c57be8 100644 --- a/src/widgets/Sidebar.cpp +++ b/src/widgets/Sidebar.cpp @@ -53,11 +53,6 @@ void SideBar::on_consoleButton_clicked() } } -void SideBar::on_webServerButton_clicked() -{ - main->setWebServerState(ui->webServerButton->isChecked()); -} - void SideBar::on_lockButton_clicked() { if (ui->lockButton->isChecked()) diff --git a/src/widgets/Sidebar.h b/src/widgets/Sidebar.h index c90c8291..cc705c92 100644 --- a/src/widgets/Sidebar.h +++ b/src/widgets/Sidebar.h @@ -28,8 +28,6 @@ private slots: void on_consoleButton_clicked(); - void on_webServerButton_clicked(); - void on_lockButton_clicked(); void on_themesButton_clicked(); diff --git a/src/widgets/Sidebar.ui b/src/widgets/Sidebar.ui index 5bfc55d0..e2e3d04b 100644 --- a/src/widgets/Sidebar.ui +++ b/src/widgets/Sidebar.ui @@ -104,7 +104,7 @@ border: 3px solid rgb(48, 48, 48); 0 0 226 - 600 + 602 @@ -893,68 +893,6 @@ QToolTip { - - - - Start/Stop web server - - - QToolButton { /* all types of tool button */ - border: 3px solid rgb(105, 105, 105); - border-left: 15px solid rgb(105, 105, 105); - border-right: 15px solid rgb(105, 105, 105); - background-color: rgb(105, 105, 105); - color: rgb(172, 174, 175); - } - -QToolButton:hover { - border: 3px solid #333; - border-left: 15px solid #333; - border-right: 15px solid #333; - border-radius: 0px; - background-color: #333; - } - -QToolButton:pressed { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolButton:checked { - border: 3px solid #2180a9; - border-left: 15px solid #2180a9; - border-right: 15px solid #2180a9; - border-radius: 0px; - background-color: #2180a9; -} - -QToolTip { - background-color: #2180a9; - border: 3px solid #2180a9; - color: rgb(232, 232, 232); -} - - - Web - - - - :/img/icons/cloud_white.svg:/img/icons/cloud_white.svg - - - true - - - true - - - Qt::ToolButtonIconOnly - - -