XPlor/app/batchexportdialog.h

100 lines
2.5 KiB
C
Raw Normal View History

#ifndef BATCHEXPORTDIALOG_H
#define BATCHEXPORTDIALOG_H
#include <QDialog>
#include <QList>
class QTreeWidget;
class QTreeWidgetItem;
class QProgressBar;
class QLabel;
class QLineEdit;
class QPushButton;
class QCheckBox;
class QComboBox;
class QDialogButtonBox;
/**
* @brief Item data for batch export operations.
*/
struct BatchExportItem
{
QString name; // Display name
QString path; // Relative path (for folder structure)
QByteArray data; // Raw data to export
int contentType; // ContentType enum value
bool selected; // Whether to export
};
/**
* @brief Dialog for batch exporting multiple items.
*
* Shows a checkable tree of items with progress tracking,
* folder structure preservation, and conflict resolution options.
*/
class BatchExportDialog : public QDialog
{
Q_OBJECT
public:
explicit BatchExportDialog(QWidget *parent = nullptr);
// Set items to potentially export
void setItems(const QList<BatchExportItem>& items);
// Get export configuration
QString outputDirectory() const;
bool preserveStructure() const;
QString conflictResolution() const; // "number", "overwrite", "skip"
QString imageFormat() const;
QString audioFormat() const;
// Get selected items
QList<BatchExportItem> selectedItems() const;
signals:
void exportProgress(int current, int total, const QString& currentItem);
void exportCompleted(int succeeded, int failed, int skipped);
public slots:
void updateProgress(int current, int total, const QString& currentItem);
void onExportCompleted(int succeeded, int failed, int skipped);
private slots:
void onSelectAll();
void onSelectNone();
void onSelectImages();
void onSelectAudio();
void onBrowseClicked();
void onExportClicked();
void onItemChanged(QTreeWidgetItem* item, int column);
private:
void setupUI();
void updateSelectionCount();
void populateTree();
int countByType(int contentType) const;
// Data
QList<BatchExportItem> mItems;
bool mExporting;
bool mCancelled;
// UI Elements
QTreeWidget* mItemTree;
QLabel* mSelectionLabel;
QLineEdit* mOutputPath;
QPushButton* mBrowseButton;
QCheckBox* mPreserveStructure;
QComboBox* mConflictCombo;
QComboBox* mImageFormatCombo;
QComboBox* mAudioFormatCombo;
QProgressBar* mProgressBar;
QLabel* mProgressLabel;
QDialogButtonBox* mButtonBox;
QPushButton* mExportButton;
QPushButton* mCancelButton;
};
#endif // BATCHEXPORTDIALOG_H