tweaked merge

This commit is contained in:
itsmattkc
2018-11-17 12:56:00 +11:00
parent d3739c2776
commit f427e37f46
4 changed files with 17 additions and 22 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ struct MediaStream {
// preview thumbnail/waveform // preview thumbnail/waveform
bool preview_done; bool preview_done;
QPixmap video_preview; // TODO change to QPixmap QPixmap video_preview;
QVector<char> audio_preview; QVector<char> audio_preview;
}; };
+1 -3
View File
@@ -439,9 +439,7 @@ void PreviewGenerator::run() {
// save preview to file // save preview to file
for (int i=0;i<media->video_tracks.size();i++) { for (int i=0;i<media->video_tracks.size();i++) {
MediaStream* ms = media->video_tracks.at(i); MediaStream* ms = media->video_tracks.at(i);
if (ms->video_preview.save(get_thumbnail_path(hash, ms), "PNG")) { ms->video_preview.save(get_thumbnail_path(hash, ms), "PNG");
//dout << "saved" << ms->file_index << "thumb to" << get_thumbnail_path(hash, ms);
}
} }
for (int i=0;i<media->audio_tracks.size();i++) { for (int i=0;i<media->audio_tracks.size();i++) {
MediaStream* ms = media->audio_tracks.at(i); MediaStream* ms = media->audio_tracks.at(i);
+4 -9
View File
@@ -2085,7 +2085,7 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
// draw thumbnail // draw thumbnail
int thumb_y = p.fontMetrics().height()+CLIP_TEXT_PADDING+CLIP_TEXT_PADDING; int thumb_y = p.fontMetrics().height()+CLIP_TEXT_PADDING+CLIP_TEXT_PADDING;
if (thumb_x < width() && thumb_y < height()) { if (thumb_x < width() && thumb_y < height()) {
int space_for_thumb = clip_rect.width(); int space_for_thumb = clip_rect.width()-1;
if (clip->opening_transition != NULL) { if (clip->opening_transition != NULL) {
int ot_width = getScreenPointFromFrame(panel_timeline->zoom, clip->opening_transition->length); int ot_width = getScreenPointFromFrame(panel_timeline->zoom, clip->opening_transition->length);
thumb_x += ot_width; thumb_x += ot_width;
@@ -2099,14 +2099,9 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
if (thumb_x + thumb_width >= 0 if (thumb_x + thumb_width >= 0
&& thumb_height > thumb_y && thumb_height > thumb_y
&& thumb_y + thumb_height >= 0 && thumb_y + thumb_height >= 0
&& space_for_thumb > thumb_width / 4){ //don't show thumbnail if 1/4 is only showing && space_for_thumb > MAX_TEXT_WIDTH) {
if (space_for_thumb < thumb_width){ int thumb_clip_width = qMin(thumb_width, space_for_thumb);
p.setClipping(true); p.drawPixmap(QRect(thumb_x, clip_rect.y()+thumb_y, thumb_clip_width, thumb_height), ms->video_preview, QRect(0, 0, thumb_clip_width*((double)ms->video_preview.width()/(double)thumb_width), ms->video_preview.height()));
p.setClipRegion(QRegion(thumb_x, clip_rect.y()+thumb_y, clip_rect.width()-1, thumb_height));
p.drawPixmap(thumb_x,clip_rect.y()+thumb_y, ms->video_preview.scaledToHeight(thumb_height));
p.setClipping(false);
} else
p.drawPixmap(thumb_x,clip_rect.y()+thumb_y, ms->video_preview.scaledToHeight(thumb_height));
} }
} }
} else if (clip_rect.height() > TRACK_MIN_HEIGHT) { } else if (clip_rect.height() > TRACK_MIN_HEIGHT) {
+11 -9
View File
@@ -69,16 +69,18 @@ void ViewerWidget::show_context_menu() {
} }
void ViewerWidget::save_frame() { void ViewerWidget::save_frame() {
QString fn = QFileDialog::getSaveFileName(this, "Save Frame", QString(), "Portable Network Graphic (*.png);;JPEG (*.jpg *.jpeg);;Windows Bitmap (*.bmp);;Portable Pixmap (*.ppm);;X11 Bitmap (*.xbm);;X11 Pixmap (*.xpm)"); QFileDialog fd(this);
fd.setAcceptMode(QFileDialog::AcceptSave);
fd.setFileMode(QFileDialog::AnyFile);
fd.setWindowTitle("Save Frame");
fd.setNameFilter("Portable Network Graphic (*.png);;JPEG (*.jpg);;Windows Bitmap (*.bmp);;Portable Pixmap (*.ppm);;X11 Bitmap (*.xbm);;X11 Pixmap (*.xpm)");
if (!fn.isEmpty()) { if (fd.exec()) {
if (!(fn.endsWith("png", Qt::CaseInsensitive) QString fn = fd.selectedFiles().at(0);
||fn.endsWith("jpeg", Qt::CaseInsensitive) QString selected_ext = fd.selectedNameFilter().mid(fd.selectedNameFilter().indexOf(QRegExp("\\*.[a-z][a-z][a-z]")) + 1, 4);
||fn.endsWith("jpg", Qt::CaseInsensitive) if (!fn.endsWith(selected_ext, Qt::CaseInsensitive)) {
||fn.endsWith("bmp", Qt::CaseInsensitive) fn += selected_ext;
||fn.endsWith("ppm", Qt::CaseInsensitive) }
||fn.endsWith("xbm", Qt::CaseInsensitive)
||fn.endsWith("xpm", Qt::CaseInsensitive))) fn.append(".png");
QOpenGLFramebufferObject fbo(viewer->seq->width, viewer->seq->height, QOpenGLFramebufferObject::CombinedDepthStencil, GL_TEXTURE_RECTANGLE); QOpenGLFramebufferObject fbo(viewer->seq->width, viewer->seq->height, QOpenGLFramebufferObject::CombinedDepthStencil, GL_TEXTURE_RECTANGLE);
rendering = true; rendering = true;