Removed RadareWebServer (useless)

This commit is contained in:
xarkes 2017-10-14 11:45:11 +02:00
parent e54b0ee106
commit 48e9767a66
8 changed files with 2 additions and 191 deletions

View File

@ -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);

View File

@ -4,7 +4,6 @@
#include <QMainWindow>
#include <QList>
#include <memory>
#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<QString> advanced);

View File

@ -1,56 +0,0 @@
#include <QCoreApplication>
#include <QProcessEnvironment>
#include <cassert>
#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;
}

View File

@ -1,26 +0,0 @@
#ifndef RADARE_WEBSERVER_H
#define RADARE_WEBSERVER_H
#include <QThread>
#include <QMutex>
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

View File

@ -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 \

View File

@ -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())

View File

@ -28,8 +28,6 @@ private slots:
void on_consoleButton_clicked();
void on_webServerButton_clicked();
void on_lockButton_clicked();
void on_themesButton_clicked();

View File

@ -104,7 +104,7 @@ border: 3px solid rgb(48, 48, 48);</string>
<x>0</x>
<y>0</y>
<width>226</width>
<height>600</height>
<height>602</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -893,68 +893,6 @@ QToolTip {
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="webServerButton">
<property name="toolTip">
<string notr="true">Start/Stop web server</string>
</property>
<property name="styleSheet">
<string notr="true">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);
}</string>
</property>
<property name="text">
<string notr="true">Web</string>
</property>
<property name="icon">
<iconset resource="../resources.qrc">
<normaloff>:/img/icons/cloud_white.svg</normaloff>:/img/icons/cloud_white.svg</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="refreshButton">
<property name="toolTip">