Files
qt5-legatus-legacy/Lts/Plugins/FileManagement/Gui/Explorer/flm_preview_playback.h
T
2026-08-13 18:33:10 +02:00

80 lines
2.1 KiB
C++
Executable File

/**
* @RDE_HEADER@
* The FileContentPreviewPlaybackWidget offers an UI to preview a FileContent
* $Id$
* $HeadURL$
* $Author$
* Created by Iuliana Ojog, SLSE, 2017-06-02
*/
#pragma once
#include "flm_get_content.h"
#include <LtsWidgets/lts_frameless_dialog.h>
#include <FileManagement/logger.h>
#include <Services/FileManagement/flm_ftc.h>
#include <QTimer>
// TODO: in a config ?
#define ZOOM_MIN 0.5
#define ZOOM_MAX 2.0
#define ZOOM_DEFAULT 1.0
namespace Ui
{
class FileContentPreviewPlaybackWidget;
}
namespace NGL
{
class PDFWidget;
}
namespace FileManagement
{
class FileContentPreviewPlaybackWidget
: public QWidget
{
Q_OBJECT
public:
explicit FileContentPreviewPlaybackWidget(const std::shared_ptr<FileManagement::Interface::Ftc> &ftc,
QWidget *parent = nullptr);
~FileContentPreviewPlaybackWidget();
bool init(const FileContent &data, int pageNo = -1, double zoomFactor = ZOOM_DEFAULT,
int rotation = 0, int duration = 0, const QString &userText = QString());
bool pauseTimer();
bool startTimer();
int getNumPages() const;
int getCurPage() const;
void setPage(int pageNo);
void setZoomFactor(double zoomFactor);
void setRotation(int rotation);
void ensureDataIsSet();
void showEvent(QShowEvent *e) override;
Q_SIGNALS:
void currentPageChanged(int curPage);
void rotationChanged(int rotation);
private:
Ui::FileContentPreviewPlaybackWidget *m_ui{nullptr};
std::shared_ptr<FileManagement::Interface::Ftc> m_ftc;
GetFileContent *m_getContent{nullptr};
FileContent m_data;
std::vector<uint8_t> m_content;
int m_duration{0};
int m_pageNo{-1};
double m_zoomFactor{ZOOM_DEFAULT};
int m_rotation; // degree
QTimer m_closeTimer;
NGL::PDFWidget *m_pdfWidget{nullptr};
QString m_userText;
LOGGER_T m_logger;
};
}