Implement a unified export system for extracting data from parsed files: ExportManager (singleton): - Centralized export handling for all content types - Content type detection (image, audio, video, text, binary) - Batch export support with progress tracking Format-specific export dialogs: - ImageExportDialog: PNG, JPEG, BMP, TGA with quality options - AudioExportDialog: WAV, MP3, OGG with FFmpeg integration - BinaryExportDialog: Raw data export with optional decompression - BatchExportDialog: Recursive export with filtering options - Base ExportDialog class for common functionality Settings additions: - FFmpeg path configuration with auto-detection - Search common install locations and PATH Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
101 lines
2.4 KiB
C++
101 lines
2.4 KiB
C++
#ifndef EXPORTDIALOG_H
|
|
#define EXPORTDIALOG_H
|
|
|
|
#include <QDialog>
|
|
#include <QVariantMap>
|
|
#include <QByteArray>
|
|
|
|
class QComboBox;
|
|
class QLabel;
|
|
class QDialogButtonBox;
|
|
class QPushButton;
|
|
class QCheckBox;
|
|
class QLineEdit;
|
|
class QVBoxLayout;
|
|
class QHBoxLayout;
|
|
class QGroupBox;
|
|
|
|
/**
|
|
* @brief Base class for media-specific export dialogs.
|
|
*
|
|
* Provides common UI elements and functionality for exporting different
|
|
* content types (images, audio, binary, etc.)
|
|
*/
|
|
class ExportDialog : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
enum ContentType {
|
|
Image,
|
|
Audio,
|
|
Video,
|
|
Text,
|
|
Binary
|
|
};
|
|
|
|
explicit ExportDialog(ContentType type, QWidget *parent = nullptr);
|
|
virtual ~ExportDialog() = default;
|
|
|
|
// Set data and metadata to export
|
|
void setData(const QByteArray& data, const QString& suggestedName);
|
|
void setMetadata(const QVariantMap& metadata);
|
|
|
|
// Get export settings
|
|
QString selectedFormat() const;
|
|
QString outputPath() const;
|
|
bool rememberSettings() const;
|
|
|
|
// Content type
|
|
ContentType contentType() const { return mContentType; }
|
|
|
|
protected:
|
|
// Subclasses implement these
|
|
virtual void setupPreview() = 0;
|
|
virtual void updatePreview() = 0;
|
|
virtual QStringList supportedFormats() const = 0;
|
|
virtual void onFormatChanged(const QString& format);
|
|
|
|
// Setup common UI elements
|
|
void setupCommonUI();
|
|
|
|
// Get the preview area (subclasses add their preview widget here)
|
|
QWidget* previewContainer() const { return mPreviewContainer; }
|
|
|
|
// Get the options area (subclasses add format-specific options here)
|
|
QGroupBox* optionsContainer() const { return mOptionsContainer; }
|
|
|
|
// Access common widgets
|
|
QComboBox* formatCombo() const { return mFormatCombo; }
|
|
QLineEdit* outputPathEdit() const { return mOutputPath; }
|
|
|
|
// Member data
|
|
ContentType mContentType;
|
|
QByteArray mData;
|
|
QString mSuggestedName;
|
|
QVariantMap mMetadata;
|
|
|
|
private slots:
|
|
void onBrowseClicked();
|
|
void onFormatComboChanged(int index);
|
|
|
|
private:
|
|
// Common UI elements
|
|
QWidget* mPreviewContainer;
|
|
QGroupBox* mOptionsContainer;
|
|
QComboBox* mFormatCombo;
|
|
QLineEdit* mOutputPath;
|
|
QPushButton* mBrowseButton;
|
|
QDialogButtonBox* mButtonBox;
|
|
QCheckBox* mRememberSettings;
|
|
QLabel* mInfoLabel;
|
|
|
|
// Layouts
|
|
QVBoxLayout* mMainLayout;
|
|
QHBoxLayout* mContentLayout;
|
|
QVBoxLayout* mLeftLayout;
|
|
QVBoxLayout* mRightLayout;
|
|
};
|
|
|
|
#endif // EXPORTDIALOG_H
|