mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 16:47:26 +00:00
Fix some minor issues and leaks
This commit is contained in:
parent
bbd5ad6b38
commit
0ebe1cf728
@ -15,6 +15,9 @@ RefreshDeferrer::~RefreshDeferrer()
|
||||
bool RefreshDeferrer::attemptRefresh(RefreshDeferrerParams params)
|
||||
{
|
||||
if (dockWidget->isVisibleToUser()) {
|
||||
if (acc) {
|
||||
acc->ignoreParams(params);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
dirty = true;
|
||||
|
@ -50,7 +50,6 @@ void CutterDockWidget::updateIsVisibleToUser()
|
||||
return;
|
||||
}
|
||||
isVisibleToUserCurrent = visibleToUser;
|
||||
qDebug() << this << "isVisibleToUser changed to" << isVisibleToUserCurrent;
|
||||
if (isVisibleToUserCurrent) {
|
||||
emit becameVisibleToUser();
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ signals:
|
||||
private:
|
||||
QAction *action;
|
||||
|
||||
bool isVisibleToUserCurrent;
|
||||
bool isVisibleToUserCurrent = false;
|
||||
void updateIsVisibleToUser();
|
||||
|
||||
protected:
|
||||
|
@ -740,18 +740,19 @@ void GraphView::showBlock(GraphBlock *block, bool animated)
|
||||
target_x = std::min(horizontalScrollBar()->maximum(), target_x);
|
||||
target_y = std::min(verticalScrollBar()->maximum(), target_y);
|
||||
if (animated) {
|
||||
QPropertyAnimation *animation_x = new QPropertyAnimation(horizontalScrollBar(), "value");
|
||||
QPropertyAnimation *animation_x = new QPropertyAnimation(horizontalScrollBar(), "value", this);
|
||||
animation_x->deleteLater();
|
||||
animation_x->setDuration(500);
|
||||
animation_x->setStartValue(horizontalScrollBar()->value());
|
||||
animation_x->setEndValue(target_x);
|
||||
animation_x->setEasingCurve(QEasingCurve::InOutQuad);
|
||||
animation_x->start();
|
||||
QPropertyAnimation *animation_y = new QPropertyAnimation(verticalScrollBar(), "value");
|
||||
animation_x->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
QPropertyAnimation *animation_y = new QPropertyAnimation(verticalScrollBar(), "value", this);
|
||||
animation_y->setDuration(500);
|
||||
animation_y->setStartValue(verticalScrollBar()->value());
|
||||
animation_y->setEndValue(target_y);
|
||||
animation_y->setEasingCurve(QEasingCurve::InOutQuad);
|
||||
animation_y->start();
|
||||
animation_y->start(QAbstractAnimation::DeleteWhenStopped);
|
||||
} else {
|
||||
horizontalScrollBar()->setValue(target_x);
|
||||
verticalScrollBar()->setValue(target_y);
|
||||
|
@ -80,6 +80,11 @@ HexdumpWidget::HexdumpWidget(MainWindow *main, QAction *action) :
|
||||
updateHeaders();
|
||||
|
||||
this->setWindowTitle(tr("Hexdump"));
|
||||
|
||||
refreshDeferrer = createReplacingRefreshDeferrer<RVA>(false, [this](const RVA *offset) {
|
||||
refresh(offset ? *offset : RVA_INVALID);
|
||||
});
|
||||
|
||||
connect(&syncAction, SIGNAL(triggered(bool)), this, SLOT(toggleSync()));
|
||||
|
||||
// Set hexdump context menu
|
||||
@ -119,12 +124,6 @@ HexdumpWidget::HexdumpWidget(MainWindow *main, QAction *action) :
|
||||
connect(seekable, &CutterSeekable::seekableSeekChanged, this, &HexdumpWidget::onSeekChanged);
|
||||
connect(&rangeDialog, &QDialog::accepted, this, &HexdumpWidget::on_rangeDialogAccepted);
|
||||
|
||||
connect(this, &CutterDockWidget::becameVisibleToUser, this, [this]() {
|
||||
if (hexdumpDirty) {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
|
||||
format = Format::Hex;
|
||||
initParsing();
|
||||
selectHexPreview();
|
||||
@ -320,11 +319,8 @@ void HexdumpWidget::highlightHexWords(const QString &str)
|
||||
|
||||
void HexdumpWidget::refresh(RVA addr)
|
||||
{
|
||||
if (!isVisibleToUser()) {
|
||||
hexdumpDirty = true;
|
||||
if (!refreshDeferrer->attemptRefresh(addr == RVA_INVALID ? nullptr : new RVA(addr))) {
|
||||
return;
|
||||
} else {
|
||||
hexdumpDirty = false;
|
||||
}
|
||||
|
||||
ut64 loadLines = 0;
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include "ui_HexdumpWidget.h"
|
||||
|
||||
class RefreshDeferrer;
|
||||
|
||||
class HexdumpWidget : public CutterDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -71,7 +73,7 @@ private:
|
||||
RVA first_loaded_address = RVA_INVALID;
|
||||
RVA last_loaded_address = RVA_INVALID;
|
||||
|
||||
bool hexdumpDirty = false;
|
||||
RefreshDeferrer *refreshDeferrer;
|
||||
|
||||
void refresh(RVA addr = RVA_INVALID);
|
||||
void selectHexPreview();
|
||||
|
@ -50,6 +50,9 @@ void Omnibar::refresh(const QStringList &flagList)
|
||||
void Omnibar::restoreCompleter()
|
||||
{
|
||||
QCompleter *completer = this->completer();
|
||||
if (!completer) {
|
||||
return;
|
||||
}
|
||||
completer->setFilterMode(Qt::MatchContains);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user