diff --git a/CHANGES b/CHANGES index df57e44ac..bb3d134c2 100644 --- a/CHANGES +++ b/CHANGES @@ -77,6 +77,7 @@ Misc: - GBA BIOS: Fix clobbered registers in CpuSet (fixes mgba.io/i/1531) - Qt: Remove What's This icon from dialogs - 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) Emulation fixes: diff --git a/src/platform/qt/PrinterView.cpp b/src/platform/qt/PrinterView.cpp index 2a2b621cf..9386e0994 100644 --- a/src/platform/qt/PrinterView.cpp +++ b/src/platform/qt/PrinterView.cpp @@ -8,6 +8,7 @@ #include "CoreController.h" #include "GBAApp.h" +#include #include using namespace QGBA; @@ -24,6 +25,17 @@ PrinterView::PrinterView(std::shared_ptr controller, QWidget* pa connect(m_ui.tear, &QAbstractButton::clicked, this, &PrinterView::clear); connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &PrinterView::save); m_timer.setInterval(80); + + connect(m_ui.magnification, static_cast(&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(); } @@ -52,22 +64,22 @@ void PrinterView::printImage(const QImage& image) { painter.drawPixmap(0, 0, m_image); painter.drawImage(0, m_image.height(), image); 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_ui.hurry->setEnabled(true); } 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); - if (m_ui.image->height() >= m_image.height()) { + if (m_ui.image->height() >= m_image.height() * m_ui.magnification->value()) { printAll(); } } void PrinterView::printAll() { 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_ui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(true); m_ui.hurry->setEnabled(false); diff --git a/src/platform/qt/PrinterView.ui b/src/platform/qt/PrinterView.ui index ceac7c577..b103ae768 100644 --- a/src/platform/qt/PrinterView.ui +++ b/src/platform/qt/PrinterView.ui @@ -6,15 +6,15 @@ 0 0 - 241 - 311 + 246 + 425 Game Boy Printer - + QFrame::NoFrame @@ -23,10 +23,15 @@ true - - - 0 - + + + 0 + 0 + 234 + 249 + + + 0 @@ -39,14 +44,36 @@ 0 - + + 0 + + Qt::Vertical + + + 0 + 0 + + - + + + + Qt::Horizontal + + + + 0 + 0 + + + + + @@ -60,18 +87,12 @@ 1 - - - 160 - 16777215 - - Qt::AlignHCenter|Qt::AlignTop - + QFrame::Plain @@ -81,6 +102,19 @@ + + + + Qt::Horizontal + + + + 0 + 0 + + + + @@ -106,6 +140,62 @@ + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + × + + + 1 + + + 8 + + + + + + + Magnification + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + +