various improvements
This commit is contained in:
@@ -15,7 +15,6 @@ const QString& FontCombobox::getPreviousValue() {
|
||||
}
|
||||
|
||||
void FontCombobox::updateInternals() {
|
||||
qDebug() << "h";
|
||||
previousValue = value;
|
||||
value = currentText();
|
||||
}
|
||||
|
||||
+14
-9
@@ -10,6 +10,7 @@
|
||||
#include <QApplication>
|
||||
|
||||
LabelSlider::LabelSlider(QWidget* parent) : QLabel(parent) {
|
||||
decimal_places = 1;
|
||||
drag_start = false;
|
||||
drag_proc = false;
|
||||
min_enabled = false;
|
||||
@@ -21,7 +22,6 @@ LabelSlider::LabelSlider(QWidget* parent) : QLabel(parent) {
|
||||
set_value(0, false);
|
||||
set = false;
|
||||
display_type = LABELSLIDER_NORMAL;
|
||||
decimal_places = 1;
|
||||
}
|
||||
|
||||
void LabelSlider::set_display_type(int type) {
|
||||
@@ -57,7 +57,7 @@ QString LabelSlider::valueToString(double v) {
|
||||
return "---";
|
||||
} else {
|
||||
switch (display_type) {
|
||||
case LABELSLIDER_FRAMENUMBER: return frame_to_timecode(v, config.timecode_view, sequence->frame_rate);
|
||||
case LABELSLIDER_FRAMENUMBER: return frame_to_timecode(v, config.timecode_view, (sequence != NULL) ? sequence->frame_rate : 30);
|
||||
case LABELSLIDER_PERCENT: return QString::number((v*100), 'f', decimal_places) + "%";
|
||||
}
|
||||
return QString::number(v, 'f', decimal_places);
|
||||
@@ -97,7 +97,7 @@ double LabelSlider::get_drag_start_value() {
|
||||
void LabelSlider::mousePressEvent(QMouseEvent *ev) {
|
||||
drag_start_value = internal_value;
|
||||
if (ev->modifiers() & Qt::AltModifier) {
|
||||
if (internal_value != default_value) {
|
||||
if (internal_value != default_value && !qIsNaN(default_value)) {
|
||||
previous_value = internal_value;
|
||||
set_value(default_value, true);
|
||||
}
|
||||
@@ -115,11 +115,7 @@ void LabelSlider::mouseMoveEvent(QMouseEvent*) {
|
||||
if (drag_start) {
|
||||
drag_proc = true;
|
||||
int diff = (cursor().pos().x()-drag_start_x) + (drag_start_y-cursor().pos().y());
|
||||
if (display_type == LABELSLIDER_PERCENT) {
|
||||
set_value(internal_value + (diff*0.01), true);
|
||||
} else {
|
||||
set_value(internal_value + diff, true);
|
||||
}
|
||||
set_value(internal_value + ((display_type == LABELSLIDER_PERCENT) ? (diff*0.01) : diff), true);
|
||||
cursor().setPos(drag_start_x, drag_start_y);
|
||||
}
|
||||
}
|
||||
@@ -133,7 +129,16 @@ void LabelSlider::mouseReleaseEvent(QMouseEvent*) {
|
||||
previous_value = drag_start_value;
|
||||
emit valueChanged();
|
||||
} else {
|
||||
double d = QInputDialog::getDouble(this, "Set Value", "New value:", internal_value);
|
||||
double d = QInputDialog::getDouble(
|
||||
this,
|
||||
"Set Value",
|
||||
"New value:",
|
||||
(display_type == LABELSLIDER_PERCENT) ? internal_value * 100 : internal_value,
|
||||
(min_enabled) ? min_value : INT_MIN,
|
||||
(max_enabled) ? max_value : INT_MAX,
|
||||
decimal_places
|
||||
);
|
||||
if (display_type == LABELSLIDER_PERCENT) d *= 0.01;
|
||||
if (d != internal_value) {
|
||||
previous_value = internal_value;
|
||||
set_value(d, true);
|
||||
|
||||
+15
-26
@@ -348,9 +348,7 @@ void TimelineWidget::dropEvent(QDropEvent* event) {
|
||||
c->color_g = 128;
|
||||
c->color_b = 192;
|
||||
}
|
||||
if (c->track < 0) {
|
||||
c->frame_rate = m->get_stream_from_file_index(true, c->media_stream)->video_frame_rate;
|
||||
}
|
||||
c->frame_rate = (c->track < 0) ? m->get_stream_from_file_index(true, c->media_stream)->video_frame_rate : 1.0;
|
||||
c->name = m->name;
|
||||
} else if (c->media_type == MEDIA_TYPE_SEQUENCE) {
|
||||
// sequence (red?ish?)
|
||||
@@ -359,7 +357,7 @@ void TimelineWidget::dropEvent(QDropEvent* event) {
|
||||
c->color_b = 128;
|
||||
|
||||
Sequence* media = static_cast<Sequence*>(c->media);
|
||||
c->frame_rate = media->frame_rate;
|
||||
c->frame_rate = (c->track < 0) ? media->frame_rate : 1.0;
|
||||
c->name = media->name;
|
||||
}
|
||||
|
||||
@@ -621,13 +619,12 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
c->color_b = 64;
|
||||
c->track = g.track;
|
||||
|
||||
if (c->track < 0) c->frame_rate = sequence->frame_rate;
|
||||
c->frame_rate = (c->track < 0) ? sequence->frame_rate : 1.0;
|
||||
|
||||
QVector<Clip*> add;
|
||||
add.append(c);
|
||||
ca->append(new AddClipCommand(sequence, add));
|
||||
|
||||
// int clipIndex = sequence->clips.size();
|
||||
if (c->track < 0) {
|
||||
// default video effects (before custom effects)
|
||||
c->effects.append(create_effect(VIDEO_TRANSFORM_EFFECT, c));
|
||||
@@ -933,15 +930,7 @@ void TimelineWidget::init_ghosts() {
|
||||
}
|
||||
|
||||
// used for trim ops
|
||||
switch (c->media_type) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
g.media_length = static_cast<Media*>(c->media)->get_length_in_frames(sequence->frame_rate);
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
Sequence* s = static_cast<Sequence*>(c->media);
|
||||
g.media_length = refactor_frame_number(s->getEndFrame(), s->frame_rate, sequence->frame_rate);
|
||||
break;
|
||||
}
|
||||
g.media_length = c->getMaximumLength();
|
||||
}
|
||||
for (int i=0;i<sequence->selections.size();i++) {
|
||||
Selection& s = sequence->selections[i];
|
||||
@@ -1710,18 +1699,10 @@ void TimelineWidget::redraw_clips() {
|
||||
draw_checkerboard = true;
|
||||
} else if (ms->preview_done) {
|
||||
// draw thumbnail/waveform
|
||||
long media_length = m->get_length_in_frames(clip->sequence->frame_rate);
|
||||
int waveform_limit;
|
||||
|
||||
if (!ms->infinite_length) {
|
||||
waveform_limit = qMin(clip_rect.width(), panel_timeline->getTimelineScreenPointFromFrame(media_length - clip->clip_in));
|
||||
if (waveform_limit < clip_rect.width()) {
|
||||
draw_checkerboard = true;
|
||||
if (waveform_limit > 0) checkerboard_rect.setLeft(checkerboard_rect.left() + waveform_limit);
|
||||
}
|
||||
}
|
||||
long media_length = clip->getMaximumLength();
|
||||
|
||||
if (clip->track < 0) {
|
||||
// draw thumbnail
|
||||
int space_for_thumb = clip_rect.width();
|
||||
if (clip->opening_transition != NULL) {
|
||||
int ot_width = panel_timeline->getTimelineScreenPointFromFrame(clip->opening_transition->length);
|
||||
@@ -1739,13 +1720,21 @@ void TimelineWidget::redraw_clips() {
|
||||
clip_painter.drawImage(thumb_rect, ms->video_preview);
|
||||
}
|
||||
} else if (clip_rect.height() > TRACK_MIN_HEIGHT) {
|
||||
int waveform_limit = qMin(clip_rect.width(), panel_timeline->getTimelineScreenPointFromFrame(media_length - clip->clip_in));
|
||||
|
||||
if (waveform_limit < clip_rect.width()) {
|
||||
draw_checkerboard = true;
|
||||
if (waveform_limit > 0) checkerboard_rect.setLeft(checkerboard_rect.left() + waveform_limit);
|
||||
}
|
||||
|
||||
// draw waveform
|
||||
clip_painter.setPen(QColor(80, 80, 80));
|
||||
|
||||
int divider = ms->audio_channels*2;
|
||||
int channel_height = clip_rect.height()/ms->audio_channels;
|
||||
|
||||
for (int i=0;i<waveform_limit;i++) {
|
||||
int waveform_index = qFloor((((clip->clip_in + ((double) i/panel_timeline->zoom))/media_length) * ms->audio_preview.size())/divider)*divider;
|
||||
int waveform_index = qFloor((((clip->clip_in + ((double) (i*clip->frame_rate)/panel_timeline->zoom))/media_length) * ms->audio_preview.size())/divider)*divider;
|
||||
|
||||
int rectified_height = 0;
|
||||
|
||||
|
||||
+16
-3
@@ -176,19 +176,27 @@ GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
|
||||
QVector<Clip*> current_clips;
|
||||
|
||||
for (int i=0;i<s->clips.size();i++) {
|
||||
Clip* c = s->clips.at(i);
|
||||
Clip* c = s->clips.at(i);
|
||||
|
||||
// if clip starts within one second and/or hasn't finished yet
|
||||
if (c != NULL && !(nest != NULL && !same_sign(c->track, nest->track))) {
|
||||
bool clip_is_active = false;
|
||||
|
||||
// backwards compatibilty
|
||||
if (c->frame_rate == 0 && c->track >= 0) {
|
||||
c->frame_rate = 1.0;
|
||||
}
|
||||
|
||||
switch (c->media_type) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Media* m = static_cast<Media*>(c->media);
|
||||
if (m->ready) {
|
||||
if (m->get_stream_from_file_index(c->track < 0, c->media_stream) != NULL
|
||||
&& is_clip_active(c, playhead)) {
|
||||
MediaStream* ms = m->get_stream_from_file_index(c->track < 0, c->media_stream);
|
||||
if (ms != NULL && is_clip_active(c, playhead)) {
|
||||
// backwards compatibility
|
||||
if (c->frame_rate == 0 && c->track < 0) c->frame_rate = ms->video_frame_rate;
|
||||
|
||||
// if thread is already working, we don't want to touch this,
|
||||
// but we also don't want to hang the UI thread
|
||||
if (!c->open) {
|
||||
@@ -204,8 +212,13 @@ GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
|
||||
}
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
// backwards compatibility
|
||||
if (c->frame_rate == 0 == c->track < 0) c->frame_rate = static_cast<Sequence*>(c->media)->frame_rate;
|
||||
case MEDIA_TYPE_SOLID:
|
||||
case MEDIA_TYPE_TONE:
|
||||
// backwards compatibility
|
||||
if (c->frame_rate == 0 && c->track < 0) c->frame_rate = s->frame_rate;
|
||||
|
||||
if (is_clip_active(c, playhead)) {
|
||||
if (!c->open) open_clip(c, !rendering);
|
||||
clip_is_active = true;
|
||||
|
||||
Reference in New Issue
Block a user