- Add ListPreviewWidget for displaying parsed list data with table view - Add TextViewerWidget for text file preview with syntax highlighting - Add TreeBuilder class to organize parsed data into tree structure - Enhance HexView with selection support, copy functionality, keyboard navigation - Enhance ImagePreviewWidget with additional format support and metadata display - Minor audio preview widget adjustments Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
82 lines
2.0 KiB
C++
82 lines
2.0 KiB
C++
#ifndef IMAGEPREVIEWWIDGET_H
|
|
#define IMAGEPREVIEWWIDGET_H
|
|
|
|
#include <QWidget>
|
|
#include <QLabel>
|
|
#include <QScrollArea>
|
|
#include <QVBoxLayout>
|
|
#include <QPixmap>
|
|
#include <QImage>
|
|
#include <QMouseEvent>
|
|
#include <QTreeWidget>
|
|
#include <QSplitter>
|
|
|
|
class ImagePreviewWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ImagePreviewWidget(QWidget *parent = nullptr);
|
|
~ImagePreviewWidget() = default;
|
|
|
|
// Load image from raw bytes (TGA, PNG, etc.)
|
|
bool loadFromData(const QByteArray &data, const QString &format = QString());
|
|
|
|
// Load image from file path
|
|
bool loadFromFile(const QString &path);
|
|
|
|
// Set the filename for display
|
|
void setFilename(const QString &filename);
|
|
|
|
// Set metadata to display in the properties panel
|
|
void setMetadata(const QVariantMap &metadata);
|
|
|
|
// Get current image size
|
|
QSize imageSize() const;
|
|
|
|
// Export current displayed image as PNG for debugging
|
|
bool exportDebugImage(const QString &suffix = QString());
|
|
|
|
protected:
|
|
// Mouse events for drag-to-pan
|
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
|
void wheelEvent(QWheelEvent *event) override;
|
|
|
|
private:
|
|
QLabel *mImageLabel;
|
|
QLabel *mInfoLabel;
|
|
QScrollArea *mScrollArea;
|
|
QTreeWidget *mMetadataTree;
|
|
QString mFilename;
|
|
QSize mImageSize;
|
|
|
|
// Drag-to-pan state
|
|
bool mDragging;
|
|
QPoint mLastDragPos;
|
|
|
|
// Zoom state
|
|
double mZoomFactor;
|
|
QPixmap mOriginalPixmap;
|
|
void updateZoom();
|
|
void updateMetadataDisplay();
|
|
|
|
// Try to load TGA manually if Qt can't handle it
|
|
QImage loadTGA(const QByteArray &data);
|
|
|
|
// Load Xbox 360 XBTX2D texture format
|
|
QImage loadXBTX2D(const QByteArray &data);
|
|
|
|
// Load RCB pixel block (Avatar g4rc texture format)
|
|
QImage loadRCBPixel(const QByteArray &data);
|
|
|
|
// Load raw DXT1/DXT5 data with auto-detected dimensions
|
|
QImage loadRawDXT(const QByteArray &data, bool tryDXT5First = false);
|
|
|
|
// Detected image info
|
|
QString mDetectedFormat;
|
|
int mBitsPerPixel;
|
|
QString mCompression;
|
|
};
|
|
|
|
#endif // IMAGEPREVIEWWIDGET_H
|