Added PDB import menu (Fix #82)

This commit is contained in:
xarkes 2018-01-16 15:09:51 +01:00
parent 90915134f5
commit 0ade622a4f
3 changed files with 111 additions and 82 deletions

View File

@ -476,12 +476,6 @@ void MainWindow::refreshAll()
Core()->triggerRefreshAll();
}
void MainWindow::on_actionLock_triggered()
{
panelLock = !panelLock;
setPanelLock();
}
void MainWindow::lockUnlock_Docks(bool what)
{
if (what)
@ -501,43 +495,6 @@ void MainWindow::lockUnlock_Docks(bool what)
}
void MainWindow::on_actionLockUnlock_triggered()
{
if (ui->actionLockUnlock->isChecked())
{
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
{
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
}
ui->actionLockUnlock->setIcon(QIcon(":/lock"));
}
else
{
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
{
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
}
ui->actionLockUnlock->setIcon(QIcon(":/unlock"));
}
}
void MainWindow::on_actionTabs_triggered()
{
tabsOnTop = !tabsOnTop;
setTabLocation();
}
void MainWindow::on_actionAbout_triggered()
{
AboutDialog *a = new AboutDialog(this);
a->open();
}
void MainWindow::on_actionRefresh_Panels_triggered()
{
this->refreshAll();
}
void MainWindow::toggleDockWidget(QDockWidget *dock_widget, bool show)
{
if (!show)
@ -556,18 +513,6 @@ void MainWindow::backButton_clicked()
core->seekPrev();
}
void MainWindow::on_actionForward_triggered()
{
core->seekNext();
}
void MainWindow::on_actionDisasAdd_comment_triggered()
{
CommentsDialog *c = new CommentsDialog(this);
c->exec();
delete c;
}
void MainWindow::restoreDocks()
{
// In the upper half the functions are the first widget
@ -671,24 +616,11 @@ void MainWindow::resetToDefaultLayout()
Core()->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Disassembly);
}
void MainWindow::on_actionDefaut_triggered()
{
resetToDefaultLayout();
}
void MainWindow::sendToNotepad(const QString &txt)
{
core->setNotes(core->getNotes() + "```\n" + txt + "\n```");
}
void MainWindow::on_actionFunctionsRename_triggered()
{
RenameDialog *r = new RenameDialog(this);
// Get function based on click position
//r->setFunctionName(fcn_name);
r->open();
}
void MainWindow::addOutput(const QString &msg)
{
consoleDock->addOutput(msg);
@ -700,9 +632,48 @@ void MainWindow::addDebugOutput(const QString &msg)
consoleDock->addDebugOutput(msg);
}
void MainWindow::on_actionLock_triggered()
{
panelLock = !panelLock;
setPanelLock();
}
void MainWindow::on_actionLockUnlock_triggered()
{
if (ui->actionLockUnlock->isChecked())
{
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
{
dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
}
ui->actionLockUnlock->setIcon(QIcon(":/lock"));
}
else
{
foreach (QDockWidget *dockWidget, findChildren<QDockWidget *>())
{
dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
}
ui->actionLockUnlock->setIcon(QIcon(":/unlock"));
}
}
void MainWindow::on_actionFunctionsRename_triggered()
{
RenameDialog *r = new RenameDialog(this);
// Get function based on click position
//r->setFunctionName(fcn_name);
r->open();
}
void MainWindow::on_actionDefault_triggered()
{
resetToDefaultLayout();
}
void MainWindow::on_actionNew_triggered()
{
on_actionLoad_triggered();
on_actionOpen_triggered();
}
void MainWindow::on_actionSave_triggered()
@ -739,7 +710,7 @@ void MainWindow::on_actionRun_Script_triggered()
this->core->cmd(". " + fileName);
}
void MainWindow::on_actionLoad_triggered()
void MainWindow::on_actionOpen_triggered()
{
QProcess process(this);
process.setEnvironment(QProcess::systemEnvironment());
@ -776,6 +747,18 @@ void MainWindow::on_actionQuit_triggered()
close();
}
void MainWindow::on_actionForward_triggered()
{
core->seekNext();
}
void MainWindow::on_actionDisasAdd_comment_triggered()
{
CommentsDialog *c = new CommentsDialog(this);
c->exec();
delete c;
}
void MainWindow::on_actionRefresh_contents_triggered()
{
refreshAll();
@ -787,7 +770,44 @@ void MainWindow::on_actionPreferences_triggered()
dialog->show();
}
void MainWindow::on_actionTabs_triggered()
{
tabsOnTop = !tabsOnTop;
setTabLocation();
}
void MainWindow::on_actionAbout_triggered()
{
AboutDialog *a = new AboutDialog(this);
a->open();
}
void MainWindow::on_actionRefresh_Panels_triggered()
{
this->refreshAll();
}
void MainWindow::on_actionImportPDB_triggered()
{
QFileDialog dialog(this);
dialog.setWindowTitle(tr("Select PDB file"));
dialog.setNameFilters({ tr("PDB file (*.pdb)"), tr("All files (*)") });
if (!dialog.exec())
{
return;
}
QString pdbFile = dialog.selectedFiles().first();
if (!pdbFile.isEmpty())
{
Core()->loadPDB(pdbFile);
addOutput(tr("%1 loaded.").arg(pdbFile));
}
}
void MainWindow::projectSaved(const QString &name)
{
this->addOutput(tr("Project saved: ") + name);
addOutput(tr("Project saved: ") + name);
}

