cg_disasm: fixerinno

This commit is contained in:
Megamouse 2017-07-20 10:24:16 +02:00 committed by Ivan
parent 96dfa9b526
commit f69e252c7a

View File

@ -71,7 +71,7 @@ void cg_disasm_window::ShowContextMenu(const QPoint &pos)
connect(open, &QAction::triggered, [=] {
QString filePath = QFileDialog::getOpenFileName(this, tr("Select Cg program object"), m_path_last, tr("Cg program objects (*.fpo;*.vpo);;"));
if (filePath == NULL) return;
m_path_last = QFileInfo(filePath).path();
m_path_last = filePath;
ShowDisasm();
});
@ -81,6 +81,8 @@ void cg_disasm_window::ShowContextMenu(const QPoint &pos)
void cg_disasm_window::ShowDisasm()
{
xgui_settings->SetValue(GUI::fd_cg_disasm, m_path_last);
if (QFileInfo(m_path_last).isFile())
{
CgBinaryDisasm disasm(sstr(m_path_last));
@ -96,22 +98,23 @@ void cg_disasm_window::ShowDisasm()
bool cg_disasm_window::IsValidFile(const QMimeData& md, bool save)
{
for (auto url : md.urls())
const QList<QUrl> urls = md.urls();
if (urls.count() > 1)
{
for (QString suff : {"fpo", "vpo"})
{
if (QFileInfo(url.fileName()).suffix().toLower() == suff)
return false;
}
const QString suff = QFileInfo(urls[0].fileName()).suffix().toLower();
if (suff == "fpo" || suff == "vpo")
{
if (save)
{
m_path_last = url.toLocalFile();
xgui_settings->SetValue(GUI::fd_cg_disasm, m_path_last);
m_path_last = urls[0].toLocalFile();
}
return true;
}
}
}
return false;
}