sorta fixed some stuff

This commit is contained in:
itsmattkc
2018-07-25 21:14:44 +01:00
parent 3a971fbfa3
commit dcde4bd46c
5 changed files with 37 additions and 5 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ int main(int argc, char *argv[])
// init ffmpeg subsystem
av_register_all();
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
// QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
QApplication a(argc, argv);
MainWindow w;
+6 -1
View File
@@ -908,7 +908,12 @@ bool Timeline::snap_to_point(long point, long* l) {
void Timeline::snap_to_clip(long* l, bool playhead_inclusive) {
snapped = false;
if (snapping) {
if (!playhead_inclusive || !snap_to_point(playhead, l)) {
if (playhead_inclusive && !playing) {
playhead_inclusive = snap_to_point(playhead, l);
} else {
playhead_inclusive = false;
}
if (!playhead_inclusive) {
for (int i=0;i<sequence->clip_count();i++) {
Clip* c = sequence->get_clip(i);
if (c != NULL) {
+8 -3
View File
@@ -634,9 +634,12 @@ bool subvalidate_snapping(const Ghost& g, long* frame_diff, long snap_point) {
}
void validate_snapping(const Ghost& g, long* frame_diff) {
panel_timeline->snapped = false;
if (panel_timeline->snapping) {
if (!subvalidate_snapping(g, frame_diff, panel_timeline->playhead)) {
bool snap_to_clip = true;
if (!panel_timeline->playing) {
snap_to_clip = !subvalidate_snapping(g, frame_diff, panel_timeline->playhead);
}
if (snap_to_clip) {
for (int j=0;j<sequence->clip_count();j++) {
Clip* c = sequence->get_clip(j);
if (c != NULL) {
@@ -657,11 +660,13 @@ void TimelineWidget::update_ghosts(QPoint& mouse_pos) {
long validator;
// first try to snap
panel_timeline->snapped = false;
if (panel_timeline->tool != TIMELINE_TOOL_SLIP) {
// slipping doesn't move the clips so we don't bother snapping for it
for (int i=0;i<panel_timeline->ghosts.size();i++) {
Ghost& g = panel_timeline->ghosts[i];
validate_snapping(g, &frame_diff);
if (panel_timeline->snapped) break;
}
}
@@ -789,7 +794,7 @@ void TimelineWidget::update_ghosts(QPoint& mouse_pos) {
}
// apply changes to selections
if (panel_timeline->tool != TIMELINE_TOOL_SLIP) {
if (panel_timeline->tool != TIMELINE_TOOL_SLIP && !panel_timeline->importing) {
for (int i=0;i<panel_timeline->selections.size();i++) {
Selection& s = panel_timeline->selections[i];
if (panel_timeline->trim_target > -1) {
+21
View File
@@ -34,17 +34,38 @@ ViewerWidget::ViewerWidget(QWidget *parent) : QOpenGLWidget(parent) {
connect(&retry_timer, SIGNAL(timeout()), this, SLOT(retry()));
}
void ViewerWidget::deleteFunction() {
// destroy all textures as well
for (int i=0;i<sequence->clip_count();i++) {
Clip* c = sequence->get_clip(i);
if (c->texture != NULL) {
/* TODO NOTE: apparently "destroy()" is non-functional here because
* it requires a valid current context, and I guess it's no longer
* valid or current by the time this function is called. Not sure
* how to handle that just yet...
*/
c->texture->destroy();
c->texture = NULL;
}
}
}
void ViewerWidget::retry() {
update();
}
void ViewerWidget::initializeGL() {
connect(context(), SIGNAL(aboutToBeDestroyed()), this, SLOT(deleteFunction()));
initializeOpenGLFunctions();
glClearColor(0, 0, 0, 1);
glMatrixMode(GL_PROJECTION);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
update();
}
//void ViewerWidget::resizeGL(int w, int h)
+1
View File
@@ -32,6 +32,7 @@ private:
QVector<qint16> samples;
private slots:
void retry();
void deleteFunction();
};
#endif // VIEWERWIDGET_H