2019-03-27 08:24:54 +00:00
|
|
|
#include "MemoryDockWidget.h"
|
2019-06-18 13:02:41 +00:00
|
|
|
#include "common/CutterSeekable.h"
|
2019-07-19 19:21:12 +00:00
|
|
|
#include "MainWindow.h"
|
2019-03-27 08:24:54 +00:00
|
|
|
#include <QAction>
|
2019-07-19 19:21:12 +00:00
|
|
|
#include <QEvent>
|
2019-10-06 17:35:44 +00:00
|
|
|
#include <QMenu>
|
|
|
|
#include <QContextMenuEvent>
|
2019-03-27 08:24:54 +00:00
|
|
|
|
2020-05-22 11:49:34 +00:00
|
|
|
MemoryDockWidget::MemoryDockWidget(MemoryWidgetType type, MainWindow *parent)
|
2021-01-24 14:50:13 +00:00
|
|
|
: AddressableDockWidget(parent), mType(type)
|
2019-03-27 08:24:54 +00:00
|
|
|
{
|
2019-07-19 19:21:12 +00:00
|
|
|
if (parent) {
|
|
|
|
parent->addMemoryDockWidget(this);
|
|
|
|
}
|
2019-03-27 08:24:54 +00:00
|
|
|
}
|
|
|
|
|
2019-07-19 19:21:12 +00:00
|
|
|
bool MemoryDockWidget::tryRaiseMemoryWidget()
|
2019-03-27 08:24:54 +00:00
|
|
|
{
|
2019-06-18 22:59:24 +00:00
|
|
|
if (!seekable->isSynchronized()) {
|
2019-07-19 19:21:12 +00:00
|
|
|
return false;
|
2019-06-18 22:59:24 +00:00
|
|
|
}
|
2019-07-19 19:21:12 +00:00
|
|
|
|
|
|
|
if (mType == MemoryWidgetType::Graph && Core()->isGraphEmpty()) {
|
|
|
|
return false;
|
2019-03-27 08:24:54 +00:00
|
|
|
}
|
2019-07-19 19:21:12 +00:00
|
|
|
raiseMemoryWidget();
|
2019-03-27 08:24:54 +00:00
|
|
|
|
2019-07-19 19:21:12 +00:00
|
|
|
return true;
|
|
|
|
}
|
2019-03-27 08:24:54 +00:00
|
|
|
|
2019-07-19 19:21:12 +00:00
|
|
|
bool MemoryDockWidget::eventFilter(QObject *object, QEvent *event)
|
|
|
|
{
|
2019-09-09 13:18:30 +00:00
|
|
|
if (mainWindow && event->type() == QEvent::FocusIn) {
|
2019-07-19 19:21:12 +00:00
|
|
|
mainWindow->setCurrentMemoryWidget(this);
|
|
|
|
}
|
|
|
|
return CutterDockWidget::eventFilter(object, event);
|
2019-03-27 08:24:54 +00:00
|
|
|
}
|