Qt: Add reset button to frame inspector

This commit is contained in:
Vicki Pfau 2019-06-02 15:56:21 -07:00
parent 427e3a6102
commit 00e8b9877f
3 changed files with 40 additions and 22 deletions

View File

@ -64,6 +64,7 @@ FrameView::FrameView(std::shared_ptr<CoreController> controller, QWidget* parent
invalidateQueue();
});
connect(m_ui.exportButton, &QAbstractButton::pressed, this, &FrameView::exportFrame);
connect(m_ui.reset, &QAbstractButton::pressed, this, &FrameView::reset);
m_backdropPicker = ColorPicker(m_ui.backdrop, QColor(0, 0, 0, 0));
connect(&m_backdropPicker, &ColorPicker::colorChanged, this, [this](const QColor& color) {
@ -432,6 +433,15 @@ void FrameView::exportFrame() {
m_framebuffer.save(filename, "PNG");
}
void FrameView::reset() {
m_disabled.clear();
for (Layer& layer : m_queue) {
layer.enabled = true;
}
m_overrideBackdrop = QColor();
invalidateQueue();
}
QString FrameView::LayerId::readable() const {
QString typeStr;
switch (type) {

View File

@ -39,6 +39,7 @@ public slots:
void selectLayer(const QPointF& coord);
void disableLayer(const QPointF& coord);
void exportFrame();
void reset();
protected:
#ifdef M_CORE_GBA

View File

@ -13,7 +13,7 @@
<property name="windowTitle">
<string>Inspect frame</string>
</property>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,1,0" columnstretch="0,1">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0,1,0,0,0" columnstretch="0,1">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
@ -87,27 +87,7 @@
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="disableScanline">
<property name="text">
<string>Disable scanline effects</string>
</property>
</widget>
</item>
<item row="4" column="0" rowspan="2">
<widget class="QListWidget" name="queue"/>
</item>
<item row="6" column="0">
<widget class="QPushButton" name="exportButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="7">
<item row="0" column="1" rowspan="9">
<widget class="QScrollArea" name="compositedArea">
<property name="widgetResizable">
<bool>true</bool>
@ -146,6 +126,33 @@
</widget>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="disableScanline">
<property name="text">
<string>Disable scanline effects</string>
</property>
</widget>
</item>
<item row="5" column="0" rowspan="2">
<widget class="QListWidget" name="queue"/>
</item>
<item row="8" column="0">
<widget class="QPushButton" name="exportButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QPushButton" name="reset">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>