"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/core/MainWindow.cpp" between
cutter-1.10.2.tar.gz and cutter-1.10.3.tar.gz

About: cutter is a Qt and C++ GUI for radare2 reverse engineering framework.

MainWindow.cpp  (cutter-1.10.2):MainWindow.cpp  (cutter-1.10.3)
skipping to change at line 16 skipping to change at line 16
#include "common/Highlighter.h" #include "common/Highlighter.h"
#include "common/HexAsciiHighlighter.h" #include "common/HexAsciiHighlighter.h"
#include "common/Helpers.h" #include "common/Helpers.h"
#include "common/SvgIconEngine.h" #include "common/SvgIconEngine.h"
#include "common/ProgressIndicator.h" #include "common/ProgressIndicator.h"
#include "common/TempConfig.h" #include "common/TempConfig.h"
#include "common/RunScriptTask.h" #include "common/RunScriptTask.h"
#include "common/PythonManager.h" #include "common/PythonManager.h"
#include "plugins/PluginManager.h" #include "plugins/PluginManager.h"
#include "CutterConfig.h" #include "CutterConfig.h"
#include "CutterApplication.h"
// Dialogs // Dialogs
#include "dialogs/WelcomeDialog.h" #include "dialogs/WelcomeDialog.h"
#include "dialogs/NewFileDialog.h" #include "dialogs/NewFileDialog.h"
#include "dialogs/InitialOptionsDialog.h" #include "dialogs/InitialOptionsDialog.h"
#include "dialogs/SaveProjectDialog.h" #include "dialogs/SaveProjectDialog.h"
#include "dialogs/CommentsDialog.h" #include "dialogs/CommentsDialog.h"
#include "dialogs/AboutDialog.h" #include "dialogs/AboutDialog.h"
#include "dialogs/RenameDialog.h" #include "dialogs/RenameDialog.h"
#include "dialogs/preferences/PreferencesDialog.h" #include "dialogs/preferences/PreferencesDialog.h"
#include "dialogs/OpenFileDialog.h" #include "dialogs/MapFileDialog.h"
#include "dialogs/AsyncTaskDialog.h" #include "dialogs/AsyncTaskDialog.h"
// Widgets Headers // Widgets Headers
#include "widgets/DisassemblerGraphView.h" #include "widgets/DisassemblerGraphView.h"
#include "widgets/GraphView.h" #include "widgets/GraphView.h"
#include "widgets/GraphWidget.h" #include "widgets/GraphWidget.h"
#include "widgets/OverviewWidget.h" #include "widgets/OverviewWidget.h"
#include "widgets/OverviewView.h" #include "widgets/OverviewView.h"
#include "widgets/FunctionsWidget.h" #include "widgets/FunctionsWidget.h"
#include "widgets/SectionsWidget.h" #include "widgets/SectionsWidget.h"
skipping to change at line 142 skipping to change at line 143
{ {
ui->setupUi(this); ui->setupUi(this);
// Initialize context menu extensions for plugins // Initialize context menu extensions for plugins
disassemblyContextMenuExtensions = new QMenu(tr("Plugins"), this); disassemblyContextMenuExtensions = new QMenu(tr("Plugins"), this);
addressableContextMenuExtensions = new QMenu(tr("Plugins"), this); addressableContextMenuExtensions = new QMenu(tr("Plugins"), this);
connect(ui->actionExtraGraph, &QAction::triggered, this, &MainWindow::addExt raGraph); connect(ui->actionExtraGraph, &QAction::triggered, this, &MainWindow::addExt raGraph);
connect(ui->actionExtraDisassembly, &QAction::triggered, this, &MainWindow:: addExtraDisassembly); connect(ui->actionExtraDisassembly, &QAction::triggered, this, &MainWindow:: addExtraDisassembly);
connect(ui->actionExtraHexdump, &QAction::triggered, this, &MainWindow::addE xtraHexdump); connect(ui->actionExtraHexdump, &QAction::triggered, this, &MainWindow::addE xtraHexdump);
connect(ui->actionCommitChanges, &QAction::triggered, this, [this]() {
Core()->commitWriteCache();
});
ui->actionCommitChanges->setEnabled(false);
connect(Core(), &CutterCore::ioCacheChanged, ui->actionCommitChanges, &QActi
on::setEnabled);
widgetTypeToConstructorMap.insert(GraphWidget::getWidgetType(), getNewInstan ce<GraphWidget>); widgetTypeToConstructorMap.insert(GraphWidget::getWidgetType(), getNewInstan ce<GraphWidget>);
widgetTypeToConstructorMap.insert(DisassemblyWidget::getWidgetType(), getNew Instance<DisassemblyWidget>); widgetTypeToConstructorMap.insert(DisassemblyWidget::getWidgetType(), getNew Instance<DisassemblyWidget>);
widgetTypeToConstructorMap.insert(HexdumpWidget::getWidgetType(), getNewInst ance<HexdumpWidget>); widgetTypeToConstructorMap.insert(HexdumpWidget::getWidgetType(), getNewInst ance<HexdumpWidget>);
initToolBar(); initToolBar();
initDocks(); initDocks();
emptyState = saveState(); emptyState = saveState();
/* /*
skipping to change at line 530 skipping to change at line 536
if (skipOptionsDialog) { if (skipOptionsDialog) {
o->setupAndStartAnalysis(); o->setupAndStartAnalysis();
} else { } else {
o->show(); o->show();
} }
} }
void MainWindow::openProject(const QString &project_name) void MainWindow::openProject(const QString &project_name)
{ {
QString filename = core->cmd("Pi " + project_name); QString filename = core->cmdRaw("Pi " + project_name);
setFilename(filename.trimmed()); setFilename(filename.trimmed());
core->openProject(project_name); core->openProject(project_name);
finalizeOpen(); finalizeOpen();
} }
void MainWindow::finalizeOpen() void MainWindow::finalizeOpen()
{ {
core->getOpcodes(); core->getOpcodes();
core->updateSeek(); core->updateSeek();
refreshAll(); refreshAll();
// Add fortune message // Add fortune message
core->message("\n" + core->cmd("fo")); core->message("\n" + core->cmdRaw("fo"));
showMaximized(); showMaximized();
Config()->adjustColorThemeDarkness();
QSettings s; QSettings s;
QStringList unsync = s.value("unsync").toStringList(); QStringList unsync = s.value("unsync").toStringList();
for (auto it : dockWidgets) { for (auto it : dockWidgets) {
auto w = qobject_cast<MemoryDockWidget*>(it); auto w = qobject_cast<MemoryDockWidget*>(it);
if (w) { if (w) {
w->getSeekable()->setSynchronization(!unsync.contains(it->objectName ())); w->getSeekable()->setSynchronization(!unsync.contains(it->objectName ()));
} }
} }
skipping to change at line 623 skipping to change at line 630
void MainWindow::setFilename(const QString &fn) void MainWindow::setFilename(const QString &fn)
{ {
// Add file name to window title // Add file name to window title
this->filename = fn; this->filename = fn;
this->setWindowTitle(APPNAME" – " + fn); this->setWindowTitle(APPNAME" – " + fn);
} }
void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::closeEvent(QCloseEvent *event)
{ {
// Check if there are uncommitted changes
if (core->isIOCacheEnabled() && !core->cmdj("wcj").array().isEmpty()) {
QMessageBox::StandardButton ret = QMessageBox::question(this, APPNAME,
tr("It seems tha
t you have changes or patches that are not committed to the file.\n"
"Do you want to
commit them now?"),
(QMessageBox::St
andardButtons)(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel));
if (ret == QMessageBox::Cancel) {
event->ignore();
return;
}
if (ret == QMessageBox::Save) {
core->commitWriteCache();
}
}
QMessageBox::StandardButton ret = QMessageBox::question(this, APPNAME, QMessageBox::StandardButton ret = QMessageBox::question(this, APPNAME,
tr("Do you really wa nt to exit?\nSave your project before closing!"), tr("Do you really wa nt to exit?\nSave your project before closing!"),
(QMessageBox::Standa rdButtons)(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel)); (QMessageBox::Standa rdButtons)(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel));
if (ret == QMessageBox::Cancel) { if (ret == QMessageBox::Cancel) {
event->ignore(); event->ignore();
return; return;
} }
if (ret == QMessageBox::Save && !saveProject(true)) { if (ret == QMessageBox::Save && !saveProject(true)) {
event->ignore(); event->ignore();
skipping to change at line 1326 skipping to change at line 1351
} }
} }
/** /**
* @brief MainWindow::on_actionNew_triggered * @brief MainWindow::on_actionNew_triggered
* Open a new Cutter session. * Open a new Cutter session.
*/ */
void MainWindow::on_actionNew_triggered() void MainWindow::on_actionNew_triggered()
{ {
// Create a new Cutter process // Create a new Cutter process
QProcess process(this); static_cast<CutterApplication*>(qApp)->launchNewInstance();
process.setEnvironment(QProcess::systemEnvironment());
process.startDetached(qApp->applicationFilePath());
} }
void MainWindow::on_actionSave_triggered() void MainWindow::on_actionSave_triggered()
{ {
saveProject(); saveProject();
} }
void MainWindow::on_actionSaveAs_triggered() void MainWindow::on_actionSaveAs_triggered()
{ {
saveProjectAs(); saveProjectAs();
skipping to change at line 1370 skipping to change at line 1393
taskDialog->setAttribute(Qt::WA_DeleteOnClose); taskDialog->setAttribute(Qt::WA_DeleteOnClose);
taskDialog->show(); taskDialog->show();
Core()->getAsyncTaskManager()->start(runScriptTaskPtr); Core()->getAsyncTaskManager()->start(runScriptTaskPtr);
} }
/** /**
* @brief MainWindow::on_actionOpen_triggered * @brief MainWindow::on_actionOpen_triggered
* Open a file as in "load (add) a file in current session". * Open a file as in "load (add) a file in current session".
*/ */
void MainWindow::on_actionOpen_triggered() void MainWindow::on_actionMap_triggered()
{ {
OpenFileDialog dialog(this); MapFileDialog dialog(this);
dialog.exec(); dialog.exec();
} }
void MainWindow::toggleResponsive(bool maybe) void MainWindow::toggleResponsive(bool maybe)
{ {
this->responsive = maybe; this->responsive = maybe;
// Save options in settings // Save options in settings
QSettings settings; QSettings settings;
settings.setValue("responsive", this->responsive); settings.setValue("responsive", this->responsive);
} }
skipping to change at line 1528 skipping to change at line 1551
QFile file(dialog.selectedFiles()[0]); QFile file(dialog.selectedFiles()[0]);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
qWarning() << "Can't open file"; qWarning() << "Can't open file";
return; return;
} }
TempConfig tempConfig; TempConfig tempConfig;
tempConfig.set("io.va", false); tempConfig.set("io.va", false);
QTextStream fileOut(&file); QTextStream fileOut(&file);
QString &cmd = cmdMap[dialog.selectedNameFilter()]; QString &cmd = cmdMap[dialog.selectedNameFilter()];
// Use cmd because cmdRaw would not handle such input
fileOut << Core()->cmd(cmd + " $s @ 0"); fileOut << Core()->cmd(cmd + " $s @ 0");
} }
void MainWindow::on_actionGrouped_dock_dragging_triggered(bool checked) void MainWindow::on_actionGrouped_dock_dragging_triggered(bool checked)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
auto options = dockOptions(); auto options = dockOptions();
options.setFlag(QMainWindow::DockOption::GroupedDragging, checked); options.setFlag(QMainWindow::DockOption::GroupedDragging, checked);
setDockOptions(options); setDockOptions(options);
#else #else
 End of changes. 11 change blocks. 
8 lines changed or deleted 37 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)