all repos — mgba @ cd8cc128299b34561a7fc14dfcb609f3beae26cb

mGBA Game Boy Advance Emulator

Draw text for empty slots
Jeffrey Pfau jeffrey@endrift.com
Thu, 16 Oct 2014 00:17:09 -0700
commit

cd8cc128299b34561a7fc14dfcb609f3beae26cb

parent

e2de508b99e60a9df3ec6da02db45803bbd20097

2 files changed, 6 insertions(+), 1 deletions(-)

jump to
M src/platform/qt/LoadSaveState.cppsrc/platform/qt/LoadSaveState.cpp

@@ -83,6 +83,7 @@ void LoadSaveState::loadState(int slot) {

GBAThread* thread = m_controller->thread(); VFile* vf = GBAGetState(thread->gba, thread->stateDir, slot, false); if (!vf) { + m_slots[slot - 1]->setText(tr("Empty")); return; } VFileDevice vdev(vf);
M src/platform/qt/SavestateButton.cppsrc/platform/qt/SavestateButton.cpp

@@ -24,10 +24,14 @@ grad.setColorAt(1, palette.color(QPalette::Dark));

painter.setBrush(grad); painter.drawRect(frame); painter.setPen(Qt::NoPen); - painter.drawPixmap(full, icon().pixmap(full.size())); + if (!icon().isNull()) { + painter.drawPixmap(full, icon().pixmap(full.size())); + } if (hasFocus()) { QColor highlight = palette.color(QPalette::Highlight); highlight.setAlpha(128); painter.fillRect(full, highlight); } + painter.setPen(QPen(palette.text(), 0)); + painter.drawText(full, Qt::AlignCenter, text()); }