mirror of https://github.com/mgba-emu/mgba.git
Draw text for empty slots
This commit is contained in:
parent
e2de508b99
commit
cd8cc12829
|
@ -83,6 +83,7 @@ void LoadSaveState::loadState(int slot) {
|
||||||
GBAThread* thread = m_controller->thread();
|
GBAThread* thread = m_controller->thread();
|
||||||
VFile* vf = GBAGetState(thread->gba, thread->stateDir, slot, false);
|
VFile* vf = GBAGetState(thread->gba, thread->stateDir, slot, false);
|
||||||
if (!vf) {
|
if (!vf) {
|
||||||
|
m_slots[slot - 1]->setText(tr("Empty"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VFileDevice vdev(vf);
|
VFileDevice vdev(vf);
|
||||||
|
|
|
@ -24,10 +24,14 @@ void SavestateButton::paintEvent(QPaintEvent*) {
|
||||||
painter.setBrush(grad);
|
painter.setBrush(grad);
|
||||||
painter.drawRect(frame);
|
painter.drawRect(frame);
|
||||||
painter.setPen(Qt::NoPen);
|
painter.setPen(Qt::NoPen);
|
||||||
|
if (!icon().isNull()) {
|
||||||
painter.drawPixmap(full, icon().pixmap(full.size()));
|
painter.drawPixmap(full, icon().pixmap(full.size()));
|
||||||
|
}
|
||||||
if (hasFocus()) {
|
if (hasFocus()) {
|
||||||
QColor highlight = palette.color(QPalette::Highlight);
|
QColor highlight = palette.color(QPalette::Highlight);
|
||||||
highlight.setAlpha(128);
|
highlight.setAlpha(128);
|
||||||
painter.fillRect(full, highlight);
|
painter.fillRect(full, highlight);
|
||||||
}
|
}
|
||||||
|
painter.setPen(QPen(palette.text(), 0));
|
||||||
|
painter.drawText(full, Qt::AlignCenter, text());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue