diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03343fd3a..4f1848461 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: ${{ matrix.cmake-gen }}> runs-on: ubuntu-latest container: - image: olivevideoeditor/ci-olive:2022.1 + image: olivevideoeditor/ci-olive:2022.2 steps: - name: Checkout Source Code @@ -332,7 +332,6 @@ jobs: run: | $DOWNLOAD_TOOL https://github.com/olive-editor/crashpad/releases/download/continuous/crashpad-mac-${{ matrix.os-arch }}.tar.gz sudo tar xzf crashpad-mac-${{ matrix.os-arch }}.tar.gz -C / - if: matrix.os-arch == 'x86_64' # TEMPORARY: Crashpad isn't compiling on ARM64 yet for some reason - name: Generate Patreon List env: @@ -344,11 +343,16 @@ jobs: if: github.event_name == 'push' continue-on-error: true + - name: Install Ninja + shell: bash + run: | + brew update + brew install ninja + - name: Configure CMake shell: bash working-directory: ${{ runner.workspace }}/build run: | - brew install ninja PATH=$DEP_LOCATION:$DEP_LOCATION/bin:$DEP_LOCATION/include:$DEP_LOCATION/lib:$DEP_LOCATION/crashpad:$PATH \ cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \ -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ matrix.min-deploy }} -G "${{ matrix.cmake-gen }}" \ @@ -374,32 +378,26 @@ jobs: BUNDLE_NAME="Olive.app" brew install dylibbundler - if [ "${{ matrix.os-arch }}" == "x86_64" ] - then - DYLIBBUNDLER_EXTRA_ARGS="-x $BUNDLE_NAME/Contents/MacOS/olive-crashhandler" - fi - mv app/$BUNDLE_NAME . mkdir $BUNDLE_NAME/Contents/Frameworks - dylibbundler -b -ns -x "$BUNDLE_NAME/Contents/MacOS/Olive" -s "$DEP_LOCATION/lib" -d "$BUNDLE_NAME/Contents/Frameworks" -p "@executable_path/../Frameworks" $DYLIBBUNDLER_EXTRA_ARGS # Copy Qt frameworks and plugins cp -Ra $DEP_LOCATION/lib/Qt*.framework $BUNDLE_NAME/Contents/Frameworks cp -Ra $DEP_LOCATION/plugins $BUNDLE_NAME/Contents + dylibbundler -b -ns -x "$BUNDLE_NAME/Contents/MacOS/Olive" -s "$DEP_LOCATION/lib" -d "$BUNDLE_NAME/Contents/Frameworks" -p "@executable_path/../Frameworks" \ + -x $BUNDLE_NAME/Contents/MacOS/olive-crashhandler -x $BUNDLE_NAME/Contents/Frameworks/QtNetwork.framework/Versions/5/QtNetwork + # HACK: On x86_64, dylibbundler doesn't resolve this symlink. Weirdly it does on ARM64, # but perhaps I'll bring it up with them soon. cp -a $BUNDLE_NAME/Contents/Frameworks/libpng16.16.37.0.dylib $BUNDLE_NAME/Contents/Frameworks/libpng16.16.dylib - if [ "${{ matrix.os-arch }}" == "x86_64" ] - then - # Crashpad symbols - $DEP_LOCATION/bin/dump_syms $BUNDLE_NAME/Contents/MacOS/Olive > Olive.sym - SYM_HEADER=($(head -n 1 Olive.sym)) # Read first line of symbol file - SYM_DIR=$BUNDLE_NAME/Contents/Resources/symbols/Olive/${SYM_HEADER[3]} - mkdir -p "$SYM_DIR" - mv Olive.sym "$SYM_DIR" - fi + # Crashpad symbols + $DEP_LOCATION/bin/dump_syms $BUNDLE_NAME/Contents/MacOS/Olive > Olive.sym + SYM_HEADER=($(head -n 1 Olive.sym)) # Read first line of symbol file + SYM_DIR=$BUNDLE_NAME/Contents/Resources/symbols/Olive/${SYM_HEADER[3]} + mkdir -p "$SYM_DIR" + mv Olive.sym "$SYM_DIR" - name: Sign Application working-directory: ${{ runner.workspace }}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index acc43c97a..b46d11f6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ option(BUILD_DOXYGEN "Build Doxygen documentation" OFF) option(BUILD_TESTS "Build unit tests" ON) option(USE_WERROR "Error on compile warning" ON) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -30,6 +30,12 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) +# Sanitizers +add_library(olive-sanitizers INTERFACE) +include(cmake/Sanitizers.cmake) +enable_sanitizers(olive-sanitizers) +list(APPEND OLIVE_LIBRARIES olive-sanitizers) + # Set compiler options if(MSVC) set(OLIVE_COMPILE_OPTIONS diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 64d77da16..d438dc135 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/audio/CMakeLists.txt b/app/audio/CMakeLists.txt index 08273c9af..6b161d81b 100644 --- a/app/audio/CMakeLists.txt +++ b/app/audio/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/audio/audiomanager.cpp b/app/audio/audiomanager.cpp index 3817f285a..fc0dc886d 100644 --- a/app/audio/audiomanager.cpp +++ b/app/audio/audiomanager.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/audio/audiomanager.h b/app/audio/audiomanager.h index 2916d29d2..3c35e0593 100644 --- a/app/audio/audiomanager.h +++ b/app/audio/audiomanager.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/audio/audioprocessor.cpp b/app/audio/audioprocessor.cpp index b9c95bb6d..d73ca0931 100644 --- a/app/audio/audioprocessor.cpp +++ b/app/audio/audioprocessor.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/audio/audioprocessor.h b/app/audio/audioprocessor.h index 38826c707..d2861a3bc 100644 --- a/app/audio/audioprocessor.h +++ b/app/audio/audioprocessor.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/audio/audiovisualwaveform.cpp b/app/audio/audiovisualwaveform.cpp index 7719d7090..03bd6aabc 100644 --- a/app/audio/audiovisualwaveform.cpp +++ b/app/audio/audiovisualwaveform.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -287,7 +287,7 @@ void ExpandMinMaxChannel(const float *a, int start, int length, float &min_val, __m128 min = _mm_loadu_ps(a + start); // loop over 'a' and compare current elements with min and max 4 by 4. - // we need to make sure we don't read out of boundaries should 'a' lenght be not mod. 4 + // we need to make sure we don't read out of boundaries should 'a' length be not mod. 4 for(int i = 4; i < length-4; i+=4) { __m128 cur = _mm_loadu_ps(a + start + i); max = _mm_max_ps(max, cur); diff --git a/app/audio/audiovisualwaveform.h b/app/audio/audiovisualwaveform.h index 446d67e75..389f72980 100644 --- a/app/audio/audiovisualwaveform.h +++ b/app/audio/audiovisualwaveform.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/cli/CMakeLists.txt b/app/cli/CMakeLists.txt index b96b46395..c261a3e00 100644 --- a/app/cli/CMakeLists.txt +++ b/app/cli/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/cli/cliexport/cliexportmanager.cpp b/app/cli/cliexport/cliexportmanager.cpp index 7e84ed84c..9f9670996 100644 --- a/app/cli/cliexport/cliexportmanager.cpp +++ b/app/cli/cliexport/cliexportmanager.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/cli/cliexport/cliexportmanager.h b/app/cli/cliexport/cliexportmanager.h index dee831bb7..867bc5493 100644 --- a/app/cli/cliexport/cliexportmanager.h +++ b/app/cli/cliexport/cliexportmanager.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/cli/cliprogress/CMakeLists.txt b/app/cli/cliprogress/CMakeLists.txt index 0dcf47f90..621c498da 100644 --- a/app/cli/cliprogress/CMakeLists.txt +++ b/app/cli/cliprogress/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/cli/cliprogress/cliprogressdialog.cpp b/app/cli/cliprogress/cliprogressdialog.cpp index d4ffa0095..17203e386 100644 --- a/app/cli/cliprogress/cliprogressdialog.cpp +++ b/app/cli/cliprogress/cliprogressdialog.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/cli/cliprogress/cliprogressdialog.h b/app/cli/cliprogress/cliprogressdialog.h index 1ed3c61f6..444c66f33 100644 --- a/app/cli/cliprogress/cliprogressdialog.h +++ b/app/cli/cliprogress/cliprogressdialog.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/cli/clitask/CMakeLists.txt b/app/cli/clitask/CMakeLists.txt index 0c904acb7..8e5f4782b 100644 --- a/app/cli/clitask/CMakeLists.txt +++ b/app/cli/clitask/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/cli/clitask/clitaskdialog.cpp b/app/cli/clitask/clitaskdialog.cpp index 45288f283..d36ef367f 100644 --- a/app/cli/clitask/clitaskdialog.cpp +++ b/app/cli/clitask/clitaskdialog.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/cli/clitask/clitaskdialog.h b/app/cli/clitask/clitaskdialog.h index 5bdac7ad5..e07ffa6cc 100644 --- a/app/cli/clitask/clitaskdialog.h +++ b/app/cli/clitask/clitaskdialog.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/CMakeLists.txt b/app/codec/CMakeLists.txt index fa6e81c25..21733e110 100644 --- a/app/codec/CMakeLists.txt +++ b/app/codec/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/codec/decoder.cpp b/app/codec/decoder.cpp index c487e2425..af4b45d34 100644 --- a/app/codec/decoder.cpp +++ b/app/codec/decoder.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -199,9 +199,17 @@ DecoderPtr Decoder::CreateFromID(const QString &id) return nullptr; } -int64_t Decoder::GetTimeInTimebaseUnits(const rational &time, const rational &timebase, int64_t start_time) +int64_t Decoder::GetTimeInTimebaseUnits(const rational &time, const rational &timebase, int64_t start_time, VideoParams::Interlacing interlacing) { - return Timecode::time_to_timestamp(time, timebase) + start_time; + int64_t t = Timecode::time_to_timestamp(time, timebase); + t += start_time; + return t; +} + +rational Decoder::GetTimestampInTimeUnits(int64_t time, const rational &timebase, int64_t start_time, VideoParams::Interlacing interlacing) +{ + time -= start_time; + return Timecode::timestamp_to_time(time, timebase); } void Decoder::SignalProcessingProgress(int64_t ts, int64_t duration) diff --git a/app/codec/decoder.h b/app/codec/decoder.h index 3191ade23..c3b501cc1 100644 --- a/app/codec/decoder.h +++ b/app/codec/decoder.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -295,7 +295,8 @@ protected: return stream_; } - static int64_t GetTimeInTimebaseUnits(const rational& time, const rational& timebase, int64_t start_time); + static int64_t GetTimeInTimebaseUnits(const rational& time, const rational& timebase, int64_t start_time, VideoParams::Interlacing interlacing); + static rational GetTimestampInTimeUnits(int64_t time, const rational& timebase, int64_t start_time, VideoParams::Interlacing interlacing); signals: /** diff --git a/app/codec/encoder.cpp b/app/codec/encoder.cpp index 06b36c3bb..458c71d8e 100644 --- a/app/codec/encoder.cpp +++ b/app/codec/encoder.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/encoder.h b/app/codec/encoder.h index f94473dbb..e1535290b 100644 --- a/app/codec/encoder.h +++ b/app/codec/encoder.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/exportcodec.cpp b/app/codec/exportcodec.cpp index e1c76ad4c..2a908f8b5 100644 --- a/app/codec/exportcodec.cpp +++ b/app/codec/exportcodec.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/exportcodec.h b/app/codec/exportcodec.h index a57abc294..7fff8f311 100644 --- a/app/codec/exportcodec.h +++ b/app/codec/exportcodec.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/exportformat.cpp b/app/codec/exportformat.cpp index 14f3e8446..9b6997d78 100644 --- a/app/codec/exportformat.cpp +++ b/app/codec/exportformat.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/exportformat.h b/app/codec/exportformat.h index fcba9666e..0fbf1d203 100644 --- a/app/codec/exportformat.h +++ b/app/codec/exportformat.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/ffmpeg/CMakeLists.txt b/app/codec/ffmpeg/CMakeLists.txt index 0f9aa9838..0401fba78 100644 --- a/app/codec/ffmpeg/CMakeLists.txt +++ b/app/codec/ffmpeg/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,11 +16,9 @@ set(OLIVE_SOURCES ${OLIVE_SOURCES} - codec/ffmpeg/ffmpegdecoder.h codec/ffmpeg/ffmpegdecoder.cpp - codec/ffmpeg/ffmpegencoder.h + codec/ffmpeg/ffmpegdecoder.h codec/ffmpeg/ffmpegencoder.cpp - codec/ffmpeg/ffmpegframepool.h - codec/ffmpeg/ffmpegframepool.cpp + codec/ffmpeg/ffmpegencoder.h PARENT_SCOPE ) diff --git a/app/codec/ffmpeg/ffmpegdecoder.cpp b/app/codec/ffmpeg/ffmpegdecoder.cpp index df6c874da..3abb9a86a 100644 --- a/app/codec/ffmpeg/ffmpegdecoder.cpp +++ b/app/codec/ffmpeg/ffmpegdecoder.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,6 +46,7 @@ extern "C" { #include "common/timecodefunctions.h" #include "render/framehashcache.h" #include "render/diskmanager.h" +#include "render/subtitleparams.h" namespace olive { @@ -53,7 +54,8 @@ FFmpegDecoder::FFmpegDecoder() : filter_graph_(nullptr), buffersrc_ctx_(nullptr), buffersink_ctx_(nullptr), - pool_(QThread::idealThreadCount()*2), + working_frame_(nullptr), + working_packet_(nullptr), is_working_(false), cache_at_zero_(false), cache_at_eof_(false) @@ -79,11 +81,14 @@ bool FFmpegDecoder::OpenInternal() if (native_pix_fmt_ == VideoParams::kFormatInvalid || native_channel_count_ == 0) { - qDebug() << "Failed to find valid native pixel format for" << ideal_pix_fmt_; + qCritical() << "Failed to find valid native pixel format for" << ideal_pix_fmt_; return false; } } + working_frame_ = av_frame_alloc(); + working_packet_ = av_packet_alloc(); + return true; } @@ -152,35 +157,21 @@ FramePtr FFmpegDecoder::RetrieveVideoInternal(const rational &timecode, const Re return nullptr; } - AVStream* s = instance_.avstream(); - - // Retrieve frame - FFmpegFramePool::ElementPtr return_frame = RetrieveFrame(timecode, cancelled); - - // We found the frame, we'll return a copy - if (return_frame) { - FramePtr copy = Frame::Create(); - copy->set_video_params(VideoParams(s->codecpar->width, - s->codecpar->height, - native_pix_fmt_, - native_channel_count_, - av_guess_sample_aspect_ratio(instance_.fmt_ctx(), s, nullptr), // May be incorrect, - VideoParams::kInterlaceNone, - filter_params_.divider)); - copy->set_timestamp(timecode); - copy->allocate(); - - // This data will already match the frame - memcpy(copy->data(), return_frame->data(), copy->allocated_size()); - - return copy; - } - - return nullptr; + return RetrieveFrame(timecode, cancelled); } void FFmpegDecoder::CloseInternal() { + if (working_packet_) { + av_packet_free(&working_packet_); + working_packet_ = nullptr; + } + + if (working_frame_) { + av_frame_free(&working_frame_); + working_frame_ = nullptr; + } + ClearFrameCache(); instance_.Close(); @@ -191,35 +182,35 @@ int FFmpegDecoder::GetFilteredFrame(AVPacket* packet, AVFrame* output_frame) // Ensure scaler is correct for these parameters int ret; - AVFrame* working_frame = av_frame_alloc(); - // Try to pull frame from buffersink while ((ret = av_buffersink_get_frame(buffersink_ctx_, output_frame)) == AVERROR(EAGAIN)) { // If no frame is ready in the buffersink, pull from codec - ret = instance_.GetFrame(packet, working_frame); + ret = instance_.GetFrame(packet, output_frame); if (ret >= 0) { // Override this frame's interlacing parameters from user switch (filter_params_.src_interlacing) { case VideoParams::kInterlaceNone: - working_frame->interlaced_frame = 0; + output_frame->interlaced_frame = 0; break; case VideoParams::kInterlacedTopFirst: - working_frame->interlaced_frame = 1; - working_frame->top_field_first = 1; + output_frame->interlaced_frame = 1; + output_frame->top_field_first = 1; break; case VideoParams::kInterlacedBottomFirst: - working_frame->interlaced_frame = 1; - working_frame->top_field_first = 0; + output_frame->interlaced_frame = 1; + output_frame->top_field_first = 0; break; } // If succeeded in pulling from codec, send to buffer source - ret = av_buffersrc_add_frame_flags(buffersrc_ctx_, working_frame, AV_BUFFERSRC_FLAG_KEEP_REF); + ret = av_buffersrc_add_frame_flags(buffersrc_ctx_, output_frame, AV_BUFFERSRC_FLAG_KEEP_REF); + + av_frame_unref(output_frame); if (ret < 0) { // If failed to send to buffer source, return break and error code - qDebug() << "Failed to feed filter graph:" << FFmpegError(ret); + qCritical() << "Failed to feed filter graph:" << FFmpegError(ret); break; } } else { @@ -228,8 +219,6 @@ int FFmpegDecoder::GetFilteredFrame(AVPacket* packet, AVFrame* output_frame) } } - av_frame_free(&working_frame); - return ret; } @@ -415,7 +404,30 @@ FootageDescription FFmpegDecoder::Probe(const QString &filename, const QAtomicIn } else if (avstream->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) { - qDebug() << "Subtitle probing: Stub"; + // Limit to SRT for now... + if (avstream->codecpar->codec_id == AV_CODEC_ID_SUBRIP) { + SubtitleParams sub; + + AVPacket* pkt = av_packet_alloc(); + { + Instance instance; + instance.Open(filename_c, avstream->index); + + while (instance.GetPacket(pkt) >= 0) { + TimeRange time(Timecode::timestamp_to_time(pkt->pts, avstream->time_base), + Timecode::timestamp_to_time(pkt->pts + pkt->duration, avstream->time_base)); + + QString text = QString::fromUtf8((const char *) pkt->data, pkt->size); + + sub.push_back(Subtitle(time, text)); + } + + instance.Close(); + } + av_packet_free(&pkt); + + desc.AddSubtitleStream(sub); + } } @@ -661,7 +673,7 @@ void FFmpegDecoder::CacheFrameToDisk(AVFrame *f) void FFmpegDecoder::ClearFrameCache() { - if (!cached_frames_.isEmpty()) { + if (!cached_frames_.empty()) { cached_frames_.clear(); cache_at_eof_ = false; cache_at_zero_ = false; @@ -672,24 +684,18 @@ void FFmpegDecoder::ClearFrameCache() } } -FFmpegFramePool::ElementPtr FFmpegDecoder::RetrieveFrame(const rational& time, const QAtomicInt *cancelled) +FramePtr FFmpegDecoder::RetrieveFrame(const rational& time, const QAtomicInt *cancelled) { - int64_t target_ts = GetTimeInTimebaseUnits(time, instance_.avstream()->time_base, instance_.avstream()->start_time); + int64_t target_ts = GetTimeInTimebaseUnits(time, instance_.avstream()->time_base, instance_.avstream()->start_time, filter_params_.src_interlacing); const int64_t min_seek = -instance_.avstream()->start_time; int64_t seek_ts = target_ts; bool still_seeking = false; - if (filter_params_.src_interlacing != VideoParams::kInterlaceNone) { - // If we are de-interlacing, the timebase is doubled because we get one frame per field, so we - // double the target timestamp too - target_ts *= 2; - } - if (time != kAnyTimecode) { // If the frame wasn't in the frame cache, see if this frame cache is too old to use - if (cached_frames_.isEmpty() - || (target_ts < cached_frames_.first()->timestamp() || target_ts > cached_frames_.last()->timestamp() + 2*second_ts_)) { + if (cached_frames_.empty() + || (time < cached_frames_.front()->timestamp() || time > cached_frames_.back()->timestamp() + 2)) { ClearFrameCache(); instance_.Seek(seek_ts); @@ -700,7 +706,7 @@ FFmpegFramePool::ElementPtr FFmpegDecoder::RetrieveFrame(const rational& time, c still_seeking = true; } else { // Search cache for frame - FFmpegFramePool::ElementPtr cached_frame = GetFrameFromCache(target_ts); + FramePtr cached_frame = GetFrameFromCache(time); if (cached_frame) { return cached_frame; } @@ -708,11 +714,7 @@ FFmpegFramePool::ElementPtr FFmpegDecoder::RetrieveFrame(const rational& time, c } int ret; - AVPacket* pkt = av_packet_alloc(); - FFmpegFramePool::ElementPtr return_frame = nullptr; - - // Allocate a new frame - AVFrame* working_frame = av_frame_alloc(); + FramePtr return_frame = nullptr; while (true) { // Break out of loop if we've cancelled @@ -721,8 +723,8 @@ FFmpegFramePool::ElementPtr FFmpegDecoder::RetrieveFrame(const rational& time, c } // Pull from the decoder - av_frame_unref(working_frame); - ret = GetFilteredFrame(pkt, working_frame); + av_frame_unref(working_frame_); + ret = GetFilteredFrame(working_packet_, working_frame_); // Handle any errors that aren't EOF (EOF is handled later on) if (ret < 0 && ret != AVERROR_EOF) { @@ -733,7 +735,7 @@ FFmpegFramePool::ElementPtr FFmpegDecoder::RetrieveFrame(const rational& time, c if (still_seeking) { // Handle a failure to seek (occurs on some media) // We'll only be here if the frame cache was emptied earlier - if (!cache_at_zero_ && (ret == AVERROR_EOF || working_frame->best_effort_timestamp > target_ts)) { + if (!cache_at_zero_ && (ret == AVERROR_EOF || working_frame_->best_effort_timestamp > target_ts)) { seek_ts = qMax(min_seek, seek_ts - second_ts_); instance_.Seek(seek_ts); @@ -755,10 +757,10 @@ FFmpegFramePool::ElementPtr FFmpegDecoder::RetrieveFrame(const rational& time, c // Handle an "expected" EOF by using the last frame of our cache cache_at_eof_ = true; - if (cached_frames_.isEmpty()) { + if (cached_frames_.empty()) { qCritical() << "Unexpected codec EOF - unable to retrieve frame"; } else { - return_frame = cached_frames_.last(); + return_frame = cached_frames_.back(); } break; @@ -766,42 +768,39 @@ FFmpegFramePool::ElementPtr FFmpegDecoder::RetrieveFrame(const rational& time, c } else { // Cut down to thread count - 1 before we acquire a new frame - if (cached_frames_.size() == QThread::idealThreadCount()) { + if (cached_frames_.size() == size_t(QThread::idealThreadCount())) { RemoveFirstFrame(); } - FFmpegFramePool::ElementPtr cached = pool_.Get(); - - if (!cached) { - qCritical() << "Frame pool failed to return a valid frame - out of memory?"; - break; - } + FramePtr cached = Frame::Create(); + cached->set_video_params(GetVideoParams()); + cached->allocate(); // Store in queue, converting to native format - uint8_t* destination_data = cached->data(); - int destination_linesize = Frame::generate_linesize_bytes(working_frame->width, native_pix_fmt_, native_channel_count_); + uint8_t* destination_data = reinterpret_cast(cached->data()); + int destination_linesize = cached->linesize_bytes(); - av_image_copy(&destination_data, &destination_linesize, const_cast(working_frame->data), working_frame->linesize, static_cast(working_frame->format), working_frame->width, working_frame->height); + av_image_copy(&destination_data, &destination_linesize, const_cast(working_frame_->data), working_frame_->linesize, static_cast(working_frame_->format), working_frame_->width, working_frame_->height); // Set timestamp so this frame can be identified later - cached->set_timestamp(working_frame->best_effort_timestamp); + cached->set_timestamp(GetTimestampInTimeUnits(working_frame_->best_effort_timestamp, instance_.avstream()->time_base, instance_.avstream()->start_time, filter_params_.src_interlacing)); // Store frame before just in case - FFmpegFramePool::ElementPtr previous; - if (cached_frames_.isEmpty()) { + FramePtr previous; + if (cached_frames_.empty()) { previous = nullptr; } else { - previous = cached_frames_.last(); + previous = cached_frames_.back(); } // Append this frame and signal to other threads that a new frame has arrived - cached_frames_.append(cached); + cached_frames_.push_back(cached); // If this is a valid frame, see if this or the frame before it are the one we need - if (cached->timestamp() == target_ts || time == kAnyTimecode) { + if (cached->timestamp() == time || time == kAnyTimecode) { return_frame = cached; break; - } else if (cached->timestamp() > target_ts) { + } else if (cached->timestamp() > time) { if (!previous && cache_at_zero_) { return_frame = cached; break; @@ -813,8 +812,8 @@ FFmpegFramePool::ElementPtr FFmpegDecoder::RetrieveFrame(const rational& time, c } } - av_frame_free(&working_frame); - av_packet_free(&pkt); + av_frame_unref(working_frame_); + av_packet_unref(working_packet_); return return_frame; } @@ -915,16 +914,10 @@ bool FFmpegDecoder::InitScaler(const RetrieveVideoParams& params) // Configure graph if (int ret = avfilter_graph_config(filter_graph_, nullptr) < 0) { - qDebug() << "Failed to configure graph:" << FFmpegError(ret); + qCritical() << "Failed to configure graph:" << FFmpegError(ret); return false; } - // Configure frame pool - if (pool_.width() != dst_width || pool_.height() != dst_height) { - // Set new frame pool parameters - pool_.SetParameters(dst_width, dst_height, native_pix_fmt_, native_channel_count_); - } - return true; } @@ -938,32 +931,32 @@ void FFmpegDecoder::FreeScaler() } } -FFmpegFramePool::ElementPtr FFmpegDecoder::GetFrameFromCache(const int64_t &t) const +FramePtr FFmpegDecoder::GetFrameFromCache(const rational &t) const { - if (t < cached_frames_.first()->timestamp()) { + if (t < cached_frames_.front()->timestamp()) { if (cache_at_zero_) { - cached_frames_.first()->access(); - return cached_frames_.first(); + return cached_frames_.front(); } - } else if (t > cached_frames_.last()->timestamp()) { + } else if (t > cached_frames_.back()->timestamp()) { if (cache_at_eof_) { - cached_frames_.last()->access(); - return cached_frames_.last(); + return cached_frames_.back(); } } else { // We already have this frame in the cache, find it - for (int i=0;itimestamp() == t // Test for an exact match - || (i < cached_frames_.size() - 1 && cached_frames_.at(i+1)->timestamp() > t)) { // Or for this frame to be the "closest" + || (next != cached_frames_.cend() && (*next)->timestamp() > t)) { // Or for this frame to be the "closest" - this_frame->access(); return this_frame; } @@ -975,10 +968,21 @@ FFmpegFramePool::ElementPtr FFmpegDecoder::GetFrameFromCache(const int64_t &t) c void FFmpegDecoder::RemoveFirstFrame() { - cached_frames_.removeFirst(); + cached_frames_.pop_front(); cache_at_zero_ = false; } +VideoParams FFmpegDecoder::GetVideoParams() const +{ + return VideoParams(instance_.avstream()->codecpar->width, + instance_.avstream()->codecpar->height, + native_pix_fmt_, + native_channel_count_, + av_guess_sample_aspect_ratio(instance_.fmt_ctx(), instance_.avstream(), nullptr), + VideoParams::kInterlaceNone, + filter_params_.divider); +} + FFmpegDecoder::Instance::Instance() : fmt_ctx_(nullptr), codec_ctx_(nullptr), @@ -1087,13 +1091,7 @@ int FFmpegDecoder::Instance::GetFrame(AVPacket *pkt, AVFrame *frame) while ((ret = avcodec_receive_frame(codec_ctx_, frame)) == AVERROR(EAGAIN) && !eof) { // Find next packet in the correct stream index - do { - // Free buffer in packet if there is one - av_packet_unref(pkt); - - // Read packet from file - ret = av_read_frame(fmt_ctx_, pkt); - } while (pkt->stream_index != avstream_->index && ret >= 0); + ret = GetPacket(pkt); if (ret == AVERROR_EOF) { // Don't break so that receive gets called again, but don't try to read again @@ -1120,6 +1118,39 @@ int FFmpegDecoder::Instance::GetFrame(AVPacket *pkt, AVFrame *frame) return ret; } +const char *FFmpegDecoder::Instance::GetSubtitleHeader() const +{ + return reinterpret_cast(codec_ctx_->subtitle_header); +} + +int FFmpegDecoder::Instance::GetSubtitle(AVPacket *pkt, AVSubtitle *sub) +{ + int ret = GetPacket(pkt); + + if (ret >= 0) { + int got_sub; + ret = avcodec_decode_subtitle2(codec_ctx_, sub, &got_sub, pkt); + if (!got_sub) { + ret = -1; + } + } + + return ret; +} + +int FFmpegDecoder::Instance::GetPacket(AVPacket *pkt) +{ + int ret; + + do { + av_packet_unref(pkt); + + ret = av_read_frame(fmt_ctx_, pkt); + } while (pkt->stream_index != avstream_->index && ret >= 0); + + return ret; +} + void FFmpegDecoder::Instance::Seek(int64_t timestamp) { avcodec_flush_buffers(codec_ctx_); diff --git a/app/codec/ffmpeg/ffmpegdecoder.h b/app/codec/ffmpeg/ffmpegdecoder.h index f3590b212..2f377af5d 100644 --- a/app/codec/ffmpeg/ffmpegdecoder.h +++ b/app/codec/ffmpeg/ffmpegdecoder.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,6 @@ extern "C" { #include #include "codec/decoder.h" -#include "ffmpegframepool.h" namespace olive { @@ -91,6 +90,12 @@ private: */ int GetFrame(AVPacket* pkt, AVFrame* frame); + const char *GetSubtitleHeader() const; + + int GetSubtitle(AVPacket* pkt, AVSubtitle* sub); + + int GetPacket(AVPacket *pkt); + void Seek(int64_t timestamp); AVFormatContext* fmt_ctx() const @@ -133,14 +138,16 @@ private: static const char* GetInterlacingModeInFFmpeg(VideoParams::Interlacing interlacing); - FFmpegFramePool::ElementPtr GetFrameFromCache(const int64_t& t) const; + FramePtr GetFrameFromCache(const rational &t) const; void ClearFrameCache(); - FFmpegFramePool::ElementPtr RetrieveFrame(const rational &time, const QAtomicInt *cancelled); + FramePtr RetrieveFrame(const rational &time, const QAtomicInt *cancelled); void RemoveFirstFrame(); + VideoParams GetVideoParams() const; + RetrieveVideoParams filter_params_; AVFilterGraph* filter_graph_; AVFilterContext* buffersrc_ctx_; @@ -149,11 +156,12 @@ private: VideoParams::Format native_pix_fmt_; int native_channel_count_; - FFmpegFramePool pool_; + AVFrame *working_frame_; + AVPacket *working_packet_; int64_t second_ts_; - QList cached_frames_; + std::list cached_frames_; bool is_working_; QMutex is_working_mutex_; diff --git a/app/codec/ffmpeg/ffmpegencoder.cpp b/app/codec/ffmpeg/ffmpegencoder.cpp index 6c42df4da..7980e10a7 100644 --- a/app/codec/ffmpeg/ffmpegencoder.cpp +++ b/app/codec/ffmpeg/ffmpegencoder.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,7 +69,7 @@ std::vector FFmpegEncoder::GetSampleFormatsForCodec(ExportC if (c == ExportCodec::kCodecPCM) { // FFmpeg lists these as separate codecs so we need custom functionality here // We list signed 16 first because ExportDialog will always use the first element by default - // (beacuse first element is the "default" in FFmpeg) + // (because first element is the "default" in FFmpeg) f = { AudioParams::kFormatSigned16Packed, AudioParams::kFormatUnsigned8Packed, @@ -376,46 +376,15 @@ QString GetAssTime(const rational &time) bool FFmpegEncoder::WriteSubtitle(const SubtitleBlock *sub_block) { - AVSubtitle subtitle; - memset(&subtitle, 0, sizeof(subtitle)); - - AVSubtitleRect rect; - memset(&rect, 0, sizeof(rect)); - - QString ass_line = QStringLiteral("Dialogue: 0,%1,%2,Default,,0,0,0,,%3").arg( - GetAssTime(sub_block->in()), - GetAssTime(sub_block->out()), - sub_block->GetText() - ); - QByteArray utf8_sub = sub_block->GetText().toUtf8(); - QByteArray utf8_ass = ass_line.toUtf8(); - - rect.type = SUBTITLE_ASS; - rect.text = utf8_sub.data(); - rect.ass = utf8_ass.data(); - - AVSubtitleRect *rect_array = ▭ - subtitle.num_rects = 1; - subtitle.rects = &rect_array; - - subtitle.pts = Timecode::time_to_timestamp(sub_block->in(), subtitle_codec_ctx_->time_base, Timecode::kFloor); - subtitle.end_display_time = qRound64(sub_block->length().toDouble() * 1000); - - QVector out_buf(1024 * 1024); - - int sub_sz = avcodec_encode_subtitle(subtitle_codec_ctx_, out_buf.data(), out_buf.size(), &subtitle); - if (sub_sz < 0) { - return false; - } AVPacket *pkt = av_packet_alloc(); pkt->stream_index = subtitle_stream_->index; - pkt->data = out_buf.data(); - pkt->size = sub_sz; - pkt->pts = subtitle.pts; - pkt->duration = av_rescale_q(subtitle.end_display_time, {1, 1000}, subtitle_codec_ctx_->time_base); + pkt->data = (uint8_t *) utf8_sub.data(); + pkt->size = utf8_sub.size(); + pkt->pts = Timecode::time_to_timestamp(sub_block->in(), subtitle_codec_ctx_->time_base, Timecode::kFloor); + pkt->duration = av_rescale_q(qRound64(sub_block->length().toDouble() * 1000), {1, 1000}, subtitle_codec_ctx_->time_base); pkt->dts = pkt->pts; av_packet_rescale_ts(pkt, subtitle_codec_ctx_->time_base, subtitle_stream_->time_base); diff --git a/app/codec/ffmpeg/ffmpegencoder.h b/app/codec/ffmpeg/ffmpegencoder.h index 465f7c40a..28786b9ce 100644 --- a/app/codec/ffmpeg/ffmpegencoder.h +++ b/app/codec/ffmpeg/ffmpegencoder.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/ffmpeg/ffmpegframepool.cpp b/app/codec/ffmpeg/ffmpegframepool.cpp deleted file mode 100644 index e8df84d67..000000000 --- a/app/codec/ffmpeg/ffmpegframepool.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*** - - Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -***/ - -#include "ffmpegframepool.h" - -#include "codec/frame.h" - -namespace olive { - -FFmpegFramePool::FFmpegFramePool(int element_count) : - MemoryPool(element_count), - width_(0), - height_(0), - format_(VideoParams::kFormatInvalid), - channel_count_(0) -{ -} - -void FFmpegFramePool::SetParameters(int width, int height, VideoParams::Format format, int channel_count) -{ - Clear(); - - width_ = width; - height_ = height; - format_ = format; - channel_count_ = channel_count; -} - -size_t FFmpegFramePool::GetElementSize() -{ - return Frame::generate_linesize_bytes(width_, format_, channel_count_) * height_; -} - -} diff --git a/app/codec/ffmpeg/ffmpegframepool.h b/app/codec/ffmpeg/ffmpegframepool.h deleted file mode 100644 index c3f9d050a..000000000 --- a/app/codec/ffmpeg/ffmpegframepool.h +++ /dev/null @@ -1,63 +0,0 @@ -/*** - - Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -***/ - -#ifndef FFMPEGFRAMEPOOL_H -#define FFMPEGFRAMEPOOL_H - -#include "common/memorypool.h" -#include "render/videoparams.h" - -namespace olive { - -class FFmpegFramePool : public MemoryPool -{ - Q_OBJECT -public: - FFmpegFramePool(int element_count); - - void SetParameters(int width, int height, VideoParams::Format format, int channel_count); - - const int& width() const - { - return width_; - } - - const int& height() const - { - return height_; - } - -protected: - virtual size_t GetElementSize() override; - -private: - int width_; - - int height_; - - VideoParams::Format format_; - - int channel_count_; - -}; - -} - -#endif // FFMPEGFRAMEPOOL_H diff --git a/app/codec/frame.cpp b/app/codec/frame.cpp index 8701ce2ba..d6899d9ff 100644 --- a/app/codec/frame.cpp +++ b/app/codec/frame.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/frame.h b/app/codec/frame.h index 5c1c4343a..995845782 100644 --- a/app/codec/frame.h +++ b/app/codec/frame.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/oiio/CMakeLists.txt b/app/codec/oiio/CMakeLists.txt index c4d407fe6..33cc8e2bb 100644 --- a/app/codec/oiio/CMakeLists.txt +++ b/app/codec/oiio/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/codec/oiio/oiiodecoder.cpp b/app/codec/oiio/oiiodecoder.cpp index e93e434e5..08264ac56 100644 --- a/app/codec/oiio/oiiodecoder.cpp +++ b/app/codec/oiio/oiiodecoder.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/oiio/oiiodecoder.h b/app/codec/oiio/oiiodecoder.h index a6039871d..fd9270e8f 100644 --- a/app/codec/oiio/oiiodecoder.h +++ b/app/codec/oiio/oiiodecoder.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/oiio/oiioencoder.cpp b/app/codec/oiio/oiioencoder.cpp index 679dbd550..0b676615c 100644 --- a/app/codec/oiio/oiioencoder.cpp +++ b/app/codec/oiio/oiioencoder.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/oiio/oiioencoder.h b/app/codec/oiio/oiioencoder.h index 1099e68ca..27f6ee44a 100644 --- a/app/codec/oiio/oiioencoder.h +++ b/app/codec/oiio/oiioencoder.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/planarfiledevice.cpp b/app/codec/planarfiledevice.cpp index c68d3ba8c..f8c961998 100644 --- a/app/codec/planarfiledevice.cpp +++ b/app/codec/planarfiledevice.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/planarfiledevice.h b/app/codec/planarfiledevice.h index d02dafa19..00da3a454 100644 --- a/app/codec/planarfiledevice.h +++ b/app/codec/planarfiledevice.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/samplebuffer.cpp b/app/codec/samplebuffer.cpp index b7d93ec83..3c0096867 100644 --- a/app/codec/samplebuffer.cpp +++ b/app/codec/samplebuffer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/codec/samplebuffer.h b/app/codec/samplebuffer.h index fb785103a..b8976af07 100644 --- a/app/codec/samplebuffer.h +++ b/app/codec/samplebuffer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/CMakeLists.txt b/app/common/CMakeLists.txt index cc881d473..b4bdea348 100644 --- a/app/common/CMakeLists.txt +++ b/app/common/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/common/autoscroll.h b/app/common/autoscroll.h index 4929348c7..8f35d3b55 100644 --- a/app/common/autoscroll.h +++ b/app/common/autoscroll.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/bezier.cpp b/app/common/bezier.cpp index b1a5f5fba..0636df355 100644 --- a/app/common/bezier.cpp +++ b/app/common/bezier.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/bezier.h b/app/common/bezier.h index 8d20a75ec..52b984a04 100644 --- a/app/common/bezier.h +++ b/app/common/bezier.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/cancelableobject.h b/app/common/cancelableobject.h index 4eafbb547..d7a1fe5d8 100644 --- a/app/common/cancelableobject.h +++ b/app/common/cancelableobject.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/channellayout.h b/app/common/channellayout.h index 07e5994e2..830726cae 100644 --- a/app/common/channellayout.h +++ b/app/common/channellayout.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/clamp.h b/app/common/clamp.h index 0ab1ffd4a..9f8cf78d2 100644 --- a/app/common/clamp.h +++ b/app/common/clamp.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/commandlineparser.cpp b/app/common/commandlineparser.cpp index 150bdc244..4d1187c04 100644 --- a/app/common/commandlineparser.cpp +++ b/app/common/commandlineparser.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -107,7 +107,7 @@ void CommandLineParser::PrintHelp(const char* filename) QCoreApplication::applicationName().toUtf8().constData(), QCoreApplication::applicationVersion().toUtf8().constData()); - printf("Copyright (C) 2018-2021 Olive Team\n"); + printf("Copyright (C) 2018-2022 Olive Team\n"); QString positional_args; for (int i=0; i #endif diff --git a/app/common/crashpadinterface.h b/app/common/crashpadinterface.h index 69f968fe5..501c3b407 100644 --- a/app/common/crashpadinterface.h +++ b/app/common/crashpadinterface.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/crashpadutils.h b/app/common/crashpadutils.h index d1e5406ca..8b0e3e6d7 100644 --- a/app/common/crashpadutils.h +++ b/app/common/crashpadutils.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,17 +24,17 @@ #include // Copied from base::FilePath to match its macro -#if defined(OS_POSIX) +#if BUILDFLAG(IS_POSIX) // On most platforms, native pathnames are char arrays, and the encoding // may or may not be specified. On Mac OS X, native pathnames are encoded // in UTF-8. #define QSTRING_TO_BASE_STRING(x) x.toStdString() #define BASE_STRING_TO_QSTRING(x) QString::fromStdString(x) -#elif defined(OS_WIN) +#elif BUILDFLAG(IS_WIN) // On Windows, for Unicode-aware applications, native pathnames are wchar_t // arrays encoded in UTF-16. #define QSTRING_TO_BASE_STRING(x) x.toStdWString() #define BASE_STRING_TO_QSTRING(x) QString::fromStdWString(x) -#endif // OS_WIN +#endif // BUILDFLAG(IS_WIN) #endif // CRASHPADUTILS_H diff --git a/app/common/debug.cpp b/app/common/debug.cpp index 83603a8a0..c132b48ee 100644 --- a/app/common/debug.cpp +++ b/app/common/debug.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/debug.h b/app/common/debug.h index 36413fee0..b2a5e9289 100644 --- a/app/common/debug.h +++ b/app/common/debug.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/decibel.h b/app/common/decibel.h index 61d57f276..40a88135b 100644 --- a/app/common/decibel.h +++ b/app/common/decibel.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/define.h b/app/common/define.h index 9ec47e4fc..889020eaf 100644 --- a/app/common/define.h +++ b/app/common/define.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/digit.h b/app/common/digit.h index d4e208944..7e03f96ff 100644 --- a/app/common/digit.h +++ b/app/common/digit.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/ffmpegutils.cpp b/app/common/ffmpegutils.cpp index 90c84e620..411f0a115 100644 --- a/app/common/ffmpegutils.cpp +++ b/app/common/ffmpegutils.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,9 +25,9 @@ namespace olive { AVPixelFormat FFmpegUtils::GetCompatiblePixelFormat(const AVPixelFormat &pix_fmt) { AVPixelFormat possible_pix_fmts[] = { - AV_PIX_FMT_RGB24, + // RGBA formats only because GPUs always upconvert to RGBA, so if it's RGB, that adds extra + // conversion overhead AV_PIX_FMT_RGBA, - AV_PIX_FMT_RGB48, AV_PIX_FMT_RGBA64, AV_PIX_FMT_NONE }; diff --git a/app/common/ffmpegutils.h b/app/common/ffmpegutils.h index 8208e56ad..9fa58582a 100644 --- a/app/common/ffmpegutils.h +++ b/app/common/ffmpegutils.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/filefunctions.cpp b/app/common/filefunctions.cpp index 82878e67b..6630470cd 100644 --- a/app/common/filefunctions.cpp +++ b/app/common/filefunctions.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/filefunctions.h b/app/common/filefunctions.h index abe20be03..f613fc001 100644 --- a/app/common/filefunctions.h +++ b/app/common/filefunctions.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/flipmodifiers.cpp b/app/common/flipmodifiers.cpp index 95c624628..ad48704c7 100644 --- a/app/common/flipmodifiers.cpp +++ b/app/common/flipmodifiers.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/flipmodifiers.h b/app/common/flipmodifiers.h index 3a9e538c0..12b408e39 100644 --- a/app/common/flipmodifiers.h +++ b/app/common/flipmodifiers.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/functiontimer.h b/app/common/functiontimer.h index a36e4afc9..ba1aadbdc 100644 --- a/app/common/functiontimer.h +++ b/app/common/functiontimer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/lerp.h b/app/common/lerp.h index 454c55a01..dbed7f498 100644 --- a/app/common/lerp.h +++ b/app/common/lerp.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/memorypool.h b/app/common/memorypool.h index 8435dee0b..a932ad5f3 100644 --- a/app/common/memorypool.h +++ b/app/common/memorypool.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/ocioutils.cpp b/app/common/ocioutils.cpp index b296f0305..5690bab43 100644 --- a/app/common/ocioutils.cpp +++ b/app/common/ocioutils.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/ocioutils.h b/app/common/ocioutils.h index 6fa294de7..bddafee2e 100644 --- a/app/common/ocioutils.h +++ b/app/common/ocioutils.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/oiioutils.cpp b/app/common/oiioutils.cpp index 682618e1a..ee84de1e0 100644 --- a/app/common/oiioutils.cpp +++ b/app/common/oiioutils.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/oiioutils.h b/app/common/oiioutils.h index 860a359f1..0d7ac9a19 100644 --- a/app/common/oiioutils.h +++ b/app/common/oiioutils.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/power.h b/app/common/power.h index 29d172f5b..1ac6bfbeb 100644 --- a/app/common/power.h +++ b/app/common/power.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/qtutils.cpp b/app/common/qtutils.cpp index 560566029..e4cc56c28 100644 --- a/app/common/qtutils.cpp +++ b/app/common/qtutils.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/qtutils.h b/app/common/qtutils.h index 2c5f6b652..122a5022c 100644 --- a/app/common/qtutils.h +++ b/app/common/qtutils.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/range.h b/app/common/range.h index c983743c4..1f34874a3 100644 --- a/app/common/range.h +++ b/app/common/range.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/ratiodialog.cpp b/app/common/ratiodialog.cpp index 8e5017f0b..fd216b6a1 100644 --- a/app/common/ratiodialog.cpp +++ b/app/common/ratiodialog.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/ratiodialog.h b/app/common/ratiodialog.h index 3b2a2fe5c..5eacd9de1 100644 --- a/app/common/ratiodialog.h +++ b/app/common/ratiodialog.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/rational.cpp b/app/common/rational.cpp index 62b93c6cd..0f9039e7c 100644 --- a/app/common/rational.cpp +++ b/app/common/rational.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/rational.h b/app/common/rational.h index 4701e1e0a..e4d0ba9fb 100644 --- a/app/common/rational.h +++ b/app/common/rational.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/threadedobject.cpp b/app/common/threadedobject.cpp index dd34b66a9..fccb2cd4d 100644 --- a/app/common/threadedobject.cpp +++ b/app/common/threadedobject.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/threadedobject.h b/app/common/threadedobject.h index 726877a11..c42b4faa5 100644 --- a/app/common/threadedobject.h +++ b/app/common/threadedobject.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/timecodefunctions.cpp b/app/common/timecodefunctions.cpp index 2ac854af2..a0f97efb1 100644 --- a/app/common/timecodefunctions.cpp +++ b/app/common/timecodefunctions.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,10 @@ #include "timecodefunctions.h" +extern "C" { +#include +} + #include #include "config/config.h" @@ -254,7 +258,14 @@ rational Timecode::snap_time_to_timebase(const rational &time, const rational &t rational Timecode::timestamp_to_time(const int64_t ×tamp, const rational &timebase) { - return rational(timestamp) * timebase; + int64_t num = int64_t(timebase.numerator()) * timestamp; + int64_t den = timebase.denominator(); + + int num_r, den_r; + + av_reduce(&num_r, &den_r, num, den, INT_MAX); + + return rational(num_r, den_r); } QString Timecode::time_to_timecode(const rational &time, const rational &timebase, const Timecode::Display &display, bool show_plus_if_positive) @@ -310,7 +321,7 @@ int64_t Timecode::rescale_timestamp(const int64_t &ts, const rational &source, c return ts; } - return qRound64(static_cast(ts) * source.toDouble() / dest.toDouble()); + return av_rescale_q(ts, source.toAVRational(), dest.toAVRational()); } int64_t Timecode::rescale_timestamp_ceil(const int64_t &ts, const rational &source, const rational &dest) @@ -319,7 +330,7 @@ int64_t Timecode::rescale_timestamp_ceil(const int64_t &ts, const rational &sour return ts; } - return qCeil(static_cast(ts) * source.toDouble() / dest.toDouble()); + return av_rescale_q_rnd(ts, source.toAVRational(), dest.toAVRational(), AV_ROUND_UP); } } diff --git a/app/common/timecodefunctions.h b/app/common/timecodefunctions.h index 7252f44db..fe5273acb 100644 --- a/app/common/timecodefunctions.h +++ b/app/common/timecodefunctions.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/timerange.cpp b/app/common/timerange.cpp index c4337a7aa..7326794ef 100644 --- a/app/common/timerange.cpp +++ b/app/common/timerange.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/timerange.h b/app/common/timerange.h index abb004853..fe73796d5 100644 --- a/app/common/timerange.h +++ b/app/common/timerange.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/util.h b/app/common/util.h index bc1642f81..8758621d6 100644 --- a/app/common/util.h +++ b/app/common/util.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/xmlutils.cpp b/app/common/xmlutils.cpp index 27057ffd9..8396532ff 100644 --- a/app/common/xmlutils.cpp +++ b/app/common/xmlutils.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/common/xmlutils.h b/app/common/xmlutils.h index 5a4735ea5..6e6670b6c 100644 --- a/app/common/xmlutils.h +++ b/app/common/xmlutils.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/config/CMakeLists.txt b/app/config/CMakeLists.txt index 2674ced82..7e1a01dd8 100644 --- a/app/config/CMakeLists.txt +++ b/app/config/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/config/config.cpp b/app/config/config.cpp index 0aaaa6253..d2cb089db 100644 --- a/app/config/config.cpp +++ b/app/config/config.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/config/config.h b/app/config/config.h index b15362802..c3c9d2d04 100644 --- a/app/config/config.h +++ b/app/config/config.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/core.cpp b/app/core.cpp index 0010cae4d..5f00a7b69 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -185,9 +185,7 @@ void Core::Start() QTimer *crash_timer = new QTimer(this); crash_timer->setInterval(interval); connect(crash_timer, &QTimer::timeout, this, []{ - // Try to read invalid memory to crash the application - int *invalid_ptr = nullptr; - qDebug() << *invalid_ptr; + abort(); }); crash_timer->start(); } @@ -370,7 +368,7 @@ void Core::DialogImportShow() void Core::DialogPreferencesShow() { - PreferencesDialog pd(main_window_, main_window_->menuBar()); + PreferencesDialog pd(main_window_); pd.exec(); } @@ -1412,25 +1410,6 @@ int Core::CountFilesInFileList(const QFileInfoList &filenames) return file_count; } -QString GetRenderModePreferencePrefix(RenderMode::Mode mode, const QString &preference) { - QString key; - - key.append((mode == RenderMode::kOffline) ? QStringLiteral("Offline") : QStringLiteral("Online")); - key.append(preference); - - return key; -} - -QVariant Core::GetPreferenceForRenderMode(RenderMode::Mode mode, const QString &preference) -{ - return OLIVE_CONFIG_STR(GetRenderModePreferencePrefix(mode, preference)); -} - -void Core::SetPreferenceForRenderMode(RenderMode::Mode mode, const QString &preference, const QVariant &value) -{ - OLIVE_CONFIG_STR(GetRenderModePreferencePrefix(mode, preference)) = value; -} - bool Core::LabelNodes(const QVector &nodes, MultiUndoCommand *parent) { if (nodes.isEmpty()) { diff --git a/app/core.h b/app/core.h index 759cdd522..b12000c14 100644 --- a/app/core.h +++ b/app/core.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -247,9 +247,6 @@ public: */ static int CountFilesInFileList(const QFileInfoList &filenames); - static QVariant GetPreferenceForRenderMode(RenderMode::Mode mode, const QString& preference); - static void SetPreferenceForRenderMode(RenderMode::Mode mode, const QString& preference, const QVariant& value); - /** * @brief Show a dialog to the user to rename a set of nodes */ diff --git a/app/crashhandler/CMakeLists.txt b/app/crashhandler/CMakeLists.txt index e05972a24..0a023275b 100644 --- a/app/crashhandler/CMakeLists.txt +++ b/app/crashhandler/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/crashhandler/crashhandler.cpp b/app/crashhandler/crashhandler.cpp index a56a43c79..e71cbf04a 100644 --- a/app/crashhandler/crashhandler.cpp +++ b/app/crashhandler/crashhandler.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/crashhandler/crashhandler.h b/app/crashhandler/crashhandler.h index ae1200261..d4e37d583 100644 --- a/app/crashhandler/crashhandler.h +++ b/app/crashhandler/crashhandler.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/CMakeLists.txt b/app/dialog/CMakeLists.txt index 1f9df6e3d..f5c628f91 100644 --- a/app/dialog/CMakeLists.txt +++ b/app/dialog/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/about/CMakeLists.txt b/app/dialog/about/CMakeLists.txt index 707a0bbdc..6a764829f 100644 --- a/app/dialog/about/CMakeLists.txt +++ b/app/dialog/about/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/about/about.cpp b/app/dialog/about/about.cpp index 066f8b537..e53b44dda 100644 --- a/app/dialog/about/about.cpp +++ b/app/dialog/about/about.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/about/about.h b/app/dialog/about/about.h index cc6197f15..24e0881f6 100644 --- a/app/dialog/about/about.h +++ b/app/dialog/about/about.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/about/scrollinglabel.cpp b/app/dialog/about/scrollinglabel.cpp index c7fb59b9d..8384e00cb 100644 --- a/app/dialog/about/scrollinglabel.cpp +++ b/app/dialog/about/scrollinglabel.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/about/scrollinglabel.h b/app/dialog/about/scrollinglabel.h index 03394b805..6671b2d6c 100644 --- a/app/dialog/about/scrollinglabel.h +++ b/app/dialog/about/scrollinglabel.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/actionsearch/CMakeLists.txt b/app/dialog/actionsearch/CMakeLists.txt index c16f4288c..c759394d2 100644 --- a/app/dialog/actionsearch/CMakeLists.txt +++ b/app/dialog/actionsearch/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/autorecovery/CMakeLists.txt b/app/dialog/autorecovery/CMakeLists.txt index e9c85bc7d..6408b5822 100644 --- a/app/dialog/autorecovery/CMakeLists.txt +++ b/app/dialog/autorecovery/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/autorecovery/autorecoverydialog.cpp b/app/dialog/autorecovery/autorecoverydialog.cpp index 31948e4e7..1e4354ed1 100644 --- a/app/dialog/autorecovery/autorecoverydialog.cpp +++ b/app/dialog/autorecovery/autorecoverydialog.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/autorecovery/autorecoverydialog.h b/app/dialog/autorecovery/autorecoverydialog.h index 0e4792695..aec025e03 100644 --- a/app/dialog/autorecovery/autorecoverydialog.h +++ b/app/dialog/autorecovery/autorecoverydialog.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/color/CMakeLists.txt b/app/dialog/color/CMakeLists.txt index 8c055b1f6..b0b2c90e4 100644 --- a/app/dialog/color/CMakeLists.txt +++ b/app/dialog/color/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/color/colordialog.cpp b/app/dialog/color/colordialog.cpp index cd36864e9..e15e8d209 100644 --- a/app/dialog/color/colordialog.cpp +++ b/app/dialog/color/colordialog.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/color/colordialog.h b/app/dialog/color/colordialog.h index 064129a2c..837feee95 100644 --- a/app/dialog/color/colordialog.h +++ b/app/dialog/color/colordialog.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/configbase/CMakeLists.txt b/app/dialog/configbase/CMakeLists.txt index 0875e1e21..b0da5d620 100644 --- a/app/dialog/configbase/CMakeLists.txt +++ b/app/dialog/configbase/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/configbase/configdialogbase.cpp b/app/dialog/configbase/configdialogbase.cpp index 9cc9637f8..13bbafbb5 100644 --- a/app/dialog/configbase/configdialogbase.cpp +++ b/app/dialog/configbase/configdialogbase.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -73,11 +73,9 @@ void ConfigDialogBase::accept() tab->Accept(command); } - if (command->child_count() == 0) { - delete command; - } else { - Core::instance()->undo_stack()->push(command); - } + Core::instance()->undo_stack()->pushIfHasChildren(command); + + AcceptEvent(); QDialog::accept(); } diff --git a/app/dialog/configbase/configdialogbase.h b/app/dialog/configbase/configdialogbase.h index eccf7af90..35592175e 100644 --- a/app/dialog/configbase/configdialogbase.h +++ b/app/dialog/configbase/configdialogbase.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,6 +44,8 @@ private slots: protected: void AddTab(ConfigDialogBaseTab* tab, const QString& title); + virtual void AcceptEvent(){} + private: QListWidget* list_widget_; diff --git a/app/dialog/configbase/configdialogbasetab.cpp b/app/dialog/configbase/configdialogbasetab.cpp index 0a0d1bab7..b40254912 100644 --- a/app/dialog/configbase/configdialogbasetab.cpp +++ b/app/dialog/configbase/configdialogbasetab.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/configbase/configdialogbasetab.h b/app/dialog/configbase/configdialogbasetab.h index 4f34c0655..cb31c0c43 100644 --- a/app/dialog/configbase/configdialogbasetab.h +++ b/app/dialog/configbase/configdialogbasetab.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/diskcache/CMakeLists.txt b/app/dialog/diskcache/CMakeLists.txt index 4a5402d6f..3b11da610 100644 --- a/app/dialog/diskcache/CMakeLists.txt +++ b/app/dialog/diskcache/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/diskcache/diskcachedialog.cpp b/app/dialog/diskcache/diskcachedialog.cpp index 75c005468..10adf836b 100644 --- a/app/dialog/diskcache/diskcachedialog.cpp +++ b/app/dialog/diskcache/diskcachedialog.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/diskcache/diskcachedialog.h b/app/dialog/diskcache/diskcachedialog.h index 87317fc77..b8aec8236 100644 --- a/app/dialog/diskcache/diskcachedialog.h +++ b/app/dialog/diskcache/diskcachedialog.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/CMakeLists.txt b/app/dialog/export/CMakeLists.txt index 481feeed5..2a309a6fc 100644 --- a/app/dialog/export/CMakeLists.txt +++ b/app/dialog/export/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/codec/CMakeLists.txt b/app/dialog/export/codec/CMakeLists.txt index 1669edd70..f00ce2690 100644 --- a/app/dialog/export/codec/CMakeLists.txt +++ b/app/dialog/export/codec/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/codec/cineformsection.cpp b/app/dialog/export/codec/cineformsection.cpp index dedecb32e..ba0071e6d 100644 --- a/app/dialog/export/codec/cineformsection.cpp +++ b/app/dialog/export/codec/cineformsection.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/codec/cineformsection.h b/app/dialog/export/codec/cineformsection.h index 6dc09f2d0..edbe8813a 100644 --- a/app/dialog/export/codec/cineformsection.h +++ b/app/dialog/export/codec/cineformsection.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/codec/codecsection.cpp b/app/dialog/export/codec/codecsection.cpp index 5072c40bb..37ce0e1cd 100644 --- a/app/dialog/export/codec/codecsection.cpp +++ b/app/dialog/export/codec/codecsection.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/codec/codecsection.h b/app/dialog/export/codec/codecsection.h index 65c4c10f8..24be8f1f8 100644 --- a/app/dialog/export/codec/codecsection.h +++ b/app/dialog/export/codec/codecsection.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/codec/codecstack.cpp b/app/dialog/export/codec/codecstack.cpp index cdffb12cd..d857536b4 100644 --- a/app/dialog/export/codec/codecstack.cpp +++ b/app/dialog/export/codec/codecstack.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/codec/codecstack.h b/app/dialog/export/codec/codecstack.h index 116f8754c..ebfaf3964 100644 --- a/app/dialog/export/codec/codecstack.h +++ b/app/dialog/export/codec/codecstack.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/codec/h264section.cpp b/app/dialog/export/codec/h264section.cpp index 6b15be526..8c015e0f8 100644 --- a/app/dialog/export/codec/h264section.cpp +++ b/app/dialog/export/codec/h264section.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/codec/h264section.h b/app/dialog/export/codec/h264section.h index 8e095d938..2ca0eaa59 100644 --- a/app/dialog/export/codec/h264section.h +++ b/app/dialog/export/codec/h264section.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/codec/imagesection.cpp b/app/dialog/export/codec/imagesection.cpp index cf38fd698..b2bf50fd8 100644 --- a/app/dialog/export/codec/imagesection.cpp +++ b/app/dialog/export/codec/imagesection.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/codec/imagesection.h b/app/dialog/export/codec/imagesection.h index 6e116b466..b93f733a0 100644 --- a/app/dialog/export/codec/imagesection.h +++ b/app/dialog/export/codec/imagesection.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/export.cpp b/app/dialog/export/export.cpp index 58813f7d5..be37d2f10 100644 --- a/app/dialog/export/export.cpp +++ b/app/dialog/export/export.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/export.h b/app/dialog/export/export.h index d0938a4b1..dae5ee996 100644 --- a/app/dialog/export/export.h +++ b/app/dialog/export/export.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/exportaudiotab.cpp b/app/dialog/export/exportaudiotab.cpp index 860052a7c..45ee90a7a 100644 --- a/app/dialog/export/exportaudiotab.cpp +++ b/app/dialog/export/exportaudiotab.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/exportaudiotab.h b/app/dialog/export/exportaudiotab.h index 9cd8faac2..e7463364a 100644 --- a/app/dialog/export/exportaudiotab.h +++ b/app/dialog/export/exportaudiotab.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/exportformatcombobox.cpp b/app/dialog/export/exportformatcombobox.cpp index c2ca8c453..c185b27a8 100644 --- a/app/dialog/export/exportformatcombobox.cpp +++ b/app/dialog/export/exportformatcombobox.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/exportformatcombobox.h b/app/dialog/export/exportformatcombobox.h index 3dd33e848..2f60867af 100644 --- a/app/dialog/export/exportformatcombobox.h +++ b/app/dialog/export/exportformatcombobox.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/exportsubtitlestab.h b/app/dialog/export/exportsubtitlestab.h index fa81df56e..a88f4d904 100644 --- a/app/dialog/export/exportsubtitlestab.h +++ b/app/dialog/export/exportsubtitlestab.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/exportvideotab.cpp b/app/dialog/export/exportvideotab.cpp index d99cc59b0..1c493eecf 100644 --- a/app/dialog/export/exportvideotab.cpp +++ b/app/dialog/export/exportvideotab.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/export/exportvideotab.h b/app/dialog/export/exportvideotab.h index 4a952fb15..c2be1aebd 100644 --- a/app/dialog/export/exportvideotab.h +++ b/app/dialog/export/exportvideotab.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/footageproperties/footageproperties.cpp b/app/dialog/footageproperties/footageproperties.cpp index 7cb56c63a..d33517766 100644 --- a/app/dialog/footageproperties/footageproperties.cpp +++ b/app/dialog/footageproperties/footageproperties.cpp @@ -93,6 +93,15 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent, Footage *foota description = tr("%1 Hz %2 channels").arg(QString::number(ap.sample_rate()), QString::number(ap.channel_count())); break; } + case Track::kSubtitle: + { + SubtitleParams sp = footage_->GetSubtitleParams(reference.index()); + is_enabled = sp.enabled(); + + // FIXME: Language? + description = tr("Subtitles"); + break; + } default: stacked_widget_->addWidget(new StreamProperties()); description = tr("Unknown"); @@ -106,7 +115,8 @@ FootagePropertiesDialog::FootagePropertiesDialog(QWidget *parent, Footage *foota if (first_usable_stream == -1 && (reference.type() == Track::kVideo - || reference.type() == Track::kAudio)) { + || reference.type() == Track::kAudio + || reference.type() == Track::kSubtitle)) { first_usable_stream = i; } } @@ -163,6 +173,8 @@ void FootagePropertiesDialog::accept() old_stream_enabled = footage_->GetAudioParams(reference.index()).enabled(); break; case Track::kSubtitle: + old_stream_enabled = footage_->GetSubtitleParams(reference.index()).enabled(); + break; case Track::kNone: case Track::kCount: break; @@ -218,6 +230,13 @@ void FootagePropertiesDialog::StreamEnableChangeCommand::redo() break; } case Track::kSubtitle: + { + SubtitleParams sp = footage_->GetSubtitleParams(index_); + old_enabled_ = sp.enabled(); + sp.set_enabled(new_enabled_); + footage_->SetSubtitleParams(sp, index_); + break; + } case Track::kNone: case Track::kCount: break; @@ -242,6 +261,12 @@ void FootagePropertiesDialog::StreamEnableChangeCommand::undo() break; } case Track::kSubtitle: + { + SubtitleParams sp = footage_->GetSubtitleParams(index_); + sp.set_enabled(old_enabled_); + footage_->SetSubtitleParams(sp, index_); + break; + } case Track::kNone: case Track::kCount: break; diff --git a/app/dialog/footagerelink/CMakeLists.txt b/app/dialog/footagerelink/CMakeLists.txt index 9697864b6..797f1c6c6 100644 --- a/app/dialog/footagerelink/CMakeLists.txt +++ b/app/dialog/footagerelink/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/keyframeproperties/CMakeLists.txt b/app/dialog/keyframeproperties/CMakeLists.txt index 990386190..6d479a925 100644 --- a/app/dialog/keyframeproperties/CMakeLists.txt +++ b/app/dialog/keyframeproperties/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/keyframeproperties/keyframeproperties.cpp b/app/dialog/keyframeproperties/keyframeproperties.cpp index 65fbcd791..37edfe771 100644 --- a/app/dialog/keyframeproperties/keyframeproperties.cpp +++ b/app/dialog/keyframeproperties/keyframeproperties.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/keyframeproperties/keyframeproperties.h b/app/dialog/keyframeproperties/keyframeproperties.h index 418c09321..39a76147c 100644 --- a/app/dialog/keyframeproperties/keyframeproperties.h +++ b/app/dialog/keyframeproperties/keyframeproperties.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/markerproperties/CMakeLists.txt b/app/dialog/markerproperties/CMakeLists.txt index 222c9246e..84a130885 100644 --- a/app/dialog/markerproperties/CMakeLists.txt +++ b/app/dialog/markerproperties/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/markerproperties/markerpropertiesdialog.cpp b/app/dialog/markerproperties/markerpropertiesdialog.cpp index 7e81c2887..18fca8cfa 100644 --- a/app/dialog/markerproperties/markerpropertiesdialog.cpp +++ b/app/dialog/markerproperties/markerpropertiesdialog.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,10 +60,10 @@ MarkerPropertiesDialog::MarkerPropertiesDialog(const std::vectorSetValue(markers.front()->time_range().in()); + in_slider_->SetValue(markers.front()->time().in()); in_slider_->SetDisplayType(RationalSlider::kTime); in_slider_->SetTimebase(timebase); - out_slider_->SetValue(markers.front()->time_range().out()); + out_slider_->SetValue(markers.front()->time().out()); out_slider_->SetDisplayType(RationalSlider::kTime); out_slider_->SetTimebase(timebase); } else { diff --git a/app/dialog/markerproperties/markerpropertiesdialog.h b/app/dialog/markerproperties/markerpropertiesdialog.h index a358dc9a7..b6cff4a56 100644 --- a/app/dialog/markerproperties/markerpropertiesdialog.h +++ b/app/dialog/markerproperties/markerpropertiesdialog.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/CMakeLists.txt b/app/dialog/preferences/CMakeLists.txt index 4088607be..1636674e4 100644 --- a/app/dialog/preferences/CMakeLists.txt +++ b/app/dialog/preferences/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/keysequenceeditor.cpp b/app/dialog/preferences/keysequenceeditor.cpp index 37ab138bb..bd1c41c3f 100644 --- a/app/dialog/preferences/keysequenceeditor.cpp +++ b/app/dialog/preferences/keysequenceeditor.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/keysequenceeditor.h b/app/dialog/preferences/keysequenceeditor.h index ea5a2b335..6047bf268 100644 --- a/app/dialog/preferences/keysequenceeditor.h +++ b/app/dialog/preferences/keysequenceeditor.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/preferences.cpp b/app/dialog/preferences/preferences.cpp index 3eee5336d..5777e929d 100644 --- a/app/dialog/preferences/preferences.cpp +++ b/app/dialog/preferences/preferences.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,11 +32,12 @@ #include "tabs/preferencesdisktab.h" #include "tabs/preferencesaudiotab.h" #include "tabs/preferenceskeyboardtab.h" +#include "window/mainwindow/mainwindow.h" namespace olive { -PreferencesDialog::PreferencesDialog(QWidget *parent, QMenuBar* main_menu_bar) : - ConfigDialogBase(parent) +PreferencesDialog::PreferencesDialog(MainWindow *main_window) : + ConfigDialogBase(main_window) { setWindowTitle(tr("Preferences")); @@ -45,7 +46,12 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, QMenuBar* main_menu_bar) : AddTab(new PreferencesBehaviorTab(), tr("Behavior")); AddTab(new PreferencesDiskTab(), tr("Disk")); AddTab(new PreferencesAudioTab(), tr("Audio")); - AddTab(new PreferencesKeyboardTab(main_menu_bar), tr("Keyboard")); + AddTab(new PreferencesKeyboardTab(main_window), tr("Keyboard")); +} + +void PreferencesDialog::AcceptEvent() +{ + Config::Save(); } } diff --git a/app/dialog/preferences/preferences.h b/app/dialog/preferences/preferences.h index cdf164cd2..87cdb7266 100644 --- a/app/dialog/preferences/preferences.h +++ b/app/dialog/preferences/preferences.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,25 +32,22 @@ namespace olive { +class MainWindow; + /** * @brief The PreferencesDialog class * - * A dialog for the global application settings. Mostly an interface for Config. Can be loaded from any part of the - * application. + * A dialog for the global application settings. Mostly an interface for Config. */ class PreferencesDialog : public ConfigDialogBase { Q_OBJECT public: - /** - * @brief PreferencesDialog Constructor - * - * @param parent - * - * QWidget parent. Usually MainWindow. - */ - PreferencesDialog(QWidget *parent, QMenuBar* main_menu_bar); + PreferencesDialog(MainWindow *main_window); + +protected: + virtual void AcceptEvent() override; }; diff --git a/app/dialog/preferences/tabs/CMakeLists.txt b/app/dialog/preferences/tabs/CMakeLists.txt index 2ccb6938b..c26e22fa1 100644 --- a/app/dialog/preferences/tabs/CMakeLists.txt +++ b/app/dialog/preferences/tabs/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/tabs/preferencesappearancetab.cpp b/app/dialog/preferences/tabs/preferencesappearancetab.cpp index 63c5da053..7751a581a 100644 --- a/app/dialog/preferences/tabs/preferencesappearancetab.cpp +++ b/app/dialog/preferences/tabs/preferencesappearancetab.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/tabs/preferencesappearancetab.h b/app/dialog/preferences/tabs/preferencesappearancetab.h index 286c79e03..63c2c2021 100644 --- a/app/dialog/preferences/tabs/preferencesappearancetab.h +++ b/app/dialog/preferences/tabs/preferencesappearancetab.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/tabs/preferencesaudiotab.cpp b/app/dialog/preferences/tabs/preferencesaudiotab.cpp index 7d2edc892..6f73dbedc 100644 --- a/app/dialog/preferences/tabs/preferencesaudiotab.cpp +++ b/app/dialog/preferences/tabs/preferencesaudiotab.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/tabs/preferencesaudiotab.h b/app/dialog/preferences/tabs/preferencesaudiotab.h index 550b6fa9e..05ca231e8 100644 --- a/app/dialog/preferences/tabs/preferencesaudiotab.h +++ b/app/dialog/preferences/tabs/preferencesaudiotab.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/tabs/preferencesbehaviortab.cpp b/app/dialog/preferences/tabs/preferencesbehaviortab.cpp index d16c7dce5..a081260fe 100644 --- a/app/dialog/preferences/tabs/preferencesbehaviortab.cpp +++ b/app/dialog/preferences/tabs/preferencesbehaviortab.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/tabs/preferencesbehaviortab.h b/app/dialog/preferences/tabs/preferencesbehaviortab.h index 0367475ea..a1a9558ce 100644 --- a/app/dialog/preferences/tabs/preferencesbehaviortab.h +++ b/app/dialog/preferences/tabs/preferencesbehaviortab.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/tabs/preferencesdisktab.cpp b/app/dialog/preferences/tabs/preferencesdisktab.cpp index 3d3ee3fa1..8aea10aab 100644 --- a/app/dialog/preferences/tabs/preferencesdisktab.cpp +++ b/app/dialog/preferences/tabs/preferencesdisktab.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/tabs/preferencesdisktab.h b/app/dialog/preferences/tabs/preferencesdisktab.h index abd68dfc0..9d17420e7 100644 --- a/app/dialog/preferences/tabs/preferencesdisktab.h +++ b/app/dialog/preferences/tabs/preferencesdisktab.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/tabs/preferencesgeneraltab.cpp b/app/dialog/preferences/tabs/preferencesgeneraltab.cpp index 2e6425731..765e91dfe 100644 --- a/app/dialog/preferences/tabs/preferencesgeneraltab.cpp +++ b/app/dialog/preferences/tabs/preferencesgeneraltab.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/tabs/preferencesgeneraltab.h b/app/dialog/preferences/tabs/preferencesgeneraltab.h index 4bb90e0ec..b0d7988a1 100644 --- a/app/dialog/preferences/tabs/preferencesgeneraltab.h +++ b/app/dialog/preferences/tabs/preferencesgeneraltab.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/preferences/tabs/preferenceskeyboardtab.cpp b/app/dialog/preferences/tabs/preferenceskeyboardtab.cpp index a7e906372..37eab5abc 100644 --- a/app/dialog/preferences/tabs/preferenceskeyboardtab.cpp +++ b/app/dialog/preferences/tabs/preferenceskeyboardtab.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,9 +27,12 @@ #include #include +#include "window/mainwindow/mainwindow.h" + namespace olive { -PreferencesKeyboardTab::PreferencesKeyboardTab(QMenuBar *menubar) +PreferencesKeyboardTab::PreferencesKeyboardTab(MainWindow *main_window) : + main_window_(main_window) { QVBoxLayout* shortcut_layout = new QVBoxLayout(this); @@ -67,7 +70,7 @@ PreferencesKeyboardTab::PreferencesKeyboardTab(QMenuBar *menubar) shortcut_layout->addLayout(reset_shortcut_layout); - setup_kbd_shortcuts(menubar); + setup_kbd_shortcuts(main_window_->menuBar()); } void PreferencesKeyboardTab::Accept(MultiUndoCommand *command) @@ -78,6 +81,8 @@ void PreferencesKeyboardTab::Accept(MultiUndoCommand *command) for (int i=0;iset_action_shortcut(); } + + main_window_->SaveLayout(); } void PreferencesKeyboardTab::setup_kbd_shortcuts(QMenuBar* menubar) { diff --git a/app/dialog/preferences/tabs/preferenceskeyboardtab.h b/app/dialog/preferences/tabs/preferenceskeyboardtab.h index 6e8f22077..f66e61f57 100644 --- a/app/dialog/preferences/tabs/preferenceskeyboardtab.h +++ b/app/dialog/preferences/tabs/preferenceskeyboardtab.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,11 +29,13 @@ namespace olive { +class MainWindow; + class PreferencesKeyboardTab : public ConfigDialogBaseTab { Q_OBJECT public: - PreferencesKeyboardTab(QMenuBar* menubar); + PreferencesKeyboardTab(MainWindow* main_window); virtual void Accept(MultiUndoCommand* command) override; @@ -132,6 +134,9 @@ private: * key_shortcut_actions and key_shortcut_fields) */ QVector key_shortcut_fields_; + + MainWindow *main_window_; + }; } diff --git a/app/dialog/progress/CMakeLists.txt b/app/dialog/progress/CMakeLists.txt index c8fe86b27..1319f1e56 100644 --- a/app/dialog/progress/CMakeLists.txt +++ b/app/dialog/progress/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/progress/progress.cpp b/app/dialog/progress/progress.cpp index 32f47e6e5..c63372f94 100644 --- a/app/dialog/progress/progress.cpp +++ b/app/dialog/progress/progress.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/progress/progress.h b/app/dialog/progress/progress.h index 123417762..4352c5868 100644 --- a/app/dialog/progress/progress.h +++ b/app/dialog/progress/progress.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/rendercancel/CMakeLists.txt b/app/dialog/rendercancel/CMakeLists.txt index 244d0ad8d..16ee46ba0 100644 --- a/app/dialog/rendercancel/CMakeLists.txt +++ b/app/dialog/rendercancel/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/rendercancel/rendercancel.cpp b/app/dialog/rendercancel/rendercancel.cpp index cb172913f..95d627834 100644 --- a/app/dialog/rendercancel/rendercancel.cpp +++ b/app/dialog/rendercancel/rendercancel.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/rendercancel/rendercancel.h b/app/dialog/rendercancel/rendercancel.h index c07cf5c27..a3f12b3f4 100644 --- a/app/dialog/rendercancel/rendercancel.h +++ b/app/dialog/rendercancel/rendercancel.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/sequence/CMakeLists.txt b/app/dialog/sequence/CMakeLists.txt index f2128cfe5..1d3b4fccf 100644 --- a/app/dialog/sequence/CMakeLists.txt +++ b/app/dialog/sequence/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/sequence/presetmanager.h b/app/dialog/sequence/presetmanager.h index 3ed913026..a61c323ea 100644 --- a/app/dialog/sequence/presetmanager.h +++ b/app/dialog/sequence/presetmanager.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/sequence/sequence.cpp b/app/dialog/sequence/sequence.cpp index 4305e1894..954cb9502 100644 --- a/app/dialog/sequence/sequence.cpp +++ b/app/dialog/sequence/sequence.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/sequence/sequence.h b/app/dialog/sequence/sequence.h index b12d1fcb3..cb3862127 100644 --- a/app/dialog/sequence/sequence.h +++ b/app/dialog/sequence/sequence.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/sequence/sequencedialogpresettab.cpp b/app/dialog/sequence/sequencedialogpresettab.cpp index 74c5a0595..b8a94fbe7 100644 --- a/app/dialog/sequence/sequencedialogpresettab.cpp +++ b/app/dialog/sequence/sequencedialogpresettab.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/sequence/sequencedialogpresettab.h b/app/dialog/sequence/sequencedialogpresettab.h index bd2e334a3..3a860e542 100644 --- a/app/dialog/sequence/sequencedialogpresettab.h +++ b/app/dialog/sequence/sequencedialogpresettab.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/sequence/sequencepreset.h b/app/dialog/sequence/sequencepreset.h index 0d2a12fa2..e8657812f 100644 --- a/app/dialog/sequence/sequencepreset.h +++ b/app/dialog/sequence/sequencepreset.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/speedduration/CMakeLists.txt b/app/dialog/speedduration/CMakeLists.txt index 42471bd32..51cc60a60 100644 --- a/app/dialog/speedduration/CMakeLists.txt +++ b/app/dialog/speedduration/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/speedduration/speeddurationdialog.cpp b/app/dialog/speedduration/speeddurationdialog.cpp index e742487a2..580da35d8 100644 --- a/app/dialog/speedduration/speeddurationdialog.cpp +++ b/app/dialog/speedduration/speeddurationdialog.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -145,17 +145,11 @@ SpeedDurationDialog::SpeedDurationDialog(const QVector &clips, cons void SpeedDurationDialog::accept() { - // We haven't implemented rippling yet, so warn the user - if (ripple_box_->isChecked()) { - // FIXME: Stub - if (QMessageBox::information(this, QString(), tr("Rippling is a stub and will not do anything. Do you wish to continue?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No) { - return; - } - } - MultiUndoCommand *command = new MultiUndoCommand(); // Set duration values + TimelineRippleDeleteGapsAtRegionsCommand::RangeList ripple_ranges; + foreach (ClipBlock *c, clips_) { rational proposed_length = c->length(); @@ -179,10 +173,15 @@ void SpeedDurationDialog::accept() if (proposed_length != c->length()) { command->add_child(new BlockTrimCommand(c->track(), c, proposed_length, Timeline::kTrimOut)); + ripple_ranges.append({c->track(), TimeRange(c->in() + proposed_length, c->out())}); } } } + if (ripple_box_->isChecked()) { + command->add_child(new TimelineRippleDeleteGapsAtRegionsCommand(clips_.first()->track()->sequence(), ripple_ranges)); + } + // Set speed values if (speed_slider_->IsTristate()) { if (link_box_->isChecked() && !dur_slider_->IsTristate()) { diff --git a/app/dialog/speedduration/speeddurationdialog.h b/app/dialog/speedduration/speeddurationdialog.h index be24ec9d6..82d95d12e 100644 --- a/app/dialog/speedduration/speeddurationdialog.h +++ b/app/dialog/speedduration/speeddurationdialog.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/task/CMakeLists.txt b/app/dialog/task/CMakeLists.txt index 276cdc588..57d46bea0 100644 --- a/app/dialog/task/CMakeLists.txt +++ b/app/dialog/task/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/task/task.cpp b/app/dialog/task/task.cpp index 8b16bd944..41cfc55a4 100644 --- a/app/dialog/task/task.cpp +++ b/app/dialog/task/task.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/task/task.h b/app/dialog/task/task.h index 8abb4a060..f4aef1afa 100644 --- a/app/dialog/task/task.h +++ b/app/dialog/task/task.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/text/CMakeLists.txt b/app/dialog/text/CMakeLists.txt index 6a96dce13..8fac97e1d 100644 --- a/app/dialog/text/CMakeLists.txt +++ b/app/dialog/text/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/dialog/text/text.cpp b/app/dialog/text/text.cpp index 264d6624b..f764bdee6 100644 --- a/app/dialog/text/text.cpp +++ b/app/dialog/text/text.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/dialog/text/text.h b/app/dialog/text/text.h index 5916b0101..e6542ceb4 100644 --- a/app/dialog/text/text.h +++ b/app/dialog/text/text.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/main.cpp b/app/main.cpp index 34ce118e4..0a42783f8 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/CMakeLists.txt b/app/node/CMakeLists.txt index ed354586d..c21485b88 100644 --- a/app/node/CMakeLists.txt +++ b/app/node/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/audio/CMakeLists.txt b/app/node/audio/CMakeLists.txt index 9ac21ad56..541fc3b20 100644 --- a/app/node/audio/CMakeLists.txt +++ b/app/node/audio/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/audio/pan/CMakeLists.txt b/app/node/audio/pan/CMakeLists.txt index 80d7c7ed7..b249404cd 100644 --- a/app/node/audio/pan/CMakeLists.txt +++ b/app/node/audio/pan/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/audio/pan/pan.cpp b/app/node/audio/pan/pan.cpp index 5951ef921..220ba9585 100644 --- a/app/node/audio/pan/pan.cpp +++ b/app/node/audio/pan/pan.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/audio/pan/pan.h b/app/node/audio/pan/pan.h index 8d915a6fa..bc1be92f9 100644 --- a/app/node/audio/pan/pan.h +++ b/app/node/audio/pan/pan.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/audio/volume/CMakeLists.txt b/app/node/audio/volume/CMakeLists.txt index 4c4f78e26..61e241f44 100644 --- a/app/node/audio/volume/CMakeLists.txt +++ b/app/node/audio/volume/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/audio/volume/volume.cpp b/app/node/audio/volume/volume.cpp index a12a939e1..81a2306a7 100644 --- a/app/node/audio/volume/volume.cpp +++ b/app/node/audio/volume/volume.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -81,6 +81,7 @@ void VolumeNode::Value(const NodeValueRow &value, const NodeGlobals &globals, No } else { // Requires job SampleJob job(kSamplesInput, value); + job.Insert(kVolumeInput, value); table->Push(NodeValue::kSamples, QVariant::fromValue(job), this); } } diff --git a/app/node/audio/volume/volume.h b/app/node/audio/volume/volume.h index 73f0c43df..ba2259821 100644 --- a/app/node/audio/volume/volume.h +++ b/app/node/audio/volume/volume.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/CMakeLists.txt b/app/node/block/CMakeLists.txt index eb19f639d..b93497d47 100644 --- a/app/node/block/CMakeLists.txt +++ b/app/node/block/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/block/block.cpp b/app/node/block/block.cpp index 96176e31c..f007eee42 100644 --- a/app/node/block/block.cpp +++ b/app/node/block/block.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/block.h b/app/node/block/block.h index b788d419a..3a65159e2 100644 --- a/app/node/block/block.h +++ b/app/node/block/block.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/clip/CMakeLists.txt b/app/node/block/clip/CMakeLists.txt index b6b985454..4a3a19828 100644 --- a/app/node/block/clip/CMakeLists.txt +++ b/app/node/block/clip/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/block/clip/clip.cpp b/app/node/block/clip/clip.cpp index bf993186d..241484965 100644 --- a/app/node/block/clip/clip.cpp +++ b/app/node/block/clip/clip.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/clip/clip.h b/app/node/block/clip/clip.h index 7861b0587..fce20dbbd 100644 --- a/app/node/block/clip/clip.h +++ b/app/node/block/clip/clip.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/gap/CMakeLists.txt b/app/node/block/gap/CMakeLists.txt index eeaccc558..a29906a51 100644 --- a/app/node/block/gap/CMakeLists.txt +++ b/app/node/block/gap/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/block/gap/gap.cpp b/app/node/block/gap/gap.cpp index 60a066153..23f5c68cf 100644 --- a/app/node/block/gap/gap.cpp +++ b/app/node/block/gap/gap.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/gap/gap.h b/app/node/block/gap/gap.h index 5dfc01eb1..88585e0a2 100644 --- a/app/node/block/gap/gap.h +++ b/app/node/block/gap/gap.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/subtitle/CMakeLists.txt b/app/node/block/subtitle/CMakeLists.txt index 81a745ab4..29001e672 100644 --- a/app/node/block/subtitle/CMakeLists.txt +++ b/app/node/block/subtitle/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/block/subtitle/subtitle.cpp b/app/node/block/subtitle/subtitle.cpp index 6231fc7d2..25bccb6f4 100644 --- a/app/node/block/subtitle/subtitle.cpp +++ b/app/node/block/subtitle/subtitle.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,7 +43,11 @@ SubtitleBlock::SubtitleBlock() QString SubtitleBlock::Name() const { - return tr("Subtitle"); + if (GetText().isEmpty()) { + return tr("Subtitle"); + } else { + return GetText(); + } } QString SubtitleBlock::id() const diff --git a/app/node/block/subtitle/subtitle.h b/app/node/block/subtitle/subtitle.h index ed51c37d3..efc4d94a1 100644 --- a/app/node/block/subtitle/subtitle.h +++ b/app/node/block/subtitle/subtitle.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/transition/CMakeLists.txt b/app/node/block/transition/CMakeLists.txt index dc753d98b..bb1f316a4 100644 --- a/app/node/block/transition/CMakeLists.txt +++ b/app/node/block/transition/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/block/transition/crossdissolve/CMakeLists.txt b/app/node/block/transition/crossdissolve/CMakeLists.txt index d484b2787..2d8b8fc11 100644 --- a/app/node/block/transition/crossdissolve/CMakeLists.txt +++ b/app/node/block/transition/crossdissolve/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/block/transition/crossdissolve/crossdissolvetransition.cpp b/app/node/block/transition/crossdissolve/crossdissolvetransition.cpp index bba754160..3fd55b653 100644 --- a/app/node/block/transition/crossdissolve/crossdissolvetransition.cpp +++ b/app/node/block/transition/crossdissolve/crossdissolvetransition.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/transition/crossdissolve/crossdissolvetransition.h b/app/node/block/transition/crossdissolve/crossdissolvetransition.h index 6cd7c8960..d74897e9e 100644 --- a/app/node/block/transition/crossdissolve/crossdissolvetransition.h +++ b/app/node/block/transition/crossdissolve/crossdissolvetransition.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/transition/diptocolor/CMakeLists.txt b/app/node/block/transition/diptocolor/CMakeLists.txt index 44429ee54..47be688c3 100644 --- a/app/node/block/transition/diptocolor/CMakeLists.txt +++ b/app/node/block/transition/diptocolor/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/block/transition/diptocolor/diptocolortransition.cpp b/app/node/block/transition/diptocolor/diptocolortransition.cpp index 8700c3628..f9945dad0 100644 --- a/app/node/block/transition/diptocolor/diptocolortransition.cpp +++ b/app/node/block/transition/diptocolor/diptocolortransition.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/transition/diptocolor/diptocolortransition.h b/app/node/block/transition/diptocolor/diptocolortransition.h index b32918555..c1f3dca0f 100644 --- a/app/node/block/transition/diptocolor/diptocolortransition.h +++ b/app/node/block/transition/diptocolor/diptocolortransition.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/transition/transition.cpp b/app/node/block/transition/transition.cpp index 6b5083698..f8b86d67d 100644 --- a/app/node/block/transition/transition.cpp +++ b/app/node/block/transition/transition.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/block/transition/transition.h b/app/node/block/transition/transition.h index cd3926628..0babf1516 100644 --- a/app/node/block/transition/transition.h +++ b/app/node/block/transition/transition.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/color/CMakeLists.txt b/app/node/color/CMakeLists.txt index 046c499da..96bd0db4f 100644 --- a/app/node/color/CMakeLists.txt +++ b/app/node/color/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/color/colormanager/CMakeLists.txt b/app/node/color/colormanager/CMakeLists.txt index ea7d83966..d964226d2 100644 --- a/app/node/color/colormanager/CMakeLists.txt +++ b/app/node/color/colormanager/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/color/colormanager/colormanager.cpp b/app/node/color/colormanager/colormanager.cpp index 6164592b6..a8a446208 100644 --- a/app/node/color/colormanager/colormanager.cpp +++ b/app/node/color/colormanager/colormanager.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/color/colormanager/colormanager.h b/app/node/color/colormanager/colormanager.h index a26d3b424..237c7f3f6 100644 --- a/app/node/color/colormanager/colormanager.h +++ b/app/node/color/colormanager/colormanager.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/color/displaytransform/CMakeLists.txt b/app/node/color/displaytransform/CMakeLists.txt index 4bede1600..bec0ddfbe 100644 --- a/app/node/color/displaytransform/CMakeLists.txt +++ b/app/node/color/displaytransform/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/color/displaytransform/displaytransform.cpp b/app/node/color/displaytransform/displaytransform.cpp index 5152d6614..6bf2116c3 100644 --- a/app/node/color/displaytransform/displaytransform.cpp +++ b/app/node/color/displaytransform/displaytransform.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/color/displaytransform/displaytransform.h b/app/node/color/displaytransform/displaytransform.h index ac6be6bef..a9a78a607 100644 --- a/app/node/color/displaytransform/displaytransform.h +++ b/app/node/color/displaytransform/displaytransform.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/color/ociobase/CMakeLists.txt b/app/node/color/ociobase/CMakeLists.txt index fa00411a4..86a82c6cd 100644 --- a/app/node/color/ociobase/CMakeLists.txt +++ b/app/node/color/ociobase/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/color/ociobase/ociobase.cpp b/app/node/color/ociobase/ociobase.cpp index 7ce711050..831c2f8be 100644 --- a/app/node/color/ociobase/ociobase.cpp +++ b/app/node/color/ociobase/ociobase.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,18 +35,14 @@ OCIOBaseNode::OCIOBaseNode() : SetEffectInput(kTextureInput); - connect(this, &Node::AddedToGraph, this, &OCIOBaseNode::ParentChanged); + connect(this, &Node::AddedToGraph, this, &OCIOBaseNode::AddedToGraph); + connect(this, &Node::RemovedFromGraph, this, &OCIOBaseNode::RemovedFromGraph); SetFlags(kVideoEffect); } -void OCIOBaseNode::ParentChanged(NodeGraph *graph) +void OCIOBaseNode::AddedToGraph(NodeGraph *graph) { - if (manager_) { - disconnect(manager_, &ColorManager::ConfigChanged, this, &OCIOBaseNode::ConfigChanged); - manager_ = nullptr; - } - if (Project *p = dynamic_cast(graph)) { manager_ = p->color_manager(); connect(manager_, &ColorManager::ConfigChanged, this, &OCIOBaseNode::ConfigChanged); @@ -54,6 +50,14 @@ void OCIOBaseNode::ParentChanged(NodeGraph *graph) } } +void OCIOBaseNode::RemovedFromGraph() +{ + if (manager_) { + disconnect(manager_, &ColorManager::ConfigChanged, this, &OCIOBaseNode::ConfigChanged); + manager_ = nullptr; + } +} + void OCIOBaseNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const { if (value[kTextureInput].toTexture() && processor_) { diff --git a/app/node/color/ociobase/ociobase.h b/app/node/color/ociobase/ociobase.h index a0b6fc0f2..2336c2214 100644 --- a/app/node/color/ociobase/ociobase.h +++ b/app/node/color/ociobase/ociobase.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -51,7 +51,9 @@ private: ColorProcessorPtr processor_; private slots: - void ParentChanged(olive::NodeGraph *graph); + void AddedToGraph(NodeGraph *graph); + + void RemovedFromGraph(); }; diff --git a/app/node/color/ociogradingtransformlinear/CMakeLists.txt b/app/node/color/ociogradingtransformlinear/CMakeLists.txt index 05a3d4ae9..891489c63 100644 --- a/app/node/color/ociogradingtransformlinear/CMakeLists.txt +++ b/app/node/color/ociogradingtransformlinear/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/color/ociogradingtransformlinear/ociogradingtransformlinear.cpp b/app/node/color/ociogradingtransformlinear/ociogradingtransformlinear.cpp index 5aa6ee8dc..2ef925652 100644 --- a/app/node/color/ociogradingtransformlinear/ociogradingtransformlinear.cpp +++ b/app/node/color/ociogradingtransformlinear/ociogradingtransformlinear.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/color/ociogradingtransformlinear/ociogradingtransformlinear.h b/app/node/color/ociogradingtransformlinear/ociogradingtransformlinear.h index 8e5d59cca..72a769208 100644 --- a/app/node/color/ociogradingtransformlinear/ociogradingtransformlinear.h +++ b/app/node/color/ociogradingtransformlinear/ociogradingtransformlinear.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/CMakeLists.txt b/app/node/distort/CMakeLists.txt index de3480361..03ede0b9a 100644 --- a/app/node/distort/CMakeLists.txt +++ b/app/node/distort/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/cornerpin/CMakeLists.txt b/app/node/distort/cornerpin/CMakeLists.txt index e89b0f94f..7dd1b44e0 100644 --- a/app/node/distort/cornerpin/CMakeLists.txt +++ b/app/node/distort/cornerpin/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/cornerpin/cornerpindistortnode.cpp b/app/node/distort/cornerpin/cornerpindistortnode.cpp index 62015df1a..1053c3ef3 100644 --- a/app/node/distort/cornerpin/cornerpindistortnode.cpp +++ b/app/node/distort/cornerpin/cornerpindistortnode.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/cornerpin/cornerpindistortnode.h b/app/node/distort/cornerpin/cornerpindistortnode.h index 41a82ca88..39dda53d8 100644 --- a/app/node/distort/cornerpin/cornerpindistortnode.h +++ b/app/node/distort/cornerpin/cornerpindistortnode.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/crop/CMakeLists.txt b/app/node/distort/crop/CMakeLists.txt index cce9aea5f..b882ad539 100644 --- a/app/node/distort/crop/CMakeLists.txt +++ b/app/node/distort/crop/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/crop/cropdistortnode.cpp b/app/node/distort/crop/cropdistortnode.cpp index 62532f839..5b52df6b1 100644 --- a/app/node/distort/crop/cropdistortnode.cpp +++ b/app/node/distort/crop/cropdistortnode.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -79,10 +79,12 @@ void CropDistortNode::Value(const NodeValueRow &value, const NodeGlobals &global { ShaderJob job; job.Insert(value); - job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this)); job.SetAlphaChannelRequired(GenerateJob::kAlphaForceOn); + job.SetWillChangeImageSize(false); + + if (TexturePtr texture = job.Get(kTextureInput).toTexture()) { + job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, QVector2D(texture->params().width(), texture->params().height()), this)); - if (job.Get(kTextureInput).toTexture()) { if (!qIsNull(job.Get(kLeftInput).toDouble()) || !qIsNull(job.Get(kRightInput).toDouble()) || !qIsNull(job.Get(kTopInput).toDouble()) diff --git a/app/node/distort/crop/cropdistortnode.h b/app/node/distort/crop/cropdistortnode.h index 697f5540a..1d6530152 100644 --- a/app/node/distort/crop/cropdistortnode.h +++ b/app/node/distort/crop/cropdistortnode.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/flip/CMakeLists.txt b/app/node/distort/flip/CMakeLists.txt index 9e9a2c02b..414f46fec 100644 --- a/app/node/distort/flip/CMakeLists.txt +++ b/app/node/distort/flip/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/flip/flipdistortnode.cpp b/app/node/distort/flip/flipdistortnode.cpp index 050bbcc84..af14263a1 100644 --- a/app/node/distort/flip/flipdistortnode.cpp +++ b/app/node/distort/flip/flipdistortnode.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/flip/flipdistortnode.h b/app/node/distort/flip/flipdistortnode.h index 2d607ffd3..1c9dcf727 100644 --- a/app/node/distort/flip/flipdistortnode.h +++ b/app/node/distort/flip/flipdistortnode.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/mask/CMakeLists.txt b/app/node/distort/mask/CMakeLists.txt index 67ff95dee..ac4b0d89e 100644 --- a/app/node/distort/mask/CMakeLists.txt +++ b/app/node/distort/mask/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/mask/mask.cpp b/app/node/distort/mask/mask.cpp index b891a262d..d92fbeb56 100644 --- a/app/node/distort/mask/mask.cpp +++ b/app/node/distort/mask/mask.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/mask/mask.h b/app/node/distort/mask/mask.h index c782cb15a..5565d3b65 100644 --- a/app/node/distort/mask/mask.h +++ b/app/node/distort/mask/mask.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/transform/CMakeLists.txt b/app/node/distort/transform/CMakeLists.txt index 2cc9c9393..63a97c6c2 100644 --- a/app/node/distort/transform/CMakeLists.txt +++ b/app/node/distort/transform/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/distort/transform/transformdistortnode.cpp b/app/node/distort/transform/transformdistortnode.cpp index ee7e45580..3ae32881d 100644 --- a/app/node/distort/transform/transformdistortnode.cpp +++ b/app/node/distort/transform/transformdistortnode.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -84,7 +84,7 @@ void TransformDistortNode::Retranslate() void TransformDistortNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const { // Generate matrix - QMatrix4x4 generated_matrix = GenerateMatrix(value, true, false, false, false); + QMatrix4x4 generated_matrix = GenerateMatrix(value, false, false, false); // Pop texture NodeValue texture_meta = value[kTextureInput]; @@ -133,7 +133,7 @@ void TransformDistortNode::GizmoDragStart(const NodeValueRow &row, double x, dou if (gizmo == anchor_gizmo_) { - gizmo_inverted_transform_ = GenerateMatrix(row, false, true, true, false).toTransform().inverted(); + gizmo_inverted_transform_ = GenerateMatrix(row, true, true, false).toTransform().inverted(); } else if (IsAScaleGizmo(gizmo)) { @@ -175,7 +175,7 @@ void TransformDistortNode::GizmoDragStart(const NodeValueRow &row, double x, dou } // Store current matrix - gizmo_inverted_transform_ = GenerateMatrix(row, false, true, true, true).toTransform().inverted(); + gizmo_inverted_transform_ = GenerateMatrix(row, true, true, true).toTransform().inverted(); } else if (gizmo == rotation_gizmo_) { @@ -360,7 +360,7 @@ void TransformDistortNode::UpdateGizmoPositions(const NodeValueRow &row, const N // Fold values into a matrix for the rectangle QMatrix4x4 rectangle_matrix; rectangle_matrix.scale(sequence_half_res); - rectangle_matrix *= AdjustMatrixByResolutions(GenerateMatrix(row, false, false, false, false), + rectangle_matrix *= AdjustMatrixByResolutions(GenerateMatrix(row, false, false, false), sequence_res, tex_sz, tex_offset, @@ -380,7 +380,7 @@ void TransformDistortNode::UpdateGizmoPositions(const NodeValueRow &row, const N // Draw anchor point QMatrix4x4 anchor_matrix; anchor_matrix.scale(sequence_half_res); - anchor_matrix *= AdjustMatrixByResolutions(GenerateMatrix(row, false, true, false, false), + anchor_matrix *= AdjustMatrixByResolutions(GenerateMatrix(row, true, false, false), sequence_res, tex_sz, tex_offset, @@ -403,6 +403,15 @@ void TransformDistortNode::UpdateGizmoPositions(const NodeValueRow &row, const N SetInputProperty(kAnchorInput, QStringLiteral("offset"), tex_sz * 0.5); } +QTransform TransformDistortNode::GizmoTransformation(const NodeValueRow &row, const NodeGlobals &globals) const +{ + if (TexturePtr texture = row[kTextureInput].toTexture()) { + auto m = GenerateMatrix(row, false, false, false); + return GenerateAutoScaledMatrix(m, row, globals, texture->params()).toTransform(); + } + return super::GizmoTransformation(row, globals); +} + QPointF TransformDistortNode::CreateScalePoint(double x, double y, const QPointF &half_res, const QMatrix4x4 &mat) { return mat.map(QPointF(x, y)) + half_res; diff --git a/app/node/distort/transform/transformdistortnode.h b/app/node/distort/transform/transformdistortnode.h index 18849e1fd..b6ae714b9 100644 --- a/app/node/distort/transform/transformdistortnode.h +++ b/app/node/distort/transform/transformdistortnode.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,6 +41,12 @@ public: return tr("Transform"); } + virtual QString ShortName() const override + { + // Override MatrixGenerator's short name "Ortho" + return Name(); + } + virtual QString id() const override { return QStringLiteral("org.olivevideoeditor.Olive.transform"); @@ -76,6 +82,7 @@ public: AutoScaleType autoscale_type = kAutoScaleNone); virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override; + virtual QTransform GizmoTransformation(const NodeValueRow &row, const NodeGlobals &globals) const override; static const QString kTextureInput; static const QString kAutoscaleInput; diff --git a/app/node/effect/CMakeLists.txt b/app/node/effect/CMakeLists.txt index e5bdb09ae..690dd76a5 100644 --- a/app/node/effect/CMakeLists.txt +++ b/app/node/effect/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/effect/opacity/CMakeLists.txt b/app/node/effect/opacity/CMakeLists.txt index 677fe38e0..4aac69730 100644 --- a/app/node/effect/opacity/CMakeLists.txt +++ b/app/node/effect/opacity/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/factory.cpp b/app/node/factory.cpp index 6e60b1ccb..dd82a0805 100644 --- a/app/node/factory.cpp +++ b/app/node/factory.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,6 +37,10 @@ #include "distort/mask/mask.h" #include "distort/transform/transformdistortnode.h" #include "effect/opacity/opacityeffect.h" +#include "filter/blur/blur.h" +#include "filter/dropshadow/dropshadowfilter.h" +#include "filter/mosaic/mosaicfilternode.h" +#include "filter/stroke/stroke.h" #include "generator/matrix/matrix.h" #include "generator/noise/noise.h" #include "generator/polygon/polygon.h" @@ -45,17 +49,14 @@ #include "generator/text/textv1.h" #include "generator/text/textv2.h" #include "generator/text/textv3.h" -#include "filter/blur/blur.h" -#include "filter/mosaic/mosaicfilternode.h" -#include "filter/stroke/stroke.h" #include "input/time/timeinput.h" #include "input/value/valuenode.h" +#include "keying/chromakey/chromakey.h" +#include "keying/colordifferencekey/colordifferencekey.h" +#include "keying/despill/despill.h" #include "math/math/math.h" #include "math/merge/merge.h" #include "math/trigonometry/trigonometry.h" -#include "keying/colordifferencekey/colordifferencekey.h" -#include "keying/despill/despill.h" -#include "keying/chromakey/chromakey.h" #include "output/track/track.h" #include "output/viewer/viewer.h" #include "project/folder/folder.h" @@ -288,6 +289,8 @@ Node *NodeFactory::CreateFromFactoryIndex(const NodeFactory::InternalID &id) return new ChromaKeyNode(); case kMaskDistort: return new MaskDistortNode(); + case kDropShadowFilter: + return new DropShadowFilter(); case kInternalNodeCount: break; diff --git a/app/node/factory.h b/app/node/factory.h index 05bde90f4..d7ca955ff 100644 --- a/app/node/factory.h +++ b/app/node/factory.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -74,6 +74,7 @@ public: kOCIOGradingTransformLinear, kChromaKey, kMaskDistort, + kDropShadowFilter, // Count value kInternalNodeCount diff --git a/app/node/filter/CMakeLists.txt b/app/node/filter/CMakeLists.txt index 632aaed33..ea93d9320 100644 --- a/app/node/filter/CMakeLists.txt +++ b/app/node/filter/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,6 +15,7 @@ # along with this program. If not, see . add_subdirectory(blur) +add_subdirectory(dropshadow) add_subdirectory(mosaic) add_subdirectory(stroke) diff --git a/app/node/filter/blur/CMakeLists.txt b/app/node/filter/blur/CMakeLists.txt index 8f22990cf..40c6695f3 100644 --- a/app/node/filter/blur/CMakeLists.txt +++ b/app/node/filter/blur/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/filter/blur/blur.cpp b/app/node/filter/blur/blur.cpp index 6b822cf43..25a1984c2 100644 --- a/app/node/filter/blur/blur.cpp +++ b/app/node/filter/blur/blur.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -119,15 +119,15 @@ ShaderCode BlurFilterNode::GetShaderCode(const ShaderRequest &request) const void BlurFilterNode::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const { - ShaderJob job; - - job.Insert(value); - job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this)); - - Method method = static_cast(job.Get(kMethodInput).toInt()); - // If there's no texture, no need to run an operation - if (job.Get(kTextureInput).toTexture()) { + if (value[kTextureInput].toTexture()) { + + ShaderJob job; + + job.Insert(value); + job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this)); + + Method method = static_cast(job.Get(kMethodInput).toInt()); bool can_push_job = true; diff --git a/app/node/filter/blur/blur.h b/app/node/filter/blur/blur.h index 9355dd4c6..11ff66953 100644 --- a/app/node/filter/blur/blur.h +++ b/app/node/filter/blur/blur.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/filter/dropshadow/CMakeLists.txt b/app/node/filter/dropshadow/CMakeLists.txt new file mode 100644 index 000000000..e86f4b95f --- /dev/null +++ b/app/node/filter/dropshadow/CMakeLists.txt @@ -0,0 +1,22 @@ +# Olive - Non-Linear Video Editor +# Copyright (C) 2022 Olive Team +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set(OLIVE_SOURCES + ${OLIVE_SOURCES} + node/filter/dropshadow/dropshadowfilter.h + node/filter/dropshadow/dropshadowfilter.cpp + PARENT_SCOPE +) diff --git a/app/node/filter/dropshadow/dropshadowfilter.cpp b/app/node/filter/dropshadow/dropshadowfilter.cpp new file mode 100644 index 000000000..a20b20f23 --- /dev/null +++ b/app/node/filter/dropshadow/dropshadowfilter.cpp @@ -0,0 +1,98 @@ +/*** + + Olive - Non-Linear Video Editor + Copyright (C) 2022 Olive Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +***/ + +#include "dropshadowfilter.h" + +#include "widget/slider/floatslider.h" + +namespace olive { + +#define super Node + +const QString DropShadowFilter::kTextureInput = QStringLiteral("tex_in"); +const QString DropShadowFilter::kColorInput = QStringLiteral("color_in"); +const QString DropShadowFilter::kDistanceInput = QStringLiteral("distance_in"); +const QString DropShadowFilter::kAngleInput = QStringLiteral("angle_in"); +const QString DropShadowFilter::kSoftnessInput = QStringLiteral("radius_in"); +const QString DropShadowFilter::kOpacityInput = QStringLiteral("opacity_in"); +const QString DropShadowFilter::kFastInput = QStringLiteral("fast_in"); + +DropShadowFilter::DropShadowFilter() +{ + AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable)); + + AddInput(kColorInput, NodeValue::kColor, QVariant::fromValue(Color(0.0, 0.0, 0.0))); + + AddInput(kDistanceInput, NodeValue::kFloat, 10.0); + + AddInput(kAngleInput, NodeValue::kFloat, 135.0); + + AddInput(kSoftnessInput, NodeValue::kFloat, 10.0); + SetInputProperty(kSoftnessInput, QStringLiteral("min"), 0.0); + + AddInput(kOpacityInput, NodeValue::kFloat, 1.0); + SetInputProperty(kOpacityInput, QStringLiteral("min"), 0.0); + SetInputProperty(kOpacityInput, QStringLiteral("view"), FloatSlider::kPercentage); + + AddInput(kFastInput, NodeValue::kBoolean, false); + + SetEffectInput(kTextureInput); + SetFlags(kVideoEffect); +} + +void DropShadowFilter::Retranslate() +{ + super::Retranslate(); + + SetInputName(kTextureInput, tr("Texture")); + SetInputName(kColorInput, tr("Color")); + SetInputName(kDistanceInput, tr("Distance")); + SetInputName(kAngleInput, tr("Angle")); + SetInputName(kSoftnessInput, tr("Softness")); + SetInputName(kOpacityInput, tr("Opacity")); + SetInputName(kFastInput, tr("Faster (Lower Quality)")); +} + +ShaderCode DropShadowFilter::GetShaderCode(const ShaderRequest &request) const +{ + Q_UNUSED(request) + return ShaderCode(FileFunctions::ReadFileAsString(":/shaders/dropshadow.frag")); +} + +void DropShadowFilter::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const +{ + if (value[kTextureInput].toTexture()) { + ShaderJob job; + + QString iterative = QStringLiteral("previous_iteration_in"); + + job.Insert(value); + job.Insert(QStringLiteral("resolution_in"), NodeValue(NodeValue::kVec2, globals.resolution(), this)); + job.Insert(iterative, value[kTextureInput]); + + if (!qIsNull(value[kSoftnessInput].toDouble())) { + job.SetIterations(3, iterative); + } + + table->Push(NodeValue::kTexture, QVariant::fromValue(job), this); + } +} + +} diff --git a/app/node/filter/dropshadow/dropshadowfilter.h b/app/node/filter/dropshadow/dropshadowfilter.h new file mode 100644 index 000000000..5e820a280 --- /dev/null +++ b/app/node/filter/dropshadow/dropshadowfilter.h @@ -0,0 +1,58 @@ +/*** + + Olive - Non-Linear Video Editor + Copyright (C) 2022 Olive Team + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +***/ + +#ifndef DROPSHADOWFILTER_H +#define DROPSHADOWFILTER_H + +#include "node/node.h" + +namespace olive { + +class DropShadowFilter : public Node +{ + Q_OBJECT +public: + DropShadowFilter(); + + NODE_DEFAULT_FUNCTIONS(DropShadowFilter) + + virtual QString Name() const override { return tr("Drop Shadow"); } + virtual QString id() const override { return QStringLiteral("org.olivevideoeditor.Olive.dropshadow"); } + virtual QVector Category() const override { return {kCategoryFilter}; } + virtual QString Description() const override { return tr("Adds a drop shadow to an image."); } + + virtual void Retranslate() override; + + virtual ShaderCode GetShaderCode(const ShaderRequest &request) const override; + virtual void Value(const NodeValueRow& value, const NodeGlobals &globals, NodeValueTable *table) const override; + + static const QString kTextureInput; + static const QString kColorInput; + static const QString kDistanceInput; + static const QString kAngleInput; + static const QString kSoftnessInput; + static const QString kOpacityInput; + static const QString kFastInput; + +}; + +} + +#endif // DROPSHADOWFILTER_H diff --git a/app/node/filter/mosaic/CMakeLists.txt b/app/node/filter/mosaic/CMakeLists.txt index 609a29415..07a502395 100644 --- a/app/node/filter/mosaic/CMakeLists.txt +++ b/app/node/filter/mosaic/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/filter/mosaic/mosaicfilternode.cpp b/app/node/filter/mosaic/mosaicfilternode.cpp index cf80a2139..e5b5af8ca 100644 --- a/app/node/filter/mosaic/mosaicfilternode.cpp +++ b/app/node/filter/mosaic/mosaicfilternode.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/filter/mosaic/mosaicfilternode.h b/app/node/filter/mosaic/mosaicfilternode.h index fed3f3168..9f962a0cb 100644 --- a/app/node/filter/mosaic/mosaicfilternode.h +++ b/app/node/filter/mosaic/mosaicfilternode.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/filter/stroke/CMakeLists.txt b/app/node/filter/stroke/CMakeLists.txt index a470ab234..71bb7c94f 100644 --- a/app/node/filter/stroke/CMakeLists.txt +++ b/app/node/filter/stroke/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/filter/stroke/stroke.cpp b/app/node/filter/stroke/stroke.cpp index f3edea14e..f8adc3f1f 100644 --- a/app/node/filter/stroke/stroke.cpp +++ b/app/node/filter/stroke/stroke.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/filter/stroke/stroke.h b/app/node/filter/stroke/stroke.h index 48a442ace..4ec07c0e9 100644 --- a/app/node/filter/stroke/stroke.h +++ b/app/node/filter/stroke/stroke.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/CMakeLists.txt b/app/node/generator/CMakeLists.txt index 74432a826..424c3a0d4 100644 --- a/app/node/generator/CMakeLists.txt +++ b/app/node/generator/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/matrix/CMakeLists.txt b/app/node/generator/matrix/CMakeLists.txt index ddde1cdb0..142fdade9 100644 --- a/app/node/generator/matrix/CMakeLists.txt +++ b/app/node/generator/matrix/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/matrix/matrix.cpp b/app/node/generator/matrix/matrix.cpp index d545ab2d9..81e43c4ea 100644 --- a/app/node/generator/matrix/matrix.cpp +++ b/app/node/generator/matrix/matrix.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -90,63 +90,33 @@ void MatrixGenerator::Retranslate() void MatrixGenerator::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const { // Push matrix output - QMatrix4x4 mat = GenerateMatrix(value, true, false, false, false); + QMatrix4x4 mat = GenerateMatrix(value, false, false, false); table->Push(NodeValue::kMatrix, mat, this); } -QMatrix4x4 MatrixGenerator::GenerateMatrix(const NodeValueRow &value, bool take, bool ignore_anchor, bool ignore_position, bool ignore_scale) const +QMatrix4x4 MatrixGenerator::GenerateMatrix(const NodeValueRow &value, bool ignore_anchor, bool ignore_position, bool ignore_scale) const { QVector2D anchor; QVector2D position; QVector2D scale; if (!ignore_anchor) { - if (take) { - // Take and store - anchor = value[kAnchorInput].toVec2(); - } else { - // Get and store - anchor = value[kAnchorInput].toVec2(); - } - } else if (take) { - // Just take - value[kAnchorInput].toVec2(); + anchor = value[kAnchorInput].toVec2(); } if (!ignore_scale) { - if (take) { - scale = value[kScaleInput].toVec2(); - } else { - scale = value[kScaleInput].toVec2(); - } - } else if (take) { - value[kScaleInput].toVec2(); + scale = value[kScaleInput].toVec2(); } if (!ignore_position) { - if (take) { - position = value[kPositionInput].toVec2(); - } else { - position = value[kPositionInput].toVec2(); - } - } else if (take) { - value[kPositionInput].toVec2(); + position = value[kPositionInput].toVec2(); } - if (take) { - return GenerateMatrix(position, - value[kRotationInput].toDouble(), - scale, - value[kUniformScaleInput].toBool(), - anchor); - } else { - return GenerateMatrix(position, - value[kRotationInput].toDouble(), - scale, - value[kUniformScaleInput].toBool(), - anchor); - - } + return GenerateMatrix(position, + value[kRotationInput].toDouble(), + scale, + value[kUniformScaleInput].toBool(), + anchor); } QMatrix4x4 MatrixGenerator::GenerateMatrix(const QVector2D& pos, diff --git a/app/node/generator/matrix/matrix.h b/app/node/generator/matrix/matrix.h index 3466c703d..5d93cb51d 100644 --- a/app/node/generator/matrix/matrix.h +++ b/app/node/generator/matrix/matrix.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ public: static const QString kAnchorInput; protected: - QMatrix4x4 GenerateMatrix(const NodeValueRow &value, bool take, bool ignore_anchor, bool ignore_position, bool ignore_scale) const; + QMatrix4x4 GenerateMatrix(const NodeValueRow &value, bool ignore_anchor, bool ignore_position, bool ignore_scale) const; static QMatrix4x4 GenerateMatrix(const QVector2D &pos, const float &rot, const QVector2D &scale, diff --git a/app/node/generator/noise/CMakeLists.txt b/app/node/generator/noise/CMakeLists.txt index d883c2737..2c74d0d1c 100644 --- a/app/node/generator/noise/CMakeLists.txt +++ b/app/node/generator/noise/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/noise/noise.cpp b/app/node/generator/noise/noise.cpp index dff259996..074a78278 100644 --- a/app/node/generator/noise/noise.cpp +++ b/app/node/generator/noise/noise.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/noise/noise.h b/app/node/generator/noise/noise.h index 73a3a0c0b..c44526ab7 100644 --- a/app/node/generator/noise/noise.h +++ b/app/node/generator/noise/noise.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/polygon/CMakeLists.txt b/app/node/generator/polygon/CMakeLists.txt index d58dd27a0..79660d493 100644 --- a/app/node/generator/polygon/CMakeLists.txt +++ b/app/node/generator/polygon/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/polygon/polygon.cpp b/app/node/generator/polygon/polygon.cpp index 9677799af..de458c6e8 100644 --- a/app/node/generator/polygon/polygon.cpp +++ b/app/node/generator/polygon/polygon.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/polygon/polygon.h b/app/node/generator/polygon/polygon.h index 7107818df..7a6bbc340 100644 --- a/app/node/generator/polygon/polygon.h +++ b/app/node/generator/polygon/polygon.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/shape/CMakeLists.txt b/app/node/generator/shape/CMakeLists.txt index 275b80e75..436a49583 100644 --- a/app/node/generator/shape/CMakeLists.txt +++ b/app/node/generator/shape/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/shape/generatorwithmerge.cpp b/app/node/generator/shape/generatorwithmerge.cpp index 3e36c9229..8174b5bf2 100644 --- a/app/node/generator/shape/generatorwithmerge.cpp +++ b/app/node/generator/shape/generatorwithmerge.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/shape/generatorwithmerge.h b/app/node/generator/shape/generatorwithmerge.h index de3e3bc04..fb7d729f0 100644 --- a/app/node/generator/shape/generatorwithmerge.h +++ b/app/node/generator/shape/generatorwithmerge.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/shape/shapenode.cpp b/app/node/generator/shape/shapenode.cpp index b8af51bf9..59b6e071c 100644 --- a/app/node/generator/shape/shapenode.cpp +++ b/app/node/generator/shape/shapenode.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/shape/shapenode.h b/app/node/generator/shape/shapenode.h index 5b69209a7..3dfdccbaf 100644 --- a/app/node/generator/shape/shapenode.h +++ b/app/node/generator/shape/shapenode.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/shape/shapenodebase.cpp b/app/node/generator/shape/shapenodebase.cpp index 77a25f5e3..582725ec4 100644 --- a/app/node/generator/shape/shapenodebase.cpp +++ b/app/node/generator/shape/shapenodebase.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ #include "common/util.h" #include "core.h" +#include "widget/nodeparamview/nodeparamviewundo.h" namespace olive { @@ -102,6 +103,21 @@ void ShapeNodeBase::UpdateGizmoPositions(const NodeValueRow &row, const NodeGlob poly_gizmo_->SetPolygon(QRectF(left_pt, top_pt, right_pt - left_pt, bottom_pt - top_pt)); } +void ShapeNodeBase::SetRect(QRectF rect, const VideoParams &sequence_res, MultiUndoCommand *command) +{ + // Normalize around center of sequence + rect.translate(-sequence_res.width()*0.5, -sequence_res.height()*0.5); + rect.translate(rect.width()*0.5, rect.height()*0.5); + + NodeInput pos(this, ShapeNodeBase::kPositionInput); + NodeInput sz(this, ShapeNodeBase::kSizeInput); + + command->add_child(new NodeParamSetStandardValueCommand(NodeKeyframeTrackReference(sz, 0), rect.width())); + command->add_child(new NodeParamSetStandardValueCommand(NodeKeyframeTrackReference(sz, 1), rect.height())); + command->add_child(new NodeParamSetStandardValueCommand(NodeKeyframeTrackReference(pos, 0), rect.x())); + command->add_child(new NodeParamSetStandardValueCommand(NodeKeyframeTrackReference(pos, 1), rect.y())); +} + void ShapeNodeBase::GizmoDragMove(double x, double y, const Qt::KeyboardModifiers &modifiers) { DraggableGizmo *gizmo = static_cast(sender()); diff --git a/app/node/generator/shape/shapenodebase.h b/app/node/generator/shape/shapenodebase.h index 4d9b01006..fd0f6658a 100644 --- a/app/node/generator/shape/shapenodebase.h +++ b/app/node/generator/shape/shapenodebase.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,6 +39,8 @@ public: virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals) override; + void SetRect(QRectF rect, const VideoParams &sequence_res, MultiUndoCommand *command); + static const QString kPositionInput; static const QString kSizeInput; static const QString kColorInput; diff --git a/app/node/generator/solid/CMakeLists.txt b/app/node/generator/solid/CMakeLists.txt index 3d37fc003..a194c709a 100644 --- a/app/node/generator/solid/CMakeLists.txt +++ b/app/node/generator/solid/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/solid/solid.cpp b/app/node/generator/solid/solid.cpp index 237c98fde..a99a7f370 100644 --- a/app/node/generator/solid/solid.cpp +++ b/app/node/generator/solid/solid.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/solid/solid.h b/app/node/generator/solid/solid.h index 4b40a7fc4..97013a13a 100644 --- a/app/node/generator/solid/solid.h +++ b/app/node/generator/solid/solid.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/text/CMakeLists.txt b/app/node/generator/text/CMakeLists.txt index 81c69f4e7..3c03d99a1 100644 --- a/app/node/generator/text/CMakeLists.txt +++ b/app/node/generator/text/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/text/textv1.cpp b/app/node/generator/text/textv1.cpp index b70aaa05b..22f4d30c7 100644 --- a/app/node/generator/text/textv1.cpp +++ b/app/node/generator/text/textv1.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/text/textv1.h b/app/node/generator/text/textv1.h index 85e4f24cf..e45b9bc07 100644 --- a/app/node/generator/text/textv1.h +++ b/app/node/generator/text/textv1.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/text/textv2.cpp b/app/node/generator/text/textv2.cpp index 2d091c4c9..0df750fc6 100644 --- a/app/node/generator/text/textv2.cpp +++ b/app/node/generator/text/textv2.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/text/textv2.h b/app/node/generator/text/textv2.h index d98443dfc..c3879692e 100644 --- a/app/node/generator/text/textv2.h +++ b/app/node/generator/text/textv2.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/generator/text/textv3.cpp b/app/node/generator/text/textv3.cpp index 40628ec46..da6f9bfe8 100644 --- a/app/node/generator/text/textv3.cpp +++ b/app/node/generator/text/textv3.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -44,6 +44,7 @@ TextGeneratorV3::TextGeneratorV3() : ShapeNodeBase(false) { AddInput(kTextInput, NodeValue::kText, QStringLiteral("

%1

").arg(tr("Sample Text"))); + SetInputProperty(kTextInput, QStringLiteral("vieweronly"), true); SetStandardValue(kSizeInput, QVector2D(400, 300)); diff --git a/app/node/generator/text/textv3.h b/app/node/generator/text/textv3.h index f2cd2d47c..69f08f617 100644 --- a/app/node/generator/text/textv3.h +++ b/app/node/generator/text/textv3.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/CMakeLists.txt b/app/node/gizmo/CMakeLists.txt index 3c43aaf85..c9f530d22 100644 --- a/app/node/gizmo/CMakeLists.txt +++ b/app/node/gizmo/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/draggable.cpp b/app/node/gizmo/draggable.cpp index d01c2144a..1c988d4d5 100644 --- a/app/node/gizmo/draggable.cpp +++ b/app/node/gizmo/draggable.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/draggable.h b/app/node/gizmo/draggable.h index db1bb385f..cee0a3790 100644 --- a/app/node/gizmo/draggable.h +++ b/app/node/gizmo/draggable.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/gizmo.cpp b/app/node/gizmo/gizmo.cpp index f69451869..f1e677f2a 100644 --- a/app/node/gizmo/gizmo.cpp +++ b/app/node/gizmo/gizmo.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/gizmo.h b/app/node/gizmo/gizmo.h index 07c519886..741a9dfdb 100644 --- a/app/node/gizmo/gizmo.h +++ b/app/node/gizmo/gizmo.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/line.cpp b/app/node/gizmo/line.cpp index c1f63027e..33f1a45bc 100644 --- a/app/node/gizmo/line.cpp +++ b/app/node/gizmo/line.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/line.h b/app/node/gizmo/line.h index 79861b269..001f7d250 100644 --- a/app/node/gizmo/line.h +++ b/app/node/gizmo/line.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/path.cpp b/app/node/gizmo/path.cpp index 95262093a..cd9642aec 100644 --- a/app/node/gizmo/path.cpp +++ b/app/node/gizmo/path.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/path.h b/app/node/gizmo/path.h index 5e1bf0859..ec6a8c4c6 100644 --- a/app/node/gizmo/path.h +++ b/app/node/gizmo/path.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/point.cpp b/app/node/gizmo/point.cpp index 3926209a6..d60ccf5bd 100644 --- a/app/node/gizmo/point.cpp +++ b/app/node/gizmo/point.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,7 +43,7 @@ PointGizmo::PointGizmo(QObject *parent) : void PointGizmo::Draw(QPainter *p) const { - QRectF rect = GetDrawingRect(GetStandardRadius() / p->transform().m11()); + QRectF rect = GetDrawingRect(p->transform(), GetStandardRadius()); if (shape_ != kAnchorPoint) { p->setPen(Qt::NoPen); @@ -72,7 +72,7 @@ void PointGizmo::Draw(QPainter *p) const QRectF PointGizmo::GetClickingRect(const QTransform &t) const { - return GetDrawingRect(GetStandardRadius() / t.m11() * 1.5); + return GetDrawingRect(t, GetStandardRadius()); } double PointGizmo::GetStandardRadius() @@ -80,20 +80,29 @@ double PointGizmo::GetStandardRadius() return QFontMetrics(qApp->font()).height() * 0.25; } -QRectF PointGizmo::GetDrawingRect(double radius) const +QRectF PointGizmo::GetDrawingRect(const QTransform &transform, double radius) const { + QRectF r(0,0, radius, radius); + + r = transform.inverted().mapRect(r); + + double width = r.width(); + double height = r.height(); + if (shape_ == kAnchorPoint) { - radius *= 2; + width *= 2; + height *= 2; } if (smaller_) { - radius *= 0.5; + width *= 0.5; + height *= 0.5; } - return QRectF(point_.x() - radius, - point_.y() - radius, - 2*radius, - 2*radius); + return QRectF(point_.x() - width, + point_.y() - height, + 2*width, + 2*height); } } diff --git a/app/node/gizmo/point.h b/app/node/gizmo/point.h index b9ec47488..8f8a02f65 100644 --- a/app/node/gizmo/point.h +++ b/app/node/gizmo/point.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,7 +57,7 @@ public: private: static double GetStandardRadius(); - QRectF GetDrawingRect(double radius) const; + QRectF GetDrawingRect(const QTransform &transform, double radius) const; Shape shape_; diff --git a/app/node/gizmo/polygon.cpp b/app/node/gizmo/polygon.cpp index 29614c038..8279d7fea 100644 --- a/app/node/gizmo/polygon.cpp +++ b/app/node/gizmo/polygon.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/polygon.h b/app/node/gizmo/polygon.h index 92e2a5398..54645c69c 100644 --- a/app/node/gizmo/polygon.h +++ b/app/node/gizmo/polygon.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/screen.cpp b/app/node/gizmo/screen.cpp index 2848c8979..4a7bfcc8e 100644 --- a/app/node/gizmo/screen.cpp +++ b/app/node/gizmo/screen.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/screen.h b/app/node/gizmo/screen.h index 0f0e76444..e6f2522cb 100644 --- a/app/node/gizmo/screen.h +++ b/app/node/gizmo/screen.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/text.cpp b/app/node/gizmo/text.cpp index 031c971f7..6e2b97c5b 100644 --- a/app/node/gizmo/text.cpp +++ b/app/node/gizmo/text.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/gizmo/text.h b/app/node/gizmo/text.h index 6a8876cee..0c74d7cdf 100644 --- a/app/node/gizmo/text.h +++ b/app/node/gizmo/text.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/globals.cpp b/app/node/globals.cpp index 171c2de35..3de62c5da 100644 --- a/app/node/globals.cpp +++ b/app/node/globals.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/globals.h b/app/node/globals.h index 17ba9d429..42d527ed0 100644 --- a/app/node/globals.h +++ b/app/node/globals.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/graph.cpp b/app/node/graph.cpp index 6c71f5a75..b4cdf44bd 100644 --- a/app/node/graph.cpp +++ b/app/node/graph.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/graph.h b/app/node/graph.h index 443e20748..93f1100b1 100644 --- a/app/node/graph.h +++ b/app/node/graph.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/group/CMakeLists.txt b/app/node/group/CMakeLists.txt index 3c0bce4d6..de08d74da 100644 --- a/app/node/group/CMakeLists.txt +++ b/app/node/group/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/group/group.cpp b/app/node/group/group.cpp index 9c7fe1c6b..b0ed9705c 100644 --- a/app/node/group/group.cpp +++ b/app/node/group/group.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/group/group.h b/app/node/group/group.h index d906c987e..2eafa3aa2 100644 --- a/app/node/group/group.h +++ b/app/node/group/group.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/input/CMakeLists.txt b/app/node/input/CMakeLists.txt index b3647a055..6de136173 100644 --- a/app/node/input/CMakeLists.txt +++ b/app/node/input/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/input/time/CMakeLists.txt b/app/node/input/time/CMakeLists.txt index b144421cb..de26aba60 100644 --- a/app/node/input/time/CMakeLists.txt +++ b/app/node/input/time/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/input/time/timeinput.cpp b/app/node/input/time/timeinput.cpp index 5a525dfb6..80624ad1d 100644 --- a/app/node/input/time/timeinput.cpp +++ b/app/node/input/time/timeinput.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/input/time/timeinput.h b/app/node/input/time/timeinput.h index 7e521f1de..a00d0d2c6 100644 --- a/app/node/input/time/timeinput.h +++ b/app/node/input/time/timeinput.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/input/value/CMakeLists.txt b/app/node/input/value/CMakeLists.txt index ab5dff9d3..cab50a98e 100644 --- a/app/node/input/value/CMakeLists.txt +++ b/app/node/input/value/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/input/value/valuenode.cpp b/app/node/input/value/valuenode.cpp index 00b3d0c5c..1303b91d3 100644 --- a/app/node/input/value/valuenode.cpp +++ b/app/node/input/value/valuenode.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/input/value/valuenode.h b/app/node/input/value/valuenode.h index 8d2569786..f45bf8914 100644 --- a/app/node/input/value/valuenode.h +++ b/app/node/input/value/valuenode.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/inputdragger.cpp b/app/node/inputdragger.cpp index ed23deb73..daff897b3 100644 --- a/app/node/inputdragger.cpp +++ b/app/node/inputdragger.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/inputdragger.h b/app/node/inputdragger.h index 5b530d515..d30bb35ab 100644 --- a/app/node/inputdragger.h +++ b/app/node/inputdragger.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/inputimmediate.cpp b/app/node/inputimmediate.cpp index fb5bc8d07..9484428aa 100644 --- a/app/node/inputimmediate.cpp +++ b/app/node/inputimmediate.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/inputimmediate.h b/app/node/inputimmediate.h index d0fd496c2..dc1aee59c 100644 --- a/app/node/inputimmediate.h +++ b/app/node/inputimmediate.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/keyframe.cpp b/app/node/keyframe.cpp index 277a1ed61..eb6d5dea1 100644 --- a/app/node/keyframe.cpp +++ b/app/node/keyframe.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,6 +41,11 @@ NodeKeyframe::NodeKeyframe(const rational &time, const QVariant &value, Type typ setParent(parent); } +NodeKeyframe::NodeKeyframe() +{ + type_ = NodeKeyframe::kLinear; +} + NodeKeyframe::~NodeKeyframe() { setParent(nullptr); diff --git a/app/node/keyframe.h b/app/node/keyframe.h index a6163039a..ffe5a7728 100644 --- a/app/node/keyframe.h +++ b/app/node/keyframe.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -64,6 +64,7 @@ public: * @brief NodeKeyframe Constructor */ NodeKeyframe(const rational& time, const QVariant& value, Type type, int track, int element, const QString& input, QObject* parent = nullptr); + NodeKeyframe(); virtual ~NodeKeyframe() override; @@ -71,10 +72,9 @@ public: NodeKeyframe* copy(QObject* parent = nullptr) const; Node* parent() const; - const QString& input() const - { - return input_; - } + + const QString& input() const { return input_; } + void set_input(const QString& input) { input_ = input; } NodeKeyframeTrackReference key_track_ref() const { @@ -87,14 +87,6 @@ public: const rational& time() const; void set_time(const rational& time); - /** - * @brief Dummy function for TimeBasedViewSelectionManager compatibility - * - * FIXME: Once we upgrade to C++17, we won't need this because we'll be able to check types in - * TimeBasedViewSelectionManager's template functions - */ - TimeRange time_range() const { return TimeRange(time_, time_); } - /** * @brief The value of this keyframe (i.e. the value to use at this keyframe's time) */ @@ -141,15 +133,11 @@ public: * For the majority of keyfreames, this will be 0, but for some types, such as kVec2, this will be 0 for X keyframes * and 1 for Y keyframes, etc. */ - int track() const - { - return track_; - } + int track() const { return track_; } + void set_track(int t) { track_ = t; } - int element() const - { - return element_; - } + int element() const { return element_; } + void set_element(int e) { element_ = e; } /** * @brief Convenience function for getting the opposite handle type (e.g. kInHandle <-> kOutHandle) diff --git a/app/node/keying/CMakeLists.txt b/app/node/keying/CMakeLists.txt index 4dbd437cd..1aa9910f4 100644 --- a/app/node/keying/CMakeLists.txt +++ b/app/node/keying/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/keying/chromakey/CMakeLists.txt b/app/node/keying/chromakey/CMakeLists.txt index c2af2bba4..e7a9023dc 100644 --- a/app/node/keying/chromakey/CMakeLists.txt +++ b/app/node/keying/chromakey/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/keying/colordifferencekey/CMakeLists.txt b/app/node/keying/colordifferencekey/CMakeLists.txt index 66422f411..f85438dc9 100644 --- a/app/node/keying/colordifferencekey/CMakeLists.txt +++ b/app/node/keying/colordifferencekey/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/keying/despill/CMakeLists.txt b/app/node/keying/despill/CMakeLists.txt index 69ee377d6..5f7c01639 100644 --- a/app/node/keying/despill/CMakeLists.txt +++ b/app/node/keying/despill/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/math/CMakeLists.txt b/app/node/math/CMakeLists.txt index e31fc9497..e9afde04c 100644 --- a/app/node/math/CMakeLists.txt +++ b/app/node/math/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/math/math/CMakeLists.txt b/app/node/math/math/CMakeLists.txt index 39fcfcb76..8837a6e9d 100644 --- a/app/node/math/math/CMakeLists.txt +++ b/app/node/math/math/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/math/math/math.cpp b/app/node/math/math/math.cpp index 6bade4174..4ddbe2e12 100644 --- a/app/node/math/math/math.cpp +++ b/app/node/math/math/math.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/math/math/math.h b/app/node/math/math/math.h index 65a63720e..1e2f1ffcc 100644 --- a/app/node/math/math/math.h +++ b/app/node/math/math/math.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/math/math/mathbase.cpp b/app/node/math/math/mathbase.cpp index d07658d94..70ba8433a 100644 --- a/app/node/math/math/mathbase.cpp +++ b/app/node/math/math/mathbase.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/math/math/mathbase.h b/app/node/math/math/mathbase.h index 80cb792a7..6d6bdb5bd 100644 --- a/app/node/math/math/mathbase.h +++ b/app/node/math/math/mathbase.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/math/merge/CMakeLists.txt b/app/node/math/merge/CMakeLists.txt index 792368d8b..d20bad99d 100644 --- a/app/node/math/merge/CMakeLists.txt +++ b/app/node/math/merge/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/math/merge/merge.cpp b/app/node/math/merge/merge.cpp index c3d00133e..227ea6577 100644 --- a/app/node/math/merge/merge.cpp +++ b/app/node/math/merge/merge.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/math/merge/merge.h b/app/node/math/merge/merge.h index 7282c4eb5..52dd5c097 100644 --- a/app/node/math/merge/merge.h +++ b/app/node/math/merge/merge.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/math/trigonometry/CMakeLists.txt b/app/node/math/trigonometry/CMakeLists.txt index cf031039e..e3b12573d 100644 --- a/app/node/math/trigonometry/CMakeLists.txt +++ b/app/node/math/trigonometry/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/math/trigonometry/trigonometry.cpp b/app/node/math/trigonometry/trigonometry.cpp index 426604ca1..b82c9f36f 100644 --- a/app/node/math/trigonometry/trigonometry.cpp +++ b/app/node/math/trigonometry/trigonometry.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/math/trigonometry/trigonometry.h b/app/node/math/trigonometry/trigonometry.h index a78f9ea59..21b82a678 100644 --- a/app/node/math/trigonometry/trigonometry.h +++ b/app/node/math/trigonometry/trigonometry.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/node.cpp b/app/node/node.cpp index f07d545e9..5b1944888 100644 --- a/app/node/node.cpp +++ b/app/node/node.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1058,7 +1058,7 @@ Node *Node::CopyNodeAndDependencyGraphMinusItemsInternal(QMap& cre } // Copy values to the clone - command->add_child(new NodeCopyInputsCommand(node, copy, false)); + CopyInputs(node, copy, false, command); // Go through input connections and copy if non-item and connect if item for (auto it=node->input_connections_.cbegin(); it!=node->input_connections_.cend(); it++) { @@ -1104,7 +1104,7 @@ Node *Node::CopyNodeInGraph(Node *node, MultiUndoCommand *command) command->add_child(new NodeAddCommand(static_cast(node->parent()), copy)); - command->add_child(new NodeCopyInputsCommand(node, copy, true)); + CopyInputs(node, copy, true, command); const PositionMap &map = node->GetContextPositions(); for (auto it=map.cbegin(); it!=map.cend(); it++) { @@ -1324,7 +1324,7 @@ QString Node::GetLabelOrName() const return GetLabel(); } -void Node::CopyInputs(const Node *source, Node *destination, bool include_connections) +void Node::CopyInputs(const Node *source, Node *destination, bool include_connections, MultiUndoCommand *command) { Q_ASSERT(source->id() == destination->id()); @@ -1334,76 +1334,119 @@ void Node::CopyInputs(const Node *source, Node *destination, bool include_connec // passthroughs correctly. Q_ASSERT(destination->HasInputWithID(input)); - CopyInput(source, destination, input, include_connections, true); + CopyInput(source, destination, input, include_connections, true, command); } - destination->SetLabel(source->GetLabel()); - destination->SetOverrideColor(source->GetOverrideColor()); + if (command) { + command->add_child(new NodeRenameCommand(destination, source->GetLabel())); + } else { + destination->SetLabel(source->GetLabel()); + } + + if (command) { + command->add_child(new NodeOverrideColorCommand(destination, source->GetOverrideColor())); + } else { + destination->SetOverrideColor(source->GetOverrideColor()); + } } -void Node::CopyInput(const Node *src, Node *dst, const QString &input, bool include_connections, bool traverse_arrays) +void Node::CopyInput(const Node *src, Node *dst, const QString &input, bool include_connections, bool traverse_arrays, MultiUndoCommand *command) { Q_ASSERT(src->id() == dst->id()); - CopyValuesOfElement(src, dst, input, -1); + CopyValuesOfElement(src, dst, input, -1, command); // Copy array size if (src->InputIsArray(input) && traverse_arrays) { int src_array_sz = src->InputArraySize(input); for (int i=0; iinput_connections().cbegin(); it!=src->input_connections().cend(); it++) { - ConnectEdge(it->second, NodeInput(dst, input, it->first.element())); + // Copy all connections + for (auto it=src->input_connections().cbegin(); it!=src->input_connections().cend(); it++) { + if (!traverse_arrays && it->first.element() != -1) { + continue; } - } else { - // Just copy the primary connection (at -1) - if (src->IsInputConnected(input)) { - ConnectEdge(src->GetConnectedOutput(input), NodeInput(dst, input)); + + auto conn_output = it->second; + NodeInput conn_input(dst, input, it->first.element()); + + if (command) { + command->add_child(new NodeEdgeAddCommand(conn_output, conn_input)); + } else { + ConnectEdge(conn_output, conn_input); } } } } -void Node::CopyValuesOfElement(const Node *src, Node *dst, const QString &input, int src_element, int dst_element) +void Node::CopyValuesOfElement(const Node *src, Node *dst, const QString &input, int src_element, int dst_element, MultiUndoCommand *command) { if (dst_element >= dst->GetInternalInputArraySize(input)) { qDebug() << "Ignored destination element that was out of array bounds"; return; } + NodeInput dst_input(dst, input, dst_element); + // Copy standard value - dst->SetSplitStandardValue(input, src->GetSplitStandardValue(input, src_element), dst_element); + SplitValue standard = src->GetSplitStandardValue(input, src_element); + if (command) { + command->add_child(new NodeParamSetSplitStandardValueCommand(dst_input, standard)); + } else { + dst->SetSplitStandardValue(input, standard, dst_element); + } // Copy keyframes if (NodeInputImmediate *immediate = dst->GetImmediate(input, dst_element)) { - immediate->delete_all_keyframes(); + if (command) { + command->add_child(new ImmediateRemoveAllKeyframesCommand(immediate)); + } else { + immediate->delete_all_keyframes(); + } } + foreach (const NodeKeyframeTrack& track, src->GetImmediate(input, src_element)->keyframe_tracks()) { foreach (NodeKeyframe* key, track) { - key->copy(dst_element, dst); + NodeKeyframe *copy = key->copy(dst_element, command ? nullptr : dst); + if (command) { + command->add_child(new NodeParamInsertKeyframeCommand(dst, copy)); + } } } // Copy keyframing state if (src->IsInputKeyframable(input)) { - dst->SetInputIsKeyframing(input, src->IsInputKeyframing(input, src_element), dst_element); + bool is_keying = src->IsInputKeyframing(input, src_element); + if (command) { + command->add_child(new NodeParamSetKeyframingCommand(dst_input, is_keying)); + } else { + dst->SetInputIsKeyframing(input, is_keying, dst_element); + } } // If this is the root of an array, copy the array size if (src_element == -1 && dst_element == -1) { - dst->ArrayResizeInternal(input, src->InputArraySize(input)); + int array_sz = src->InputArraySize(input); + if (command) { + command->add_child(new Node::ArrayResizeCommand(dst, input, array_sz)); + } else { + dst->ArrayResizeInternal(input, array_sz); + } } // Copy value hint - dst->SetValueHintForInput(input, src->GetValueHintForInput(input, src_element), dst_element); + Node::ValueHint vh = src->GetValueHintForInput(input, src_element); + if (command) { + command->add_child(new NodeSetValueHintCommand(dst_input, vh)); + } else { + dst->SetValueHintForInput(input, vh, dst_element); + } } bool Node::CanBeDeleted() const @@ -2086,4 +2129,25 @@ void NodeSetPositionAndDependenciesRecursivelyCommand::move_recursively(Node *no } } +void Node::ImmediateRemoveAllKeyframesCommand::prepare() +{ + for (const NodeKeyframeTrack& track : immediate_->keyframe_tracks()) { + keys_.append(track); + } +} + +void Node::ImmediateRemoveAllKeyframesCommand::redo() +{ + for (auto it=keys_.cbegin(); it!=keys_.cend(); it++) { + (*it)->setParent(&memory_manager_); + } +} + +void Node::ImmediateRemoveAllKeyframesCommand::undo() +{ + for (auto it=keys_.crbegin(); it!=keys_.crend(); it++) { + (*it)->setParent(&memory_manager_); + } +} + } diff --git a/app/node/node.h b/app/node/node.h index 2b8d69b1e..b9bd33c7d 100644 --- a/app/node/node.h +++ b/app/node/node.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -829,14 +829,14 @@ public: * * Nodes must be of the same types (i.e. have the same ID) */ - static void CopyInputs(const Node *source, Node* destination, bool include_connections = true); + static void CopyInputs(const Node *source, Node* destination, bool include_connections = true, MultiUndoCommand *command = nullptr); - static void CopyInput(const Node *src, Node* dst, const QString& input, bool include_connections, bool traverse_arrays); + static void CopyInput(const Node *src, Node* dst, const QString& input, bool include_connections, bool traverse_arrays, MultiUndoCommand *command); - static void CopyValuesOfElement(const Node* src, Node* dst, const QString& input, int src_element, int dst_element); - static void CopyValuesOfElement(const Node* src, Node* dst, const QString& input, int element) + static void CopyValuesOfElement(const Node* src, Node* dst, const QString& input, int src_element, int dst_element, MultiUndoCommand *command = nullptr); + static void CopyValuesOfElement(const Node* src, Node* dst, const QString& input, int element, MultiUndoCommand *command = nullptr) { - return CopyValuesOfElement(src, dst, input, element, element); + return CopyValuesOfElement(src, dst, input, element, element, command); } /** @@ -884,6 +884,8 @@ public: return gizmos_; } + virtual QTransform GizmoTransformation(const NodeValueRow &row, const NodeGlobals &globals) const { return QTransform(); } + virtual void UpdateGizmoPositions(const NodeValueRow &row, const NodeGlobals &globals){} const QString& GetLabel() const; @@ -1254,6 +1256,31 @@ private: int array_size; }; + class ImmediateRemoveAllKeyframesCommand : public UndoCommand + { + public: + ImmediateRemoveAllKeyframesCommand(NodeInputImmediate *immediate) : + immediate_(immediate) + {} + + virtual Project* GetRelevantProject() const override { return nullptr; } + + protected: + virtual void prepare() override; + + virtual void redo() override; + + virtual void undo() override; + + private: + NodeInputImmediate *immediate_; + + QObject memory_manager_; + + QVector keys_; + + }; + NodeInputImmediate* CreateImmediate(const QString& input); NodeInputImmediate* GetImmediate(const QString& input, int element) const; diff --git a/app/node/output/CMakeLists.txt b/app/node/output/CMakeLists.txt index 68bcf12ee..ae9e63c14 100644 --- a/app/node/output/CMakeLists.txt +++ b/app/node/output/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/output/track/CMakeLists.txt b/app/node/output/track/CMakeLists.txt index d2287c4ef..a0b2b6e21 100644 --- a/app/node/output/track/CMakeLists.txt +++ b/app/node/output/track/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/output/track/track.cpp b/app/node/output/track/track.cpp index 7dafd170f..facf4ad92 100644 --- a/app/node/output/track/track.cpp +++ b/app/node/output/track/track.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/output/track/track.h b/app/node/output/track/track.h index 1f3b032e3..4994bf73c 100644 --- a/app/node/output/track/track.h +++ b/app/node/output/track/track.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -222,6 +222,9 @@ public: } else if (s.at(0) == 'a') { // Audio stream return Track::kAudio; + } else if (s.at(0) == 's') { + // Subtitle stream + return Track::kSubtitle; } } } diff --git a/app/node/output/track/tracklist.cpp b/app/node/output/track/tracklist.cpp index f5d233515..bd8b7e813 100644 --- a/app/node/output/track/tracklist.cpp +++ b/app/node/output/track/tracklist.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/output/track/tracklist.h b/app/node/output/track/tracklist.h index 63683efd9..6096d0858 100644 --- a/app/node/output/track/tracklist.h +++ b/app/node/output/track/tracklist.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/output/viewer/CMakeLists.txt b/app/node/output/viewer/CMakeLists.txt index c69649b2f..d77898838 100644 --- a/app/node/output/viewer/CMakeLists.txt +++ b/app/node/output/viewer/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/output/viewer/viewer.cpp b/app/node/output/viewer/viewer.cpp index 29f6e9915..d7aa0e4ae 100644 --- a/app/node/output/viewer/viewer.cpp +++ b/app/node/output/viewer/viewer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ namespace olive { const QString ViewerOutput::kVideoParamsInput = QStringLiteral("video_param_in"); const QString ViewerOutput::kAudioParamsInput = QStringLiteral("audio_param_in"); +const QString ViewerOutput::kSubtitleParamsInput = QStringLiteral("subtitle_param_in"); const QString ViewerOutput::kTextureInput = QStringLiteral("tex_in"); const QString ViewerOutput::kSamplesInput = QStringLiteral("samples_in"); const QString ViewerOutput::kVideoAutoCacheInput = QStringLiteral("video_autocache_in"); @@ -48,6 +49,8 @@ ViewerOutput::ViewerOutput(bool create_buffer_inputs, bool create_default_stream AddInput(kAudioParamsInput, NodeValue::kAudioParams, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable | kInputFlagArray | kInputFlagHidden)); + AddInput(kSubtitleParamsInput, NodeValue::kSubtitleParams, InputFlags(kInputFlagNotConnectable | kInputFlagNotKeyframable | kInputFlagArray | kInputFlagHidden)); + if (create_buffer_inputs) { AddInput(kTextureInput, NodeValue::kTexture, InputFlags(kInputFlagNotKeyframable)); AddInput(kSamplesInput, NodeValue::kSamples, InputFlags(kInputFlagNotKeyframable)); @@ -98,6 +101,7 @@ QString ViewerOutput::duration() const // Get first enabled streams VideoParams video = GetFirstEnabledVideoStream(); AudioParams audio = GetFirstEnabledAudioStream(); + SubtitleParams sub = GetFirstEnabledSubtitleStream(); if (video.is_valid() && video.video_type() != VideoParams::kVideoTypeStill) { // Prioritize video @@ -111,6 +115,8 @@ QString ViewerOutput::duration() const } using_timebase = audio.sample_rate_as_time_base(); + } else if (sub.is_valid()) { + using_timebase = OLIVE_CONFIG("DefaultSequenceFrameRate").value(); } if (using_timebase.isNull()) { @@ -149,6 +155,11 @@ bool ViewerOutput::HasEnabledAudioStreams() const return GetFirstEnabledAudioStream().is_valid(); } +bool ViewerOutput::HasEnabledSubtitleStreams() const +{ + return GetFirstEnabledSubtitleStream().is_valid(); +} + VideoParams ViewerOutput::GetFirstEnabledVideoStream() const { int sz = GetVideoStreamCount(); @@ -179,6 +190,21 @@ AudioParams ViewerOutput::GetFirstEnabledAudioStream() const return AudioParams(); } +SubtitleParams ViewerOutput::GetFirstEnabledSubtitleStream() const +{ + int sz = GetSubtitleStreamCount(); + + for (int i=0; i ViewerOutput::GetEnabledStreamsAsReferences() const } } + { + int sp_sz = GetSubtitleStreamCount(); + + for (int i=0; i(); if (!r.isNaN()) { return r; @@ -351,7 +388,7 @@ rational ViewerOutput::VerifyLengthInternal(Track::Type type) const break; case Track::kAudio: if (IsInputConnected(kSamplesInput)) { - NodeValueTable t = traverser.GenerateTable(GetConnectedOutput(kSamplesInput), GetValueHintForInput(kSamplesInput), TimeRange(0, 0)); + NodeValueTable t = traverser.GenerateTable(GetConnectedOutput(kSamplesInput), TimeRange(0, 0)); rational r = t.Get(NodeValue::kRational, QStringLiteral("length")).value();; if (!r.isNaN()) { return r; @@ -518,6 +555,8 @@ int ViewerOutput::AddStream(Track::Type type, const QVariant& value) id = kVideoParamsInput; } else if (type == Track::kAudio) { id = kAudioParamsInput; + } else if (type == Track::kSubtitle) { + id = kSubtitleParamsInput; } else { return -1; } diff --git a/app/node/output/viewer/viewer.h b/app/node/output/viewer/viewer.h index 2edf2d344..a689d005b 100644 --- a/app/node/output/viewer/viewer.h +++ b/app/node/output/viewer/viewer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ #include "render/audioparams.h" #include "render/audioplaybackcache.h" #include "render/framehashcache.h" -#include "render/videoparams.h" +#include "render/subtitleparams.h" #include "render/videoparams.h" #include "timeline/timelinepoints.h" @@ -88,6 +88,17 @@ public: } } + SubtitleParams GetSubtitleParams(int index = 0) const + { + // This check isn't strictly necessary (GetStandardValue will return a null VideoParams anyway), + // but it does suppress a warning message that we don't need + if (index < InputArraySize(kSubtitleParamsInput)) { + return GetStandardValue(kSubtitleParamsInput, index).value(); + } else { + return SubtitleParams(); + } + } + void SetVideoParams(const VideoParams &video, int index = 0) { SetStandardValue(kVideoParamsInput, QVariant::fromValue(video), index); @@ -98,6 +109,11 @@ public: SetStandardValue(kAudioParamsInput, QVariant::fromValue(audio), index); } + void SetSubtitleParams(const SubtitleParams &subs, int index = 0) + { + SetStandardValue(kSubtitleParamsInput, QVariant::fromValue(subs), index); + } + int GetVideoStreamCount() const { return InputArraySize(kVideoParamsInput); @@ -108,16 +124,23 @@ public: return InputArraySize(kAudioParamsInput); } + int GetSubtitleStreamCount() const + { + return InputArraySize(kSubtitleParamsInput); + } + int GetTotalStreamCount() const { - return GetVideoStreamCount() + GetAudioStreamCount(); + return GetVideoStreamCount() + GetAudioStreamCount() + GetSubtitleStreamCount(); } bool HasEnabledVideoStreams() const; bool HasEnabledAudioStreams() const; + bool HasEnabledSubtitleStreams() const; VideoParams GetFirstEnabledVideoStream() const; AudioParams GetFirstEnabledAudioStream() const; + SubtitleParams GetFirstEnabledSubtitleStream() const; const rational &GetLength() const { return last_length_; } const rational &GetVideoLength() const { return video_length_; } @@ -191,6 +214,7 @@ public: static const QString kVideoParamsInput; static const QString kAudioParamsInput; + static const QString kSubtitleParamsInput; static const QString kTextureInput; static const QString kSamplesInput; diff --git a/app/node/param.cpp b/app/node/param.cpp index 07a5c6510..34eb9d382 100644 --- a/app/node/param.cpp +++ b/app/node/param.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/param.h b/app/node/param.h index 4eb000191..4c57e9489 100644 --- a/app/node/param.h +++ b/app/node/param.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/CMakeLists.txt b/app/node/project/CMakeLists.txt index 3d2aded8b..b745ea86f 100644 --- a/app/node/project/CMakeLists.txt +++ b/app/node/project/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/project/folder/CMakeLists.txt b/app/node/project/folder/CMakeLists.txt index b14bf3a8a..d04701644 100644 --- a/app/node/project/folder/CMakeLists.txt +++ b/app/node/project/folder/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/project/folder/folder.cpp b/app/node/project/folder/folder.cpp index 7b017923f..3f8ffe700 100644 --- a/app/node/project/folder/folder.cpp +++ b/app/node/project/folder/folder.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/folder/folder.h b/app/node/project/folder/folder.h index 7c779719d..7274960f1 100644 --- a/app/node/project/folder/folder.h +++ b/app/node/project/folder/folder.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/footage/CMakeLists.txt b/app/node/project/footage/CMakeLists.txt index 30bb36560..4d277e07a 100644 --- a/app/node/project/footage/CMakeLists.txt +++ b/app/node/project/footage/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/project/footage/footage.cpp b/app/node/project/footage/footage.cpp index f2540152b..72f37dab2 100644 --- a/app/node/project/footage/footage.cpp +++ b/app/node/project/footage/footage.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -89,12 +89,8 @@ void Footage::InputValueChangedEvent(const QString &input, int element) FootageDescription footage_info; - if (QFileInfo::exists(meta_cache_file)) { - - // Load meta cache file - footage_info.Load(meta_cache_file); - - } else { + // Try to load footage info from cache + if (!QFileInfo::exists(meta_cache_file) || !footage_info.Load(meta_cache_file)) { // Probe and create cache QVector decoder_list = Decoder::ReceiveListOfAllDecoders(); @@ -124,6 +120,10 @@ void Footage::InputValueChangedEvent(const QString &input, int element) AddStream(Track::kAudio, QVariant::fromValue(footage_info.GetAudioStreams().at(i))); } + for (int i=0; i& GetSubtitleStreams() const + { + return subtitle_streams_; + } + private: + static constexpr unsigned kFootageMetaVersion = 2; + QString decoder_; QVector video_streams_; QVector audio_streams_; + QVector subtitle_streams_; + }; } diff --git a/app/node/project/project.cpp b/app/node/project/project.cpp index c4340b177..4cf192643 100644 --- a/app/node/project/project.cpp +++ b/app/node/project/project.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,6 +32,8 @@ namespace olive { +const QString Project::kItemMimeType = QStringLiteral("application/x-oliveprojectitemdata"); + Project::Project() : is_modified_(false), autorecovery_saved_(true) diff --git a/app/node/project/project.h b/app/node/project/project.h index 1119e26fc..09e7e8606 100644 --- a/app/node/project/project.h +++ b/app/node/project/project.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -117,6 +117,8 @@ public: */ static Project *GetProjectFromObject(const QObject *o); + static const QString kItemMimeType; + signals: void NameChanged(); diff --git a/app/node/project/projectsettings/CMakeLists.txt b/app/node/project/projectsettings/CMakeLists.txt index fa52b3e6e..fc7adab96 100644 --- a/app/node/project/projectsettings/CMakeLists.txt +++ b/app/node/project/projectsettings/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/project/projectsettings/projectsettings.cpp b/app/node/project/projectsettings/projectsettings.cpp index 59b3bedc0..93fb79127 100644 --- a/app/node/project/projectsettings/projectsettings.cpp +++ b/app/node/project/projectsettings/projectsettings.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/projectsettings/projectsettings.h b/app/node/project/projectsettings/projectsettings.h index 35b9d578c..ec1a972cd 100644 --- a/app/node/project/projectsettings/projectsettings.h +++ b/app/node/project/projectsettings/projectsettings.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/projectviewmodel.cpp b/app/node/project/projectviewmodel.cpp index e4af49620..3aefbb13d 100644 --- a/app/node/project/projectviewmodel.cpp +++ b/app/node/project/projectviewmodel.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -271,7 +271,7 @@ Qt::ItemFlags ProjectViewModel::flags(const QModelIndex &index) const QStringList ProjectViewModel::mimeTypes() const { // Allow data from this model and a file list from external sources - return {QStringLiteral("application/x-oliveprojectitemdata"), QStringLiteral("text/uri-list")}; + return {Project::kItemMimeType, QStringLiteral("text/uri-list")}; } QMimeData *ProjectViewModel::mimeData(const QModelIndexList &indexes) const @@ -312,7 +312,7 @@ QMimeData *ProjectViewModel::mimeData(const QModelIndexList &indexes) const } // Set byte array as the mime data and return the mime data - data->setData(QStringLiteral("application/x-oliveprojectitemdata"), encoded_data); + data->setData(Project::kItemMimeType, encoded_data); return data; } @@ -331,9 +331,9 @@ bool ProjectViewModel::dropMimeData(const QMimeData *data, Qt::DropAction action // Probe mime data for its format QStringList mime_formats = data->formats(); - if (mime_formats.contains(QStringLiteral("application/x-oliveprojectitemdata"))) { + if (mime_formats.contains(Project::kItemMimeType)) { // Data is drag/drop data from this model - QByteArray model_data = data->data(QStringLiteral("application/x-oliveprojectitemdata")); + QByteArray model_data = data->data(Project::kItemMimeType); // Use QDataStream to deserialize the data QDataStream stream(&model_data, QIODevice::ReadOnly); diff --git a/app/node/project/projectviewmodel.h b/app/node/project/projectviewmodel.h index 9528439f0..c4fd74bc5 100644 --- a/app/node/project/projectviewmodel.h +++ b/app/node/project/projectviewmodel.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/sequence/CMakeLists.txt b/app/node/project/sequence/CMakeLists.txt index 39b4b9eb4..4da66c716 100644 --- a/app/node/project/sequence/CMakeLists.txt +++ b/app/node/project/sequence/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/project/sequence/sequence.cpp b/app/node/project/sequence/sequence.cpp index 8829089dd..df0a970fd 100644 --- a/app/node/project/sequence/sequence.cpp +++ b/app/node/project/sequence/sequence.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/sequence/sequence.h b/app/node/project/sequence/sequence.h index d07a89c4f..25220a4f5 100644 --- a/app/node/project/sequence/sequence.h +++ b/app/node/project/sequence/sequence.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/serializer/CMakeLists.txt b/app/node/project/serializer/CMakeLists.txt index 44201649c..829e559bb 100644 --- a/app/node/project/serializer/CMakeLists.txt +++ b/app/node/project/serializer/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/project/serializer/serializer.cpp b/app/node/project/serializer/serializer.cpp index 67bd879f7..362d48dc5 100644 --- a/app/node/project/serializer/serializer.cpp +++ b/app/node/project/serializer/serializer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/serializer/serializer.h b/app/node/project/serializer/serializer.h index cd6b99082..831c98d44 100644 --- a/app/node/project/serializer/serializer.h +++ b/app/node/project/serializer/serializer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,6 +55,7 @@ public: }; using SerializedProperties = QHash >; + using SerializedKeyframes = QHash >; class LoadData { @@ -65,6 +66,8 @@ public: std::vector markers; + SerializedKeyframes keyframes; + }; class Result @@ -105,7 +108,7 @@ public: class SaveData { public: - SaveData(Project *project, const QString &filename = QString()) + SaveData(Project *project = nullptr, const QString &filename = QString()) { project_ = project; filename_ = filename; @@ -128,6 +131,9 @@ public: const std::vector &GetOnlySerializeMarkers() const { return only_serialize_markers_; } void SetOnlySerializeMarkers(const std::vector &only) { only_serialize_markers_ = only; } + const std::vector &GetOnlySerializeKeyframes() const { return only_serialize_keyframes_; } + void SetOnlySerializeKeyframes(const std::vector &only) { only_serialize_keyframes_ = only; } + const SerializedProperties &GetProperties() const { return properties_; } void SetProperties(const SerializedProperties &p) { properties_ = p; } @@ -142,6 +148,8 @@ public: std::vector only_serialize_markers_; + std::vector only_serialize_keyframes_; + }; static void Initialize(); diff --git a/app/node/project/serializer/serializer190219.cpp b/app/node/project/serializer/serializer190219.cpp index 6e81bc494..0da1a405c 100644 --- a/app/node/project/serializer/serializer190219.cpp +++ b/app/node/project/serializer/serializer190219.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/serializer/serializer190219.h b/app/node/project/serializer/serializer190219.h index 159904c7c..f8f5a598c 100644 --- a/app/node/project/serializer/serializer190219.h +++ b/app/node/project/serializer/serializer190219.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/serializer/serializer210528.cpp b/app/node/project/serializer/serializer210528.cpp index 47700b240..8a2294b48 100644 --- a/app/node/project/serializer/serializer210528.cpp +++ b/app/node/project/serializer/serializer210528.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/serializer/serializer210528.h b/app/node/project/serializer/serializer210528.h index 3935ac424..2bf195064 100644 --- a/app/node/project/serializer/serializer210528.h +++ b/app/node/project/serializer/serializer210528.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/serializer/serializer210907.cpp b/app/node/project/serializer/serializer210907.cpp index b65678a04..0ab48339b 100644 --- a/app/node/project/serializer/serializer210907.cpp +++ b/app/node/project/serializer/serializer210907.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/serializer/serializer210907.h b/app/node/project/serializer/serializer210907.h index ffbabf0bc..6a56d43b5 100644 --- a/app/node/project/serializer/serializer210907.h +++ b/app/node/project/serializer/serializer210907.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/serializer/serializer211228.cpp b/app/node/project/serializer/serializer211228.cpp index 70ae3b494..cbd8cf57f 100644 --- a/app/node/project/serializer/serializer211228.cpp +++ b/app/node/project/serializer/serializer211228.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/serializer/serializer211228.h b/app/node/project/serializer/serializer211228.h index 20982c07a..49733a5d7 100644 --- a/app/node/project/serializer/serializer211228.h +++ b/app/node/project/serializer/serializer211228.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/project/serializer/serializer220403.cpp b/app/node/project/serializer/serializer220403.cpp index c64e420bf..5a0a39822 100644 --- a/app/node/project/serializer/serializer220403.cpp +++ b/app/node/project/serializer/serializer220403.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -99,6 +99,102 @@ ProjectSerializer220403::LoadData ProjectSerializer220403::Load(Project *project } } + } else if (reader->name() == QStringLiteral("keyframes")) { + + while (XMLReadNextStartElement(reader)) { + if (reader->name() == QStringLiteral("node")) { + QString node_id; + XMLAttributeLoop(reader, attr) { + if (attr.name() == QStringLiteral("id")) { + node_id = attr.value().toString(); + break; + } + } + + Node *n = nullptr; + if (!node_id.isEmpty()) { + n = NodeFactory::CreateFromID(node_id); + } + + if (!n) { + reader->skipCurrentElement(); + } else { + while (XMLReadNextStartElement(reader)) { + if (reader->name() == QStringLiteral("input")) { + QString input_id; + XMLAttributeLoop(reader, attr) { + if (attr.name() == QStringLiteral("id")) { + input_id = attr.value().toString(); + break; + } + } + + if (input_id.isEmpty()) { + reader->skipCurrentElement(); + } else { + while (XMLReadNextStartElement(reader)) { + if (reader->name() == QStringLiteral("element")) { + QString element_id; + XMLAttributeLoop(reader, attr) { + if (attr.name() == QStringLiteral("id")) { + element_id = attr.value().toString(); + break; + } + } + + if (element_id.isEmpty()) { + reader->skipCurrentElement(); + } else { + while (XMLReadNextStartElement(reader)) { + if (reader->name() == QStringLiteral("track")) { + QString track_id; + XMLAttributeLoop(reader, attr) { + if (attr.name() == QStringLiteral("id")) { + track_id = attr.value().toString(); + break; + } + } + + if (track_id.isEmpty()) { + reader->skipCurrentElement(); + } else { + while (XMLReadNextStartElement(reader)) { + if (reader->name() == QStringLiteral("key")) { + NodeKeyframe *key = new NodeKeyframe(); + key->set_input(input_id); + key->set_element(element_id.toInt()); + key->set_track(track_id.toInt()); + + LoadKeyframe(reader, key, n->GetInputDataType(input_id)); + + load_data.keyframes[node_id].append(key); + } else { + reader->skipCurrentElement(); + } + } + } + } else { + reader->skipCurrentElement(); + } + } + } + } else { + reader->skipCurrentElement(); + } + } + } + } else { + reader->skipCurrentElement(); + } + } + } + + delete n; + } else { + reader->skipCurrentElement(); + } + } + } else if (reader->name() == QStringLiteral("markers")) { while (XMLReadNextStartElement(reader)) { @@ -221,8 +317,6 @@ ProjectSerializer220403::LoadData ProjectSerializer220403::Load(Project *project void ProjectSerializer220403::Save(QXmlStreamWriter *writer, const SaveData &data, void *reserved) const { - Project *project = data.GetProject(); - if (!data.GetOnlySerializeMarkers().empty()) { writer->writeStartElement(QStringLiteral("markers")); @@ -239,9 +333,63 @@ void ProjectSerializer220403::Save(QXmlStreamWriter *writer, const SaveData &dat writer->writeEndElement(); // markers - } else { + } else if (!data.GetOnlySerializeKeyframes().empty()) { - writer->writeTextElement(QStringLiteral("uuid"), data.GetProject()->GetUuid().toString()); + writer->writeStartElement(QStringLiteral("keyframes")); + + // Organize keyframes into node+input + QHash > > > > organized; + + for (auto it=data.GetOnlySerializeKeyframes().cbegin(); it!=data.GetOnlySerializeKeyframes().cend(); it++) { + NodeKeyframe *key = *it; + organized[key->parent()->id()][key->input()][key->element()][key->track()].append(key); + } + + for (auto it=organized.cbegin(); it!=organized.cend(); it++) { + writer->writeStartElement(QStringLiteral("node")); + + writer->writeAttribute(QStringLiteral("id"), it.key()); + + for (auto jt=it.value().cbegin(); jt!=it.value().cend(); jt++) { + writer->writeStartElement(QStringLiteral("input")); + + writer->writeAttribute(QStringLiteral("id"), jt.key()); + + for (auto kt=jt.value().cbegin(); kt!=jt.value().cend(); kt++) { + writer->writeStartElement(QStringLiteral("element")); + + writer->writeAttribute(QStringLiteral("id"), QString::number(kt.key())); + + for (auto lt=kt.value().cbegin(); lt!=kt.value().cend(); lt++) { + const QVector &keys = lt.value(); + + writer->writeStartElement(QStringLiteral("track")); + + writer->writeAttribute(QStringLiteral("id"), QString::number(lt.key())); + + for (NodeKeyframe *key : keys) { + writer->writeStartElement(QStringLiteral("key")); + SaveKeyframe(writer, key, key->parent()->GetInputDataType(key->input())); + writer->writeEndElement(); // key + } + + writer->writeEndElement(); // track + } + + writer->writeEndElement(); // element + } + + writer->writeEndElement(); // input + } + + writer->writeEndElement(); // node; + } + + writer->writeEndElement(); // keyframes + + } else if (Project *project = data.GetProject()) { + + writer->writeTextElement(QStringLiteral("uuid"), project->GetUuid().toString()); writer->writeStartElement(QStringLiteral("nodes")); @@ -310,6 +458,10 @@ void ProjectSerializer220403::Save(QXmlStreamWriter *writer, const SaveData &dat // Save main window project layout project->GetLayoutInfo().toXml(writer); + } else { + + qCritical() << "Cannot save nodes without project object"; + } } @@ -548,6 +700,14 @@ void ProjectSerializer220403::LoadImmediate(QXmlStreamReader *reader, Node *node NodeValue::Type data_type = node->GetInputDataType(input); + // HACK: SubtitleParams contain the actual subtitle data, so loading/replacing it will overwrite + // the valid subtitles. We hack around it by simply skipping loading subtitles, we'll see + // if this ends up being an issue in the future. + if (data_type == NodeValue::kSubtitleParams) { + reader->skipCurrentElement(); + return; + } + while (XMLReadNextStartElement(reader)) { if (reader->name() == QStringLiteral("standard")) { // Load standard value @@ -601,40 +761,13 @@ void ProjectSerializer220403::LoadImmediate(QXmlStreamReader *reader, Node *node } if (reader->name() == QStringLiteral("key")) { - QString key_input; - rational key_time; - NodeKeyframe::Type key_type = NodeKeyframe::kLinear; - QVariant key_value; - QPointF key_in_handle; - QPointF key_out_handle; + NodeKeyframe* key = new NodeKeyframe(); + key->set_input(input); + key->set_element(element); + key->set_track(track); - XMLAttributeLoop(reader, attr) { - if (IsCancelled()) { - return; - } - - if (attr.name() == QStringLiteral("input")) { - key_input = attr.value().toString(); - } else if (attr.name() == QStringLiteral("time")) { - key_time = rational::fromString(attr.value().toString()); - } else if (attr.name() == QStringLiteral("type")) { - key_type = static_cast(attr.value().toInt()); - } else if (attr.name() == QStringLiteral("inhandlex")) { - key_in_handle.setX(attr.value().toDouble()); - } else if (attr.name() == QStringLiteral("inhandley")) { - key_in_handle.setY(attr.value().toDouble()); - } else if (attr.name() == QStringLiteral("outhandlex")) { - key_out_handle.setX(attr.value().toDouble()); - } else if (attr.name() == QStringLiteral("outhandley")) { - key_out_handle.setY(attr.value().toDouble()); - } - } - - key_value = NodeValue::StringToValue(data_type, reader->readElementText(), true); - - NodeKeyframe* key = new NodeKeyframe(key_time, key_value, key_type, track, element, key_input, node); - key->set_bezier_control_in(key_in_handle); - key->set_bezier_control_out(key_out_handle); + LoadKeyframe(reader, key, data_type); + key->setParent(node); } else { reader->skipCurrentElement(); } @@ -695,15 +828,7 @@ void ProjectSerializer220403::SaveImmediate(QXmlStreamWriter *writer, Node *node for (NodeKeyframe* key : track) { writer->writeStartElement(QStringLiteral("key")); - writer->writeAttribute(QStringLiteral("input"), key->input()); - writer->writeAttribute(QStringLiteral("time"), key->time().toString()); - writer->writeAttribute(QStringLiteral("type"), QString::number(key->type())); - writer->writeAttribute(QStringLiteral("inhandlex"), QString::number(key->bezier_control_in().x())); - writer->writeAttribute(QStringLiteral("inhandley"), QString::number(key->bezier_control_in().y())); - writer->writeAttribute(QStringLiteral("outhandlex"), QString::number(key->bezier_control_out().x())); - writer->writeAttribute(QStringLiteral("outhandley"), QString::number(key->bezier_control_out().y())); - - writer->writeCharacters(NodeValue::ValueToString(data_type, key->value(), true)); + SaveKeyframe(writer, key, data_type); writer->writeEndElement(); // key } @@ -722,6 +847,53 @@ void ProjectSerializer220403::SaveImmediate(QXmlStreamWriter *writer, Node *node } } +void ProjectSerializer220403::LoadKeyframe(QXmlStreamReader *reader, NodeKeyframe *key, NodeValue::Type data_type) const +{ + QString key_input; + QPointF key_in_handle; + QPointF key_out_handle; + + XMLAttributeLoop(reader, attr) { + if (IsCancelled()) { + return; + } + + if (attr.name() == QStringLiteral("input")) { + key_input = attr.value().toString(); + } else if (attr.name() == QStringLiteral("time")) { + key->set_time(rational::fromString(attr.value().toString())); + } else if (attr.name() == QStringLiteral("type")) { + key->set_type(static_cast(attr.value().toInt())); + } else if (attr.name() == QStringLiteral("inhandlex")) { + key_in_handle.setX(attr.value().toDouble()); + } else if (attr.name() == QStringLiteral("inhandley")) { + key_in_handle.setY(attr.value().toDouble()); + } else if (attr.name() == QStringLiteral("outhandlex")) { + key_out_handle.setX(attr.value().toDouble()); + } else if (attr.name() == QStringLiteral("outhandley")) { + key_out_handle.setY(attr.value().toDouble()); + } + } + + key->set_value(NodeValue::StringToValue(data_type, reader->readElementText(), true)); + + key->set_bezier_control_in(key_in_handle); + key->set_bezier_control_out(key_out_handle); +} + +void ProjectSerializer220403::SaveKeyframe(QXmlStreamWriter *writer, NodeKeyframe *key, NodeValue::Type data_type) const +{ + writer->writeAttribute(QStringLiteral("input"), key->input()); + writer->writeAttribute(QStringLiteral("time"), key->time().toString()); + writer->writeAttribute(QStringLiteral("type"), QString::number(key->type())); + writer->writeAttribute(QStringLiteral("inhandlex"), QString::number(key->bezier_control_in().x())); + writer->writeAttribute(QStringLiteral("inhandley"), QString::number(key->bezier_control_in().y())); + writer->writeAttribute(QStringLiteral("outhandlex"), QString::number(key->bezier_control_out().x())); + writer->writeAttribute(QStringLiteral("outhandley"), QString::number(key->bezier_control_out().y())); + + writer->writeCharacters(NodeValue::ValueToString(data_type, key->value(), true)); +} + bool ProjectSerializer220403::LoadPosition(QXmlStreamReader *reader, quintptr *node_ptr, Node::Position *pos) const { bool got_node_ptr = false; @@ -1011,8 +1183,8 @@ void ProjectSerializer220403::LoadMarker(QXmlStreamReader *reader, TimelineMarke void ProjectSerializer220403::SaveMarker(QXmlStreamWriter *writer, TimelineMarker *marker) const { writer->writeAttribute(QStringLiteral("name"), marker->name()); - writer->writeAttribute(QStringLiteral("in"), marker->time_range().in().toString()); - writer->writeAttribute(QStringLiteral("out"), marker->time_range().out().toString()); + writer->writeAttribute(QStringLiteral("in"), marker->time().in().toString()); + writer->writeAttribute(QStringLiteral("out"), marker->time().out().toString()); writer->writeAttribute(QStringLiteral("color"), QString::number(marker->color())); } diff --git a/app/node/project/serializer/serializer220403.h b/app/node/project/serializer/serializer220403.h index 16de30679..4612b2fce 100644 --- a/app/node/project/serializer/serializer220403.h +++ b/app/node/project/serializer/serializer220403.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -86,6 +86,10 @@ private: void SaveImmediate(QXmlStreamWriter *writer, Node *node, const QString &input, int element) const; + void LoadKeyframe(QXmlStreamReader *reader, NodeKeyframe *key, NodeValue::Type data_type) const; + + void SaveKeyframe(QXmlStreamWriter *writer, NodeKeyframe *key, NodeValue::Type data_type) const; + bool LoadPosition(QXmlStreamReader *reader, quintptr *node_ptr, Node::Position *pos) const; void SavePosition(QXmlStreamWriter *writer, Node *node, const Node::Position &pos) const; diff --git a/app/node/splitvalue.h b/app/node/splitvalue.h index bebe457eb..2a1d2a49c 100644 --- a/app/node/splitvalue.h +++ b/app/node/splitvalue.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/time/CMakeLists.txt b/app/node/time/CMakeLists.txt index a038672fb..e23a85367 100644 --- a/app/node/time/CMakeLists.txt +++ b/app/node/time/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/time/timeoffset/CMakeLists.txt b/app/node/time/timeoffset/CMakeLists.txt index b3976d54b..03afa72c3 100644 --- a/app/node/time/timeoffset/CMakeLists.txt +++ b/app/node/time/timeoffset/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/time/timeoffset/timeoffsetnode.cpp b/app/node/time/timeoffset/timeoffsetnode.cpp index 1a980c663..98fc2c6d0 100644 --- a/app/node/time/timeoffset/timeoffsetnode.cpp +++ b/app/node/time/timeoffset/timeoffsetnode.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/time/timeoffset/timeoffsetnode.h b/app/node/time/timeoffset/timeoffsetnode.h index 9359fbefc..56f1c0711 100644 --- a/app/node/time/timeoffset/timeoffsetnode.h +++ b/app/node/time/timeoffset/timeoffsetnode.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/time/timeremap/CMakeLists.txt b/app/node/time/timeremap/CMakeLists.txt index 180c9ef5e..f15e4dc03 100644 --- a/app/node/time/timeremap/CMakeLists.txt +++ b/app/node/time/timeremap/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/node/time/timeremap/timeremap.cpp b/app/node/time/timeremap/timeremap.cpp index 7f1fb5c49..2c1d0d2c5 100644 --- a/app/node/time/timeremap/timeremap.cpp +++ b/app/node/time/timeremap/timeremap.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/time/timeremap/timeremap.h b/app/node/time/timeremap/timeremap.h index 82937128b..8efd60ed0 100644 --- a/app/node/time/timeremap/timeremap.h +++ b/app/node/time/timeremap/timeremap.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/traverser.cpp b/app/node/traverser.cpp index 2139bae4d..1b179f5fa 100644 --- a/app/node/traverser.cpp +++ b/app/node/traverser.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -141,6 +141,17 @@ int NodeTraverser::GenerateRowValueElementIndex(const Node *node, const QString return GenerateRowValueElementIndex(node->GetValueHintForInput(input, element), node->GetInputDataType(input), table); } +void NodeTraverser::Transform(QTransform *transform, const Node *start, const Node *end, const TimeRange &range) +{ + transform_ = transform; + transform_start_ = start; + transform_now_ = nullptr; + + GenerateTable(end, range); + + transform_ = nullptr; +} + NodeGlobals NodeTraverser::GenerateGlobals(const VideoParams ¶ms, const TimeRange &time) { return NodeGlobals(QVector2D(params.width(), params.height()), params.pixel_aspect_ratio(), time); @@ -179,6 +190,20 @@ int NodeTraverser::GetChannelCountFromJob(const GenerateJob &job) return VideoParams::kRGBAChannelCount; } +TexturePtr NodeTraverser::GetMainTextureFromJob(const GenerateJob &job) +{ + // FIXME: Should probably take Node::GetEffectInput into account here + for (auto it=job.GetValues().cbegin(); it!=job.GetValues().cend(); it++) { + if (it.value().type() == NodeValue::kTexture) { + if (TexturePtr t = it.value().toTexture()) { + return t; + } + } + } + + return nullptr; +} + NodeValueTable NodeTraverser::ProcessInput(const Node* node, const QString& input, const TimeRange& range) { // If input is connected, retrieve value directly @@ -187,7 +212,9 @@ NodeValueTable NodeTraverser::ProcessInput(const Node* node, const QString& inpu TimeRange adjusted_range = node->InputTimeAdjustment(input, -1, range); // Value will equal something from the connected node, follow it - return GenerateTable(node->GetConnectedOutput(input), node->GetValueHintForInput(input), adjusted_range); + Node *output = node->GetConnectedOutput(input); + NodeValueTable table = GenerateTable(output, adjusted_range, node); + return table; } else { @@ -205,7 +232,8 @@ NodeValueTable NodeTraverser::ProcessInput(const Node* node, const QString& inpu TimeRange adjusted_range = node->InputTimeAdjustment(input, i, range); if (node->IsInputConnected(input, i)) { - sub_tbl = GenerateTable(node->GetConnectedOutput(input, i), node->GetValueHintForInput(input, i), adjusted_range); + Node *output = node->GetConnectedOutput(input, i); + sub_tbl = GenerateTable(output, adjusted_range, node); } else { QVariant input_value = node->GetValueAtTime(input, adjusted_range.in(), i); sub_tbl.Push(node->GetInputDataType(input), input_value, node); @@ -231,12 +259,28 @@ NodeValueTable NodeTraverser::ProcessInput(const Node* node, const QString& inpu } NodeTraverser::NodeTraverser() : - cancel_(nullptr) + cancel_(nullptr), + transform_(nullptr) { } -NodeValueTable NodeTraverser::GenerateTable(const Node *n, const Node::ValueHint &hint, const TimeRange& range) +class GTTTime { +public: + GTTTime(const Node *n) { t = QDateTime::currentMSecsSinceEpoch(); node = n; } + + ~GTTTime() { qDebug() << "GT for" << node << "took" << (QDateTime::currentMSecsSinceEpoch() - t); } + + qint64 t; + const Node *node; + +}; + +NodeValueTable NodeTraverser::GenerateTable(const Node *n, const TimeRange& range, const Node *next_node) +{ + // NOTE: Times how long a node takes to process, useful for profiling. + //GTTTime gtt(n);Q_UNUSED(gtt); + const Track* track = dynamic_cast(n); if (track) { // If the range is not wholly contained in this Block, we'll need to do some extra processing @@ -264,7 +308,24 @@ NodeValueTable NodeTraverser::GenerateTable(const Node *n, const Node::ValueHint NodeValueTable table = database.Merge(); // By this point, the node should have all the inputs it needs to render correctly - n->Value(row, GenerateGlobals(video_params_, range), &table); + NodeGlobals globals = GenerateGlobals(video_params_, range); + n->Value(row, globals, &table); + + // `transform_now_` is the next node in the path that needs to be traversed. It only ever goes + // "down" the graph so that any traversing going back up doesn't unnecessarily transform + // from unrelated nodes or the same node twice + if (transform_) { + if (transform_now_ == n || transform_start_ == n) { + if (transform_now_ == n) { + QTransform t = n->GizmoTransformation(row, globals); + if (!t.isIdentity()) { + (*transform_) *= t; + } + } + + transform_now_ = next_node; + } + } return table; } else { @@ -288,7 +349,7 @@ NodeValueTable NodeTraverser::GenerateBlockTable(const Track *track, const TimeR NodeValueTable table; if (active_block) { - table = GenerateTable(active_block, track->GetValueHintForInput(Track::kBlockInput, track->GetArrayIndexFromBlock(active_block)), Track::TransformRangeForBlock(active_block, range)); + table = GenerateTable(active_block, Track::TransformRangeForBlock(active_block, range), track); } return table; @@ -307,12 +368,21 @@ void NodeTraverser::ResolveJobs(NodeValue &val, const TimeRange &range) ShaderJob job = val.value(); + PreProcessRow(range, job.GetValues()); + VideoParams tex_params = GetCacheVideoParams(); tex_params.set_channel_count(GetChannelCountFromJob(job)); + if (!job.GetWillChangeImageSize()) { + if (TexturePtr texture = GetMainTextureFromJob(job)) { + tex_params.set_width(texture->params().width()); + tex_params.set_height(texture->params().height()); + tex_params.set_divider(texture->params().divider()); + } + } + TexturePtr tex = CreateTexture(tex_params); - PreProcessRow(range, job.GetValues()); ProcessShader(tex, val.source(), range, job); val.set_value(tex); diff --git a/app/node/traverser.h b/app/node/traverser.h index 090599673..afe56db2b 100644 --- a/app/node/traverser.h +++ b/app/node/traverser.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ class NodeTraverser public: NodeTraverser(); - NodeValueTable GenerateTable(const Node *n, const Node::ValueHint &hint, const TimeRange &range); + NodeValueTable GenerateTable(const Node *n, const TimeRange &range, const Node *next_node = nullptr); NodeValueDatabase GenerateDatabase(const Node *node, const TimeRange &range); @@ -50,6 +50,8 @@ public: int GenerateRowValueElementIndex(const Node::ValueHint &hint, NodeValue::Type preferred_type, const NodeValueTable *table); int GenerateRowValueElementIndex(const Node *node, const QString &input, int element, const NodeValueTable *table); + void Transform(QTransform *transform, const Node *start, const Node *end, const TimeRange &range); + static NodeGlobals GenerateGlobals(const VideoParams ¶ms, const TimeRange &time); static NodeGlobals GenerateGlobals(const VideoParams ¶ms, const rational &time) { @@ -78,6 +80,8 @@ public: static int GetChannelCountFromJob(const GenerateJob& job); + static TexturePtr GetMainTextureFromJob(const GenerateJob& job); + protected: NodeValueTable ProcessInput(const Node *node, const QString &input, const TimeRange &range); @@ -152,6 +156,10 @@ private: const QAtomicInt *cancel_; + const Node *transform_start_; + const Node *transform_now_; + QTransform *transform_; + }; } diff --git a/app/node/value.cpp b/app/node/value.cpp index 5cc7e9bc5..7a2d875bf 100644 --- a/app/node/value.cpp +++ b/app/node/value.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,6 +29,7 @@ #include "common/bezier.h" #include "common/tohex.h" #include "render/audioparams.h" +#include "render/subtitleparams.h" #include "render/videoparams.h" #include "render/color.h" @@ -297,6 +298,8 @@ QString NodeValue::GetPrettyDataTypeName(Type type) return QCoreApplication::translate("NodeValue", "Video Parameters"); case kAudioParams: return QCoreApplication::translate("NodeValue", "Audio Parameters"); + case kSubtitleParams: + return QCoreApplication::translate("NodeValue", "Subtitle Parameters"); case kDataTypeCount: break; @@ -346,6 +349,8 @@ QString NodeValue::GetDataTypeName(Type type) return QStringLiteral("vparam"); case kAudioParams: return QStringLiteral("aparam"); + case kSubtitleParams: + return QStringLiteral("sparam"); case kDataTypeCount: break; } diff --git a/app/node/value.h b/app/node/value.h index c22615112..6cf1e537d 100644 --- a/app/node/value.h +++ b/app/node/value.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -178,6 +178,13 @@ public: */ kAudioParams, + /** + * Subtitle Parameters type + * + * Resolves to `SubtitleParams` + */ + kSubtitleParams, + /** * End of list */ diff --git a/app/node/valuedatabase.cpp b/app/node/valuedatabase.cpp index 129a5ea78..f83e2a7f8 100644 --- a/app/node/valuedatabase.cpp +++ b/app/node/valuedatabase.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/node/valuedatabase.h b/app/node/valuedatabase.h index 80574b371..27745ee27 100644 --- a/app/node/valuedatabase.h +++ b/app/node/valuedatabase.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/packaging/CMakeLists.txt b/app/packaging/CMakeLists.txt index b09591801..aa007f6d7 100644 --- a/app/packaging/CMakeLists.txt +++ b/app/packaging/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/packaging/linux/CMakeLists.txt b/app/packaging/linux/CMakeLists.txt index 5ff1ecf61..1696a9162 100644 --- a/app/packaging/linux/CMakeLists.txt +++ b/app/packaging/linux/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/CMakeLists.txt b/app/panel/CMakeLists.txt index 4042890ba..e13af427d 100644 --- a/app/panel/CMakeLists.txt +++ b/app/panel/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/audiomonitor/CMakeLists.txt b/app/panel/audiomonitor/CMakeLists.txt index 611f13bb2..0fcf37b09 100644 --- a/app/panel/audiomonitor/CMakeLists.txt +++ b/app/panel/audiomonitor/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/audiomonitor/audiomonitor.cpp b/app/panel/audiomonitor/audiomonitor.cpp index 63e069940..84297447a 100644 --- a/app/panel/audiomonitor/audiomonitor.cpp +++ b/app/panel/audiomonitor/audiomonitor.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/audiomonitor/audiomonitor.h b/app/panel/audiomonitor/audiomonitor.h index 5d4b49c49..2c76d60da 100644 --- a/app/panel/audiomonitor/audiomonitor.h +++ b/app/panel/audiomonitor/audiomonitor.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/curve/CMakeLists.txt b/app/panel/curve/CMakeLists.txt index 5741ba791..b7a2ad77a 100644 --- a/app/panel/curve/CMakeLists.txt +++ b/app/panel/curve/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/curve/curve.cpp b/app/panel/curve/curve.cpp index 00f81e3d6..7083520b9 100644 --- a/app/panel/curve/curve.cpp +++ b/app/panel/curve/curve.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/curve/curve.h b/app/panel/curve/curve.h index 6ddc14401..7d93d3e58 100644 --- a/app/panel/curve/curve.h +++ b/app/panel/curve/curve.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/footageviewer/CMakeLists.txt b/app/panel/footageviewer/CMakeLists.txt index c060b6257..c8fd5d56d 100644 --- a/app/panel/footageviewer/CMakeLists.txt +++ b/app/panel/footageviewer/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/footageviewer/footageviewer.cpp b/app/panel/footageviewer/footageviewer.cpp index 0ab847be7..ebb86a007 100644 --- a/app/panel/footageviewer/footageviewer.cpp +++ b/app/panel/footageviewer/footageviewer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/footageviewer/footageviewer.h b/app/panel/footageviewer/footageviewer.h index f7bc7c93d..2b07cc233 100644 --- a/app/panel/footageviewer/footageviewer.h +++ b/app/panel/footageviewer/footageviewer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/node/CMakeLists.txt b/app/panel/node/CMakeLists.txt index 38f04b28e..5acf9e114 100644 --- a/app/panel/node/CMakeLists.txt +++ b/app/panel/node/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/node/node.cpp b/app/panel/node/node.cpp index d618c7d80..85abaf465 100644 --- a/app/panel/node/node.cpp +++ b/app/panel/node/node.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/node/node.h b/app/panel/node/node.h index c8ebccaaa..a572989c4 100644 --- a/app/panel/node/node.h +++ b/app/panel/node/node.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/panelmanager.cpp b/app/panel/panelmanager.cpp index edef10377..a85285a4f 100644 --- a/app/panel/panelmanager.cpp +++ b/app/panel/panelmanager.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/panelmanager.h b/app/panel/panelmanager.h index a71a312a3..23feeb02f 100644 --- a/app/panel/panelmanager.h +++ b/app/panel/panelmanager.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/param/CMakeLists.txt b/app/panel/param/CMakeLists.txt index 29a9f7831..5c8aaaa08 100644 --- a/app/panel/param/CMakeLists.txt +++ b/app/panel/param/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/param/param.cpp b/app/panel/param/param.cpp index 368a6abd2..48fb8dfdb 100644 --- a/app/panel/param/param.cpp +++ b/app/panel/param/param.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ ParamPanel::ParamPanel(QWidget* parent) : NodeParamView* view = new NodeParamView(); connect(view, &NodeParamView::FocusedNodeChanged, this, &ParamPanel::FocusedNodeChanged); connect(view, &NodeParamView::SelectedNodesChanged, this, &ParamPanel::SelectedNodesChanged); + connect(view, &NodeParamView::RequestViewerToStartEditingText, this, &ParamPanel::RequestViewerToStartEditingText); connect(this, &ParamPanel::visibilityChanged, view, &NodeParamView::UpdateElementY); SetTimeBasedWidget(view); diff --git a/app/panel/param/param.h b/app/panel/param/param.h index 9cfb881c0..5b55075ef 100644 --- a/app/panel/param/param.h +++ b/app/panel/param/param.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -67,6 +67,8 @@ signals: void SelectedNodesChanged(const QVector &nodes); + void RequestViewerToStartEditingText(); + protected: virtual void Retranslate() override; diff --git a/app/panel/pixelsampler/CMakeLists.txt b/app/panel/pixelsampler/CMakeLists.txt index b34a90b82..2be528575 100644 --- a/app/panel/pixelsampler/CMakeLists.txt +++ b/app/panel/pixelsampler/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/pixelsampler/pixelsamplerpanel.cpp b/app/panel/pixelsampler/pixelsamplerpanel.cpp index dce9fd698..080dd3ea8 100644 --- a/app/panel/pixelsampler/pixelsamplerpanel.cpp +++ b/app/panel/pixelsampler/pixelsamplerpanel.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/pixelsampler/pixelsamplerpanel.h b/app/panel/pixelsampler/pixelsamplerpanel.h index a77db10cc..38535d38b 100644 --- a/app/panel/pixelsampler/pixelsamplerpanel.h +++ b/app/panel/pixelsampler/pixelsamplerpanel.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/project/CMakeLists.txt b/app/panel/project/CMakeLists.txt index ce35a1ae2..17008939e 100644 --- a/app/panel/project/CMakeLists.txt +++ b/app/panel/project/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/project/footagemanagementpanel.h b/app/panel/project/footagemanagementpanel.h index e8d88a4d6..c6b0ebd86 100644 --- a/app/panel/project/footagemanagementpanel.h +++ b/app/panel/project/footagemanagementpanel.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/project/project.cpp b/app/panel/project/project.cpp index ec22e0124..d6c353330 100644 --- a/app/panel/project/project.cpp +++ b/app/panel/project/project.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/project/project.h b/app/panel/project/project.h index d2bc30341..c4720fe22 100644 --- a/app/panel/project/project.h +++ b/app/panel/project/project.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/scope/CMakeLists.txt b/app/panel/scope/CMakeLists.txt index a75626696..997f26d42 100644 --- a/app/panel/scope/CMakeLists.txt +++ b/app/panel/scope/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/scope/scope.cpp b/app/panel/scope/scope.cpp index 05560fe8b..27700bb5c 100644 --- a/app/panel/scope/scope.cpp +++ b/app/panel/scope/scope.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/scope/scope.h b/app/panel/scope/scope.h index 6e14cb0e3..f46ef9fba 100644 --- a/app/panel/scope/scope.h +++ b/app/panel/scope/scope.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/sequenceviewer/CMakeLists.txt b/app/panel/sequenceviewer/CMakeLists.txt index 5d29e5fd8..067b7a046 100644 --- a/app/panel/sequenceviewer/CMakeLists.txt +++ b/app/panel/sequenceviewer/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/sequenceviewer/sequenceviewer.cpp b/app/panel/sequenceviewer/sequenceviewer.cpp index 9a76f1a18..0b7bc0770 100644 --- a/app/panel/sequenceviewer/sequenceviewer.cpp +++ b/app/panel/sequenceviewer/sequenceviewer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/sequenceviewer/sequenceviewer.h b/app/panel/sequenceviewer/sequenceviewer.h index 486e762a8..941430ac6 100644 --- a/app/panel/sequenceviewer/sequenceviewer.h +++ b/app/panel/sequenceviewer/sequenceviewer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/table/CMakeLists.txt b/app/panel/table/CMakeLists.txt index d6e361988..9afcbf2fa 100644 --- a/app/panel/table/CMakeLists.txt +++ b/app/panel/table/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/table/table.cpp b/app/panel/table/table.cpp index 96a7a2d8d..15398c918 100644 --- a/app/panel/table/table.cpp +++ b/app/panel/table/table.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/table/table.h b/app/panel/table/table.h index 5f55ec5c1..ff990f36d 100644 --- a/app/panel/table/table.h +++ b/app/panel/table/table.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/taskmanager/CMakeLists.txt b/app/panel/taskmanager/CMakeLists.txt index fd3418cc1..cb56c2366 100644 --- a/app/panel/taskmanager/CMakeLists.txt +++ b/app/panel/taskmanager/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/taskmanager/taskmanager.cpp b/app/panel/taskmanager/taskmanager.cpp index a1213f70f..cf8d34579 100644 --- a/app/panel/taskmanager/taskmanager.cpp +++ b/app/panel/taskmanager/taskmanager.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/taskmanager/taskmanager.h b/app/panel/taskmanager/taskmanager.h index 1f79fdab6..1c84057d7 100644 --- a/app/panel/taskmanager/taskmanager.h +++ b/app/panel/taskmanager/taskmanager.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/timebased/CMakeLists.txt b/app/panel/timebased/CMakeLists.txt index 1c717f402..928f80e8f 100644 --- a/app/panel/timebased/CMakeLists.txt +++ b/app/panel/timebased/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/timebased/timebased.cpp b/app/panel/timebased/timebased.cpp index b2fabbec9..b10220dab 100644 --- a/app/panel/timebased/timebased.cpp +++ b/app/panel/timebased/timebased.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -216,4 +216,19 @@ void TimeBasedPanel::DeleteSelected() GetTimeBasedWidget()->DeleteSelected(); } +void TimeBasedPanel::CutSelected() +{ + GetTimeBasedWidget()->CopySelected(true); +} + +void TimeBasedPanel::CopySelected() +{ + GetTimeBasedWidget()->CopySelected(false); +} + +void TimeBasedPanel::Paste() +{ + GetTimeBasedWidget()->Paste(); +} + } diff --git a/app/panel/timebased/timebased.h b/app/panel/timebased/timebased.h index 380420bbc..dff33ccca 100644 --- a/app/panel/timebased/timebased.h +++ b/app/panel/timebased/timebased.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -100,6 +100,12 @@ public: virtual void DeleteSelected() override; + virtual void CutSelected() override; + + virtual void CopySelected() override; + + virtual void Paste() override; + public slots: void SetTimebase(const rational& timebase); diff --git a/app/panel/timeline/CMakeLists.txt b/app/panel/timeline/CMakeLists.txt index 5547db26b..67a6c3ca7 100644 --- a/app/panel/timeline/CMakeLists.txt +++ b/app/panel/timeline/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/timeline/timeline.cpp b/app/panel/timeline/timeline.cpp index 0eb45f0a4..f08f7b998 100644 --- a/app/panel/timeline/timeline.cpp +++ b/app/panel/timeline/timeline.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -108,24 +108,9 @@ void TimelinePanel::ToggleLinks() timeline_widget()->ToggleLinksOnSelected(); } -void TimelinePanel::CutSelected() -{ - timeline_widget()->CopySelected(true); -} - -void TimelinePanel::CopySelected() -{ - timeline_widget()->CopySelected(false); -} - -void TimelinePanel::Paste() -{ - timeline_widget()->Paste(false); -} - void TimelinePanel::PasteInsert() { - timeline_widget()->Paste(true); + timeline_widget()->PasteInsert(); } void TimelinePanel::DeleteInToOut() diff --git a/app/panel/timeline/timeline.h b/app/panel/timeline/timeline.h index 34b926bfd..90de35332 100644 --- a/app/panel/timeline/timeline.h +++ b/app/panel/timeline/timeline.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -68,12 +68,6 @@ public: virtual void ToggleLinks() override; - virtual void CutSelected() override; - - virtual void CopySelected() override; - - virtual void Paste() override; - virtual void PasteInsert() override; virtual void DeleteInToOut() override; diff --git a/app/panel/tool/CMakeLists.txt b/app/panel/tool/CMakeLists.txt index 18db0f3a2..4a115b032 100644 --- a/app/panel/tool/CMakeLists.txt +++ b/app/panel/tool/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/tool/tool.cpp b/app/panel/tool/tool.cpp index 0cb68a778..40ec95528 100644 --- a/app/panel/tool/tool.cpp +++ b/app/panel/tool/tool.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/tool/tool.h b/app/panel/tool/tool.h index 4e6586cb4..3e2c4534d 100644 --- a/app/panel/tool/tool.h +++ b/app/panel/tool/tool.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/viewer/CMakeLists.txt b/app/panel/viewer/CMakeLists.txt index 5d5f43928..1265ef695 100644 --- a/app/panel/viewer/CMakeLists.txt +++ b/app/panel/viewer/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/panel/viewer/viewer.cpp b/app/panel/viewer/viewer.cpp index ad9ca461d..49c77f941 100644 --- a/app/panel/viewer/viewer.cpp +++ b/app/panel/viewer/viewer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/viewer/viewer.h b/app/panel/viewer/viewer.h index 3b1cc4eb5..ff72bca7a 100644 --- a/app/panel/viewer/viewer.h +++ b/app/panel/viewer/viewer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/viewer/viewerbase.cpp b/app/panel/viewer/viewerbase.cpp index f06cd37b1..7076ae510 100644 --- a/app/panel/viewer/viewerbase.cpp +++ b/app/panel/viewer/viewerbase.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/panel/viewer/viewerbase.h b/app/panel/viewer/viewerbase.h index 8135f7056..e5fe7cdff 100644 --- a/app/panel/viewer/viewerbase.h +++ b/app/panel/viewer/viewerbase.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,6 +69,11 @@ public slots: void CacheSequenceInOut(); + void RequestStartEditingText() + { + static_cast(GetTimeBasedWidget())->RequestStartEditingText(); + } + signals: /** * @brief Signal emitted when a new frame is loaded diff --git a/app/render/CMakeLists.txt b/app/render/CMakeLists.txt index 35c7d78b6..8a37e1776 100644 --- a/app/render/CMakeLists.txt +++ b/app/render/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/render/alphaassoc.h b/app/render/alphaassoc.h index 22eb74835..b71fee481 100644 --- a/app/render/alphaassoc.h +++ b/app/render/alphaassoc.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/audioparams.cpp b/app/render/audioparams.cpp index 8663ed9d6..39680fce8 100644 --- a/app/render/audioparams.cpp +++ b/app/render/audioparams.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/audioparams.h b/app/render/audioparams.h index 4ed1fcfa5..2f195b645 100644 --- a/app/render/audioparams.h +++ b/app/render/audioparams.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/audioplaybackcache.cpp b/app/render/audioplaybackcache.cpp index f014a2cf6..8e4804696 100644 --- a/app/render/audioplaybackcache.cpp +++ b/app/render/audioplaybackcache.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/audioplaybackcache.h b/app/render/audioplaybackcache.h index 8a75b0173..739a38cb0 100644 --- a/app/render/audioplaybackcache.h +++ b/app/render/audioplaybackcache.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/color.cpp b/app/render/color.cpp index ea00896d4..a840244e0 100644 --- a/app/render/color.cpp +++ b/app/render/color.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/color.h b/app/render/color.h index 1d76f4ca0..ebaed9063 100644 --- a/app/render/color.h +++ b/app/render/color.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/colorprocessor.cpp b/app/render/colorprocessor.cpp index b7349e4b2..8cc4adb8d 100644 --- a/app/render/colorprocessor.cpp +++ b/app/render/colorprocessor.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/colorprocessor.h b/app/render/colorprocessor.h index 9d1c9130a..6d59a1b83 100644 --- a/app/render/colorprocessor.h +++ b/app/render/colorprocessor.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/colorprocessorcache.h b/app/render/colorprocessorcache.h index 94b5decda..596114d3b 100644 --- a/app/render/colorprocessorcache.h +++ b/app/render/colorprocessorcache.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/colortransform.h b/app/render/colortransform.h index ee8290795..df04c4147 100644 --- a/app/render/colortransform.h +++ b/app/render/colortransform.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/diskmanager.cpp b/app/render/diskmanager.cpp index c76c64bb9..3ec66816d 100644 --- a/app/render/diskmanager.cpp +++ b/app/render/diskmanager.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/diskmanager.h b/app/render/diskmanager.h index 0bd950659..09221086a 100644 --- a/app/render/diskmanager.h +++ b/app/render/diskmanager.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/framehashcache.cpp b/app/render/framehashcache.cpp index 46f9441f7..f3b7aa8ff 100644 --- a/app/render/framehashcache.cpp +++ b/app/render/framehashcache.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/framehashcache.h b/app/render/framehashcache.h index 014a1af7b..a4978a564 100644 --- a/app/render/framehashcache.h +++ b/app/render/framehashcache.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/framemanager.cpp b/app/render/framemanager.cpp index fdb789ee1..09466c403 100644 --- a/app/render/framemanager.cpp +++ b/app/render/framemanager.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/framemanager.h b/app/render/framemanager.h index dffc0203c..2f083dcbf 100644 --- a/app/render/framemanager.h +++ b/app/render/framemanager.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/job/CMakeLists.txt b/app/render/job/CMakeLists.txt index 8d64547d5..6ad233bbe 100644 --- a/app/render/job/CMakeLists.txt +++ b/app/render/job/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/render/job/acceleratedjob.cpp b/app/render/job/acceleratedjob.cpp index c53fc4f1e..c23739994 100644 --- a/app/render/job/acceleratedjob.cpp +++ b/app/render/job/acceleratedjob.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/job/acceleratedjob.h b/app/render/job/acceleratedjob.h index c09138585..9468a9a74 100644 --- a/app/render/job/acceleratedjob.h +++ b/app/render/job/acceleratedjob.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/job/colortransformjob.h b/app/render/job/colortransformjob.h index 18f48a7cb..da7846d2c 100644 --- a/app/render/job/colortransformjob.h +++ b/app/render/job/colortransformjob.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/job/footagejob.h b/app/render/job/footagejob.h index 7d674b3d5..6952d76b4 100644 --- a/app/render/job/footagejob.h +++ b/app/render/job/footagejob.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/job/generatejob.h b/app/render/job/generatejob.h index 465ba1609..38354aa55 100644 --- a/app/render/job/generatejob.h +++ b/app/render/job/generatejob.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/job/samplejob.h b/app/render/job/samplejob.h index f2cd928e6..15fd71dc9 100644 --- a/app/render/job/samplejob.h +++ b/app/render/job/samplejob.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/job/shaderjob.h b/app/render/job/shaderjob.h index 53cd836d6..0669e0c42 100644 --- a/app/render/job/shaderjob.h +++ b/app/render/job/shaderjob.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ public: { iterations_ = 1; iterative_input_ = nullptr; + will_change_image_size_ = true; } const QString& GetShaderID() const @@ -99,6 +100,9 @@ public: return vertex_overrides_; } + bool GetWillChangeImageSize() const { return will_change_image_size_; } + void SetWillChangeImageSize(bool e) { will_change_image_size_ = e; } + private: QString shader_id_; @@ -110,6 +114,8 @@ private: QVector vertex_overrides_; + bool will_change_image_size_; + }; } diff --git a/app/render/managedcolor.cpp b/app/render/managedcolor.cpp index df28d7dcc..6a6862cde 100644 --- a/app/render/managedcolor.cpp +++ b/app/render/managedcolor.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/managedcolor.h b/app/render/managedcolor.h index a5b607da1..3b3dd275b 100644 --- a/app/render/managedcolor.h +++ b/app/render/managedcolor.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/ocioconf/CMakeLists.txt b/app/render/ocioconf/CMakeLists.txt index 5f38063b0..51099b161 100644 --- a/app/render/ocioconf/CMakeLists.txt +++ b/app/render/ocioconf/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/render/opengl/CMakeLists.txt b/app/render/opengl/CMakeLists.txt index 7dbae5a95..f5ab4f652 100644 --- a/app/render/opengl/CMakeLists.txt +++ b/app/render/opengl/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/render/opengl/openglrenderer.cpp b/app/render/opengl/openglrenderer.cpp index 7f7119143..ade819167 100644 --- a/app/render/opengl/openglrenderer.cpp +++ b/app/render/opengl/openglrenderer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -422,8 +422,7 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video GL_PREAMBLE; // If this node is iterative, we'll pick up which input here - QString iterative_name; - GLuint iterative_input = 0; + QMap texture_index_map; QVector textures_to_bind; GLuint shader = s.value(); @@ -495,11 +494,7 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video // Set value to bound texture functions_->glUniform1i(variable_location, textures_to_bind.size()); - // If this texture binding is the iterative input, set it here - if (it.key() == job.GetIterativeInput()) { - iterative_input = textures_to_bind.size(); - iterative_name = it.key(); - } + texture_index_map.insert(it.key(), textures_to_bind.size()); textures_to_bind.append({texture, job.GetInterpolation(it.key())}); @@ -518,6 +513,7 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video case NodeValue::kFile: case NodeValue::kVideoParams: case NodeValue::kAudioParams: + case NodeValue::kSubtitleParams: case NodeValue::kBezier: case NodeValue::kNone: case NodeValue::kDataTypeCount: @@ -654,11 +650,12 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video if (iteration > 0) { // If this is not the first iteration, replace the iterative texture with the one we // last drew - functions_->glActiveTexture(GL_TEXTURE0 + iterative_input); + const QString &iterative_input = job.GetIterativeInput(); + functions_->glActiveTexture(GL_TEXTURE0 + texture_index_map.value(iterative_input)); functions_->glBindTexture(GL_TEXTURE_2D, input_tex->id().value()); // At this time, we only support iterating 2D textures - PrepareInputTexture(GL_TEXTURE_2D, job.GetInterpolation(iterative_name)); + PrepareInputTexture(GL_TEXTURE_2D, job.GetInterpolation(iterative_input)); } // Swap so that the next iteration, the texture we draw now will be the input texture next diff --git a/app/render/opengl/openglrenderer.h b/app/render/opengl/openglrenderer.h index decc1d20b..b1ec02474 100644 --- a/app/render/opengl/openglrenderer.h +++ b/app/render/opengl/openglrenderer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/playbackcache.cpp b/app/render/playbackcache.cpp index 2f225fd81..e88e65510 100644 --- a/app/render/playbackcache.cpp +++ b/app/render/playbackcache.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/playbackcache.h b/app/render/playbackcache.h index 1f66994d2..3572c053d 100644 --- a/app/render/playbackcache.h +++ b/app/render/playbackcache.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/previewaudiodevice.cpp b/app/render/previewaudiodevice.cpp index c275c2c12..cb09a9550 100644 --- a/app/render/previewaudiodevice.cpp +++ b/app/render/previewaudiodevice.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/previewaudiodevice.h b/app/render/previewaudiodevice.h index 6d796e2ff..818fbf309 100644 --- a/app/render/previewaudiodevice.h +++ b/app/render/previewaudiodevice.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/previewautocacher.cpp b/app/render/previewautocacher.cpp index e99c9408a..b51c4d6c3 100644 --- a/app/render/previewautocacher.cpp +++ b/app/render/previewautocacher.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -62,7 +62,7 @@ PreviewAutoCacher::~PreviewAutoCacher() SetViewerNode(nullptr); } -RenderTicketPtr PreviewAutoCacher::GetSingleFrame(const rational &t, bool prioritize) +RenderTicketPtr PreviewAutoCacher::GetSingleFrame(const rational &t, RenderTicketPriority priority) { // If we have a single frame render queued (but not yet sent to the RenderManager), cancel it now CancelQueuedSingleFrameRender(); @@ -71,7 +71,7 @@ RenderTicketPtr PreviewAutoCacher::GetSingleFrame(const rational &t, bool priori auto sfr = std::make_shared(); sfr->Start(); sfr->setProperty("time", QVariant::fromValue(t)); - sfr->setProperty("prioritize", prioritize); + sfr->setProperty("priority", int(priority)); // Queue it and try to render single_frame_render_ = sfr; @@ -80,9 +80,9 @@ RenderTicketPtr PreviewAutoCacher::GetSingleFrame(const rational &t, bool priori return sfr; } -RenderTicketPtr PreviewAutoCacher::GetRangeOfAudio(TimeRange range, bool prioritize) +RenderTicketPtr PreviewAutoCacher::GetRangeOfAudio(TimeRange range, RenderTicketPriority priority) { - return RenderAudio(range, false, prioritize); + return RenderAudio(range, false, priority); } void PreviewAutoCacher::VideoInvalidated(const TimeRange &range) @@ -211,7 +211,7 @@ void PreviewAutoCacher::VideoRendered() w->SetTicket(RenderManager::instance()->SaveFrameToCache(viewer_node_->video_frame_cache(), frame, it.value(), - true)); + RenderTicketPriority::kHigh)); } } @@ -554,7 +554,7 @@ void PreviewAutoCacher::TryRender() single_frame_render_->Finish(watcher->property("frame")); } else { watcher = RenderFrame(single_frame_render_->property("time").value(), - single_frame_render_->property("prioritize").toBool(), + RenderTicketPriority(single_frame_render_->property("priority").toInt()), !viewer_node_->GetVideoAutoCacheEnabled()); video_immediate_passthroughs_[watcher].append(single_frame_render_); @@ -574,7 +574,7 @@ void PreviewAutoCacher::TryRender() // We want this hash, if we're not already rendering, start render now if (!render_task && !video_download_tasks_.key(t)) { // Don't render any hash more than once - RenderFrame(t, false, false); + RenderFrame(t, RenderTicketPriority::kNormal, false); } emit SignalCacheProxyTaskProgress(double(queued_frame_iterator_.frame_index()) / double(queued_frame_iterator_.size())); @@ -594,13 +594,13 @@ void PreviewAutoCacher::TryRender() r.set_out(qMin(r.out(), r.in() + AudioVisualWaveform::kMinimumSampleRate.flipped())); // Start job - RenderAudio(r, true, false); + RenderAudio(r, true, RenderTicketPriority::kNormal); audio_iterator_.remove(r); } } -RenderTicketWatcher* PreviewAutoCacher::RenderFrame(const rational& time, bool prioritize, bool texture_only) +RenderTicketWatcher* PreviewAutoCacher::RenderFrame(const rational& time, RenderTicketPriority priority, bool texture_only) { RenderTicketWatcher* watcher = new RenderTicketWatcher(); watcher->setProperty("job", QVariant::fromValue(last_update_time_)); @@ -611,19 +611,19 @@ RenderTicketWatcher* PreviewAutoCacher::RenderFrame(const rational& time, bool p time, RenderMode::kOffline, viewer_node_->video_frame_cache(), - prioritize, + priority, texture_only)); return watcher; } -RenderTicketPtr PreviewAutoCacher::RenderAudio(const TimeRange &r, bool generate_waveforms, bool prioritize) +RenderTicketPtr PreviewAutoCacher::RenderAudio(const TimeRange &r, bool generate_waveforms, RenderTicketPriority priority) { RenderTicketWatcher* watcher = new RenderTicketWatcher(); watcher->setProperty("job", QVariant::fromValue(last_update_time_)); connect(watcher, &RenderTicketWatcher::Finished, this, &PreviewAutoCacher::AudioRendered); audio_tasks_.insert(watcher, r); - RenderTicketPtr ticket = RenderManager::instance()->RenderAudio(copied_viewer_node_, r, RenderMode::kOffline, generate_waveforms, prioritize); + RenderTicketPtr ticket = RenderManager::instance()->RenderAudio(copied_viewer_node_, r, RenderMode::kOffline, generate_waveforms, priority); watcher->SetTicket(ticket); return ticket; } diff --git a/app/render/previewautocacher.h b/app/render/previewautocacher.h index 1ad185877..3dd54a9da 100644 --- a/app/render/previewautocacher.h +++ b/app/render/previewautocacher.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,6 +32,7 @@ #include "node/project/project.h" #include "render/audioparams.h" #include "render/renderjobtracker.h" +#include "threading/threadpool.h" #include "threading/threadticketwatcher.h" namespace olive { @@ -49,9 +50,9 @@ public: virtual ~PreviewAutoCacher() override; - RenderTicketPtr GetSingleFrame(const rational& t, bool prioritize); + RenderTicketPtr GetSingleFrame(const rational& t, RenderTicketPriority prioritize); - RenderTicketPtr GetRangeOfAudio(TimeRange range, bool prioritize); + RenderTicketPtr GetRangeOfAudio(TimeRange range, RenderTicketPriority prioritize); /** * @brief Set the viewer node to auto-cache @@ -100,8 +101,8 @@ signals: private: void TryRender(); - RenderTicketWatcher *RenderFrame(const rational &time, bool prioritize, bool texture_only); - RenderTicketPtr RenderAudio(const TimeRange &range, bool generate_waveforms, bool prioritize); + RenderTicketWatcher *RenderFrame(const rational &time, RenderTicketPriority priority, bool texture_only); + RenderTicketPtr RenderAudio(const TimeRange &range, bool generate_waveforms, RenderTicketPriority priority); /** * @brief Process all changes to internal NodeGraph copy diff --git a/app/render/rendercache.h b/app/render/rendercache.h index 09436a9b6..114244fb8 100644 --- a/app/render/rendercache.h +++ b/app/render/rendercache.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/renderer.cpp b/app/render/renderer.cpp index a75d6c02f..80683c285 100644 --- a/app/render/renderer.cpp +++ b/app/render/renderer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/renderer.h b/app/render/renderer.h index e46ec7990..749d777cf 100644 --- a/app/render/renderer.h +++ b/app/render/renderer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/rendererthreadwrapper.cpp b/app/render/rendererthreadwrapper.cpp index 5566f9c59..50abd8b77 100644 --- a/app/render/rendererthreadwrapper.cpp +++ b/app/render/rendererthreadwrapper.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/rendererthreadwrapper.h b/app/render/rendererthreadwrapper.h index 694a630b7..873e43832 100644 --- a/app/render/rendererthreadwrapper.h +++ b/app/render/rendererthreadwrapper.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/renderjobtracker.cpp b/app/render/renderjobtracker.cpp index 29f07b3f0..7d8154f82 100644 --- a/app/render/renderjobtracker.cpp +++ b/app/render/renderjobtracker.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/renderjobtracker.h b/app/render/renderjobtracker.h index baaddfd72..178c01ecc 100644 --- a/app/render/renderjobtracker.h +++ b/app/render/renderjobtracker.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/rendermanager.cpp b/app/render/rendermanager.cpp index 49c21e3ba..7090a2a82 100644 --- a/app/render/rendermanager.cpp +++ b/app/render/rendermanager.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -36,10 +36,9 @@ namespace olive { RenderManager* RenderManager::instance_ = nullptr; -const int RenderManager::kDecoderMaximumInactivity = 10000; RenderManager::RenderManager(QObject *parent) : - ThreadPool(QThread::IdlePriority, 0, parent), + ThreadPool(0, parent), backend_(kOpenGL) { Renderer* graphics_renderer = nullptr; @@ -56,10 +55,6 @@ RenderManager::RenderManager(QObject *parent) : decoder_cache_ = new DecoderCache(); shader_cache_ = new ShaderCache(); default_shader_ = context_->CreateNativeShader(ShaderCode(QString(), QString())); - - decoder_clear_timer_.setInterval(kDecoderMaximumInactivity); - connect(&decoder_clear_timer_, &QTimer::timeout, this, &RenderManager::ClearOldDecoders); - decoder_clear_timer_.start(); } else { qCritical() << "Tried to initialize unknown graphics backend"; context_ = nullptr; @@ -81,27 +76,9 @@ RenderManager::~RenderManager() } } -void RenderManager::ClearOldDecoders() -{ - QMutexLocker locker(decoder_cache_->mutex()); - - qint64 min_age = QDateTime::currentMSecsSinceEpoch() - kDecoderMaximumInactivity; - - for (auto it=decoder_cache_->begin(); it!=decoder_cache_->end(); ) { - DecoderPair decoder = it.value(); - - if (decoder.decoder->GetLastAccessedTime() < min_age) { - decoder.decoder->Close(); - it = decoder_cache_->erase(it); - } else { - it++; - } - } -} - RenderTicketPtr RenderManager::RenderFrame(ViewerOutput *viewer, ColorManager* color_manager, const rational& time, RenderMode::Mode mode, - FrameHashCache* cache, bool prioritize, bool texture_only) + FrameHashCache* cache, RenderTicketPriority priority, bool texture_only) { return RenderFrame(viewer, color_manager, @@ -114,7 +91,7 @@ RenderTicketPtr RenderManager::RenderFrame(ViewerOutput *viewer, ColorManager* c VideoParams::kFormatInvalid, nullptr, cache, - prioritize, + priority, texture_only); } @@ -124,7 +101,7 @@ RenderTicketPtr RenderManager::RenderFrame(ViewerOutput *viewer, ColorManager* c const QSize& force_size, const QMatrix4x4& force_matrix, VideoParams::Format force_format, ColorProcessorPtr force_color_output, - FrameHashCache* cache, bool prioritize, bool texture_only) + FrameHashCache* cache, RenderTicketPriority priority, bool texture_only) { // Create ticket RenderTicketPtr ticket = std::make_shared(); @@ -146,24 +123,17 @@ RenderTicketPtr RenderManager::RenderFrame(ViewerOutput *viewer, ColorManager* c ticket->setProperty("cache", cache->GetCacheDirectory()); } - if (ticket->thread() != this->thread()) { - ticket->moveToThread(this->thread()); - } - - // Queue appending the ticket and running the next job on our thread to make this function thread-safe - QMetaObject::invokeMethod(this, "AddTicket", Qt::AutoConnection, - OLIVE_NS_ARG(RenderTicketPtr, ticket), - Q_ARG(bool, prioritize)); + AddTicket(ticket, priority); return ticket; } -RenderTicketPtr RenderManager::RenderAudio(ViewerOutput* viewer, const TimeRange& r, RenderMode::Mode mode, bool generate_waveforms, bool prioritize) +RenderTicketPtr RenderManager::RenderAudio(ViewerOutput* viewer, const TimeRange& r, RenderMode::Mode mode, bool generate_waveforms, RenderTicketPriority priority) { - return RenderAudio(viewer, r, viewer->GetAudioParams(), mode, generate_waveforms, prioritize); + return RenderAudio(viewer, r, viewer->GetAudioParams(), mode, generate_waveforms, priority); } -RenderTicketPtr RenderManager::RenderAudio(ViewerOutput* viewer, const TimeRange &r, const AudioParams ¶ms, RenderMode::Mode mode, bool generate_waveforms, bool prioritize) +RenderTicketPtr RenderManager::RenderAudio(ViewerOutput* viewer, const TimeRange &r, const AudioParams ¶ms, RenderMode::Mode mode, bool generate_waveforms, RenderTicketPriority priority) { // Create ticket RenderTicketPtr ticket = std::make_shared(); @@ -175,19 +145,12 @@ RenderTicketPtr RenderManager::RenderAudio(ViewerOutput* viewer, const TimeRange ticket->setProperty("enablewaveforms", generate_waveforms); ticket->setProperty("aparam", QVariant::fromValue(params)); - if (ticket->thread() != this->thread()) { - ticket->moveToThread(this->thread()); - } - - // Queue appending the ticket and running the next job on our thread to make this function thread-safe - QMetaObject::invokeMethod(this, "AddTicket", Qt::AutoConnection, - OLIVE_NS_ARG(RenderTicketPtr, ticket), - Q_ARG(bool, prioritize)); + AddTicket(ticket, priority); return ticket; } -RenderTicketPtr RenderManager::SaveFrameToCache(FrameHashCache *cache, FramePtr frame, const rational &time, bool prioritize) +RenderTicketPtr RenderManager::SaveFrameToCache(FrameHashCache *cache, FramePtr frame, const rational &time, RenderTicketPriority priority) { // Create ticket RenderTicketPtr ticket = std::make_shared(); @@ -198,20 +161,21 @@ RenderTicketPtr RenderManager::SaveFrameToCache(FrameHashCache *cache, FramePtr ticket->setProperty("uuid", QVariant::fromValue(cache->GetUuid())); ticket->setProperty("type", kTypeVideoDownload); - if (ticket->thread() != this->thread()) { - ticket->moveToThread(this->thread()); - } - - // Queue appending the ticket and running the next job on our thread to make this function thread-safe - QMetaObject::invokeMethod(this, "AddTicket", Qt::AutoConnection, - OLIVE_NS_ARG(RenderTicketPtr, ticket), - Q_ARG(bool, prioritize)); + AddTicket(ticket, priority); return ticket; } void RenderManager::RunTicket(RenderTicketPtr ticket) const { + // Setup the ticket for ::Process + ticket->Start(); + + if (ticket->IsCancelled()) { + ticket->Finish(); + return; + } + RenderProcessor::Process(ticket, context_, decoder_cache_, shader_cache_, default_shader_); } diff --git a/app/render/rendermanager.h b/app/render/rendermanager.h index c69c22770..98f4a01d4 100644 --- a/app/render/rendermanager.h +++ b/app/render/rendermanager.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,36 +69,30 @@ public: * The ticket from this function will return a FramePtr - the rendered frame in reference color * space. * - * Setting `prioritize` to TRUE puts this ticket at the top of the queue. Leaving it as FALSE - * appends it to the bottom. - * * This function is thread-safe. */ RenderTicketPtr RenderFrame(ViewerOutput *viewer, ColorManager* color_manager, const rational& time, RenderMode::Mode mode, - FrameHashCache* cache = nullptr, bool prioritize = false, bool texture_only = false); + FrameHashCache* cache = nullptr, RenderTicketPriority priority = RenderTicketPriority::kNormal, bool texture_only = false); RenderTicketPtr RenderFrame(ViewerOutput* viewer, ColorManager* color_manager, const rational& time, RenderMode::Mode mode, const VideoParams& video_params, const AudioParams& audio_params, const QSize& force_size, const QMatrix4x4& force_matrix, VideoParams::Format force_format, ColorProcessorPtr force_color_output, - FrameHashCache* cache = nullptr, bool prioritize = false, bool texture_only = false); + FrameHashCache* cache = nullptr, RenderTicketPriority priority = RenderTicketPriority::kNormal, bool texture_only = false); /** * @brief Asynchronously generate a chunk of audio * * The ticket from this function will return a SampleBufferPtr - the rendered audio. * - * Setting `prioritize` to TRUE puts this ticket at the top of the queue. Leaving it as FALSE - * appends it to the bottom. - * * This function is thread-safe. */ - RenderTicketPtr RenderAudio(ViewerOutput* viewer, const TimeRange& r, const AudioParams& params, RenderMode::Mode mode, bool generate_waveforms, bool prioritize = false); - RenderTicketPtr RenderAudio(ViewerOutput *viewer, const TimeRange& r, RenderMode::Mode mode, bool generate_waveforms, bool prioritize = false); + RenderTicketPtr RenderAudio(ViewerOutput* viewer, const TimeRange& r, const AudioParams& params, RenderMode::Mode mode, bool generate_waveforms, RenderTicketPriority priority = RenderTicketPriority::kNormal); + RenderTicketPtr RenderAudio(ViewerOutput *viewer, const TimeRange& r, RenderMode::Mode mode, bool generate_waveforms, RenderTicketPriority priority = RenderTicketPriority::kNormal); - RenderTicketPtr SaveFrameToCache(FrameHashCache* cache, FramePtr frame, const rational &time, bool prioritize = false); + RenderTicketPtr SaveFrameToCache(FrameHashCache* cache, FramePtr frame, const rational &time, RenderTicketPriority priority = RenderTicketPriority::kNormal); virtual void RunTicket(RenderTicketPtr ticket) const override; @@ -137,13 +131,6 @@ private: QVariant default_shader_; - QTimer decoder_clear_timer_; - - static const int kDecoderMaximumInactivity; - -private slots: - void ClearOldDecoders(); - }; } diff --git a/app/render/rendermodes.h b/app/render/rendermodes.h index e39cb3fd5..0d60ee914 100644 --- a/app/render/rendermodes.h +++ b/app/render/rendermodes.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/renderprocessor.cpp b/app/render/renderprocessor.cpp index 1a7d692b9..90115ec03 100644 --- a/app/render/renderprocessor.cpp +++ b/app/render/renderprocessor.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ TexturePtr RenderProcessor::GenerateTexture(const rational &time, const rational NodeValueTable table; if (Node *texture_output = viewer->GetConnectedTextureOutput()) { - table = GenerateTable(texture_output, viewer->GetValueHintForInput(ViewerOutput::kTextureInput), range); + table = GenerateTable(texture_output, range); } NodeValue tex_val = table.Get(NodeValue::kTexture); @@ -193,7 +193,7 @@ void RenderProcessor::Run() NodeValueTable table; if (Node *texture_output = viewer->GetConnectedSampleOutput()) { - table = GenerateTable(texture_output, viewer->GetValueHintForInput(ViewerOutput::kSamplesInput),time); + table = GenerateTable(texture_output, time); } NodeValue sample_val = table.Get(NodeValue::kSamples); @@ -291,7 +291,7 @@ NodeValueTable RenderProcessor::GenerateBlockTable(const Track *track, const Tim int max_dest_sz = audio_params.time_to_samples(range_for_block.length()); // Destination buffer - NodeValueTable table = GenerateTable(b, track->GetValueHintForInput(Track::kBlockInput, track->GetArrayIndexFromBlock(b)),Track::TransformRangeForBlock(b, range_for_block)); + NodeValueTable table = GenerateTable(b, Track::TransformRangeForBlock(b, range_for_block)); SampleBuffer samples_from_this_block = table.Take(NodeValue::kSamples).toSamples(); ClipBlock *clip_cast = dynamic_cast(b); diff --git a/app/render/renderprocessor.h b/app/render/renderprocessor.h index 017cedada..1fb6ea23f 100644 --- a/app/render/renderprocessor.h +++ b/app/render/renderprocessor.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/shadercode.h b/app/render/shadercode.h index 20c8b8079..238d51243 100644 --- a/app/render/shadercode.h +++ b/app/render/shadercode.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/subtitleparams.cpp b/app/render/subtitleparams.cpp index b0bc7c534..442fa3994 100644 --- a/app/render/subtitleparams.cpp +++ b/app/render/subtitleparams.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,8 @@ #include +#include "common/xmlutils.h" + namespace olive { QString SubtitleParams::GenerateASSHeader() @@ -106,4 +108,56 @@ QString SubtitleParams::GenerateASSHeader() return ass_code; } +void SubtitleParams::Load(QXmlStreamReader *reader) +{ + this->clear(); + + while (XMLReadNextStartElement(reader)) { + if (reader->name() == QStringLiteral("streamindex")) { + set_stream_index(reader->readElementText().toInt()); + } else if (reader->name() == QStringLiteral("enabled")) { + set_enabled(reader->readElementText().toInt()); + } else if (reader->name() == QStringLiteral("subtitles")) { + while (XMLReadNextStartElement(reader)) { + if (reader->name() == QStringLiteral("subtitle")) { + rational in, out; + QString text; + + XMLAttributeLoop(reader, attr) { + if (attr.name() == QStringLiteral("in")) { + in = rational::fromString(attr.value().toString()); + } else if (attr.name() == QStringLiteral("out")) { + out = rational::fromString(attr.value().toString()); + } + } + + text = reader->readElementText(); + + this->push_back(Subtitle(TimeRange(in, out), text)); + } else { + reader->skipCurrentElement(); + } + } + } else { + reader->skipCurrentElement(); + } + } +} + +void SubtitleParams::Save(QXmlStreamWriter *writer) const +{ + writer->writeTextElement(QStringLiteral("streamindex"), QString::number(stream_index_)); + writer->writeTextElement(QStringLiteral("enabled"), QString::number(enabled_)); + + writer->writeStartElement(QStringLiteral("subtitles")); + for (auto it=this->cbegin(); it!=this->cend(); it++) { + writer->writeStartElement(QStringLiteral("subtitle")); + writer->writeAttribute(QStringLiteral("in"), it->time().in().toString()); + writer->writeAttribute(QStringLiteral("out"), it->time().out().toString()); + writer->writeCharacters(it->text()); + writer->writeEndElement(); // subtitle + } + writer->writeEndElement(); // subtitles +} + } diff --git a/app/render/subtitleparams.h b/app/render/subtitleparams.h index c72f9c25c..2e9d86c8e 100644 --- a/app/render/subtitleparams.h +++ b/app/render/subtitleparams.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,16 +21,84 @@ #ifndef SUBTITLEPARAMS_H #define SUBTITLEPARAMS_H +#include #include +#include +#include + +#include "common/timerange.h" namespace olive { -class SubtitleParams { +class Subtitle +{ public: + Subtitle() = default; + + Subtitle(const TimeRange &time, const QString &text) : + range_(time), + text_(text) + { + } + + const TimeRange &time() const { return range_; } + void set_time(const TimeRange &t) { range_ = t; } + + const QString &text() const { return text_; } + void set_text(const QString &t) { text_ = t; } + +private: + TimeRange range_; + + QString text_; + +}; + +class SubtitleParams : public std::vector +{ +public: + SubtitleParams() + { + stream_index_ = 0; + enabled_ = true; + } + static QString GenerateASSHeader(); + void Load(QXmlStreamReader* reader); + + void Save(QXmlStreamWriter* writer) const; + + bool is_valid() const + { + return !this->empty(); + } + + rational duration() const + { + if (this->empty()) { + return 0; + } else { + return back().time().out(); + } + } + + int stream_index() const { return stream_index_; } + void set_stream_index(int i) { stream_index_ = i; } + + bool enabled() const { return enabled_; } + void set_enabled(bool e) { enabled_ = e; } + +private: + int stream_index_; + + bool enabled_; + }; } +Q_DECLARE_METATYPE(olive::Subtitle) +Q_DECLARE_METATYPE(olive::SubtitleParams) + #endif // SUBTITLEPARAMS_H diff --git a/app/render/texture.cpp b/app/render/texture.cpp index b74c2dc18..33973ddaf 100644 --- a/app/render/texture.cpp +++ b/app/render/texture.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/texture.h b/app/render/texture.h index 7bed5928f..612b3e2f2 100644 --- a/app/render/texture.h +++ b/app/render/texture.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/videoparams.cpp b/app/render/videoparams.cpp index 28ea5c29e..c40ff3684 100644 --- a/app/render/videoparams.cpp +++ b/app/render/videoparams.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/render/videoparams.h b/app/render/videoparams.h index 28fb26fdd..564985dc4 100644 --- a/app/render/videoparams.h +++ b/app/render/videoparams.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/shaders/CMakeLists.txt b/app/shaders/CMakeLists.txt index b32e14e23..e32b69af3 100644 --- a/app/shaders/CMakeLists.txt +++ b/app/shaders/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/shaders/dropshadow.frag b/app/shaders/dropshadow.frag new file mode 100644 index 000000000..dbfba07cb --- /dev/null +++ b/app/shaders/dropshadow.frag @@ -0,0 +1,110 @@ +uniform sampler2D tex_in; +uniform vec4 color_in; +uniform float distance_in; +uniform float angle_in; +uniform float radius_in; +uniform float opacity_in; +uniform vec2 resolution_in; +uniform sampler2D previous_iteration_in; +uniform bool fast_in; + +uniform int ove_iteration; + +in vec2 ove_texcoord; +out vec4 frag_color; + +// Gaussian function uses PI +#define M_PI 3.1415926535897932384626433832795 + +// Single gaussian formula (unused, mainly here for documentation/just in case) +//float gaussian(float x, float sigma) { +// return (1.0/(sigma*sqrt(2.0*M_PI)))*exp(-0.5*pow(x/sigma, 2.0)); +//} + +// Double gaussian formula, actually used in the code below +// Should be faster than the single gaussian above since it doesn't need sqrt() +float gaussian2(float x, float y, float sigma) { + return (1.0/((sigma*sigma)*2.0*M_PI))*exp(-0.5*(((x*x) + (y*y))/(sigma*sigma))); +} + +void main(void) { + if (ove_iteration == 2 || radius_in == 0.0) { + + // Merge step + vec4 composite = texture(tex_in, ove_texcoord); + if (composite.a < 1.0) { + // Convert degrees to radians + float shadow_angle = ((angle_in + 90.0)*M_PI)/180.0; + + vec2 shadow_offset = vec2(cos(shadow_angle) * distance_in, sin(shadow_angle) * distance_in); + shadow_offset /= resolution_in; + shadow_offset += ove_texcoord; + + vec4 shadow_color = texture(previous_iteration_in, shadow_offset); + + shadow_color.rgb = color_in.rgb * shadow_color.a; + shadow_color *= 1.0 - composite.a; + shadow_color *= opacity_in; + + composite += shadow_color; + } + frag_color = composite; + + } else { + // We only sample on hard pixels, so we don't accept decimal radii + float real_radius = ceil(radius_in); + + vec4 composite = vec4(0.0); + + float divider, sigma; + + if (fast_in) { + + // Calculate the weight of each pixel based on the radius + divider = 1.0 / real_radius; + + } else { + + // Using (radius = 3 * sigma) because 3 standard deviations covers 97% of the blur according to this document: + // http://chemaguerra.com/gaussian-filter-radius/ + sigma = real_radius; + real_radius *= 3.0; + + // Use gaussian formula to calculate the weight of all pixels + divider = 0.0; + for (float i = -real_radius + 0.5; i <= real_radius; i += 2.0) { + divider += gaussian2(i, 0.0, sigma); + } + + } + + for (float i = -real_radius + 0.5; i <= real_radius; i += 2.0) { + float weight; + + if (fast_in) { + weight = divider; + } else { + weight = gaussian2(i, 0.0, sigma) / divider; + } + + vec2 pixel_coord = ove_texcoord; + vec4 tex_col; + if (ove_iteration == 0) { + pixel_coord.x += i / resolution_in.x; + + // Pull from main texture + tex_col = texture(tex_in, pixel_coord); + } else if (ove_iteration == 1) { + pixel_coord.y += i / resolution_in.y; + + // Pull from previous iteration + tex_col = texture(previous_iteration_in, pixel_coord); + } + + composite += tex_col * weight; + } + + frag_color = composite; + } + +} diff --git a/app/task/CMakeLists.txt b/app/task/CMakeLists.txt index 640946a68..f56f080b6 100644 --- a/app/task/CMakeLists.txt +++ b/app/task/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/task/conform/CMakeLists.txt b/app/task/conform/CMakeLists.txt index d452a2ca6..6c25e92ce 100644 --- a/app/task/conform/CMakeLists.txt +++ b/app/task/conform/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/task/conform/conform.cpp b/app/task/conform/conform.cpp index 4ee1ea5f9..a0cd5fe72 100644 --- a/app/task/conform/conform.cpp +++ b/app/task/conform/conform.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/conform/conform.h b/app/task/conform/conform.h index 32f480048..9467c9748 100644 --- a/app/task/conform/conform.h +++ b/app/task/conform/conform.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/customcache/CMakeLists.txt b/app/task/customcache/CMakeLists.txt index 46abd88af..c171db697 100644 --- a/app/task/customcache/CMakeLists.txt +++ b/app/task/customcache/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/task/customcache/customcachetask.cpp b/app/task/customcache/customcachetask.cpp index 97d7c07fe..29fe16094 100644 --- a/app/task/customcache/customcachetask.cpp +++ b/app/task/customcache/customcachetask.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/customcache/customcachetask.h b/app/task/customcache/customcachetask.h index e946ae775..e81d24516 100644 --- a/app/task/customcache/customcachetask.h +++ b/app/task/customcache/customcachetask.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/export/CMakeLists.txt b/app/task/export/CMakeLists.txt index 33daf22a7..5c1bb1f41 100644 --- a/app/task/export/CMakeLists.txt +++ b/app/task/export/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/task/export/export.cpp b/app/task/export/export.cpp index 6d979fd69..e471d6862 100644 --- a/app/task/export/export.cpp +++ b/app/task/export/export.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/export/export.h b/app/task/export/export.h index 169ef171c..bf696978e 100644 --- a/app/task/export/export.h +++ b/app/task/export/export.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/export/exportparams.cpp b/app/task/export/exportparams.cpp index 33d5acc45..dd7154044 100644 --- a/app/task/export/exportparams.cpp +++ b/app/task/export/exportparams.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/export/exportparams.h b/app/task/export/exportparams.h index 6405e7740..b72597a6c 100644 --- a/app/task/export/exportparams.h +++ b/app/task/export/exportparams.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/precache/CMakeLists.txt b/app/task/precache/CMakeLists.txt index b82c9c07f..127475e36 100644 --- a/app/task/precache/CMakeLists.txt +++ b/app/task/precache/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/task/precache/precachetask.cpp b/app/task/precache/precachetask.cpp index 71560714e..e83de623b 100644 --- a/app/task/precache/precachetask.cpp +++ b/app/task/precache/precachetask.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/precache/precachetask.h b/app/task/precache/precachetask.h index 3f3de1964..5cb9b4864 100644 --- a/app/task/precache/precachetask.h +++ b/app/task/precache/precachetask.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/CMakeLists.txt b/app/task/project/CMakeLists.txt index f87e9d885..a9761a917 100644 --- a/app/task/project/CMakeLists.txt +++ b/app/task/project/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/task/project/import/CMakeLists.txt b/app/task/project/import/CMakeLists.txt index 9f571f3ea..adc4161fc 100644 --- a/app/task/project/import/CMakeLists.txt +++ b/app/task/project/import/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/task/project/import/import.cpp b/app/task/project/import/import.cpp index 900cc1d8b..db2fd434f 100644 --- a/app/task/project/import/import.cpp +++ b/app/task/project/import/import.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -222,7 +222,7 @@ void ProjectImportTask::ValidateImageSequence(Footage *footage, QFileInfoList& i void ProjectImportTask::AddItemToFolder(Folder *folder, Node *item, MultiUndoCommand *command) { // Create undoable command that adds the items to the model - Project* project = folder->project(); + Project* project = folder_->project(); NodeAddCommand* nac = new NodeAddCommand(project, item); nac->PushToThread(project->thread()); diff --git a/app/task/project/import/import.h b/app/task/project/import/import.h index 3f884478a..f02afea9e 100644 --- a/app/task/project/import/import.h +++ b/app/task/project/import/import.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/import/importerrordialog.cpp b/app/task/project/import/importerrordialog.cpp index c44b4cdbd..e74dea565 100644 --- a/app/task/project/import/importerrordialog.cpp +++ b/app/task/project/import/importerrordialog.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/import/importerrordialog.h b/app/task/project/import/importerrordialog.h index b1552e114..c69176941 100644 --- a/app/task/project/import/importerrordialog.h +++ b/app/task/project/import/importerrordialog.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/load/CMakeLists.txt b/app/task/project/load/CMakeLists.txt index 165bdc646..e2b50ceff 100644 --- a/app/task/project/load/CMakeLists.txt +++ b/app/task/project/load/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/task/project/load/load.cpp b/app/task/project/load/load.cpp index 17497723c..df1e34545 100644 --- a/app/task/project/load/load.cpp +++ b/app/task/project/load/load.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/load/load.h b/app/task/project/load/load.h index d6d8640c9..facf68a91 100644 --- a/app/task/project/load/load.h +++ b/app/task/project/load/load.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/load/loadbasetask.cpp b/app/task/project/load/loadbasetask.cpp index 91c82a970..e63e3cd2f 100644 --- a/app/task/project/load/loadbasetask.cpp +++ b/app/task/project/load/loadbasetask.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/load/loadbasetask.h b/app/task/project/load/loadbasetask.h index 546dd6b51..74c68a4f7 100644 --- a/app/task/project/load/loadbasetask.h +++ b/app/task/project/load/loadbasetask.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/loadotio/CMakeLists.txt b/app/task/project/loadotio/CMakeLists.txt index d5c740bc9..77752a10e 100644 --- a/app/task/project/loadotio/CMakeLists.txt +++ b/app/task/project/loadotio/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/task/project/loadotio/loadotio.cpp b/app/task/project/loadotio/loadotio.cpp index 896d90737..202b71a5e 100644 --- a/app/task/project/loadotio/loadotio.cpp +++ b/app/task/project/loadotio/loadotio.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/loadotio/loadotio.h b/app/task/project/loadotio/loadotio.h index 4d1501920..9ee9d3a2a 100644 --- a/app/task/project/loadotio/loadotio.h +++ b/app/task/project/loadotio/loadotio.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/save/CMakeLists.txt b/app/task/project/save/CMakeLists.txt index 9c6c3e3fb..774f9349e 100644 --- a/app/task/project/save/CMakeLists.txt +++ b/app/task/project/save/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/task/project/save/save.cpp b/app/task/project/save/save.cpp index 24c95b665..10446e8f1 100644 --- a/app/task/project/save/save.cpp +++ b/app/task/project/save/save.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/save/save.h b/app/task/project/save/save.h index 4ab1b81b5..6157b2d67 100644 --- a/app/task/project/save/save.h +++ b/app/task/project/save/save.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/saveotio/CMakeLists.txt b/app/task/project/saveotio/CMakeLists.txt index 486417aff..d48b94f43 100644 --- a/app/task/project/saveotio/CMakeLists.txt +++ b/app/task/project/saveotio/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/task/project/saveotio/saveotio.cpp b/app/task/project/saveotio/saveotio.cpp index 66ea55ca4..65e543f4a 100644 --- a/app/task/project/saveotio/saveotio.cpp +++ b/app/task/project/saveotio/saveotio.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/project/saveotio/saveotio.h b/app/task/project/saveotio/saveotio.h index 4be81d178..2fcbd1241 100644 --- a/app/task/project/saveotio/saveotio.h +++ b/app/task/project/saveotio/saveotio.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/render/CMakeLists.txt b/app/task/render/CMakeLists.txt index 87a5c7655..e43581c6e 100644 --- a/app/task/render/CMakeLists.txt +++ b/app/task/render/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/task/render/render.cpp b/app/task/render/render.cpp index dc93342c7..7c1f59ee2 100644 --- a/app/task/render/render.cpp +++ b/app/task/render/render.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/render/render.h b/app/task/render/render.h index 472816434..d08c6d018 100644 --- a/app/task/render/render.h +++ b/app/task/render/render.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/task.h b/app/task/task.h index b660c470d..835c009fd 100644 --- a/app/task/task.h +++ b/app/task/task.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/taskmanager.cpp b/app/task/taskmanager.cpp index 9e59b6d5e..26730a0f8 100644 --- a/app/task/taskmanager.cpp +++ b/app/task/taskmanager.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/task/taskmanager.h b/app/task/taskmanager.h index 567e6971d..05cbf6ed6 100644 --- a/app/task/taskmanager.h +++ b/app/task/taskmanager.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/threading/CMakeLists.txt b/app/threading/CMakeLists.txt index 6a7cb8838..ada17c49c 100644 --- a/app/threading/CMakeLists.txt +++ b/app/threading/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/threading/threadpool.cpp b/app/threading/threadpool.cpp index cef8500c0..b048f3519 100644 --- a/app/threading/threadpool.cpp +++ b/app/threading/threadpool.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,140 +22,73 @@ namespace olive { -ThreadPool::ThreadPool(QThread::Priority priority, int threads, QObject *parent) : +ThreadPool::ThreadPool(unsigned threads, QObject *parent) : QObject(parent) { - all_threads_.resize(threads ? threads : QThread::idealThreadCount()); + if (threads == 0) { + threads = std::thread::hardware_concurrency(); + } - // Create threads - for (int i=0; i lock(task_mutex_); - // Append to list of available threads - available_threads_.push_back(t); + if (priority == RenderTicketPriority::kHigh) { + tasks_.emplace_front(std::move(ticket)); + } else { + tasks_.emplace_back(std::move(ticket)); + } - // Connect done signal - connect(t, &ThreadPoolThread::Done, this, &ThreadPool::ThreadDone); + cond_.notify_one(); +} - // Start the thread at the given priority - t->start(priority); +bool ThreadPool::RemoveTicket(RenderTicketPtr ticket) +{ + std::lock_guard lock(task_mutex_); + + const auto it = std::find(tasks_.begin(), tasks_.end(), ticket); + if (it == tasks_.end()) { + return false; + } + + tasks_.erase(it); + return true; +} + +void ThreadPool::thread_exec() +{ + while (true) { + TaskType task; + + { + std::unique_lock lock(task_mutex_); + cond_.wait(lock, [this]{ return this->end_threadp_ || !this->tasks_.empty(); }); + + if (this->end_threadp_ && this->tasks_.empty()) { + break; + } + + task = std::move(tasks_.front()); + tasks_.pop_front(); + } + + RunTicket(task); } } ThreadPool::~ThreadPool() { - foreach (ThreadPoolThread* thread, all_threads_) { - thread->Cancel(); - thread->wait(); - delete thread; + end_threadp_ = true; + cond_.notify_all(); + + for (auto &e : worker_threads_) { + e.join(); } } -bool ThreadPool::RemoveTicket(RenderTicketPtr ticket) -{ - auto it = std::find(ticket_queue_.begin(), ticket_queue_.end(), ticket); - if (it == ticket_queue_.end()) { - return false; - } - - ticket_queue_.erase(it); - return true; -} - -void ThreadPool::AddTicket(RenderTicketPtr ticket, bool prioritize) -{ - if (prioritize) { - ticket_queue_.push_front(ticket); - } else { - ticket_queue_.push_back(ticket); - } - - RunNext(); -} - -void ThreadPool::RunNext() -{ - while (!ticket_queue_.empty() && !available_threads_.empty()) { - // Run function - RenderTicketPtr ticket = ticket_queue_.front(); - ticket_queue_.pop_front(); - - ticket->Start(); - - if (ticket->IsCancelled()) { - // Finish without doing any more - ticket->Finish(); - } else { - ThreadPoolThread* thread = available_threads_.front(); - available_threads_.pop_front(); - - // Move ticket to other thread so event processing can occur there - ticket->moveToThread(thread); - - // Run the ticket in the thread, which actually just calls our virtual function RunTicket - thread->RunTicket(ticket); - } - } -} - -void ThreadPool::ThreadDone() -{ - ThreadPoolThread* thread = static_cast(sender()); - - available_threads_.push_back(thread); - - RunNext(); -} - -ThreadPoolThread::ThreadPoolThread(ThreadPool *parent) -{ - pool_ = parent; - - // Ensures mutex is definitely locked by the time the thread is running - mutex_.lock(); -} - -ThreadPoolThread::~ThreadPoolThread() -{ - mutex_.unlock(); -} - -void ThreadPoolThread::RunTicket(RenderTicketPtr ticket) -{ - mutex_.lock(); - ticket_ = ticket; - wait_cond_.wakeAll(); - mutex_.unlock(); -} - -void ThreadPoolThread::run() -{ - while (true) { - wait_cond_.wait(&mutex_); - - if (ticket_) { - pool_->RunTicket(ticket_); - - // Move back to calling thread (hacky?) - ticket_->moveToThread(this->thread()); - - ticket_ = nullptr; - } - - if (IsCancelled()) { - break; - } else { - emit Done(); - } - } -} - -void ThreadPoolThread::CancelEvent() -{ - wait_cond_.wakeAll(); -} - } diff --git a/app/threading/threadpool.h b/app/threading/threadpool.h index ee1e29b61..3c3204bb1 100644 --- a/app/threading/threadpool.h +++ b/app/threading/threadpool.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,75 +21,44 @@ #ifndef THREADPOOL_H #define THREADPOOL_H -#include - -#include "common/cancelableobject.h" #include "threading/threadticket.h" +#include +#include +#include +#include +#include + namespace olive { -class ThreadPoolThread; +enum class RenderTicketPriority { kHigh = 0, kNormal }; class ThreadPool : public QObject { Q_OBJECT public: - ThreadPool(QThread::Priority priority = QThread::InheritPriority, int threads = 0, QObject* parent = nullptr); + using TaskType = RenderTicketPtr; + ThreadPool(unsigned threads, QObject *parent); + + DISABLE_COPY_MOVE(ThreadPool) + + virtual void RunTicket(RenderTicketPtr ticket) const = 0; + void AddTicket(RenderTicketPtr ticket, RenderTicketPriority priority = RenderTicketPriority::kNormal); + bool RemoveTicket(RenderTicketPtr ticket); virtual ~ThreadPool() override; - RenderTicketPtr Queue(); - - virtual void RunTicket(RenderTicketPtr ticket) const = 0; - - bool RemoveTicket(RenderTicketPtr ticket); - -public slots: - void AddTicket(olive::RenderTicketPtr ticket, bool prioritize = false); - private: - void RunNext(); + void thread_exec(); - QVector all_threads_; - - std::list available_threads_; - - std::list ticket_queue_; - -private slots: - void ThreadDone(); + std::vector worker_threads_; + std::deque tasks_; + std::mutex task_mutex_; + std::condition_variable cond_; + std::atomic_bool end_threadp_{false}; }; -class ThreadPoolThread : public QThread, public CancelableObject -{ - Q_OBJECT -public: - ThreadPoolThread(ThreadPool* parent); +} // namespace olive - virtual ~ThreadPoolThread() override; - - void RunTicket(RenderTicketPtr ticket); - -protected: - virtual void run() override; - - virtual void CancelEvent() override; - -signals: - void Done(); - -private: - ThreadPool* pool_; - - RenderTicketPtr ticket_; - - QMutex mutex_; - - QWaitCondition wait_cond_; - -}; - -} - -#endif // THREADPOOL_H +#endif // THREADPOOL_H diff --git a/app/threading/threadticket.cpp b/app/threading/threadticket.cpp index d8d041d9e..8f9715424 100644 --- a/app/threading/threadticket.cpp +++ b/app/threading/threadticket.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/threading/threadticket.h b/app/threading/threadticket.h index bb8629f06..fb42ab969 100644 --- a/app/threading/threadticket.h +++ b/app/threading/threadticket.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/threading/threadticketwatcher.cpp b/app/threading/threadticketwatcher.cpp index 891c7eff1..a6ca5b2eb 100644 --- a/app/threading/threadticketwatcher.cpp +++ b/app/threading/threadticketwatcher.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/threading/threadticketwatcher.h b/app/threading/threadticketwatcher.h index eac476835..3b442e03e 100644 --- a/app/threading/threadticketwatcher.h +++ b/app/threading/threadticketwatcher.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/timeline/CMakeLists.txt b/app/timeline/CMakeLists.txt index 844524f38..3fb988e83 100644 --- a/app/timeline/CMakeLists.txt +++ b/app/timeline/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/timeline/timelinecommon.h b/app/timeline/timelinecommon.h index 2420c8868..5c6d96df9 100644 --- a/app/timeline/timelinecommon.h +++ b/app/timeline/timelinecommon.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/timeline/timelinecoordinate.cpp b/app/timeline/timelinecoordinate.cpp index beb5ebf98..baac6140b 100644 --- a/app/timeline/timelinecoordinate.cpp +++ b/app/timeline/timelinecoordinate.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/timeline/timelinecoordinate.h b/app/timeline/timelinecoordinate.h index 15517e96c..9e572cca1 100644 --- a/app/timeline/timelinecoordinate.h +++ b/app/timeline/timelinecoordinate.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/timeline/timelinemarker.cpp b/app/timeline/timelinemarker.cpp index cc770e894..d8b87b7fd 100644 --- a/app/timeline/timelinemarker.cpp +++ b/app/timeline/timelinemarker.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -167,9 +167,9 @@ void TimelineMarkerList::InsertIntoList(TimelineMarker *marker) for (auto it=markers_.begin(); it!=markers_.end(); it++) { TimelineMarker *m = *it; - Q_ASSERT(m->time() != marker->time()); + Q_ASSERT(m->time().in() != marker->time().in()); - if (m->time() > marker->time()) { + if (m->time().in() > marker->time().in()) { markers_.insert(it, marker); found = true; break; @@ -316,7 +316,7 @@ Project* MarkerChangeTimeCommand::GetRelevantProject() const void MarkerChangeTimeCommand::redo() { - old_time_ = marker_->time_range(); + old_time_ = marker_->time(); marker_->set_time(new_time_); } diff --git a/app/timeline/timelinemarker.h b/app/timeline/timelinemarker.h index ae7cc4484..7712111d2 100644 --- a/app/timeline/timelinemarker.h +++ b/app/timeline/timelinemarker.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,17 +38,9 @@ public: TimelineMarker(QObject* parent = nullptr); TimelineMarker(int color, const TimeRange& time, const QString& name = QString(), QObject* parent = nullptr); - /** - * @brief Dummy function for TimeBasedViewSelectionManager compatibility - * - * FIXME: Once we upgrade to C++17, we won't need this because we'll be able to check types in - * TimeBasedViewSelectionManager's template functions - */ - const rational &time() const { return time_.in(); } - void set_time(const rational& time); - - const TimeRange &time_range() const { return time_; } + const TimeRange &time() const { return time_; } void set_time(const TimeRange& time); + void set_time(const rational& time); bool has_sibling_at_time(const rational &t) const; @@ -99,7 +91,7 @@ public: { for (auto it=markers_.cbegin(); it!=markers_.cend(); it++) { TimelineMarker *m = *it; - if (m->time() == t) { + if (m->time().in() == t) { return m; } } @@ -114,10 +106,10 @@ public: for (auto it=markers_.cbegin(); it!=markers_.cend(); it++) { TimelineMarker *m = *it; - rational this_diff = qAbs(m->time() - t); + rational this_diff = qAbs(m->time().in() - t); if (closest) { - rational stored_diff = qAbs(closest->time() - t); + rational stored_diff = qAbs(closest->time().in() - t); if (this_diff > stored_diff) { // Since the list is organized by time, if the diff increases, assume we are only going @@ -229,7 +221,7 @@ class MarkerChangeTimeCommand : public UndoCommand { public: MarkerChangeTimeCommand(TimelineMarker* marker, const TimeRange &time, const TimeRange &old_time); MarkerChangeTimeCommand(TimelineMarker* marker, const TimeRange &time) : - MarkerChangeTimeCommand(marker, time, marker->time_range()) + MarkerChangeTimeCommand(marker, time, marker->time()) {} virtual Project* GetRelevantProject() const override; diff --git a/app/timeline/timelinepoints.cpp b/app/timeline/timelinepoints.cpp index 61ed3633d..b7c2034bb 100644 --- a/app/timeline/timelinepoints.cpp +++ b/app/timeline/timelinepoints.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/timeline/timelinepoints.h b/app/timeline/timelinepoints.h index 62290bef4..02ea804ce 100644 --- a/app/timeline/timelinepoints.h +++ b/app/timeline/timelinepoints.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/timeline/timelineworkarea.cpp b/app/timeline/timelineworkarea.cpp index fdb831ab2..59cf04d49 100644 --- a/app/timeline/timelineworkarea.cpp +++ b/app/timeline/timelineworkarea.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/timeline/timelineworkarea.h b/app/timeline/timelineworkarea.h index c672a9c76..f100d8856 100644 --- a/app/timeline/timelineworkarea.h +++ b/app/timeline/timelineworkarea.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/tool/CMakeLists.txt b/app/tool/CMakeLists.txt index 0d78bd01f..7ae9ff94b 100644 --- a/app/tool/CMakeLists.txt +++ b/app/tool/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/tool/tool.h b/app/tool/tool.h index f6422e806..5cdff7aa1 100644 --- a/app/tool/tool.h +++ b/app/tool/tool.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/ts/CMakeLists.txt b/app/ts/CMakeLists.txt index 1725b16e1..8c153a4f9 100644 --- a/app/ts/CMakeLists.txt +++ b/app/ts/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/ui/CMakeLists.txt b/app/ui/CMakeLists.txt index b57cbde70..1aad55a4a 100644 --- a/app/ui/CMakeLists.txt +++ b/app/ui/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/ui/colorcoding.cpp b/app/ui/colorcoding.cpp index 93e8ea389..9e8fbb42b 100644 --- a/app/ui/colorcoding.cpp +++ b/app/ui/colorcoding.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/ui/colorcoding.h b/app/ui/colorcoding.h index 42606c765..4e8393c12 100644 --- a/app/ui/colorcoding.h +++ b/app/ui/colorcoding.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/ui/cursors/CMakeLists.txt b/app/ui/cursors/CMakeLists.txt index 45e9c96d4..2627d8432 100644 --- a/app/ui/cursors/CMakeLists.txt +++ b/app/ui/cursors/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/ui/graphics/CMakeLists.txt b/app/ui/graphics/CMakeLists.txt index 579f38a13..e32d639f3 100644 --- a/app/ui/graphics/CMakeLists.txt +++ b/app/ui/graphics/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/ui/icons/CMakeLists.txt b/app/ui/icons/CMakeLists.txt index a9167afc7..41fa1c3b9 100644 --- a/app/ui/icons/CMakeLists.txt +++ b/app/ui/icons/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/ui/icons/icons.cpp b/app/ui/icons/icons.cpp index cc79d834a..85288cb6b 100644 --- a/app/ui/icons/icons.cpp +++ b/app/ui/icons/icons.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -91,6 +91,8 @@ QIcon icon::EyeOpened; QIcon icon::EyeClosed; QIcon icon::LockOpened; QIcon icon::LockClosed; +QIcon icon::Pencil; +QIcon icon::Subtitles; void icon::LoadAll(const QString& theme) { @@ -161,6 +163,9 @@ void icon::LoadAll(const QString& theme) EyeClosed = Create(theme, "eye-closed"); LockOpened = Create(theme, "lock-opened"); LockClosed = Create(theme, "lock-closed"); + + Pencil = Create(theme, "text-edit"); + Subtitles = Create(theme, "subtitles"); } QIcon icon::Create(const QString& theme, const QString &name) diff --git a/app/ui/icons/icons.h b/app/ui/icons/icons.h index 987ab2b3b..83a9f18dc 100644 --- a/app/ui/icons/icons.h +++ b/app/ui/icons/icons.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -103,6 +103,8 @@ extern QIcon EyeOpened; extern QIcon EyeClosed; extern QIcon LockOpened; extern QIcon LockClosed; +extern QIcon Pencil; +extern QIcon Subtitles; /** * @brief Create an icon object loaded from file diff --git a/app/ui/style/CMakeLists.txt b/app/ui/style/CMakeLists.txt index 973beef16..62f48f031 100644 --- a/app/ui/style/CMakeLists.txt +++ b/app/ui/style/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/ui/style/generate-style.sh b/app/ui/style/generate-style.sh index 1fc2a897c..03a0af8a5 100755 --- a/app/ui/style/generate-style.sh +++ b/app/ui/style/generate-style.sh @@ -1,7 +1,7 @@ #!/bin/bash # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/ui/style/olive-dark/CMakeLists.txt b/app/ui/style/olive-dark/CMakeLists.txt index 7564656df..3a34de164 100644 --- a/app/ui/style/olive-dark/CMakeLists.txt +++ b/app/ui/style/olive-dark/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/ui/style/olive-dark/png/subtitles.128.disabled.png b/app/ui/style/olive-dark/png/subtitles.128.disabled.png new file mode 100644 index 000000000..74382a237 Binary files /dev/null and b/app/ui/style/olive-dark/png/subtitles.128.disabled.png differ diff --git a/app/ui/style/olive-dark/png/subtitles.128.png b/app/ui/style/olive-dark/png/subtitles.128.png new file mode 100644 index 000000000..28e2e278d Binary files /dev/null and b/app/ui/style/olive-dark/png/subtitles.128.png differ diff --git a/app/ui/style/olive-dark/png/subtitles.16.disabled.png b/app/ui/style/olive-dark/png/subtitles.16.disabled.png new file mode 100644 index 000000000..923c94072 Binary files /dev/null and b/app/ui/style/olive-dark/png/subtitles.16.disabled.png differ diff --git a/app/ui/style/olive-dark/png/subtitles.16.png b/app/ui/style/olive-dark/png/subtitles.16.png new file mode 100644 index 000000000..46e15b593 Binary files /dev/null and b/app/ui/style/olive-dark/png/subtitles.16.png differ diff --git a/app/ui/style/olive-dark/png/subtitles.32.disabled.png b/app/ui/style/olive-dark/png/subtitles.32.disabled.png new file mode 100644 index 000000000..aa143de89 Binary files /dev/null and b/app/ui/style/olive-dark/png/subtitles.32.disabled.png differ diff --git a/app/ui/style/olive-dark/png/subtitles.32.png b/app/ui/style/olive-dark/png/subtitles.32.png new file mode 100644 index 000000000..67038dcfa Binary files /dev/null and b/app/ui/style/olive-dark/png/subtitles.32.png differ diff --git a/app/ui/style/olive-dark/png/subtitles.64.disabled.png b/app/ui/style/olive-dark/png/subtitles.64.disabled.png new file mode 100644 index 000000000..22278781a Binary files /dev/null and b/app/ui/style/olive-dark/png/subtitles.64.disabled.png differ diff --git a/app/ui/style/olive-dark/png/subtitles.64.png b/app/ui/style/olive-dark/png/subtitles.64.png new file mode 100644 index 000000000..9e5d306bb Binary files /dev/null and b/app/ui/style/olive-dark/png/subtitles.64.png differ diff --git a/app/ui/style/olive-dark/style.css b/app/ui/style/olive-dark/style.css index badb22d35..b66c597a1 100644 --- a/app/ui/style/olive-dark/style.css +++ b/app/ui/style/olive-dark/style.css @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/ui/style/olive-dark/svg/subtitles.svg b/app/ui/style/olive-dark/svg/subtitles.svg new file mode 100644 index 000000000..9e1eb0d2e --- /dev/null +++ b/app/ui/style/olive-dark/svg/subtitles.svg @@ -0,0 +1,315 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Martin Ruskov + + + http://commons.wikimedia.org/wiki/Tango_icon + + + + + + + + + + + + + + + + + + diff --git a/app/ui/style/olive-light/CMakeLists.txt b/app/ui/style/olive-light/CMakeLists.txt index 7564656df..3a34de164 100644 --- a/app/ui/style/olive-light/CMakeLists.txt +++ b/app/ui/style/olive-light/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/ui/style/olive-light/png/subtitles.128.disabled.png b/app/ui/style/olive-light/png/subtitles.128.disabled.png new file mode 100644 index 000000000..e79ddd52e Binary files /dev/null and b/app/ui/style/olive-light/png/subtitles.128.disabled.png differ diff --git a/app/ui/style/olive-light/png/subtitles.128.png b/app/ui/style/olive-light/png/subtitles.128.png new file mode 100644 index 000000000..75a441517 Binary files /dev/null and b/app/ui/style/olive-light/png/subtitles.128.png differ diff --git a/app/ui/style/olive-light/png/subtitles.16.disabled.png b/app/ui/style/olive-light/png/subtitles.16.disabled.png new file mode 100644 index 000000000..eeedf1064 Binary files /dev/null and b/app/ui/style/olive-light/png/subtitles.16.disabled.png differ diff --git a/app/ui/style/olive-light/png/subtitles.16.png b/app/ui/style/olive-light/png/subtitles.16.png new file mode 100644 index 000000000..e7a564f2a Binary files /dev/null and b/app/ui/style/olive-light/png/subtitles.16.png differ diff --git a/app/ui/style/olive-light/png/subtitles.32.disabled.png b/app/ui/style/olive-light/png/subtitles.32.disabled.png new file mode 100644 index 000000000..d3c075f56 Binary files /dev/null and b/app/ui/style/olive-light/png/subtitles.32.disabled.png differ diff --git a/app/ui/style/olive-light/png/subtitles.32.png b/app/ui/style/olive-light/png/subtitles.32.png new file mode 100644 index 000000000..f38d36eff Binary files /dev/null and b/app/ui/style/olive-light/png/subtitles.32.png differ diff --git a/app/ui/style/olive-light/png/subtitles.64.disabled.png b/app/ui/style/olive-light/png/subtitles.64.disabled.png new file mode 100644 index 000000000..7bff5e203 Binary files /dev/null and b/app/ui/style/olive-light/png/subtitles.64.disabled.png differ diff --git a/app/ui/style/olive-light/png/subtitles.64.png b/app/ui/style/olive-light/png/subtitles.64.png new file mode 100644 index 000000000..3fc6061b8 Binary files /dev/null and b/app/ui/style/olive-light/png/subtitles.64.png differ diff --git a/app/ui/style/olive-light/style.css b/app/ui/style/olive-light/style.css index d56c6a08f..2913b1073 100644 --- a/app/ui/style/olive-light/style.css +++ b/app/ui/style/olive-light/style.css @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/ui/style/olive-light/svg/convert-to-dark.sh b/app/ui/style/olive-light/svg/convert-to-dark.sh index d6431190a..421fa968a 100755 --- a/app/ui/style/olive-light/svg/convert-to-dark.sh +++ b/app/ui/style/olive-light/svg/convert-to-dark.sh @@ -1,7 +1,7 @@ #!/bin/sh # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/ui/style/olive-light/svg/subtitles.svg b/app/ui/style/olive-light/svg/subtitles.svg new file mode 100644 index 000000000..2729f1b55 --- /dev/null +++ b/app/ui/style/olive-light/svg/subtitles.svg @@ -0,0 +1,315 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Martin Ruskov + + + http://commons.wikimedia.org/wiki/Tango_icon + + + + + + + + + + + + + + + + + + diff --git a/app/ui/style/style.cpp b/app/ui/style/style.cpp index af255fa38..a8038c4c3 100644 --- a/app/ui/style/style.cpp +++ b/app/ui/style/style.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/ui/style/style.h b/app/ui/style/style.h index 83c782f52..0ae18332d 100644 --- a/app/ui/style/style.h +++ b/app/ui/style/style.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/undo/CMakeLists.txt b/app/undo/CMakeLists.txt index 479b20606..e04e22502 100644 --- a/app/undo/CMakeLists.txt +++ b/app/undo/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/undo/undocommand.cpp b/app/undo/undocommand.cpp index 4a587c07c..5fba43b52 100644 --- a/app/undo/undocommand.cpp +++ b/app/undo/undocommand.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/undo/undocommand.h b/app/undo/undocommand.h index bd6032da2..196531150 100644 --- a/app/undo/undocommand.h +++ b/app/undo/undocommand.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/undo/undostack.cpp b/app/undo/undostack.cpp index 76ca50869..157ebda26 100644 --- a/app/undo/undostack.cpp +++ b/app/undo/undostack.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/undo/undostack.h b/app/undo/undostack.h index dda7a45b0..bc1550e7d 100644 --- a/app/undo/undostack.h +++ b/app/undo/undostack.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/version.cpp b/app/version.cpp index 1eee5aca1..dbc084361 100644 --- a/app/version.cpp +++ b/app/version.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/version.h b/app/version.h index 6ba399920..0970b87c5 100644 --- a/app/version.h +++ b/app/version.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/CMakeLists.txt b/app/widget/CMakeLists.txt index 9faf9c462..5f4ab85e6 100644 --- a/app/widget/CMakeLists.txt +++ b/app/widget/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/audiomonitor/CMakeLists.txt b/app/widget/audiomonitor/CMakeLists.txt index 793fe05dd..d2e8d2b50 100644 --- a/app/widget/audiomonitor/CMakeLists.txt +++ b/app/widget/audiomonitor/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/audiomonitor/audiomonitor.cpp b/app/widget/audiomonitor/audiomonitor.cpp index 982bb152a..8e7c945f5 100644 --- a/app/widget/audiomonitor/audiomonitor.cpp +++ b/app/widget/audiomonitor/audiomonitor.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/audiomonitor/audiomonitor.h b/app/widget/audiomonitor/audiomonitor.h index 3c5e27d81..d29b74491 100644 --- a/app/widget/audiomonitor/audiomonitor.h +++ b/app/widget/audiomonitor/audiomonitor.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/bezier/CMakeLists.txt b/app/widget/bezier/CMakeLists.txt index 7f73ab2ba..9c6460353 100644 --- a/app/widget/bezier/CMakeLists.txt +++ b/app/widget/bezier/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/bezier/bezierwidget.cpp b/app/widget/bezier/bezierwidget.cpp index 2f2dec995..bfce43a2b 100644 --- a/app/widget/bezier/bezierwidget.cpp +++ b/app/widget/bezier/bezierwidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/bezier/bezierwidget.h b/app/widget/bezier/bezierwidget.h index c052fd3b3..0faa721dc 100644 --- a/app/widget/bezier/bezierwidget.h +++ b/app/widget/bezier/bezierwidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/clickablelabel/CMakeLists.txt b/app/widget/clickablelabel/CMakeLists.txt index 43968fc25..0268a2a85 100644 --- a/app/widget/clickablelabel/CMakeLists.txt +++ b/app/widget/clickablelabel/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/clickablelabel/clickablelabel.cpp b/app/widget/clickablelabel/clickablelabel.cpp index e49bc0ffe..002ef49e3 100644 --- a/app/widget/clickablelabel/clickablelabel.cpp +++ b/app/widget/clickablelabel/clickablelabel.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/clickablelabel/clickablelabel.h b/app/widget/clickablelabel/clickablelabel.h index f95f9c1ca..0d9e20a39 100644 --- a/app/widget/clickablelabel/clickablelabel.h +++ b/app/widget/clickablelabel/clickablelabel.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/collapsebutton/CMakeLists.txt b/app/widget/collapsebutton/CMakeLists.txt index 904a36c46..a2ae50765 100644 --- a/app/widget/collapsebutton/CMakeLists.txt +++ b/app/widget/collapsebutton/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/collapsebutton/collapsebutton.cpp b/app/widget/collapsebutton/collapsebutton.cpp index 1b94fa53a..353d6fe42 100644 --- a/app/widget/collapsebutton/collapsebutton.cpp +++ b/app/widget/collapsebutton/collapsebutton.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/collapsebutton/collapsebutton.h b/app/widget/collapsebutton/collapsebutton.h index 5f643e9b9..81a0cceb4 100644 --- a/app/widget/collapsebutton/collapsebutton.h +++ b/app/widget/collapsebutton/collapsebutton.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorbutton/CMakeLists.txt b/app/widget/colorbutton/CMakeLists.txt index e7b8a3710..6c3c5fee6 100644 --- a/app/widget/colorbutton/CMakeLists.txt +++ b/app/widget/colorbutton/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorbutton/colorbutton.cpp b/app/widget/colorbutton/colorbutton.cpp index 92cc29b58..4abf33a30 100644 --- a/app/widget/colorbutton/colorbutton.cpp +++ b/app/widget/colorbutton/colorbutton.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorbutton/colorbutton.h b/app/widget/colorbutton/colorbutton.h index c8cad6c95..31ce5dfaa 100644 --- a/app/widget/colorbutton/colorbutton.h +++ b/app/widget/colorbutton/colorbutton.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorlabelmenu/CMakeLists.txt b/app/widget/colorlabelmenu/CMakeLists.txt index 0631ad3cc..221b11e23 100644 --- a/app/widget/colorlabelmenu/CMakeLists.txt +++ b/app/widget/colorlabelmenu/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorlabelmenu/colorcodingcombobox.cpp b/app/widget/colorlabelmenu/colorcodingcombobox.cpp index d1d5bc648..badff46e1 100644 --- a/app/widget/colorlabelmenu/colorcodingcombobox.cpp +++ b/app/widget/colorlabelmenu/colorcodingcombobox.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorlabelmenu/colorcodingcombobox.h b/app/widget/colorlabelmenu/colorcodingcombobox.h index d3fc92fe0..b0f9555b4 100644 --- a/app/widget/colorlabelmenu/colorcodingcombobox.h +++ b/app/widget/colorlabelmenu/colorcodingcombobox.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorlabelmenu/colorlabelmenu.cpp b/app/widget/colorlabelmenu/colorlabelmenu.cpp index 256d0bf45..8dfbb0e42 100644 --- a/app/widget/colorlabelmenu/colorlabelmenu.cpp +++ b/app/widget/colorlabelmenu/colorlabelmenu.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorlabelmenu/colorlabelmenu.h b/app/widget/colorlabelmenu/colorlabelmenu.h index 26ecefc1e..86c5fe5cd 100644 --- a/app/widget/colorlabelmenu/colorlabelmenu.h +++ b/app/widget/colorlabelmenu/colorlabelmenu.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorlabelmenu/colorlabelmenuitem.cpp b/app/widget/colorlabelmenu/colorlabelmenuitem.cpp index 93ccda0b9..935427bac 100644 --- a/app/widget/colorlabelmenu/colorlabelmenuitem.cpp +++ b/app/widget/colorlabelmenu/colorlabelmenuitem.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorlabelmenu/colorlabelmenuitem.h b/app/widget/colorlabelmenu/colorlabelmenuitem.h index 26ea4eb66..29307d681 100644 --- a/app/widget/colorlabelmenu/colorlabelmenuitem.h +++ b/app/widget/colorlabelmenu/colorlabelmenuitem.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/CMakeLists.txt b/app/widget/colorwheel/CMakeLists.txt index 35619e797..c5a8407f3 100644 --- a/app/widget/colorwheel/CMakeLists.txt +++ b/app/widget/colorwheel/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/colorgradientwidget.cpp b/app/widget/colorwheel/colorgradientwidget.cpp index 698fc9bed..a9a093a68 100644 --- a/app/widget/colorwheel/colorgradientwidget.cpp +++ b/app/widget/colorwheel/colorgradientwidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/colorgradientwidget.h b/app/widget/colorwheel/colorgradientwidget.h index 97723a7ab..1df64a8ed 100644 --- a/app/widget/colorwheel/colorgradientwidget.h +++ b/app/widget/colorwheel/colorgradientwidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/colorpreviewbox.cpp b/app/widget/colorwheel/colorpreviewbox.cpp index c2b0c3f89..7ee223cba 100644 --- a/app/widget/colorwheel/colorpreviewbox.cpp +++ b/app/widget/colorwheel/colorpreviewbox.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/colorpreviewbox.h b/app/widget/colorwheel/colorpreviewbox.h index 83c9071fa..f222219ac 100644 --- a/app/widget/colorwheel/colorpreviewbox.h +++ b/app/widget/colorwheel/colorpreviewbox.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/colorspacechooser.cpp b/app/widget/colorwheel/colorspacechooser.cpp index 8617f891d..02d82ac11 100644 --- a/app/widget/colorwheel/colorspacechooser.cpp +++ b/app/widget/colorwheel/colorspacechooser.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/colorspacechooser.h b/app/widget/colorwheel/colorspacechooser.h index 4bcf326b8..8879e1ebb 100644 --- a/app/widget/colorwheel/colorspacechooser.h +++ b/app/widget/colorwheel/colorspacechooser.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/colorswatchwidget.cpp b/app/widget/colorwheel/colorswatchwidget.cpp index 750ccbd4a..e61a799aa 100644 --- a/app/widget/colorwheel/colorswatchwidget.cpp +++ b/app/widget/colorwheel/colorswatchwidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/colorswatchwidget.h b/app/widget/colorwheel/colorswatchwidget.h index 9ba7fef02..0c68ae50b 100644 --- a/app/widget/colorwheel/colorswatchwidget.h +++ b/app/widget/colorwheel/colorswatchwidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/colorvalueswidget.cpp b/app/widget/colorwheel/colorvalueswidget.cpp index cb0218395..88bf46012 100644 --- a/app/widget/colorwheel/colorvalueswidget.cpp +++ b/app/widget/colorwheel/colorvalueswidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/colorvalueswidget.h b/app/widget/colorwheel/colorvalueswidget.h index c8822d5f2..5c0607043 100644 --- a/app/widget/colorwheel/colorvalueswidget.h +++ b/app/widget/colorwheel/colorvalueswidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/colorwheelwidget.cpp b/app/widget/colorwheel/colorwheelwidget.cpp index 5a2caaf63..954a905ee 100644 --- a/app/widget/colorwheel/colorwheelwidget.cpp +++ b/app/widget/colorwheel/colorwheelwidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/colorwheel/colorwheelwidget.h b/app/widget/colorwheel/colorwheelwidget.h index a3b77e772..2860b14bc 100644 --- a/app/widget/colorwheel/colorwheelwidget.h +++ b/app/widget/colorwheel/colorwheelwidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/columnedgridlayout/CMakeLists.txt b/app/widget/columnedgridlayout/CMakeLists.txt index de1b2eefa..bd9f28b35 100644 --- a/app/widget/columnedgridlayout/CMakeLists.txt +++ b/app/widget/columnedgridlayout/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/columnedgridlayout/columnedgridlayout.cpp b/app/widget/columnedgridlayout/columnedgridlayout.cpp index b85aa6eb3..6b9969064 100644 --- a/app/widget/columnedgridlayout/columnedgridlayout.cpp +++ b/app/widget/columnedgridlayout/columnedgridlayout.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/columnedgridlayout/columnedgridlayout.h b/app/widget/columnedgridlayout/columnedgridlayout.h index aaacf2575..666c3324b 100644 --- a/app/widget/columnedgridlayout/columnedgridlayout.h +++ b/app/widget/columnedgridlayout/columnedgridlayout.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/curvewidget/CMakeLists.txt b/app/widget/curvewidget/CMakeLists.txt index baafedb04..23546f74d 100644 --- a/app/widget/curvewidget/CMakeLists.txt +++ b/app/widget/curvewidget/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/curvewidget/curveview.cpp b/app/widget/curvewidget/curveview.cpp index 49748e5d2..10300b7ff 100644 --- a/app/widget/curvewidget/curveview.cpp +++ b/app/widget/curvewidget/curveview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/curvewidget/curveview.h b/app/widget/curvewidget/curveview.h index 1eb8355f1..a01598548 100644 --- a/app/widget/curvewidget/curveview.h +++ b/app/widget/curvewidget/curveview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,6 +41,11 @@ public: void SetKeyframeTrackColor(const NodeKeyframeTrackReference& ref, const QColor& color); + const QHash &GetConnections() const + { + return track_connections_; + } + public slots: void ZoomToFit(); diff --git a/app/widget/curvewidget/curvewidget.cpp b/app/widget/curvewidget/curvewidget.cpp index 516e4b378..d58bde7cd 100644 --- a/app/widget/curvewidget/curvewidget.cpp +++ b/app/widget/curvewidget/curvewidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -129,6 +129,36 @@ void CurveWidget::DeleteSelected() view_->DeleteSelected(); } +Node *CurveWidget::GetSelectedNodeWithID(const QString &id) +{ + for (auto it=view_->GetConnections().cbegin(); it!=view_->GetConnections().cend(); it++) { + Node *n = it.key().input().node(); + if (n->id() == id) { + return n; + } + } + + return nullptr; +} + +bool CurveWidget::CopySelected(bool cut) +{ + if (super::CopySelected(cut)) { + return true; + } + + return view_->CopySelected(cut); +} + +bool CurveWidget::Paste() +{ + if (super::Paste()) { + return true; + } + + return view_->Paste(std::bind(&CurveWidget::GetSelectedNodeWithID, this, std::placeholders::_1)); +} + void CurveWidget::SetNodes(const QVector &nodes) { tree_view_->SetNodes(nodes); diff --git a/app/widget/curvewidget/curvewidget.h b/app/widget/curvewidget/curvewidget.h index 3fd8ca4fe..5fae1b4df 100644 --- a/app/widget/curvewidget/curvewidget.h +++ b/app/widget/curvewidget/curvewidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -55,6 +55,12 @@ public: view_->DeselectAll(); } + Node *GetSelectedNodeWithID(const QString &id); + + virtual bool CopySelected(bool cut) override; + + virtual bool Paste() override; + public slots: void SetNodes(const QVector &nodes); diff --git a/app/widget/filefield/CMakeLists.txt b/app/widget/filefield/CMakeLists.txt index 0be41aef4..075a7aaf4 100644 --- a/app/widget/filefield/CMakeLists.txt +++ b/app/widget/filefield/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/filefield/filefield.cpp b/app/widget/filefield/filefield.cpp index cdf10f090..dde16dd36 100644 --- a/app/widget/filefield/filefield.cpp +++ b/app/widget/filefield/filefield.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/filefield/filefield.h b/app/widget/filefield/filefield.h index 38449372a..f8852eae4 100644 --- a/app/widget/filefield/filefield.h +++ b/app/widget/filefield/filefield.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/flowlayout/CMakeLists.txt b/app/widget/flowlayout/CMakeLists.txt index cbfad055b..74bf744b9 100644 --- a/app/widget/flowlayout/CMakeLists.txt +++ b/app/widget/flowlayout/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/focusablelineedit/CMakeLists.txt b/app/widget/focusablelineedit/CMakeLists.txt index 5015ce531..e040eb8a0 100644 --- a/app/widget/focusablelineedit/CMakeLists.txt +++ b/app/widget/focusablelineedit/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/focusablelineedit/focusablelineedit.cpp b/app/widget/focusablelineedit/focusablelineedit.cpp index d4bd47c96..3ddc9c806 100644 --- a/app/widget/focusablelineedit/focusablelineedit.cpp +++ b/app/widget/focusablelineedit/focusablelineedit.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/focusablelineedit/focusablelineedit.h b/app/widget/focusablelineedit/focusablelineedit.h index 945028faa..0ddfedb0c 100644 --- a/app/widget/focusablelineedit/focusablelineedit.h +++ b/app/widget/focusablelineedit/focusablelineedit.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/handmovableview/CMakeLists.txt b/app/widget/handmovableview/CMakeLists.txt index b1c8eae33..d69a10d4d 100644 --- a/app/widget/handmovableview/CMakeLists.txt +++ b/app/widget/handmovableview/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/handmovableview/handmovableview.cpp b/app/widget/handmovableview/handmovableview.cpp index 87086dcdc..25536ec7b 100644 --- a/app/widget/handmovableview/handmovableview.cpp +++ b/app/widget/handmovableview/handmovableview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/handmovableview/handmovableview.h b/app/widget/handmovableview/handmovableview.h index 9430406f2..e9579e7dd 100644 --- a/app/widget/handmovableview/handmovableview.h +++ b/app/widget/handmovableview/handmovableview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/keyframeview/CMakeLists.txt b/app/widget/keyframeview/CMakeLists.txt index d61022fbe..3c18f5453 100644 --- a/app/widget/keyframeview/CMakeLists.txt +++ b/app/widget/keyframeview/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/keyframeview/keyframeview.cpp b/app/widget/keyframeview/keyframeview.cpp index 16d845352..51ec2e724 100644 --- a/app/widget/keyframeview/keyframeview.cpp +++ b/app/widget/keyframeview/keyframeview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ #include "dialog/keyframeproperties/keyframeproperties.h" #include "keyframeviewundo.h" #include "node/node.h" +#include "node/project/serializer/serializer.h" #include "widget/menu/menu.h" #include "widget/menu/menushared.h" #include "widget/nodeparamview/nodeparamviewundo.h" @@ -52,13 +53,15 @@ KeyframeView::KeyframeView(QWidget *parent) : void KeyframeView::DeleteSelected() { - MultiUndoCommand* command = new MultiUndoCommand(); + if (!selection_manager_.IsDragging()) { + MultiUndoCommand* command = new MultiUndoCommand(); - foreach (NodeKeyframe *key, GetSelectedKeyframes()) { - command->add_child(new NodeParamRemoveKeyframeCommand(key)); + foreach (NodeKeyframe *key, GetSelectedKeyframes()) { + command->add_child(new NodeParamRemoveKeyframeCommand(key)); + } + + Core::instance()->undo_stack()->pushIfHasChildren(command); } - - Core::instance()->undo_stack()->pushIfHasChildren(command); } KeyframeView::NodeConnections KeyframeView::AddKeyframesOfNode(Node *n) @@ -181,6 +184,68 @@ void KeyframeView::SelectionManagerDeselectEvent(void *obj) emit SelectionChanged(); } +bool KeyframeView::CopySelected(bool cut) +{ + if (!selection_manager_.GetSelectedObjects().empty()) { + ProjectSerializer::SaveData sdata; + sdata.SetOnlySerializeKeyframes(selection_manager_.GetSelectedObjects()); + + ProjectSerializer::Copy(sdata, QStringLiteral("keyframes")); + + if (cut) { + DeleteSelected(); + } + + return true; + } + + return false; +} + +bool KeyframeView::Paste(std::function find_node_function) +{ + ProjectSerializer::Result res = ProjectSerializer::Paste(QStringLiteral("keyframes")); + if (res == ProjectSerializer::kSuccess) { + const ProjectSerializer::SerializedKeyframes &keys = res.GetLoadData().keyframes; + + MultiUndoCommand *command = new MultiUndoCommand(); + + rational min = RATIONAL_MAX; + for (auto it=keys.cbegin(); it!=keys.cend(); it++) { + for (NodeKeyframe *key : it.value()) { + min = std::min(min, key->time()); + } + } + min -= GetTime(); + + for (auto it=keys.cbegin(); it!=keys.cend(); it++) { + const QString &paste_id = it.key(); + + // Find a node with this ID + Node *node_with_id = find_node_function(paste_id); + + if (node_with_id) { + for (NodeKeyframe *key : it.value()) { + key->set_time(key->time() - min); + + if (NodeKeyframe *existing = node_with_id->GetKeyframeAtTimeOnTrack(key->input(), key->time(), key->track(), key->element())) { + command->add_child(new NodeParamRemoveKeyframeCommand(existing)); + } + + command->add_child(new NodeParamInsertKeyframeCommand(node_with_id, key)); + } + } else { + qDeleteAll(it.value()); + } + } + + Core::instance()->undo_stack()->pushIfHasChildren(command); + return true; + } + + return false; +} + void KeyframeView::mousePressEvent(QMouseEvent *event) { NodeKeyframe *key_under_cursor = selection_manager_.GetObjectAtPoint(event->pos()); diff --git a/app/widget/keyframeview/keyframeview.h b/app/widget/keyframeview/keyframeview.h index 096be2f9f..2558f8cc7 100644 --- a/app/widget/keyframeview/keyframeview.h +++ b/app/widget/keyframeview/keyframeview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,8 @@ #ifndef KEYFRAMEVIEWBASE_H #define KEYFRAMEVIEWBASE_H +#include + #include "keyframeviewinputconnection.h" #include "node/keyframe.h" #include "widget/menu/menu.h" @@ -77,6 +79,10 @@ public: UpdateSceneRect(); } + bool CopySelected(bool cut); + + bool Paste(std::function find_node_function); + signals: void Dragged(int current_x, int current_y); diff --git a/app/widget/keyframeview/keyframeviewinputconnection.cpp b/app/widget/keyframeview/keyframeviewinputconnection.cpp index c0d2c3f31..71ce62bc3 100644 --- a/app/widget/keyframeview/keyframeviewinputconnection.cpp +++ b/app/widget/keyframeview/keyframeviewinputconnection.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/keyframeview/keyframeviewinputconnection.h b/app/widget/keyframeview/keyframeviewinputconnection.h index 5b3275fc0..766879b93 100644 --- a/app/widget/keyframeview/keyframeviewinputconnection.h +++ b/app/widget/keyframeview/keyframeviewinputconnection.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,6 +60,11 @@ public: return brush_; } + const NodeKeyframeTrackReference &GetReference() const + { + return input_; + } + void SetBrush(const QBrush &brush); signals: diff --git a/app/widget/keyframeview/keyframeviewundo.cpp b/app/widget/keyframeview/keyframeviewundo.cpp index 784f805c9..3ccd0dd90 100644 --- a/app/widget/keyframeview/keyframeviewundo.cpp +++ b/app/widget/keyframeview/keyframeviewundo.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/keyframeview/keyframeviewundo.h b/app/widget/keyframeview/keyframeviewundo.h index c994d6f1a..b5adafca0 100644 --- a/app/widget/keyframeview/keyframeviewundo.h +++ b/app/widget/keyframeview/keyframeviewundo.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/manageddisplay/CMakeLists.txt b/app/widget/manageddisplay/CMakeLists.txt index 484324c8f..68b0be6e5 100644 --- a/app/widget/manageddisplay/CMakeLists.txt +++ b/app/widget/manageddisplay/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/manageddisplay/manageddisplay.cpp b/app/widget/manageddisplay/manageddisplay.cpp index 10a66bbcf..22589365e 100644 --- a/app/widget/manageddisplay/manageddisplay.cpp +++ b/app/widget/manageddisplay/manageddisplay.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/manageddisplay/manageddisplay.h b/app/widget/manageddisplay/manageddisplay.h index 6b3fd9ac3..94648c22e 100644 --- a/app/widget/manageddisplay/manageddisplay.h +++ b/app/widget/manageddisplay/manageddisplay.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/menu/CMakeLists.txt b/app/widget/menu/CMakeLists.txt index 9a25268c6..bf344cef8 100644 --- a/app/widget/menu/CMakeLists.txt +++ b/app/widget/menu/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/menu/menu.cpp b/app/widget/menu/menu.cpp index f1cd655c2..d6ae1d315 100644 --- a/app/widget/menu/menu.cpp +++ b/app/widget/menu/menu.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/menu/menu.h b/app/widget/menu/menu.h index 0bc4f4b7d..b25282505 100644 --- a/app/widget/menu/menu.h +++ b/app/widget/menu/menu.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/menu/menushared.cpp b/app/widget/menu/menushared.cpp index 7d6644e36..6dc566e31 100644 --- a/app/widget/menu/menushared.cpp +++ b/app/widget/menu/menushared.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/menu/menushared.h b/app/widget/menu/menushared.h index cdc3dcdec..8935457ca 100644 --- a/app/widget/menu/menushared.h +++ b/app/widget/menu/menushared.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodecombobox/CMakeLists.txt b/app/widget/nodecombobox/CMakeLists.txt index 3c66926fa..e26165b77 100644 --- a/app/widget/nodecombobox/CMakeLists.txt +++ b/app/widget/nodecombobox/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodecombobox/nodecombobox.cpp b/app/widget/nodecombobox/nodecombobox.cpp index ba219bbc0..455d3446e 100644 --- a/app/widget/nodecombobox/nodecombobox.cpp +++ b/app/widget/nodecombobox/nodecombobox.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodecombobox/nodecombobox.h b/app/widget/nodecombobox/nodecombobox.h index cf4785626..4eb3a62d8 100644 --- a/app/widget/nodecombobox/nodecombobox.h +++ b/app/widget/nodecombobox/nodecombobox.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/CMakeLists.txt b/app/widget/nodeparamview/CMakeLists.txt index 067ffad1f..8a891bf2c 100644 --- a/app/widget/nodeparamview/CMakeLists.txt +++ b/app/widget/nodeparamview/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamview.cpp b/app/widget/nodeparamview/nodeparamview.cpp index 2f97d8133..99a4cd95f 100644 --- a/app/widget/nodeparamview/nodeparamview.cpp +++ b/app/widget/nodeparamview/nodeparamview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ #include "nodeparamview.h" #include +#include #include #include #include @@ -28,6 +29,8 @@ #include "common/functiontimer.h" #include "common/timecodefunctions.h" #include "node/output/viewer/viewer.h" +#include "node/project/serializer/serializer.h" +#include "widget/nodeparamview/nodeparamviewundo.h" #include "widget/nodeview/nodeviewundo.h" #include "widget/timeruler/timeruler.h" @@ -317,6 +320,15 @@ void NodeParamView::SelectNodeFromConnectedLink(Node *node) SetSelectedNodes({p}); } +void NodeParamView::RequestEditTextInViewer() +{ + NodeParamViewItem *item = static_cast(sender()); + + focused_node_ = item; + emit FocusedNodeChanged(item->GetNode()); + emit RequestViewerToStartEditingText(); +} + void NodeParamView::SetContexts(const QVector &contexts) { // Setting contexts is expensive, so we queue it here to prevent multiple calls in a short timespan @@ -519,6 +531,162 @@ void NodeParamView::SetSelectedNodes(const QVector &nodes, bo } } +Node *NodeParamView::GetNodeWithID(const QString &id) +{ + return GetNodeWithIDAndIgnoreList(id, QVector()); +} + +Node *NodeParamView::GetNodeWithIDAndIgnoreList(const QString &id, const QVector &ignore) +{ + for (NodeParamViewItem *item : selected_nodes_) { + if (item->GetNode()->id() == id && !ignore.contains(item->GetNode())) { + return item->GetNode(); + } + } + + for (NodeParamViewContext *ctx : context_items_) { + for (NodeParamViewItem *item : ctx->GetItems()) { + if (item->GetNode()->id() == id && !ignore.contains(item->GetNode())) { + return item->GetNode(); + } + } + } + + return nullptr; +} + +bool NodeParamView::CopySelected(bool cut) +{ + if (super::CopySelected(cut)) { + return true; + } + + if (keyframe_view_ && keyframe_view_->hasFocus()) { + if (keyframe_view_->CopySelected(cut)) { + return true; + } + } + + if (contexts_.empty()) { + return false; + } + + ProjectSerializer::SaveData sdata(contexts_.first()->project()); + ProjectSerializer::SerializedProperties properties; + QVector nodes; + + for (NodeParamViewItem *item : selected_nodes_) { + Node *n = item->GetNode(); + + if (!nodes.contains(n)) { + nodes.append(n); + + Node::Position pos = item->GetContext()->GetNodePositionDataInContext(n); + + properties[n][QStringLiteral("x")] = QString::number(pos.position.x()); + properties[n][QStringLiteral("y")] = QString::number(pos.position.y()); + properties[n][QStringLiteral("expanded")] = QString::number(pos.expanded); + } + } + + sdata.SetOnlySerializeNodesAndResolveGroups(nodes); + sdata.SetProperties(properties); + + ProjectSerializer::Copy(sdata, QStringLiteral("nodes")); + + if (cut) { + DeleteSelected(); + } + + return false; +} + +bool NodeParamView::Paste() +{ + if (keyframe_view_) { + if (keyframe_view_->Paste(std::bind(&NodeParamView::GetNodeWithID, this, std::placeholders::_1))) { + return true; + } + } + + ProjectSerializer::Result res = ProjectSerializer::Paste(QStringLiteral("nodes")); + if (res.GetLoadedNodes().isEmpty()) { + return false; + } + + // Determine if any nodes of this type are already in the editor + QVector ignore_nodes; + QMap existing_nodes; + for (Node *n : res.GetLoadedNodes()) { + if (Node *existing = GetNodeWithIDAndIgnoreList(n->id(), ignore_nodes)) { + existing_nodes.insert(existing, n); + ignore_nodes.append(existing); + } + } + + QVector nodes_to_paste_as_new = res.GetLoadedNodes(); + MultiUndoCommand *command = new MultiUndoCommand(); + + if (!existing_nodes.empty()) { + QMessageBox b(this); + b.setWindowTitle(tr("Paste Nodes")); + + QStringList node_names; + for (auto it=existing_nodes.cbegin(); it!=existing_nodes.cend(); it++) { + node_names.append(it.key()->GetLabelAndName()); + } + + b.setText(tr("The following node types already exist in this context:\n\n" + "%1\n\n" + "Do you wish to paste values onto the existing nodes or paste new nodes?").arg(node_names.join('\n'))); + + auto as_vals = b.addButton(tr("Paste As Values"), QMessageBox::YesRole); + auto as_nodes = b.addButton(tr("Paste As Nodes"), QMessageBox::NoRole); + auto cancel_btn = b.addButton(QMessageBox::Cancel); + + Q_UNUSED(as_nodes) + + b.exec(); + + if (b.clickedButton() == cancel_btn) { + + // Delete pasted nodes and clear array so no later code runs + qDeleteAll(nodes_to_paste_as_new); + nodes_to_paste_as_new.clear(); + + } else if (b.clickedButton() == as_vals) { + + // Filter out existing nodes + for (auto it=existing_nodes.cbegin(); it!=existing_nodes.cend(); it++) { + Node::CopyInputs(it.value(), it.key(), false, command); + nodes_to_paste_as_new.removeOne(it.value()); + } + + } + } + + if (!nodes_to_paste_as_new.isEmpty()) { + Node::PositionMap map; + + for (auto it=res.GetLoadData().properties.cbegin(); it!=res.GetLoadData().properties.cend(); it++) { + if (nodes_to_paste_as_new.contains(it.key())) { + Node::Position pos; + + const QMap &node_props = it.value(); + pos.position.setX(node_props.value(QStringLiteral("x")).toDouble()); + pos.position.setY(node_props.value(QStringLiteral("y")).toDouble()); + pos.expanded = node_props.value(QStringLiteral("expanded")).toDouble(); + + map.insert(it.key(), pos); + } + } + } + + Core::instance()->undo_stack()->pushIfHasChildren(command); + + return true; +} + void NodeParamView::UpdateItemTime(const rational &time) { foreach (NodeParamViewContext* item, context_items_) { @@ -576,6 +744,7 @@ void NodeParamView::AddNode(Node *n, Node *ctx, NodeParamViewContext *context) connect(item, &NodeParamViewItem::PinToggled, this, &NodeParamView::PinNode); connect(item, &NodeParamViewItem::InputCheckedChanged, this, &NodeParamView::InputCheckBoxChanged); connect(item, &NodeParamViewItem::Clicked, this, &NodeParamView::ItemClicked); + connect(item, &NodeParamViewItem::RequestEditTextInViewer, this, &NodeParamView::RequestEditTextInViewer); item->SetContext(ctx); item->SetTimeTarget(GetTimeTarget()); @@ -764,14 +933,14 @@ void NodeParamView::KeyframeViewDragged(int x, int y) void NodeParamView::UpdateElementY() { - foreach (NodeParamViewContext *ctx, context_items_) { + for (NodeParamViewContext *ctx : context_items_) { for (auto it=ctx->GetItems().cbegin(); it!=ctx->GetItems().cend(); it++) { NodeParamViewItem *item = *it; Node *node = item->GetNode(); const KeyframeView::NodeConnections &connections = item->GetKeyframeConnections(); if (!connections.isEmpty()) { - foreach (const QString& input, node->inputs()) { + for (const QString& input : node->inputs()) { if (!(node->GetInputFlags(input) & kInputFlagHidden)) { int arr_sz = NodeGroup::ResolveInput(NodeInput(node, input)).GetArraySize(); @@ -787,7 +956,7 @@ void NodeParamView::UpdateElementY() int use_index = i + 1; if (use_index < input_con.size()) { const KeyframeView::ElementConnections &ele_con = input_con.at(ic.element()+1); - foreach (KeyframeViewInputConnection *track, ele_con) { + for (KeyframeViewInputConnection *track : ele_con) { track->SetKeyframeY(y); } } diff --git a/app/widget/nodeparamview/nodeparamview.h b/app/widget/nodeparamview/nodeparamview.h index 3b90e22b7..ba918d373 100644 --- a/app/widget/nodeparamview/nodeparamview.h +++ b/app/widget/nodeparamview/nodeparamview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -64,11 +64,18 @@ public: void SetSelectedNodes(const QVector &nodes, bool handle_focused_node = true, bool emit_signal = true); void SetSelectedNodes(const QVector &nodes, bool emit_signal = true); + Node *GetNodeWithID(const QString &id); + Node *GetNodeWithIDAndIgnoreList(const QString &id, const QVector &ignore); + const QVector &GetContexts() const { return contexts_; } + virtual bool CopySelected(bool cut) override; + + virtual bool Paste() override; + public slots: void SetContexts(const QVector &contexts); @@ -79,6 +86,8 @@ signals: void SelectedNodesChanged(const QVector &nodes); + void RequestViewerToStartEditingText(); + protected: virtual void resizeEvent(QResizeEvent *event) override; @@ -175,6 +184,8 @@ private slots: void SelectNodeFromConnectedLink(Node *node); + void RequestEditTextInViewer(); + }; } diff --git a/app/widget/nodeparamview/nodeparamviewarraywidget.cpp b/app/widget/nodeparamview/nodeparamviewarraywidget.cpp index 97f1b0567..262a55a4d 100644 --- a/app/widget/nodeparamview/nodeparamviewarraywidget.cpp +++ b/app/widget/nodeparamview/nodeparamviewarraywidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewarraywidget.h b/app/widget/nodeparamview/nodeparamviewarraywidget.h index 41926693b..59ed985aa 100644 --- a/app/widget/nodeparamview/nodeparamviewarraywidget.h +++ b/app/widget/nodeparamview/nodeparamviewarraywidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewconnectedlabel.cpp b/app/widget/nodeparamview/nodeparamviewconnectedlabel.cpp index d55fbe103..824452f4b 100644 --- a/app/widget/nodeparamview/nodeparamviewconnectedlabel.cpp +++ b/app/widget/nodeparamview/nodeparamviewconnectedlabel.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewconnectedlabel.h b/app/widget/nodeparamview/nodeparamviewconnectedlabel.h index 3e4fc5f55..183ff633b 100644 --- a/app/widget/nodeparamview/nodeparamviewconnectedlabel.h +++ b/app/widget/nodeparamview/nodeparamviewconnectedlabel.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewcontext.cpp b/app/widget/nodeparamview/nodeparamviewcontext.cpp index 8fe70ca7a..6e83a617b 100644 --- a/app/widget/nodeparamview/nodeparamviewcontext.cpp +++ b/app/widget/nodeparamview/nodeparamviewcontext.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewcontext.h b/app/widget/nodeparamview/nodeparamviewcontext.h index 29be6dd58..256f772aa 100644 --- a/app/widget/nodeparamview/nodeparamviewcontext.h +++ b/app/widget/nodeparamview/nodeparamviewcontext.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewdockarea.cpp b/app/widget/nodeparamview/nodeparamviewdockarea.cpp index 7f6c32e0d..15975145c 100644 --- a/app/widget/nodeparamview/nodeparamviewdockarea.cpp +++ b/app/widget/nodeparamview/nodeparamviewdockarea.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewdockarea.h b/app/widget/nodeparamview/nodeparamviewdockarea.h index 099eb087c..303dc9686 100644 --- a/app/widget/nodeparamview/nodeparamviewdockarea.h +++ b/app/widget/nodeparamview/nodeparamviewdockarea.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewitem.cpp b/app/widget/nodeparamview/nodeparamviewitem.cpp index 9cba6f83c..05e9fe932 100644 --- a/app/widget/nodeparamview/nodeparamviewitem.cpp +++ b/app/widget/nodeparamview/nodeparamviewitem.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ const int NodeParamViewItemBody::kOptionalCheckBox = 0; const int NodeParamViewItemBody::kArrayCollapseBtnColumn = 1; const int NodeParamViewItemBody::kLabelColumn = 2; const int NodeParamViewItemBody::kWidgetStartColumn = 3; -const int NodeParamViewItemBody::kMaxWidgetColumn = kKeyControlColumn; +const int NodeParamViewItemBody::kMaxWidgetColumn = kArrayRemoveColumn; #define super NodeParamViewItemBase @@ -90,6 +90,7 @@ void NodeParamViewItem::RecreateBody() connect(body_, &NodeParamViewItemBody::RequestSetTime, this, &NodeParamViewItem::RequestSetTime); connect(body_, &NodeParamViewItemBody::ArrayExpandedChanged, this, &NodeParamViewItem::ArrayExpandedChanged); connect(body_, &NodeParamViewItemBody::InputCheckedChanged, this, &NodeParamViewItem::InputCheckedChanged); + connect(body_, &NodeParamViewItemBody::RequestEditTextInViewer, this, &NodeParamViewItem::RequestEditTextInViewer); body_->Retranslate(); body_->SetTime(time_); body_->SetTimebase(timebase_); @@ -237,6 +238,7 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout* layout, Node *node, const ui_objects.widget_bridge = new NodeParamViewWidgetBridge(NodeInput(node, input, element), this); connect(ui_objects.widget_bridge, &NodeParamViewWidgetBridge::WidgetsRecreated, this, &NodeParamViewItemBody::ReplaceWidgets); connect(ui_objects.widget_bridge, &NodeParamViewWidgetBridge::ArrayWidgetDoubleClicked, this, &NodeParamViewItemBody::ToggleArrayExpanded); + connect(ui_objects.widget_bridge, &NodeParamViewWidgetBridge::RequestEditTextInViewer, this, &NodeParamViewItemBody::RequestEditTextInViewer); // Place widgets into layout PlaceWidgetsFromBridge(layout, ui_objects.widget_bridge, row); diff --git a/app/widget/nodeparamview/nodeparamviewitem.h b/app/widget/nodeparamview/nodeparamviewitem.h index 1653a5ada..8ec20bb6a 100644 --- a/app/widget/nodeparamview/nodeparamviewitem.h +++ b/app/widget/nodeparamview/nodeparamviewitem.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -73,6 +73,8 @@ signals: void InputCheckedChanged(const NodeInput &input, bool e); + void RequestEditTextInViewer(); + private: void CreateWidgets(QGridLayout *layout, Node* node, const QString& input, int element, int row_index); @@ -222,6 +224,8 @@ signals: void InputCheckedChanged(const NodeInput &input, bool e); + void RequestEditTextInViewer(); + protected slots: virtual void Retranslate() override; diff --git a/app/widget/nodeparamview/nodeparamviewitembase.cpp b/app/widget/nodeparamview/nodeparamviewitembase.cpp index 645ee79f1..9d58f1b9f 100644 --- a/app/widget/nodeparamview/nodeparamviewitembase.cpp +++ b/app/widget/nodeparamview/nodeparamviewitembase.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewitembase.h b/app/widget/nodeparamview/nodeparamviewitembase.h index a728bb93f..ff31fa104 100644 --- a/app/widget/nodeparamview/nodeparamviewitembase.h +++ b/app/widget/nodeparamview/nodeparamviewitembase.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,6 +41,8 @@ public: update(); } + bool IsHighlighted() const { return highlighted_; } + bool IsExpanded() const; static QString GetTitleBarTextFromNode(Node *n); diff --git a/app/widget/nodeparamview/nodeparamviewitemtitlebar.cpp b/app/widget/nodeparamview/nodeparamviewitemtitlebar.cpp index efe3d2768..0e9aa6b32 100644 --- a/app/widget/nodeparamview/nodeparamviewitemtitlebar.cpp +++ b/app/widget/nodeparamview/nodeparamviewitemtitlebar.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewitemtitlebar.h b/app/widget/nodeparamview/nodeparamviewitemtitlebar.h index 7024c9e82..aa2c4ad2c 100644 --- a/app/widget/nodeparamview/nodeparamviewitemtitlebar.h +++ b/app/widget/nodeparamview/nodeparamviewitemtitlebar.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewkeyframecontrol.cpp b/app/widget/nodeparamview/nodeparamviewkeyframecontrol.cpp index e6785b388..c431966a8 100644 --- a/app/widget/nodeparamview/nodeparamviewkeyframecontrol.cpp +++ b/app/widget/nodeparamview/nodeparamviewkeyframecontrol.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewkeyframecontrol.h b/app/widget/nodeparamview/nodeparamviewkeyframecontrol.h index c9d9d2c1a..c11b206e0 100644 --- a/app/widget/nodeparamview/nodeparamviewkeyframecontrol.h +++ b/app/widget/nodeparamview/nodeparamviewkeyframecontrol.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeparamview/nodeparamviewtextedit.cpp b/app/widget/nodeparamview/nodeparamviewtextedit.cpp index ab4a77295..6e3b291cc 100644 --- a/app/widget/nodeparamview/nodeparamviewtextedit.cpp +++ b/app/widget/nodeparamview/nodeparamviewtextedit.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,7 +21,6 @@ #include "nodeparamviewtextedit.h" #include -#include #include "dialog/text/text.h" #include "ui/icons/icons.h" @@ -39,11 +38,25 @@ NodeParamViewTextEdit::NodeParamViewTextEdit(QWidget *parent) : connect(line_edit_, &QPlainTextEdit::textChanged, this, &NodeParamViewTextEdit::InnerWidgetTextChanged); layout->addWidget(line_edit_); - QPushButton* edit_btn = new QPushButton(); - edit_btn->setIcon(icon::ToolEdit); - edit_btn->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding); - layout->addWidget(edit_btn); - connect(edit_btn, &QPushButton::clicked, this, &NodeParamViewTextEdit::ShowTextDialog); + edit_btn_ = new QPushButton(); + edit_btn_->setIcon(icon::ToolEdit); + edit_btn_->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding); + layout->addWidget(edit_btn_); + connect(edit_btn_, &QPushButton::clicked, this, &NodeParamViewTextEdit::ShowTextDialog); + + edit_in_viewer_btn_ = new QPushButton(tr("Edit In Viewer")); + edit_in_viewer_btn_->setIcon(icon::Pencil); + layout->addWidget(edit_in_viewer_btn_); + connect(edit_in_viewer_btn_, &QPushButton::clicked, this, &NodeParamViewTextEdit::RequestEditInViewer); + + SetEditInViewerOnlyMode(false); +} + +void NodeParamViewTextEdit::SetEditInViewerOnlyMode(bool on) +{ + line_edit_->setVisible(!on); + edit_btn_->setVisible(!on); + edit_in_viewer_btn_->setVisible(on); } void NodeParamViewTextEdit::ShowTextDialog() diff --git a/app/widget/nodeparamview/nodeparamviewtextedit.h b/app/widget/nodeparamview/nodeparamviewtextedit.h index ece9f03a0..2c2577566 100644 --- a/app/widget/nodeparamview/nodeparamviewtextedit.h +++ b/app/widget/nodeparamview/nodeparamviewtextedit.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ #define NODEPARAMVIEWTEXTEDIT_H #include +#include #include #include "common/define.h" @@ -39,6 +40,8 @@ public: return line_edit_->toPlainText(); } + void SetEditInViewerOnlyMode(bool on); + public slots: void setText(const QString &s) { @@ -64,9 +67,15 @@ public slots: signals: void textEdited(const QString &); + void RequestEditInViewer(); + private: QPlainTextEdit* line_edit_; + QPushButton* edit_btn_; + + QPushButton *edit_in_viewer_btn_; + private slots: void ShowTextDialog(); diff --git a/app/widget/nodeparamview/nodeparamviewundo.cpp b/app/widget/nodeparamview/nodeparamviewundo.cpp index d93cb3549..a3e448fda 100644 --- a/app/widget/nodeparamview/nodeparamviewundo.cpp +++ b/app/widget/nodeparamview/nodeparamviewundo.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,9 +27,8 @@ namespace olive { NodeParamSetKeyframingCommand::NodeParamSetKeyframingCommand(const NodeInput &input, bool setting) : input_(input), - setting_(setting) + new_setting_(setting) { - Q_ASSERT(setting != input_.IsKeyframing()); } Project *NodeParamSetKeyframingCommand::GetRelevantProject() const @@ -39,12 +38,13 @@ Project *NodeParamSetKeyframingCommand::GetRelevantProject() const void NodeParamSetKeyframingCommand::redo() { - input_.node()->SetInputIsKeyframing(input_, setting_); + old_setting_ = input_.IsKeyframing(); + input_.node()->SetInputIsKeyframing(input_, new_setting_); } void NodeParamSetKeyframingCommand::undo() { - input_.node()->SetInputIsKeyframing(input_, !setting_); + input_.node()->SetInputIsKeyframing(input_, old_setting_); } NodeParamSetKeyframeValueCommand::NodeParamSetKeyframeValueCommand(NodeKeyframe* key, const QVariant& value) : diff --git a/app/widget/nodeparamview/nodeparamviewundo.h b/app/widget/nodeparamview/nodeparamviewundo.h index 595aecaab..90cdce452 100644 --- a/app/widget/nodeparamview/nodeparamviewundo.h +++ b/app/widget/nodeparamview/nodeparamviewundo.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,8 @@ protected: private: NodeInput input_; - bool setting_; + bool new_setting_; + bool old_setting_; }; @@ -145,6 +146,43 @@ private: }; +class NodeParamSetSplitStandardValueCommand : public UndoCommand +{ +public: + NodeParamSetSplitStandardValueCommand(const NodeInput& input, const SplitValue& new_value, const SplitValue& old_value) : + ref_(input), + old_value_(old_value), + new_value_(new_value) + {} + + NodeParamSetSplitStandardValueCommand(const NodeInput& input, const SplitValue& value) : + NodeParamSetSplitStandardValueCommand(input, value, input.node()->GetSplitStandardValue(input.input())) + {} + + virtual Project* GetRelevantProject() const override + { + return ref_.node()->project(); + } + +protected: + virtual void redo() override + { + ref_.node()->SetSplitStandardValue(ref_.input(), new_value_, ref_.element()); + } + + virtual void undo() override + { + ref_.node()->SetSplitStandardValue(ref_.input(), old_value_, ref_.element()); + } + +private: + NodeInput ref_; + + SplitValue old_value_; + SplitValue new_value_; + +}; + class NodeParamArrayAppendCommand : public UndoCommand { public: diff --git a/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp b/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp index c25848f03..9f0ae6ac8 100644 --- a/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp +++ b/app/widget/nodeparamview/nodeparamviewwidgetbridge.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -89,6 +89,7 @@ void NodeParamViewWidgetBridge::CreateWidgets() case NodeValue::kSamples: case NodeValue::kVideoParams: case NodeValue::kAudioParams: + case NodeValue::kSubtitleParams: case NodeValue::kDataTypeCount: break; case NodeValue::kInt: @@ -141,6 +142,7 @@ void NodeParamViewWidgetBridge::CreateWidgets() NodeParamViewTextEdit* line_edit = new NodeParamViewTextEdit(); widgets_.append(line_edit); connect(line_edit, &NodeParamViewTextEdit::textEdited, this, &NodeParamViewWidgetBridge::WidgetCallback); + connect(line_edit, &NodeParamViewTextEdit::RequestEditInViewer, this, &NodeParamViewWidgetBridge::RequestEditTextInViewer); break; } case NodeValue::kBoolean: @@ -239,6 +241,7 @@ void NodeParamViewWidgetBridge::WidgetCallback() case NodeValue::kSamples: case NodeValue::kVideoParams: case NodeValue::kAudioParams: + case NodeValue::kSubtitleParams: case NodeValue::kDataTypeCount: break; case NodeValue::kInt: @@ -416,6 +419,7 @@ void NodeParamViewWidgetBridge::UpdateWidgetValues() case NodeValue::kSamples: case NodeValue::kVideoParams: case NodeValue::kAudioParams: + case NodeValue::kSubtitleParams: case NodeValue::kDataTypeCount: break; case NodeValue::kInt: @@ -781,6 +785,15 @@ void NodeParamViewWidgetBridge::SetProperty(const QString &key, const QVariant & ff->SetDirectoryMode(value.toBool()); } } + + // Parameters for text + if (data_type == NodeValue::kText) { + NodeParamViewTextEdit *tex = static_cast(widgets_.first()); + + if (key == QStringLiteral("vieweronly")) { + tex->SetEditInViewerOnlyMode(value.toBool()); + } + } } void NodeParamViewWidgetBridge::InputDataTypeChanged(const QString &input, NodeValue::Type type) diff --git a/app/widget/nodeparamview/nodeparamviewwidgetbridge.h b/app/widget/nodeparamview/nodeparamviewwidgetbridge.h index 0f80a443b..98a71d5d7 100644 --- a/app/widget/nodeparamview/nodeparamviewwidgetbridge.h +++ b/app/widget/nodeparamview/nodeparamviewwidgetbridge.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,6 +57,8 @@ signals: void WidgetsRecreated(const NodeInput& input); + void RequestEditTextInViewer(); + private: void CreateWidgets(); diff --git a/app/widget/nodetableview/CMakeLists.txt b/app/widget/nodetableview/CMakeLists.txt index 4e4f8b2a6..2132ccd6a 100644 --- a/app/widget/nodetableview/CMakeLists.txt +++ b/app/widget/nodetableview/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodetableview/nodetableview.cpp b/app/widget/nodetableview/nodetableview.cpp index 8981552fa..f191f4b64 100644 --- a/app/widget/nodetableview/nodetableview.cpp +++ b/app/widget/nodetableview/nodetableview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodetableview/nodetableview.h b/app/widget/nodetableview/nodetableview.h index a964aafdd..3c4cf87ca 100644 --- a/app/widget/nodetableview/nodetableview.h +++ b/app/widget/nodetableview/nodetableview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodetableview/nodetablewidget.cpp b/app/widget/nodetableview/nodetablewidget.cpp index bcb1b77a1..48091357f 100644 --- a/app/widget/nodetableview/nodetablewidget.cpp +++ b/app/widget/nodetableview/nodetablewidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodetableview/nodetablewidget.h b/app/widget/nodetableview/nodetablewidget.h index 13d800799..24907553f 100644 --- a/app/widget/nodetableview/nodetablewidget.h +++ b/app/widget/nodetableview/nodetablewidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodetreeview/CMakeLists.txt b/app/widget/nodetreeview/CMakeLists.txt index 3238df801..a8b5b6dce 100644 --- a/app/widget/nodetreeview/CMakeLists.txt +++ b/app/widget/nodetreeview/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodetreeview/nodetreeview.cpp b/app/widget/nodetreeview/nodetreeview.cpp index fd0afc2d9..f54757c92 100644 --- a/app/widget/nodetreeview/nodetreeview.cpp +++ b/app/widget/nodetreeview/nodetreeview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodetreeview/nodetreeview.h b/app/widget/nodetreeview/nodetreeview.h index 067a4c82a..82504a79e 100644 --- a/app/widget/nodetreeview/nodetreeview.h +++ b/app/widget/nodetreeview/nodetreeview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodevaluetree/CMakeLists.txt b/app/widget/nodevaluetree/CMakeLists.txt index a297a7dd3..44ed10d5b 100644 --- a/app/widget/nodevaluetree/CMakeLists.txt +++ b/app/widget/nodevaluetree/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodevaluetree/nodevaluetree.cpp b/app/widget/nodevaluetree/nodevaluetree.cpp index 2f263b125..d980d57a1 100644 --- a/app/widget/nodevaluetree/nodevaluetree.cpp +++ b/app/widget/nodevaluetree/nodevaluetree.cpp @@ -31,9 +31,8 @@ void NodeValueTree::SetNode(const NodeInput &input, const rational &time) NodeTraverser traverser; Node *connected_node = input.GetConnectedOutput(); - Node::ValueHint value_hint = input.node()->GetValueHintForInput(input.input(), input.element()); - NodeValueTable table = traverser.GenerateTable(connected_node, value_hint, TimeRange(time, time)); + NodeValueTable table = traverser.GenerateTable(connected_node, TimeRange(time, time)); int index = traverser.GenerateRowValueElementIndex(input.node(), input.input(), input.element(), &table); diff --git a/app/widget/nodeview/CMakeLists.txt b/app/widget/nodeview/CMakeLists.txt index cf3a2375e..6395ae407 100644 --- a/app/widget/nodeview/CMakeLists.txt +++ b/app/widget/nodeview/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeview/nodeview.cpp b/app/widget/nodeview/nodeview.cpp index f8af45ca6..7e3f9e138 100644 --- a/app/widget/nodeview/nodeview.cpp +++ b/app/widget/nodeview/nodeview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -539,78 +540,7 @@ void NodeView::mouseMoveEvent(QMouseEvent *event) // See if there are any items attached if (!attached_items_.isEmpty()) { - // Move those items to the cursor - MoveAttachedNodesToCursor(event->pos()); - - // See if the user clicked on an edge (only when dropping single nodes) - if (attached_items_.size() == 1) { - Node* attached_node = attached_items_.first().item->GetNode(); - - QRect edge_detect_rect(event->pos(), event->pos()); - - int edge_detect_radius = fontMetrics().height(); - edge_detect_rect.adjust(-edge_detect_radius, -edge_detect_radius, edge_detect_radius, edge_detect_radius); - - QList items = this->items(edge_detect_rect); - - NodeViewEdge* new_drop_edge = nullptr; - - // See if there is an edge here - for (QGraphicsItem* item : qAsConst(items)) { - new_drop_edge = dynamic_cast(item); - - if (new_drop_edge) { - drop_input_.Reset(); - - NodeValue::Type drop_edge_data_type = new_drop_edge->input().GetDataType(); - - // Determine best input to connect to our new node - if (attached_node->GetEffectInput().IsValid()) { - // If node specifies an effect input, use that immediately - drop_input_ = attached_node->GetEffectInput(); - } else { - // Otherwise, we may have to iterate to find a valid one - for (const QString& input : attached_node->inputs()) { - if (input == Node::kEnabledInput) { - // Ignore enabled input - continue; - } - - NodeInput i(attached_node, input); - - if (attached_node->IsInputConnectable(input)) { - if (attached_node->GetInputDataType(input) == drop_edge_data_type) { - // Found exactly the type we're looking for, set and break this loop - drop_input_ = i; - break; - } else if (!drop_input_.IsValid()) { - // Default to first connectable input - drop_input_ = i; - } - } - } - } - - if (drop_input_.IsValid()) { - break; - } else { - new_drop_edge = nullptr; - } - } - } - - if (drop_edge_ != new_drop_edge) { - if (drop_edge_) { - drop_edge_->SetHighlighted(false); - } - - drop_edge_ = new_drop_edge; - - if (drop_edge_) { - drop_edge_->SetHighlighted(true); - } - } - } + ProcessMovingAttachedNodes(event->pos()); } } @@ -630,72 +560,10 @@ void NodeView::mouseReleaseEvent(QMouseEvent *event) bool had_attached_items = !attached_items_.isEmpty(); if (!attached_items_.isEmpty()) { - select_context = nullptr; - - QList items_at_cursor = this->items(event->pos()); - foreach (QGraphicsItem *i, items_at_cursor) { - if (NodeViewContext *context_item = dynamic_cast(i)) { - select_context = context_item->GetContext(); - break; - } - } + select_context = GetContextAtMousePos(event->pos()); if (select_context) { - { - MultiUndoCommand *add_command = new MultiUndoCommand(); - - foreach (const AttachedItem &ai, attached_items_) { - // Add node to the same graph that the context is in - add_command->add_child(new NodeAddCommand(select_context->parent(), ai.node)); - - // Add node to the context - if (ai.item) { - add_command->add_child(new NodeSetPositionCommand(ai.node, select_context, scene_.context_map().value(select_context)->MapScenePosToNodePosInContext(ai.item->pos()))); - select_nodes.append(ai.node); - } - } - - if (add_command->child_count()) { - add_command->redo_now(); - command->add_child(add_command); - } else { - delete add_command; - } - } - - { - // Dropped attached item onto an edge, connect it between them - MultiUndoCommand *drop_edge_command = new MultiUndoCommand(); - if (attached_items_.size() == 1) { - Node* dropping_node = nullptr; - - foreach (const AttachedItem &ai, attached_items_) { - if (ai.item) { - dropping_node = ai.node; - break; - } - } - - if (dropping_node && drop_edge_) { - // Remove old edge - drop_edge_command->add_child(new NodeEdgeRemoveCommand(drop_edge_->output(), drop_edge_->input())); - - // Place new edges - drop_edge_command->add_child(new NodeEdgeAddCommand(drop_edge_->output(), drop_input_)); - drop_edge_command->add_child(new NodeEdgeAddCommand(dropping_node, drop_edge_->input())); - } - - drop_edge_ = nullptr; - } - if (drop_edge_command->child_count()) { - drop_edge_command->redo_now(); - command->add_child(drop_edge_command); - } else { - delete drop_edge_command; - } - } - - DetachItemsFromCursor(false); + select_nodes = ProcessDroppingAttachedNodes(command, select_context, event->pos()); } else { QToolTip::showText(QCursor::pos(), tr("Nodes must be placed inside a context.")); } @@ -717,6 +585,7 @@ void NodeView::mouseReleaseEvent(QMouseEvent *event) } if (select_context) { + DeselectAll(); scene_.context_map().value(select_context)->Select(select_nodes); } } @@ -733,6 +602,98 @@ void NodeView::mouseDoubleClickEvent(QMouseEvent *event) } } +void NodeView::dragEnterEvent(QDragEnterEvent *event) +{ + if (contexts_.empty()) { + event->ignore(); + return; + } + + QStringList mime_fmts = event->mimeData()->formats(); + + if (mime_fmts.contains(Project::kItemMimeType)) { + QByteArray model_data = event->mimeData()->data(Project::kItemMimeType); + QDataStream stream(&model_data, QIODevice::ReadOnly); + + // Variables to deserialize into + quintptr item_ptr; + QVector enabled_streams; + QVector new_attached; + + int y = 0; + + while (!stream.atEnd()) { + stream >> enabled_streams >> item_ptr; + + // Get Item object + Node* item = reinterpret_cast(item_ptr); + + if (ViewerOutput* f = dynamic_cast(item)) { + NodeViewItem *new_item; + + new_item = new NodeViewItem(f, nullptr); + new_item->SetFlowDirection(scene_.GetFlowDirection()); + new_item->SetNodePosition(QPointF(0, y)); + y++; + scene_.addItem(new_item); + + new_attached.append({new_item, f, new_item->pos()}); + } + } + + if (new_attached.empty()) { + event->ignore(); + } else { + SetAttachedItems(new_attached); + + event->accept(); + } + } +} + +void NodeView::dragMoveEvent(QDragMoveEvent *event) +{ + if (attached_items_.empty()) { + event->ignore(); + } else { + ProcessMovingAttachedNodes(event->pos()); + + if (GetContextAtMousePos(event->pos())) { + event->accept(); + } else { + event->ignore(); + } + } +} + +void NodeView::dropEvent(QDropEvent *event) +{ + if (Node *drop_ctx = GetContextAtMousePos(event->pos())) { + MultiUndoCommand *command = new MultiUndoCommand(); + QVector select_nodes = ProcessDroppingAttachedNodes(command, drop_ctx, event->pos()); + Core::instance()->undo_stack()->pushIfHasChildren(command); + + DeselectAll(); + scene_.context_map().value(drop_ctx)->Select(select_nodes); + + event->accept(); + } else { + DetachItemsFromCursor(false); + event->ignore(); + } +} + +void NodeView::dragLeaveEvent(QDragLeaveEvent *event) +{ + if (attached_items_.empty()) { + event->ignore(); + } else { + DetachItemsFromCursor(false); + + event->accept(); + } +} + void NodeView::resizeEvent(QResizeEvent *event) { super::resizeEvent(event); @@ -1007,6 +968,7 @@ void NodeView::DetachItemsFromCursor(bool delete_nodes_too) delete ai.item; if (delete_nodes_too) { + qDebug() << "deleting" << ai.node; delete ai.node; } } @@ -1030,6 +992,177 @@ void NodeView::MoveAttachedNodesToCursor(const QPoint& p) } } +void NodeView::ProcessMovingAttachedNodes(const QPoint &pos) +{ + // Move those items to the cursor + MoveAttachedNodesToCursor(pos); + + // See if the user clicked on an edge (only when dropping single nodes) + if (attached_items_.size() == 1) { + Node* attached_node = attached_items_.first().item->GetNode(); + + QRect edge_detect_rect(pos, pos); + + int edge_detect_radius = fontMetrics().height(); + edge_detect_rect.adjust(-edge_detect_radius, -edge_detect_radius, edge_detect_radius, edge_detect_radius); + + QList items = this->items(edge_detect_rect); + + NodeViewEdge* new_drop_edge = nullptr; + + // See if there is an edge here + for (QGraphicsItem* item : qAsConst(items)) { + new_drop_edge = dynamic_cast(item); + + if (new_drop_edge) { + drop_input_.Reset(); + + NodeValue::Type drop_edge_data_type = new_drop_edge->input().GetDataType(); + + // Determine best input to connect to our new node + if (attached_node->GetEffectInput().IsValid()) { + // If node specifies an effect input, use that immediately + drop_input_ = attached_node->GetEffectInput(); + } else { + // Otherwise, we may have to iterate to find a valid one + for (const QString& input : attached_node->inputs()) { + if (input == Node::kEnabledInput) { + // Ignore enabled input + continue; + } + + NodeInput i(attached_node, input); + + if (attached_node->IsInputConnectable(input)) { + if (attached_node->GetInputDataType(input) == drop_edge_data_type) { + // Found exactly the type we're looking for, set and break this loop + drop_input_ = i; + break; + } else if (!drop_input_.IsValid()) { + // Default to first connectable input + drop_input_ = i; + } + } + } + } + + if (new_drop_edge->input().node()->OutputsTo(attached_node, true)) { + drop_input_.Reset(); + } + + if (drop_input_.IsValid()) { + break; + } else { + new_drop_edge = nullptr; + } + } + } + + if (drop_edge_ != new_drop_edge) { + if (drop_edge_) { + drop_edge_->SetHighlighted(false); + } + + drop_edge_ = new_drop_edge; + + if (drop_edge_) { + drop_edge_->SetHighlighted(true); + } + } + } +} + +QVector NodeView::ProcessDroppingAttachedNodes(MultiUndoCommand *command, Node *select_context, const QPoint &pos) +{ + QVector select_nodes; + + // Make a copy + QVector attached = attached_items_; + + for (int i=0; iOutputsTo(ai.node, true)) { + attached.removeAt(i); + } else if (select_context->ContextContainsNode(ai.node)) { + select_nodes.append(ai.node); + attached.removeAt(i); + } + } + + { + MultiUndoCommand *add_command = new MultiUndoCommand(); + + foreach (const AttachedItem &ai, attached) { + // Add node to the same graph that the context is in + if (ai.node->parent() != select_context->parent()) { + add_command->add_child(new NodeAddCommand(select_context->parent(), ai.node)); + } + + // Add node to the context + if (ai.item) { + select_nodes.append(ai.node); + add_command->add_child(new NodeSetPositionCommand(ai.node, select_context, scene_.context_map().value(select_context)->MapScenePosToNodePosInContext(ai.item->pos()))); + } + } + + if (add_command->child_count()) { + add_command->redo_now(); + command->add_child(add_command); + } else { + delete add_command; + } + } + + { + // Dropped attached item onto an edge, connect it between them + MultiUndoCommand *drop_edge_command = new MultiUndoCommand(); + if (attached.size() == 1) { + Node* dropping_node = nullptr; + + foreach (const AttachedItem &ai, attached) { + if (ai.item && !select_context->OutputsTo(ai.node, true)) { + dropping_node = ai.node; + break; + } + } + + if (dropping_node && drop_edge_) { + // Remove old edge + drop_edge_command->add_child(new NodeEdgeRemoveCommand(drop_edge_->output(), drop_edge_->input())); + + // Place new edges + drop_edge_command->add_child(new NodeEdgeAddCommand(drop_edge_->output(), drop_input_)); + drop_edge_command->add_child(new NodeEdgeAddCommand(dropping_node, drop_edge_->input())); + } + + drop_edge_ = nullptr; + } + if (drop_edge_command->child_count()) { + drop_edge_command->redo_now(); + command->add_child(drop_edge_command); + } else { + delete drop_edge_command; + } + } + + DetachItemsFromCursor(false); + + return select_nodes; +} + +Node *NodeView::GetContextAtMousePos(const QPoint &p) +{ + QList items_at_cursor = this->items(p); + foreach (QGraphicsItem *i, items_at_cursor) { + if (NodeViewContext *context_item = dynamic_cast(i)) { + return context_item->GetContext(); + } + } + + return nullptr; +} + void NodeView::ConnectSelectionChangedSignal() { connect(&scene_, &QGraphicsScene::selectionChanged, this, &NodeView::UpdateSelectionCache); diff --git a/app/widget/nodeview/nodeview.h b/app/widget/nodeview/nodeview.h index d18d2d185..15a5ddc28 100644 --- a/app/widget/nodeview/nodeview.h +++ b/app/widget/nodeview/nodeview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -133,6 +133,11 @@ protected: virtual void mouseReleaseEvent(QMouseEvent* event) override; virtual void mouseDoubleClickEvent(QMouseEvent* event) override; + virtual void dragEnterEvent(QDragEnterEvent *event) override; + virtual void dragMoveEvent(QDragMoveEvent *event) override; + virtual void dropEvent(QDropEvent *event) override; + virtual void dragLeaveEvent(QDragLeaveEvent *event) override; + virtual void resizeEvent(QResizeEvent *event) override; virtual void ZoomIntoCursorPosition(QWheelEvent *event, double multiplier, const QPointF &cursor_pos) override; @@ -149,6 +154,9 @@ private: void SetFlowDirection(NodeViewCommon::FlowDirection dir); void MoveAttachedNodesToCursor(const QPoint &p); + void ProcessMovingAttachedNodes(const QPoint &pos); + QVector ProcessDroppingAttachedNodes(MultiUndoCommand *command, Node *select_context, const QPoint &pos); + Node *GetContextAtMousePos(const QPoint &p); void ConnectSelectionChangedSignal(); void DisconnectSelectionChangedSignal(); diff --git a/app/widget/nodeview/nodeviewcommon.h b/app/widget/nodeview/nodeviewcommon.h index f8ffa4583..505c16027 100644 --- a/app/widget/nodeview/nodeviewcommon.h +++ b/app/widget/nodeview/nodeviewcommon.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeview/nodeviewedge.cpp b/app/widget/nodeview/nodeviewedge.cpp index 0cf408ea1..775596377 100644 --- a/app/widget/nodeview/nodeviewedge.cpp +++ b/app/widget/nodeview/nodeviewedge.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeview/nodeviewedge.h b/app/widget/nodeview/nodeviewedge.h index b149b3680..6e17dea30 100644 --- a/app/widget/nodeview/nodeviewedge.h +++ b/app/widget/nodeview/nodeviewedge.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeview/nodeviewitem.cpp b/app/widget/nodeview/nodeviewitem.cpp index 479bd9f72..9a04ee961 100644 --- a/app/widget/nodeview/nodeviewitem.cpp +++ b/app/widget/nodeview/nodeviewitem.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeview/nodeviewitem.h b/app/widget/nodeview/nodeviewitem.h index d91733dcc..c5bf240d3 100644 --- a/app/widget/nodeview/nodeviewitem.h +++ b/app/widget/nodeview/nodeviewitem.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeview/nodeviewitemconnector.cpp b/app/widget/nodeview/nodeviewitemconnector.cpp index 032b9903f..de723a36c 100644 --- a/app/widget/nodeview/nodeviewitemconnector.cpp +++ b/app/widget/nodeview/nodeviewitemconnector.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeview/nodeviewitemconnector.h b/app/widget/nodeview/nodeviewitemconnector.h index 4da1e2fca..b309f05e0 100644 --- a/app/widget/nodeview/nodeviewitemconnector.h +++ b/app/widget/nodeview/nodeviewitemconnector.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeview/nodeviewminimap.cpp b/app/widget/nodeview/nodeviewminimap.cpp index 8dc99c914..b796a7da3 100644 --- a/app/widget/nodeview/nodeviewminimap.cpp +++ b/app/widget/nodeview/nodeviewminimap.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -109,7 +109,11 @@ void NodeViewMiniMap::mouseMoveEvent(QMouseEvent *event) EmitMoveSignal(event); } } else { - setCursor(MouseInsideResizeTriangle(event) ? Qt::SizeFDiagCursor : Qt::ArrowCursor); + if (MouseInsideResizeTriangle(event)) { + setCursor(Qt::SizeFDiagCursor); + } else { + unsetCursor(); + } } } diff --git a/app/widget/nodeview/nodeviewminimap.h b/app/widget/nodeview/nodeviewminimap.h index e155b54f2..ba48ef67f 100644 --- a/app/widget/nodeview/nodeviewminimap.h +++ b/app/widget/nodeview/nodeviewminimap.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeview/nodeviewscene.cpp b/app/widget/nodeview/nodeviewscene.cpp index dc76509cc..833a83d99 100644 --- a/app/widget/nodeview/nodeviewscene.cpp +++ b/app/widget/nodeview/nodeviewscene.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeview/nodeviewscene.h b/app/widget/nodeview/nodeviewscene.h index 64a149bd3..6a43becf2 100644 --- a/app/widget/nodeview/nodeviewscene.h +++ b/app/widget/nodeview/nodeviewscene.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeview/nodeviewundo.cpp b/app/widget/nodeview/nodeviewundo.cpp index 2ed0ef28b..03ff5a372 100644 --- a/app/widget/nodeview/nodeviewundo.cpp +++ b/app/widget/nodeview/nodeviewundo.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -112,18 +112,6 @@ Project *NodeAddCommand::GetRelevantProject() const return dynamic_cast(graph_); } -NodeCopyInputsCommand::NodeCopyInputsCommand(const Node *src, Node *dest, bool include_connections) : - src_(src), - dest_(dest), - include_connections_(include_connections) -{ -} - -void NodeCopyInputsCommand::redo() -{ - Node::CopyInputs(src_, dest_, include_connections_); -} - void NodeRemoveAndDisconnectCommand::prepare() { command_ = new MultiUndoCommand(); diff --git a/app/widget/nodeview/nodeviewundo.h b/app/widget/nodeview/nodeviewundo.h index bb4588444..f5508abb2 100644 --- a/app/widget/nodeview/nodeviewundo.h +++ b/app/widget/nodeview/nodeviewundo.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -193,28 +193,6 @@ private: }; -class NodeCopyInputsCommand : public UndoCommand { -public: - NodeCopyInputsCommand(const Node* src, - Node* dest, - bool include_connections); - - virtual Project* GetRelevantProject() const override {return nullptr;} - -protected: - virtual void redo() override; - - virtual void undo() override {} - -private: - const Node* src_; - - Node* dest_; - - bool include_connections_; - -}; - class NodeLinkCommand : public UndoCommand { public: NodeLinkCommand(Node* a, Node* b, bool link) : @@ -324,6 +302,10 @@ class NodeRenameCommand : public UndoCommand { public: NodeRenameCommand() = default; + NodeRenameCommand(Node* node, const QString& new_name) + { + AddNode(node, new_name); + } void AddNode(Node* node, const QString& new_name); diff --git a/app/widget/nodeview/nodewidget.cpp b/app/widget/nodeview/nodewidget.cpp index 4fdb2dd06..7ee2d4097 100644 --- a/app/widget/nodeview/nodewidget.cpp +++ b/app/widget/nodeview/nodewidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/nodeview/nodewidget.h b/app/widget/nodeview/nodewidget.h index 47762f499..7c69b564d 100644 --- a/app/widget/nodeview/nodewidget.h +++ b/app/widget/nodeview/nodewidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/panel/CMakeLists.txt b/app/widget/panel/CMakeLists.txt index 02716ec02..4b358fb09 100644 --- a/app/widget/panel/CMakeLists.txt +++ b/app/widget/panel/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/panel/panel.cpp b/app/widget/panel/panel.cpp index 4ce4cd405..f3840fc06 100644 --- a/app/widget/panel/panel.cpp +++ b/app/widget/panel/panel.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/panel/panel.h b/app/widget/panel/panel.h index 130e3eaf8..608c0ba5f 100644 --- a/app/widget/panel/panel.h +++ b/app/widget/panel/panel.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/path/CMakeLists.txt b/app/widget/path/CMakeLists.txt index 0daa0dcd1..9902d40b5 100644 --- a/app/widget/path/CMakeLists.txt +++ b/app/widget/path/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/path/pathwidget.cpp b/app/widget/path/pathwidget.cpp index 256e6ebfb..79504273f 100644 --- a/app/widget/path/pathwidget.cpp +++ b/app/widget/path/pathwidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/path/pathwidget.h b/app/widget/path/pathwidget.h index 608308c02..51efb7bcf 100644 --- a/app/widget/path/pathwidget.h +++ b/app/widget/path/pathwidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/pixelsampler/CMakeLists.txt b/app/widget/pixelsampler/CMakeLists.txt index 1fed4314b..212184c9f 100644 --- a/app/widget/pixelsampler/CMakeLists.txt +++ b/app/widget/pixelsampler/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/pixelsampler/pixelsampler.cpp b/app/widget/pixelsampler/pixelsampler.cpp index 7011466f3..81ee86d6c 100644 --- a/app/widget/pixelsampler/pixelsampler.cpp +++ b/app/widget/pixelsampler/pixelsampler.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/pixelsampler/pixelsampler.h b/app/widget/pixelsampler/pixelsampler.h index bcbe60e23..42884c28c 100644 --- a/app/widget/pixelsampler/pixelsampler.h +++ b/app/widget/pixelsampler/pixelsampler.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/playbackcontrols/CMakeLists.txt b/app/widget/playbackcontrols/CMakeLists.txt index edd5a12f8..aa10921ee 100644 --- a/app/widget/playbackcontrols/CMakeLists.txt +++ b/app/widget/playbackcontrols/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/playbackcontrols/dragbutton.cpp b/app/widget/playbackcontrols/dragbutton.cpp index 4947d42f4..d3d4e6557 100644 --- a/app/widget/playbackcontrols/dragbutton.cpp +++ b/app/widget/playbackcontrols/dragbutton.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/playbackcontrols/dragbutton.h b/app/widget/playbackcontrols/dragbutton.h index ca3214bfe..166814efa 100644 --- a/app/widget/playbackcontrols/dragbutton.h +++ b/app/widget/playbackcontrols/dragbutton.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/playbackcontrols/playbackcontrols.cpp b/app/widget/playbackcontrols/playbackcontrols.cpp index 6a0c7ab6d..ea598b734 100644 --- a/app/widget/playbackcontrols/playbackcontrols.cpp +++ b/app/widget/playbackcontrols/playbackcontrols.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/playbackcontrols/playbackcontrols.h b/app/widget/playbackcontrols/playbackcontrols.h index f467a1924..53ea4ce5d 100644 --- a/app/widget/playbackcontrols/playbackcontrols.h +++ b/app/widget/playbackcontrols/playbackcontrols.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/CMakeLists.txt b/app/widget/projectexplorer/CMakeLists.txt index 12407c436..2de828952 100644 --- a/app/widget/projectexplorer/CMakeLists.txt +++ b/app/widget/projectexplorer/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorer.cpp b/app/widget/projectexplorer/projectexplorer.cpp index 5242a2f47..2236d4b84 100644 --- a/app/widget/projectexplorer/projectexplorer.cpp +++ b/app/widget/projectexplorer/projectexplorer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorer.h b/app/widget/projectexplorer/projectexplorer.h index fa145112b..30200a757 100644 --- a/app/widget/projectexplorer/projectexplorer.h +++ b/app/widget/projectexplorer/projectexplorer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorericonview.cpp b/app/widget/projectexplorer/projectexplorericonview.cpp index b9bf60dbe..77f0f36ed 100644 --- a/app/widget/projectexplorer/projectexplorericonview.cpp +++ b/app/widget/projectexplorer/projectexplorericonview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorericonview.h b/app/widget/projectexplorer/projectexplorericonview.h index 6998d9900..30fab4e9a 100644 --- a/app/widget/projectexplorer/projectexplorericonview.h +++ b/app/widget/projectexplorer/projectexplorericonview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorericonviewitemdelegate.cpp b/app/widget/projectexplorer/projectexplorericonviewitemdelegate.cpp index 528b2bb62..eb0275964 100644 --- a/app/widget/projectexplorer/projectexplorericonviewitemdelegate.cpp +++ b/app/widget/projectexplorer/projectexplorericonviewitemdelegate.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorericonviewitemdelegate.h b/app/widget/projectexplorer/projectexplorericonviewitemdelegate.h index f7b50841e..6527d7f13 100644 --- a/app/widget/projectexplorer/projectexplorericonviewitemdelegate.h +++ b/app/widget/projectexplorer/projectexplorericonviewitemdelegate.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorerlistview.cpp b/app/widget/projectexplorer/projectexplorerlistview.cpp index 75b81af76..cf1cb6d99 100644 --- a/app/widget/projectexplorer/projectexplorerlistview.cpp +++ b/app/widget/projectexplorer/projectexplorerlistview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorerlistview.h b/app/widget/projectexplorer/projectexplorerlistview.h index 364aa7e9d..9fbc532e5 100644 --- a/app/widget/projectexplorer/projectexplorerlistview.h +++ b/app/widget/projectexplorer/projectexplorerlistview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorerlistviewbase.cpp b/app/widget/projectexplorer/projectexplorerlistviewbase.cpp index e15933ccb..3f32df668 100644 --- a/app/widget/projectexplorer/projectexplorerlistviewbase.cpp +++ b/app/widget/projectexplorer/projectexplorerlistviewbase.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorerlistviewbase.h b/app/widget/projectexplorer/projectexplorerlistviewbase.h index a7600e88d..eb4541fa1 100644 --- a/app/widget/projectexplorer/projectexplorerlistviewbase.h +++ b/app/widget/projectexplorer/projectexplorerlistviewbase.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorerlistviewitemdelegate.cpp b/app/widget/projectexplorer/projectexplorerlistviewitemdelegate.cpp index 7c9094c2a..b539ed290 100644 --- a/app/widget/projectexplorer/projectexplorerlistviewitemdelegate.cpp +++ b/app/widget/projectexplorer/projectexplorerlistviewitemdelegate.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorerlistviewitemdelegate.h b/app/widget/projectexplorer/projectexplorerlistviewitemdelegate.h index 93b5f34f3..27ace4269 100644 --- a/app/widget/projectexplorer/projectexplorerlistviewitemdelegate.h +++ b/app/widget/projectexplorer/projectexplorerlistviewitemdelegate.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorernavigation.cpp b/app/widget/projectexplorer/projectexplorernavigation.cpp index fd384cbb1..ed635f19a 100644 --- a/app/widget/projectexplorer/projectexplorernavigation.cpp +++ b/app/widget/projectexplorer/projectexplorernavigation.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorernavigation.h b/app/widget/projectexplorer/projectexplorernavigation.h index b3a08d5fb..723f70d34 100644 --- a/app/widget/projectexplorer/projectexplorernavigation.h +++ b/app/widget/projectexplorer/projectexplorernavigation.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorertreeview.cpp b/app/widget/projectexplorer/projectexplorertreeview.cpp index fde98803c..c43d52343 100644 --- a/app/widget/projectexplorer/projectexplorertreeview.cpp +++ b/app/widget/projectexplorer/projectexplorertreeview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorertreeview.h b/app/widget/projectexplorer/projectexplorertreeview.h index ae3328b16..eced14c51 100644 --- a/app/widget/projectexplorer/projectexplorertreeview.h +++ b/app/widget/projectexplorer/projectexplorertreeview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projectexplorer/projectexplorerundo.h b/app/widget/projectexplorer/projectexplorerundo.h index 0a7ba0e96..5df4d064f 100644 --- a/app/widget/projectexplorer/projectexplorerundo.h +++ b/app/widget/projectexplorer/projectexplorerundo.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projecttoolbar/CMakeLists.txt b/app/widget/projecttoolbar/CMakeLists.txt index 140d73ebe..6c063e6fe 100644 --- a/app/widget/projecttoolbar/CMakeLists.txt +++ b/app/widget/projecttoolbar/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/projecttoolbar/projecttoolbar.cpp b/app/widget/projecttoolbar/projecttoolbar.cpp index a3a90eeba..a99a7340c 100644 --- a/app/widget/projecttoolbar/projecttoolbar.cpp +++ b/app/widget/projecttoolbar/projecttoolbar.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/projecttoolbar/projecttoolbar.h b/app/widget/projecttoolbar/projecttoolbar.h index 6117236e4..c53039524 100644 --- a/app/widget/projecttoolbar/projecttoolbar.h +++ b/app/widget/projecttoolbar/projecttoolbar.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/resizablescrollbar/CMakeLists.txt b/app/widget/resizablescrollbar/CMakeLists.txt index 7680e7a45..1e54cff06 100644 --- a/app/widget/resizablescrollbar/CMakeLists.txt +++ b/app/widget/resizablescrollbar/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/resizablescrollbar/resizablescrollbar.cpp b/app/widget/resizablescrollbar/resizablescrollbar.cpp index 7520cc68b..beacc6929 100644 --- a/app/widget/resizablescrollbar/resizablescrollbar.cpp +++ b/app/widget/resizablescrollbar/resizablescrollbar.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/resizablescrollbar/resizablescrollbar.h b/app/widget/resizablescrollbar/resizablescrollbar.h index 91fddf591..88949fece 100644 --- a/app/widget/resizablescrollbar/resizablescrollbar.h +++ b/app/widget/resizablescrollbar/resizablescrollbar.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/resizablescrollbar/resizabletimelinescrollbar.cpp b/app/widget/resizablescrollbar/resizabletimelinescrollbar.cpp index 0b06ac1bc..4672657bb 100644 --- a/app/widget/resizablescrollbar/resizabletimelinescrollbar.cpp +++ b/app/widget/resizablescrollbar/resizabletimelinescrollbar.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -117,8 +117,8 @@ void ResizableTimelineScrollBar::paintEvent(QPaintEvent *event) TimelineMarker* marker = *it; QColor marker_color = ColorCoding::GetColor(marker->color()).toQColor(); - int64_t in = qRound64(ratio * TimeToScene(marker->time_range().in())); - int64_t out = qRound64(ratio * TimeToScene(marker->time_range().out())); + int64_t in = qRound64(ratio * TimeToScene(marker->time().in())); + int64_t out = qRound64(ratio * TimeToScene(marker->time().out())); int64_t length = qMax(int64_t(1), out-in); p.fillRect(gr.x() + in, diff --git a/app/widget/resizablescrollbar/resizabletimelinescrollbar.h b/app/widget/resizablescrollbar/resizabletimelinescrollbar.h index 528f44f2b..dcd8b10fc 100644 --- a/app/widget/resizablescrollbar/resizabletimelinescrollbar.h +++ b/app/widget/resizablescrollbar/resizabletimelinescrollbar.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/scope/CMakeLists.txt b/app/widget/scope/CMakeLists.txt index d1d05143e..4eb246120 100644 --- a/app/widget/scope/CMakeLists.txt +++ b/app/widget/scope/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/scope/histogram/CMakeLists.txt b/app/widget/scope/histogram/CMakeLists.txt index 1f56fd496..b743df960 100644 --- a/app/widget/scope/histogram/CMakeLists.txt +++ b/app/widget/scope/histogram/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/scope/histogram/histogram.cpp b/app/widget/scope/histogram/histogram.cpp index 1027333a4..26b92b711 100644 --- a/app/widget/scope/histogram/histogram.cpp +++ b/app/widget/scope/histogram/histogram.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/scope/histogram/histogram.h b/app/widget/scope/histogram/histogram.h index 45c7cea27..b6bff328e 100644 --- a/app/widget/scope/histogram/histogram.h +++ b/app/widget/scope/histogram/histogram.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/scope/scopebase/CMakeLists.txt b/app/widget/scope/scopebase/CMakeLists.txt index d852fff38..58263e1b4 100644 --- a/app/widget/scope/scopebase/CMakeLists.txt +++ b/app/widget/scope/scopebase/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/scope/scopebase/scopebase.cpp b/app/widget/scope/scopebase/scopebase.cpp index e01b4978c..bedcd986d 100644 --- a/app/widget/scope/scopebase/scopebase.cpp +++ b/app/widget/scope/scopebase/scopebase.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/scope/scopebase/scopebase.h b/app/widget/scope/scopebase/scopebase.h index a8891a384..1e569f72f 100644 --- a/app/widget/scope/scopebase/scopebase.h +++ b/app/widget/scope/scopebase/scopebase.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/scope/waveform/CMakeLists.txt b/app/widget/scope/waveform/CMakeLists.txt index 3435e8523..28d0b9b7c 100644 --- a/app/widget/scope/waveform/CMakeLists.txt +++ b/app/widget/scope/waveform/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/scope/waveform/waveform.cpp b/app/widget/scope/waveform/waveform.cpp index 9e664cb49..a0b11769c 100644 --- a/app/widget/scope/waveform/waveform.cpp +++ b/app/widget/scope/waveform/waveform.cpp @@ -2,7 +2,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/scope/waveform/waveform.h b/app/widget/scope/waveform/waveform.h index 833aa39b2..2e8cf2b6c 100644 --- a/app/widget/scope/waveform/waveform.h +++ b/app/widget/scope/waveform/waveform.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/CMakeLists.txt b/app/widget/slider/CMakeLists.txt index 044f00e5b..d20c999e6 100644 --- a/app/widget/slider/CMakeLists.txt +++ b/app/widget/slider/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/base/CMakeLists.txt b/app/widget/slider/base/CMakeLists.txt index 614545a56..921ec8826 100644 --- a/app/widget/slider/base/CMakeLists.txt +++ b/app/widget/slider/base/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/base/decimalsliderbase.cpp b/app/widget/slider/base/decimalsliderbase.cpp index 18b4a91ae..cf523f832 100644 --- a/app/widget/slider/base/decimalsliderbase.cpp +++ b/app/widget/slider/base/decimalsliderbase.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/base/decimalsliderbase.h b/app/widget/slider/base/decimalsliderbase.h index bfe20da2d..44dc80c73 100644 --- a/app/widget/slider/base/decimalsliderbase.h +++ b/app/widget/slider/base/decimalsliderbase.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/base/numericsliderbase.cpp b/app/widget/slider/base/numericsliderbase.cpp index 81b3951ac..4f0397967 100644 --- a/app/widget/slider/base/numericsliderbase.cpp +++ b/app/widget/slider/base/numericsliderbase.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/base/numericsliderbase.h b/app/widget/slider/base/numericsliderbase.h index 1a2a01d05..71f2557d1 100644 --- a/app/widget/slider/base/numericsliderbase.h +++ b/app/widget/slider/base/numericsliderbase.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/base/sliderbase.cpp b/app/widget/slider/base/sliderbase.cpp index 7549e9f5c..1f132e3e6 100644 --- a/app/widget/slider/base/sliderbase.cpp +++ b/app/widget/slider/base/sliderbase.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/base/sliderbase.h b/app/widget/slider/base/sliderbase.h index 4663525d9..3bf9eb901 100644 --- a/app/widget/slider/base/sliderbase.h +++ b/app/widget/slider/base/sliderbase.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/base/sliderlabel.cpp b/app/widget/slider/base/sliderlabel.cpp index 4271bd1e5..cd7428bc7 100644 --- a/app/widget/slider/base/sliderlabel.cpp +++ b/app/widget/slider/base/sliderlabel.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/base/sliderlabel.h b/app/widget/slider/base/sliderlabel.h index 948b0d77a..2ec787640 100644 --- a/app/widget/slider/base/sliderlabel.h +++ b/app/widget/slider/base/sliderlabel.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/base/sliderladder.cpp b/app/widget/slider/base/sliderladder.cpp index c7a5ec7ad..245c32ab9 100644 --- a/app/widget/slider/base/sliderladder.cpp +++ b/app/widget/slider/base/sliderladder.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -97,7 +97,10 @@ SliderLadder::SliderLadder(double drag_multiplier, int nb_outer_values, QString SliderLadder::~SliderLadder() { if (UsingLadders()) { - + if (wrap_count_ != 0) { + // If wrapped, restore cursor to ladder + QCursor::setPos(pos() + rect().center()); + } } else { #if defined(Q_OS_MAC) CGAssociateMouseAndMouseCursorPosition(true); diff --git a/app/widget/slider/base/sliderladder.h b/app/widget/slider/base/sliderladder.h index 919cccc9f..8426c1f22 100644 --- a/app/widget/slider/base/sliderladder.h +++ b/app/widget/slider/base/sliderladder.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/floatslider.cpp b/app/widget/slider/floatslider.cpp index 7510c36ef..b03995170 100644 --- a/app/widget/slider/floatslider.cpp +++ b/app/widget/slider/floatslider.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/floatslider.h b/app/widget/slider/floatslider.h index fe392a983..eee55db41 100644 --- a/app/widget/slider/floatslider.h +++ b/app/widget/slider/floatslider.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/integerslider.cpp b/app/widget/slider/integerslider.cpp index 7760f6433..1ce992b90 100644 --- a/app/widget/slider/integerslider.cpp +++ b/app/widget/slider/integerslider.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/integerslider.h b/app/widget/slider/integerslider.h index b6549720b..452f41a68 100644 --- a/app/widget/slider/integerslider.h +++ b/app/widget/slider/integerslider.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/rationalslider.cpp b/app/widget/slider/rationalslider.cpp index 9ab45d652..3cf9e1e85 100644 --- a/app/widget/slider/rationalslider.cpp +++ b/app/widget/slider/rationalslider.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/rationalslider.h b/app/widget/slider/rationalslider.h index 2febb775e..090bff099 100644 --- a/app/widget/slider/rationalslider.h +++ b/app/widget/slider/rationalslider.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/stringslider.cpp b/app/widget/slider/stringslider.cpp index cf8a7b1d7..fcac6cf82 100644 --- a/app/widget/slider/stringslider.cpp +++ b/app/widget/slider/stringslider.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/stringslider.h b/app/widget/slider/stringslider.h index 97b79b7ba..0e61c48f5 100644 --- a/app/widget/slider/stringslider.h +++ b/app/widget/slider/stringslider.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/timeslider.cpp b/app/widget/slider/timeslider.cpp index e82a729b0..57fc557b5 100644 --- a/app/widget/slider/timeslider.cpp +++ b/app/widget/slider/timeslider.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/slider/timeslider.h b/app/widget/slider/timeslider.h index d024afc43..b22bb325c 100644 --- a/app/widget/slider/timeslider.h +++ b/app/widget/slider/timeslider.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/standardcombos/CMakeLists.txt b/app/widget/standardcombos/CMakeLists.txt index 992a0ef7b..4cb7164e6 100644 --- a/app/widget/standardcombos/CMakeLists.txt +++ b/app/widget/standardcombos/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/standardcombos/channellayoutcombobox.h b/app/widget/standardcombos/channellayoutcombobox.h index 0050bfc78..58a468bdd 100644 --- a/app/widget/standardcombos/channellayoutcombobox.h +++ b/app/widget/standardcombos/channellayoutcombobox.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/standardcombos/frameratecombobox.h b/app/widget/standardcombos/frameratecombobox.h index fdb6e51ef..d5ed19c05 100644 --- a/app/widget/standardcombos/frameratecombobox.h +++ b/app/widget/standardcombos/frameratecombobox.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/standardcombos/interlacedcombobox.h b/app/widget/standardcombos/interlacedcombobox.h index 075b2f00c..95c35a6ff 100644 --- a/app/widget/standardcombos/interlacedcombobox.h +++ b/app/widget/standardcombos/interlacedcombobox.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/standardcombos/pixelaspectratiocombobox.h b/app/widget/standardcombos/pixelaspectratiocombobox.h index 2a11fbd9f..0b53689c3 100644 --- a/app/widget/standardcombos/pixelaspectratiocombobox.h +++ b/app/widget/standardcombos/pixelaspectratiocombobox.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/standardcombos/pixelformatcombobox.h b/app/widget/standardcombos/pixelformatcombobox.h index b4b34d880..1e7fda24b 100644 --- a/app/widget/standardcombos/pixelformatcombobox.h +++ b/app/widget/standardcombos/pixelformatcombobox.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/standardcombos/sampleformatcombobox.h b/app/widget/standardcombos/sampleformatcombobox.h index d52a20709..046ad9d34 100644 --- a/app/widget/standardcombos/sampleformatcombobox.h +++ b/app/widget/standardcombos/sampleformatcombobox.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/standardcombos/sampleratecombobox.h b/app/widget/standardcombos/sampleratecombobox.h index dbc608b12..653cc0c87 100644 --- a/app/widget/standardcombos/sampleratecombobox.h +++ b/app/widget/standardcombos/sampleratecombobox.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/standardcombos/standardcombos.h b/app/widget/standardcombos/standardcombos.h index acfffc893..f1c94e7c2 100644 --- a/app/widget/standardcombos/standardcombos.h +++ b/app/widget/standardcombos/standardcombos.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/standardcombos/videodividercombobox.h b/app/widget/standardcombos/videodividercombobox.h index 01e1742f7..05c068458 100644 --- a/app/widget/standardcombos/videodividercombobox.h +++ b/app/widget/standardcombos/videodividercombobox.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/taskview/CMakeLists.txt b/app/widget/taskview/CMakeLists.txt index a747fd934..7c380215a 100644 --- a/app/widget/taskview/CMakeLists.txt +++ b/app/widget/taskview/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/taskview/elapsedcounterwidget.cpp b/app/widget/taskview/elapsedcounterwidget.cpp index f3d0b673a..cc191239b 100644 --- a/app/widget/taskview/elapsedcounterwidget.cpp +++ b/app/widget/taskview/elapsedcounterwidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/taskview/elapsedcounterwidget.h b/app/widget/taskview/elapsedcounterwidget.h index f8b5b7d74..809853fd0 100644 --- a/app/widget/taskview/elapsedcounterwidget.h +++ b/app/widget/taskview/elapsedcounterwidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/taskview/taskview.cpp b/app/widget/taskview/taskview.cpp index 218c8f848..ff0cd0e54 100644 --- a/app/widget/taskview/taskview.cpp +++ b/app/widget/taskview/taskview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/taskview/taskview.h b/app/widget/taskview/taskview.h index 193269645..75f91561b 100644 --- a/app/widget/taskview/taskview.h +++ b/app/widget/taskview/taskview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/taskview/taskviewitem.cpp b/app/widget/taskview/taskviewitem.cpp index 6c4b40115..d63e8f42b 100644 --- a/app/widget/taskview/taskviewitem.cpp +++ b/app/widget/taskview/taskviewitem.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/taskview/taskviewitem.h b/app/widget/taskview/taskviewitem.h index 67c5e09d9..18726a29b 100644 --- a/app/widget/taskview/taskviewitem.h +++ b/app/widget/taskview/taskviewitem.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timebased/CMakeLists.txt b/app/widget/timebased/CMakeLists.txt index ed200fc08..55609d627 100644 --- a/app/widget/timebased/CMakeLists.txt +++ b/app/widget/timebased/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/timebased/timebasedview.cpp b/app/widget/timebased/timebasedview.cpp index dc5e68cd8..768fb3862 100644 --- a/app/widget/timebased/timebasedview.cpp +++ b/app/widget/timebased/timebasedview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timebased/timebasedview.h b/app/widget/timebased/timebasedview.h index 8771f6c01..9f708553a 100644 --- a/app/widget/timebased/timebasedview.h +++ b/app/widget/timebased/timebasedview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timebased/timebasedviewselectionmanager.cpp b/app/widget/timebased/timebasedviewselectionmanager.cpp index 577046aff..fb7729fa6 100644 --- a/app/widget/timebased/timebasedviewselectionmanager.cpp +++ b/app/widget/timebased/timebasedviewselectionmanager.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timebased/timebasedviewselectionmanager.h b/app/widget/timebased/timebasedviewselectionmanager.h index 8c8a0cb6a..7647ddc06 100644 --- a/app/widget/timebased/timebasedviewselectionmanager.h +++ b/app/widget/timebased/timebasedviewselectionmanager.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -163,14 +163,24 @@ public: initial_drag_item_ = initial_item; dragging_.resize(selected_.size()); - snap_points_.resize(selected_.size()*2); + + if constexpr (std::is_same_v) { + snap_points_.resize(selected_.size()*2); + } else { + snap_points_.resize(selected_.size()); + } + for (size_t i=0; itime(); - - snap_points_[i] = obj->time(); - snap_points_[i+selected_.size()] = obj->time_range().out(); + if constexpr (std::is_same_v) { + dragging_[i] = obj->time().in(); + snap_points_[i] = obj->time().in(); + snap_points_[i+selected_.size()] = obj->time().out(); + } else { + dragging_[i] = obj->time(); + snap_points_[i] = obj->time(); + } } drag_mouse_start_ = view_->mapToScene(event->pos()); @@ -258,7 +268,15 @@ public: } // Show information about this keyframe - QString tip = Timecode::time_to_timecode(initial_drag_item_->time(), timebase_, + rational display_time; + + if constexpr (std::is_same_v) { + display_time = initial_drag_item_->time().in(); + } else { + display_time = initial_drag_item_->time(); + } + + QString tip = Timecode::time_to_timecode(display_time, timebase_, Core::instance()->GetTimecodeDisplay(), false); if (!tip_format.isEmpty()) { @@ -274,7 +292,13 @@ public: QToolTip::hideText(); for (size_t i=0; iadd_child(new SetTimeCommand(selected_.at(i), selected_.at(i)->time(), dragging_.at(i))); + rational current; + if constexpr (std::is_same_v) { + current = selected_.at(i)->time().in(); + } else { + current = selected_.at(i)->time(); + } + command->add_child(new SetTimeCommand(selected_.at(i), current, dragging_.at(i))); } dragging_.clear(); diff --git a/app/widget/timebased/timebasedwidget.cpp b/app/widget/timebased/timebasedwidget.cpp index 237f25f92..a812e6c69 100644 --- a/app/widget/timebased/timebasedwidget.cpp +++ b/app/widget/timebased/timebasedwidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -346,10 +346,10 @@ void TimeBasedWidget::GoToPrevCut() rational closest_cut = 0; - foreach (Track* track, sequence->GetTracks()) { + for (Track* track : sequence->GetTracks()) { rational this_track_closest_cut = 0; - foreach (Block* block, track->Blocks()) { + for (Block* block : track->Blocks()) { if (block->out() < GetTime()) { this_track_closest_cut = block->out(); } else { @@ -754,7 +754,7 @@ bool TimeBasedWidget::SnapPoint(const std::vector &start_times, ration for (auto jt=markers->cbegin(); jt!=markers->cend(); jt++) { TimelineMarker *marker = *jt; - TimeRange marker_range = marker->time_range() + clip->in() - clip->media_in(); + TimeRange marker_range = marker->time() + clip->in() - clip->media_in(); qreal marker_in_screen = TimeToScene(marker_range.in()); qreal marker_out_screen = TimeToScene(marker_range.out()); @@ -777,12 +777,12 @@ bool TimeBasedWidget::SnapPoint(const std::vector &start_times, ration continue; } - qreal marker_pos = TimeToScene(m->time_range().in()); - AttemptSnap(potential_snaps, screen_pt, marker_pos, start_times, m->time_range().in()); + qreal marker_pos = TimeToScene(m->time().in()); + AttemptSnap(potential_snaps, screen_pt, marker_pos, start_times, m->time().in()); - if (m->time_range().in() != m->time_range().out()) { - marker_pos = TimeToScene(m->time_range().out()); - AttemptSnap(potential_snaps, screen_pt, marker_pos, start_times, m->time_range().out()); + if (m->time().in() != m->time().out()) { + marker_pos = TimeToScene(m->time().out()); + AttemptSnap(potential_snaps, screen_pt, marker_pos, start_times, m->time().out()); } } } @@ -860,4 +860,22 @@ void TimeBasedWidget::HideSnaps() } } +bool TimeBasedWidget::CopySelected(bool cut) +{ + if (ruler()->hasFocus() && ruler()->CopySelected(cut)) { + return true; + } + + return false; +} + +bool TimeBasedWidget::Paste() +{ + if (ruler()->hasFocus() && ruler()->PasteMarkers()) { + return true; + } + + return false; +} + } diff --git a/app/widget/timebased/timebasedwidget.h b/app/widget/timebased/timebasedwidget.h index 3555cad98..82924160f 100644 --- a/app/widget/timebased/timebasedwidget.h +++ b/app/widget/timebased/timebasedwidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -73,6 +73,10 @@ public: void ShowSnaps(const std::vector ×); void HideSnaps(); + virtual bool CopySelected(bool cut); + + virtual bool Paste(); + public slots: void SetTime(const rational &time); diff --git a/app/widget/timebased/timescaledobject.cpp b/app/widget/timebased/timescaledobject.cpp index 5ea4176aa..daefa14d2 100644 --- a/app/widget/timebased/timescaledobject.cpp +++ b/app/widget/timebased/timescaledobject.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timebased/timescaledobject.h b/app/widget/timebased/timescaledobject.h index d5cd102e2..6fb237682 100644 --- a/app/widget/timebased/timescaledobject.h +++ b/app/widget/timebased/timescaledobject.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/CMakeLists.txt b/app/widget/timelinewidget/CMakeLists.txt index 4de23d7da..c3cd173bc 100644 --- a/app/widget/timelinewidget/CMakeLists.txt +++ b/app/widget/timelinewidget/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/timelineandtrackview.cpp b/app/widget/timelinewidget/timelineandtrackview.cpp index e6f0e028e..a9ce5bbcd 100644 --- a/app/widget/timelinewidget/timelineandtrackview.cpp +++ b/app/widget/timelinewidget/timelineandtrackview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/timelineandtrackview.h b/app/widget/timelinewidget/timelineandtrackview.h index 3767c3725..af1b963f1 100644 --- a/app/widget/timelinewidget/timelineandtrackview.h +++ b/app/widget/timelinewidget/timelineandtrackview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/timelinewidget.cpp b/app/widget/timelinewidget/timelinewidget.cpp index 4f2a67647..47c704a76 100644 --- a/app/widget/timelinewidget/timelinewidget.cpp +++ b/app/widget/timelinewidget/timelinewidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -66,7 +66,8 @@ TimelineWidget::TimelineWidget(QWidget *parent) : rubberband_(QRubberBand::Rectangle, this), active_tool_(nullptr), use_audio_time_units_(false), - subtitle_show_command_(nullptr) + subtitle_show_command_(nullptr), + subtitle_tentative_track_(nullptr) { QVBoxLayout* vert_layout = new QVBoxLayout(this); vert_layout->setSpacing(0); @@ -91,13 +92,13 @@ TimelineWidget::TimelineWidget(QWidget *parent) : vert_layout->addWidget(view_splitter_); // Video view - views_.append(new TimelineAndTrackView(Qt::AlignBottom)); + views_.append(AddTimelineAndTrackView(Qt::AlignBottom)); // Audio view - views_.append(new TimelineAndTrackView(Qt::AlignTop)); + views_.append(AddTimelineAndTrackView(Qt::AlignTop)); // Subtitle view - views_.append(new TimelineAndTrackView(Qt::AlignTop)); + views_.append(AddTimelineAndTrackView(Qt::AlignTop)); // Create tools tools_.resize(olive::Tool::kCount); @@ -487,7 +488,7 @@ void TimelineWidget::DeleteSelected(bool ripple) TimelineRippleDeleteGapsAtRegionsCommand *ripple_command = nullptr; rational new_playhead = RATIONAL_MAX; if (ripple) { - QVector > range_list; + TimelineRippleDeleteGapsAtRegionsCommand::RangeList range_list; foreach (Block* b, blocks_to_delete) { range_list.append({b->track(), b->range()}); @@ -568,18 +569,14 @@ void TimelineWidget::ToggleLinksOnSelected() Core::instance()->undo_stack()->push(new NodeLinkManyCommand(blocks, link)); } -void TimelineWidget::CopySelected(bool cut) +bool TimelineWidget::CopySelected(bool cut) { - if (!GetConnectedNode()) { - return; + if (super::CopySelected(cut)) { + return true; } - if (ruler()->hasFocus() && ruler()->CopySelected(cut)) { - return; - } - - if (selected_blocks_.isEmpty()) { - return; + if (!GetConnectedNode() || selected_blocks_.isEmpty()) { + return false; } QVector selected_nodes; @@ -619,58 +616,24 @@ void TimelineWidget::CopySelected(bool cut) if (cut) { DeleteSelected(); } + + return true; } -void TimelineWidget::Paste(bool insert) +bool TimelineWidget::Paste() { - if (!GetConnectedNode()) { - return; + if (super::Paste()) { + return true; + } if (!GetConnectedNode()) { + return false; } - if (ruler()->hasFocus() && ruler()->PasteMarkers(insert, GetTime())) { - return; - } + return PasteInternal(false); +} - ProjectSerializer::Result res = ProjectSerializer::Paste(QStringLiteral("timeline")); - if (res.GetLoadedNodes().isEmpty()) { - return; - } - - MultiUndoCommand *command = new MultiUndoCommand(); - - foreach (Node *n, res.GetLoadedNodes()) { - command->add_child(new NodeAddCommand(GetConnectedNode()->project(), n)); - } - - rational paste_start = GetTime(); - - if (insert) { - rational paste_end = GetTime(); - - for (auto it=res.GetLoadData().properties.cbegin(); it!=res.GetLoadData().properties.cend(); it++) { - rational length = static_cast(it.key())->length(); - rational in = rational::fromString(it.value()[QStringLiteral("in")]); - - paste_end = qMax(paste_end, paste_start + in + length); - } - - if (paste_end != paste_start) { - InsertGapsAt(paste_start, paste_end - paste_start, command); - } - } - - for (auto it=res.GetLoadData().properties.cbegin(); it!=res.GetLoadData().properties.cend(); it++) { - Block *block = static_cast(it.key()); - rational in = rational::fromString(it.value()[QStringLiteral("in")]); - Track::Reference track = Track::Reference::FromString(it.value()[QStringLiteral("track")]); - - command->add_child(new TrackPlaceBlockCommand(sequence()->track_list(track.type()), - track.index(), - block, - paste_start + in)); - } - - Core::instance()->undo_stack()->pushIfHasChildren(command); +void TimelineWidget::PasteInsert() +{ + PasteInternal(true); } void TimelineWidget::DeleteInToOut(bool ripple) @@ -818,6 +781,44 @@ void TimelineWidget::DisableRecordingOverlay() } } +void TimelineWidget::AddTentativeSubtitleTrack() +{ + if (!subtitle_show_command_) { + // Determine if we need to do anything + QList sz = view_splitter_->sizes(); + bool should_adjust_splitter = (sz[Track::kSubtitle] == 0); + bool should_add_sub_track = (sequence() && sequence()->track_list(Track::kSubtitle)->GetTrackCount() == 0); + + if (should_adjust_splitter || should_add_sub_track) { + // Create command + subtitle_show_command_ = new MultiUndoCommand(); + + if (should_adjust_splitter) { + sz[Track::kSubtitle] = height() / Track::kCount; + subtitle_show_command_->add_child(new SetSplitterSizesCommand(view_splitter_, sz)); + } + + if (should_add_sub_track) { + TimelineAddTrackCommand *track_add_cmd = new TimelineAddTrackCommand(sequence()->track_list(Track::kSubtitle)); + subtitle_tentative_track_ = track_add_cmd->track(); + subtitle_show_command_->add_child(track_add_cmd); + } + + subtitle_show_command_->redo_now(); + } + } +} + +void TimelineWidget::ClearTentativeSubtitleTrack() +{ + if (subtitle_show_command_) { + subtitle_show_command_->undo_now(); + delete subtitle_show_command_; + subtitle_show_command_ = nullptr; + subtitle_tentative_track_ = nullptr; + } +} + void TimelineWidget::InsertGapsAt(const rational &earliest_point, const rational &insert_length, MultiUndoCommand *command) { for (int i=0;itool() == Tool::kAdd && Core::instance()->GetSelectedAddableObject() == Tool::kAddableSubtitle) { - if (!subtitle_show_command_) { - // Determine if we need to do anything - QList sz = view_splitter_->sizes(); - bool should_adjust_splitter = (sz[Track::kSubtitle] == 0); - bool should_add_sub_track = (sequence() && sequence()->track_list(Track::kSubtitle)->GetTrackCount() == 0); - - if (should_adjust_splitter || should_add_sub_track) { - // Create command - subtitle_show_command_ = new MultiUndoCommand(); - - if (should_adjust_splitter) { - sz[Track::kSubtitle] = height() / Track::kCount; - subtitle_show_command_->add_child(new SetSplitterSizesCommand(view_splitter_, sz)); - } - - if (should_add_sub_track) { - subtitle_show_command_->add_child(new TimelineAddTrackCommand(sequence()->track_list(Track::kSubtitle))); - } - - subtitle_show_command_->redo_now(); - } - } - } else if (subtitle_show_command_) { - subtitle_show_command_->undo_now(); - delete subtitle_show_command_; - subtitle_show_command_ = nullptr; + AddTentativeSubtitleTrack(); + } else { + ClearTentativeSubtitleTrack(); } } @@ -1248,6 +1226,16 @@ void TimelineWidget::RenameSelectedBlocks() Core::instance()->undo_stack()->pushIfHasChildren(command); } +void TimelineWidget::TrackAboutToBeDeleted(Track *track) +{ + if (track == subtitle_tentative_track_) { + // User is deleting the tentative subtitle track. Technically they shouldn't do this, but they + // might if they misinterpret it as permanent. If so, we handle it cleanly by pushing our + // command as if the action really were permanent. + Core::instance()->undo_stack()->push(TakeSubtitleSectionCommand()); + } +} + void TimelineWidget::AddGhost(TimelineViewGhostItem *ghost) { ghost_items_.append(ghost); @@ -1629,6 +1617,63 @@ QVector TimelineWidget::GetBlocksInGlobalRect(const QPoint &p1, const Q return blocks_in_rect; } +bool TimelineWidget::PasteInternal(bool insert) +{ + if (!GetConnectedNode()) { + return false; + } + + ProjectSerializer::Result res = ProjectSerializer::Paste(QStringLiteral("timeline")); + if (res.GetLoadedNodes().isEmpty()) { + return false; + } + + MultiUndoCommand *command = new MultiUndoCommand(); + + foreach (Node *n, res.GetLoadedNodes()) { + command->add_child(new NodeAddCommand(GetConnectedNode()->project(), n)); + } + + rational paste_start = GetTime(); + + if (insert) { + rational paste_end = GetTime(); + + for (auto it=res.GetLoadData().properties.cbegin(); it!=res.GetLoadData().properties.cend(); it++) { + rational length = static_cast(it.key())->length(); + rational in = rational::fromString(it.value()[QStringLiteral("in")]); + + paste_end = qMax(paste_end, paste_start + in + length); + } + + if (paste_end != paste_start) { + InsertGapsAt(paste_start, paste_end - paste_start, command); + } + } + + for (auto it=res.GetLoadData().properties.cbegin(); it!=res.GetLoadData().properties.cend(); it++) { + Block *block = static_cast(it.key()); + rational in = rational::fromString(it.value()[QStringLiteral("in")]); + Track::Reference track = Track::Reference::FromString(it.value()[QStringLiteral("track")]); + + command->add_child(new TrackPlaceBlockCommand(sequence()->track_list(track.type()), + track.index(), + block, + paste_start + in)); + } + + Core::instance()->undo_stack()->pushIfHasChildren(command); + + return true; +} + +TimelineAndTrackView *TimelineWidget::AddTimelineAndTrackView(Qt::Alignment alignment) +{ + TimelineAndTrackView *v = new TimelineAndTrackView(alignment); + connect(v->track_view(), &TrackView::AboutToDeleteTrack, this, &TimelineWidget::TrackAboutToBeDeleted); + return v; +} + QByteArray TimelineWidget::SaveSplitterState() const { return view_splitter_->saveState(); diff --git a/app/widget/timelinewidget/timelinewidget.h b/app/widget/timelinewidget/timelinewidget.h index cd515b67f..e2f9d6b35 100644 --- a/app/widget/timelinewidget/timelinewidget.h +++ b/app/widget/timelinewidget/timelinewidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -79,9 +79,11 @@ public: void ToggleLinksOnSelected(); - void CopySelected(bool cut); + virtual bool CopySelected(bool cut) override; - void Paste(bool insert); + virtual bool Paste() override; + + void PasteInsert(); void DeleteInToOut(bool ripple); @@ -105,6 +107,8 @@ public: void DisableRecordingOverlay(); + void AddTentativeSubtitleTrack(); + /** * @brief Timelines should always be connected to sequences */ @@ -228,6 +232,7 @@ public: // Set to null subtitle_show_command_ = nullptr; + subtitle_tentative_track_ = nullptr; // Return command return c; @@ -264,6 +269,9 @@ public: }; +public slots: + void ClearTentativeSubtitleTrack(); + signals: void BlockSelectionChanged(const QVector& selected_blocks); @@ -294,6 +302,10 @@ private: QVector GetBlocksInGlobalRect(const QPoint &p1, const QPoint &p2); + bool PasteInternal(bool insert); + + TimelineAndTrackView *AddTimelineAndTrackView(Qt::Alignment alignment); + QPoint drag_origin_; QRubberBand rubberband_; @@ -327,6 +339,7 @@ private: QSplitter* view_splitter_; MultiUndoCommand *subtitle_show_command_; + Track *subtitle_tentative_track_; QTimer *signal_block_change_timer_; @@ -416,6 +429,8 @@ private slots: void RenameSelectedBlocks(); + void TrackAboutToBeDeleted(Track *track); + }; } diff --git a/app/widget/timelinewidget/timelinewidgetselections.cpp b/app/widget/timelinewidget/timelinewidgetselections.cpp index 0578db6d8..83eec07ec 100644 --- a/app/widget/timelinewidget/timelinewidgetselections.cpp +++ b/app/widget/timelinewidget/timelinewidgetselections.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/timelinewidgetselections.h b/app/widget/timelinewidget/timelinewidgetselections.h index e2803f8c7..8bd216f66 100644 --- a/app/widget/timelinewidget/timelinewidgetselections.h +++ b/app/widget/timelinewidget/timelinewidgetselections.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/CMakeLists.txt b/app/widget/timelinewidget/tool/CMakeLists.txt index 8175a66cf..10670d9b0 100644 --- a/app/widget/timelinewidget/tool/CMakeLists.txt +++ b/app/widget/timelinewidget/tool/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/add.cpp b/app/widget/timelinewidget/tool/add.cpp index 2dd7455c5..866a384d2 100644 --- a/app/widget/timelinewidget/tool/add.cpp +++ b/app/widget/timelinewidget/tool/add.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ #include "node/generator/shape/shapenode.h" #include "node/generator/solid/solid.h" #include "node/generator/text/textv3.h" +#include "widget/nodeparamview/nodeparamviewundo.h" #include "widget/timelinewidget/timelinewidget.h" #include "widget/timelinewidget/undo/timelineundopointer.h" @@ -49,22 +50,22 @@ void AddTool::MousePress(TimelineViewMouseEvent *event) Track::Type add_type = Track::kNone; switch (Core::instance()->GetSelectedAddableObject()) { - case olive::Tool::kAddableBars: - case olive::Tool::kAddableSolid: - case olive::Tool::kAddableTitle: - case olive::Tool::kAddableShape: + case Tool::kAddableBars: + case Tool::kAddableSolid: + case Tool::kAddableTitle: + case Tool::kAddableShape: add_type = Track::kVideo; break; - case olive::Tool::kAddableTone: + case Tool::kAddableTone: add_type = Track::kAudio; break; - case olive::Tool::kAddableSubtitle: + case Tool::kAddableSubtitle: add_type = Track::kSubtitle; break; - case olive::Tool::kAddableEmpty: + case Tool::kAddableEmpty: // Leave as "none", which means this block can be placed on any track break; - case olive::Tool::kAddableCount: + case Tool::kAddableCount: // Return so we do nothing return; } @@ -94,8 +95,6 @@ void AddTool::MouseMove(TimelineViewMouseEvent *event) void AddTool::MouseRelease(TimelineViewMouseEvent *event) { - const Track::Reference& track = ghost_->GetTrack(); - if (ghost_) { if (!ghost_->GetAdjustedLength().isNull()) { MultiUndoCommand* command = new MultiUndoCommand(); @@ -104,62 +103,16 @@ void AddTool::MouseRelease(TimelineViewMouseEvent *event) command->add_child(subtitle_section_command); } - ClipBlock* clip; - if (Core::instance()->GetSelectedAddableObject() == olive::Tool::kAddableSubtitle) { - clip = new SubtitleBlock(); - } else { - clip = new ClipBlock(); - } - clip->set_length_and_media_out(ghost_->GetAdjustedLength()); - clip->SetLabel(olive::Tool::GetAddableObjectName(Core::instance()->GetSelectedAddableObject())); + Sequence *s = parent()->sequence(); - NodeGraph* graph = static_cast(parent()->GetConnectedNode()->parent()); - - command->add_child(new NodeAddCommand(graph, clip)); - command->add_child(new NodeSetPositionCommand(clip, clip, QPointF(0, 0))); - command->add_child(new TrackPlaceBlockCommand(sequence()->track_list(track.type()), - track.index(), - clip, - ghost_->GetAdjustedIn())); - - Node *node_to_add = nullptr; - - switch (Core::instance()->GetSelectedAddableObject()) { - case olive::Tool::kAddableEmpty: - // Empty, nothing to be done - break; - case olive::Tool::kAddableSolid: - { - node_to_add = new SolidGenerator(); - break; - } - case olive::Tool::kAddableShape: - node_to_add = new ShapeNode(); - break; - case olive::Tool::kAddableTitle: - { - node_to_add = new TextGeneratorV3(); - break; - } - case olive::Tool::kAddableBars: - case olive::Tool::kAddableTone: - // Not implemented yet - qWarning() << "Unimplemented add object:" << Core::instance()->GetSelectedAddableObject(); - break; - case olive::Tool::kAddableSubtitle: - // The block itself is the node we want - break; - case olive::Tool::kAddableCount: - // Invalid value, do nothing - break; + QRectF r; + if (Core::instance()->GetSelectedAddableObject() == Tool::kAddableTitle) { + VideoParams svp = s->GetVideoParams(); + r = QRectF(0, 0, svp.width(), svp.height()); + r.adjust(svp.width()/10, svp.height()/10, -svp.width()/10, -svp.height()/10); } - if (node_to_add) { - QPointF extra_node_offset(kDefaultDistanceFromOutput, 0); - command->add_child(new NodeAddCommand(graph, node_to_add)); - command->add_child(new NodeEdgeAddCommand(node_to_add, NodeInput(clip, ClipBlock::kBufferIn))); - command->add_child(new NodeSetPositionCommand(node_to_add, clip, extra_node_offset)); - } + CreateAddableClip(command, s, ghost_->GetTrack(), ghost_->GetAdjustedIn(), ghost_->GetAdjustedLength(), r); Core::instance()->undo_stack()->push(command); } @@ -170,6 +123,70 @@ void AddTool::MouseRelease(TimelineViewMouseEvent *event) } } +Node *AddTool::CreateAddableClip(MultiUndoCommand *command, Sequence *sequence, const Track::Reference &track, const rational &in, const rational &length, const QRectF &rect) +{ + ClipBlock* clip; + if (Core::instance()->GetSelectedAddableObject() == Tool::kAddableSubtitle) { + clip = new SubtitleBlock(); + } else { + clip = new ClipBlock(); + } + clip->set_length_and_media_out(length); + clip->SetLabel(olive::Tool::GetAddableObjectName(Core::instance()->GetSelectedAddableObject())); + + NodeGraph* graph = sequence->parent(); + + command->add_child(new NodeAddCommand(graph, clip)); + command->add_child(new NodeSetPositionCommand(clip, clip, QPointF(0, 0))); + command->add_child(new TrackPlaceBlockCommand(sequence->track_list(track.type()), + track.index(), + clip, + in)); + + Node *node_to_add = nullptr; + + switch (Core::instance()->GetSelectedAddableObject()) { + case Tool::kAddableEmpty: + // Empty, nothing to be done + break; + case Tool::kAddableSolid: + node_to_add = new SolidGenerator(); + break; + case Tool::kAddableShape: + node_to_add = new ShapeNode(); + break; + case Tool::kAddableTitle: + node_to_add = new TextGeneratorV3(); + break; + case Tool::kAddableBars: + case Tool::kAddableTone: + // Not implemented yet + qWarning() << "Unimplemented add object:" << Core::instance()->GetSelectedAddableObject(); + break; + case Tool::kAddableSubtitle: + // The block itself is the node we want + break; + case Tool::kAddableCount: + // Invalid value, do nothing + break; + } + + if (node_to_add) { + QPointF extra_node_offset(kDefaultDistanceFromOutput, 0); + command->add_child(new NodeAddCommand(graph, node_to_add)); + command->add_child(new NodeEdgeAddCommand(node_to_add, NodeInput(clip, ClipBlock::kBufferIn))); + command->add_child(new NodeSetPositionCommand(node_to_add, clip, extra_node_offset)); + + if (!rect.isNull()) { + if (ShapeNodeBase *shape = dynamic_cast(node_to_add)) { + shape->SetRect(rect, sequence->GetVideoParams(), command); + } + } + } + + return node_to_add; +} + void AddTool::MouseMoveInternal(const rational &cursor_frame, bool outwards) { // Calculate movement diff --git a/app/widget/timelinewidget/tool/add.h b/app/widget/timelinewidget/tool/add.h index 8b3e64946..0320fddd8 100644 --- a/app/widget/timelinewidget/tool/add.h +++ b/app/widget/timelinewidget/tool/add.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,6 +34,8 @@ public: virtual void MouseMove(TimelineViewMouseEvent *event) override; virtual void MouseRelease(TimelineViewMouseEvent *event) override; + static Node *CreateAddableClip(MultiUndoCommand *command, Sequence *sequence, const Track::Reference &track, const rational &in, const rational &length, const QRectF &rect = QRectF()); + protected: void MouseMoveInternal(const rational& cursor_frame, bool outwards); diff --git a/app/widget/timelinewidget/tool/beam.cpp b/app/widget/timelinewidget/tool/beam.cpp index 5eaa10409..d2332e3bf 100644 --- a/app/widget/timelinewidget/tool/beam.cpp +++ b/app/widget/timelinewidget/tool/beam.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/beam.h b/app/widget/timelinewidget/tool/beam.h index 25180d692..ab3ae1528 100644 --- a/app/widget/timelinewidget/tool/beam.h +++ b/app/widget/timelinewidget/tool/beam.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/edit.cpp b/app/widget/timelinewidget/tool/edit.cpp index ce7511b95..0a483e925 100644 --- a/app/widget/timelinewidget/tool/edit.cpp +++ b/app/widget/timelinewidget/tool/edit.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/edit.h b/app/widget/timelinewidget/tool/edit.h index 108379e92..ed259069a 100644 --- a/app/widget/timelinewidget/tool/edit.h +++ b/app/widget/timelinewidget/tool/edit.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/import.cpp b/app/widget/timelinewidget/tool/import.cpp index ed81a6f8b..bc1a5590a 100644 --- a/app/widget/timelinewidget/tool/import.cpp +++ b/app/widget/timelinewidget/tool/import.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ #include "core.h" #include "dialog/sequence/sequence.h" #include "node/audio/volume/volume.h" +#include "node/block/subtitle/subtitle.h" #include "node/distort/transform/transformdistortnode.h" #include "node/generator/matrix/matrix.h" #include "node/math/math/math.h" @@ -54,10 +55,10 @@ void ImportTool::DragEnter(TimelineViewMouseEvent *event) QStringList mime_formats = event->GetMimeData()->formats(); // Listen for MIME data from a ProjectViewModel - if (mime_formats.contains(QStringLiteral("application/x-oliveprojectitemdata"))) { + if (mime_formats.contains(Project::kItemMimeType)) { // Data is drag/drop data from a ProjectViewModel - QByteArray model_data = event->GetMimeData()->data(QStringLiteral("application/x-oliveprojectitemdata")); + QByteArray model_data = event->GetMimeData()->data(Project::kItemMimeType); // Use QDataStream to deserialize the data QDataStream stream(&model_data, QIODevice::ReadOnly); @@ -86,10 +87,21 @@ void ImportTool::DragEnter(TimelineViewMouseEvent *event) } } - PrepGhosts(drag_start_.GetFrame() - parent()->SceneToTime(import_pre_buffer_), - drag_start_.GetTrack().index()); + // Create a reasonable amount of space to inset the cursor by when importing + ghost_offset_ = drag_start_.GetFrame(); + + if (!event->GetBypassImportBuffer()) { + ghost_offset_ -= parent()->SceneToTime(import_pre_buffer_); + } + + PrepGhosts(ghost_offset_, drag_start_.GetTrack().index()); if (parent()->HasGhosts() || !parent()->GetConnectedNode()) { + // We only clear the tentative track if the mimedata is about to be destroyed (i.e. the drag + // is cancelled). If we do this in DragLeave, it leads to undesirable behavior if the cursor + // is going between views (subtitle track rapidly appearing and disappearing) + QObject::connect(event->GetMimeData(), &QObject::destroyed, parent(), &TimelineWidget::ClearTentativeSubtitleTrack); + event->accept(); } else { event->ignore(); @@ -106,6 +118,12 @@ void ImportTool::DragMove(TimelineViewMouseEvent *event) if (parent()->HasGhosts()) { rational time_movement = event->GetFrame() - drag_start_.GetFrame(); + + // Keep ghost offset no lower than 0 + if (ghost_offset_ + time_movement < 0) { + time_movement = -ghost_offset_; + } + int track_movement = event->GetTrack().index() - drag_start_.GetTrack().index(); time_movement = ValidateTimeMovement(time_movement); @@ -235,25 +253,27 @@ void ImportTool::FootageToGhosts(rational ghost_start, const DraggedFootageData // Create ghosts foreach (const Track::Reference& ref, it->second) { Track::Type track_type = ref.type(); + Track::Reference dest_track(track_type, track_offsets.at(track_type)); - TimelineViewGhostItem* ghost = new TimelineViewGhostItem(); + if (track_type == Track::kVideo || track_type == Track::kAudio) { + auto ghost = CreateGhost(TimeRange(ghost_start, ghost_start + footage_duration), ghost_in, dest_track); - ghost->SetIn(ghost_start); - ghost->SetOut(ghost_start + footage_duration); - ghost->SetMediaIn(ghost_in); - ghost->SetTrack(Track::Reference(track_type, track_offsets.at(track_type))); + // Increment track count for this track type + track_offsets[track_type]++; - snap_points_.push_back(ghost->GetIn()); - snap_points_.push_back(ghost->GetOut()); + TimelineViewGhostItem::AttachedFootage af = {it->first, ref.ToString()}; + ghost->SetData(TimelineViewGhostItem::kAttachedFootage, QVariant::fromValue(af)); + } else if (track_type == Track::kSubtitle) { + SubtitleParams sp = footage->GetSubtitleParams(ref.index()); - // Increment track count for this track type - track_offsets[track_type]++; + for (const Subtitle &sub : sp) { + auto ghost = CreateGhost(sub.time() + ghost_start, 0, dest_track); - TimelineViewGhostItem::AttachedFootage af = {it->first, ref.ToString()}; - ghost->SetData(TimelineViewGhostItem::kAttachedFootage, QVariant::fromValue(af)); - ghost->SetMode(Timeline::kMove); + ghost->SetData(TimelineViewGhostItem::kAttachedFootage, QVariant::fromValue(sub)); + } - parent()->AddGhost(ghost); + parent()->AddTentativeSubtitleTrack(); + } } // Stack each ghost one after the other @@ -276,6 +296,10 @@ void ImportTool::DropGhosts(bool insert) { MultiUndoCommand* command = new MultiUndoCommand(); + if (MultiUndoCommand *c = parent()->TakeSubtitleSectionCommand()) { + command->add_child(c); + } + NodeGraph* dst_graph = nullptr; Sequence* sequence = this->sequence(); bool open_sequence = false; @@ -360,6 +384,10 @@ void ImportTool::DropGhosts(bool insert) FootageToGhosts(0, dragged_footage_, new_sequence->GetVideoParams().time_base(), 0); + if (MultiUndoCommand *c = parent()->TakeSubtitleSectionCommand()) { + command->add_child(c); + } + sequence = new_sequence; // Set this as the sequence to open @@ -384,69 +412,83 @@ void ImportTool::DropGhosts(bool insert) for (int i=0;iGetGhostItems().size();i++) { TimelineViewGhostItem* ghost = parent()->GetGhostItems().at(i); + Block* block = nullptr; - TimelineViewGhostItem::AttachedFootage footage_stream = ghost->GetData(TimelineViewGhostItem::kAttachedFootage).value(); + Track::Type track_type = ghost->GetAdjustedTrack().type(); + if (track_type == Track::kVideo || track_type == Track::kAudio) { + TimelineViewGhostItem::AttachedFootage footage_stream = ghost->GetData(TimelineViewGhostItem::kAttachedFootage).value(); - ClipBlock* clip = new ClipBlock(); - clip->set_media_in(ghost->GetMediaIn()); - clip->set_length_and_media_out(ghost->GetLength()); - clip->SetLabel(footage_stream.footage->GetLabel()); - command->add_child(new NodeAddCommand(dst_graph, clip)); + ClipBlock* clip = new ClipBlock(); + block = clip; + clip->set_media_in(ghost->GetMediaIn()); + clip->SetLabel(footage_stream.footage->GetLabel()); + command->add_child(new NodeAddCommand(dst_graph, clip)); - // Position clip in its own context - command->add_child(new NodeSetPositionCommand(clip, clip, QPointF(0, 0))); + // Position clip in its own context + command->add_child(new NodeSetPositionCommand(clip, clip, QPointF(0, 0))); - int dep_pos = kDefaultDistanceFromOutput; + int dep_pos = kDefaultDistanceFromOutput; - // Position footage in its context - command->add_child(new NodeSetPositionCommand(footage_stream.footage, clip, QPointF(dep_pos, 0))); + // Position footage in its context + command->add_child(new NodeSetPositionCommand(footage_stream.footage, clip, QPointF(dep_pos, 0))); - dep_pos++; + dep_pos++; - switch (Track::Reference::TypeFromString(footage_stream.output)) { - case Track::kVideo: - { - TransformDistortNode* transform = new TransformDistortNode(); - command->add_child(new NodeAddCommand(dst_graph, transform)); + switch (Track::Reference::TypeFromString(footage_stream.output)) { + case Track::kVideo: + { + TransformDistortNode* transform = new TransformDistortNode(); + command->add_child(new NodeAddCommand(dst_graph, transform)); - command->add_child(new NodeSetValueHintCommand(transform, TransformDistortNode::kTextureInput, -1, Node::ValueHint({NodeValue::kTexture}, footage_stream.output))); + command->add_child(new NodeSetValueHintCommand(transform, TransformDistortNode::kTextureInput, -1, Node::ValueHint({NodeValue::kTexture}, footage_stream.output))); - command->add_child(new NodeEdgeAddCommand(footage_stream.footage, NodeInput(transform, TransformDistortNode::kTextureInput))); - command->add_child(new NodeEdgeAddCommand(transform, NodeInput(clip, ClipBlock::kBufferIn))); - command->add_child(new NodeSetPositionCommand(transform, clip, QPointF(dep_pos, 0))); - break; + command->add_child(new NodeEdgeAddCommand(footage_stream.footage, NodeInput(transform, TransformDistortNode::kTextureInput))); + command->add_child(new NodeEdgeAddCommand(transform, NodeInput(clip, ClipBlock::kBufferIn))); + command->add_child(new NodeSetPositionCommand(transform, clip, QPointF(dep_pos, 0))); + break; + } + case Track::kAudio: + { + VolumeNode* volume_node = new VolumeNode(); + command->add_child(new NodeAddCommand(dst_graph, volume_node)); + + command->add_child(new NodeSetValueHintCommand(volume_node, VolumeNode::kSamplesInput, -1, Node::ValueHint({NodeValue::kSamples}, footage_stream.output))); + + command->add_child(new NodeEdgeAddCommand(footage_stream.footage, NodeInput(volume_node, VolumeNode::kSamplesInput))); + command->add_child(new NodeEdgeAddCommand(volume_node, NodeInput(clip, ClipBlock::kBufferIn))); + command->add_child(new NodeSetPositionCommand(volume_node, clip, QPointF(dep_pos, 0))); + break; + } + default: + break; + } + + // Link any clips so far that share the same Footage with this one + for (int j=0;jGetGhostItems().at(j)->GetData(TimelineViewGhostItem::kAttachedFootage).value(); + + if (footage_compare.footage == footage_stream.footage) { + Block::Link(block_items.at(j), clip); + } + } + } else if (track_type == Track::kSubtitle) { + Subtitle src = ghost->GetData(TimelineViewGhostItem::kAttachedFootage).value(); + SubtitleBlock *sub = new SubtitleBlock(); + sub->SetText(src.text()); + block = sub; + + command->add_child(new NodeAddCommand(dst_graph, sub)); + command->add_child(new NodeSetPositionCommand(sub, sub, QPointF(0, 0))); } - case Track::kAudio: - { - VolumeNode* volume_node = new VolumeNode(); - command->add_child(new NodeAddCommand(dst_graph, volume_node)); - command->add_child(new NodeSetValueHintCommand(volume_node, VolumeNode::kSamplesInput, -1, Node::ValueHint({NodeValue::kSamples}, footage_stream.output))); - - command->add_child(new NodeEdgeAddCommand(footage_stream.footage, NodeInput(volume_node, VolumeNode::kSamplesInput))); - command->add_child(new NodeEdgeAddCommand(volume_node, NodeInput(clip, ClipBlock::kBufferIn))); - command->add_child(new NodeSetPositionCommand(volume_node, clip, QPointF(dep_pos, 0))); - break; - } - default: - break; - } + block->set_length_and_media_out(ghost->GetLength()); command->add_child(new TrackPlaceBlockCommand(sequence->track_list(ghost->GetAdjustedTrack().type()), ghost->GetAdjustedTrack().index(), - clip, + block, ghost->GetAdjustedIn())); - block_items.replace(i, clip); - - // Link any clips so far that share the same Footage with this one - for (int j=0;jGetGhostItems().at(j)->GetData(TimelineViewGhostItem::kAttachedFootage).value(); - - if (footage_compare.footage == footage_stream.footage) { - Block::Link(block_items.at(j), clip); - } - } + block_items.replace(i, block); } } @@ -460,4 +502,24 @@ void ImportTool::DropGhosts(bool insert) dragged_footage_.clear(); } +TimelineViewGhostItem* ImportTool::CreateGhost(const TimeRange &range, const rational &media_in, const Track::Reference &track) +{ + TimelineViewGhostItem* ghost = new TimelineViewGhostItem(); + + ghost->SetIn(range.in()); + ghost->SetOut(range.out()); + ghost->SetMediaIn(media_in); + ghost->SetTrack(track); + + snap_points_.push_back(ghost->GetIn()); + snap_points_.push_back(ghost->GetOut()); + + + ghost->SetMode(Timeline::kMove); + + parent()->AddGhost(ghost); + + return ghost; +} + } diff --git a/app/widget/timelinewidget/tool/import.h b/app/widget/timelinewidget/tool/import.h index 965f5960d..565d8f0ce 100644 --- a/app/widget/timelinewidget/tool/import.h +++ b/app/widget/timelinewidget/tool/import.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,10 +54,14 @@ private: void DropGhosts(bool insert); + TimelineViewGhostItem* CreateGhost(const TimeRange &range, const rational &media_in, const Track::Reference &track); + DraggedFootageData dragged_footage_; int import_pre_buffer_; + rational ghost_offset_; + }; } diff --git a/app/widget/timelinewidget/tool/pointer.cpp b/app/widget/timelinewidget/tool/pointer.cpp index ad76ff6a6..7158cb906 100644 --- a/app/widget/timelinewidget/tool/pointer.cpp +++ b/app/widget/timelinewidget/tool/pointer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -264,10 +264,30 @@ void PointerTool::InitiateDragInternal(Block *clicked_item, return; } - // Determine if this move is a slide, which is determined by either - bool clips_are_sliding = (slide_instead_of_moving || dynamic_cast(clicked_item)); + bool sliding_due_to_transition = false; - if (clips_are_sliding) { + if (!slide_instead_of_moving) { + // If the user tries to move a transition without moving the clip it belongs to, we turn + // this into a slide + foreach (Block* block, clips) { + if (TransitionBlock* transit = dynamic_cast(block)) { + if (!CanTransitionMove(transit, clips)) { + slide_instead_of_moving = true; + break; + } + } else if (ClipBlock *clip = dynamic_cast(block)) { + if ((clip->in_transition() && !CanTransitionMove(clip->in_transition(), clips)) + || (clip->out_transition() && !CanTransitionMove(clip->out_transition(), clips))) { + slide_instead_of_moving = true; + break; + } + } + } + + sliding_due_to_transition = slide_instead_of_moving; + } + + if (slide_instead_of_moving) { // This is a slide. What we do here is move clips within their own track, between the clips // that they're already next to. We don't allow changing tracks or changing the order of // blocks. @@ -297,17 +317,51 @@ void PointerTool::InitiateDragInternal(Block *clicked_item, Block* latest = latest_block_on_track.value(i.key()); // First we add the block that's out trimming, the one prior to the earliest - TimelineViewGhostItem* earliest_ghost; - if (earliest->previous()) { - earliest_ghost = AddGhostFromBlock(earliest->previous(), Timeline::kTrimOut); - } else { - earliest_ghost = AddGhostFromNull(earliest->in(), earliest->in(), track->ToReference(), Timeline::kTrimOut); + { + TimelineViewGhostItem* earliest_ghost; + bool slide_with_earliest_previous = true; + if (sliding_due_to_transition && earliest->previous()) { + if (TransitionBlock *transit = dynamic_cast(earliest)) { + if (earliest->previous() != transit->connected_out_block()) { + slide_with_earliest_previous = false; + } + } else if (ClipBlock *clip = dynamic_cast(earliest)) { + if (earliest->previous() != clip->in_transition()) { + slide_with_earliest_previous = false; + } + } + } + + if (earliest->previous() && slide_with_earliest_previous) { + earliest_ghost = AddGhostFromBlock(earliest->previous(), Timeline::kTrimOut); + } else { + earliest_ghost = AddGhostFromNull(earliest->in(), earliest->in(), track->ToReference(), Timeline::kTrimOut); + } + SetGhostToSlideMode(earliest_ghost); } - SetGhostToSlideMode(earliest_ghost); // Then we add the block that's in trimming, the one after the latest if (latest->next()) { - TimelineViewGhostItem* latest_ghost = AddGhostFromBlock(latest->next(), Timeline::kTrimIn); + TimelineViewGhostItem* latest_ghost; + + bool slide_with_latest_next = true; + if (sliding_due_to_transition) { + if (TransitionBlock *transit = dynamic_cast(latest)) { + if (latest->next() != transit->connected_in_block()) { + slide_with_latest_next = false; + } + } else if (ClipBlock *clip = dynamic_cast(latest)) { + if (latest->next() != clip->out_transition()) { + slide_with_latest_next = false; + } + } + } + + if (slide_with_latest_next) { + latest_ghost = AddGhostFromBlock(latest->next(), Timeline::kTrimIn); + } else { + latest_ghost = AddGhostFromNull(latest->out(), latest->out(), track->ToReference(), Timeline::kTrimIn); + } SetGhostToSlideMode(latest_ghost); } @@ -329,13 +383,18 @@ void PointerTool::InitiateDragInternal(Block *clicked_item, } else { // Prepare for a standard pointer move by creating ghosts for them and any related blocks foreach (Block* block, clips) { - if (dynamic_cast(block) || dynamic_cast(block)) { - // Gaps cannot move, and we handle transitions further down - continue; - } - // Create ghost for this block - AddGhostFromBlock(block, trim_mode, true); + auto ghost = AddGhostFromBlock(block, trim_mode, true); + Q_UNUSED(ghost) + + if (ClipBlock *clip = dynamic_cast(block)) { + if (clip->out_transition()) { + AddGhostFromBlock(clip->out_transition(), trim_mode, true); + } + if (clip->in_transition()) { + AddGhostFromBlock(clip->in_transition(), trim_mode, true); + } + } } } @@ -454,6 +513,18 @@ void PointerTool::InitiateDragInternal(Block *clicked_item, } } +bool PointerTool::CanTransitionMove(TransitionBlock *transit, const QVector &clips) +{ + Block *out = transit->connected_out_block(); + Block *in = transit->connected_in_block(); + + if ((out && !clips.contains(out)) || (in && !clips.contains(in))) { + return false; + } + + return true; +} + void PointerTool::ProcessDrag(const TimelineCoordinate &mouse_pos) { // Calculate track movement @@ -691,8 +762,7 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event) } if (!movement.isNull()) { - QHash >::const_iterator i; - for (i=slide_info.constBegin(); i!=slide_info.constEnd(); i++) { + for (auto i=slide_info.constBegin(); i!=slide_info.constEnd(); i++) { command->add_child(new TrackSlideCommand(parent()->GetTrackFromReference(i.key()), i.value(), in_adjacents.value(i.key()), @@ -737,6 +807,17 @@ void PointerTool::InitiateDrag(Block *clicked_item, Timeline::MovementMode trim_ InitiateDragInternal(clicked_item, trim_mode, modifiers, false, false, false); } +TimelineViewGhostItem *PointerTool::GetExistingGhostFromBlock(Block *block) +{ + foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) { + if (Node::ValueToPtr(ghost->GetData(TimelineViewGhostItem::kAttachedBlock)) == block) { + return ghost; + } + } + + return nullptr; +} + //#define HIDE_GAP_GHOSTS TimelineViewGhostItem* PointerTool::AddGhostFromBlock(Block* block, Timeline::MovementMode mode, bool check_if_exists) @@ -747,17 +828,17 @@ TimelineViewGhostItem* PointerTool::AddGhostFromBlock(Block* block, Timeline::Mo return nullptr; } + TimelineViewGhostItem* ghost; + // Check if we've already made a ghost for this block if (check_if_exists) { - foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) { - if (Node::ValueToPtr(ghost->GetData(TimelineViewGhostItem::kAttachedBlock)) == block) { - return ghost; - } + if ((ghost = GetExistingGhostFromBlock(block))) { + return ghost; } } // Otherwise, it's time to make a ghost for this block - TimelineViewGhostItem* ghost = TimelineViewGhostItem::FromBlock(block); + ghost = TimelineViewGhostItem::FromBlock(block); #ifdef HIDE_GAP_GHOSTS if (block->type() == Block::kGap) { diff --git a/app/widget/timelinewidget/tool/pointer.h b/app/widget/timelinewidget/tool/pointer.h index d44d60c8e..be4e0cf90 100644 --- a/app/widget/timelinewidget/tool/pointer.h +++ b/app/widget/timelinewidget/tool/pointer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,6 +41,8 @@ protected: virtual void InitiateDrag(Block* clicked_item, Timeline::MovementMode trim_mode, Qt::KeyboardModifiers modifiers); + TimelineViewGhostItem *GetExistingGhostFromBlock(Block *block); + TimelineViewGhostItem* AddGhostFromBlock(Block *block, Timeline::MovementMode mode, bool check_if_exists = false); TimelineViewGhostItem* AddGhostFromNull(const rational& in, const rational& out, const Track::Reference& track, Timeline::MovementMode mode); @@ -72,6 +74,8 @@ protected: const Timeline::MovementMode& drag_movement_mode() const { return drag_movement_mode_; } void set_drag_movement_mode(const Timeline::MovementMode &d) { drag_movement_mode_ = d; } + static bool CanTransitionMove(TransitionBlock *transit, const QVector &clips); + void SetMovementAllowed(bool e) { movement_allowed_ = e; diff --git a/app/widget/timelinewidget/tool/razor.cpp b/app/widget/timelinewidget/tool/razor.cpp index f8c350344..76b8c720f 100644 --- a/app/widget/timelinewidget/tool/razor.cpp +++ b/app/widget/timelinewidget/tool/razor.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/razor.h b/app/widget/timelinewidget/tool/razor.h index 52820affe..c32767455 100644 --- a/app/widget/timelinewidget/tool/razor.h +++ b/app/widget/timelinewidget/tool/razor.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/record.h b/app/widget/timelinewidget/tool/record.h index 4fbe7f85b..1d7e38e7e 100644 --- a/app/widget/timelinewidget/tool/record.h +++ b/app/widget/timelinewidget/tool/record.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/ripple.cpp b/app/widget/timelinewidget/tool/ripple.cpp index 2eeae67fa..cacc4f1e5 100644 --- a/app/widget/timelinewidget/tool/ripple.cpp +++ b/app/widget/timelinewidget/tool/ripple.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/ripple.h b/app/widget/timelinewidget/tool/ripple.h index b58ced311..840f154f5 100644 --- a/app/widget/timelinewidget/tool/ripple.h +++ b/app/widget/timelinewidget/tool/ripple.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/rolling.cpp b/app/widget/timelinewidget/tool/rolling.cpp index 3f5ff410e..12688f684 100644 --- a/app/widget/timelinewidget/tool/rolling.cpp +++ b/app/widget/timelinewidget/tool/rolling.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/rolling.h b/app/widget/timelinewidget/tool/rolling.h index 724f79c80..7cb321b62 100644 --- a/app/widget/timelinewidget/tool/rolling.h +++ b/app/widget/timelinewidget/tool/rolling.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/slide.cpp b/app/widget/timelinewidget/tool/slide.cpp index 30ee0376b..5bdc61889 100644 --- a/app/widget/timelinewidget/tool/slide.cpp +++ b/app/widget/timelinewidget/tool/slide.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/slide.h b/app/widget/timelinewidget/tool/slide.h index ce7c57821..b7951f951 100644 --- a/app/widget/timelinewidget/tool/slide.h +++ b/app/widget/timelinewidget/tool/slide.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/slip.cpp b/app/widget/timelinewidget/tool/slip.cpp index 6dc6a6c61..86550fcbc 100644 --- a/app/widget/timelinewidget/tool/slip.cpp +++ b/app/widget/timelinewidget/tool/slip.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/slip.h b/app/widget/timelinewidget/tool/slip.h index be29eb1b2..046aee0c9 100644 --- a/app/widget/timelinewidget/tool/slip.h +++ b/app/widget/timelinewidget/tool/slip.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/tool.cpp b/app/widget/timelinewidget/tool/tool.cpp index 2612b9697..2e35857ee 100644 --- a/app/widget/timelinewidget/tool/tool.cpp +++ b/app/widget/timelinewidget/tool/tool.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/tool.h b/app/widget/timelinewidget/tool/tool.h index 47fafbd90..37a5a6841 100644 --- a/app/widget/timelinewidget/tool/tool.h +++ b/app/widget/timelinewidget/tool/tool.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/trackselect.cpp b/app/widget/timelinewidget/tool/trackselect.cpp index 57a948ef3..5ee1c4419 100644 --- a/app/widget/timelinewidget/tool/trackselect.cpp +++ b/app/widget/timelinewidget/tool/trackselect.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/trackselect.h b/app/widget/timelinewidget/tool/trackselect.h index 1ff4e4a9f..309afe22d 100644 --- a/app/widget/timelinewidget/tool/trackselect.h +++ b/app/widget/timelinewidget/tool/trackselect.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/transition.cpp b/app/widget/timelinewidget/tool/transition.cpp index bd95a429a..f03f06297 100644 --- a/app/widget/timelinewidget/tool/transition.cpp +++ b/app/widget/timelinewidget/tool/transition.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/transition.h b/app/widget/timelinewidget/tool/transition.h index 8bae224cf..c345f52f1 100644 --- a/app/widget/timelinewidget/tool/transition.h +++ b/app/widget/timelinewidget/tool/transition.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/zoom.cpp b/app/widget/timelinewidget/tool/zoom.cpp index 9b6731fe2..3d270b555 100644 --- a/app/widget/timelinewidget/tool/zoom.cpp +++ b/app/widget/timelinewidget/tool/zoom.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/tool/zoom.h b/app/widget/timelinewidget/tool/zoom.h index 61ee6f9cc..ffe9c96f6 100644 --- a/app/widget/timelinewidget/tool/zoom.h +++ b/app/widget/timelinewidget/tool/zoom.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/trackview/CMakeLists.txt b/app/widget/timelinewidget/trackview/CMakeLists.txt index 854fb0532..c0b7845e6 100644 --- a/app/widget/timelinewidget/trackview/CMakeLists.txt +++ b/app/widget/timelinewidget/trackview/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/trackview/trackview.cpp b/app/widget/timelinewidget/trackview/trackview.cpp index c2de4f750..562c68d55 100644 --- a/app/widget/timelinewidget/trackview/trackview.cpp +++ b/app/widget/timelinewidget/trackview/trackview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -121,9 +121,13 @@ void TrackView::TrackHeightChanged(int index, int height) void TrackView::InsertTrack(Track *track) { + TrackViewItem *tvi = new TrackViewItem(track); + + connect(tvi, &TrackViewItem::AboutToDeleteTrack, this, &TrackView::AboutToDeleteTrack); + splitter_->Insert(track->Index(), track->GetTrackHeightInPixels(), - new TrackViewItem(track)); + tvi); } void TrackView::RemoveTrack(Track *track) diff --git a/app/widget/timelinewidget/trackview/trackview.h b/app/widget/timelinewidget/trackview/trackview.h index a5a502dbe..1498a526b 100644 --- a/app/widget/timelinewidget/trackview/trackview.h +++ b/app/widget/timelinewidget/trackview/trackview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,6 +40,9 @@ public: void ConnectTrackList(TrackList* list); void DisconnectTrackList(); +signals: + void AboutToDeleteTrack(Track *track); + protected: virtual void resizeEvent(QResizeEvent *e) override; diff --git a/app/widget/timelinewidget/trackview/trackviewitem.cpp b/app/widget/timelinewidget/trackview/trackviewitem.cpp index 2e860a2ae..6a5ba698e 100644 --- a/app/widget/timelinewidget/trackview/trackviewitem.cpp +++ b/app/widget/timelinewidget/trackview/trackviewitem.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -145,6 +145,7 @@ void TrackViewItem::ShowContextMenu(const QPoint &p) void TrackViewItem::DeleteTrack() { + emit AboutToDeleteTrack(track_); Core::instance()->undo_stack()->push(new TimelineRemoveTrackCommand(track_)); } diff --git a/app/widget/timelinewidget/trackview/trackviewitem.h b/app/widget/timelinewidget/trackview/trackviewitem.h index 000a562f0..fac93d4d7 100644 --- a/app/widget/timelinewidget/trackview/trackviewitem.h +++ b/app/widget/timelinewidget/trackview/trackviewitem.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ #include "node/output/track/track.h" #include "widget/clickablelabel/clickablelabel.h" #include "widget/focusablelineedit/focusablelineedit.h" +#include "widget/timelinewidget/view/timelineviewmouseevent.h" namespace olive { @@ -38,6 +39,9 @@ public: TrackViewItem(Track* track, QWidget* parent = nullptr); +signals: + void AboutToDeleteTrack(Track *track); + private: QPushButton* CreateMSLButton(const QColor &checked_color) const; diff --git a/app/widget/timelinewidget/trackview/trackviewsplitter.cpp b/app/widget/timelinewidget/trackview/trackviewsplitter.cpp index bd18d181b..e0b4f9a98 100644 --- a/app/widget/timelinewidget/trackview/trackviewsplitter.cpp +++ b/app/widget/timelinewidget/trackview/trackviewsplitter.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/trackview/trackviewsplitter.h b/app/widget/timelinewidget/trackview/trackviewsplitter.h index accee9071..652dc77d3 100644 --- a/app/widget/timelinewidget/trackview/trackviewsplitter.h +++ b/app/widget/timelinewidget/trackview/trackviewsplitter.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/CMakeLists.txt b/app/widget/timelinewidget/undo/CMakeLists.txt index a3b72c454..e93f6ed50 100644 --- a/app/widget/timelinewidget/undo/CMakeLists.txt +++ b/app/widget/timelinewidget/undo/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/timelineundocommon.h b/app/widget/timelinewidget/undo/timelineundocommon.h index 3a0d28f19..0dc793240 100644 --- a/app/widget/timelinewidget/undo/timelineundocommon.h +++ b/app/widget/timelinewidget/undo/timelineundocommon.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/timelineundogeneral.cpp b/app/widget/timelinewidget/undo/timelineundogeneral.cpp index 59e77a35d..a3d470241 100644 --- a/app/widget/timelinewidget/undo/timelineundogeneral.cpp +++ b/app/widget/timelinewidget/undo/timelineundogeneral.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/timelineundogeneral.h b/app/widget/timelinewidget/undo/timelineundogeneral.h index 7c3df0a72..136af2eea 100644 --- a/app/widget/timelinewidget/undo/timelineundogeneral.h +++ b/app/widget/timelinewidget/undo/timelineundogeneral.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/timelineundopointer.cpp b/app/widget/timelinewidget/undo/timelineundopointer.cpp index 0f6501b19..a5560f317 100644 --- a/app/widget/timelinewidget/undo/timelineundopointer.cpp +++ b/app/widget/timelinewidget/undo/timelineundopointer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/timelineundopointer.h b/app/widget/timelinewidget/undo/timelineundopointer.h index 4483d81d2..05adf590e 100644 --- a/app/widget/timelinewidget/undo/timelineundopointer.h +++ b/app/widget/timelinewidget/undo/timelineundopointer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/timelineundoripple.cpp b/app/widget/timelinewidget/undo/timelineundoripple.cpp index ef4c890ae..6b4e96098 100644 --- a/app/widget/timelinewidget/undo/timelineundoripple.cpp +++ b/app/widget/timelinewidget/undo/timelineundoripple.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/timelineundoripple.h b/app/widget/timelinewidget/undo/timelineundoripple.h index 17556f935..6a8c1191a 100644 --- a/app/widget/timelinewidget/undo/timelineundoripple.h +++ b/app/widget/timelinewidget/undo/timelineundoripple.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -207,7 +207,9 @@ private: class TimelineRippleDeleteGapsAtRegionsCommand : public UndoCommand { public: - TimelineRippleDeleteGapsAtRegionsCommand(Sequence* vo, const QVector >& regions) : + using RangeList = QVector >; + + TimelineRippleDeleteGapsAtRegionsCommand(Sequence* vo, const RangeList& regions) : timeline_(vo), regions_(regions) { @@ -237,7 +239,7 @@ protected: private: Sequence* timeline_; - QVector > regions_; + RangeList regions_; QVector commands_; diff --git a/app/widget/timelinewidget/undo/timelineundosplit.cpp b/app/widget/timelinewidget/undo/timelineundosplit.cpp index 20cc8a803..3bf70d355 100644 --- a/app/widget/timelinewidget/undo/timelineundosplit.cpp +++ b/app/widget/timelinewidget/undo/timelineundosplit.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/timelineundosplit.h b/app/widget/timelinewidget/undo/timelineundosplit.h index 9705147b9..2cc12ff21 100644 --- a/app/widget/timelinewidget/undo/timelineundosplit.h +++ b/app/widget/timelinewidget/undo/timelineundosplit.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/timelineundotrack.cpp b/app/widget/timelinewidget/undo/timelineundotrack.cpp index 7e14c10b1..6dfc4f278 100644 --- a/app/widget/timelinewidget/undo/timelineundotrack.cpp +++ b/app/widget/timelinewidget/undo/timelineundotrack.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/timelineundotrack.h b/app/widget/timelinewidget/undo/timelineundotrack.h index ca2587b5a..041225f21 100644 --- a/app/widget/timelinewidget/undo/timelineundotrack.h +++ b/app/widget/timelinewidget/undo/timelineundotrack.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/timelineundoworkarea.cpp b/app/widget/timelinewidget/undo/timelineundoworkarea.cpp index fcdd9b8b1..30a184e5a 100644 --- a/app/widget/timelinewidget/undo/timelineundoworkarea.cpp +++ b/app/widget/timelinewidget/undo/timelineundoworkarea.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/undo/timelineundoworkarea.h b/app/widget/timelinewidget/undo/timelineundoworkarea.h index a7b1e2655..b953fafa7 100644 --- a/app/widget/timelinewidget/undo/timelineundoworkarea.h +++ b/app/widget/timelinewidget/undo/timelineundoworkarea.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/view/CMakeLists.txt b/app/widget/timelinewidget/view/CMakeLists.txt index 3b36a238d..4fbe6a280 100644 --- a/app/widget/timelinewidget/view/CMakeLists.txt +++ b/app/widget/timelinewidget/view/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/view/timelineview.cpp b/app/widget/timelinewidget/view/timelineview.cpp index 567d1d0f1..d3ee50c04 100644 --- a/app/widget/timelinewidget/view/timelineview.cpp +++ b/app/widget/timelinewidget/view/timelineview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -69,7 +69,7 @@ void TimelineView::mousePressEvent(QMouseEvent *event) QObject *p = this->parent(); while (p) { if (TimelineWidget *timeline = dynamic_cast(p)) { - timeline->SetTime(it.key()->time()); + timeline->SetTime(it.key()->time().in()); break; } @@ -555,8 +555,8 @@ void TimelineView::DrawBlock(QPainter *painter, bool foreground, Block *block, q for (auto it=marker_list->cbegin(); it!=marker_list->cend(); it++) { TimelineMarker *marker = *it; // Make sure marker is within In/Out points of the clip - if (marker->time_range().in() >= clip->media_in() && marker->time_range().out() <= clip->media_in() + clip->length()) { - QPoint marker_pt(TimeToScene(clip->in() - clip->media_in() + marker->time_range().in()), block_top + block_height); + if (marker->time().in() >= clip->media_in() && marker->time().out() <= clip->media_in() + clip->length()) { + QPoint marker_pt(TimeToScene(clip->in() - clip->media_in() + marker->time().in()), block_top + block_height); painter->setClipRect(r); QRect marker_rect = marker->Draw(painter, marker_pt, GetScale(), false); clip_marker_rects_.insert(marker, marker_rect); diff --git a/app/widget/timelinewidget/view/timelineview.h b/app/widget/timelinewidget/view/timelineview.h index 3d5513637..9f9425177 100644 --- a/app/widget/timelinewidget/view/timelineview.h +++ b/app/widget/timelinewidget/view/timelineview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timelinewidget/view/timelineviewghostitem.h b/app/widget/timelinewidget/view/timelineviewghostitem.h index 92da94e98..16a3c0e8a 100644 --- a/app/widget/timelinewidget/view/timelineviewghostitem.h +++ b/app/widget/timelinewidget/view/timelineviewghostitem.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -75,7 +75,6 @@ public: ghost->can_have_zero_length_ = false; } else if (dynamic_cast(block)) { ghost->can_have_zero_length_ = false; - ghost->SetCanMoveTracks(false); } return ghost; diff --git a/app/widget/timelinewidget/view/timelineviewmouseevent.h b/app/widget/timelinewidget/view/timelineviewmouseevent.h index d1c09381d..79bd99d85 100644 --- a/app/widget/timelinewidget/view/timelineviewmouseevent.h +++ b/app/widget/timelinewidget/view/timelineviewmouseevent.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ #ifndef TIMELINEVIEWMOUSEEVENT_H #define TIMELINEVIEWMOUSEEVENT_H +#include #include #include #include @@ -46,7 +47,8 @@ public: button_(button), modifiers_(modifiers), source_event_(nullptr), - mime_data_(nullptr) + mime_data_(nullptr), + bypass_import_buffer_(false) { } @@ -116,6 +118,9 @@ public: source_event_->ignore(); } + bool GetBypassImportBuffer() const { return bypass_import_buffer_; } + void SetBypassImportBuffer(bool e) { bypass_import_buffer_ = e; } + private: qreal scene_x_; double scale_x_; @@ -131,6 +136,8 @@ private: const QMimeData* mime_data_; + bool bypass_import_buffer_; + }; } diff --git a/app/widget/timeruler/CMakeLists.txt b/app/widget/timeruler/CMakeLists.txt index 8cb805f25..895046495 100644 --- a/app/widget/timeruler/CMakeLists.txt +++ b/app/widget/timeruler/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/timeruler/seekablewidget.cpp b/app/widget/timeruler/seekablewidget.cpp index 8e0a657b5..141a28b70 100644 --- a/app/widget/timeruler/seekablewidget.cpp +++ b/app/widget/timeruler/seekablewidget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -90,19 +90,21 @@ void SeekableWidget::ConnectTimelinePoints(TimelinePoints *points) void SeekableWidget::DeleteSelected() { - MultiUndoCommand* command = new MultiUndoCommand(); + if (!selection_manager_.IsDragging()) { + MultiUndoCommand* command = new MultiUndoCommand(); - foreach (TimelineMarker *marker, selection_manager_.GetSelectedObjects()) { - command->add_child(new MarkerRemoveCommand(marker)); + foreach (TimelineMarker *marker, selection_manager_.GetSelectedObjects()) { + command->add_child(new MarkerRemoveCommand(marker)); + } + + Core::instance()->undo_stack()->pushIfHasChildren(command); } - - Core::instance()->undo_stack()->pushIfHasChildren(command); } bool SeekableWidget::CopySelected(bool cut) { if (!selection_manager_.GetSelectedObjects().empty()) { - ProjectSerializer::SaveData sdata(Project::GetProjectFromObject(timeline_points_)); + ProjectSerializer::SaveData sdata; sdata.SetOnlySerializeMarkers(selection_manager_.GetSelectedObjects()); ProjectSerializer::Copy(sdata, QStringLiteral("markers")); @@ -117,7 +119,7 @@ bool SeekableWidget::CopySelected(bool cut) } } -bool SeekableWidget::PasteMarkers(bool insert, rational insert_time) +bool SeekableWidget::PasteMarkers() { ProjectSerializer::Result res = ProjectSerializer::Paste(QStringLiteral("markers")); if (res == ProjectSerializer::kSuccess) { @@ -128,29 +130,18 @@ bool SeekableWidget::PasteMarkers(bool insert, rational insert_time) // Normalize markers to start at playhead rational min = RATIONAL_MAX; for (auto it=markers.cbegin(); it!=markers.cend(); it++) { - min = qMin(min, (*it)->time()); + min = std::min(min, (*it)->time().in()); } min -= GetTime(); - // Avoid duplicates - bool loop; - do { - loop = false; - for (auto it=markers.cbegin(); it!=markers.cend(); it++) { - rational proposed_time = (*it)->time() - min; - - if (timeline_points_->markers()->GetMarkerAtTime(proposed_time)) { - min -= timebase(); - loop = true; - break; - } - } - } while (loop); - for (auto it=markers.cbegin(); it!=markers.cend(); it++) { TimelineMarker *m = *it; - m->set_time(m->time() - min); + m->set_time(m->time().in() - min); + + if (TimelineMarker *existing = timeline_points_->markers()->GetMarkerAtTime(m->time().in())) { + command->add_child(new MarkerRemoveCommand(existing)); + } command->add_child(new MarkerAddCommand(timeline_points_->markers(), m)); } @@ -198,7 +189,11 @@ void SeekableWidget::mouseMoveEvent(QMouseEvent *event) } } else if (timeline_points_) { // Look for resize points - setCursor(FindResizeHandle(event) ? Qt::SizeHorCursor : Qt::ArrowCursor); + if (FindResizeHandle(event)) { + setCursor(Qt::SizeHorCursor); + } else { + unsetCursor(); + } } } @@ -344,12 +339,12 @@ void SeekableWidget::DrawTimelinePoints(QPainter* p, int marker_bottom) for (auto it=GetTimelinePoints()->markers()->cbegin(); it!=GetTimelinePoints()->markers()->cend(); it++) { TimelineMarker* marker = *it; - int marker_right = TimeToScene(marker->time_range().out()); + int marker_right = TimeToScene(marker->time().out()); if (marker_right < lim_left) { continue; } - int marker_left = TimeToScene(marker->time_range().in()); + int marker_left = TimeToScene(marker->time().in()); if (marker_left >= lim_right) { break; } @@ -441,16 +436,16 @@ bool SeekableWidget::FindResizeHandle(QMouseEvent *event) // Check for markers for (auto it=timeline_points_->markers()->cbegin(); it!=timeline_points_->markers()->cend(); it++) { TimelineMarker *m = *it; - if (m->time_range().in() != m->time_range().out()) { - if (m->time_range().in() >= min && m->time_range().in() < max) { + if (m->time().in() != m->time().out()) { + if (m->time().in() >= min && m->time().in() < max) { resize_mode_ = kResizeIn; - } else if (m->time_range().out() >= min && m->time_range().out() < max) { + } else if (m->time().out() >= min && m->time().out() < max) { resize_mode_ = kResizeOut; } if (resize_mode_ != kResizeNone) { resize_item_ = m; - resize_item_range_ = m->time_range(); + resize_item_range_ = m->time(); resize_snap_mask_ = TimeBasedWidget::kSnapAll; break; } @@ -519,7 +514,7 @@ void SeekableWidget::CommitResizeHandle() MultiUndoCommand *command = new MultiUndoCommand(); if (TimelineMarker *marker = dynamic_cast(resize_item_)) { - command->add_child(new MarkerChangeTimeCommand(marker, marker->time_range(), resize_item_range_)); + command->add_child(new MarkerChangeTimeCommand(marker, marker->time(), resize_item_range_)); } else if (TimelineWorkArea *workarea = dynamic_cast(resize_item_)) { command->add_child(new WorkareaSetRangeCommand(workarea, workarea->range(), resize_item_range_)); } diff --git a/app/widget/timeruler/seekablewidget.h b/app/widget/timeruler/seekablewidget.h index e151bbc4d..dc28e9dbe 100644 --- a/app/widget/timeruler/seekablewidget.h +++ b/app/widget/timeruler/seekablewidget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -54,7 +54,7 @@ public: bool CopySelected(bool cut); - bool PasteMarkers(bool insert, rational insert_time); + bool PasteMarkers(); void DeselectAllMarkers(); diff --git a/app/widget/timeruler/timeruler.cpp b/app/widget/timeruler/timeruler.cpp index 23b349a6a..1b60a077c 100644 --- a/app/widget/timeruler/timeruler.cpp +++ b/app/widget/timeruler/timeruler.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timeruler/timeruler.h b/app/widget/timeruler/timeruler.h index b6bfc8858..372e0e602 100644 --- a/app/widget/timeruler/timeruler.h +++ b/app/widget/timeruler/timeruler.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timetarget/CMakeLists.txt b/app/widget/timetarget/CMakeLists.txt index b6e2c5288..7cca0f27c 100644 --- a/app/widget/timetarget/CMakeLists.txt +++ b/app/widget/timetarget/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/timetarget/timetarget.cpp b/app/widget/timetarget/timetarget.cpp index bd5e0b88d..8662999e5 100644 --- a/app/widget/timetarget/timetarget.cpp +++ b/app/widget/timetarget/timetarget.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/timetarget/timetarget.h b/app/widget/timetarget/timetarget.h index 9d604fa6c..f1b2aa285 100644 --- a/app/widget/timetarget/timetarget.h +++ b/app/widget/timetarget/timetarget.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/toolbar/CMakeLists.txt b/app/widget/toolbar/CMakeLists.txt index 30f112d4d..6c2b66f66 100644 --- a/app/widget/toolbar/CMakeLists.txt +++ b/app/widget/toolbar/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/toolbar/toolbar.cpp b/app/widget/toolbar/toolbar.cpp index ddce86c7a..900e6532b 100644 --- a/app/widget/toolbar/toolbar.cpp +++ b/app/widget/toolbar/toolbar.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/toolbar/toolbar.h b/app/widget/toolbar/toolbar.h index 16c1989f1..e189e3e1e 100644 --- a/app/widget/toolbar/toolbar.h +++ b/app/widget/toolbar/toolbar.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/toolbar/toolbarbutton.cpp b/app/widget/toolbar/toolbarbutton.cpp index 517396246..ae9767697 100644 --- a/app/widget/toolbar/toolbarbutton.cpp +++ b/app/widget/toolbar/toolbarbutton.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/toolbar/toolbarbutton.h b/app/widget/toolbar/toolbarbutton.h index e71337c16..5245d888b 100644 --- a/app/widget/toolbar/toolbarbutton.h +++ b/app/widget/toolbar/toolbarbutton.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/CMakeLists.txt b/app/widget/viewer/CMakeLists.txt index 074b0f3ef..ca6026619 100644 --- a/app/widget/viewer/CMakeLists.txt +++ b/app/widget/viewer/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/audiowaveformview.cpp b/app/widget/viewer/audiowaveformview.cpp index 59f1dc4f6..92dc7e500 100644 --- a/app/widget/viewer/audiowaveformview.cpp +++ b/app/widget/viewer/audiowaveformview.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/audiowaveformview.h b/app/widget/viewer/audiowaveformview.h index 92f34d80e..970cb07ad 100644 --- a/app/widget/viewer/audiowaveformview.h +++ b/app/widget/viewer/audiowaveformview.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/footageviewer.cpp b/app/widget/viewer/footageviewer.cpp index 90624a2da..9ede7b066 100644 --- a/app/widget/viewer/footageviewer.cpp +++ b/app/widget/viewer/footageviewer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -87,7 +87,7 @@ void FootageViewerWidget::StartFootageDragInternal(bool enable_video, bool enabl if (!streams.isEmpty()) { data_stream << streams << reinterpret_cast(GetConnectedNode()); - mimedata->setData(QStringLiteral("application/x-oliveprojectitemdata"), encoded_data); + mimedata->setData(Project::kItemMimeType, encoded_data); drag->setMimeData(mimedata); drag->exec(); diff --git a/app/widget/viewer/footageviewer.h b/app/widget/viewer/footageviewer.h index fdc8a62ea..e9ef774f3 100644 --- a/app/widget/viewer/footageviewer.h +++ b/app/widget/viewer/footageviewer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/viewer.cpp b/app/widget/viewer/viewer.cpp index 82afc0cc6..f15656272 100644 --- a/app/widget/viewer/viewer.cpp +++ b/app/widget/viewer/viewer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,12 +37,15 @@ #include "common/timecodefunctions.h" #include "config/config.h" #include "core.h" +#include "node/block/gap/gap.h" +#include "node/generator/shape/shapenodebase.h" #include "node/project/project.h" #include "render/rendermanager.h" #include "task/taskmanager.h" #include "viewerpreventsleep.h" #include "widget/menu/menu.h" #include "window/mainwindow/mainwindow.h" +#include "widget/timelinewidget/tool/add.h" #include "widget/timeruler/timeruler.h" namespace olive { @@ -92,7 +95,9 @@ ViewerWidget::ViewerWidget(QWidget *parent) : connect(display_widget_, &ViewerDisplayWidget::DragEntered, this, &ViewerWidget::DragEntered); connect(display_widget_, &ViewerDisplayWidget::Dropped, this, &ViewerWidget::Dropped); connect(display_widget_, &ViewerDisplayWidget::TextureChanged, this, &ViewerWidget::TextureChanged); - connect(display_widget_, &ViewerDisplayWidget::QueueStarved, this, &ViewerWidget::ForceRequeueFromCurrentTime); + connect(display_widget_, &ViewerDisplayWidget::QueueStarved, this, &ViewerWidget::QueueStarved); + connect(display_widget_, &ViewerDisplayWidget::QueueNoLongerStarved, this, &ViewerWidget::QueueNoLongerStarved); + connect(display_widget_, &ViewerDisplayWidget::CreateAddableAt, this, &ViewerWidget::CreateAddableAt); connect(sizer_, &ViewerSizer::RequestScale, display_widget_, &ViewerDisplayWidget::SetMatrixZoom); connect(sizer_, &ViewerSizer::RequestTranslate, display_widget_, &ViewerDisplayWidget::SetMatrixTranslate); connect(display_widget_, &ViewerDisplayWidget::HandDragMoved, sizer_, &ViewerSizer::HandDragMove); @@ -476,6 +481,48 @@ void ViewerWidget::UpdateAudioProcessor() } } +void ViewerWidget::CreateAddableAt(const QRectF &f) +{ + if (Sequence *s = dynamic_cast(GetConnectedNode())) { + Track::Type type = Track::kVideo; + int track_index = -1; + TrackList *list = s->track_list(type); + const rational &in = GetTime(); + rational length = OLIVE_CONFIG("DefaultStillLength").value(); + rational out = in + length; + + // Find a free track where we won't overwrite anything + while (true) { + track_index++; + + if (track_index >= list->GetTrackCount()) { + // Just create a new track + break; + } + + Track *track = list->GetTrackAt(track_index); + if (track->IsLocked()) { + continue; + } + + Block *b = track->NearestBlockBeforeOrAt(in); + if (!b || (dynamic_cast(b) && b->out() >= out)) { + break; + } + } + + MultiUndoCommand *command = new MultiUndoCommand(); + Node *clip = AddTool::CreateAddableClip(command, s, Track::Reference(type, track_index), in, length); + + if (ShapeNodeBase *shape = dynamic_cast(clip)) { + shape->SetRect(f, s->GetVideoParams(), command); + } + + Core::instance()->undo_stack()->pushIfHasChildren(command); + SetGizmos(clip); + } +} + void ViewerWidget::CloseAudioProcessor() { audio_processor_.Close(); @@ -499,7 +546,7 @@ void ViewerWidget::QueueNextAudioBuffer() RenderTicketWatcher *watcher = new RenderTicketWatcher(this); connect(watcher, &RenderTicketWatcher::Finished, this, &ViewerWidget::ReceivedAudioBufferForPlayback); audio_playback_queue_.push_back(watcher); - watcher->SetTicket(auto_cacher_.GetRangeOfAudio(TimeRange(audio_playback_queue_time_, queue_end), true)); + watcher->SetTicket(auto_cacher_.GetRangeOfAudio(TimeRange(audio_playback_queue_time_, queue_end), RenderTicketPriority::kHigh)); audio_playback_queue_time_ = queue_end; } @@ -590,6 +637,24 @@ void ViewerWidget::ReceivedAudioBufferForScrubbing() delete watcher; } +void ViewerWidget::QueueStarved() +{ + static const int kMaximumWaitTime = 250; + qint64 now = QDateTime::currentMSecsSinceEpoch(); + + if (!queue_starved_start_) { + queue_starved_start_ = now; + } else if (now > queue_starved_start_ + kMaximumWaitTime) { + ForceRequeueFromCurrentTime(); + queue_starved_start_ = 0; + } +} + +void ViewerWidget::QueueNoLongerStarved() +{ + queue_starved_start_ = 0; +} + void ViewerWidget::ForceRequeueFromCurrentTime() { ClearVideoAutoCacherQueue(); @@ -629,7 +694,7 @@ void ViewerWidget::UpdateTextureFromNode() ClearVideoAutoCacherQueue(); } - watcher->SetTicket(GetFrame(time, true)); + watcher->SetTicket(GetFrame(time, RenderTicketPriority::kHigh)); } else { // There is definitely no frame here, we can immediately flip to showing nothing nonqueue_watchers_.clear(); @@ -686,6 +751,8 @@ void ViewerWidget::PlayInternal(int speed, bool in_to_out_only) controls_->ShowPauseButton(); + queue_starved_start_ = 0; + // Attempt to fill playback queue if (display_widget_->isVisible() || !windows_.isEmpty()) { prequeue_length_ = DeterminePlaybackQueueSize(); @@ -702,7 +769,7 @@ void ViewerWidget::PlayInternal(int speed, bool in_to_out_only) for (int i=0; iSetTicket(auto_cacher_.GetRangeOfAudio(TimeRange(GetTime(), GetTime() + interval), true)); + watcher->SetTicket(auto_cacher_.GetRangeOfAudio(TimeRange(GetTime(), GetTime() + interval), RenderTicketPriority::kHigh)); } } } @@ -836,7 +903,7 @@ void ViewerWidget::SetDisplayImage(QVariant frame) } } -void ViewerWidget::RequestNextFrameForQueue(bool prioritize, bool increment) +void ViewerWidget::RequestNextFrameForQueue(RenderTicketPriority priority, bool increment) { rational next_time = Timecode::timestamp_to_time(playback_queue_next_frame_, timebase()); @@ -850,17 +917,17 @@ void ViewerWidget::RequestNextFrameForQueue(bool prioritize, bool increment) watcher->setProperty("time", QVariant::fromValue(next_time)); connect(watcher, &RenderTicketWatcher::Finished, this, &ViewerWidget::RendererGeneratedFrameForQueue); queue_watchers_.append(watcher); - watcher->SetTicket(GetFrame(next_time, prioritize)); + watcher->SetTicket(GetFrame(next_time, priority)); } } -RenderTicketPtr ViewerWidget::GetFrame(const rational &t, bool prioritize) +RenderTicketPtr ViewerWidget::GetFrame(const rational &t, RenderTicketPriority priority) { QString cache_fn = GetConnectedNode()->video_frame_cache()->CachePathName(t); if (!QFileInfo::exists(cache_fn)) { // Frame hasn't been cached, start render job - return auto_cacher_.GetSingleFrame(t, prioritize); + return auto_cacher_.GetSingleFrame(t, priority); } else { // Frame has been cached, grab the frame RenderTicketPtr ticket = std::make_shared(); @@ -1508,14 +1575,14 @@ void ViewerWidget::ViewerShiftedRange(const rational &from, const rational &to) void ViewerWidget::DragEntered(QDragEnterEvent* event) { - if (event->mimeData()->formats().contains(QStringLiteral("application/x-oliveprojectitemdata"))) { + if (event->mimeData()->formats().contains(Project::kItemMimeType)) { event->accept(); } } void ViewerWidget::Dropped(QDropEvent *event) { - QByteArray mimedata = event->mimeData()->data(QStringLiteral("application/x-oliveprojectitemdata")); + QByteArray mimedata = event->mimeData()->data(Project::kItemMimeType); QDataStream stream(&mimedata, QIODevice::ReadOnly); // Variables to deserialize into diff --git a/app/widget/viewer/viewer.h b/app/widget/viewer/viewer.h index 273703f60..0eef98bbe 100644 --- a/app/widget/viewer/viewer.h +++ b/app/widget/viewer/viewer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -119,6 +119,11 @@ public slots: void UpdateTextureFromNode(); + void RequestStartEditingText() + { + display_widget_->RequestStartEditingText(); + } + signals: /** * @brief Wrapper for ViewerGLWidget::CursorColor() @@ -185,9 +190,9 @@ private: void SetDisplayImage(QVariant frame); - void RequestNextFrameForQueue(bool prioritize = false, bool increment = true); + void RequestNextFrameForQueue(RenderTicketPriority priority = RenderTicketPriority::kNormal, bool increment = true); - RenderTicketPtr GetFrame(const rational& t, bool prioritize); + RenderTicketPtr GetFrame(const rational& t, RenderTicketPriority priority); void FinishPlayPreprocess(); @@ -269,6 +274,8 @@ private: Track::Reference recording_track_; QString recording_filename_; + qint64 queue_starved_start_; + private slots: void PlaybackTimerUpdate(); @@ -316,10 +323,15 @@ private slots: void ReceivedAudioBufferForScrubbing(); + void QueueStarved(); + void QueueNoLongerStarved(); + void ForceRequeueFromCurrentTime(); void UpdateAudioProcessor(); + void CreateAddableAt(const QRectF &f); + }; } diff --git a/app/widget/viewer/viewerdisplay.cpp b/app/widget/viewer/viewerdisplay.cpp index 2ceb202e3..9fc4eeac4 100644 --- a/app/widget/viewer/viewerdisplay.cpp +++ b/app/widget/viewer/viewerdisplay.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,8 +45,6 @@ #include "node/gizmo/point.h" #include "node/gizmo/polygon.h" #include "node/gizmo/screen.h" -#include "node/gizmo/text.h" -#include "node/traverser.h" #include "viewertexteditor.h" #include "window/mainwindow/mainwindow.h" @@ -68,9 +66,11 @@ ViewerDisplayWidget::ViewerDisplayWidget(QWidget *parent) : show_fps_(false), frames_skipped_(0), show_widget_background_(false), - push_mode_(kPushNull) + push_mode_(kPushNull), + add_band_(nullptr), + queue_starved_(false) { - connect(Core::instance(), &Core::ToolChanged, this, &ViewerDisplayWidget::UpdateCursor); + connect(Core::instance(), &Core::ToolChanged, this, &ViewerDisplayWidget::ToolChanged); connect(this, &ViewerDisplayWidget::InnerWidgetMouseMove, this, &ViewerDisplayWidget::EmitColorAtCursor); @@ -106,6 +106,8 @@ void ViewerDisplayWidget::UpdateCursor() { if (Core::instance()->tool() == Tool::kHand) { setCursor(Qt::OpenHandCursor); + } else if (Core::instance()->tool() == Tool::kAdd) { + setCursor(Qt::CrossCursor); } else { unsetCursor(); } @@ -137,6 +139,11 @@ void ViewerDisplayWidget::SetBlank() update(); } +void ViewerDisplayWidget::ToolChanged() +{ + UpdateCursor(); +} + void ViewerDisplayWidget::SetDeinterlacing(bool e) { deinterlace_ = e; @@ -214,7 +221,7 @@ QPointF ViewerDisplayWidget::TransformViewerSpaceToBufferSpace(const QPointF &po * Inversion will only fail if the viewer has been scaled by 0 in any direction * which I think should never happen. */ - return pos * GenerateGizmoTransform().inverted(); + return pos * GenerateDisplayTransform().inverted(); } void ViewerDisplayWidget::ResetFPSTimer() @@ -236,8 +243,18 @@ void ViewerDisplayWidget::IncrementSkippedFrames() void ViewerDisplayWidget::mousePressEvent(QMouseEvent *event) { - if (event->button() == Qt::LeftButton && gizmos_ - && (current_gizmo_ = TryGizmoPress(gizmo_db_, TransformViewerSpaceToBufferSpace(event->pos())))) { + if (event->button() == Qt::LeftButton && Core::instance()->tool() == Tool::kAdd + && (Core::instance()->GetSelectedAddableObject() == Tool::kAddableShape || Core::instance()->GetSelectedAddableObject() == Tool::kAddableTitle)) { + + add_band_start_ = event->pos(); + + add_band_ = new QRubberBand(QRubberBand::Rectangle, this); + add_band_->setGeometry(QRect(add_band_start_, add_band_start_)); + add_band_->show(); + + } else if (event->button() == Qt::LeftButton && gizmos_ + && (gizmo_last_draw_transform_inverted_ = gizmo_last_draw_transform_.inverted(), + current_gizmo_ = TryGizmoPress(gizmo_db_, gizmo_last_draw_transform_inverted_.map(event->pos())))) { // Handle gizmo click gizmo_start_drag_ = event->pos(); @@ -275,12 +292,16 @@ void ViewerDisplayWidget::mouseMoveEvent(QMouseEvent *event) hand_last_drag_pos_ = event->pos(); + } else if (add_band_) { + + add_band_->setGeometry(QRect(event->pos(), add_band_start_).normalized()); + } else if (current_gizmo_) { // Signal movement if (DraggableGizmo *draggable = dynamic_cast(current_gizmo_)) { if (!gizmo_drag_started_) { - QPointF start = TransformViewerSpaceToBufferSpace(gizmo_start_drag_); + QPointF start = gizmo_start_drag_ * gizmo_last_draw_transform_inverted_; rational gizmo_time = GetGizmoTime(); NodeTraverser t; @@ -291,17 +312,17 @@ void ViewerDisplayWidget::mouseMoveEvent(QMouseEvent *event) gizmo_drag_started_ = true; } - QPointF v = TransformViewerSpaceToBufferSpace(event->pos()); + QPointF v = event->pos() * gizmo_last_draw_transform_inverted_; switch (draggable->GetDragValueBehavior()) { case DraggableGizmo::kAbsolute: // Above value is correct break; case DraggableGizmo::kDeltaFromPrevious: - v -= TransformViewerSpaceToBufferSpace(gizmo_last_drag_); + v -= gizmo_last_drag_ * gizmo_last_draw_transform_inverted_; gizmo_last_drag_ = event->pos(); break; case DraggableGizmo::kDeltaFromStart: - v -= TransformViewerSpaceToBufferSpace(gizmo_start_drag_); + v -= gizmo_start_drag_ * gizmo_last_draw_transform_inverted_; break; } @@ -325,6 +346,17 @@ void ViewerDisplayWidget::mouseReleaseEvent(QMouseEvent *event) hand_dragging_ = false; UpdateCursor(); + } else if (add_band_) { + + const QRect &band_rect = add_band_->geometry(); + if (band_rect.width() > 1 && band_rect.height() > 1) { + QRectF r = GenerateDisplayTransform().inverted().mapRect(add_band_->geometry()); + emit CreateAddableAt(r); + } + + add_band_->deleteLater(); + add_band_ = nullptr; + } else if (current_gizmo_) { // Handle gizmo @@ -353,53 +385,7 @@ void ViewerDisplayWidget::mouseDoubleClickEvent(QMouseEvent *event) foreach (NodeGizmo *g, gizmos_->GetGizmos()) { if (TextGizmo *text = dynamic_cast(g)) { if (text->GetRect().contains(ptr)) { - QTransform gizmo_transform = GenerateGizmoTransform(); - - ViewerTextEditor *text_edit = new ViewerTextEditor(gizmo_transform.m11(), this); - Html::HtmlToDoc(text_edit->document(), text->GetHtml()); - text_edit->setProperty("gizmo", reinterpret_cast(text)); - - QRectF transformed_geom = gizmo_transform.map(text->GetRect()).boundingRect(); - text_edit->setGeometry(transformed_geom.toRect()); - - ViewerTextEditorToolBar *toolbar = new ViewerTextEditorToolBar(this); - - QPoint pos = mapToGlobal(QPoint(transformed_geom.x(), transformed_geom.y() - toolbar->height())); - for (QScreen *screen : qApp->screens()) { - if (screen->geometry().contains(pos)) { - if (pos.x() + toolbar->width() > screen->geometry().right()) { - pos.setX(screen->geometry().right() - toolbar->width()); - } - break; - } - } - toolbar->move(pos); - toolbar->show(); - - text_edit->show(); - - connect(text_edit, &ViewerTextEditor::textChanged, this, &ViewerDisplayWidget::TextEditChanged); - - text_edit->ConnectToolBar(toolbar); - - QPoint text_edit_pos = text_edit->mapFrom(this, event->pos()); - - // Ensure text edit is actually focused rather than the toolbar - connect(toolbar, &ViewerTextEditorToolBar::FirstPaint, this, [this, text_edit, text_edit_pos]{ - // Grab focus back from the toolbar - this->raise(); - this->activateWindow(); - text_edit->setFocus(); - - // Start text cursor where the user clicked - text_edit->setTextCursor(text_edit->cursorForPosition(text_edit_pos)); - - // HACK: On macOS, for some reason the QDockWidget receives focus before the - // ViewerTextEditor, causing the editor to close prematurely. However this only - // happens the first time the editor receives focus and not subsequent times, so - // if we get it to only listen after the first one, this solves the problem. - text_edit->SetListenToFocusEvents(true); - }); + OpenTextGizmo(text, event); break; } } @@ -525,7 +511,8 @@ void ViewerDisplayWidget::OnPaint() gizmo_db_ = gt.GenerateRow(gizmos_, range); QPainter p(inner_widget()); - p.setWorldTransform(GenerateGizmoTransform()); + gizmo_last_draw_transform_ = GenerateGizmoTransform(gt, range); + p.setWorldTransform(gizmo_last_draw_transform_); gizmos_->UpdateGizmoPositions(gizmo_db_, NodeTraverser::GenerateGlobals(gizmo_params_, range)); foreach (NodeGizmo *gizmo, gizmos_->GetGizmos()) { @@ -737,7 +724,7 @@ QTransform ViewerDisplayWidget::GenerateWorldTransform() return world; } -QTransform ViewerDisplayWidget::GenerateGizmoTransform() +QTransform ViewerDisplayWidget::GenerateDisplayTransform() { QVector2D viewer_scale(GetTexturePosition(size())); QTransform gizmo_transform = GenerateWorldTransform(); @@ -746,13 +733,39 @@ QTransform ViewerDisplayWidget::GenerateGizmoTransform() return gizmo_transform; } +QTransform ViewerDisplayWidget::GenerateGizmoTransform(NodeTraverser >, const TimeRange &range) +{ + QTransform t = GenerateDisplayTransform(); + if (GetTimeTarget()) { + Node *target = GetTimeTarget(); + if (ViewerOutput *v = dynamic_cast(target)) { + if (Node *n = v->GetConnectedTextureOutput()) { + target = n; + } + } + + QTransform nt; + gt.Transform(&nt, gizmos_, target, range); + + t.translate(gizmo_params_.width()*0.5, gizmo_params_.height()*0.5); + t.scale(gizmo_params_.width(), gizmo_params_.height()); + + t = nt * t; + + t.scale(1.0 / gizmo_params_.width(), 1.0 / gizmo_params_.height()); + t.translate(-gizmo_params_.width()*0.5, -gizmo_params_.height()*0.5); + } + + return t; +} + NodeGizmo *ViewerDisplayWidget::TryGizmoPress(const NodeValueRow &row, const QPointF &p) { for (auto it=gizmos_->GetGizmos().crbegin(); it!=gizmos_->GetGizmos().crend(); it++) { NodeGizmo *gizmo = *it; if (gizmo->IsVisible()) { if (PointGizmo *point = dynamic_cast(gizmo)) { - if (point->GetClickingRect(GenerateGizmoTransform()).contains(p)) { + if (point->GetClickingRect(gizmo_last_draw_transform_).contains(p)) { return point; } } else if (PolygonGizmo *poly = dynamic_cast(gizmo)) { @@ -773,6 +786,62 @@ NodeGizmo *ViewerDisplayWidget::TryGizmoPress(const NodeValueRow &row, const QPo return nullptr; } +void ViewerDisplayWidget::OpenTextGizmo(TextGizmo *text, QMouseEvent *event) +{ + QTransform gizmo_transform = GenerateDisplayTransform(); + + ViewerTextEditor *text_edit = new ViewerTextEditor(gizmo_transform.m11(), this); + Html::HtmlToDoc(text_edit->document(), text->GetHtml()); + text_edit->setProperty("gizmo", reinterpret_cast(text)); + + QRectF transformed_geom = gizmo_transform.map(text->GetRect()).boundingRect(); + text_edit->setGeometry(transformed_geom.toRect()); + + ViewerTextEditorToolBar *toolbar = new ViewerTextEditorToolBar(this); + + QPoint pos = mapToGlobal(QPoint(transformed_geom.x(), transformed_geom.y() - toolbar->height())); + for (QScreen *screen : qApp->screens()) { + if (screen->geometry().contains(pos)) { + if (pos.x() + toolbar->width() > screen->geometry().right()) { + pos.setX(screen->geometry().right() - toolbar->width()); + } + break; + } + } + toolbar->move(pos); + toolbar->show(); + + text_edit->show(); + + connect(text_edit, &ViewerTextEditor::textChanged, this, &ViewerDisplayWidget::TextEditChanged); + + text_edit->ConnectToolBar(toolbar); + + QPoint text_edit_pos; + if (event) { + text_edit_pos = text_edit->mapFrom(this, event->pos()); + } + + // Ensure text edit is actually focused rather than the toolbar + connect(toolbar, &ViewerTextEditorToolBar::FirstPaint, this, [this, text_edit, text_edit_pos]{ + // Grab focus back from the toolbar + this->raise(); + this->activateWindow(); + text_edit->setFocus(); + + // Start text cursor where the user clicked + if (!text_edit_pos.isNull()) { + text_edit->setTextCursor(text_edit->cursorForPosition(text_edit_pos)); + } + + // HACK: On macOS, for some reason the QDockWidget receives focus before the + // ViewerTextEditor, causing the editor to close prematurely. However this only + // happens the first time the editor receives focus and not subsequent times, so + // if we get it to only listen after the first one, this solves the problem. + text_edit->SetListenToFocusEvents(true); + }); +} + void ViewerDisplayWidget::EmitColorAtCursor(QMouseEvent *e) { // Do this no matter what, emits signal to any pixel samplers @@ -780,7 +849,7 @@ void ViewerDisplayWidget::EmitColorAtCursor(QMouseEvent *e) Color reference, display; if (texture_) { - QPointF pixel_pos = GenerateGizmoTransform().inverted().map(e->pos()); + QPointF pixel_pos = GenerateDisplayTransform().inverted().map(e->pos()); pixel_pos /= texture_->params().divider(); reference = renderer()->GetPixelFromTexture(texture_.get(), pixel_pos); @@ -798,6 +867,18 @@ void ViewerDisplayWidget::SetShowFPS(bool e) update(); } +void ViewerDisplayWidget::RequestStartEditingText() +{ + if (gizmos_) { + foreach (NodeGizmo *gizmo, gizmos_->GetGizmos()) { + if (TextGizmo *text = dynamic_cast(gizmo)) { + OpenTextGizmo(text); + break; + } + } + } +} + void ViewerDisplayWidget::Play(const int64_t &start_timestamp, const int &playback_speed, const rational &timebase) { playback_timebase_ = timebase; @@ -814,6 +895,7 @@ void ViewerDisplayWidget::Pause() disconnect(this, &ViewerDisplayWidget::frameSwapped, this, &ViewerDisplayWidget::UpdateFromQueue); queue_.clear(); + queue_starved_ = false; } void ViewerDisplayWidget::UpdateFromQueue() @@ -825,6 +907,7 @@ void ViewerDisplayWidget::UpdateFromQueue() bool popped = false; if (queue_.empty()) { + queue_starved_ = true; emit QueueStarved(); } else { while (!queue_.empty()) { @@ -834,6 +917,11 @@ void ViewerDisplayWidget::UpdateFromQueue() // Frame was in queue, no need to decode anything SetImage(pf.frame); + + if (queue_starved_) { + queue_starved_ = false; + emit QueueNoLongerStarved(); + } return; } else if (pf.timestamp > time) { @@ -856,6 +944,7 @@ void ViewerDisplayWidget::UpdateFromQueue() } if (queue_.empty()) { + queue_starved_ = true; emit QueueStarved(); break; } diff --git a/app/widget/viewer/viewerdisplay.h b/app/widget/viewer/viewerdisplay.h index 1ccc5b3d1..adb51e682 100644 --- a/app/widget/viewer/viewerdisplay.h +++ b/app/widget/viewer/viewerdisplay.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,12 +21,15 @@ #ifndef VIEWERGLWIDGET_H #define VIEWERGLWIDGET_H -#include #include +#include +#include #include "node/color/colormanager/colormanager.h" +#include "node/gizmo/text.h" #include "node/node.h" #include "node/output/track/tracklist.h" +#include "node/traverser.h" #include "render/color.h" #include "tool/tool.h" #include "viewerplaybacktimer.h" @@ -162,6 +165,8 @@ public slots: */ void UpdateCursor(); + void ToolChanged(); + /** * @brief Enables/disables a basic deinterlace on the viewer */ @@ -169,6 +174,8 @@ public slots: void SetShowFPS(bool e); + void RequestStartEditingText(); + signals: /** * @brief Signal emitted when the user starts dragging from the viewer @@ -205,6 +212,10 @@ signals: void QueueStarved(); + void QueueNoLongerStarved(); + + void CreateAddableAt(const QRectF &rect); + protected: /** * @brief Override the mouse press event for the DragStarted() signal and gizmos @@ -254,7 +265,9 @@ private: QTransform GenerateWorldTransform(); - QTransform GenerateGizmoTransform(); + QTransform GenerateDisplayTransform(); + + QTransform GenerateGizmoTransform(NodeTraverser >, const TimeRange &range); TimeRange GenerateGizmoTime() { @@ -264,6 +277,8 @@ private: NodeGizmo *TryGizmoPress(const NodeValueRow &row, const QPointF &p); + void OpenTextGizmo(TextGizmo *text, QMouseEvent *event = nullptr); + /** * @brief Internal reference to the OpenGL texture to draw. Set in SetTexture() and used in paintGL(). */ @@ -316,6 +331,8 @@ private: QPoint gizmo_last_drag_; NodeGizmo *current_gizmo_; bool gizmo_drag_started_; + QTransform gizmo_last_draw_transform_; + QTransform gizmo_last_draw_transform_inverted_; bool show_subtitles_; Sequence *subtitle_tracks_; @@ -366,6 +383,11 @@ private: rational playback_timebase_; + QRubberBand *add_band_; + QPoint add_band_start_; + + bool queue_starved_; + private slots: void EmitColorAtCursor(QMouseEvent* e); @@ -375,6 +397,7 @@ private slots: void SubtitlesChanged(const TimeRange &r); + }; } diff --git a/app/widget/viewer/viewerplaybacktimer.cpp b/app/widget/viewer/viewerplaybacktimer.cpp index 03452c3b8..09e254a1f 100644 --- a/app/widget/viewer/viewerplaybacktimer.cpp +++ b/app/widget/viewer/viewerplaybacktimer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/viewerplaybacktimer.h b/app/widget/viewer/viewerplaybacktimer.h index 98000d4f9..8878f70bf 100644 --- a/app/widget/viewer/viewerplaybacktimer.h +++ b/app/widget/viewer/viewerplaybacktimer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/viewerqueue.h b/app/widget/viewer/viewerqueue.h index e97d213b7..3ad2c0b36 100644 --- a/app/widget/viewer/viewerqueue.h +++ b/app/widget/viewer/viewerqueue.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/viewersafemargininfo.h b/app/widget/viewer/viewersafemargininfo.h index 87b215bda..fa6dfba95 100644 --- a/app/widget/viewer/viewersafemargininfo.h +++ b/app/widget/viewer/viewersafemargininfo.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/viewersizer.cpp b/app/widget/viewer/viewersizer.cpp index d0136a62c..7041da533 100644 --- a/app/widget/viewer/viewersizer.cpp +++ b/app/widget/viewer/viewersizer.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/viewersizer.h b/app/widget/viewer/viewersizer.h index 51390885f..7acb76965 100644 --- a/app/widget/viewer/viewersizer.h +++ b/app/widget/viewer/viewersizer.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/viewertexteditor.cpp b/app/widget/viewer/viewertexteditor.cpp index cdcc769ee..76fd94037 100644 --- a/app/widget/viewer/viewertexteditor.cpp +++ b/app/widget/viewer/viewertexteditor.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -64,6 +64,8 @@ ViewerTextEditor::ViewerTextEditor(double scale, QWidget *parent) : connect(qApp, &QApplication::focusChanged, this, &ViewerTextEditor::FocusChanged); connect(this, &QTextEdit::currentCharFormatChanged, this, &ViewerTextEditor::FormatChanged); connect(document(), &QTextDocument::contentsChanged, this, &ViewerTextEditor::DocumentChanged, Qt::QueuedConnection); + + setAcceptRichText(false); } void ViewerTextEditor::ConnectToolBar(ViewerTextEditorToolBar *toolbar) diff --git a/app/widget/viewer/viewertexteditor.h b/app/widget/viewer/viewertexteditor.h index d1faae7be..8df6a5285 100644 --- a/app/widget/viewer/viewertexteditor.h +++ b/app/widget/viewer/viewertexteditor.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/viewerwindow.cpp b/app/widget/viewer/viewerwindow.cpp index 1d9c00460..be582b139 100644 --- a/app/widget/viewer/viewerwindow.cpp +++ b/app/widget/viewer/viewerwindow.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/widget/viewer/viewerwindow.h b/app/widget/viewer/viewerwindow.h index 0810cb1e2..b59d5dc1d 100644 --- a/app/widget/viewer/viewerwindow.h +++ b/app/widget/viewer/viewerwindow.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/window/CMakeLists.txt b/app/window/CMakeLists.txt index eb933f119..5bfd0695e 100644 --- a/app/window/CMakeLists.txt +++ b/app/window/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/window/mainwindow/CMakeLists.txt b/app/window/mainwindow/CMakeLists.txt index 46f351483..f9bade703 100644 --- a/app/window/mainwindow/CMakeLists.txt +++ b/app/window/mainwindow/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/app/window/mainwindow/mainmenu.cpp b/app/window/mainwindow/mainmenu.cpp index dec12a79e..fd8123371 100644 --- a/app/window/mainwindow/mainmenu.cpp +++ b/app/window/mainwindow/mainmenu.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/window/mainwindow/mainmenu.h b/app/window/mainwindow/mainmenu.h index ba5740f0b..a4dc36b81 100644 --- a/app/window/mainwindow/mainmenu.h +++ b/app/window/mainwindow/mainmenu.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/window/mainwindow/mainstatusbar.cpp b/app/window/mainwindow/mainstatusbar.cpp index 47715c0bb..281b2c426 100644 --- a/app/window/mainwindow/mainstatusbar.cpp +++ b/app/window/mainwindow/mainstatusbar.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/window/mainwindow/mainstatusbar.h b/app/window/mainwindow/mainstatusbar.h index a9e5e5667..9946005cc 100644 --- a/app/window/mainwindow/mainstatusbar.h +++ b/app/window/mainwindow/mainstatusbar.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/window/mainwindow/mainwindow.cpp b/app/window/mainwindow/mainwindow.cpp index 1bf868ffd..176575e40 100644 --- a/app/window/mainwindow/mainwindow.cpp +++ b/app/window/mainwindow/mainwindow.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -96,6 +96,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(node_panel_, &NodePanel::NodeGroupOpened, this, &MainWindow::NodePanelGroupOpenedOrClosed); connect(node_panel_, &NodePanel::NodeGroupClosed, this, &MainWindow::NodePanelGroupOpenedOrClosed); connect(param_panel_, &ParamPanel::FocusedNodeChanged, sequence_viewer_panel_, &ViewerPanel::SetGizmos); + connect(param_panel_, &ParamPanel::RequestViewerToStartEditingText, sequence_viewer_panel_, &ViewerPanel::RequestStartEditingText); connect(param_panel_, &ParamPanel::FocusedNodeChanged, curve_panel_, &CurvePanel::SetNode); connect(param_panel_, &ParamPanel::SelectedNodesChanged, node_panel_, &NodePanel::Select); diff --git a/app/window/mainwindow/mainwindow.h b/app/window/mainwindow/mainwindow.h index 364d3f7a7..53d6bb6c0 100644 --- a/app/window/mainwindow/mainwindow.h +++ b/app/window/mainwindow/mainwindow.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/window/mainwindow/mainwindowundo.cpp b/app/window/mainwindow/mainwindowundo.cpp index 2dbea18d4..05646f69f 100644 --- a/app/window/mainwindow/mainwindowundo.cpp +++ b/app/window/mainwindow/mainwindowundo.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/app/window/mainwindow/mainwindowundo.h b/app/window/mainwindow/mainwindowundo.h index 51bc52c64..cc54cc6e7 100644 --- a/app/window/mainwindow/mainwindowundo.h +++ b/app/window/mainwindow/mainwindowundo.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/cmake/FindGoogleCrashpad.cmake b/cmake/FindGoogleCrashpad.cmake index 887bd0dfe..ea19b9eee 100644 --- a/cmake/FindGoogleCrashpad.cmake +++ b/cmake/FindGoogleCrashpad.cmake @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/cmake/FindOpenColorIO.cmake b/cmake/FindOpenColorIO.cmake index ae2526f50..e9f5fb143 100644 --- a/cmake/FindOpenColorIO.cmake +++ b/cmake/FindOpenColorIO.cmake @@ -1,6 +1,6 @@ # # Copyright 2019 Pixar -# Modifications: Copyright (C) 2021 Olive Team +# Modifications: Copyright (C) 2022 Olive Team # # Licensed under the Apache License, Version 2.0 (the "Apache License") # with the following modification; you may not use this file except in diff --git a/cmake/FindOpenTimelineIO.cmake b/cmake/FindOpenTimelineIO.cmake index 595e6f8ec..947585baa 100644 --- a/cmake/FindOpenTimelineIO.cmake +++ b/cmake/FindOpenTimelineIO.cmake @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/cmake/Sanitizers.cmake b/cmake/Sanitizers.cmake new file mode 100644 index 000000000..f6d658cf0 --- /dev/null +++ b/cmake/Sanitizers.cmake @@ -0,0 +1,58 @@ +function(enable_sanitizers project_name) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(SANITIZERS "") + + option(ENABLE_SANITIZER_ADDRESS "Enable address sanitizer" OFF) + if(ENABLE_SANITIZER_ADDRESS) + list(APPEND SANITIZERS "address") + endif() + + option(ENABLE_SANITIZER_LEAK "Enable leak sanitizer" OFF) + if(ENABLE_SANITIZER_LEAK) + list(APPEND SANITIZERS "leak") + endif() + + option(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR "Enable undefined behavior sanitizer" OFF) + if(ENABLE_SANITIZER_UNDEFINED_BEHAVIOR) + list(APPEND SANITIZERS "undefined") + endif() + + option(ENABLE_SANITIZER_THREAD "Enable thread sanitizer" OFF) + if(ENABLE_SANITIZER_THREAD) + if("address" IN_LIST SANITIZERS OR "leak" IN_LIST SANITIZERS) + message(WARNING "Thread sanitizer does not work with Address and Leak sanitizer enabled") + else() + list(APPEND SANITIZERS "thread") + endif() + endif() + + option(ENABLE_SANITIZER_MEMORY "Enable memory sanitizer" OFF) + if(ENABLE_SANITIZER_MEMORY AND CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + message(WARNING "Memory sanitizer requires all the code (including libc++) to be MSan-instrumented otherwise it reports false positives") + if("address" IN_LIST SANITIZERS + OR "thread" IN_LIST SANITIZERS + OR "leak" IN_LIST SANITIZERS) + message(WARNING "Memory sanitizer does not work with Address, Thread and Leak sanitizer enabled") + else() + list(APPEND SANITIZERS "memory") + endif() + endif() + + list(JOIN SANITIZERS "," LIST_OF_SANITIZERS) + endif() + + if(LIST_OF_SANITIZERS) + set(SANITIZE_PREFIX "") + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(SANITIZE_PREFIX "/fsanitize") + else() + set(SANITIZE_PREFIX "-fsanitize") + endif() + + if(NOT "${LIST_OF_SANITIZERS}" STREQUAL "") + target_compile_options(${project_name} INTERFACE ${SANITIZE_PREFIX}=${LIST_OF_SANITIZERS}) + target_link_options(${project_name} INTERFACE ${SANITIZE_PREFIX}=${LIST_OF_SANITIZERS}) + endif() + endif() + +endfunction() diff --git a/docker/README.md b/docker/README.md index c5a824194..fa0c08423 100644 --- a/docker/README.md +++ b/docker/README.md @@ -27,14 +27,14 @@ docker pull olivevideoeditor/ci-package-otio:0.14.1 docker pull olivevideoeditor/ci-package-crashpad docker pull olivevideoeditor/ci-package-ffmpeg:5.0 docker pull olivevideoeditor/ci-package-ocio:2022-2.1.1 -docker pull olivevideoeditor/ci-olive:2022.1 +docker pull olivevideoeditor/ci-olive:2022.2 ``` Use `ci-olive` image as local build container, by mounting working copy at `~/olive` into guest system at `/opt/olive/olive`: ```bash -docker run --rm -it -v ~/olive:/opt/olive/olive olivevideoeditor/ci-olive:2022.1 +docker run --rm -it -v ~/olive:/opt/olive/olive olivevideoeditor/ci-olive:2022.2 mkdir build cd build cmake .. -G Ninja @@ -50,11 +50,11 @@ docker build -t olivevideoeditor/ci-package-otio:0.14.1 -f ci-otio/Dockerfile . docker build -t olivevideoeditor/ci-package-crashpad -f ci-crashpad/Dockerfile . docker build -t olivevideoeditor/ci-package-ffmpeg:5.0 -f ci-ffmpeg/Dockerfile . docker build -t olivevideoeditor/ci-package-ocio:2022-2.1.1 -f ci-ocio/Dockerfile . -docker build -t olivevideoeditor/ci-olive:2022.1 -f ci-olive/Dockerfile . +docker build -t olivevideoeditor/ci-olive:2022.2 -f ci-olive/Dockerfile . ``` -Note that `2022` in `ci-olive:2022.1` stands for the -[VFX Reference Platform](http://vfxplatform.com/) calendar year and `1` for the +Note that `2022` in `ci-olive:2022.2` stands for the +[VFX Reference Platform](http://vfxplatform.com/) calendar year and `2` for the build image revision (should be incremented each time a new image is published). Publish images: @@ -65,5 +65,5 @@ docker push olivevideoeditor/ci-package-otio:0.14.1 docker push olivevideoeditor/ci-package-crashpad docker push olivevideoeditor/ci-package-ffmpeg:5.0 docker push olivevideoeditor/ci-package-ocio:2022-2.1.1 -docker push olivevideoeditor/ci-olive:2022.1 +docker push olivevideoeditor/ci-olive:2022.2 ``` diff --git a/docker/ci-olive/Dockerfile b/docker/ci-olive/Dockerfile index b4fb4ac11..fab98dfc0 100644 --- a/docker/ci-olive/Dockerfile +++ b/docker/ci-olive/Dockerfile @@ -2,7 +2,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later # Build image (default): -# docker build -t olivevideoeditor/ci-olive:2022.1 -f ci-olive/Dockerfile . +# docker build -t olivevideoeditor/ci-olive:2022.2 -f ci-olive/Dockerfile . # # .n is the build image revision number. It should be incremented each time a # new image is published (also update the GitHub Actions workflow!). diff --git a/docker/ci-otio/Dockerfile b/docker/ci-otio/Dockerfile index 1c2bdc94f..794b5797d 100644 --- a/docker/ci-otio/Dockerfile +++ b/docker/ci-otio/Dockerfile @@ -9,6 +9,7 @@ ARG ASWF_PKG_ORG=aswftesting ARG CI_COMMON_VERSION=2 ARG VFXPLATFORM_VERSION=2022 ARG OTIO_VERSION=v0.14.1 +ARG CXX_STANDARD=17 # We are currently not interested in the Python implementation and bindings #FROM ${ASWF_PKG_ORG}/ci-package-python:${VFXPLATFORM_VERSION} as ci-package-python @@ -20,6 +21,7 @@ FROM ${OLIVE_ORG}/ci-common:${CI_COMMON_VERSION} as ci-otio ARG OLIVE_ORG ARG VFXPLATFORM_VERSION ARG OTIO_VERSION +ARG CXX_STANDARD ARG PYTHON_VERSION=3.9 LABEL maintainer="olivevideoeditor@gmail.com" @@ -36,6 +38,7 @@ ENV OLIVE_ORG=${OLIVE_ORG} \ CI_COMMON_VERSION=${CI_COMMON_VERSION} \ VFXPLATFORM_VERSION=${VFXPLATFORM_VERSION} \ OTIO_VERSION=${OTIO_VERSION} \ + CXX_STANDARD=${CXX_STANDARD} \ OLIVE_INSTALL_PREFIX=/usr/local # PYTHONPATH=/usr/local/lib/python${PYTHON_VERSION}/site-packages:/usr/local/lib/python \ diff --git a/docker/scripts/build_otio.sh b/docker/scripts/build_otio.sh index b232e35ab..56743a411 100644 --- a/docker/scripts/build_otio.sh +++ b/docker/scripts/build_otio.sh @@ -13,6 +13,7 @@ mkdir build cd build cmake .. -G "Ninja" \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_CXX_STANDARD="${CXX_STANDARD}" \ -DCMAKE_INSTALL_PREFIX="${OLIVE_INSTALL_PREFIX}" \ -DOTIO_PYTHON_INSTALL=OFF cmake --build . diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ebb43723e..3dbbd2ccd 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/tests/compositing/CMakeLists.txt b/tests/compositing/CMakeLists.txt index b0be21aaf..2dbef7f6b 100644 --- a/tests/compositing/CMakeLists.txt +++ b/tests/compositing/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/tests/compositing/compositing-tests.cpp b/tests/compositing/compositing-tests.cpp index 9a326c550..b0eefbd23 100644 --- a/tests/compositing/compositing-tests.cpp +++ b/tests/compositing/compositing-tests.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/general/CMakeLists.txt b/tests/general/CMakeLists.txt index 7f87c6302..537608f97 100644 --- a/tests/general/CMakeLists.txt +++ b/tests/general/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/tests/general/common-tests.cpp b/tests/general/common-tests.cpp index be3414dab..9938b7c31 100644 --- a/tests/general/common-tests.cpp +++ b/tests/general/common-tests.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/general/rational-tests.cpp b/tests/general/rational-tests.cpp index 8e9de8122..0728a5112 100644 --- a/tests/general/rational-tests.cpp +++ b/tests/general/rational-tests.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/general/timerange-tests.cpp b/tests/general/timerange-tests.cpp index b35d70102..fe4d117fa 100644 --- a/tests/general/timerange-tests.cpp +++ b/tests/general/timerange-tests.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/testutil.h b/tests/testutil.h index 697c3002a..9cdc54ddb 100644 --- a/tests/testutil.h +++ b/tests/testutil.h @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/tests/timeline/CMakeLists.txt b/tests/timeline/CMakeLists.txt index 7892dcd54..8f13c1a59 100644 --- a/tests/timeline/CMakeLists.txt +++ b/tests/timeline/CMakeLists.txt @@ -1,5 +1,5 @@ # Olive - Non-Linear Video Editor -# Copyright (C) 2021 Olive Team +# Copyright (C) 2022 Olive Team # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/tests/timeline/timeline-tests.cpp b/tests/timeline/timeline-tests.cpp index 9b3186c7d..034349e57 100644 --- a/tests/timeline/timeline-tests.cpp +++ b/tests/timeline/timeline-tests.cpp @@ -1,7 +1,7 @@ /*** Olive - Non-Linear Video Editor - Copyright (C) 2021 Olive Team + Copyright (C) 2022 Olive Team This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/update-copyright.sh b/update-copyright.sh new file mode 100644 index 000000000..3ccef1fc2 --- /dev/null +++ b/update-copyright.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +if [ "$#" -ne 2 ] +then + echo "Usage: $0 [old-year] [new-year]" + exit 1 +fi + +find . -type f -exec sed -i "s/$1 Olive Team/$2 Olive Team/g" {} \;