diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 24e51c3b..40c770c0 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -1,6 +1,5 @@
#include "MainWindow.h"
#include "ui_MainWindow.h"
-#include "dialogs/CreateNewDialog.h"
#include "dialogs/CommentsDialog.h"
#include "dialogs/AboutDialog.h"
#include "dialogs/RenameDialog.h"
@@ -636,12 +635,6 @@ void MainWindow::on_actionForward_triggered()
core->seekNext();
}
-void MainWindow::on_actionCreate_File_triggered()
-{
- CreateNewDialog *n = new CreateNewDialog(this);
- n->exec();
-}
-
void MainWindow::on_actionDisasAdd_comment_triggered()
{
CommentsDialog *c = new CommentsDialog(this);
diff --git a/src/MainWindow.h b/src/MainWindow.h
index 2e5886d3..8a8859e8 100644
--- a/src/MainWindow.h
+++ b/src/MainWindow.h
@@ -126,8 +126,6 @@ private slots:
void on_actionRefresh_Panels_triggered();
- void on_actionCreate_File_triggered();
-
void on_actionDisasAdd_comment_triggered();
void on_actionDefaut_triggered();
diff --git a/src/MainWindow.ui b/src/MainWindow.ui
index be272e53..b45a609d 100644
--- a/src/MainWindow.ui
+++ b/src/MainWindow.ui
@@ -166,7 +166,7 @@ border-top: 0px;
0
0
1013
- 23
+ 22
@@ -180,8 +180,8 @@ border-top: 0px;
367
185
- 140
- 239
+ 156
+ 206
@@ -646,14 +646,6 @@ QToolButton:pressed {
Default Theme
-
-
- Create file
-
-
- Create file
-
-
Bindiff
diff --git a/src/cutter.pro b/src/cutter.pro
index bada2b20..5f2e05ba 100644
--- a/src/cutter.pro
+++ b/src/cutter.pro
@@ -49,7 +49,6 @@ SOURCES += \
utils/Highlighter.cpp \
utils/MdHighlighter.cpp \
dialogs/AsmOptionsDialog.cpp \
- dialogs/CreateNewDialog.cpp \
dialogs/NewFileDialog.cpp \
AnalThread.cpp \
widgets/CommentsWidget.cpp \
@@ -100,7 +99,6 @@ HEADERS += \
utils/Highlighter.h \
utils/MdHighlighter.h \
dialogs/OptionsDialog.h \
- dialogs/CreateNewDialog.h \
dialogs/NewFileDialog.h \
AnalThread.h \
widgets/CommentsWidget.h \
@@ -143,7 +141,6 @@ FORMS += \
dialogs/NewfileDialog.ui \
dialogs/OptionsDialog.ui \
MainWindow.ui \
- dialogs/CreateNewDialog.ui \
widgets/CommentsWidget.ui \
widgets/ConsoleWidget.ui \
widgets/Dashboard.ui \
diff --git a/src/dialogs/CreateNewDialog.cpp b/src/dialogs/CreateNewDialog.cpp
deleted file mode 100644
index 1e91e935..00000000
--- a/src/dialogs/CreateNewDialog.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-#include
-#include "dialogs/NewFileDialog.h"
-#include "dialogs/CreateNewDialog.h"
-#include "ui_CreateNewDialog.h"
-#include "r_util.h"
-
-CreateNewDialog::CreateNewDialog(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::CreateNewDialog),
- w(new MainWindow),
- core(CutterCore::getInstance())
-{
- ui->setupUi(this);
- setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
-}
-
-CreateNewDialog::~CreateNewDialog() {}
-
-void CreateNewDialog::on_pushButton_2_clicked()
-{
- // Close dialog and open OptionsDialog
- close();
- NewFileDialog *n = new NewFileDialog(nullptr); // TODO: This leaks
- n->show();
-}
-
-void CreateNewDialog::on_pushButton_3_clicked()
-{
- close();
-}
-
-void CreateNewDialog::on_exampleButton_clicked()
-{
- QString type = ui->comboType->currentText();
- QString str;
- if (type == "Assembler")
- {
- str = "; Sample program code\nmov eax, 1\nint 0x80";
- }
- else if (type == "Text")
- {
- str = "Hello World";
- }
- else if (type == "Rapatch")
- {
- str = "; Sample rapatch script\n"
- "0x0 \"Hello World\n"
- "0x10 909090";
- }
- else if (type == "C Code")
- {
- str = "int main() {\n"
- " write (1, \"Hello World\", 12);\n"
- " exit (0);\n"
- "}";
- }
- else if (type == "Radare2 script")
- {
- str = "w Hello\ns+5\nw World";
- }
- else if (type == "Hexpairs")
- {
- str = "48656c6c6f20576f726c6400";
- }
- else fprintf(stderr, "%s", tr("Unknown combo value selected").toLocal8Bit().constData());
- if (str.length() > 0)
- ui->plainTextEdit->setPlainText(str);
- // }
-}
-
-void CreateNewDialog::on_buttonCreate_clicked()
-{
- RCoreLocked lcore = core->core();
- QString type = ui->comboType->currentText();
- QString str;
- bool created = false;
-
- QString arch = ui->comboArch->currentText();
- int fsize = r_num_math(NULL, ui->entrySize->text().toUtf8().constData());
- QString format = ui->comboFormat->currentText();
-
- if (type == "Assembler")
- {
- RAsmCode *code = r_asm_massemble(lcore->assembler, ui->plainTextEdit->toPlainText().toUtf8().constData());
- if (code && code->len > 0)
- {
- char file[32];
- snprintf(file, sizeof(file) - 1, "malloc://%d", code->len);
- if (core->loadFile(file, 0, 0, 1, 0, 0, false))
- {
- created = true;
- r_core_write_at(lcore, 0, code->buf, code->len);
- }
- else
- {
- __alert(tr("Failed to create file"));
- }
- }
- else
- {
- __alert(tr("Invalid assembler code"));
- }
- r_asm_code_free(code);
- }
- else if (type == "Rapatch")
- {
- if (fsize > 0)
- {
- char file[32];
- created = true;
- snprintf(file, sizeof(file) - 1, "malloc://%d", fsize);
- if (core->loadFile(file, 0, 0, 1, 0, 0, false))
- {
- r_core_patch(lcore, ui->plainTextEdit->toPlainText().toUtf8().constData());
- r_core_seek(lcore, 0, 1);
- created = true;
- }
- else
- {
- __alert(tr("Failed to open file"));
- }
- }
- else
- {
- __alert(tr("Invalid file size"));
- }
- }
- else if (type == "C Code")
- {
- __alert("C Code: TODO");
- // ragg2-cc -x
- }
- else if (type == "Radare2 script")
- {
- if (fsize > 0)
- {
- char file[32];
- created = true;
- snprintf(file, sizeof(file) - 1, "malloc://%d", fsize);
- if (core->loadFile(file, 0, 0, 1, 0, 0, false))
- {
- created = true;
- QString str = ui->plainTextEdit->toPlainText();
- QList lines = str.split("\n");
- foreach (QString str, lines)
- {
- core->cmd(str);
- }
- }
- else
- {
- __alert(tr("Failed to open file"));
- }
- }
- else
- {
- __alert(tr("Invalid file size"));
- }
- }
- else if (type == "Text")
- {
- char file[32];
- QByteArray hexpairs = ui->plainTextEdit->toPlainText().toUtf8();
- size_t sz = strlen(hexpairs.constData());
- if (sz > 0)
- {
- snprintf(file, sizeof(file) - 1, "malloc://%d", (int)sz);
- if (core->loadFile(file, 0, 0, 1, 0, 0, false))
- {
- created = true;
- r_core_write_at(lcore, 0, (const ut8 *)hexpairs.constData(), (int)sz);
- }
- else
- {
- __alert(tr("Failed to open file"));
- }
- }
- else
- {
- __alert(tr("Empty string?"));
- }
- }
- else if (type == "Hexpairs")
- {
- char file[32];
- int sz;
- QByteArray hexpairs = ui->plainTextEdit->toPlainText().toUtf8();
- ut8 *buf = (ut8 *)malloc(strlen(hexpairs.constData()) + 1);
- sz = r_hex_str2bin(hexpairs.constData(), buf);
- if (sz > 0)
- {
- snprintf(file, sizeof(file) - 1, "malloc://%d", sz);
- if (core->loadFile(file, 0, 0, 1, 0, 0, false))
- {
- created = true;
- r_core_write_at(lcore, 0, buf, sz);
- }
- else
- {
- __alert(tr("Failed to open file"));
- }
- }
- else
- {
- __alert(tr("Invalid hexpair string"));
- }
- free(buf);
- }
- else
- {
- __alert(tr("Unknown combo value selected"));
- return;
- }
-
- if (format != "Raw")
- {
- __alert("TODO: non-raw fileformat is not yet supported");
- created = false;
- delete core;
- core = nullptr;
- }
-
- if (created)
- {
-
- // Close dialog and open OptionsDialog
- close();
-
- core->seek(0);
- w->refreshAll();
- w->setFilename("-");
- w->addOutput(tr("Finished, check its contents"));
- w->showMaximized();
- }
- else
- {
- __alert(tr("No file created."));
-
- }
-}
diff --git a/src/dialogs/CreateNewDialog.h b/src/dialogs/CreateNewDialog.h
deleted file mode 100644
index 6655827e..00000000
--- a/src/dialogs/CreateNewDialog.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef CREATENEWDIALOG_H
-#define CREATENEWDIALOG_H
-
-#include
-#include "MainWindow.h"
-#include
-
-namespace Ui
-{
- class CreateNewDialog;
-}
-
-class CreateNewDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit CreateNewDialog(QWidget *parent = 0);
- ~CreateNewDialog();
-
-private slots:
- void on_pushButton_2_clicked();
-
- void on_pushButton_3_clicked();
-
- void on_exampleButton_clicked();
-
- void on_buttonCreate_clicked();
-
-private:
- std::unique_ptr ui;
- MainWindow *w;
- CutterCore *core;
-};
-
-#endif // CREATENEWDIALOG_H
diff --git a/src/dialogs/CreateNewDialog.ui b/src/dialogs/CreateNewDialog.ui
deleted file mode 100644
index e8366fdc..00000000
--- a/src/dialogs/CreateNewDialog.ui
+++ /dev/null
@@ -1,482 +0,0 @@
-
-
- CreateNewDialog
-
-
-
- 0
- 0
- 587
- 474
-
-
-
- Dialog
-
-
-
- 5
-
-
- 5
-
-
- 5
-
-
- 5
-
-
- 5
-
- -
-
-
-
-
-
- 5
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- 96
- 96
-
-
-
-
- 96
- 96
-
-
-
-
-
-
- :/img/cutter_plain.svg
-
-
- true
-
-
- Qt::AlignCenter
-
-
- 8
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 15
- 75
- true
-
-
-
- Create new file
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- QFrame::NoFrame
-
-
- QFrame::Plain
-
-
-
- 5
-
-
- 5
-
-
- 5
-
-
- 5
-
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- Architecture:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
- arm
-
-
- -
-
- bf
-
-
- -
-
- dalvik
-
-
- -
-
- dcpu16
-
-
- -
-
- java
-
-
- -
-
- mips
-
-
- -
-
- ppc
-
-
- -
-
- psosvm
-
-
- -
-
- rar
-
-
- -
-
- x86
-
-
- -
-
- z80
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Bits:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 1
-
-
-
-
- 16
-
-
- -
-
- 32
-
-
- -
-
- 64
-
-
-
-
-
-
- -
-
-
- 0
-
-
-
-
-
-
- 0
- 0
-
-
-
- Binary format:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
- Raw
-
-
- -
-
- ELF
-
-
- -
-
- PE
-
-
- -
-
- MACH-0
-
-
- -
-
- COFF
-
-
- -
-
- Plan9
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- File size:
-
-
-
- -
-
-
-
-
-
- 0
-
-
- false
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- 0
-
-
-
-
-
-
- 0
- 0
-
-
-
- Input type:
-
-
-
- -
-
-
- Text
-
-
-
-
- Text
-
-
- -
-
- Hexpairs
-
-
- -
-
- Assembler
-
-
- -
-
- Radare2 script
-
-
- -
-
- Rapatch
-
-
- -
-
- C Code
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Fill the textarea with example code
-
-
- Example
-
-
-
-
-
- -
-
-
- QFrame::NoFrame
-
-
- QFrame::Plain
-
-
-
-
-
-
-
-
-
-
- -
-
-
- 0
-
-
-
-
-
- Close
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Cancel
-
-
- true
-
-
-
- -
-
-
- Create
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/dialogs/NewFileDialog.cpp b/src/dialogs/NewFileDialog.cpp
index 6025c432..a07e98d1 100644
--- a/src/dialogs/NewFileDialog.cpp
+++ b/src/dialogs/NewFileDialog.cpp
@@ -1,5 +1,5 @@
#include "OptionsDialog.h"
-#include "dialogs/CreateNewDialog.h"
+#include "MainWindow.h"
#include "dialogs/NewFileDialog.h"
#include "dialogs/AboutDialog.h"
#include "ui_NewfileDialog.h"
@@ -84,9 +84,6 @@ NewFileDialog::NewFileDialog(QWidget *parent) :
ui->tabWidget->setCurrentWidget(ui->filesTab);
}
- // Hide "create" button until the dialog works
- ui->createButton->hide();
-
ui->loadProjectButton->setEnabled(ui->projectsListWidget->currentItem() != nullptr);
}
@@ -198,14 +195,6 @@ void NewFileDialog::on_actionRemove_item_triggered()
ui->newFileEdit->clear();
}
-void NewFileDialog::on_createButton_clicked()
-{
- // Close dialog and open create new file dialog
- close();
- CreateNewDialog *n = new CreateNewDialog(nullptr);
- n->exec();
-}
-
void NewFileDialog::on_actionClear_all_triggered()
{
// Clear recent file list
diff --git a/src/dialogs/NewFileDialog.h b/src/dialogs/NewFileDialog.h
index 435e730a..cd0e29ea 100644
--- a/src/dialogs/NewFileDialog.h
+++ b/src/dialogs/NewFileDialog.h
@@ -21,7 +21,6 @@ public:
private slots:
void on_loadFileButton_clicked();
void on_selectFileButton_clicked();
- void on_createButton_clicked();
void on_selectProjectsDirButton_clicked();
void on_loadProjectButton_clicked();
diff --git a/src/dialogs/NewfileDialog.ui b/src/dialogs/NewfileDialog.ui
index d0c11373..682ac77d 100644
--- a/src/dialogs/NewfileDialog.ui
+++ b/src/dialogs/NewfileDialog.ui
@@ -231,13 +231,6 @@
- -
-
-
- Create
-
-
-
-
@@ -401,7 +394,7 @@
-
-
+
10
@@ -415,26 +408,26 @@
- -
-
-
- Qt::Horizontal
-
-
-
- 500
- 20
-
-
-
-
- -
-
-
- About
-
-
-
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 500
+ 20
+
+
+
+
+ -
+
+
+ About
+
+
+
-
@@ -470,9 +463,6 @@
1
-
-
-
-
+