diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 7e032138..9720ad95 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -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()) - { - dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures); - } - ui->actionLockUnlock->setIcon(QIcon(":/lock")); - } - else - { - foreach (QDockWidget *dockWidget, findChildren()) - { - 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()) + { + dockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures); + } + ui->actionLockUnlock->setIcon(QIcon(":/lock")); + } + else + { + foreach (QDockWidget *dockWidget, findChildren()) + { + 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); } diff --git a/src/MainWindow.h b/src/MainWindow.h index 45abe1d9..4dad9c7e 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -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: diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 63105692..0db596b8 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -166,7 +166,7 @@ border-top: 0px; 0 0 1013 - 23 + 20 @@ -178,17 +178,19 @@ border-top: 0px; - 273 - 133 - 140 - 239 + 346 + 97 + 148 + 215 File - + + + @@ -206,7 +208,7 @@ border-top: 0px; - + @@ -312,7 +314,7 @@ QToolButton:pressed { - + Reset Layout @@ -351,7 +353,7 @@ QToolButton:pressed { Documentation - + Open @@ -1028,6 +1030,11 @@ QToolButton:pressed { Classes + + + Import PDB + +