UT 0.20.7

- added "Open in new window..." action
This commit is contained in:
Nikolaj Schlej 2015-08-13 20:28:10 +02:00
parent 1109e44379
commit 63e5a4dd1c
4 changed files with 34 additions and 3 deletions

View File

@ -17,7 +17,7 @@
UEFITool::UEFITool(QWidget *parent) : UEFITool::UEFITool(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::UEFITool), ui(new Ui::UEFITool),
version(tr("0.20.6")) version(tr("0.20.7"))
{ {
clipboard = QApplication::clipboard(); clipboard = QApplication::clipboard();
@ -31,6 +31,7 @@ version(tr("0.20.6"))
// Connect signals to slots // Connect signals to slots
connect(ui->actionOpenImageFile, SIGNAL(triggered()), this, SLOT(openImageFile())); connect(ui->actionOpenImageFile, SIGNAL(triggered()), this, SLOT(openImageFile()));
connect(ui->actionOpenImageFileInNewWindow, SIGNAL(triggered()), this, SLOT(openImageFileInNewWindow()));
connect(ui->actionSaveImageFile, SIGNAL(triggered()), this, SLOT(saveImageFile())); connect(ui->actionSaveImageFile, SIGNAL(triggered()), this, SLOT(saveImageFile()));
connect(ui->actionSearch, SIGNAL(triggered()), this, SLOT(search())); connect(ui->actionSearch, SIGNAL(triggered()), this, SLOT(search()));
connect(ui->actionExtract, SIGNAL(triggered()), this, SLOT(extractAsIs())); connect(ui->actionExtract, SIGNAL(triggered()), this, SLOT(extractAsIs()));
@ -83,6 +84,11 @@ UEFITool::~UEFITool()
delete searchDialog; delete searchDialog;
} }
void UEFITool::setProgramPath(QString path)
{
currentProgramPath = path;
};
void UEFITool::init() void UEFITool::init()
{ {
// Clear components // Clear components
@ -358,6 +364,8 @@ void UEFITool::replace(const UINT8 mode)
path = QFileDialog::getOpenFileName(this, tr("Select volume file to replace body"), currentDir, "Volume files (*.vol *.bin);;All files (*)"); path = QFileDialog::getOpenFileName(this, tr("Select volume file to replace body"), currentDir, "Volume files (*.vol *.bin);;All files (*)");
else if (model->subtype(index) == EFI_SECTION_RAW) else if (model->subtype(index) == EFI_SECTION_RAW)
path = QFileDialog::getOpenFileName(this, tr("Select raw file to replace body"), currentDir, "Raw files (*.raw *.bin);;All files (*)"); path = QFileDialog::getOpenFileName(this, tr("Select raw file to replace body"), currentDir, "Raw files (*.raw *.bin);;All files (*)");
else if (model->subtype(index) == EFI_SECTION_PE32 || model->subtype(index) == EFI_SECTION_TE || model->subtype(index) == EFI_SECTION_PIC)
path = QFileDialog::getOpenFileName(this, tr("Select EFI executable file to replace body"), currentDir, "EFI executable files (*.efi *.dxe *.pei *.bin);;All files (*)");
else else
path = QFileDialog::getOpenFileName(this, tr("Select file to replace body"), currentDir, "Binary files (*.bin);;All files (*)"); path = QFileDialog::getOpenFileName(this, tr("Select file to replace body"), currentDir, "Binary files (*.bin);;All files (*)");
} }
@ -521,7 +529,7 @@ void UEFITool::exit()
void UEFITool::saveImageFile() void UEFITool::saveImageFile()
{ {
QString path = QFileDialog::getSaveFileName(this, tr("Save BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.efi *.dec);;All files (*)"); QString path = QFileDialog::getSaveFileName(this, tr("Save BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.dec);;All files (*)");
if (path.isEmpty()) if (path.isEmpty())
return; return;
@ -552,10 +560,16 @@ void UEFITool::saveImageFile()
void UEFITool::openImageFile() void UEFITool::openImageFile()
{ {
QString path = QFileDialog::getOpenFileName(this, tr("Open BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.efi *.dec);;All files (*)"); QString path = QFileDialog::getOpenFileName(this, tr("Open BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.dec);;All files (*)");
openImageFile(path); openImageFile(path);
} }
void UEFITool::openImageFileInNewWindow()
{
QString path = QFileDialog::getOpenFileName(this, tr("Open BIOS image file in new window"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.dec);;All files (*)");
QProcess::startDetached(currentProgramPath, QStringList(path));
}
void UEFITool::openImageFile(QString path) void UEFITool::openImageFile(QString path)
{ {
if (path.trimmed().isEmpty()) if (path.trimmed().isEmpty())

View File

@ -27,6 +27,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QMimeData> #include <QMimeData>
#include <QPlainTextEdit> #include <QPlainTextEdit>
#include <QProcess>
#include <QSettings> #include <QSettings>
#include <QSplitter> #include <QSplitter>
#include <QString> #include <QString>
@ -51,6 +52,7 @@ public:
~UEFITool(); ~UEFITool();
void openImageFile(QString path); void openImageFile(QString path);
void setProgramPath(QString path);
private slots: private slots:
void init(); void init();
@ -58,6 +60,7 @@ public:
void scrollTreeView(QListWidgetItem* item); void scrollTreeView(QListWidgetItem* item);
void openImageFile(); void openImageFile();
void openImageFileInNewWindow();
void saveImageFile(); void saveImageFile();
void search(); void search();
@ -95,6 +98,7 @@ private:
SearchDialog* searchDialog; SearchDialog* searchDialog;
QClipboard* clipboard; QClipboard* clipboard;
QString currentDir; QString currentDir;
QString currentProgramPath;
QQueue<MessageListItem> messageItems; QQueue<MessageListItem> messageItems;
const QString version; const QString version;

View File

@ -188,6 +188,7 @@
<string>&amp;File</string> <string>&amp;File</string>
</property> </property>
<addaction name="actionOpenImageFile"/> <addaction name="actionOpenImageFile"/>
<addaction name="actionOpenImageFileInNewWindow"/>
<addaction name="actionSaveImageFile"/> <addaction name="actionSaveImageFile"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionSearch"/> <addaction name="actionSearch"/>
@ -522,6 +523,17 @@
<string>Ctrl+Alt+C</string> <string>Ctrl+Alt+C</string>
</property> </property>
</action> </action>
<action name="actionOpenImageFileInNewWindow">
<property name="text">
<string>&amp;Open image file in new window...</string>
</property>
<property name="toolTip">
<string>Open image file in new window</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+O</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources/> <resources/>

View File

@ -23,6 +23,7 @@ int main(int argc, char *argv[])
a.setApplicationName("UEFITool"); a.setApplicationName("UEFITool");
UEFITool w; UEFITool w;
w.setProgramPath(a.arguments().at(0));
if (a.arguments().length() > 1) if (a.arguments().length() > 1)
w.openImageFile(a.arguments().at(1)); w.openImageFile(a.arguments().at(1));
w.show(); w.show();