| 1714 | |
| 1715 | #ifdef PNG_WRITE_APNG_SUPPORTED |
| 1716 | void 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 | |
| 1771 | void MainWindow::recordSave(const QString &filename) { |
| 1772 | ui->apngSkip->setEnabled(false); |
nothing calls this directly
no test coverage detected