69 lines
1.6 KiB
C
69 lines
1.6 KiB
C
|
|
#ifndef IMAGEEXPORTDIALOG_H
|
||
|
|
#define IMAGEEXPORTDIALOG_H
|
||
|
|
|
||
|
|
#include "exportdialog.h"
|
||
|
|
#include <QImage>
|
||
|
|
|
||
|
|
class QSlider;
|
||
|
|
class QSpinBox;
|
||
|
|
class QStackedWidget;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Export dialog for images with preview and format-specific options.
|
||
|
|
*
|
||
|
|
* Shows a thumbnail preview of the image and provides quality/compression
|
||
|
|
* settings for different output formats (PNG, JPEG, TGA, BMP, TIFF).
|
||
|
|
*/
|
||
|
|
class ImageExportDialog : public ExportDialog
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
|
||
|
|
public:
|
||
|
|
explicit ImageExportDialog(QWidget *parent = nullptr);
|
||
|
|
|
||
|
|
// Set image directly (already decoded)
|
||
|
|
void setImage(const QImage& image, const QString& suggestedName);
|
||
|
|
|
||
|
|
// Get configured image for export
|
||
|
|
QImage exportImage() const { return mImage; }
|
||
|
|
|
||
|
|
// Format-specific options
|
||
|
|
int jpegQuality() const;
|
||
|
|
int pngCompression() const;
|
||
|
|
|
||
|
|
protected:
|
||
|
|
void setupPreview() override;
|
||
|
|
void updatePreview() override;
|
||
|
|
QStringList supportedFormats() const override;
|
||
|
|
void onFormatChanged(const QString& format) override;
|
||
|
|
|
||
|
|
private slots:
|
||
|
|
void onJpegQualityChanged(int value);
|
||
|
|
void onPngCompressionChanged(int value);
|
||
|
|
|
||
|
|
private:
|
||
|
|
void updateFileSizeEstimate();
|
||
|
|
void showOptionsForFormat(const QString& format);
|
||
|
|
|
||
|
|
QImage mImage;
|
||
|
|
QLabel* mPreviewLabel;
|
||
|
|
|
||
|
|
// Format-specific option widgets
|
||
|
|
QStackedWidget* mOptionsStack;
|
||
|
|
|
||
|
|
// JPEG options
|
||
|
|
QWidget* mJpegOptionsWidget;
|
||
|
|
QSlider* mJpegQualitySlider;
|
||
|
|
QSpinBox* mJpegQualitySpinBox;
|
||
|
|
|
||
|
|
// PNG options
|
||
|
|
QWidget* mPngOptionsWidget;
|
||
|
|
QSlider* mPngCompressionSlider;
|
||
|
|
QSpinBox* mPngCompressionSpinBox;
|
||
|
|
|
||
|
|
// No options widget (for TGA, BMP, TIFF)
|
||
|
|
QWidget* mNoOptionsWidget;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif // IMAGEEXPORTDIALOG_H
|