mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
52105e5217
This commit adds an entry to the dive media context menu which offers to write a subtitle file. This creates an .ass file for the selected videos. In an attempt to to clutter the screen too much, don't show irrelevant entries (zero temperature or NDL and show TTS only for dives with stops). VLC is able to show these subtitles directly, they can be integrated into the video file with ffmpeg. Signed-off-by: Robert C. Helling <helling@atdotde.de>
45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef DIVEPICTUREMODEL_H
|
|
#define DIVEPICTUREMODEL_H
|
|
|
|
#include "core/units.h"
|
|
|
|
#include <QAbstractTableModel>
|
|
#include <QImage>
|
|
#include <QFuture>
|
|
|
|
struct PictureEntry {
|
|
int diveId;
|
|
struct picture *picture;
|
|
QString filename;
|
|
QImage image;
|
|
int offsetSeconds;
|
|
duration_t length;
|
|
};
|
|
|
|
class DivePictureModel : public QAbstractTableModel {
|
|
Q_OBJECT
|
|
public:
|
|
static DivePictureModel *instance();
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
void updateDivePictures();
|
|
void removePictures(const QVector<QString> &fileUrls);
|
|
void updateDivePictureOffset(int diveId, const QString &filename, int offsetSeconds);
|
|
signals:
|
|
void picturesRemoved(const QVector<QString> &fileUrls);
|
|
public slots:
|
|
void setZoomLevel(int level);
|
|
void updateThumbnail(QString filename, QImage thumbnail, duration_t duration);
|
|
private:
|
|
DivePictureModel();
|
|
QVector<PictureEntry> pictures;
|
|
int findPictureId(const QString &filename); // Return -1 if not found
|
|
double zoomLevel; // -1.0: minimum, 0.0: standard, 1.0: maximum
|
|
int size;
|
|
void updateThumbnails();
|
|
void updateZoom();
|
|
};
|
|
|
|
#endif
|