mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-20 20:06:12 +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;
|
||||
}
|
||||
targetGraphDock = targetGraph;
|
||||
ui->actionOverview->setChecked(visibility);
|
||||
if (visibility) {
|
||||
enableOverviewMenu(visibility);
|
||||
if (visibility && !core->isGraphEmpty()) {
|
||||
connect(targetGraphDock->graphView, SIGNAL(refreshBlock()), 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, &QDockWidget::dockLocationChanged, this, &MainWindow::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, &QDockWidget::dockLocationChanged, this, &MainWindow::adjustOverview);
|
||||
disconnect(overviewDock, SIGNAL(resized()), this, SLOT(adjustOverview()));
|
||||
overviewDock->hide();
|
||||
}
|
||||
}
|
||||
|
||||
@ -773,6 +778,12 @@ void MainWindow::enableDebugWidgetsMenu(bool enable)
|
||||
ui->menuAddDebugWidgets->setEnabled(enable);
|
||||
}
|
||||
|
||||
void MainWindow::enableOverviewMenu(bool enable)
|
||||
{
|
||||
ui->actionOverview->setEnabled(enable);
|
||||
ui->actionOverview->setChecked(enable);
|
||||
}
|
||||
|
||||
void MainWindow::resetToDefaultLayout()
|
||||
{
|
||||
hideAllDocks();
|
||||
|
@ -264,6 +264,7 @@ private:
|
||||
void showZenDocks();
|
||||
void showDebugDocks();
|
||||
void enableDebugWidgetsMenu(bool enable);
|
||||
void enableOverviewMenu(bool enable);
|
||||
|
||||
void toggleDockWidget(QDockWidget *dock_widget, bool show);
|
||||
|
||||
|
@ -125,7 +125,6 @@ public:
|
||||
|
||||
void loadCurrentGraph();
|
||||
QString windowTitle;
|
||||
bool isGraphEmpty();
|
||||
QTextEdit *header = nullptr;
|
||||
|
||||
int getWidth() { return width; }
|
||||
|
@ -35,6 +35,9 @@ GraphWidget::GraphWidget(MainWindow *main, QAction *action) :
|
||||
connect(Core(), &CutterCore::raisePrioritizedMemoryWidget,
|
||||
this, [ = ](CutterCore::MemoryWidgetType type) {
|
||||
bool emptyGraph = (type == CutterCore::MemoryWidgetType::Graph && Core()->isGraphEmpty());
|
||||
if (emptyGraph) {
|
||||
emit graphEmpty();
|
||||
}
|
||||
if (type == CutterCore::MemoryWidgetType::Graph && !emptyGraph) {
|
||||
this->raise();
|
||||
this->graphView->setFocus();
|
||||
@ -43,3 +46,9 @@ GraphWidget::GraphWidget(MainWindow *main, QAction *action) :
|
||||
}
|
||||
|
||||
GraphWidget::~GraphWidget() {}
|
||||
|
||||
void GraphWidget::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
CutterDockWidget::closeEvent(event);
|
||||
emit graphClose();
|
||||
}
|
||||
|
@ -14,6 +14,13 @@ public:
|
||||
explicit GraphWidget(MainWindow *main, QAction *action = nullptr);
|
||||
~GraphWidget();
|
||||
DisassemblerGraphView *graphView;
|
||||
|
||||
private:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
|
||||
signals:
|
||||
void graphClose();
|
||||
void graphEmpty();
|
||||
};
|
||||
|
||||
#endif // GRAPHWIDGET_H
|
||||
|
Loading…
Reference in New Issue
Block a user