SEVERAL bug fixes

This commit is contained in:
itsmattkc
2018-10-12 18:48:14 +11:00
parent caee50a943
commit cdbec85a81
30 changed files with 444 additions and 149 deletions
+15 -8
View File
@@ -81,6 +81,10 @@ void KeyframeView::paintEvent(QPaintEvent*) {
visible_out = effects_out;
int max_width = getScreenPointFromFrame(panel_effect_controls->zoom, visible_out - visible_in);
qDebug() << max_width << width();
if (max_width < width()) {
p.fillRect(QRect(max_width, 0, width(), height()), QColor(0, 0, 0, 64));
}
panel_effect_controls->ui->horizontalScrollBar->setMaximum(qMax(max_width - width(), 0));
header->set_visible_in(effects_in);
@@ -152,11 +156,13 @@ void KeyframeView::mousePressEvent(QMouseEvent *event) {
int row_index = -1;
int keyframe_index = -1;
long frame_diff = 0;
long frame_min = getFrameFromScreenPoint(panel_effect_controls->zoom, event->x()-KEYFRAME_SIZE);
drag_frame_start = getFrameFromScreenPoint(panel_effect_controls->zoom, event->x());
long frame_max = getFrameFromScreenPoint(panel_effect_controls->zoom, event->x()+KEYFRAME_SIZE);
int mouse_x = event->x() + x_scroll;
int mouse_y = event->y();
long frame_min = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x-KEYFRAME_SIZE);
drag_frame_start = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x);
long frame_max = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x+KEYFRAME_SIZE);
for (int i=0;i<rowY.size();i++) {
if (event->y() > rowY.at(i)-KEYFRAME_SIZE-KEYFRAME_SIZE && event->y() < rowY.at(i)+KEYFRAME_SIZE+KEYFRAME_SIZE) {
if (mouse_y > rowY.at(i)-KEYFRAME_SIZE-KEYFRAME_SIZE && mouse_y < rowY.at(i)+KEYFRAME_SIZE+KEYFRAME_SIZE) {
EffectRow* row = rows.at(i);
for (int j=0;j<row->keyframe_times.size();j++) {
long eval_keyframe_time = row->keyframe_times.at(j)-row->parent_effect->parent_clip->clip_in+(row->parent_effect->parent_clip->timeline_in-visible_in);
@@ -199,9 +205,10 @@ void KeyframeView::mousePressEvent(QMouseEvent *event) {
void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
if (mousedown) {
int mouse_x = event->x() + x_scroll;
if (keys_selected) {
// move keyframes
frame_diff = getFrameFromScreenPoint(panel_effect_controls->zoom, event->x()) - drag_frame_start;
frame_diff = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x) - drag_frame_start;
// snapping to playhead
if (panel_timeline->snapping) {
@@ -210,7 +217,7 @@ void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
Clip* c = row->parent_effect->parent_clip;
long key_time = row->keyframe_times.at(selected_keyframes.at(i)) + frame_diff - c->clip_in + c->timeline_in;
long key_eval = key_time;
if (panel_timeline->snap_to_timeline(&key_eval, true, true, true)) {
if (panel_timeline->snap_to_point(sequence->playhead, &key_eval)) {
frame_diff += (key_eval - key_time);
break;
}
@@ -245,8 +252,8 @@ void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
int min_row = qMin(rect_select_y, event->y())-KEYFRAME_SIZE;
int max_row = qMax(rect_select_y, event->y())+KEYFRAME_SIZE;
long frame_start = getFrameFromScreenPoint(panel_effect_controls->zoom, rect_select_x);
long frame_end = getFrameFromScreenPoint(panel_effect_controls->zoom, event->x());
long frame_start = getFrameFromScreenPoint(panel_effect_controls->zoom, rect_select_x+x_scroll);
long frame_end = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x);
long min_frame = qMin(frame_start, frame_end)-KEYFRAME_SIZE;
long max_frame = qMax(frame_start, frame_end)+KEYFRAME_SIZE;
+1
View File
@@ -8,6 +8,7 @@
#include <QMouseEvent>
#include <QInputDialog>
#include <QApplication>
#include <QDebug>
LabelSlider::LabelSlider(QWidget* parent) : QLabel(parent) {
decimal_places = 1;
+1 -1
View File
@@ -22,7 +22,7 @@ public:
bool is_set();
double get_drag_start_value();
bool is_dragging();
virtual QString valueToString(double v);
QString valueToString(double v);
double getPreviousValue();
int decimal_places;
protected:
+8 -3
View File
@@ -24,10 +24,10 @@ SourceTable::SourceTable(QWidget* parent) : QTreeWidget(parent) {
connect(&rename_timer, SIGNAL(timeout()), this, SLOT(rename_interval()));
connect(this, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(item_click(QTreeWidgetItem*,int)));
connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(item_renamed(QTreeWidgetItem*)));
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu(const QPoint&)));
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
}
void SourceTable::show_context_menu(const QPoint& pos) {
void SourceTable::show_context_menu() {
QMenu menu(this);
if (selectedItems().size() == 0) {
@@ -75,9 +75,14 @@ void SourceTable::show_context_menu(const QPoint& pos) {
// delete media
QAction* delete_action = menu.addAction("Delete");
connect(delete_action, SIGNAL(triggered(bool)), panel_project, SLOT(delete_selected_media()));
if (selectedItems().size() == 1) {
QAction* properties_action = menu.addAction("Properties...");
connect(properties_action, SIGNAL(triggered(bool)), panel_project, SLOT(open_properties()));
}
}
menu.exec(mapToGlobal(pos));
menu.exec(QCursor::pos());
}
void SourceTable::item_renamed(QTreeWidgetItem* item) {
+1 -1
View File
@@ -27,7 +27,7 @@ private slots:
void item_click(QTreeWidgetItem* item, int column);
void stop_rename_timer();
void item_renamed(QTreeWidgetItem *item);
void show_context_menu(const QPoint& pos);
void show_context_menu();
};
#endif // SOURCETABLE_H
+22 -13
View File
@@ -5,22 +5,17 @@
TextEditEx::TextEditEx(QWidget *parent) : QTextEdit(parent) {
setUndoRedoEnabled(false);
connect(this, SIGNAL(textChanged()), this, SLOT(updateInternals()));
connect(this, SIGNAL(updateSelf()), this, SLOT(updateText()));
}
void TextEditEx::setPlainTextEx(const QString &text) {
blockSignals(true);
const QString& TextEditEx::getPlainTextEx() {
return text;
}
int pos = textCursor().position();
setPlainText(text);
QTextCursor newCursor(document());
newCursor.setPosition(pos);
setTextCursor(newCursor);
updateInternals();
blockSignals(false);
void TextEditEx::setPlainTextEx(const QString &t) {
previousText = text;
text = t;
emit updateSelf();
}
const QString &TextEditEx::getPreviousValue() {
@@ -31,3 +26,17 @@ void TextEditEx::updateInternals() {
previousText = text;
text = toPlainText();
}
void TextEditEx::updateText() {
blockSignals(true);
int pos = textCursor().position();
setPlainText(text);
QTextCursor newCursor(document());
newCursor.setPosition(pos);
setTextCursor(newCursor);
blockSignals(false);
}
+4
View File
@@ -9,8 +9,12 @@ public:
TextEditEx(QWidget* parent = 0);
void setPlainTextEx(const QString &text);
const QString& getPreviousValue();
const QString& getPlainTextEx();
signals:
void updateSelf();
private slots:
void updateInternals();
void updateText();
private:
QString previousText;
QString text;
+1 -1
View File
@@ -1947,7 +1947,7 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
for (int i=0;i<2;i++) {
Transition* t = (i == 0) ? clip->opening_transition : clip->closing_transition;
if (t != NULL) {
int transition_width = panel_timeline->getTimelineScreenPointFromFrame(t->length);
int transition_width = getScreenPointFromFrame(panel_timeline->zoom, t->length);
int transition_height = clip_rect.height();
int tr_y = clip_rect.y();
int tr_x = 0;
+28 -13
View File
@@ -85,7 +85,7 @@ void ViewerWidget::drawTitleSafeArea() {
glLoadIdentity();
glOrtho(-halfWidth, halfWidth, halfHeight, -halfHeight, -1, 1);
glColor4f(0.5, 0.5, 0.5, 1.0);
glColor4f(0.66f, 0.66f, 0.66f, 1.0f);
glBegin(GL_LINES);
// action safe rectangle
@@ -378,6 +378,8 @@ GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
glVertex2f(coords.vertexBottomLeftX, coords.vertexBottomLeftY); // bottom left
glEnd();
glBindTexture(GL_TEXTURE_2D, 0);
if (nest != NULL) {
nest->fbo[0]->release();
if (default_fbo != NULL) default_fbo->bind();
@@ -386,19 +388,32 @@ GLuint ViewerWidget::compose_sequence(Clip* nest, bool render_audio) {
glPopMatrix();
} else {
switch (c->media_type) {
case MEDIA_TYPE_FOOTAGE:
case MEDIA_TYPE_TONE:
if (render_audio
&& c->lock.tryLock()) {
// clip is not caching, start caching audio
cache_clip(c, playhead, false, false, c->audio_reset, nest);
c->lock.unlock();
if (render_audio) {
switch (c->media_type) {
case MEDIA_TYPE_FOOTAGE:
case MEDIA_TYPE_TONE:
if (c->lock.tryLock()) {
// clip is not caching, start caching audio
cache_clip(c, playhead, false, false, c->audio_reset, nest);
c->lock.unlock();
}
break;
case MEDIA_TYPE_SEQUENCE:
compose_sequence(c, render_audio);
break;
}
}
// visually update all the keyframe values
double ts = (playhead - c->timeline_in + c->clip_in)/sequence->frame_rate;
for (int i=0;i<c->effects.size();i++) {
Effect* e = c->effects.at(i);
for (int j=0;j<e->row_count();j++) {
EffectRow* r = e->row(j);
for (int k=0;k<r->fieldCount();k++) {
r->field(k)->validate_keyframe_data(ts);
}
}
break;
case MEDIA_TYPE_SEQUENCE:
compose_sequence(c, render_audio);
break;
}
}
}