mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-20 13:46:06 +00:00
Rename OpenFileDialog to MapFileDialog
This commit is contained in:
parent
e7691eb956
commit
f789337f45
@ -369,7 +369,7 @@ SOURCES += \
|
||||
widgets/ThreadsWidget.cpp \
|
||||
widgets/ProcessesWidget.cpp \
|
||||
widgets/BacktraceWidget.cpp \
|
||||
dialogs/OpenFileDialog.cpp \
|
||||
dialogs/MapFileDialog.cpp \
|
||||
common/CommandTask.cpp \
|
||||
common/ProgressIndicator.cpp \
|
||||
common/R2Task.cpp \
|
||||
@ -509,7 +509,7 @@ HEADERS += \
|
||||
widgets/ThreadsWidget.h \
|
||||
widgets/ProcessesWidget.h \
|
||||
widgets/BacktraceWidget.h \
|
||||
dialogs/OpenFileDialog.h \
|
||||
dialogs/MapFileDialog.h \
|
||||
common/StringsTask.h \
|
||||
common/FunctionsTask.h \
|
||||
common/CommandTask.h \
|
||||
@ -614,7 +614,7 @@ FORMS += \
|
||||
widgets/ThreadsWidget.ui \
|
||||
widgets/ProcessesWidget.ui \
|
||||
widgets/BacktraceWidget.ui \
|
||||
dialogs/OpenFileDialog.ui \
|
||||
dialogs/MapFileDialog.ui \
|
||||
dialogs/preferences/DebugOptionsWidget.ui \
|
||||
widgets/BreakpointWidget.ui \
|
||||
dialogs/BreakpointsDialog.ui \
|
||||
|
@ -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 mapaddr Map Address
|
||||
* @return bool
|
||||
*/
|
||||
bool CutterCore::openFile(QString path, RVA mapaddr)
|
||||
bool CutterCore::mapFile(QString path, RVA mapaddr)
|
||||
{
|
||||
CORE_LOCK();
|
||||
RVA addr = mapaddr != RVA_INVALID ? mapaddr : 0;
|
||||
|
@ -247,7 +247,7 @@ public:
|
||||
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());
|
||||
bool tryFile(QString path, bool rw);
|
||||
bool openFile(QString path, RVA mapaddr);
|
||||
bool mapFile(QString path, RVA mapaddr);
|
||||
void loadScript(const QString &scriptname);
|
||||
QJsonArray getOpenedFiles();
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "dialogs/AboutDialog.h"
|
||||
#include "dialogs/RenameDialog.h"
|
||||
#include "dialogs/preferences/PreferencesDialog.h"
|
||||
#include "dialogs/OpenFileDialog.h"
|
||||
#include "dialogs/MapFileDialog.h"
|
||||
#include "dialogs/AsyncTaskDialog.h"
|
||||
|
||||
// Widgets Headers
|
||||
@ -1395,7 +1395,7 @@ void MainWindow::on_actionRun_Script_triggered()
|
||||
*/
|
||||
void MainWindow::on_actionMap_triggered()
|
||||
{
|
||||
OpenFileDialog dialog(this);
|
||||
MapFileDialog dialog(this);
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,20 @@
|
||||
#include "OpenFileDialog.h"
|
||||
#include "ui_OpenFileDialog.h"
|
||||
#include "MapFileDialog.h"
|
||||
#include "ui_MapFileDialog.h"
|
||||
|
||||
#include "common/Configuration.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
OpenFileDialog::OpenFileDialog(QWidget *parent):
|
||||
MapFileDialog::MapFileDialog(QWidget *parent):
|
||||
QDialog(parent),
|
||||
ui(new Ui::OpenFileDialog)
|
||||
ui(new Ui::MapFileDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
OpenFileDialog::~OpenFileDialog() {}
|
||||
MapFileDialog::~MapFileDialog() {}
|
||||
|
||||
void OpenFileDialog::on_selectFileButton_clicked()
|
||||
void MapFileDialog::on_selectFileButton_clicked()
|
||||
{
|
||||
QString currentDir = Config()->getRecentFolder();
|
||||
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());
|
||||
RVA mapAddress = RVA_INVALID;
|
||||
@ -34,14 +34,14 @@ void OpenFileDialog::on_buttonBox_accepted()
|
||||
mapAddress = Core()->math(mapAddressStr);
|
||||
}
|
||||
|
||||
if (!Core()->openFile(filePath, mapAddress)) {
|
||||
QMessageBox::critical(this, tr("Open file"), tr("Failed to open file"));
|
||||
if (!Core()->mapFile(filePath, mapAddress)) {
|
||||
QMessageBox::critical(this, tr("Map new file file"), tr("Failed to map a new file"));
|
||||
return;
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
void OpenFileDialog::on_buttonBox_rejected()
|
||||
void MapFileDialog::on_buttonBox_rejected()
|
||||
{
|
||||
close();
|
||||
}
|
29
src/dialogs/MapFileDialog.h
Normal file
29
src/dialogs/MapFileDialog.h
Normal 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
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OpenFileDialog</class>
|
||||
<widget class="QDialog" name="OpenFileDialog">
|
||||
<class>MapFileDialog</class>
|
||||
<widget class="QDialog" name="MapFileDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Open file</string>
|
||||
<string>Map New File</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
@ -90,7 +90,7 @@
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>OpenFileDialog</receiver>
|
||||
<receiver>MapFileDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
@ -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
|
Loading…
Reference in New Issue
Block a user