mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 17:11:23 +00:00
Qt: Random unimportant stuff
This commit is contained in:
parent
99be645fcc
commit
e4a9c177e6
@ -197,22 +197,22 @@ namespace gui
|
||||
return;
|
||||
|
||||
int item_count = table->rowCount();
|
||||
bool is_empty = item_count < 1;
|
||||
const bool is_empty = item_count < 1;
|
||||
if (is_empty)
|
||||
table->insertRow(0);
|
||||
|
||||
int item_height = table->rowHeight(0);
|
||||
const int item_height = table->rowHeight(0);
|
||||
if (is_empty)
|
||||
{
|
||||
table->clearContents();
|
||||
table->setRowCount(0);
|
||||
}
|
||||
|
||||
int available_height = table->rect().height() - table->horizontalHeader()->height() - table->frameWidth() * 2;
|
||||
const int available_height = table->rect().height() - table->horizontalHeader()->height() - table->frameWidth() * 2;
|
||||
if (available_height < item_height || item_height < 1)
|
||||
return;
|
||||
|
||||
int new_item_count = available_height / item_height;
|
||||
const int new_item_count = available_height / item_height;
|
||||
if (new_item_count == item_count)
|
||||
return;
|
||||
|
||||
|
@ -103,9 +103,9 @@ save_data_list_dialog::save_data_list_dialog(const std::vector<SaveDataEntry>& e
|
||||
|
||||
connect(m_list, &QTableWidget::cellChanged, [&](int row, int col)
|
||||
{
|
||||
int originalIndex = m_list->item(row, 0)->data(Qt::UserRole).toInt();
|
||||
SaveDataEntry originalEntry = m_save_entries[originalIndex];
|
||||
QString originalDirName = qstr(originalEntry.dirName);
|
||||
const int originalIndex = m_list->item(row, 0)->data(Qt::UserRole).toInt();
|
||||
const SaveDataEntry originalEntry = m_save_entries[originalIndex];
|
||||
const QString originalDirName = qstr(originalEntry.dirName);
|
||||
QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap();
|
||||
currNotes[originalDirName] = m_list->item(row, col)->text();
|
||||
m_gui_settings->SetValue(gui::m_saveNotes, currNotes);
|
||||
@ -124,7 +124,7 @@ void save_data_list_dialog::UpdateSelectionLabel()
|
||||
}
|
||||
else
|
||||
{
|
||||
int entry = m_list->item(m_list->currentRow(), 0)->data(Qt::UserRole).toInt();
|
||||
const int entry = m_list->item(m_list->currentRow(), 0)->data(Qt::UserRole).toInt();
|
||||
m_entry_label->setText(tr("Currently Selected: ") + qstr(m_save_entries[entry].dirName));
|
||||
}
|
||||
}
|
||||
@ -132,8 +132,7 @@ void save_data_list_dialog::UpdateSelectionLabel()
|
||||
|
||||
s32 save_data_list_dialog::GetSelection()
|
||||
{
|
||||
int res = result();
|
||||
if (res == QDialog::Accepted)
|
||||
if (result() == QDialog::Accepted)
|
||||
{
|
||||
if (m_entry == selection_code::new_save)
|
||||
{ // Save new entry
|
||||
@ -159,7 +158,7 @@ void save_data_list_dialog::OnSort(int logicalIndex)
|
||||
m_sort_ascending = true;
|
||||
}
|
||||
m_sort_column = logicalIndex;
|
||||
Qt::SortOrder sort_order = m_sort_ascending ? Qt::AscendingOrder : Qt::DescendingOrder;
|
||||
const Qt::SortOrder sort_order = m_sort_ascending ? Qt::AscendingOrder : Qt::DescendingOrder;
|
||||
m_list->sortByColumn(m_sort_column, sort_order);
|
||||
}
|
||||
}
|
||||
@ -167,8 +166,7 @@ void save_data_list_dialog::OnSort(int logicalIndex)
|
||||
//Display info dialog directly.
|
||||
void save_data_list_dialog::OnEntryInfo()
|
||||
{
|
||||
int idx = m_list->currentRow();
|
||||
if (idx != -1)
|
||||
if (const int idx = m_list->currentRow(); idx != -1)
|
||||
{
|
||||
save_data_info_dialog* infoDialog = new save_data_info_dialog(m_save_entries[idx], this);
|
||||
infoDialog->setModal(true);
|
||||
@ -181,7 +179,7 @@ void save_data_list_dialog::UpdateList()
|
||||
m_list->clearContents();
|
||||
m_list->setRowCount(::narrow<int>(m_save_entries.size()));
|
||||
|
||||
QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap();
|
||||
const QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap();
|
||||
|
||||
int row = 0;
|
||||
for (const SaveDataEntry& entry: m_save_entries)
|
||||
@ -218,15 +216,15 @@ void save_data_list_dialog::UpdateList()
|
||||
m_list->horizontalHeader()->resizeSections(QHeaderView::ResizeToContents);
|
||||
m_list->verticalHeader()->resizeSections(QHeaderView::ResizeToContents);
|
||||
|
||||
QSize tableSize = QSize
|
||||
const QSize table_size
|
||||
(
|
||||
m_list->verticalHeader()->width() + m_list->horizontalHeader()->length() + m_list->frameWidth() * 2,
|
||||
m_list->horizontalHeader()->height() + m_list->verticalHeader()->length() + m_list->frameWidth() * 2
|
||||
);
|
||||
|
||||
QSize preferredSize = minimumSize().expandedTo(sizeHint() - m_list->sizeHint() + tableSize);
|
||||
const QSize preferred_size = minimumSize().expandedTo(sizeHint() - m_list->sizeHint() + table_size);
|
||||
|
||||
QSize maxSize = QSize(preferredSize.width(), static_cast<int>(QGuiApplication::primaryScreen()->geometry().height() * 0.6));
|
||||
const QSize max_size(preferred_size.width(), static_cast<int>(QGuiApplication::primaryScreen()->geometry().height() * 0.6));
|
||||
|
||||
resize(preferredSize.boundedTo(maxSize));
|
||||
resize(preferred_size.boundedTo(max_size));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user