added workaround for qtreewidget deleting the wrong item

This commit is contained in:
itsmattkc
2018-12-04 20:01:33 +11:00
parent 3d4512fa3c
commit 6f5cab5f86
9 changed files with 25 additions and 12 deletions
+3
View File
@@ -15,6 +15,7 @@
#include "project/sequence.h"
#include "io/exportthread.h"
#include "playback/playback.h"
#include "mainwindow.h"
extern "C" {
#include <libavformat/avformat.h>
@@ -477,6 +478,8 @@ void ExportDialog::on_pushButton_clicked() {
closeActiveClips(sequence, true);
mainWindow->autorecover_interval();
rendering = true;
panel_sequence_viewer->viewer_widget->context()->doneCurrent();
panel_sequence_viewer->viewer_widget->context()->moveToThread(et);
+5 -3
View File
@@ -124,7 +124,7 @@ bool ExportThread::setupVideo() {
/*char buffer[50];
itoa(vcodec_ctx, buffer, 10);*/
av_opt_set(vcodec_ctx->priv_data, "preset", "slow", AV_OPT_SEARCH_CHILDREN);
// av_opt_set(vcodec_ctx->priv_data, "preset", "slow", AV_OPT_SEARCH_CHILDREN);
switch (video_compression_type) {
case COMPRESSION_TYPE_CFR:
@@ -358,7 +358,9 @@ void ExportThread::run() {
sws_frame->pts = round(timecode_secs/av_q2d(video_stream->time_base));
// send to encoder
// dout << "starting encode of video frame" << sequence->playhead;
if (!encode(fmt_ctx, vcodec_ctx, sws_frame, &video_pkt, video_stream)) continueEncode = false;
// dout << "completed encode of video frame" << sequence->playhead;
}
if (audio_enabled) {
// do we need to encode more audio samples?
@@ -381,8 +383,8 @@ void ExportThread::run() {
swr_convert_frame(swr_ctx, swr_frame, audio_frame);
swr_frame->pts = file_audio_samples;
// send to encoder
if (!encode(fmt_ctx, acodec_ctx, swr_frame, &audio_pkt, audio_stream)) continueEncode = false;
// send to encoder
if (!encode(fmt_ctx, acodec_ctx, swr_frame, &audio_pkt, audio_stream)) continueEncode = false;
file_audio_samples += swr_frame->nb_samples;
}
+1 -1
View File
@@ -418,7 +418,7 @@ void MainWindow::on_actionSplit_at_Playhead_triggered()
}
void MainWindow::autorecover_interval() {
if (isWindowModified()) {
if (!rendering && isWindowModified()) {
panel_project->save_project(true);
dout << "[INFO] Auto-recovery project saved";
}
+1 -2
View File
@@ -28,6 +28,7 @@ public slots:
void cut();
void copy();
void paste();
void autorecover_interval();
void on_actionNest_triggered();
protected:
@@ -105,8 +106,6 @@ private slots:
void on_actionGo_to_Next_Cut_triggered();
void autorecover_interval();
void on_actionPreferences_triggered();
void on_actionIncrease_Track_Height_triggered();
+5
View File
@@ -337,6 +337,10 @@ void Project::delete_selected_media() {
bool remove = true;
bool redraw = false;
// correctly sort (fixes qt bug - see AddMediaCommand::redo() for info)
source_table->setSortingEnabled(false);
source_table->setSortingEnabled(true);
// check if media is in use
QVector<QTreeWidgetItem*> parents;
QList<QTreeWidgetItem*> sequence_items;
@@ -993,6 +997,7 @@ bool Project::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
if (!QFileInfo::exists(m->url)) { // if path is not absolute
QString proj_dir_test = proj_dir.absoluteFilePath(m->url);
QString internal_proj_dir_test = internal_proj_dir.absoluteFilePath(m->url);
if (QFileInfo::exists(proj_dir_test)) { // if path is relative to the project's current dir
m->url = proj_dir_test;
dout << "[INFO] Matched" << attr.value().toString() << "relative to project's current directory";
+1 -1
View File
@@ -319,7 +319,7 @@ void Viewer::play_wake() {
if (just_played) {
start_msecs = QDateTime::currentMSecsSinceEpoch();
playback_updater.start();
audio_thread->notifyReceiver();
if (audio_thread != NULL) audio_thread->notifyReceiver();
just_played = false;
}
}
+4 -4
View File
@@ -54,7 +54,7 @@ void init_audio(Sequence* s) {
audio_format = info.nearestFormat(audio_format);
}
audio_output = new QAudioOutput(audio_format);
audio_output = new QAudioOutput(info, audio_format);
audio_output->setNotifyInterval(5);
// connect
@@ -62,9 +62,9 @@ void init_audio(Sequence* s) {
audio_device_set = true;
// start sender thread
audio_thread = new AudioSenderThread();
QObject::connect(audio_output, SIGNAL(notify()), audio_thread, SLOT(notifyReceiver()));
audio_thread->start(QThread::TimeCriticalPriority);
audio_thread = new AudioSenderThread();
QObject::connect(audio_output, SIGNAL(notify()), audio_thread, SLOT(notifyReceiver()));
audio_thread->start(QThread::TimeCriticalPriority);
clear_audio_ibuffer();
}
+1 -1
View File
@@ -390,7 +390,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests) {
audio_write_lock.unlock();
if (scrubbing) {
audio_thread->notifyReceiver();
if (audio_thread != NULL) audio_thread->notifyReceiver();
}
if (c->frame_sample_index == nb_bytes) {
+4
View File
@@ -415,6 +415,10 @@ void AddMediaCommand::redo() {
*
* The following 2 lines seem to force the source_table to re-sort
* correctly and therefore works around this problem. But holy shit.
*
* I guess I'm "supposed" to use a Modelviewviewmodel instead,
* which I'll probably have to switch to soon anyway. So perhaps
* this will be a non-issue soon.
*/
panel_project->source_table->setSortingEnabled(false);
panel_project->source_table->setSortingEnabled(true);