MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / recordAnimated

Method recordAnimated

gui/qt/mainwindow.cpp:1716–1769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1714
1715#ifdef PNG_WRITE_APNG_SUPPORTED
1716void MainWindow::recordAnimated() {
1717 static QString path;
1718
1719 if (guiDebug || guiSend) {
1720 return;
1721 }
1722
1723 if (path.isEmpty()) {
1724 if (m_recording) {
1725 return;
1726 }
1727 path = QDir::tempPath() + QDir::separator() + QStringLiteral("apng_tmp.png");
1728 apng_start(path.toStdString().c_str(), ui->apngSkip->value());
1729 showStatusMsg(tr("Recording..."));
1730 } else {
1731 showStatusMsg(tr("Saving Recording..."));
1732 if (apng_stop()) {
1733 int res;
1734
1735 QFileDialog dialog(this);
1736
1737 dialog.setAcceptMode(QFileDialog::AcceptSave);
1738 dialog.setFileMode(QFileDialog::AnyFile);
1739 dialog.setDirectory(m_dir);
1740 dialog.setNameFilter(tr("PNG images (*.png)"));
1741 dialog.setWindowTitle(tr("Save Recorded PNG"));
1742 dialog.setDefaultSuffix(QStringLiteral("png"));
1743 res = dialog.exec();
1744
1745 QFile(path).remove();
1746 m_dir = dialog.directory();
1747 path.clear();
1748
1749 if (res == QDialog::Accepted) {
1750 QStringList selected = dialog.selectedFiles();
1751 QString filename = selected.first();
1752 recordSave(filename);
1753 } else {
1754 recordControlUpdate();
1755 }
1756 } else {
1757 QMessageBox::critical(this, MSG_ERROR, tr("A failure occured during PNG recording."));
1758 m_msgLabel.clear();
1759 path.clear();
1760 }
1761 return;
1762 }
1763
1764 m_recording = true;
1765 ui->apngSkip->setEnabled(false);
1766 ui->actionRecordAnimated->setChecked(true);
1767 ui->buttonRecordAnimated->setText(tr("Stop Recording"));
1768 ui->actionRecordAnimated->setText(tr("Stop Recording..."));
1769}
1770
1771void MainWindow::recordSave(const QString &filename) {
1772 ui->apngSkip->setEnabled(false);

Callers

nothing calls this directly

Calls 3

apng_startFunction · 0.85
apng_stopFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected