Rename OpenFileDialog to MapFileDialog

This commit is contained in:
itayc0hen 2020-04-07 16:20:52 +03:00 committed by Itay Cohen
parent e7691eb956
commit f789337f45
8 changed files with 51 additions and 51 deletions

View File

@ -369,7 +369,7 @@ SOURCES += \
widgets/ThreadsWidget.cpp \ widgets/ThreadsWidget.cpp \
widgets/ProcessesWidget.cpp \ widgets/ProcessesWidget.cpp \
widgets/BacktraceWidget.cpp \ widgets/BacktraceWidget.cpp \
dialogs/OpenFileDialog.cpp \ dialogs/MapFileDialog.cpp \
common/CommandTask.cpp \ common/CommandTask.cpp \
common/ProgressIndicator.cpp \ common/ProgressIndicator.cpp \
common/R2Task.cpp \ common/R2Task.cpp \
@ -509,7 +509,7 @@ HEADERS += \
widgets/ThreadsWidget.h \ widgets/ThreadsWidget.h \
widgets/ProcessesWidget.h \ widgets/ProcessesWidget.h \
widgets/BacktraceWidget.h \ widgets/BacktraceWidget.h \
dialogs/OpenFileDialog.h \ dialogs/MapFileDialog.h \
common/StringsTask.h \ common/StringsTask.h \
common/FunctionsTask.h \ common/FunctionsTask.h \
common/CommandTask.h \ common/CommandTask.h \
@ -614,7 +614,7 @@ FORMS += \
widgets/ThreadsWidget.ui \ widgets/ThreadsWidget.ui \
widgets/ProcessesWidget.ui \ widgets/ProcessesWidget.ui \
widgets/BacktraceWidget.ui \ widgets/BacktraceWidget.ui \
dialogs/OpenFileDialog.ui \ dialogs/MapFileDialog.ui \
dialogs/preferences/DebugOptionsWidget.ui \ dialogs/preferences/DebugOptionsWidget.ui \
widgets/BreakpointWidget.ui \ widgets/BreakpointWidget.ui \
dialogs/BreakpointsDialog.ui \ dialogs/BreakpointsDialog.ui \

View File

