mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Overview does not disappear anymore when it is moved to the same dock as Graph (#1212)
* Overview does not disappear anymore when it is moved to same dock as Graph, Gray out Overview menu when Graph is not active
This commit is contained in:
parent
6a77db67ff
commit
fa708143ac
@ -288,10 +288,16 @@ void MainWindow::toggleOverview(bool visibility, GraphWidget *targetGraph)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
targetGraphDock = targetGraph;
|
targetGraphDock = targetGraph;
|
||||||
ui->actionOverview->setChecked(visibility);
|
enableOverviewMenu(visibility);
|
||||||
if (visibility) {
|
if (visibility && !core->isGraphEmpty()) {
|
||||||
connect(targetGraphDock->graphView, SIGNAL(refreshBlock()), this, SLOT(adjustOverview()));
|
connect(targetGraphDock->graphView, SIGNAL(refreshBlock()), this, SLOT(adjustOverview()));
|
||||||
connect(targetGraphDock->graphView, SIGNAL(viewZoomed()), this, SLOT(adjustOverview()));
|
connect(targetGraphDock->graphView, SIGNAL(viewZoomed()), this, SLOT(adjustOverview()));
|
||||||
|
connect(targetGraphDock, &GraphWidget::graphClose, [this]() {
|
||||||
|
overviewDock->hide();
|
||||||
|
});
|
||||||
|
connect(targetGraphDock, &GraphWidget::graphEmpty, [this]() {
|
||||||
|
overviewDock->hide();
|
||||||
|
});
|
||||||
connect(overviewDock->graphView, SIGNAL(mouseMoved()), this, SLOT(adjustGraph()));
|
connect(overviewDock->graphView, SIGNAL(mouseMoved()), this, SLOT(adjustGraph()));
|
||||||
connect(overviewDock, &QDockWidget::dockLocationChanged, this, &MainWindow::adjustOverview);
|
connect(overviewDock, &QDockWidget::dockLocationChanged, this, &MainWindow::adjustOverview);
|
||||||
connect(overviewDock, SIGNAL(resized()), this, SLOT(adjustOverview()));
|
connect(overviewDock, SIGNAL(resized()), this, SLOT(adjustOverview()));
|
||||||
@ -302,7 +308,6 @@ void MainWindow::toggleOverview(bool visibility, GraphWidget *targetGraph)
|
|||||||
disconnect(overviewDock->graphView, SIGNAL(mouseMoved()), this, SLOT(adjustGraph()));
|
disconnect(overviewDock->graphView, SIGNAL(mouseMoved()), this, SLOT(adjustGraph()));
|
||||||
disconnect(overviewDock, &QDockWidget::dockLocationChanged, this, &MainWindow::adjustOverview);
|
disconnect(overviewDock, &QDockWidget::dockLocationChanged, this, &MainWindow::adjustOverview);
|
||||||
disconnect(overviewDock, SIGNAL(resized()), this, SLOT(adjustOverview()));
|
disconnect(overviewDock, SIGNAL(resized()), this, SLOT(adjustOverview()));
|
||||||
overviewDock->hide();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,6 +778,12 @@ void MainWindow::enableDebugWidgetsMenu(bool enable)
|
|||||||
ui->menuAddDebugWidgets->setEnabled(enable);
|
ui->menuAddDebugWidgets->setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::enableOverviewMenu(bool enable)
|
||||||
|
{
|
||||||
|
ui->actionOverview->setEnabled(enable);
|
||||||
|
ui->actionOverview->setChecked(enable);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::resetToDefaultLayout()
|
void MainWindow::resetToDefaultLayout()
|
||||||
{
|
{
|
||||||
hideAllDocks();
|
hideAllDocks();
|
||||||
|
@ -264,6 +264,7 @@ private:
|
|||||||
void showZenDocks();
|
void showZenDocks();
|
||||||
void showDebugDocks();
|
void showDebugDocks();
|
||||||
void enableDebugWidgetsMenu(bool enable);
|
void enableDebugWidgetsMenu(bool enable);
|
||||||
|
void enableOverviewMenu(bool enable);
|
||||||
|
|
||||||
void toggleDockWidget(QDockWidget *dock_widget, bool show);
|
void toggleDockWidget(QDockWidget *dock_widget, bool show);
|
||||||
|
|
||||||
|
@ -125,7 +125,6 @@ public:
|
|||||||
|
|
||||||
void loadCurrentGraph();
|
void loadCurrentGraph();
|
||||||
QString windowTitle;
|
QString windowTitle;
|
||||||
bool isGraphEmpty();
|
|
||||||
QTextEdit *header = nullptr;
|
QTextEdit *header = nullptr;
|
||||||
|
|
||||||
int getWidth() { return width; }
|
int getWidth() { return width; }
|
||||||
|
@ -35,6 +35,9 @@ GraphWidget::GraphWidget(MainWindow *main, QAction *action) :
|
|||||||
connect(Core(), &CutterCore::raisePrioritizedMemoryWidget,
|
connect(Core(), &CutterCore::raisePrioritizedMemoryWidget,
|
||||||
this, [ = ](CutterCore::MemoryWidgetType type) {
|
this, [ = ](CutterCore::MemoryWidgetType type) {
|
||||||
bool emptyGraph = (type == CutterCore::MemoryWidgetType::Graph && Core()->isGraphEmpty());
|
bool emptyGraph = (type == CutterCore::MemoryWidgetType::Graph && Core()->isGraphEmpty());
|
||||||
|
if (emptyGraph) {
|
||||||
|
emit graphEmpty();
|
||||||
|
}
|
||||||
if (type == CutterCore::MemoryWidgetType::Graph && !emptyGraph) {
|
if (type == CutterCore::MemoryWidgetType::Graph && !emptyGraph) {
|
||||||
this->raise();
|
this->raise();
|
||||||
this->graphView->setFocus();
|
this->graphView->setFocus();
|
||||||
@ -43,3 +46,9 @@ GraphWidget::GraphWidget(MainWindow *main, QAction *action) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
GraphWidget::~GraphWidget() {}
|
GraphWidget::~GraphWidget() {}
|
||||||
|
|
||||||
|
void GraphWidget::closeEvent(QCloseEvent *event)
|
||||||
|
{
|
||||||
|
CutterDockWidget::closeEvent(event);
|
||||||
|
emit graphClose();
|
||||||
|
}
|
||||||
|
@ -14,6 +14,13 @@ public:
|
|||||||
explicit GraphWidget(MainWindow *main, QAction *action = nullptr);
|
explicit GraphWidget(MainWindow *main, QAction *action = nullptr);
|
||||||
~GraphWidget();
|
~GraphWidget();
|
||||||
DisassemblerGraphView *graphView;
|
DisassemblerGraphView *graphView;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void graphClose();
|
||||||
|
void graphEmpty();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GRAPHWIDGET_H
|
#endif // GRAPHWIDGET_H
|
||||||
|
Loading…
Reference in New Issue
Block a user