mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 19:36:11 +00:00
Save layout of the Decompiler Widgets (#2410)
* Create decompiler widgets when loading a layout * Do not translate the dock widget names used for saving layout.
This commit is contained in:
parent
691de14853
commit
d7ef6e9e91
@ -157,6 +157,8 @@ void MainWindow::initUI()
|
||||
widgetTypeToConstructorMap.insert(DisassemblyWidget::getWidgetType(),
|
||||
getNewInstance<DisassemblyWidget>);
|
||||
widgetTypeToConstructorMap.insert(HexdumpWidget::getWidgetType(), getNewInstance<HexdumpWidget>);
|
||||
widgetTypeToConstructorMap.insert(DecompilerWidget::getWidgetType(),
|
||||
getNewInstance<DecompilerWidget>);
|
||||
|
||||
initToolBar();
|
||||
initDocks();
|
||||
@ -654,7 +656,12 @@ void MainWindow::finalizeOpen()
|
||||
auto disasmWidget = qobject_cast<DisassemblyWidget *>(dockWidget);
|
||||
if (disasmWidget && dockWidget->isVisibleToUser()) {
|
||||
disasmWidget->raiseMemoryWidget();
|
||||
// continue looping in case there is a graph wiget
|
||||
// continue looping in case there is a graph widget
|
||||
}
|
||||
auto decompilerWidget = qobject_cast<DecompilerWidget *>(dockWidget);
|
||||
if (decompilerWidget && dockWidget->isVisibleToUser()) {
|
||||
decompilerWidget->raiseMemoryWidget();
|
||||
// continue looping in case there is a graph widget
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -885,7 +892,8 @@ bool MainWindow::isExtraMemoryWidget(QDockWidget *dock) const
|
||||
{
|
||||
return qobject_cast<GraphWidget*>(dock) ||
|
||||
qobject_cast<HexdumpWidget*>(dock) ||
|
||||
qobject_cast<DisassemblyWidget*>(dock);
|
||||
qobject_cast<DisassemblyWidget*>(dock) ||
|
||||
qobject_cast<DecompilerWidget*>(dock);
|
||||
}
|
||||
|
||||
MemoryWidgetType MainWindow::getMemoryWidgetTypeToRestore()
|
||||
@ -1341,7 +1349,8 @@ void MainWindow::setViewLayout(const CutterLayout &layout)
|
||||
docksToCreate = QStringList {
|
||||
DisassemblyWidget::getWidgetType(),
|
||||
GraphWidget::getWidgetType(),
|
||||
HexdumpWidget::getWidgetType()
|
||||
HexdumpWidget::getWidgetType(),
|
||||
DecompilerWidget::getWidgetType()
|
||||
};
|
||||
} else {
|
||||
docksToCreate = layout.viewProperties.keys();
|
||||
|
@ -34,8 +34,8 @@ DecompilerWidget::DecompilerWidget(MainWindow *main) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setObjectName(main
|
||||
? main->getUniqueObjectName(tr("Decompiler"))
|
||||
: tr("Decompiler"));
|
||||
? main->getUniqueObjectName(getWidgetType())
|
||||
: getWidgetType());
|
||||
updateWindowTitle();
|
||||
|
||||
syntaxHighlighter = Config()->createSyntaxHighlighter(ui->textEdit->document());
|
||||
@ -108,6 +108,11 @@ DecompilerWidget::DecompilerWidget(MainWindow *main) :
|
||||
|
||||
DecompilerWidget::~DecompilerWidget() = default;
|
||||
|
||||
QString DecompilerWidget::getWidgetType()
|
||||
{
|
||||
return "Decompiler";
|
||||
}
|
||||
|
||||
Decompiler *DecompilerWidget::getCurrentDecompiler()
|
||||
{
|
||||
return Core()->getDecompilerById(ui->decompilerComboBox->currentData().toString());
|
||||
|
@ -27,6 +27,7 @@ protected:
|
||||
public:
|
||||
explicit DecompilerWidget(MainWindow *main);
|
||||
~DecompilerWidget();
|
||||
static QString getWidgetType();
|
||||
public slots:
|
||||
void showDecompilerContextMenu(const QPoint &pt);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user