mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-05-09 05:35:43 -04:00
Qt/MemoryCardEditor: Handle switching to empty path at combobox index 0
This commit is contained in:
parent
0218006e1b
commit
e939507f42
@ -112,12 +112,7 @@ void MemoryCardEditorDialog::populateComboBox(QComboBox* cb)
|
|||||||
|
|
||||||
void MemoryCardEditorDialog::loadCardFromComboBox(Card* card, int index)
|
void MemoryCardEditorDialog::loadCardFromComboBox(Card* card, int index)
|
||||||
{
|
{
|
||||||
QString filename = card->path_cb->itemData(index).toString();
|
loadCard(card->path_cb->itemData(index).toString(), card);
|
||||||
|
|
||||||
if (filename.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
loadCard(filename, card);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryCardEditorDialog::onCardASelectionChanged()
|
void MemoryCardEditorDialog::onCardASelectionChanged()
|
||||||
@ -166,6 +161,12 @@ bool MemoryCardEditorDialog::loadCard(const QString& filename, Card* card)
|
|||||||
|
|
||||||
card->filename.clear();
|
card->filename.clear();
|
||||||
|
|
||||||
|
if (filename.isEmpty())
|
||||||
|
{
|
||||||
|
updateButtonState();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::string filename_str = filename.toStdString();
|
std::string filename_str = filename.toStdString();
|
||||||
if (!MemoryCardImage::LoadFromFile(&card->data, filename_str.c_str()))
|
if (!MemoryCardImage::LoadFromFile(&card->data, filename_str.c_str()))
|
||||||
{
|
{
|
||||||
@ -435,4 +436,6 @@ void MemoryCardEditorDialog::updateButtonState()
|
|||||||
m_ui.moveRight->setEnabled(both_cards_present && has_selection && !is_card_b);
|
m_ui.moveRight->setEnabled(both_cards_present && has_selection && !is_card_b);
|
||||||
m_ui.importCardA->setEnabled(card_a_present);
|
m_ui.importCardA->setEnabled(card_a_present);
|
||||||
m_ui.importCardB->setEnabled(card_b_present);
|
m_ui.importCardB->setEnabled(card_b_present);
|
||||||
|
m_ui.importFileToCardA->setEnabled(card_a_present);
|
||||||
|
m_ui.importFileToCardB->setEnabled(card_b_present);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user