2018-06-20 09:24:28 +00:00
|
|
|
#include "OpenFileDialog.h"
|
|
|
|
#include "ui_OpenFileDialog.h"
|
|
|
|
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
|
|
|
OpenFileDialog::OpenFileDialog(QWidget *parent):
|
|
|
|
QDialog(parent),
|
|
|
|
ui(new Ui::OpenFileDialog)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
OpenFileDialog::~OpenFileDialog() {}
|
|
|
|
|
|
|
|
void OpenFileDialog::on_selectFileButton_clicked()
|
|
|
|
{
|
|
|
|
QString fileName = QFileDialog::getOpenFileName(this, tr("Select file"), QDir::homePath());
|
|
|
|
|
|
|
|
if (!fileName.isEmpty()) {
|
|
|
|
ui->filenameLineEdit->setText(fileName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OpenFileDialog::on_buttonBox_accepted()
|
|
|
|
{
|
2018-11-02 06:48:17 +00:00
|
|
|
const QString &filePath = QDir::toNativeSeparators(ui->filenameLineEdit->text());
|
2018-06-20 09:24:28 +00:00
|
|
|
RVA mapAddress = RVA_INVALID;
|
|
|
|
QString mapAddressStr = ui->mapAddressLineEdit->text();
|
2018-11-02 06:48:17 +00:00
|
|
|
if (!mapAddressStr.isEmpty()) {
|
2018-06-20 09:24:28 +00:00
|
|
|
mapAddress = Core()->math(mapAddressStr);
|
|
|
|
}
|
|
|
|
Core()->openFile(filePath, mapAddress);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OpenFileDialog::on_buttonBox_rejected()
|
|
|
|
{
|
|
|
|
close();
|
|
|
|
}
|