GUI: General SearchListView
This commit is contained in:
parent
03848519bc
commit
512d46cbbc
|
|
@ -43,7 +43,6 @@ SOURCES += \
|
|||
Src/BasicView/LogView.cpp \
|
||||
Src/Gui/GotoDialog.cpp \
|
||||
Src/Disassembler/BeaHighlight.cpp \
|
||||
Src/BasicView/RegistersView.cpp \
|
||||
Src/Gui/StatusLabel.cpp \
|
||||
Src/BasicView/WordEditDialog.cpp \
|
||||
Src/Gui/CPUDisassembly.cpp \
|
||||
|
|
@ -55,6 +54,8 @@ SOURCES += \
|
|||
Src/BasicView/ScriptView.cpp \
|
||||
Src/Gui/CPUStack.cpp \
|
||||
Src/BasicView/SymbolView.cpp \
|
||||
Src/BasicView/RegistersView.cpp \
|
||||
Src/BasicView/SearchListView.cpp \
|
||||
Src/BasicView/ReferenceView.cpp
|
||||
|
||||
|
||||
|
|
@ -91,6 +92,7 @@ HEADERS += \
|
|||
Src/BasicView/ScriptView.h \
|
||||
Src/Gui/CPUStack.h \
|
||||
Src/BasicView/SymbolView.h \
|
||||
Src/BasicView/SearchListView.h \
|
||||
Src/BasicView/ReferenceView.h
|
||||
|
||||
INCLUDEPATH += \
|
||||
|
|
@ -113,7 +115,7 @@ FORMS += \
|
|||
Src/BasicView/WordEditDialog.ui \
|
||||
Src/BasicView/LineEditDialog.ui \
|
||||
Src/BasicView/SymbolView.ui \
|
||||
Src/BasicView/ReferenceView.ui
|
||||
Src/BasicView/SearchListView.ui
|
||||
|
||||
INCLUDEPATH += $$PWD/Src/Bridge
|
||||
|
||||
|
|
|
|||
|
|
@ -1,36 +1,16 @@
|
|||
#include "ReferenceView.h"
|
||||
#include "ui_ReferenceView.h"
|
||||
|
||||
ReferenceView::ReferenceView(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::ReferenceView)
|
||||
ReferenceView::ReferenceView()
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Get font information
|
||||
QFont wFont("Monospace", 8);
|
||||
wFont.setStyleHint(QFont::Monospace);
|
||||
wFont.setFixedPitch(true);
|
||||
|
||||
int charwidth=QFontMetrics(wFont).width(QChar(' '));
|
||||
|
||||
mReferenceList = new StdTable();
|
||||
mReferenceList->addColumnAt(charwidth*2*sizeof(int_t)+8, "Address", true);
|
||||
mReferenceList->addColumnAt(0,"Data", true);
|
||||
|
||||
ui->mainSplitter->insertWidget(0, mReferenceList);
|
||||
|
||||
mMainLayout = new QVBoxLayout();
|
||||
mMainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mMainLayout->addWidget(ui->mainSplitter);
|
||||
setLayout(mMainLayout);
|
||||
|
||||
ui->mainSplitter->setStretchFactor(0, 1000);
|
||||
ui->mainSplitter->setStretchFactor(0, 1);
|
||||
for(int i=0; i<ui->mainSplitter->count(); i++)
|
||||
ui->mainSplitter->handle(i)->setEnabled(false);
|
||||
}
|
||||
|
||||
ReferenceView::~ReferenceView()
|
||||
{
|
||||
delete ui;
|
||||
// Setup example list
|
||||
mList->addColumnAt(charwidth*2*sizeof(int_t)+8, "Address", false);
|
||||
mList->addColumnAt(0, "Data", true);
|
||||
mSearchList->addColumnAt(charwidth*2*sizeof(int_t)+8, "Address", false);
|
||||
mSearchList->addColumnAt(0, "Data", true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,12 @@
|
|||
#ifndef REFERENCEVIEW_H
|
||||
#define REFERENCEVIEW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include "StdTable.h"
|
||||
#include "SearchListView.h"
|
||||
|
||||
namespace Ui {
|
||||
class ReferenceView;
|
||||
}
|
||||
|
||||
class ReferenceView : public QWidget
|
||||
class ReferenceView : public SearchListView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReferenceView(QWidget *parent = 0);
|
||||
~ReferenceView();
|
||||
|
||||
private:
|
||||
Ui::ReferenceView *ui;
|
||||
QVBoxLayout* mMainLayout;
|
||||
StdTable* mReferenceList;
|
||||
ReferenceView();
|
||||
};
|
||||
|
||||
#endif // REFERENCEVIEW_H
|
||||
|
|
|
|||
|
|
@ -0,0 +1,137 @@
|
|||
#include "SearchListView.h"
|
||||
#include "ui_SearchListView.h"
|
||||
|
||||
SearchListView::SearchListView(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::SearchListView)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Create the reference list
|
||||
mList = new StdTable();
|
||||
mList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
// Create the search list
|
||||
mSearchList = new StdTable();
|
||||
mSearchList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
mSearchList->hide();
|
||||
|
||||
// Set global variables
|
||||
mSearchBox = ui->searchBox;
|
||||
mCurList = mList;
|
||||
|
||||
// Create list layout
|
||||
mListLayout = new QVBoxLayout();
|
||||
mListLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mListLayout->setSpacing(0);
|
||||
mListLayout->addWidget(mList);
|
||||
mListLayout->addWidget(mSearchList);
|
||||
|
||||
// Create list placeholder
|
||||
mListPlaceHolder = new QWidget();
|
||||
mListPlaceHolder->setLayout(mListLayout);
|
||||
|
||||
// Insert the placeholder
|
||||
ui->mainSplitter->insertWidget(0, mListPlaceHolder);
|
||||
|
||||
// Set the main layout
|
||||
mMainLayout = new QVBoxLayout();
|
||||
mMainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mMainLayout->addWidget(ui->mainSplitter);
|
||||
setLayout(mMainLayout);
|
||||
|
||||
// Minimal size for the search box
|
||||
ui->mainSplitter->setStretchFactor(0, 1000);
|
||||
ui->mainSplitter->setStretchFactor(0, 1);
|
||||
|
||||
// Disable main splitter
|
||||
for(int i=0; i<ui->mainSplitter->count(); i++)
|
||||
ui->mainSplitter->handle(i)->setEnabled(false);
|
||||
|
||||
// Setup signals
|
||||
connect(mList, SIGNAL(keyPressedSignal(QKeyEvent*)), this, SLOT(listKeyPressed(QKeyEvent*)));
|
||||
connect(mList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(listContextMenu(QPoint)));
|
||||
connect(mSearchList, SIGNAL(keyPressedSignal(QKeyEvent*)), this, SLOT(listKeyPressed(QKeyEvent*)));
|
||||
connect(mSearchList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(listContextMenu(QPoint)));
|
||||
connect(mSearchBox, SIGNAL(textChanged(QString)), this, SLOT(searchTextChanged(QString)));
|
||||
}
|
||||
|
||||
SearchListView::~SearchListView()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SearchListView::listKeyPressed(QKeyEvent* event)
|
||||
{
|
||||
char ch=event->text().toUtf8().constData()[0];
|
||||
if(isprint(ch)) //add a char to the search box
|
||||
mSearchBox->setText(mSearchBox->text()+QString(QChar(ch)));
|
||||
else if(event->key()==Qt::Key_Backspace) //remove a char from the search box
|
||||
{
|
||||
QString newText;
|
||||
if(event->modifiers()==Qt::ControlModifier) //clear the search box
|
||||
newText="";
|
||||
else
|
||||
{
|
||||
newText=mSearchBox->text();
|
||||
newText.chop(1);
|
||||
}
|
||||
mSearchBox->setText(newText);
|
||||
}
|
||||
else if((event->key()==Qt::Key_Return || event->key()==Qt::Key_Enter) && event->modifiers()==Qt::NoModifier) //user pressed enter
|
||||
emit enterPressedSignal();
|
||||
}
|
||||
|
||||
void SearchListView::searchTextChanged(const QString &arg1)
|
||||
{
|
||||
if(arg1.length())
|
||||
{
|
||||
mList->hide();
|
||||
mSearchList->show();
|
||||
mCurList=mSearchList;
|
||||
}
|
||||
else
|
||||
{
|
||||
mSearchList->hide();
|
||||
mList->show();
|
||||
mList->setFocus();
|
||||
mCurList=mList;
|
||||
}
|
||||
mSearchList->setRowCount(0);
|
||||
int count=mList->getRowCount();
|
||||
for(int i=0,j=0; i<count; i++)
|
||||
{
|
||||
if(mList->getCellContent(i, 1).contains(arg1, Qt::CaseInsensitive) || mList->getCellContent(i, 2).contains(arg1, Qt::CaseInsensitive))
|
||||
{
|
||||
mSearchList->setRowCount(j+1);
|
||||
mSearchList->setCellContent(j, 0, mList->getCellContent(i, 0));
|
||||
mSearchList->setCellContent(j, 1, mList->getCellContent(i, 1));
|
||||
mSearchList->setCellContent(j, 2, mList->getCellContent(i, 2));
|
||||
j++;
|
||||
}
|
||||
}
|
||||
count=mSearchList->getRowCount();
|
||||
mSearchList->setTableOffset(0);
|
||||
for(int i=0; i<count; i++)
|
||||
{
|
||||
if(mSearchList->getCellContent(i, 1).startsWith(arg1, Qt::CaseInsensitive) || mSearchList->getCellContent(i, 2).startsWith(arg1, Qt::CaseInsensitive))
|
||||
{
|
||||
if(count>mSearchList->getViewableRowsCount())
|
||||
{
|
||||
int cur=i-mSearchList->getViewableRowsCount()/2;
|
||||
if(!mSearchList->isValidIndex(cur, 0))
|
||||
cur=i;
|
||||
mSearchList->setTableOffset(cur);
|
||||
}
|
||||
mSearchList->setSingleSelection(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mSearchList->reloadData();
|
||||
mSearchList->setFocus();
|
||||
}
|
||||
|
||||
void SearchListView::listContextMenu(const QPoint & pos)
|
||||
{
|
||||
emit listContextMenuSignal(mCurList->mapToGlobal(pos));
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
#ifndef SEARCHLISTVIEW_H
|
||||
#define SEARCHLISTVIEW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLineEdit>
|
||||
#include "StdTable.h"
|
||||
|
||||
namespace Ui {
|
||||
class SearchListView;
|
||||
}
|
||||
|
||||
class SearchListView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SearchListView(QWidget* parent = 0);
|
||||
~SearchListView();
|
||||
|
||||
StdTable* mList;
|
||||
StdTable* mSearchList;
|
||||
StdTable* mCurList;
|
||||
QLineEdit* mSearchBox;
|
||||
|
||||
private slots:
|
||||
void searchTextChanged(const QString &arg1);
|
||||
void listKeyPressed(QKeyEvent* event);
|
||||
void listContextMenu(const QPoint & pos);
|
||||
|
||||
signals:
|
||||
void enterPressedSignal();
|
||||
void listContextMenuSignal(const QPoint & pos);
|
||||
|
||||
private:
|
||||
Ui::SearchListView* ui;
|
||||
QVBoxLayout* mMainLayout;
|
||||
QVBoxLayout* mListLayout;
|
||||
QWidget* mListPlaceHolder;
|
||||
|
||||
};
|
||||
|
||||
#endif // SEARCHLISTVIEW_H
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ReferenceView</class>
|
||||
<widget class="QWidget" name="ReferenceView">
|
||||
<class>SearchListView</class>
|
||||
<widget class="QWidget" name="SearchListView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
<number>2</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="searchLabel">
|
||||
|
|
@ -7,48 +7,39 @@ SymbolView::SymbolView(QWidget *parent) :
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Set main layout
|
||||
mMainLayout = new QVBoxLayout;
|
||||
mMainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mMainLayout->addWidget(ui->mainSplitter);
|
||||
setLayout(mMainLayout);
|
||||
|
||||
// Create reference view
|
||||
mSearchListView = new SearchListView();
|
||||
|
||||
// Get font information
|
||||
QFont wFont("Monospace", 8);
|
||||
wFont.setStyleHint(QFont::Monospace);
|
||||
wFont.setFixedPitch(true);
|
||||
|
||||
int charwidth=QFontMetrics(wFont).width(QChar(' '));
|
||||
|
||||
// Create module list
|
||||
mModuleList = new StdTable();
|
||||
mModuleList->addColumnAt(charwidth*2*sizeof(int_t)+8, "Base", false);
|
||||
mModuleList->addColumnAt(0, "Module", true);
|
||||
|
||||
// Create symbol list
|
||||
mSymbolList = new StdTable();
|
||||
mSymbolList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
mSymbolList->addColumnAt(charwidth*2*sizeof(int_t)+8, "Address", true);
|
||||
mSymbolList->addColumnAt(charwidth*80, "Symbol", true);
|
||||
mSymbolList->addColumnAt(0, "Symbol (undecorated)", true);
|
||||
// Setup symbol list
|
||||
mSearchListView->mList->addColumnAt(charwidth*2*sizeof(int_t)+8, "Address", true);
|
||||
mSearchListView->mList->addColumnAt(charwidth*80, "Symbol", true);
|
||||
mSearchListView->mList->addColumnAt(0, "Symbol (undecorated)", true);
|
||||
|
||||
// Create search list
|
||||
mSymbolSearchList = new StdTable();
|
||||
mSymbolSearchList->addColumnAt(charwidth*2*sizeof(int_t)+8, "Address", true);
|
||||
mSymbolSearchList->addColumnAt(charwidth*80, "Symbol Search", true);
|
||||
mSymbolSearchList->addColumnAt(0, "Symbol (undecorated)", true);
|
||||
mSymbolSearchList->hide();
|
||||
|
||||
// Create symbol layout
|
||||
mSymbolLayout = new QVBoxLayout();
|
||||
mSymbolLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mSymbolLayout->setSpacing(0);
|
||||
mSymbolLayout->addWidget(mSymbolList);
|
||||
mSymbolLayout->addWidget(mSymbolSearchList);
|
||||
|
||||
// Create symbol placeholder
|
||||
mSymbolPlaceHolder = new QWidget();
|
||||
mSymbolPlaceHolder->setLayout(mSymbolLayout);
|
||||
// Setup search list
|
||||
mSearchListView->mSearchList->addColumnAt(charwidth*2*sizeof(int_t)+8, "Address", true);
|
||||
mSearchListView->mSearchList->addColumnAt(charwidth*80, "Symbol", true);
|
||||
mSearchListView->mSearchList->addColumnAt(0, "Symbol (undecorated)", true);
|
||||
|
||||
// Setup list splitter
|
||||
ui->listSplitter->addWidget(mModuleList);
|
||||
ui->listSplitter->addWidget(mSymbolPlaceHolder);
|
||||
ui->listSplitter->addWidget(mSearchListView);
|
||||
#ifdef _WIN64
|
||||
// mModuleList : mSymbolList = 40 : 100
|
||||
ui->listSplitter->setStretchFactor(0, 40);
|
||||
|
|
@ -59,14 +50,14 @@ SymbolView::SymbolView(QWidget *parent) :
|
|||
ui->listSplitter->setStretchFactor(1, 100);
|
||||
#endif //_WIN64
|
||||
|
||||
// Setup log edit
|
||||
ui->symbolLogEdit->setFont(wFont);
|
||||
ui->symbolLogEdit->setStyleSheet("QTextEdit { background-color: rgb(255, 251, 240) }");
|
||||
ui->symbolLogEdit->setUndoRedoEnabled(false);
|
||||
ui->symbolLogEdit->setReadOnly(true);
|
||||
|
||||
// Log : List = 2 : 9
|
||||
ui->mainSplitter->setStretchFactor(0, 9);
|
||||
ui->mainSplitter->setStretchFactor(1, 2);
|
||||
ui->mainSplitter->setStretchFactor(1, 9);
|
||||
ui->mainSplitter->setStretchFactor(0, 2);
|
||||
|
||||
//setup context menu
|
||||
setupContextMenu();
|
||||
|
|
@ -78,10 +69,8 @@ SymbolView::SymbolView(QWidget *parent) :
|
|||
connect(mModuleList, SIGNAL(selectionChangedSignal(int)), this, SLOT(moduleSelectionChanged(int)));
|
||||
connect(Bridge::getBridge(), SIGNAL(updateSymbolList(int,SYMBOLMODULEINFO*)), this, SLOT(updateSymbolList(int,SYMBOLMODULEINFO*)));
|
||||
connect(Bridge::getBridge(), SIGNAL(setSymbolProgress(int)), ui->symbolProgress, SLOT(setValue(int)));
|
||||
connect(mSymbolList, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(symbolContextMenu(const QPoint &)));
|
||||
connect(mSymbolList, SIGNAL(keyPressedSignal(QKeyEvent*)), this, SLOT(symbolKeyPressed(QKeyEvent*)));
|
||||
connect(mSymbolSearchList, SIGNAL(keyPressedSignal(QKeyEvent*)), this, SLOT(symbolKeyPressed(QKeyEvent*)));
|
||||
connect(ui->searchBox, SIGNAL(textChanged(QString)), this, SLOT(searchTextChanged(QString)));
|
||||
connect(mSearchListView, SIGNAL(listContextMenuSignal(QPoint)), this, SLOT(symbolContextMenu(QPoint)));
|
||||
connect(mSearchListView, SIGNAL(enterPressedSignal()), this, SLOT(symbolFollow()));
|
||||
}
|
||||
|
||||
SymbolView::~SymbolView()
|
||||
|
|
@ -135,13 +124,13 @@ void SymbolView::cbSymbolEnum(SYMBOLINFO* symbol, void* user)
|
|||
|
||||
void SymbolView::moduleSelectionChanged(int index)
|
||||
{
|
||||
mSymbolList->setRowCount(0);
|
||||
DbgSymbolEnum(mModuleBaseList.at(index), cbSymbolEnum, mSymbolList);
|
||||
mSymbolList->reloadData();
|
||||
mSymbolList->setSingleSelection(0);
|
||||
mSymbolList->setTableOffset(0);
|
||||
mSymbolList->setFocus();
|
||||
ui->searchBox->setText("");
|
||||
mSearchListView->mList->setRowCount(0);
|
||||
DbgSymbolEnum(mModuleBaseList.at(index), cbSymbolEnum, mSearchListView->mList);
|
||||
mSearchListView->mList->reloadData();
|
||||
mSearchListView->mList->setSingleSelection(0);
|
||||
mSearchListView->mList->setTableOffset(0);
|
||||
mSearchListView->mList->setFocus();
|
||||
mSearchListView->mSearchBox->setText("");
|
||||
}
|
||||
|
||||
void SymbolView::updateSymbolList(int module_count, SYMBOLMODULEINFO* modules)
|
||||
|
|
@ -149,8 +138,8 @@ void SymbolView::updateSymbolList(int module_count, SYMBOLMODULEINFO* modules)
|
|||
mModuleList->setRowCount(module_count);
|
||||
if(!module_count)
|
||||
{
|
||||
mSymbolList->setRowCount(0);
|
||||
mSymbolList->setSingleSelection(0);
|
||||
mSearchListView->mList->setRowCount(0);
|
||||
mSearchListView->mList->setSingleSelection(0);
|
||||
mModuleList->setSingleSelection(0);
|
||||
}
|
||||
QList<uint_t> empty;
|
||||
|
|
@ -169,123 +158,35 @@ void SymbolView::updateSymbolList(int module_count, SYMBOLMODULEINFO* modules)
|
|||
|
||||
void SymbolView::symbolContextMenu(const QPoint & pos)
|
||||
{
|
||||
if(!mSymbolList->getRowCount())
|
||||
if(!mSearchListView->mCurList->getRowCount())
|
||||
return;
|
||||
QMenu* wMenu = new QMenu(this);
|
||||
wMenu->addAction(mFollowSymbolAction);
|
||||
wMenu->addSeparator();
|
||||
wMenu->addAction(mCopySymbolAddress);
|
||||
wMenu->addAction(mCopyDecoratedSymbolAction);
|
||||
if(mSymbolList->getCellContent(mSymbolList->getInitialSelection(), 2).length())
|
||||
if(mSearchListView->mCurList->getCellContent(mSearchListView->mCurList->getInitialSelection(), 2).length())
|
||||
wMenu->addAction(mCopyUndecoratedSymbolAction);
|
||||
wMenu->exec(mSymbolList->mapToGlobal(pos));
|
||||
wMenu->exec(pos);
|
||||
}
|
||||
|
||||
void SymbolView::symbolFollow()
|
||||
{
|
||||
StdTable* curList;
|
||||
if(mSymbolList->isHidden()) //search is active
|
||||
curList=mSymbolSearchList;
|
||||
else
|
||||
curList=mSymbolList;
|
||||
DbgCmdExecDirect(QString("disasm " + curList->getCellContent(curList->getInitialSelection(), 0)).toUtf8().constData());
|
||||
DbgCmdExecDirect(QString("disasm " + mSearchListView->mCurList->getCellContent(mSearchListView->mCurList->getInitialSelection(), 0)).toUtf8().constData());
|
||||
emit showCpu();
|
||||
}
|
||||
|
||||
void SymbolView::symbolAddressCopy()
|
||||
{
|
||||
StdTable* curList;
|
||||
if(mSymbolList->isHidden()) //search is active
|
||||
curList=mSymbolSearchList;
|
||||
else
|
||||
curList=mSymbolList;
|
||||
Bridge::CopyToClipboard(curList->getCellContent(curList->getInitialSelection(), 0).toUtf8().constData());
|
||||
Bridge::CopyToClipboard(mSearchListView->mCurList->getCellContent(mSearchListView->mCurList->getInitialSelection(), 0).toUtf8().constData());
|
||||
}
|
||||
|
||||
void SymbolView::symbolDecoratedCopy()
|
||||
{
|
||||
StdTable* curList;
|
||||
if(mSymbolList->isHidden()) //search is active
|
||||
curList=mSymbolSearchList;
|
||||
else
|
||||
curList=mSymbolList;
|
||||
Bridge::CopyToClipboard(curList->getCellContent(curList->getInitialSelection(), 1).toUtf8().constData());
|
||||
Bridge::CopyToClipboard(mSearchListView->mCurList->getCellContent(mSearchListView->mCurList->getInitialSelection(), 1).toUtf8().constData());
|
||||
}
|
||||
|
||||
void SymbolView::symbolUndecoratedCopy()
|
||||
{
|
||||
StdTable* curList;
|
||||
if(mSymbolList->isHidden()) //search is active
|
||||
curList=mSymbolSearchList;
|
||||
else
|
||||
curList=mSymbolList;
|
||||
Bridge::CopyToClipboard(curList->getCellContent(curList->getInitialSelection(), 2).toUtf8().constData());
|
||||
}
|
||||
|
||||
void SymbolView::symbolKeyPressed(QKeyEvent* event)
|
||||
{
|
||||
char ch=event->text().toUtf8().constData()[0];
|
||||
if(isprint(ch)) //add a char to the search box
|
||||
ui->searchBox->setText(ui->searchBox->text()+QString(QChar(ch)));
|
||||
else if(event->key()==Qt::Key_Backspace) //remove a char from the search box
|
||||
{
|
||||
QString newText;
|
||||
if(event->modifiers()==Qt::ControlModifier) //clear the search box
|
||||
newText="";
|
||||
else
|
||||
{
|
||||
newText=ui->searchBox->text();
|
||||
newText.chop(1);
|
||||
}
|
||||
ui->searchBox->setText(newText);
|
||||
}
|
||||
else if((event->key()==Qt::Key_Return || event->key()==Qt::Key_Enter) && event->modifiers()==Qt::NoModifier) //user pressed enter
|
||||
mFollowSymbolAction->trigger();
|
||||
}
|
||||
|
||||
void SymbolView::searchTextChanged(const QString &arg1)
|
||||
{
|
||||
if(arg1.length())
|
||||
{
|
||||
mSymbolList->hide();
|
||||
mSymbolSearchList->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
mSymbolSearchList->hide();
|
||||
mSymbolList->show();
|
||||
mSymbolList->setFocus();
|
||||
}
|
||||
mSymbolSearchList->setRowCount(0);
|
||||
int count=mSymbolList->getRowCount();
|
||||
for(int i=0,j=0; i<count; i++)
|
||||
{
|
||||
if(mSymbolList->getCellContent(i, 1).contains(arg1, Qt::CaseInsensitive) || mSymbolList->getCellContent(i, 2).contains(arg1, Qt::CaseInsensitive))
|
||||
{
|
||||
mSymbolSearchList->setRowCount(j+1);
|
||||
mSymbolSearchList->setCellContent(j, 0, mSymbolList->getCellContent(i, 0));
|
||||
mSymbolSearchList->setCellContent(j, 1, mSymbolList->getCellContent(i, 1));
|
||||
mSymbolSearchList->setCellContent(j, 2, mSymbolList->getCellContent(i, 2));
|
||||
j++;
|
||||
}
|
||||
}
|
||||
count=mSymbolSearchList->getRowCount();
|
||||
mSymbolSearchList->setTableOffset(0);
|
||||
for(int i=0; i<count; i++)
|
||||
{
|
||||
if(mSymbolSearchList->getCellContent(i, 1).startsWith(arg1, Qt::CaseInsensitive) || mSymbolSearchList->getCellContent(i, 2).startsWith(arg1, Qt::CaseInsensitive))
|
||||
{
|
||||
if(count>mSymbolSearchList->getViewableRowsCount())
|
||||
{
|
||||
int cur=i-mSymbolSearchList->getViewableRowsCount()/2;
|
||||
if(!mSymbolSearchList->isValidIndex(cur, 0))
|
||||
cur=i;
|
||||
mSymbolSearchList->setTableOffset(cur);
|
||||
}
|
||||
mSymbolSearchList->setSingleSelection(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
mSymbolSearchList->reloadData();
|
||||
mSymbolSearchList->setFocus();
|
||||
Bridge::CopyToClipboard(mSearchListView->mCurList->getCellContent(mSearchListView->mCurList->getInitialSelection(), 2).toUtf8().constData());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include <QMenu>
|
||||
#include "StdTable.h"
|
||||
#include "Bridge.h"
|
||||
#include "SearchListView.h"
|
||||
|
||||
namespace Ui {
|
||||
class SymbolView;
|
||||
|
|
@ -21,7 +22,7 @@ public:
|
|||
~SymbolView();
|
||||
void setupContextMenu();
|
||||
|
||||
public slots:
|
||||
private slots:
|
||||
void addMsgToSymbolLogSlot(QString msg);
|
||||
void clearSymbolLogSlot();
|
||||
void moduleSelectionChanged(int index);
|
||||
|
|
@ -31,8 +32,6 @@ public slots:
|
|||
void symbolAddressCopy();
|
||||
void symbolDecoratedCopy();
|
||||
void symbolUndecoratedCopy();
|
||||
void symbolKeyPressed(QKeyEvent* event);
|
||||
void searchTextChanged(const QString &arg1);
|
||||
|
||||
signals:
|
||||
void showCpu();
|
||||
|
|
@ -42,13 +41,9 @@ private:
|
|||
QVBoxLayout* mMainLayout;
|
||||
QVBoxLayout* mSymbolLayout;
|
||||
QWidget* mSymbolPlaceHolder;
|
||||
|
||||
SearchListView* mSearchListView;
|
||||
StdTable* mModuleList;
|
||||
StdTable* mSymbolList;
|
||||
StdTable* mSymbolSearchList;
|
||||
|
||||
QList<uint_t> mModuleBaseList;
|
||||
|
||||
QAction* mFollowSymbolAction;
|
||||
QAction* mCopySymbolAddress;
|
||||
QAction* mCopyDecoratedSymbolAction;
|
||||
|
|
|
|||
|
|
@ -40,61 +40,22 @@
|
|||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalListLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="listSplitter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalListLayout">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="searchLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Search:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="searchBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QSplitter" name="listSplitter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="childrenCollapsible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="logLayout">
|
||||
|
|
|
|||
Loading…
Reference in New Issue