View File

@ -111,7 +111,7 @@ private slots:
void on_actionDisasAdd_comment_triggered();
void on_actionDefaut_triggered();
void on_actionDefault_triggered();
void on_actionFunctionsRename_triggered();
@ -123,7 +123,7 @@ private slots:
void on_actionUndoSeek_triggered();
void on_actionRedoSeek_triggered();
void on_actionLoad_triggered();
void on_actionOpen_triggered();
void on_actionForward_triggered();
@ -137,6 +137,8 @@ private slots:
void on_actionPreferences_triggered();
void on_actionImportPDB_triggered();
void projectSaved(const QString &name);
private:

View File

@ -166,7 +166,7 @@ border-top: 0px;
<x>0</x>
<y>0</y>
<width>1013</width>
<height>23</height>
<height>20</height>
</rect>
</property>
<property name="defaultUp">
@ -178,17 +178,19 @@ border-top: 0px;
<widget class="QMenu" name="menuFile">
<property name="geometry">
<rect>
<x>273</x>
<y>133</y>
<width>140</width>
<height>239</height>
<x>346</x>
<y>97</y>
<width>148</width>
<height>215</height>
</rect>
</property>
<property name="title">
<string>File</string>
</property>
<addaction name="actionNew"/>
<addaction name="actionLoad"/>
<addaction name="actionOpen"/>
<addaction name="separator"/>
<addaction name="actionImportPDB"/>
<addaction name="separator"/>
<addaction name="actionSave"/>
<addaction name="actionSaveAs"/>
@ -206,7 +208,7 @@ border-top: 0px;
</property>
<addaction name="actionRefresh_contents"/>
<addaction name="separator"/>
<addaction name="actionDefaut"/>
<addaction name="actionDefault"/>
<addaction name="actionReset_settings"/>
<addaction name="separator"/>
<addaction name="actionLock"/>
@ -312,7 +314,7 @@ QToolButton:pressed {
</attribute>
<addaction name="actionForward"/>
</widget>
<action name="actionDefaut">
<action name="actionDefault">
<property name="text">
<string>Reset Layout</string>
</property>
@ -351,7 +353,7 @@ QToolButton:pressed {
<string>Documentation</string>
</property>
</action>
<action name="actionLoad">
<action name="actionOpen">
<property name="text">
<string>Open</string>
</property>
@ -1028,6 +1030,11 @@ QToolButton:pressed {
<string>Classes</string>
</property>
</action>
<action name="actionImportPDB">
<property name="text">
<string>Import PDB</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>