Skip to content
Permalink
Browse files

GUI: further improve performance of reference searching

Fixes #2287
  • Loading branch information
mrexodia committed Feb 10, 2020
1 parent 1774ba1 commit 6407b2b063bdc3d54dd8a58ee549ff65942c1728
@@ -257,6 +257,7 @@ void AbstractTableView::paintEvent(QPaintEvent* event)
// Reload data if needed
if(mPrevTableOffset != mTableOffset || mShouldReload == true)
{
updateScrollBarRange(getRowCount());
prepareData();
mPrevTableOffset = mTableOffset;
mShouldReload = false;
@@ -875,12 +876,9 @@ void AbstractTableView::updateScrollBarRange(dsint range)
rangeMin = 0;
rangeMax = 0;
}
MethodInvoker::invokeMethod([this, rangeMin, rangeMax]
{
verticalScrollBar()->setRange(rangeMin, rangeMax);
verticalScrollBar()->setSingleStep(getRowHeight());
verticalScrollBar()->setPageStep(getViewableRowsCount() * getRowHeight());
});
verticalScrollBar()->setRange(rangeMin, rangeMax);
verticalScrollBar()->setSingleStep(getRowHeight());
verticalScrollBar()->setPageStep(getViewableRowsCount() * getRowHeight());
}

/************************************************************************************
@@ -1065,7 +1063,6 @@ void AbstractTableView::addColumnAt(int width, const QString & title, bool isCli

void AbstractTableView::setRowCount(dsint count)
{
updateScrollBarRange(count);
if(mRowCount != count)
mShouldReload = true;
mRowCount = count;
@@ -1253,7 +1250,6 @@ void AbstractTableView::setTableOffset(dsint val)

MethodInvoker::invokeMethod([this]()
{

#ifdef _WIN64
int wNewValue = scaleFromUint64ToScrollBarRange(mTableOffset);
verticalScrollBar()->setValue(wNewValue);
@@ -116,6 +116,16 @@ void ReferenceView::disconnectBridge()
disconnect(stdList(), SIGNAL(selectionChangedSignal(int)), this, SLOT(searchSelectionChanged(int)));
}

int ReferenceView::progress() const
{
return mSearchTotalProgress->value();
}

int ReferenceView::currentTaskProgress() const
{
return mSearchCurrentTaskProgress->value();
}

void ReferenceView::refreshShortcutsSlot()
{
mToggleBreakpoint->setShortcut(ConfigShortcut("ActionToggleBreakpoint"));
@@ -124,23 +134,17 @@ void ReferenceView::refreshShortcutsSlot()

void ReferenceView::referenceSetProgressSlot(int progress)
{
if(mSearchTotalProgress->value() != progress)
{
mSearchTotalProgress->setValue(progress);
mSearchTotalProgress->setAlignment(Qt::AlignCenter);
mSearchTotalProgress->setFormat(tr("Total Progress %1%").arg(QString::number(progress)));
mCountTotalLabel->setText(QString("%1").arg(stdList()->getRowCount()));
}
mSearchTotalProgress->setValue(progress);
mSearchTotalProgress->setAlignment(Qt::AlignCenter);
mSearchTotalProgress->setFormat(tr("Total Progress %1%").arg(QString::number(progress)));
mCountTotalLabel->setText(QString("%1").arg(stdList()->getRowCount()));
}

void ReferenceView::referenceSetCurrentTaskProgressSlot(int progress, QString taskTitle)
{
if(mSearchCurrentTaskProgress->value() != progress)
{
mSearchCurrentTaskProgress->setValue(progress);
mSearchCurrentTaskProgress->setAlignment(Qt::AlignCenter);
mSearchCurrentTaskProgress->setFormat(taskTitle + " " + QString::number(progress) + "%");
}
mSearchCurrentTaskProgress->setValue(progress);
mSearchCurrentTaskProgress->setAlignment(Qt::AlignCenter);
mSearchCurrentTaskProgress->setFormat(taskTitle + " " + QString::number(progress) + "%");
}

void ReferenceView::searchSelectionChanged(int index)
@@ -17,6 +17,8 @@ class ReferenceView : public StdSearchListView
void setupContextMenu();
void connectBridge();
void disconnectBridge();
int progress() const;
int currentTaskProgress() const;

public slots:
void addColumnAtRef(int width, QString title);
@@ -276,11 +276,21 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
break;

case GUI_REF_SETPROGRESS:
emit referenceSetProgress((int)param1);
if(referenceManager->currentReferenceView())
{
auto newProgress = (int)param1;
if(referenceManager->currentReferenceView()->progress() != newProgress)
emit referenceSetProgress(newProgress);
}
break;

case GUI_REF_SETCURRENTTASKPROGRESS:
emit referenceSetCurrentTaskProgress((int)param1, QString((const char*)param2));
if(referenceManager->currentReferenceView())
{
auto newProgress = (int)param1;
if(referenceManager->currentReferenceView()->currentTaskProgress() != newProgress)
emit referenceSetCurrentTaskProgress((int)param1, QString((const char*)param2));
}
break;

case GUI_REF_SETSEARCHSTARTCOL:

0 comments on commit 6407b2b

Please sign in to comment.
You can’t perform that action at this time.