1
0
Fork 0

GUI: improve performance of ReferenceView API

closes issue #2281
This commit is contained in:
Duncan Ogilvie 2020-02-10 02:34:15 +01:00
parent 1de5313e58
commit aac246b27f
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
4 changed files with 34 additions and 27 deletions

View File

@ -96,14 +96,10 @@ void ReferenceView::setupContextMenu()
void ReferenceView::connectBridge()
{
connect(Bridge::getBridge(), SIGNAL(referenceAddColumnAt(int, QString)), this, SLOT(addColumnAtRef(int, QString)));
connect(Bridge::getBridge(), SIGNAL(referenceSetRowCount(dsint)), this, SLOT(setRowCount(dsint)));
connect(Bridge::getBridge(), SIGNAL(referenceSetCellContent(int, int, QString)), this, SLOT(setCellContent(int, int, QString)));
connect(Bridge::getBridge(), SIGNAL(referenceReloadData()), this, SLOT(reloadData()));
connect(Bridge::getBridge(), SIGNAL(referenceReloadData()), this, SLOT(reloadDataSlot()));
connect(Bridge::getBridge(), SIGNAL(referenceSetSingleSelection(int, bool)), this, SLOT(setSingleSelection(int, bool)));
connect(Bridge::getBridge(), SIGNAL(referenceSetProgress(int)), this, SLOT(referenceSetProgressSlot(int)));
connect(Bridge::getBridge(), SIGNAL(referenceSetCurrentTaskProgress(int, QString)), this, SLOT(referenceSetCurrentTaskProgressSlot(int, QString)));
connect(Bridge::getBridge(), SIGNAL(referenceSetSearchStartCol(int)), this, SLOT(setSearchStartCol(int)));
connect(Bridge::getBridge(), SIGNAL(referenceAddCommand(QString, QString)), this, SLOT(addCommand(QString, QString)));
connect(stdSearchList(), SIGNAL(selectionChangedSignal(int)), this, SLOT(searchSelectionChanged(int)));
connect(stdList(), SIGNAL(selectionChangedSignal(int)), this, SLOT(searchSelectionChanged(int)));
@ -111,14 +107,10 @@ void ReferenceView::connectBridge()
void ReferenceView::disconnectBridge()
{
disconnect(Bridge::getBridge(), SIGNAL(referenceAddColumnAt(int, QString)), this, SLOT(addColumnAtRef(int, QString)));
disconnect(Bridge::getBridge(), SIGNAL(referenceSetRowCount(dsint)), this, SLOT(setRowCount(dsint)));
disconnect(Bridge::getBridge(), SIGNAL(referenceSetCellContent(int, int, QString)), this, SLOT(setCellContent(int, int, QString)));
disconnect(Bridge::getBridge(), SIGNAL(referenceReloadData()), this, SLOT(reloadData()));
disconnect(Bridge::getBridge(), SIGNAL(referenceReloadData()), this, SLOT(reloadDataSlot()));
disconnect(Bridge::getBridge(), SIGNAL(referenceSetSingleSelection(int, bool)), this, SLOT(setSingleSelection(int, bool)));
disconnect(Bridge::getBridge(), SIGNAL(referenceSetProgress(int)), mSearchTotalProgress, SLOT(setValue(int)));
disconnect(Bridge::getBridge(), SIGNAL(referenceSetProgress(int)), this, SLOT(referenceSetProgressSlot(int)));
disconnect(Bridge::getBridge(), SIGNAL(referenceSetCurrentTaskProgress(int, QString)), this, SLOT(referenceSetCurrentTaskProgressSlot(int, QString)));
disconnect(Bridge::getBridge(), SIGNAL(referenceSetSearchStartCol(int)), this, SLOT(setSearchStartCol(int)));
disconnect(Bridge::getBridge(), SIGNAL(referenceAddCommand(QString, QString)), this, SLOT(addCommand(QString, QString)));
disconnect(stdSearchList(), SIGNAL(selectionChangedSignal(int)), this, SLOT(searchSelectionChanged(int)));
disconnect(stdList(), SIGNAL(selectionChangedSignal(int)), this, SLOT(searchSelectionChanged(int)));
@ -132,16 +124,23 @@ void ReferenceView::refreshShortcutsSlot()
void ReferenceView::referenceSetProgressSlot(int progress)
{
mSearchTotalProgress->setValue(progress);
mSearchTotalProgress->setAlignment(Qt::AlignCenter);
mSearchTotalProgress->setFormat(tr("Total Progress %1%").arg(QString::number(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()));
}
}
void ReferenceView::referenceSetCurrentTaskProgressSlot(int progress, QString taskTitle)
{
mSearchCurrentTaskProgress->setValue(progress);
mSearchCurrentTaskProgress->setAlignment(Qt::AlignCenter);
mSearchCurrentTaskProgress->setFormat(taskTitle + " " + QString::number(progress) + "%");
if(mSearchCurrentTaskProgress->value() != progress)
{
mSearchCurrentTaskProgress->setValue(progress);
mSearchCurrentTaskProgress->setAlignment(Qt::AlignCenter);
mSearchCurrentTaskProgress->setFormat(taskTitle + " " + QString::number(progress) + "%");
}
}
void ReferenceView::searchSelectionChanged(int index)
@ -150,6 +149,16 @@ void ReferenceView::searchSelectionChanged(int index)
DbgValToString("$__dump_refindex", index);
}
void ReferenceView::reloadDataSlot()
{
if(mUpdateCountLabel)
{
mUpdateCountLabel = true;
mCountTotalLabel->setText(QString("%1").arg(stdList()->getRowCount()));
}
reloadData();
}
void ReferenceView::addColumnAtRef(int width, QString title)
{
int charwidth = getCharWidth();
@ -167,9 +176,8 @@ void ReferenceView::setRowCount(dsint count)
{
if(!stdList()->getRowCount() && count) //from zero to N rows
searchSelectionChanged(0);
emit mCountTotalLabel->setText(QString("%1").arg(count));
mUpdateCountLabel = true;
StdSearchListView::setRowCount(count);
Bridge::getBridge()->setResult(BridgeResult::RefSetRowCount, 1);
}
void ReferenceView::setSingleSelection(int index, bool scroll)

View File

@ -40,6 +40,7 @@ public slots:
void referenceSetProgressSlot(int progress);
void referenceSetCurrentTaskProgressSlot(int progress, QString taskTitle);
void searchSelectionChanged(int index);
void reloadDataSlot();
signals:
void showCpu();
@ -59,6 +60,7 @@ private:
QAction* mRemoveBreakpointOnAllCommands;
QAction* mSetBreakpointOnAllApiCalls;
QAction* mRemoveBreakpointOnAllApiCalls;
bool mUpdateCountLabel = false;
QLabel* mCountTotalLabel;
QVector<QString> mCommandTitles;
QVector<QString> mCommands;

View File

@ -219,11 +219,7 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
case GUI_REF_SETROWCOUNT:
{
if(referenceManager->currentReferenceView())
{
BridgeResult result(BridgeResult::RefSetRowCount);
emit referenceSetRowCount((dsint)param1);
result.Wait();
}
referenceManager->currentReferenceView()->setRowCount((dsint)param1);
}
break;
@ -244,7 +240,8 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
case GUI_REF_SETCELLCONTENT:
{
CELLINFO* info = (CELLINFO*)param1;
emit referenceSetCellContent(info->row, info->col, QString(info->str));
if(referenceManager->currentReferenceView())
referenceManager->currentReferenceView()->setCellContent(info->row, info->col, QString(info->str));
}
break;
@ -287,7 +284,8 @@ void* Bridge::processMessage(GUIMSG type, void* param1, void* param2)
break;
case GUI_REF_SETSEARCHSTARTCOL:
emit referenceSetSearchStartCol((int)param1);
if(referenceManager->currentReferenceView())
referenceManager->currentReferenceView()->setSearchStartCol((int)param1);
break;
case GUI_REF_INITIALIZE:

View File

@ -11,7 +11,6 @@ public:
ScriptAdd,
ScriptMessage,
RefInitialize,
RefSetRowCount,
MenuAddToList,
MenuAdd,
MenuAddEntry,