33
44#include " memorycardeditorwindow.h"
55#include " mainwindow.h"
6+ #include " qthost.h"
67#include " qtutils.h"
78
89#include " core/host.h"
@@ -139,9 +140,13 @@ MemoryCardEditorWindow::MemoryCardEditorWindow() : QWidget()
139140 m_card_a.path_cb = m_ui.cardAPath ;
140141 m_card_a.table = m_ui.cardA ;
141142 m_card_a.blocks_free_label = m_ui.cardAUsage ;
143+ m_card_a.modified_icon_label = m_ui.cardAModifiedIcon ;
144+ m_card_a.modified_label = m_ui.cardAModified ;
142145 m_card_b.path_cb = m_ui.cardBPath ;
143146 m_card_b.table = m_ui.cardB ;
144147 m_card_b.blocks_free_label = m_ui.cardBUsage ;
148+ m_card_b.modified_icon_label = m_ui.cardBModifiedIcon ;
149+ m_card_b.modified_label = m_ui.cardBModified ;
145150
146151 m_file_icon_width = MEMORY_CARD_ICON_SIZE + (m_card_a.table ->showGrid () ? 1 : 0 );
147152 m_file_icon_height = MEMORY_CARD_ICON_SIZE + (m_card_a.table ->showGrid () ? 1 : 0 );
@@ -155,6 +160,8 @@ MemoryCardEditorWindow::MemoryCardEditorWindow() : QWidget()
155160 connectCardUi (&m_card_b, m_ui.buttonBoxB );
156161 populateComboBox (m_ui.cardAPath );
157162 populateComboBox (m_ui.cardBPath );
163+ updateCardBlocksFree (&m_card_a);
164+ updateCardBlocksFree (&m_card_b);
158165 updateButtonState ();
159166
160167 const QString new_card_hover_text (tr (" New Card..." ));
@@ -236,6 +243,7 @@ bool MemoryCardEditorWindow::event(QEvent* event)
236243
237244void MemoryCardEditorWindow::createCardButtons (Card* card, QDialogButtonBox* buttonBox)
238245{
246+ card->modified_icon_label ->setPixmap (QIcon (QtHost::GetResourceQPath (" images/warning.svg" , true )).pixmap (16 , 16 ));
239247 card->format_button = buttonBox->addButton (tr (" Format Card" ), QDialogButtonBox::ActionRole);
240248 card->import_file_button = buttonBox->addButton (tr (" Import File..." ), QDialogButtonBox::ActionRole);
241249 card->import_button = buttonBox->addButton (tr (" Import Card..." ), QDialogButtonBox::ActionRole);
@@ -351,13 +359,12 @@ bool MemoryCardEditorWindow::loadCard(const QString& filename, Card* card)
351359 card->table ->setRowCount (0 );
352360 card->dirty = false ;
353361 card->save_button ->setEnabled (false );
354- card->blocks_free_label ->clear ();
355-
356362 card->filename .clear ();
357363
358364 if (filename.isEmpty ())
359365 {
360366 updateButtonState ();
367+ updateCardBlocksFree (card);
361368 return false ;
362369 }
363370
@@ -468,9 +475,19 @@ void MemoryCardEditorWindow::incrementAnimationFrame()
468475
469476void MemoryCardEditorWindow::updateCardBlocksFree (Card* card)
470477{
471- card->blocks_free = MemoryCardImage::GetFreeBlockCount (card->data );
472- card->blocks_free_label ->setText (
473- tr (" %n block(s) free%1" , " " , card->blocks_free ).arg (card->dirty ? QStringLiteral (" (*)" ) : QString ()));
478+ if (!card->filename .empty ())
479+ {
480+ card->blocks_free = MemoryCardImage::GetFreeBlockCount (card->data );
481+ card->blocks_free_label ->setText (tr (" %n block(s) free" , " " , card->blocks_free ));
482+ card->modified_icon_label ->setVisible (card->dirty );
483+ card->modified_label ->setVisible (card->dirty );
484+ }
485+ else
486+ {
487+ card->blocks_free_label ->clear ();
488+ card->modified_icon_label ->setVisible (false );
489+ card->modified_label ->setVisible (false );
490+ }
474491}
475492
476493void MemoryCardEditorWindow::setCardDirty (Card* card)
0 commit comments