all repos — mgba @ b9d4101937d166a24018b5bb5423ead87c22f6bc

mGBA Game Boy Advance Emulator

Paint background on savestate window
Jeffrey Pfau jeffrey@endrift.com
Thu, 16 Oct 2014 04:07:19 -0700
commit

b9d4101937d166a24018b5bb5423ead87c22f6bc

parent

1d00ccf6ddb760313c8f4fd0e8bd2e21ae64eca6

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

@@ -4,6 +4,7 @@ #include "GameController.h"

#include "VFileDevice.h" #include <QKeyEvent> +#include <QPainter> extern "C" { #include "gba-serialize.h"

@@ -138,3 +139,10 @@ void LoadSaveState::showEvent(QShowEvent* event) {

m_slots[m_currentFocus]->setFocus(); QWidget::showEvent(event); } + +void LoadSaveState::paintEvent(QPaintEvent* event) { + QPainter painter(this); + QRect full(QPoint(), size()); + painter.drawPixmap(full, m_currentImage); + painter.fillRect(full, QColor(0, 0, 0, 128)); +}
M src/platform/qt/LoadSaveState.hsrc/platform/qt/LoadSaveState.h

@@ -32,6 +32,7 @@ protected:

virtual bool eventFilter(QObject*, QEvent*) override; virtual void closeEvent(QCloseEvent*) override; virtual void showEvent(QShowEvent*) override; + virtual void paintEvent(QPaintEvent*) override; private: void loadState(int slot);
M src/platform/qt/LoadSaveState.uisrc/platform/qt/LoadSaveState.ui

@@ -94,7 +94,7 @@ <verstretch>0</verstretch>

</sizepolicy> </property> <property name="styleSheet"> - <string notr="true">font-size: 30pt; font-weight: bold;</string> + <string notr="true">font-size: 30pt; font-weight: bold; color: white;</string> </property> <property name="text"> <string>%1 State</string>
M src/platform/qt/SavestateButton.cppsrc/platform/qt/SavestateButton.cpp

@@ -19,8 +19,12 @@ QPalette palette = QApplication::palette(this);

painter.setPen(Qt::black); QLinearGradient grad(0, 0, 0, 1); grad.setCoordinateMode(QGradient::ObjectBoundingMode); - grad.setColorAt(0, palette.color(QPalette::Shadow)); - grad.setColorAt(1, palette.color(QPalette::Dark)); + QColor shadow = palette.color(QPalette::Shadow); + QColor dark = palette.color(QPalette::Dark); + shadow.setAlpha(128); + dark.setAlpha(128); + grad.setColorAt(0, shadow); + grad.setColorAt(1, dark); painter.setBrush(grad); painter.drawRect(frame); painter.setPen(Qt::NoPen);