mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-12-16 04:09:39 +00:00
CheatSearchWidget: Add GetTableRowCount function
This commit is contained in:
parent
9c97498f4b
commit
d364a244d7
@ -352,9 +352,8 @@ void CheatSearchWidget::OnNextScanClicked()
|
|||||||
|
|
||||||
m_address_table_current_values.clear();
|
m_address_table_current_values.clear();
|
||||||
const bool show_in_hex = m_display_values_in_hex_checkbox->isChecked();
|
const bool show_in_hex = m_display_values_in_hex_checkbox->isChecked();
|
||||||
const bool too_many_results = new_count > TABLE_MAX_ROWS;
|
const size_t row_count = GetTableRowCount();
|
||||||
const size_t result_count_to_display = too_many_results ? TABLE_MAX_ROWS : new_count;
|
for (size_t i = 0; i < row_count; ++i)
|
||||||
for (size_t i = 0; i < result_count_to_display; ++i)
|
|
||||||
{
|
{
|
||||||
m_address_table_current_values[m_session->GetResultAddress(i)] =
|
m_address_table_current_values[m_session->GetResultAddress(i)] =
|
||||||
m_session->GetResultValueAsString(i, show_in_hex);
|
m_session->GetResultValueAsString(i, show_in_hex);
|
||||||
@ -585,6 +584,11 @@ void CheatSearchWidget::GenerateARCodes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t CheatSearchWidget::GetTableRowCount() const
|
||||||
|
{
|
||||||
|
return std::min(TABLE_MAX_ROWS, m_session->GetResultCount());
|
||||||
|
}
|
||||||
|
|
||||||
void CheatSearchWidget::RefreshCurrentValueTableItem(
|
void CheatSearchWidget::RefreshCurrentValueTableItem(
|
||||||
QTableWidgetItem* const current_value_table_item)
|
QTableWidgetItem* const current_value_table_item)
|
||||||
{
|
{
|
||||||
@ -615,12 +619,10 @@ void CheatSearchWidget::RecreateGUITable()
|
|||||||
m_address_table->setHorizontalHeaderLabels(
|
m_address_table->setHorizontalHeaderLabels(
|
||||||
{tr("Description"), tr("Address"), tr("Last Value"), tr("Current Value")});
|
{tr("Description"), tr("Address"), tr("Last Value"), tr("Current Value")});
|
||||||
|
|
||||||
const size_t result_count = m_session->GetResultCount();
|
const int row_count = static_cast<int>(GetTableRowCount());
|
||||||
const bool too_many_results = result_count > TABLE_MAX_ROWS;
|
m_address_table->setRowCount(row_count);
|
||||||
const int result_count_to_display = int(too_many_results ? TABLE_MAX_ROWS : result_count);
|
|
||||||
m_address_table->setRowCount(result_count_to_display);
|
|
||||||
|
|
||||||
for (int i = 0; i < result_count_to_display; ++i)
|
for (int i = 0; i < row_count; ++i)
|
||||||
{
|
{
|
||||||
const u32 address = m_session->GetResultAddress(i);
|
const u32 address = m_session->GetResultAddress(i);
|
||||||
const auto user_data_it = m_address_table_user_data.find(address);
|
const auto user_data_it = m_address_table_user_data.find(address);
|
||||||
|
|||||||
@ -73,6 +73,7 @@ private:
|
|||||||
void GenerateARCodes();
|
void GenerateARCodes();
|
||||||
int GetVisibleRowsBeginIndex() const;
|
int GetVisibleRowsBeginIndex() const;
|
||||||
int GetVisibleRowsEndIndex() const;
|
int GetVisibleRowsEndIndex() const;
|
||||||
|
size_t GetTableRowCount() const;
|
||||||
|
|
||||||
Core::System& m_system;
|
Core::System& m_system;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user