mirror of https://github.com/mgba-emu/mgba.git
Qt: Add copy button to GB printer dialog
This commit is contained in:
parent
5a50f47bf7
commit
e1b57de035
1
CHANGES
1
CHANGES
|
@ -85,6 +85,7 @@ Misc:
|
|||
- Qt: Add hex index to palette view
|
||||
- Qt: Add transformation matrix info to sprite view
|
||||
- Qt: Memory viewer now supports editing decimal values directly (closes mgba.io/i/1705)
|
||||
- Qt: Add copy button to GB printer dialog
|
||||
- Util: Reset vector size on deinit
|
||||
- VFS: Change semantics of VFile.sync on mapped files (fixes mgba.io/i/1730)
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "GBAApp.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QClipboard>
|
||||
#include <QPainter>
|
||||
|
||||
using namespace QGBA;
|
||||
|
@ -23,6 +24,7 @@ PrinterView::PrinterView(std::shared_ptr<CoreController> controller, QWidget* pa
|
|||
connect(&m_timer, &QTimer::timeout, this, &PrinterView::printLine);
|
||||
connect(m_ui.hurry, &QAbstractButton::clicked, this, &PrinterView::printAll);
|
||||
connect(m_ui.tear, &QAbstractButton::clicked, this, &PrinterView::clear);
|
||||
connect(m_ui.copyButton, &QAbstractButton::clicked, this, &PrinterView::copy);
|
||||
connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &PrinterView::save);
|
||||
m_timer.setInterval(80);
|
||||
|
||||
|
@ -41,6 +43,11 @@ PrinterView::PrinterView(std::shared_ptr<CoreController> controller, QWidget* pa
|
|||
connect(save, &QAction::triggered, this, &PrinterView::save);
|
||||
addAction(save);
|
||||
|
||||
QAction* copyAction = new QAction(this);
|
||||
copyAction->setShortcut(QKeySequence::Copy);
|
||||
connect(copyAction, &QAction::triggered, this, &PrinterView::copy);
|
||||
addAction(copyAction);
|
||||
|
||||
clear();
|
||||
}
|
||||
|
||||
|
@ -56,11 +63,16 @@ void PrinterView::save() {
|
|||
m_image.save(filename);
|
||||
}
|
||||
|
||||
void PrinterView::copy() {
|
||||
GBAApp::app()->clipboard()->setImage(m_image.toImage());
|
||||
}
|
||||
|
||||
void PrinterView::clear() {
|
||||
m_ui.image->setFixedHeight(0);
|
||||
m_image = QPixmap();
|
||||
m_ui.image->clear();
|
||||
m_ui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
|
||||
m_ui.copyButton->setEnabled(false);
|
||||
}
|
||||
|
||||
void PrinterView::printImage(const QImage& image) {
|
||||
|
@ -87,5 +99,6 @@ void PrinterView::printAll() {
|
|||
m_ui.image->setFixedHeight(m_image.height() * m_ui.magnification->value());
|
||||
m_controller->endPrint();
|
||||
m_ui.buttonBox->button(QDialogButtonBox::Save)->setEnabled(true);
|
||||
m_ui.copyButton->setEnabled(true);
|
||||
m_ui.hurry->setEnabled(false);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ signals:
|
|||
|
||||
public slots:
|
||||
void save();
|
||||
void copy();
|
||||
void clear();
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -196,14 +196,54 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="copyButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="edit-copy">
|
||||
<normaloff>.</normaloff>.</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Save</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
|
Loading…
Reference in New Issue