mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 10:56:11 +00:00
Cleanup Remnants of Widget Actions (#1637)
This commit is contained in:
parent
2ac1455642
commit
a7a7bad6d9
@ -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<GraphWidget>, ui->actionGraph});
|
||||
classNameToConstructorAndActionMap.insert(DisassemblyWidget::getWidgetType(),
|
||||
{getNewInstance<DisassemblyWidget>, ui->actionDisassembly});
|
||||
classNameToConstructorAndActionMap.insert(HexdumpWidget::getWidgetType(),
|
||||
{getNewInstance<HexdumpWidget>, ui->actionHexdump});
|
||||
widgetTypeToConstructorMap.insert(GraphWidget::getWidgetType(), getNewInstance<GraphWidget>);
|
||||
widgetTypeToConstructorMap.insert(DisassemblyWidget::getWidgetType(), getNewInstance<DisassemblyWidget>);
|
||||
widgetTypeToConstructorMap.insert(HexdumpWidget::getWidgetType(), getNewInstance<HexdumpWidget>);
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -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<QString, std::pair<std::function<CutterDockWidget*(MainWindow*, QAction*)>, QAction*>> classNameToConstructorAndActionMap;
|
||||
QMap<QString, std::function<CutterDockWidget*(MainWindow*, QAction*)>> widgetTypeToConstructorMap;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
@ -881,14 +881,6 @@
|
||||
<string>Tmp</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDisassembly">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Disassembly</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGraph">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@ -913,14 +905,6 @@
|
||||
<string>Pseudocode</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionHexdump">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Hexdump</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionConsole">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
|
Loading…
Reference in New Issue
Block a user