@ -605,12 +605,12 @@ bool CutterCore::tryFile(QString path, bool rw)
} }
/** /**
* @brief Opens a file using r2 API * @brief Maps a file using r2 API
* @param path Path to file * @param path Path to file
* @param mapaddr Map Address * @param mapaddr Map Address
* @return bool * @return bool
*/ */
bool CutterCore::openFile(QString path, RVA mapaddr) bool CutterCore::mapFile(QString path, RVA mapaddr)
{ {
CORE_LOCK(); CORE_LOCK();
RVA addr = mapaddr != RVA_INVALID ? mapaddr : 0; RVA addr = mapaddr != RVA_INVALID ? mapaddr : 0;

View File

@ -247,7 +247,7 @@ public:
bool loadFile(QString path, ut64 baddr = 0LL, ut64 mapaddr = 0LL, int perms = R_PERM_R, bool loadFile(QString path, ut64 baddr = 0LL, ut64 mapaddr = 0LL, int perms = R_PERM_R,
int va = 0, bool loadbin = false, const QString &forceBinPlugin = QString()); int va = 0, bool loadbin = false, const QString &forceBinPlugin = QString());
bool tryFile(QString path, bool rw); bool tryFile(QString path, bool rw);
bool openFile(QString path, RVA mapaddr); bool mapFile(QString path, RVA mapaddr);
void loadScript(const QString &scriptname); void loadScript(const QString &scriptname);
QJsonArray getOpenedFiles(); QJsonArray getOpenedFiles();

View File

@ -23,7 +23,7 @@
#include "dialogs/AboutDialog.h" #include "dialogs/AboutDialog.h"
#include "dialogs/RenameDialog.h" #include "dialogs/RenameDialog.h"
#include "dialogs/preferences/PreferencesDialog.h" #include "dialogs/preferences/PreferencesDialog.h"
#include "dialogs/OpenFileDialog.h" #include "dialogs/MapFileDialog.h"
#include "dialogs/AsyncTaskDialog.h" #include "dialogs/AsyncTaskDialog.h"
// Widgets Headers // Widgets Headers
@ -1395,7 +1395,7 @@ void MainWindow::on_actionRun_Script_triggered()
*/ */
void MainWindow::on_actionMap_triggered() void MainWindow::on_actionMap_triggered()
{ {
OpenFileDialog dialog(this); MapFileDialog dialog(this);
dialog.exec(); dialog.exec();
} }

View File

@ -1,20 +1,20 @@
#include "OpenFileDialog.h" #include "MapFileDialog.h"
#include "ui_OpenFileDialog.h" #include "ui_MapFileDialog.h"
#include "common/Configuration.h" #include "common/Configuration.h"
#include <QFileDialog> #include <QFileDialog>
OpenFileDialog::OpenFileDialog(QWidget *parent): MapFileDialog::MapFileDialog(QWidget *parent):
QDialog(parent), QDialog(parent),
ui(new Ui::OpenFileDialog) ui(new Ui::MapFileDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
} }
OpenFileDialog::~OpenFileDialog() {} MapFileDialog::~MapFileDialog() {}
void OpenFileDialog::on_selectFileButton_clicked() void MapFileDialog::on_selectFileButton_clicked()
{ {
QString currentDir = Config()->getRecentFolder(); QString currentDir = Config()->getRecentFolder();
QString fileName = QFileDialog::getOpenFileName(this, tr("Select file"), currentDir); QString fileName = QFileDialog::getOpenFileName(this, tr("Select file"), currentDir);
@ -25,7 +25,7 @@ void OpenFileDialog::on_selectFileButton_clicked()
} }
} }
void OpenFileDialog::on_buttonBox_accepted() void MapFileDialog::on_buttonBox_accepted()
{ {
const QString &filePath = QDir::toNativeSeparators(ui->filenameLineEdit->text()); const QString &filePath = QDir::toNativeSeparators(ui->filenameLineEdit->text());
RVA mapAddress = RVA_INVALID; RVA mapAddress = RVA_INVALID;
@ -34,14 +34,14 @@ void OpenFileDialog::on_buttonBox_accepted()
mapAddress = Core()->math(mapAddressStr); mapAddress = Core()->math(mapAddressStr);
} }
if (!Core()->openFile(filePath, mapAddress)) { if (!Core()->mapFile(filePath, mapAddress)) {
QMessageBox::critical(this, tr("Open file"), tr("Failed to open file")); QMessageBox::critical(this, tr("Map new file file"), tr("Failed to map a new file"));
return; return;
} }
close(); close();
} }
void OpenFileDialog::on_buttonBox_rejected() void MapFileDialog::on_buttonBox_rejected()
{ {
close(); close();
} }

View File

@ -0,0 +1,29 @@
#ifndef MAPFILEDIALOG_H
#define MAPFILEDIALOG_H
#include <QDialog>
#include <memory>
#include "core/Cutter.h"
namespace Ui {
class MapFileDialog;
}
class MapFileDialog : public QDialog
{
Q_OBJECT
public:
explicit MapFileDialog(QWidget *parent = nullptr);
~MapFileDialog();
private slots:
void on_selectFileButton_clicked();
void on_buttonBox_accepted();
void on_buttonBox_rejected();
private:
std::unique_ptr<Ui::MapFileDialog> ui;
};
#endif // MAPFILEDIALOG_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>OpenFileDialog</class> <class>MapFileDialog</class>
<widget class="QDialog" name="OpenFileDialog"> <widget class="QDialog" name="MapFileDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -11,7 +11,7 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Open file</string> <string>Map New File</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
@ -90,7 +90,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>OpenFileDialog</receiver> <receiver>MapFileDialog</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">

View File

@ -1,29 +0,0 @@
#ifndef OPENFILEDIALOG_H
#define OPENFILEDIALOG_H
#include <QDialog>
#include <memory>
#include "core/Cutter.h"
namespace Ui {
class OpenFileDialog;
}
class OpenFileDialog : public QDialog
{
Q_OBJECT
public:
explicit OpenFileDialog(QWidget *parent = nullptr);
~OpenFileDialog();
private slots:
void on_selectFileButton_clicked();
void on_buttonBox_accepted();
void on_buttonBox_rejected();
private:
std::unique_ptr<Ui::OpenFileDialog> ui;
};
#endif // OPENFILEDIALOG_H