diff --git a/src/core/MainWindow.cpp b/src/core/MainWindow.cpp index a33045e5..5b9a733d 100644 --- a/src/core/MainWindow.cpp +++ b/src/core/MainWindow.cpp @@ -131,12 +131,9 @@ void MainWindow::initUI() connect(ui->actionExtraDisassembly, &QAction::triggered, this, &MainWindow::addExtraDisassembly); connect(ui->actionExtraHexdump, &QAction::triggered, this, &MainWindow::addExtraHexdump); - classNameToConstructorAndActionMap.insert(GraphWidget::getWidgetType(), - {getNewInstance, ui->actionGraph}); - classNameToConstructorAndActionMap.insert(DisassemblyWidget::getWidgetType(), - {getNewInstance, ui->actionDisassembly}); - classNameToConstructorAndActionMap.insert(HexdumpWidget::getWidgetType(), - {getNewInstance, ui->actionHexdump}); + widgetTypeToConstructorMap.insert(GraphWidget::getWidgetType(), getNewInstance); + widgetTypeToConstructorMap.insert(DisassemblyWidget::getWidgetType(), getNewInstance); + widgetTypeToConstructorMap.insert(HexdumpWidget::getWidgetType(), getNewInstance); initToolBar(); initDocks(); @@ -324,9 +321,8 @@ void MainWindow::initDocks() if (std::none_of(dockWidgets.constBegin(), dockWidgets.constEnd(), [&it](QDockWidget *w) { return w->objectName() == it; })) { className = it.split(';').at(0); - if (classNameToConstructorAndActionMap.contains(className)) { - auto widget = classNameToConstructorAndActionMap[className] - .first(this, classNameToConstructorAndActionMap[className].second); + if (widgetTypeToConstructorMap.contains(className)) { + auto widget = widgetTypeToConstructorMap[className](this, nullptr); widget->setObjectName(it); addExtraWidget(widget); } diff --git a/src/core/MainWindow.h b/src/core/MainWindow.h index 76fd11b8..8fcfa951 100644 --- a/src/core/MainWindow.h +++ b/src/core/MainWindow.h @@ -272,10 +272,9 @@ private: bool isOverviewActive(); /** - * @brief Map, where key is class name an value is pair of - * pointer to class constructor and action that passed to this constructor. + * @brief Map from a widget type (e.g. DisassemblyWidget::getWidgetType()) to the respective contructor of the widget */ - QMap, QAction*>> classNameToConstructorAndActionMap; + QMap> widgetTypeToConstructorMap; }; #endif // MAINWINDOW_H diff --git a/src/core/MainWindow.ui b/src/core/MainWindow.ui index 0f96babe..59de0589 100644 --- a/src/core/MainWindow.ui +++ b/src/core/MainWindow.ui @@ -881,14 +881,6 @@ Tmp - - - true - - - Disassembly - - true @@ -913,14 +905,6 @@ Pseudocode - - - true - - - Hexdump - - true