mirror of https://github.com/mgba-emu/mgba.git
Qt: More GIF view UX fixes
This commit is contained in:
parent
458a95e11f
commit
a5fc8429eb
|
@ -25,6 +25,8 @@ GIFView::GIFView(QWidget* parent)
|
|||
|
||||
connect(m_ui.selectFile, &QAbstractButton::clicked, this, &GIFView::selectFile);
|
||||
connect(m_ui.filename, &QLineEdit::textChanged, this, &GIFView::setFilename);
|
||||
connect(m_ui.fmtGif, &QAbstractButton::clicked, this, &GIFView::changeExtension);
|
||||
connect(m_ui.fmtApng, &QAbstractButton::clicked, this, &GIFView::changeExtension);
|
||||
|
||||
FFmpegEncoderInit(&m_encoder);
|
||||
FFmpegEncoderSetAudio(&m_encoder, nullptr, 0);
|
||||
|
@ -92,4 +94,21 @@ void GIFView::setFilename(const QString& filename) {
|
|||
}
|
||||
}
|
||||
|
||||
void GIFView::changeExtension() {
|
||||
if (m_filename.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
QString filename = m_filename;
|
||||
int index = m_filename.lastIndexOf(".");
|
||||
if (index >= 0) {
|
||||
filename.truncate(index);
|
||||
}
|
||||
if (m_ui.fmtGif->isChecked()) {
|
||||
filename += ".gif";
|
||||
} else if (m_ui.fmtApng->isChecked()) {
|
||||
filename += ".png";
|
||||
}
|
||||
m_ui.filename->setText(filename);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -41,6 +41,7 @@ signals:
|
|||
private slots:
|
||||
void selectFile();
|
||||
void setFilename(const QString&);
|
||||
void changeExtension();
|
||||
|
||||
private:
|
||||
Ui::GIFView m_ui;
|
||||
|
|
Loading…
Reference in New Issue