1
0
Fork 0

GUI: further improve performance of reference searching

Fixes #2287
This commit is contained in:
Duncan Ogilvie 2020-02-11 00:57:14 +01:00
parent 1774ba1f89
commit 6407b2b063
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
4 changed files with 35 additions and 23 deletions

View File

@ -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);

View File

@ -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)

View File

@ -17,6 +17,8 @@ public:
void setupContextMenu();
void connectBridge();
void disconnectBridge();
int progress() const;
int currentTaskProgress() const;
public slots:
void addColumnAtRef(int width, QString title);

View File

@ -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: