| 284 | |
| 285 | |
| 286 | void KCTriageView::initSymbolTable() |
| 287 | { |
| 288 | m_symbolTable = new SymbolTableView(this, m_cache); |
| 289 | |
| 290 | auto symbolFilterEdit = new FilterEdit(m_symbolTable); |
| 291 | connect(symbolFilterEdit, &FilterEdit::textChanged, [this](const QString& filter) { |
| 292 | m_symbolTable->setFilter(filter.toStdString()); |
| 293 | }); |
| 294 | |
| 295 | auto loadSymbolImageButton = new QPushButton(); |
| 296 | connect(loadSymbolImageButton, &QPushButton::clicked, [this](bool) { |
| 297 | auto selected = m_symbolTable->selectionModel()->selectedRows(); |
| 298 | std::vector<uint64_t> addresses; |
| 299 | for (const auto& row : selected) |
| 300 | addresses.push_back(row.data().toString().toULongLong(nullptr, 16)); |
| 301 | loadImagesWithAddr(addresses); |
| 302 | }); |
| 303 | loadSymbolImageButton->setText("Load Image"); |
| 304 | |
| 305 | // Shows the current selected rows image name. |
| 306 | auto currentImageLabel = new QLabel(this); |
| 307 | currentImageLabel->setText(""); |
| 308 | currentImageLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
| 309 | connect(m_symbolTable->selectionModel(), &QItemSelectionModel::currentRowChanged, this, [this, currentImageLabel](const QModelIndex ¤t, const QModelIndex &) { |
| 310 | auto symbol = m_symbolTable->getSymbolAtRow(current.row()); |
| 311 | auto imageName = m_cache->GetImageNameForAddress(symbol.address); |
| 312 | currentImageLabel->setText("Image: " + QString::fromStdString(imageName)); |
| 313 | }); |
| 314 | |
| 315 | auto symbolFooterLayout = new QHBoxLayout; |
| 316 | symbolFooterLayout->addWidget(loadSymbolImageButton); |
| 317 | symbolFooterLayout->addWidget(currentImageLabel); |
| 318 | symbolFooterLayout->setAlignment(Qt::AlignLeft); |
| 319 | |
| 320 | auto symbolLayout = new QVBoxLayout; |
| 321 | symbolLayout->addWidget(symbolFilterEdit); |
| 322 | symbolLayout->addWidget(m_symbolTable); |
| 323 | symbolLayout->addLayout(symbolFooterLayout); |
| 324 | |
| 325 | auto symbolWidget = new QWidget; |
| 326 | symbolWidget->setLayout(symbolLayout); |
| 327 | |
| 328 | std::function<void(uint64_t)> navigateToAddress = [=](uint64_t addr) { |
| 329 | ExecuteOnMainThread([addr, this](){ |
| 330 | if (Settings::Instance()->Get<bool>("ui.view.graph.preferred")) |
| 331 | m_data->Navigate("Graph:KCView", addr); |
| 332 | else |
| 333 | m_data->Navigate("Linear:KCView", addr); |
| 334 | }); |
| 335 | }; |
| 336 | |
| 337 | connect(m_symbolTable, &SymbolTableView::activated, this, [=](const QModelIndex& index) |
| 338 | { |
| 339 | auto symbol = m_symbolTable->getSymbolAtRow(index.row()); |
| 340 | WorkerPriorityEnqueue([this, symbol, navigateToAddress]() { |
| 341 | if (m_data->IsValidOffset(symbol.address)) |
| 342 | navigateToAddress(symbol.address); |
| 343 | else |
nothing calls this directly
no test coverage detected