mirror of https://github.com/mgba-emu/mgba.git
Qt: Printer quality of life improvements (fixes #1540)
This commit is contained in:
parent
c8cc2eba2e
commit
28151ee65c
1
CHANGES
1
CHANGES
|
@ -77,6 +77,7 @@ Misc:
|
||||||
- GBA BIOS: Fix clobbered registers in CpuSet (fixes mgba.io/i/1531)
|
- GBA BIOS: Fix clobbered registers in CpuSet (fixes mgba.io/i/1531)
|
||||||
- Qt: Remove What's This icon from dialogs
|
- Qt: Remove What's This icon from dialogs
|
||||||
- CMake: Don't use libzip on embedded platforms (fixes mgba.io/i/1527)
|
- CMake: Don't use libzip on embedded platforms (fixes mgba.io/i/1527)
|
||||||
|
- Qt: Printer quality of life improvements (fixes mgba.io/i/1540)
|
||||||
|
|
||||||
0.7.3: (2019-09-15)
|
0.7.3: (2019-09-15)
|
||||||
Emulation fixes:
|
Emulation fixes:
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "CoreController.h"
|
#include "CoreController.h"
|
||||||
#include "GBAApp.h"
|
#include "GBAApp.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
using namespace QGBA;
|
using namespace QGBA;
|
||||||
|
@ -24,6 +25,17 @@ PrinterView::PrinterView(std::shared_ptr<CoreController> controller, QWidget* pa
|
||||||
connect(m_ui.tear, &QAbstractButton::clicked, this, &PrinterView::clear);
|
connect(m_ui.tear, &QAbstractButton::clicked, this, &PrinterView::clear);
|
||||||
connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &PrinterView::save);
|
connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &PrinterView::save);
|
||||||
m_timer.setInterval(80);
|
m_timer.setInterval(80);
|
||||||
|
|
||||||
|
connect(m_ui.magnification, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [this](int mag) {
|
||||||
|
if (m_image.isNull()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int oldMag = m_ui.image->size().width() / m_image.size().width();
|
||||||
|
m_ui.image->setPixmap(m_image.scaled(m_image.size() * mag));
|
||||||
|
m_ui.image->setFixedWidth(m_image.size().width() * mag);
|
||||||
|
m_ui.image->setFixedHeight(m_ui.image->size().height() / oldMag * mag);
|
||||||
|
});
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,22 +64,22 @@ void PrinterView::printImage(const QImage& image) {
|
||||||
painter.drawPixmap(0, 0, m_image);
|
painter.drawPixmap(0, 0, m_image);
|
||||||
painter.drawImage(0, m_image.height(), image);
|
painter.drawImage(0, m_image.height(), image);
|
||||||
m_image = pixmap;
|
m_image = pixmap;
|
||||||
m_ui.image->setPixmap(m_image);
|
m_ui.image->setPixmap(m_image.scaled(m_image.size() * m_ui.magnification->value()));
|
||||||
m_timer.start();
|
m_timer.start();
|
||||||
m_ui.hurry->setEnabled(true);
|
m_ui.hurry->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrinterView::printLine() {
|
void PrinterView::printLine() {
|
||||||
m_ui.image->setFixedHeight(m_ui.image->height() + 1);
|
m_ui.image->setFixedHeight(m_ui.image->height() + m_ui.magnification->value());
|
||||||
m_ui.scrollArea->ensureVisible(0, m_ui.image->height(), 0, 0);
|
m_ui.scrollArea->ensureVisible(0, m_ui.image->height(), 0, 0);
|
||||||
if (m_ui.image->height() >= m_image.height()) {
|
if (m_ui.image->height() >= m_image.height() * m_ui.magnification->value()) {
|
||||||
printAll();
|
printAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrinterView::printAll() {
|
void PrinterView::printAll() {
|
||||||
m_timer.stop();
|
m_timer.stop();
|
||||||
m_ui.image->setFixedHeight(m_image.height());
|
m_ui.image->setFixedHeight(m_image.height() * m_ui.magnification->value());
|
||||||
m_controller->endPrint();
|
m_controller->endPrint();
|
||||||
m_ui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(true);
|
m_ui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(true);
|
||||||
m_ui.hurry->setEnabled(false);
|
m_ui.hurry->setEnabled(false);
|
||||||
|
|
|
@ -6,15 +6,15 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>241</width>
|
<width>246</width>
|
||||||
<height>311</height>
|
<height>425</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Game Boy Printer</string>
|
<string>Game Boy Printer</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item alignment="Qt::AlignHCenter">
|
<item>
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
@ -23,10 +23,15 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<property name="geometry">
|
||||||
<property name="spacing">
|
<rect>
|
||||||
<number>0</number>
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>234</width>
|
||||||
|
<height>249</height>
|
||||||
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout" rowstretch="1,0,1" columnminimumwidth="0,160,0">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -39,14 +44,36 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="1">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="0">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="image">
|
<widget class="QLabel" name="image">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
@ -60,18 +87,12 @@
|
||||||
<height>1</height>
|
<height>1</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>160</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="1">
|
||||||
<widget class="Line" name="line">
|
<widget class="Line" name="line">
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Plain</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
|
@ -81,6 +102,19 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -106,6 +140,62 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="magnification">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string>×</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Magnification</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="standardButtons">
|
<property name="standardButtons">
|
||||||
|
|
Loading…
Reference in New Issue