2019-01-24 17:13:04 +00:00
|
|
|
#ifndef OVERVIEWWIDGET_H
|
|
|
|
#define OVERVIEWWIDGET_H
|
|
|
|
|
|
|
|
#include "CutterDockWidget.h"
|
|
|
|
|
|
|
|
class MainWindow;
|
|
|
|
class OverviewView;
|
2019-04-14 12:18:24 +00:00
|
|
|
class GraphWidget;
|
2019-01-24 17:13:04 +00:00
|
|
|
|
|
|
|
class OverviewWidget : public CutterDockWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-05-22 11:49:34 +00:00
|
|
|
explicit OverviewWidget(MainWindow *main);
|
2019-01-24 17:13:04 +00:00
|
|
|
~OverviewWidget();
|
2019-03-27 08:24:54 +00:00
|
|
|
|
2019-04-14 12:18:24 +00:00
|
|
|
private:
|
|
|
|
OverviewView *graphView;
|
|
|
|
bool isAvailable = false;
|
|
|
|
bool userOpened = false;
|
2019-01-24 17:13:04 +00:00
|
|
|
|
2019-04-14 12:18:24 +00:00
|
|
|
GraphWidget *targetGraphWidget;
|
|
|
|
|
|
|
|
RefreshDeferrer *graphDataRefreshDeferrer;
|
2019-03-27 08:24:54 +00:00
|
|
|
|
2019-03-06 20:30:39 +00:00
|
|
|
/**
|
|
|
|
* @brief this takes care of scaling the overview when the widget is resized
|
2019-01-24 18:04:39 +00:00
|
|
|
*/
|
|
|
|
void resizeEvent(QResizeEvent *event) override;
|
2019-01-24 17:13:04 +00:00
|
|
|
|
2019-04-14 12:18:24 +00:00
|
|
|
void setIsAvailable(bool isAvailable);
|
|
|
|
void setUserOpened(bool userOpened);
|
2019-07-22 19:28:11 +00:00
|
|
|
void zoomTarget(int d);
|
2019-04-14 12:18:24 +00:00
|
|
|
|
2019-01-24 17:13:04 +00:00
|
|
|
private slots:
|
2019-04-14 12:18:24 +00:00
|
|
|
void showEvent(QShowEvent *event) override;
|
|
|
|
void closeEvent(QCloseEvent *event) override;
|
|
|
|
|
2019-03-06 20:30:39 +00:00
|
|
|
/**
|
2019-04-14 12:18:24 +00:00
|
|
|
* @brief update the view in the target widget when the range rect in the overview is moved
|
2019-01-24 17:13:04 +00:00
|
|
|
*/
|
2019-04-14 12:18:24 +00:00
|
|
|
void updateTargetView();
|
|
|
|
|
|
|
|
/**
|
2021-01-24 14:50:13 +00:00
|
|
|
* @brief update the content of the graph (blocks, edges) in the contained graphView from the
|
|
|
|
* target widget
|
2019-03-08 18:57:57 +00:00
|
|
|
*/
|
2019-04-14 12:18:24 +00:00
|
|
|
void updateGraphData();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief update the rect to show the current view in the target widget
|
|
|
|
*/
|
|
|
|
void updateRangeRect();
|
|
|
|
|
|
|
|
void targetClosed();
|
2019-02-07 20:39:37 +00:00
|
|
|
|
|
|
|
signals:
|
2019-03-06 20:30:39 +00:00
|
|
|
/**
|
|
|
|
* @brief emit signal to update the rect
|
2019-02-07 20:39:37 +00:00
|
|
|
*/
|
|
|
|
void resized();
|
2019-04-14 12:18:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @sa getIsAvailable()
|
2019-03-08 18:57:57 +00:00
|
|
|
*/
|
2019-04-14 12:18:24 +00:00
|
|
|
void isAvailableChanged(bool isAvailable);
|
2019-03-27 08:24:54 +00:00
|
|
|
|
2019-04-14 12:18:24 +00:00
|
|
|
/**
|
|
|
|
* @sa getUserOpened()
|
|
|
|
*/
|
|
|
|
void userOpenedChanged(bool userOpened);
|
|
|
|
|
|
|
|
public:
|
|
|
|
GraphWidget *getTargetGraphWidget() { return targetGraphWidget; }
|
|
|
|
void setTargetGraphWidget(GraphWidget *widget);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief whether this widget makes sense to be show, i.e. the menu entry should be enabled
|
|
|
|
*/
|
2021-01-24 14:50:13 +00:00
|
|
|
bool getIsAvailable() const { return isAvailable; }
|
2019-04-14 12:18:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief whether this widget is desired to be shown in general
|
|
|
|
*
|
|
|
|
* Will be false when the user closed the overview explicitly.
|
|
|
|
* Also corresponds to the checked state of the menu entry for this widget.
|
|
|
|
*/
|
2021-01-24 14:50:13 +00:00
|
|
|
bool getUserOpened() const { return userOpened; }
|
2019-03-27 08:24:54 +00:00
|
|
|
|
2021-01-24 14:50:13 +00:00
|
|
|
OverviewView *getGraphView() const { return graphView; }
|
2019-07-22 19:28:11 +00:00
|
|
|
void wheelEvent(QWheelEvent *event) override;
|
2019-01-24 17:13:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // OverviewWIDGET_H
|