From 1cd5dabc075ce2c91f41ac12ec493724612fe785 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Wed, 13 Mar 2019 16:55:49 +1100 Subject: [PATCH] file/folder restructuring --- dialogs/advancedvideodialog.h | 2 +- dialogs/clippropertiesdialog.cpp | 18 +- dialogs/clippropertiesdialog.h | 2 +- dialogs/exportdialog.cpp | 6 +- dialogs/exportdialog.h | 4 +- dialogs/loaddialog.cpp | 4 +- dialogs/loaddialog.h | 2 +- dialogs/mediapropertiesdialog.cpp | 2 +- dialogs/newsequencedialog.cpp | 6 +- dialogs/newsequencedialog.h | 2 +- dialogs/preferencesdialog.cpp | 8 +- dialogs/proxydialog.cpp | 4 +- dialogs/replaceclipmediadialog.cpp | 136 ++++----- dialogs/speeddialog.cpp | 48 ++-- dialogs/speeddialog.h | 2 +- dialogs/speeddialog.ui | 107 ------- effects/README | 1 - {project => effects}/effect.cpp | 18 +- {project => effects}/effect.h | 0 .../effectfields => effects}/effectfield.cpp | 95 +++--- .../effectfields => effects}/effectfield.h | 5 +- effects/effectfields.h | 14 + {project => effects}/effectgizmo.cpp | 0 {project => effects}/effectgizmo.h | 0 effects/effectloaders.cpp | 271 ++++++++++++++++++ {project => effects}/effectloaders.h | 0 {project => effects}/effectrow.cpp | 6 +- {project => effects}/effectrow.h | 0 .../fields}/boolfield.cpp | 14 + .../fields}/boolfield.h | 3 +- .../fields}/buttonfield.cpp | 0 .../fields}/buttonfield.h | 2 +- .../fields}/colorfield.cpp | 0 .../fields}/colorfield.h | 2 +- .../fields}/combofield.cpp | 0 .../fields}/combofield.h | 2 +- .../fields}/doublefield.cpp | 19 +- .../fields}/doublefield.h | 3 +- .../fields}/filefield.cpp | 0 .../fields}/filefield.h | 2 +- .../fields}/fontfield.cpp | 0 .../fields}/fontfield.h | 2 +- .../fields}/labelfield.cpp | 0 .../fields}/labelfield.h | 2 +- .../fields}/stringfield.cpp | 2 +- .../fields}/stringfield.h | 2 +- effects/internal/audionoiseeffect.h | 2 +- effects/internal/cornerpineffect.cpp | 6 +- effects/internal/cornerpineffect.h | 2 +- effects/internal/crossdissolvetransition.h | 2 +- effects/internal/cubetransition.h | 2 +- effects/internal/exponentialfadetransition.h | 4 +- effects/internal/fillleftrighteffect.h | 2 +- effects/internal/frei0reffect.cpp | 2 +- effects/internal/frei0reffect.h | 29 +- effects/internal/linearfadetransition.h | 4 +- effects/internal/logarithmicfadetransition.h | 4 +- effects/internal/paneffect.h | 2 +- effects/internal/shakeeffect.cpp | 7 +- effects/internal/shakeeffect.h | 2 +- effects/internal/solideffect.cpp | 4 +- effects/internal/solideffect.h | 2 +- effects/internal/texteffect.cpp | 6 +- effects/internal/texteffect.h | 2 +- effects/internal/timecodeeffect.cpp | 6 +- effects/internal/timecodeeffect.h | 2 +- effects/internal/toneeffect.cpp | 5 +- effects/internal/toneeffect.h | 2 +- effects/internal/transformeffect.cpp | 8 +- effects/internal/transformeffect.h | 2 +- effects/internal/voideffect.cpp | 2 +- effects/internal/voideffect.h | 2 +- effects/internal/volumeeffect.cpp | 2 +- effects/internal/volumeeffect.h | 2 +- effects/internal/vsthost.cpp | 4 +- effects/internal/vsthost.h | 4 +- {project => effects}/keyframe.cpp | 5 +- {project => effects}/keyframe.h | 18 +- effects/{ => shaders}/boxblur.frag | 0 effects/{ => shaders}/boxblur.xml | 0 effects/{ => shaders}/bulge.frag | 0 effects/{ => shaders}/bulge.xml | 0 effects/{ => shaders}/chromakey.frag | 0 effects/{ => shaders}/chromakey.xml | 0 .../{ => shaders}/chromaticaberration.frag | 0 effects/{ => shaders}/chromaticaberration.xml | 0 effects/{ => shaders}/colorcorrection.frag | 0 effects/{ => shaders}/colorcorrection.xml | 0 effects/{ => shaders}/colorsel.frag | 0 effects/{ => shaders}/colorsel.xml | 0 effects/{ => shaders}/common.frag | 0 effects/{ => shaders}/common.vert | 0 effects/{ => shaders}/crop.frag | 0 effects/{ => shaders}/crop.xml | 0 effects/{ => shaders}/crossstitch.frag | 0 effects/{ => shaders}/crossstitch.xml | 0 effects/{ => shaders}/directionalblur.frag | 0 effects/{ => shaders}/directionalblur.xml | 0 effects/{ => shaders}/dropshadow.xml.disabled | 0 effects/{ => shaders}/emboss.frag | 0 effects/{ => shaders}/emboss.xml | 0 effects/{ => shaders}/findedges.frag | 0 effects/{ => shaders}/findedges.xml.disabled | 0 effects/{ => shaders}/fisheye.frag | 0 effects/{ => shaders}/fisheye.xml | 0 effects/{ => shaders}/flip.frag | 0 effects/{ => shaders}/flip.xml | 0 effects/{ => shaders}/gaussianblur.frag | 0 effects/{ => shaders}/gaussianblur.xml | 0 effects/{ => shaders}/huesatbri.frag | 0 effects/{ => shaders}/huesatbri.xml | 0 effects/{ => shaders}/invert.frag | 0 effects/{ => shaders}/invert.xml | 0 effects/{ => shaders}/lumakey.frag | 0 effects/{ => shaders}/lumakey.xml | 0 effects/{ => shaders}/noise.frag | 0 effects/{ => shaders}/noise.xml | 0 effects/{ => shaders}/pixelate.frag | 0 effects/{ => shaders}/pixelate.xml | 0 effects/{ => shaders}/posterize.frag | 0 effects/{ => shaders}/posterize.xml | 0 effects/{ => shaders}/radialblur.frag | 0 effects/{ => shaders}/radialblur.xml | 0 effects/{ => shaders}/ripple.frag | 0 effects/{ => shaders}/ripple.xml | 0 effects/{ => shaders}/sphere.frag | 0 effects/{ => shaders}/sphere.xml | 0 effects/{ => shaders}/swirl.frag | 0 effects/{ => shaders}/swirl.xml | 0 effects/{ => shaders}/tile.frag | 0 effects/{ => shaders}/tile.xml | 0 effects/{ => shaders}/toonify.frag | 0 effects/{ => shaders}/toonify.xml | 0 effects/{ => shaders}/vignette.frag | 0 effects/{ => shaders}/vignette.xml | 0 effects/{ => shaders}/volumetriclight.frag | 0 effects/{ => shaders}/volumetriclight.xml | 0 effects/{ => shaders}/wave.frag | 0 effects/{ => shaders}/wave.xml | 0 {project => effects}/transition.cpp | 12 +- {project => effects}/transition.h | 0 {io => global}/config.cpp | 0 {io => global}/config.h | 0 {io => global}/crossplatformlib.cpp | 0 {io => global}/crossplatformlib.h | 0 debug.cpp => global/debug.cpp | 0 debug.h => global/debug.h | 0 oliveglobal.cpp => global/global.cpp | 12 +- oliveglobal.h => global/global.h | 2 +- {io => global}/math.cpp | 0 {io => global}/math.h | 0 {io => global}/path.cpp | 0 {io => global}/path.h | 0 io/qpainterwrapper.cpp | 61 ---- io/qpainterwrapper.h | 44 --- main.cpp | 14 +- olive.pro | 142 +++++---- panels/effectcontrols.cpp | 32 ++- panels/grapheditor.cpp | 22 +- panels/grapheditor.h | 2 +- panels/panels.cpp | 69 +---- panels/project.cpp | 15 +- panels/project.h | 2 +- panels/timeline.cpp | 12 +- panels/timeline.h | 6 +- panels/viewer.cpp | 24 +- panels/viewer.h | 2 +- {io => project}/clipboard.cpp | 10 +- {io => project}/clipboard.h | 2 +- project/effectfields.h | 14 - project/effectloaders.cpp | 271 ------------------ project/footage.cpp | 72 ++--- project/footage.h | 2 +- {io => project}/loadthread.cpp | 10 +- {io => project}/loadthread.h | 1 + project/media.cpp | 27 +- project/media.h | 2 +- {io => project}/previewgenerator.cpp | 6 +- {io => project}/previewgenerator.h | 0 project/projectelements.h | 7 - project/projectfilter.cpp | 22 +- project/projectmodel.cpp | 2 +- {io => project}/proxygenerator.cpp | 6 +- {io => project}/proxygenerator.h | 0 project/sourcescommon.cpp | 10 +- rendering/audio.cpp | 8 +- rendering/audio.h | 22 +- rendering/cacher.cpp | 4 +- {io => rendering}/exportthread.cpp | 10 +- {io => rendering}/exportthread.h | 0 rendering/renderfunctions.cpp | 12 +- rendering/renderfunctions.h | 5 +- rendering/renderthread.cpp | 2 +- rendering/renderthread.h | 4 +- {project => timeline}/clip.cpp | 14 +- {project => timeline}/clip.h | 8 +- {project => timeline}/marker.cpp | 10 +- {project => timeline}/marker.h | 0 {project => timeline}/selection.h | 0 {project => timeline}/sequence.cpp | 3 +- {project => timeline}/sequence.h | 7 +- ui/audiomonitor.cpp | 74 ++--- ui/collapsiblewidget.h | 2 +- ui/effectui.cpp | 23 +- ui/effectui.h | 7 +- ui/focusfilter.cpp | 2 +- ui/graphview.cpp | 15 +- ui/graphview.h | 4 +- ui/keyframenavigator.h | 3 +- ui/keyframeview.cpp | 12 +- ui/labelslider.cpp | 123 ++++---- ui/labelslider.h | 195 ++++++------- mainwindow.cpp => ui/mainwindow.cpp | 12 +- mainwindow.h => ui/mainwindow.h | 0 ui/menuhelper.cpp | 8 +- ui/scrollarea.cpp | 2 +- ui/sourceiconview.cpp | 74 ++--- ui/sourcetable.cpp | 60 ++-- ui/timelineheader.cpp | 8 +- ui/timelinewidget.cpp | 10 +- ui/timelinewidget.h | 6 +- ui/viewercontainer.cpp | 100 +++---- ui/viewerwidget.cpp | 8 +- ui/viewerwidget.h | 4 +- {project => undo}/comboaction.cpp | 0 {project => undo}/comboaction.h | 0 {project => undo}/undo.cpp | 39 ++- {project => undo}/undo.h | 23 +- 228 files changed, 1269 insertions(+), 1557 deletions(-) delete mode 100644 dialogs/speeddialog.ui delete mode 100644 effects/README rename {project => effects}/effect.cpp (96%) rename {project => effects}/effect.h (100%) rename {project/effectfields => effects}/effectfield.cpp (84%) rename {project/effectfields => effects}/effectfield.h (90%) create mode 100644 effects/effectfields.h rename {project => effects}/effectgizmo.cpp (100%) rename {project => effects}/effectgizmo.h (100%) create mode 100644 effects/effectloaders.cpp rename {project => effects}/effectloaders.h (100%) rename {project => effects}/effectrow.cpp (95%) rename {project => effects}/effectrow.h (100%) rename {project/effectfields => effects/fields}/boolfield.cpp (62%) rename {project/effectfields => effects/fields}/boolfield.h (78%) rename {project/effectfields => effects/fields}/buttonfield.cpp (100%) rename {project/effectfields => effects/fields}/buttonfield.h (88%) rename {project/effectfields => effects/fields}/colorfield.cpp (100%) rename {project/effectfields => effects/fields}/colorfield.h (90%) rename {project/effectfields => effects/fields}/combofield.cpp (100%) rename {project/effectfields => effects/fields}/combofield.h (89%) rename {project/effectfields => effects/fields}/doublefield.cpp (77%) rename {project/effectfields => effects/fields}/doublefield.h (87%) rename {project/effectfields => effects/fields}/filefield.cpp (100%) rename {project/effectfields => effects/fields}/filefield.h (87%) rename {project/effectfields => effects/fields}/fontfield.cpp (100%) rename {project/effectfields => effects/fields}/fontfield.h (88%) rename {project/effectfields => effects/fields}/labelfield.cpp (100%) rename {project/effectfields => effects/fields}/labelfield.h (85%) rename {project/effectfields => effects/fields}/stringfield.cpp (94%) rename {project/effectfields => effects/fields}/stringfield.h (87%) rename {project => effects}/keyframe.cpp (93%) rename {project => effects}/keyframe.h (81%) rename effects/{ => shaders}/boxblur.frag (100%) rename effects/{ => shaders}/boxblur.xml (100%) rename effects/{ => shaders}/bulge.frag (100%) rename effects/{ => shaders}/bulge.xml (100%) rename effects/{ => shaders}/chromakey.frag (100%) rename effects/{ => shaders}/chromakey.xml (100%) rename effects/{ => shaders}/chromaticaberration.frag (100%) rename effects/{ => shaders}/chromaticaberration.xml (100%) rename effects/{ => shaders}/colorcorrection.frag (100%) rename effects/{ => shaders}/colorcorrection.xml (100%) rename effects/{ => shaders}/colorsel.frag (100%) rename effects/{ => shaders}/colorsel.xml (100%) rename effects/{ => shaders}/common.frag (100%) rename effects/{ => shaders}/common.vert (100%) rename effects/{ => shaders}/crop.frag (100%) rename effects/{ => shaders}/crop.xml (100%) rename effects/{ => shaders}/crossstitch.frag (100%) rename effects/{ => shaders}/crossstitch.xml (100%) rename effects/{ => shaders}/directionalblur.frag (100%) rename effects/{ => shaders}/directionalblur.xml (100%) rename effects/{ => shaders}/dropshadow.xml.disabled (100%) rename effects/{ => shaders}/emboss.frag (100%) rename effects/{ => shaders}/emboss.xml (100%) rename effects/{ => shaders}/findedges.frag (100%) rename effects/{ => shaders}/findedges.xml.disabled (100%) rename effects/{ => shaders}/fisheye.frag (100%) rename effects/{ => shaders}/fisheye.xml (100%) rename effects/{ => shaders}/flip.frag (100%) rename effects/{ => shaders}/flip.xml (100%) rename effects/{ => shaders}/gaussianblur.frag (100%) rename effects/{ => shaders}/gaussianblur.xml (100%) rename effects/{ => shaders}/huesatbri.frag (100%) rename effects/{ => shaders}/huesatbri.xml (100%) rename effects/{ => shaders}/invert.frag (100%) rename effects/{ => shaders}/invert.xml (100%) rename effects/{ => shaders}/lumakey.frag (100%) rename effects/{ => shaders}/lumakey.xml (100%) rename effects/{ => shaders}/noise.frag (100%) rename effects/{ => shaders}/noise.xml (100%) rename effects/{ => shaders}/pixelate.frag (100%) rename effects/{ => shaders}/pixelate.xml (100%) rename effects/{ => shaders}/posterize.frag (100%) rename effects/{ => shaders}/posterize.xml (100%) rename effects/{ => shaders}/radialblur.frag (100%) rename effects/{ => shaders}/radialblur.xml (100%) rename effects/{ => shaders}/ripple.frag (100%) rename effects/{ => shaders}/ripple.xml (100%) rename effects/{ => shaders}/sphere.frag (100%) rename effects/{ => shaders}/sphere.xml (100%) rename effects/{ => shaders}/swirl.frag (100%) rename effects/{ => shaders}/swirl.xml (100%) rename effects/{ => shaders}/tile.frag (100%) rename effects/{ => shaders}/tile.xml (100%) rename effects/{ => shaders}/toonify.frag (100%) rename effects/{ => shaders}/toonify.xml (100%) rename effects/{ => shaders}/vignette.frag (100%) rename effects/{ => shaders}/vignette.xml (100%) rename effects/{ => shaders}/volumetriclight.frag (100%) rename effects/{ => shaders}/volumetriclight.xml (100%) rename effects/{ => shaders}/wave.frag (100%) rename effects/{ => shaders}/wave.xml (100%) rename {project => effects}/transition.cpp (92%) rename {project => effects}/transition.h (100%) rename {io => global}/config.cpp (100%) rename {io => global}/config.h (100%) rename {io => global}/crossplatformlib.cpp (100%) rename {io => global}/crossplatformlib.h (100%) rename debug.cpp => global/debug.cpp (100%) rename debug.h => global/debug.h (100%) rename oliveglobal.cpp => global/global.cpp (95%) rename oliveglobal.h => global/global.h (96%) rename {io => global}/math.cpp (100%) rename {io => global}/math.h (100%) rename {io => global}/path.cpp (100%) rename {io => global}/path.h (100%) delete mode 100644 io/qpainterwrapper.cpp delete mode 100644 io/qpainterwrapper.h rename {io => project}/clipboard.cpp (86%) rename {io => project}/clipboard.h (97%) delete mode 100644 project/effectfields.h delete mode 100644 project/effectloaders.cpp rename {io => project}/loadthread.cpp (99%) rename {io => project}/loadthread.h (98%) rename {io => project}/previewgenerator.cpp (96%) rename {io => project}/previewgenerator.h (100%) rename {io => project}/proxygenerator.cpp (96%) rename {io => project}/proxygenerator.h (100%) rename {io => rendering}/exportthread.cpp (96%) rename {io => rendering}/exportthread.h (100%) rename {project => timeline}/clip.cpp (95%) rename {project => timeline}/clip.h (92%) rename {project => timeline}/marker.cpp (93%) rename {project => timeline}/marker.h (100%) rename {project => timeline}/selection.h (100%) rename {project => timeline}/sequence.cpp (95%) rename {project => timeline}/sequence.h (89%) rename mainwindow.cpp => ui/mainwindow.cpp (97%) rename mainwindow.h => ui/mainwindow.h (100%) rename {project => undo}/comboaction.cpp (100%) rename {project => undo}/comboaction.h (100%) rename {project => undo}/undo.cpp (97%) rename {project => undo}/undo.h (98%) diff --git a/dialogs/advancedvideodialog.h b/dialogs/advancedvideodialog.h index 832e615ae..e393c062d 100644 --- a/dialogs/advancedvideodialog.h +++ b/dialogs/advancedvideodialog.h @@ -25,7 +25,7 @@ #include #include -#include "io/exportthread.h" +#include "rendering/exportthread.h" /** * @brief The AdvancedVideoDialog class diff --git a/dialogs/clippropertiesdialog.cpp b/dialogs/clippropertiesdialog.cpp index 6f4be32fe..a767e5dc6 100644 --- a/dialogs/clippropertiesdialog.cpp +++ b/dialogs/clippropertiesdialog.cpp @@ -5,7 +5,7 @@ #include #include "panels/panels.h" -#include "project/undo.h" +#include "undo/undo.h" ClipPropertiesDialog::ClipPropertiesDialog(QWidget *parent, QVector clips) : QDialog(parent) @@ -33,8 +33,8 @@ ClipPropertiesDialog::ClipPropertiesDialog(QWidget *parent, QVector clip layout->addWidget(new QLabel(tr("Duration:")), row, 0); duration_field_ = new LabelSlider(); - duration_field_->set_display_type(LabelSlider::LABELSLIDER_FRAMENUMBER); - duration_field_->set_minimum_value(1); + duration_field_->SetDisplayType(LabelSlider::FrameNumber); + duration_field_->SetMinimum(1); layout->addWidget(duration_field_, row, 1); row++; @@ -72,15 +72,15 @@ ClipPropertiesDialog::ClipPropertiesDialog(QWidget *parent, QVector clip } // it's assumed all the clips come from the same sequence - duration_field_->set_frame_rate(first_clip->sequence->frame_rate); + duration_field_->SetFrameRate(first_clip->sequence->frame_rate); if (all_clips_have_same_duration) { - duration_field_->set_default_value(first_clip->length()); - duration_field_->set_value(first_clip->length(), false); - duration_field_->set_maximum_value(first_clip->media_length()); + duration_field_->SetDefault(first_clip->length()); + duration_field_->SetValue(first_clip->length()); + duration_field_->SetMaximum(first_clip->media_length()); } else { - duration_field_->set_default_value(qSNaN()); - duration_field_->set_value(qSNaN(), false); + duration_field_->SetDefault(qSNaN()); + duration_field_->SetValue(qSNaN()); } } diff --git a/dialogs/clippropertiesdialog.h b/dialogs/clippropertiesdialog.h index 12b631b3f..8fd830978 100644 --- a/dialogs/clippropertiesdialog.h +++ b/dialogs/clippropertiesdialog.h @@ -4,7 +4,7 @@ #include #include -#include "project/clip.h" +#include "timeline/clip.h" #include "ui/labelslider.h" class ClipPropertiesDialog : public QDialog { diff --git a/dialogs/exportdialog.cpp b/dialogs/exportdialog.cpp index b37f6f4f2..7d48a49d4 100644 --- a/dialogs/exportdialog.cpp +++ b/dialogs/exportdialog.cpp @@ -30,13 +30,13 @@ #include #include -#include "oliveglobal.h" +#include "global/global.h" #include "dialogs/advancedvideodialog.h" #include "panels/panels.h" #include "ui/viewerwidget.h" #include "rendering/renderfunctions.h" -#include "io/exportthread.h" -#include "mainwindow.h" +#include "rendering/exportthread.h" +#include "ui/mainwindow.h" extern "C" { #include diff --git a/dialogs/exportdialog.h b/dialogs/exportdialog.h index 8daf27308..909912c55 100644 --- a/dialogs/exportdialog.h +++ b/dialogs/exportdialog.h @@ -29,9 +29,9 @@ #include #include -#include "project/sequence.h" +#include "timeline/sequence.h" -#include "io/exportthread.h" +#include "rendering/exportthread.h" class ExportDialog : public QDialog { diff --git a/dialogs/loaddialog.cpp b/dialogs/loaddialog.cpp index 310e668ca..92327eabb 100644 --- a/dialogs/loaddialog.cpp +++ b/dialogs/loaddialog.cpp @@ -24,12 +24,12 @@ #include #include -#include "oliveglobal.h" +#include "global/global.h" #include "panels/panels.h" #include "ui/sourcetable.h" -#include "mainwindow.h" +#include "ui/mainwindow.h" LoadDialog::LoadDialog(QWidget *parent, const QString& fn, bool autorecovery, bool clear) : QDialog(parent) diff --git a/dialogs/loaddialog.h b/dialogs/loaddialog.h index 285a58448..63586d226 100644 --- a/dialogs/loaddialog.h +++ b/dialogs/loaddialog.h @@ -26,7 +26,7 @@ #include #include "project/projectelements.h" -#include "io/loadthread.h" +#include "project/loadthread.h" class LoadDialog : public QDialog { diff --git a/dialogs/mediapropertiesdialog.cpp b/dialogs/mediapropertiesdialog.cpp index 8bcee21ed..dceb5ba9a 100644 --- a/dialogs/mediapropertiesdialog.cpp +++ b/dialogs/mediapropertiesdialog.cpp @@ -34,7 +34,7 @@ #include "project/footage.h" #include "project/media.h" #include "panels/project.h" -#include "project/undo.h" +#include "undo/undo.h" MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) : QDialog(parent), diff --git a/dialogs/newsequencedialog.cpp b/dialogs/newsequencedialog.cpp index b4b6e05a5..575775af7 100644 --- a/dialogs/newsequencedialog.cpp +++ b/dialogs/newsequencedialog.cpp @@ -22,9 +22,9 @@ #include "panels/panels.h" #include "panels/project.h" -#include "project/sequence.h" -#include "project/undo.h" -#include "project/clip.h" +#include "timeline/sequence.h" +#include "undo/undo.h" +#include "timeline/clip.h" #include "panels/timeline.h" #include "project/media.h" #include "rendering/audio.h" diff --git a/dialogs/newsequencedialog.h b/dialogs/newsequencedialog.h index ec7ab84b8..b71bdc099 100644 --- a/dialogs/newsequencedialog.h +++ b/dialogs/newsequencedialog.h @@ -28,7 +28,7 @@ #include "panels/project.h" #include "project/media.h" -#include "project/sequence.h" +#include "timeline/sequence.h" class NewSequenceDialog : public QDialog { diff --git a/dialogs/preferencesdialog.cpp b/dialogs/preferencesdialog.cpp index 859ae57db..1ac93c362 100644 --- a/dialogs/preferencesdialog.cpp +++ b/dialogs/preferencesdialog.cpp @@ -20,12 +20,12 @@ #include "preferencesdialog.h" -#include "oliveglobal.h" -#include "io/config.h" -#include "io/path.h" +#include "global/global.h" +#include "global/config.h" +#include "global/path.h" #include "rendering/audio.h" #include "panels/panels.h" -#include "mainwindow.h" +#include "ui/mainwindow.h" #include #include diff --git a/dialogs/proxydialog.cpp b/dialogs/proxydialog.cpp index fb2641de1..bcc0a0745 100644 --- a/dialogs/proxydialog.cpp +++ b/dialogs/proxydialog.cpp @@ -28,9 +28,9 @@ #include #include -#include "io/proxygenerator.h" +#include "project/proxygenerator.h" #include "project/footage.h" -#include "mainwindow.h" +#include "ui/mainwindow.h" ProxyDialog::ProxyDialog(QWidget *parent, const QVector &media) : QDialog(parent), diff --git a/dialogs/replaceclipmediadialog.cpp b/dialogs/replaceclipmediadialog.cpp index d2a9a87d7..bb8b73b33 100644 --- a/dialogs/replaceclipmediadialog.cpp +++ b/dialogs/replaceclipmediadialog.cpp @@ -23,7 +23,7 @@ #include "panels/panels.h" #include "rendering/cacher.h" -#include "project/undo.h" +#include "undo/undo.h" #include #include @@ -31,96 +31,96 @@ #include ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media* old_media) : - QDialog(parent), - media(old_media) + QDialog(parent), + media(old_media) { - setWindowTitle(tr("Replace clips using \"%1\"").arg(old_media->get_name())); + setWindowTitle(tr("Replace clips using \"%1\"").arg(old_media->get_name())); - resize(300, 400); + resize(300, 400); - QVBoxLayout* layout = new QVBoxLayout(this); + QVBoxLayout* layout = new QVBoxLayout(this); - layout->addWidget(new QLabel(tr("Select which media you want to replace this media's clips with:"), this)); + layout->addWidget(new QLabel(tr("Select which media you want to replace this media's clips with:"), this)); - tree = new QTreeView(this); + tree = new QTreeView(this); - layout->addWidget(tree); + layout->addWidget(tree); - use_same_media_in_points = new QCheckBox(tr("Keep the same media in-points"), this); - use_same_media_in_points->setChecked(true); - layout->addWidget(use_same_media_in_points); + use_same_media_in_points = new QCheckBox(tr("Keep the same media in-points"), this); + use_same_media_in_points->setChecked(true); + layout->addWidget(use_same_media_in_points); QHBoxLayout* buttons = new QHBoxLayout(); - buttons->addStretch(); + buttons->addStretch(); - QPushButton* replace_button = new QPushButton(tr("Replace"), this); - connect(replace_button, SIGNAL(clicked(bool)), this, SLOT(replace())); - buttons->addWidget(replace_button); + QPushButton* replace_button = new QPushButton(tr("Replace"), this); + connect(replace_button, SIGNAL(clicked(bool)), this, SLOT(replace())); + buttons->addWidget(replace_button); - QPushButton* cancel_button = new QPushButton(tr("Cancel"), this); - connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(close())); - buttons->addWidget(cancel_button); + QPushButton* cancel_button = new QPushButton(tr("Cancel"), this); + connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(close())); + buttons->addWidget(cancel_button); - buttons->addStretch(); + buttons->addStretch(); - layout->addLayout(buttons); + layout->addLayout(buttons); - tree->setModel(&olive::project_model); + tree->setModel(&olive::project_model); } void ReplaceClipMediaDialog::replace() { - QModelIndexList selected_items = tree->selectionModel()->selectedRows(); - if (selected_items.size() != 1) { - QMessageBox::critical( - this, - tr("No media selected"), - tr("Please select a media to replace with or click 'Cancel'."), - QMessageBox::Ok - ); - } else { + QModelIndexList selected_items = tree->selectionModel()->selectedRows(); + if (selected_items.size() != 1) { + QMessageBox::critical( + this, + tr("No media selected"), + tr("Please select a media to replace with or click 'Cancel'."), + QMessageBox::Ok + ); + } else { Media* new_item = static_cast(selected_items.at(0).internalPointer()); - if (media == new_item) { - QMessageBox::critical( - this, - tr("Same media selected"), - tr("You selected the same media that you're replacing. Please select a different one or click 'Cancel'."), - QMessageBox::Ok - ); - } else if (new_item->get_type() == MEDIA_TYPE_FOLDER) { - QMessageBox::critical( - this, - tr("Folder selected"), - tr("You cannot replace footage with a folder."), - QMessageBox::Ok - ); - } else { - if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && olive::ActiveSequence == new_item->to_sequence()) { - QMessageBox::critical( - this, - tr("Active sequence selected"), - tr("You cannot insert a sequence into itself."), - QMessageBox::Ok - ); - } else { - ReplaceClipMediaCommand* rcmc = new ReplaceClipMediaCommand( - media, - new_item, - use_same_media_in_points->isChecked() - ); + if (media == new_item) { + QMessageBox::critical( + this, + tr("Same media selected"), + tr("You selected the same media that you're replacing. Please select a different one or click 'Cancel'."), + QMessageBox::Ok + ); + } else if (new_item->get_type() == MEDIA_TYPE_FOLDER) { + QMessageBox::critical( + this, + tr("Folder selected"), + tr("You cannot replace footage with a folder."), + QMessageBox::Ok + ); + } else { + if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && olive::ActiveSequence == new_item->to_sequence()) { + QMessageBox::critical( + this, + tr("Active sequence selected"), + tr("You cannot insert a sequence into itself."), + QMessageBox::Ok + ); + } else { + ReplaceClipMediaCommand* rcmc = new ReplaceClipMediaCommand( + media, + new_item, + use_same_media_in_points->isChecked() + ); - for (int i=0;iclips.size();i++) { + for (int i=0;iclips.size();i++) { ClipPtr c = olive::ActiveSequence->clips.at(i); if (c != nullptr && c->media() == media) { - rcmc->clips.append(c); - } - } + rcmc->clips.append(c); + } + } - olive::UndoStack.push(rcmc); + olive::UndoStack.push(rcmc); - close(); - } + close(); + } - } - } + } + } } diff --git a/dialogs/speeddialog.cpp b/dialogs/speeddialog.cpp index c2233fa9d..b7727e048 100644 --- a/dialogs/speeddialog.cpp +++ b/dialogs/speeddialog.cpp @@ -26,13 +26,13 @@ #include #include -#include "project/sequence.h" +#include "timeline/sequence.h" #include "project/footage.h" #include "rendering/renderfunctions.h" #include "panels/panels.h" #include "panels/timeline.h" -#include "project/undo.h" -#include "project/effect.h" +#include "undo/undo.h" +#include "effects/effect.h" #include "project/media.h" SpeedDialog::SpeedDialog(QWidget *parent, QVector clips) : QDialog(parent) { @@ -47,20 +47,20 @@ SpeedDialog::SpeedDialog(QWidget *parent, QVector clips) : QDialog(parent grid->addWidget(new QLabel(tr("Speed:"), this), 0, 0); percent = new LabelSlider(this); - percent->decimal_places = 2; - percent->set_display_type(LabelSlider::LABELSLIDER_PERCENT); - percent->set_default_value(1); + percent->SetDecimalPlaces(2); + percent->SetDisplayType(LabelSlider::Percent); + percent->SetDefault(1); grid->addWidget(percent, 0, 1); grid->addWidget(new QLabel(tr("Frame Rate:"), this), 1, 0); frame_rate = new LabelSlider(this); - frame_rate->decimal_places = 3; + frame_rate->SetDecimalPlaces(3); grid->addWidget(frame_rate, 1, 1); grid->addWidget(new QLabel(tr("Duration:"), this), 2, 0); duration = new LabelSlider(this); - duration->set_display_type(LabelSlider::LABELSLIDER_FRAMENUMBER); - duration->set_frame_rate(olive::ActiveSequence->frame_rate); + duration->SetDisplayType(LabelSlider::FrameNumber); + duration->SetFrameRate(olive::ActiveSequence->frame_rate); grid->addWidget(duration, 2, 1); main_layout->addLayout(grid); @@ -168,16 +168,16 @@ void SpeedDialog::run() { } } - frame_rate->set_minimum_value(1); - percent->set_minimum_value(0.0001); - duration->set_minimum_value(1); + frame_rate->SetMinimum(1); + percent->SetMinimum(0.0001); + duration->SetMinimum(1); frame_rate->setEnabled(enable_frame_rate); - frame_rate->set_default_value(default_frame_rate); - frame_rate->set_value(current_frame_rate, false); - percent->set_value(current_percent, false); - duration->set_default_value(default_length); - duration->set_value((current_length == -1) ? qSNaN() : current_length, false); + frame_rate->SetDefault(default_frame_rate); + frame_rate->SetValue(current_frame_rate); + percent->SetValue(current_percent); + duration->SetDefault(default_length); + duration->SetValue((current_length == -1) ? qSNaN() : current_length); exec(); } @@ -213,8 +213,8 @@ void SpeedDialog::percent_update() { } } - frame_rate->set_value(fr_val, false); - duration->set_value((len_val == -1) ? qSNaN() : len_val, false); + frame_rate->SetValue(fr_val); + duration->SetValue((len_val == -1) ? qSNaN() : len_val); } void SpeedDialog::duration_update() { @@ -248,8 +248,8 @@ void SpeedDialog::duration_update() { } } - frame_rate->set_value(fr_val, false); - percent->set_value(pc_val, false); + frame_rate->SetValue(fr_val); + percent->SetValue(pc_val); } void SpeedDialog::frame_rate_update() { @@ -312,8 +312,8 @@ void SpeedDialog::frame_rate_update() { } } - percent->set_value(pc_val, false); - duration->set_value((len_val == -1) ? qSNaN() : len_val, false); + percent->SetValue(pc_val); + duration->SetValue((len_val == -1) ? qSNaN() : len_val); } void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, long& lr) { @@ -321,7 +321,7 @@ void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, lo long proposed_out = c->timeline_out(); double multiplier = (c->speed().value / speed); - proposed_out = c->timeline_in() + (c->length() * multiplier); + proposed_out = qRound(c->timeline_in() + (c->length() * multiplier)); ca->append(new SetSpeedAction(c, speed)); if (!ripple && proposed_out > c->timeline_out()) { for (int i=0;isequence->clips.size();i++) { diff --git a/dialogs/speeddialog.h b/dialogs/speeddialog.h index 26bb0ab9c..ac68c51dc 100644 --- a/dialogs/speeddialog.h +++ b/dialogs/speeddialog.h @@ -24,7 +24,7 @@ #include #include -#include "project/clip.h" +#include "timeline/clip.h" #include "ui/labelslider.h" class SpeedDialog : public QDialog diff --git a/dialogs/speeddialog.ui b/dialogs/speeddialog.ui deleted file mode 100644 index 144e418a4..000000000 --- a/dialogs/speeddialog.ui +++ /dev/null @@ -1,107 +0,0 @@ - - - SpeedDialog - - - - 0 - 0 - 400 - 300 - - - - Dialog - - - - - 30 - 240 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - 20 - 20 - 47 - 13 - - - - Speed: - - - - - - 20 - 50 - 47 - 13 - - - - Frame Rate: - - - - - - 20 - 80 - 47 - 13 - - - - Duration: - - - - - - - buttonBox - accepted() - SpeedDialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - SpeedDialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/effects/README b/effects/README deleted file mode 100644 index 71a3822d3..000000000 --- a/effects/README +++ /dev/null @@ -1 +0,0 @@ -Place this folder in the runtime folder of Olive. \ No newline at end of file diff --git a/project/effect.cpp b/effects/effect.cpp similarity index 96% rename from project/effect.cpp rename to effects/effect.cpp index 43d2e2ec2..799aa3538 100644 --- a/project/effect.cpp +++ b/effects/effect.cpp @@ -25,19 +25,19 @@ #include "ui/viewerwidget.h" #include "ui/collapsiblewidget.h" #include "panels/project.h" -#include "project/undo.h" -#include "project/sequence.h" -#include "project/clip.h" +#include "undo/undo.h" +#include "timeline/sequence.h" +#include "timeline/clip.h" #include "panels/timeline.h" #include "panels/effectcontrols.h" #include "panels/grapheditor.h" #include "ui/checkboxex.h" -#include "debug.h" -#include "io/path.h" -#include "mainwindow.h" -#include "io/math.h" -#include "io/clipboard.h" -#include "io/config.h" +#include "global/debug.h" +#include "global/path.h" +#include "ui/mainwindow.h" +#include "global/math.h" +#include "project/clipboard.h" +#include "global/config.h" #include "transition.h" #include "effects/internal/transformeffect.h" diff --git a/project/effect.h b/effects/effect.h similarity index 100% rename from project/effect.h rename to effects/effect.h diff --git a/project/effectfields/effectfield.cpp b/effects/effectfield.cpp similarity index 84% rename from project/effectfields/effectfield.cpp rename to effects/effectfield.cpp index 0fe9421a1..73aabc02d 100644 --- a/project/effectfields/effectfield.cpp +++ b/effects/effectfield.cpp @@ -33,18 +33,18 @@ #include "rendering/renderfunctions.h" -#include "io/config.h" +#include "global/config.h" -#include "project/effectrow.h" -#include "project/effect.h" +#include "effects/effectrow.h" +#include "effects/effect.h" -#include "project/undo.h" -#include "project/clip.h" -#include "project/sequence.h" +#include "undo/undo.h" +#include "timeline/clip.h" +#include "timeline/sequence.h" -#include "io/math.h" +#include "global/math.h" -#include "debug.h" +#include "global/debug.h" EffectField::EffectField(EffectRow* parent, const QString &i, EffectFieldType t) : QObject(parent), @@ -100,10 +100,10 @@ QWidget *EffectField::CreateWidget() return new QLabel(tr("(Invalid field)")); } +void EffectField::UpdateWidgetValue(QWidget *, double) {} + QVariant EffectField::GetValueAt(double timecode) { - Q_ASSERT(!keyframes.isEmpty()); - if (HasKeyframes()) { int before_keyframe; int after_keyframe; @@ -179,7 +179,8 @@ QVariant EffectField::GetValueAt(double timecode) } } - return value; + perpetual_data_ = value; + break; } case EFFECT_FIELD_COLOR: { @@ -191,32 +192,27 @@ QVariant EffectField::GetValueAt(double timecode) QColor after_data = keyframes.at(after_keyframe).data.value(); value = QColor(lerp(before_data.red(), after_data.red(), progress), lerp(before_data.green(), after_data.green(), progress), lerp(before_data.blue(), after_data.blue(), progress)); } - return value; + perpetual_data_ = value; + break; } case EFFECT_FIELD_STRING: case EFFECT_FIELD_BOOL: case EFFECT_FIELD_COMBO: case EFFECT_FIELD_FONT: case EFFECT_FIELD_FILE: - return before_data; + perpetual_data_ = before_data; + break; default: break; } } - return keyframes.first().data; + return perpetual_data_; } void EffectField::SetValueAt(double time, const QVariant &value) { - if (keyframes.isEmpty()) { - EffectKeyframe key; - key.data = value; - keyframes.append(key); - return; - } - - if (GetParentRow()->IsKeyframing()) { + if (HasKeyframes()) { // Create keyframe here @@ -237,6 +233,7 @@ void EffectField::SetValueAt(double time, const QVariant &value) EffectKeyframe key; key.time = frame_timecode; key.data = value; + key.type = (keyframes.isEmpty()) ? EFFECT_KEYFRAME_LINEAR : keyframes.last().type; keyframes.append(key); } else { EffectKeyframe& key = keyframes[keyframe_index]; @@ -244,7 +241,7 @@ void EffectField::SetValueAt(double time, const QVariant &value) } } else { - keyframes.first().data = value; + perpetual_data_ = value; } emit Changed(); @@ -256,23 +253,37 @@ double EffectField::Now() return playhead_to_clip_seconds(c, c->sequence->playhead); } +long EffectField::NowInFrames() +{ + Clip* c = GetParentRow()->GetParentEffect()->parent_clip; + return playhead_to_clip_frame(c, c->sequence->playhead); +} + void EffectField::PrepareDataForKeyframing(bool enabled, ComboAction *ca) { if (enabled) { - // Convert "perpetual" keyframe to a keyframe at this time - ca->append(new SetLong(&keyframes.first().time, keyframes.first().time, timecodeToFrame(Now()))); + // Create keyframe from perpetual data + EffectKeyframe key; + + key.time = NowInFrames(); + key.data = perpetual_data_; + key.type = EFFECT_KEYFRAME_LINEAR; + + keyframes.append(key); + + ca->append(new KeyframeAdd(this, keyframes.size()-1)); } else { // Convert keyframes to one "perpetual" keyframe // Set first keyframe to whatever the data is now - ca->append(new SetQVariant(&keyframes.first().data, keyframes.first().data, GetValueAt(Now()))); + ca->append(new SetQVariant(&perpetual_data_, perpetual_data_, GetValueAt(Now()))); - // Delete all keyframes except the first - for (int i=1;iappend(new KeyframeDelete(this, 1)); + // Delete all keyframes + for (int i=0;iappend(new KeyframeDelete(this, 0)); } } @@ -379,33 +390,9 @@ void EffectField::get_keyframe_data(double timecode, int &before, int &after, do } bool EffectField::HasKeyframes() { - return (GetParentRow()->IsKeyframing() && keyframes.size() > 1); + return (GetParentRow()->IsKeyframing() && !keyframes.isEmpty()); } -/* -void EffectField::ui_element_change() { - // TODO address this - //bool dragging_double = (type_ == EFFECT_FIELD_DOUBLE && static_cast(ui_element)->is_dragging()); - bool dragging_double = false; - ComboAction* ca = nullptr; - if (!dragging_double) ca = new ComboAction(); - //make_key_from_change(ca); - if (!dragging_double) olive::UndoStack.push(ca); - emit Changed(); -} -*/ - -/* -void EffectField::make_key_from_change(ComboAction* ca) { - if (GetParentRow()->isKeyframing()) { - GetParentRow()->set_keyframe_now(ca); - } else if (ca != nullptr) { - // set undo - ca->append(new EffectFieldUndo(this)); - } -} -*/ - bool EffectField::IsEnabled() { return enabled_; } diff --git a/project/effectfields/effectfield.h b/effects/effectfield.h similarity index 90% rename from project/effectfields/effectfield.h rename to effects/effectfield.h index 08fce79bb..f8f824896 100644 --- a/project/effectfields/effectfield.h +++ b/effects/effectfield.h @@ -25,7 +25,7 @@ #include #include -#include "project/keyframe.h" +#include "effects/keyframe.h" class EffectRow; class ComboAction; @@ -56,6 +56,7 @@ public: void SetValueAt(double time, const QVariant& value); double Now(); + long NowInFrames(); void PrepareDataForKeyframing(bool enabled, ComboAction* ca); @@ -66,6 +67,7 @@ public: virtual QString ConvertValueToString(const QVariant& v); virtual QWidget* CreateWidget(); + virtual void UpdateWidgetValue(QWidget* widget, double); double GetValidKeyframeHandlePosition(int key, bool post); @@ -92,6 +94,7 @@ private: bool enabled_; int colspan_; + QVariant perpetual_data_; }; #endif // EFFECTFIELD_H diff --git a/effects/effectfields.h b/effects/effectfields.h new file mode 100644 index 000000000..1c8e687e2 --- /dev/null +++ b/effects/effectfields.h @@ -0,0 +1,14 @@ +#ifndef EFFECTFIELDS_H +#define EFFECTFIELDS_H + +#include "fields/boolfield.h" +#include "fields/buttonfield.h" +#include "fields/colorfield.h" +#include "fields/combofield.h" +#include "fields/doublefield.h" +#include "fields/filefield.h" +#include "fields/fontfield.h" +#include "fields/labelfield.h" +#include "fields/stringfield.h" + +#endif // EFFECTFIELDS_H diff --git a/project/effectgizmo.cpp b/effects/effectgizmo.cpp similarity index 100% rename from project/effectgizmo.cpp rename to effects/effectgizmo.cpp diff --git a/project/effectgizmo.h b/effects/effectgizmo.h similarity index 100% rename from project/effectgizmo.h rename to effects/effectgizmo.h diff --git a/effects/effectloaders.cpp b/effects/effectloaders.cpp new file mode 100644 index 000000000..d00c8b67b --- /dev/null +++ b/effects/effectloaders.cpp @@ -0,0 +1,271 @@ +/*** + + Olive - Non-Linear Video Editor + Copyright (C) 2019 Olive Team + + This 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 "effectloaders.h" + +#include "effects/effect.h" +#include "effects/transition.h" +#include "global/path.h" +#include "panels/panels.h" +#include "panels/effectcontrols.h" +#include "global/crossplatformlib.h" +#include "global/config.h" + +#include +#include + +#include + +#ifndef NOFREI0R +#include +typedef void (*f0rGetPluginInfo)(f0r_plugin_info_t* info); +#endif + +void load_internal_effects() { + if (!olive::CurrentRuntimeConfig.shaders_are_enabled) qWarning() << "Shaders are disabled, some effects may be nonfunctional"; + + EffectMeta em; + + // load internal effects + em.path = ":/internalshaders"; + + em.type = EFFECT_TYPE_EFFECT; + em.subtype = EFFECT_TYPE_AUDIO; + + em.name = "Volume"; + em.internal = EFFECT_INTERNAL_VOLUME; + effects.append(em); + + em.name = "Pan"; + em.internal = EFFECT_INTERNAL_PAN; + effects.append(em); + +#ifndef NOVST + em.name = "VST Plugin 2.x"; + em.internal = EFFECT_INTERNAL_VST; + effects.append(em); +#endif + + em.name = "Tone"; + em.internal = EFFECT_INTERNAL_TONE; + effects.append(em); + + em.name = "Noise"; + em.internal = EFFECT_INTERNAL_NOISE; + effects.append(em); + + em.name = "Fill Left/Right"; + em.internal = EFFECT_INTERNAL_FILLLEFTRIGHT; + effects.append(em); + + em.subtype = EFFECT_TYPE_VIDEO; + + em.name = "Transform"; + em.category = "Distort"; + em.internal = EFFECT_INTERNAL_TRANSFORM; + effects.append(em); + + em.name = "Corner Pin"; + em.internal = EFFECT_INTERNAL_CORNERPIN; + effects.append(em); + + /*em.name = "Mask"; + em.internal = EFFECT_INTERNAL_MASK; + effects.append(em);*/ + + em.name = "Shake"; + em.internal = EFFECT_INTERNAL_SHAKE; + effects.append(em); + + em.name = "Text"; + em.category = "Render"; + em.internal = EFFECT_INTERNAL_TEXT; + effects.append(em); + + em.name = "Timecode"; + em.internal = EFFECT_INTERNAL_TIMECODE; + effects.append(em); + + em.name = "Solid"; + em.internal = EFFECT_INTERNAL_SOLID; + effects.append(em); + + // internal transitions + em.type = EFFECT_TYPE_TRANSITION; + em.category = ""; + + em.name = "Cross Dissolve"; + em.internal = TRANSITION_INTERNAL_CROSSDISSOLVE; + effects.append(em); + + em.subtype = EFFECT_TYPE_AUDIO; + + em.name = "Linear Fade"; + em.internal = TRANSITION_INTERNAL_LINEARFADE; + effects.append(em); + + em.name = "Exponential Fade"; + em.internal = TRANSITION_INTERNAL_EXPONENTIALFADE; + effects.append(em); + + em.name = "Logarithmic Fade"; + em.internal = TRANSITION_INTERNAL_LOGARITHMICFADE; + effects.append(em); +} + +void load_shader_effects() { + QList effects_paths = get_effects_paths(); + + for (int h=0;h entries = effects_dir.entryList(QStringList("*.xml"), QDir::Files); + for (int i=0;istart(); +} + +#ifndef NOFREI0R +void load_frei0r_effects_worker(const QString& dir, EffectMeta& em, QVector& loaded_names) { + QDir search_dir(dir); + if (search_dir.exists()) { + QList entry_list = search_dir.entryList(LibFilter(), QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot); + for (int j=0;j(LibAddress(effect, "f0r_get_plugin_info")); + if (get_info_func != nullptr) { + f0r_plugin_info_t info; + get_info_func(&info); + + if (!loaded_names.contains(info.name) + && info.plugin_type == F0R_PLUGIN_TYPE_FILTER + && info.color_model == F0R_COLOR_MODEL_RGBA8888) { + em.name = info.name; + em.path = dir; + em.filename = entry_list.at(j); + em.tooltip = QString("%1\n%2\n%3\n%4").arg(em.name, info.author, info.explanation, em.filename); + + loaded_names.append(em.name); + + effects.append(em); + } +// qDebug() << "Found:" << info.name << "by" << info.author; + } + LibClose(effect); + } +// qDebug() << search_dir.filePath(entry_list.at(j)); + } + } + } +} + +void load_frei0r_effects() { + QList effect_dirs = get_effects_paths(); + + // add defined paths for frei0r plugins on unix +#if defined(__APPLE__) || defined(__linux__) || defined(__HAIKU__) + effect_dirs.prepend("/usr/lib/frei0r-1"); + effect_dirs.prepend("/usr/local/lib/frei0r-1"); + effect_dirs.prepend(QDir::homePath() + "/.frei0r-1/lib"); +#endif + + QString env_path(qgetenv("FREI0R_PATH")); + if (!env_path.isEmpty()) effect_dirs.append(env_path); + + QVector loaded_names; + + // search for paths + EffectMeta em; + em.category = "Frei0r"; + em.type = EFFECT_TYPE_EFFECT; + em.subtype = EFFECT_TYPE_VIDEO; + em.internal = EFFECT_INTERNAL_FREI0R; + + for (int i=0;ieffects_loaded.lock(); +} + +void EffectInit::run() { + qInfo() << "Initializing effects..."; + load_internal_effects(); + load_shader_effects(); +#ifndef NOFREI0R + load_frei0r_effects(); +#endif + panel_effect_controls->effects_loaded.unlock(); + qInfo() << "Finished initializing effects"; +} diff --git a/project/effectloaders.h b/effects/effectloaders.h similarity index 100% rename from project/effectloaders.h rename to effects/effectloaders.h diff --git a/project/effectrow.cpp b/effects/effectrow.cpp similarity index 95% rename from project/effectrow.cpp rename to effects/effectrow.cpp index a1337fb7b..16cfde39d 100644 --- a/project/effectrow.cpp +++ b/effects/effectrow.cpp @@ -24,9 +24,9 @@ #include #include -#include "project/undo.h" -#include "project/clip.h" -#include "project/sequence.h" +#include "undo/undo.h" +#include "timeline/clip.h" +#include "timeline/sequence.h" #include "panels/panels.h" #include "panels/effectcontrols.h" #include "panels/viewer.h" diff --git a/project/effectrow.h b/effects/effectrow.h similarity index 100% rename from project/effectrow.h rename to effects/effectrow.h diff --git a/project/effectfields/boolfield.cpp b/effects/fields/boolfield.cpp similarity index 62% rename from project/effectfields/boolfield.cpp rename to effects/fields/boolfield.cpp index 0a15030c4..f7f4d70ac 100644 --- a/project/effectfields/boolfield.cpp +++ b/effects/fields/boolfield.cpp @@ -22,6 +22,20 @@ QWidget *BoolField::CreateWidget() return cb; } +void BoolField::UpdateWidgetValue(QWidget *widget, double timecode) +{ + QCheckBox* cb = static_cast(widget); + + // Setting the checked state on the checkbox below normally triggers a change() signal that will then trickle back + // to setting a value on this field. Therefore we block its signals while we're setting this. + + cb->blockSignals(true); + + cb->setChecked(GetBoolAt(timecode)); + + cb->blockSignals(false); +} + QVariant BoolField::ConvertStringToValue(const QString &s) { return (s == "1"); diff --git a/project/effectfields/boolfield.h b/effects/fields/boolfield.h similarity index 78% rename from project/effectfields/boolfield.h rename to effects/fields/boolfield.h index bf6be11d7..0ac09a01e 100644 --- a/project/effectfields/boolfield.h +++ b/effects/fields/boolfield.h @@ -1,7 +1,7 @@ #ifndef BOOLFIELD_H #define BOOLFIELD_H -#include "effectfield.h" +#include "../effectfield.h" class BoolField : public EffectField { @@ -12,6 +12,7 @@ public: bool GetBoolAt(double timecode); virtual QWidget* CreateWidget() override; + virtual void UpdateWidgetValue(QWidget* widget, double timecode) override; virtual QVariant ConvertStringToValue(const QString& s) override; virtual QString ConvertValueToString(const QVariant& v) override; diff --git a/project/effectfields/buttonfield.cpp b/effects/fields/buttonfield.cpp similarity index 100% rename from project/effectfields/buttonfield.cpp rename to effects/fields/buttonfield.cpp diff --git a/project/effectfields/buttonfield.h b/effects/fields/buttonfield.h similarity index 88% rename from project/effectfields/buttonfield.h rename to effects/fields/buttonfield.h index 71e77f1ac..c3e3150f7 100644 --- a/project/effectfields/buttonfield.h +++ b/effects/fields/buttonfield.h @@ -1,7 +1,7 @@ #ifndef BUTTONFIELD_H #define BUTTONFIELD_H -#include "effectfield.h" +#include "../effectfield.h" class ButtonField : public EffectField { diff --git a/project/effectfields/colorfield.cpp b/effects/fields/colorfield.cpp similarity index 100% rename from project/effectfields/colorfield.cpp rename to effects/fields/colorfield.cpp diff --git a/project/effectfields/colorfield.h b/effects/fields/colorfield.h similarity index 90% rename from project/effectfields/colorfield.h rename to effects/fields/colorfield.h index f4ef25020..7c6d60216 100644 --- a/project/effectfields/colorfield.h +++ b/effects/fields/colorfield.h @@ -1,7 +1,7 @@ #ifndef COLORFIELD_H #define COLORFIELD_H -#include "effectfield.h" +#include "../effectfield.h" class ColorField : public EffectField { diff --git a/project/effectfields/combofield.cpp b/effects/fields/combofield.cpp similarity index 100% rename from project/effectfields/combofield.cpp rename to effects/fields/combofield.cpp diff --git a/project/effectfields/combofield.h b/effects/fields/combofield.h similarity index 89% rename from project/effectfields/combofield.h rename to effects/fields/combofield.h index c886a0172..bdf5a9972 100644 --- a/project/effectfields/combofield.h +++ b/effects/fields/combofield.h @@ -1,7 +1,7 @@ #ifndef COMBOFIELD_H #define COMBOFIELD_H -#include "effectfield.h" +#include "../effectfield.h" struct ComboFieldItem { QString name; diff --git a/project/effectfields/doublefield.cpp b/effects/fields/doublefield.cpp similarity index 77% rename from project/effectfields/doublefield.cpp rename to effects/fields/doublefield.cpp index 63de39fbb..8499c2f9b 100644 --- a/project/effectfields/doublefield.cpp +++ b/effects/fields/doublefield.cpp @@ -1,11 +1,13 @@ #include "doublefield.h" +#include + DoubleField::DoubleField(EffectRow* parent, const QString& id) : EffectField(parent, id, EFFECT_FIELD_DOUBLE), min_(qSNaN()), max_(qSNaN()), default_(0), - display_type_(LabelSlider::LABELSLIDER_NORMAL), + display_type_(LabelSlider::Normal), frame_rate_(30), value_set_(false) { @@ -62,14 +64,14 @@ QWidget *DoubleField::CreateWidget() LabelSlider* ls = new LabelSlider(); if (!qIsNaN(min_)) { - ls->set_minimum_value(min_); + ls->SetMinimum(min_); } - ls->set_default_value(default_); + ls->SetDefault(default_); if (!qIsNaN(max_)) { - ls->set_maximum_value(max_); + ls->SetMaximum(max_); } - ls->set_display_type(display_type_); - ls->set_frame_rate(frame_rate_); + ls->SetDisplayType(display_type_); + ls->SetFrameRate(frame_rate_); ls->setEnabled(IsEnabled()); @@ -80,6 +82,11 @@ QWidget *DoubleField::CreateWidget() return ls; } +void DoubleField::UpdateWidgetValue(QWidget *widget, double timecode) +{ + static_cast(widget)->SetValue(GetDoubleAt(timecode)); +} + void DoubleField::ValueHasBeenSet() { value_set_ = true; diff --git a/project/effectfields/doublefield.h b/effects/fields/doublefield.h similarity index 87% rename from project/effectfields/doublefield.h rename to effects/fields/doublefield.h index 2935cf4d6..39a46a334 100644 --- a/project/effectfields/doublefield.h +++ b/effects/fields/doublefield.h @@ -1,7 +1,7 @@ #ifndef DOUBLEFIELD_H #define DOUBLEFIELD_H -#include "effectfield.h" +#include "../effectfield.h" #include "ui/labelslider.h" class DoubleField : public EffectField @@ -36,6 +36,7 @@ public: virtual QString ConvertValueToString(const QVariant& v); virtual QWidget* CreateWidget() override; + virtual void UpdateWidgetValue(QWidget* widget, double timecode) override; private: double min_; double max_; diff --git a/project/effectfields/filefield.cpp b/effects/fields/filefield.cpp similarity index 100% rename from project/effectfields/filefield.cpp rename to effects/fields/filefield.cpp diff --git a/project/effectfields/filefield.h b/effects/fields/filefield.h similarity index 87% rename from project/effectfields/filefield.h rename to effects/fields/filefield.h index 2a68a0b50..ef1e1e099 100644 --- a/project/effectfields/filefield.h +++ b/effects/fields/filefield.h @@ -1,7 +1,7 @@ #ifndef FILEFIELD_H #define FILEFIELD_H -#include "effectfield.h" +#include "../effectfield.h" class FileField : public EffectField { diff --git a/project/effectfields/fontfield.cpp b/effects/fields/fontfield.cpp similarity index 100% rename from project/effectfields/fontfield.cpp rename to effects/fields/fontfield.cpp diff --git a/project/effectfields/fontfield.h b/effects/fields/fontfield.h similarity index 88% rename from project/effectfields/fontfield.h rename to effects/fields/fontfield.h index b2a828b1d..ddd2b05be 100644 --- a/project/effectfields/fontfield.h +++ b/effects/fields/fontfield.h @@ -1,7 +1,7 @@ #ifndef FONTFIELD_H #define FONTFIELD_H -#include "effectfield.h" +#include "../effectfield.h" class FontField : public EffectField { Q_OBJECT diff --git a/project/effectfields/labelfield.cpp b/effects/fields/labelfield.cpp similarity index 100% rename from project/effectfields/labelfield.cpp rename to effects/fields/labelfield.cpp diff --git a/project/effectfields/labelfield.h b/effects/fields/labelfield.h similarity index 85% rename from project/effectfields/labelfield.h rename to effects/fields/labelfield.h index 628a9181a..31a40462b 100644 --- a/project/effectfields/labelfield.h +++ b/effects/fields/labelfield.h @@ -1,7 +1,7 @@ #ifndef LABELFIELD_H #define LABELFIELD_H -#include "effectfield.h" +#include "../effectfield.h" class LabelField : public EffectField { diff --git a/project/effectfields/stringfield.cpp b/effects/fields/stringfield.cpp similarity index 94% rename from project/effectfields/stringfield.cpp rename to effects/fields/stringfield.cpp index 105e5c28f..b2f38a246 100644 --- a/project/effectfields/stringfield.cpp +++ b/effects/fields/stringfield.cpp @@ -3,7 +3,7 @@ #include #include "ui/texteditex.h" -#include "io/config.h" +#include "global/config.h" StringField::StringField(EffectRow* parent, const QString& id) : EffectField(parent, id, EFFECT_FIELD_STRING) diff --git a/project/effectfields/stringfield.h b/effects/fields/stringfield.h similarity index 87% rename from project/effectfields/stringfield.h rename to effects/fields/stringfield.h index 043dbbb67..4643f7bd6 100644 --- a/project/effectfields/stringfield.h +++ b/effects/fields/stringfield.h @@ -1,7 +1,7 @@ #ifndef STRINGFIELD_H #define STRINGFIELD_H -#include "effectfield.h" +#include "../effectfield.h" class StringField : public EffectField { diff --git a/effects/internal/audionoiseeffect.h b/effects/internal/audionoiseeffect.h index f2668d354..dab29be78 100644 --- a/effects/internal/audionoiseeffect.h +++ b/effects/internal/audionoiseeffect.h @@ -21,7 +21,7 @@ #ifndef AUDIONOISEEFFECT_H #define AUDIONOISEEFFECT_H -#include "project/effect.h" +#include "effects/effect.h" class AudioNoiseEffect : public Effect { Q_OBJECT diff --git a/effects/internal/cornerpineffect.cpp b/effects/internal/cornerpineffect.cpp index 566247109..a80a504ef 100644 --- a/effects/internal/cornerpineffect.cpp +++ b/effects/internal/cornerpineffect.cpp @@ -20,9 +20,9 @@ #include "cornerpineffect.h" -#include "io/path.h" -#include "project/clip.h" -#include "debug.h" +#include "global/path.h" +#include "timeline/clip.h" +#include "global/debug.h" CornerPinEffect::CornerPinEffect(Clip* c, const EffectMeta *em) : Effect(c, em) { SetFlags(Effect::CoordsFlag & Effect::ShaderFlag); diff --git a/effects/internal/cornerpineffect.h b/effects/internal/cornerpineffect.h index 5b2460ef8..ffee7311b 100644 --- a/effects/internal/cornerpineffect.h +++ b/effects/internal/cornerpineffect.h @@ -21,7 +21,7 @@ #ifndef CORNERPINEFFECT_H #define CORNERPINEFFECT_H -#include "project/effect.h" +#include "effects/effect.h" class CornerPinEffect : public Effect { Q_OBJECT diff --git a/effects/internal/crossdissolvetransition.h b/effects/internal/crossdissolvetransition.h index 2b11b7c7e..42c91492e 100644 --- a/effects/internal/crossdissolvetransition.h +++ b/effects/internal/crossdissolvetransition.h @@ -21,7 +21,7 @@ #ifndef CROSSDISSOLVETRANSITION_H #define CROSSDISSOLVETRANSITION_H -#include "project/transition.h" +#include "effects/transition.h" class CrossDissolveTransition : public Transition { public: diff --git a/effects/internal/cubetransition.h b/effects/internal/cubetransition.h index 82519ad03..fb3bdc512 100644 --- a/effects/internal/cubetransition.h +++ b/effects/internal/cubetransition.h @@ -21,7 +21,7 @@ #ifndef CUBETRANSITION_H #define CUBETRANSITION_H -#include "project/transition.h" +#include "effects/transition.h" class CubeTransition : public Transition { public: diff --git a/effects/internal/exponentialfadetransition.h b/effects/internal/exponentialfadetransition.h index 36ec7f6f1..8aeaccdc0 100644 --- a/effects/internal/exponentialfadetransition.h +++ b/effects/internal/exponentialfadetransition.h @@ -21,12 +21,12 @@ #ifndef EXPONENTIALFADETRANSITION_H #define EXPONENTIALFADETRANSITION_H -#include "project/transition.h" +#include "effects/transition.h" class ExponentialFadeTransition : public Transition { public: ExponentialFadeTransition(Clip* c, Clip* s, const EffectMeta* em); - void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count); + void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count); }; #endif // LINEARFADETRANSITION_H diff --git a/effects/internal/fillleftrighteffect.h b/effects/internal/fillleftrighteffect.h index 6a47a31ac..9300bcb72 100644 --- a/effects/internal/fillleftrighteffect.h +++ b/effects/internal/fillleftrighteffect.h @@ -21,7 +21,7 @@ #ifndef FILLLEFTRIGHTEFFECT_H #define FILLLEFTRIGHTEFFECT_H -#include "project/effect.h" +#include "effects/effect.h" class FillLeftRightEffect : public Effect { Q_OBJECT diff --git a/effects/internal/frei0reffect.cpp b/effects/internal/frei0reffect.cpp index da45e4564..c63514e03 100644 --- a/effects/internal/frei0reffect.cpp +++ b/effects/internal/frei0reffect.cpp @@ -25,7 +25,7 @@ #include #include -#include "project/clip.h" +#include "timeline/clip.h" typedef f0r_instance_t (*f0rConstructFunc)(unsigned int width, unsigned int height); typedef int (*f0rInitFunc) (); diff --git a/effects/internal/frei0reffect.h b/effects/internal/frei0reffect.h index b6428a8b9..6f7356b28 100644 --- a/effects/internal/frei0reffect.h +++ b/effects/internal/frei0reffect.h @@ -23,32 +23,31 @@ #ifndef NOFREI0R -#include "project/effect.h" - #include -#include "io/crossplatformlib.h" +#include "effects/effect.h" +#include "global/crossplatformlib.h" typedef void (*f0rGetParamInfo)(f0r_param_info_t * info, - int param_index ); + int param_index ); class Frei0rEffect : public Effect { - Q_OBJECT + Q_OBJECT public: Frei0rEffect(Clip* c, const EffectMeta* em); - ~Frei0rEffect(); + ~Frei0rEffect(); - virtual void process_image(double timecode, uint8_t* input, uint8_t* output, int size); + virtual void process_image(double timecode, uint8_t* input, uint8_t* output, int size); - virtual void refresh(); + virtual void refresh(); private: - ModulePtr handle; - f0r_instance_t instance; - int param_count; - f0rGetParamInfo get_param_info; - void destruct_module(); - void construct_module(); - bool open; + ModulePtr handle; + f0r_instance_t instance; + int param_count; + f0rGetParamInfo get_param_info; + void destruct_module(); + void construct_module(); + bool open; }; #endif diff --git a/effects/internal/linearfadetransition.h b/effects/internal/linearfadetransition.h index f3716753a..bfb94c414 100644 --- a/effects/internal/linearfadetransition.h +++ b/effects/internal/linearfadetransition.h @@ -21,12 +21,12 @@ #ifndef LINEARFADETRANSITION_H #define LINEARFADETRANSITION_H -#include "project/transition.h" +#include "effects/transition.h" class LinearFadeTransition : public Transition { public: LinearFadeTransition(Clip* c, Clip* s, const EffectMeta* em); - void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count); + void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count); }; #endif // LINEARFADETRANSITION_H diff --git a/effects/internal/logarithmicfadetransition.h b/effects/internal/logarithmicfadetransition.h index a476351d1..e4b178881 100644 --- a/effects/internal/logarithmicfadetransition.h +++ b/effects/internal/logarithmicfadetransition.h @@ -21,12 +21,12 @@ #ifndef LOGARITHMICFADETRANSITION_H #define LOGARITHMICFADETRANSITION_H -#include "project/transition.h" +#include "effects/transition.h" class LogarithmicFadeTransition : public Transition { public: LogarithmicFadeTransition(Clip* c, Clip* s, const EffectMeta* em); - void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count); + void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count); }; #endif // LOGARITHMICFADETRANSITION_H diff --git a/effects/internal/paneffect.h b/effects/internal/paneffect.h index aab759b54..5e767e04e 100644 --- a/effects/internal/paneffect.h +++ b/effects/internal/paneffect.h @@ -21,7 +21,7 @@ #ifndef PANEFFECT_H #define PANEFFECT_H -#include "project/effect.h" +#include "effects/effect.h" class PanEffect : public Effect { Q_OBJECT diff --git a/effects/internal/shakeeffect.cpp b/effects/internal/shakeeffect.cpp index 4c1ea170f..6467e2bb5 100644 --- a/effects/internal/shakeeffect.cpp +++ b/effects/internal/shakeeffect.cpp @@ -27,11 +27,10 @@ #include "ui/labelslider.h" #include "ui/collapsiblewidget.h" -#include "project/clip.h" -#include "project/sequence.h" +#include "timeline/clip.h" +#include "timeline/sequence.h" #include "panels/timeline.h" - -#include "debug.h" +#include "global/debug.h" ShakeEffect::ShakeEffect(Clip* c, const EffectMeta *em) : Effect(c, em) { SetFlags(Effect::CoordsFlag); diff --git a/effects/internal/shakeeffect.h b/effects/internal/shakeeffect.h index 05c96022f..b199f493b 100644 --- a/effects/internal/shakeeffect.h +++ b/effects/internal/shakeeffect.h @@ -21,7 +21,7 @@ #ifndef SHAKEEFFECT_H #define SHAKEEFFECT_H -#include "project/effect.h" +#include "effects/effect.h" #define RANDOM_VAL_SIZE 30 diff --git a/effects/internal/solideffect.cpp b/effects/internal/solideffect.cpp index 76e067f27..95b01cb2d 100644 --- a/effects/internal/solideffect.cpp +++ b/effects/internal/solideffect.cpp @@ -27,8 +27,8 @@ #include #include -#include "project/clip.h" -#include "project/sequence.h" +#include "timeline/clip.h" +#include "timeline/sequence.h" const int SMPTE_BARS = 7; const int SMPTE_STRIP_COUNT = 3; diff --git a/effects/internal/solideffect.h b/effects/internal/solideffect.h index 0b5b22846..3d099b17f 100644 --- a/effects/internal/solideffect.h +++ b/effects/internal/solideffect.h @@ -21,7 +21,7 @@ #ifndef SOLIDEFFECT_H #define SOLIDEFFECT_H -#include "project/effect.h" +#include "effects/effect.h" #include diff --git a/effects/internal/texteffect.cpp b/effects/internal/texteffect.cpp index 59b80b929..4c51f47e4 100644 --- a/effects/internal/texteffect.cpp +++ b/effects/internal/texteffect.cpp @@ -35,12 +35,12 @@ #include "ui/labelslider.h" #include "ui/collapsiblewidget.h" -#include "project/clip.h" -#include "project/sequence.h" +#include "timeline/clip.h" +#include "timeline/sequence.h" #include "ui/comboboxex.h" #include "ui/colorbutton.h" #include "ui/fontcombobox.h" -#include "io/config.h" +#include "global/config.h" TextEffect::TextEffect(Clip* c, const EffectMeta* em) : Effect(c, em) diff --git a/effects/internal/texteffect.h b/effects/internal/texteffect.h index e389a5873..b74356dbf 100644 --- a/effects/internal/texteffect.h +++ b/effects/internal/texteffect.h @@ -21,7 +21,7 @@ #ifndef TEXTEFFECT_H #define TEXTEFFECT_H -#include "project/effect.h" +#include "effects/effect.h" #include #include diff --git a/effects/internal/timecodeeffect.cpp b/effects/internal/timecodeeffect.cpp index b10b9d916..6b37a6795 100644 --- a/effects/internal/timecodeeffect.cpp +++ b/effects/internal/timecodeeffect.cpp @@ -35,13 +35,13 @@ #include "ui/labelslider.h" #include "ui/collapsiblewidget.h" -#include "project/clip.h" -#include "project/sequence.h" +#include "timeline/clip.h" +#include "timeline/sequence.h" #include "panels/viewer.h" #include "ui/comboboxex.h" #include "ui/colorbutton.h" #include "ui/fontcombobox.h" -#include "io/config.h" +#include "global/config.h" TimecodeEffect::TimecodeEffect(Clip* c, const EffectMeta* em) : Effect(c, em) diff --git a/effects/internal/timecodeeffect.h b/effects/internal/timecodeeffect.h index 1e8ba5ec8..2f48d9bc7 100644 --- a/effects/internal/timecodeeffect.h +++ b/effects/internal/timecodeeffect.h @@ -21,7 +21,7 @@ #ifndef TIMECODEEFFECT_H #define TIMECODEEFFECT_H -#include "project/effect.h" +#include "effects/effect.h" #include #include diff --git a/effects/internal/toneeffect.cpp b/effects/internal/toneeffect.cpp index 95c33504d..a1758f86e 100644 --- a/effects/internal/toneeffect.cpp +++ b/effects/internal/toneeffect.cpp @@ -24,9 +24,8 @@ #define TONE_TYPE_SINE 0 -#include "project/clip.h" -#include "project/sequence.h" -#include "debug.h" +#include "timeline/clip.h" +#include "timeline/sequence.h" ToneEffect::ToneEffect(Clip* c, const EffectMeta *em) : Effect(c, em), sinX(INT_MIN) { EffectRow* type_row = new EffectRow(this, tr("Type")); diff --git a/effects/internal/toneeffect.h b/effects/internal/toneeffect.h index 2b0223e47..a14f49a98 100644 --- a/effects/internal/toneeffect.h +++ b/effects/internal/toneeffect.h @@ -21,7 +21,7 @@ #ifndef TONEEFFECT_H #define TONEEFFECT_H -#include "project/effect.h" +#include "effects/effect.h" class ToneEffect : public Effect { Q_OBJECT diff --git a/effects/internal/transformeffect.cpp b/effects/internal/transformeffect.cpp index 82103cfe9..03c219dcd 100644 --- a/effects/internal/transformeffect.cpp +++ b/effects/internal/transformeffect.cpp @@ -30,14 +30,14 @@ #include #include "ui/collapsiblewidget.h" -#include "project/clip.h" -#include "project/sequence.h" +#include "timeline/clip.h" +#include "timeline/sequence.h" #include "project/footage.h" -#include "io/math.h" +#include "global/math.h" #include "ui/labelslider.h" #include "ui/comboboxex.h" #include "panels/project.h" -#include "debug.h" +#include "global/debug.h" #include "panels/panels.h" #include "panels/viewer.h" diff --git a/effects/internal/transformeffect.h b/effects/internal/transformeffect.h index 13b007bc0..84f64fadb 100644 --- a/effects/internal/transformeffect.h +++ b/effects/internal/transformeffect.h @@ -21,7 +21,7 @@ #ifndef TRANSFORMEFFECT_H #define TRANSFORMEFFECT_H -#include "project/effect.h" +#include "effects/effect.h" class TransformEffect : public Effect { Q_OBJECT diff --git a/effects/internal/voideffect.cpp b/effects/internal/voideffect.cpp index d68f2ddbe..bf3192cd6 100644 --- a/effects/internal/voideffect.cpp +++ b/effects/internal/voideffect.cpp @@ -25,7 +25,7 @@ #include #include "ui/collapsiblewidget.h" -#include "debug.h" +#include "global/debug.h" VoidEffect::VoidEffect(Clip* c, const QString& n) : Effect(c, nullptr) { QString display_name; diff --git a/effects/internal/voideffect.h b/effects/internal/voideffect.h index 7d524302f..a0c49c7ba 100644 --- a/effects/internal/voideffect.h +++ b/effects/internal/voideffect.h @@ -27,7 +27,7 @@ * isn't lost if the user saves over the project. */ -#include "project/effect.h" +#include "effects/effect.h" class VoidEffect : public Effect { Q_OBJECT diff --git a/effects/internal/volumeeffect.cpp b/effects/internal/volumeeffect.cpp index 1b12216f5..e01d5241c 100644 --- a/effects/internal/volumeeffect.cpp +++ b/effects/internal/volumeeffect.cpp @@ -34,7 +34,7 @@ VolumeEffect::VolumeEffect(Clip* c, const EffectMeta *em) : Effect(c, em) { // set defaults volume_val->SetDefault(1); - volume_val->SetDisplayType(LabelSlider::LABELSLIDER_DECIBEL); + volume_val->SetDisplayType(LabelSlider::Decibel); } void VolumeEffect::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int) { diff --git a/effects/internal/volumeeffect.h b/effects/internal/volumeeffect.h index 584c6c00c..80e0adc70 100644 --- a/effects/internal/volumeeffect.h +++ b/effects/internal/volumeeffect.h @@ -21,7 +21,7 @@ #ifndef VOLUMEEFFECT_H #define VOLUMEEFFECT_H -#include "project/effect.h" +#include "effects/effect.h" class VolumeEffect : public Effect { Q_OBJECT diff --git a/effects/internal/vsthost.cpp b/effects/internal/vsthost.cpp index f831abc4e..ade778f06 100644 --- a/effects/internal/vsthost.cpp +++ b/effects/internal/vsthost.cpp @@ -32,8 +32,8 @@ #include #include "rendering/audio.h" -#include "mainwindow.h" -#include "debug.h" +#include "ui/mainwindow.h" +#include "global/debug.h" #ifdef __linux__ #include diff --git a/effects/internal/vsthost.h b/effects/internal/vsthost.h index 5e30312ba..5dc06a0cf 100644 --- a/effects/internal/vsthost.h +++ b/effects/internal/vsthost.h @@ -23,9 +23,9 @@ #ifndef NOVST -#include "project/effect.h" +#include "effects/effect.h" -#include "io/crossplatformlib.h" +#include "global/crossplatformlib.h" #include "include/vestige.h" diff --git a/project/keyframe.cpp b/effects/keyframe.cpp similarity index 93% rename from project/keyframe.cpp rename to effects/keyframe.cpp index 64a36ce2d..c7518477b 100644 --- a/project/keyframe.cpp +++ b/effects/keyframe.cpp @@ -23,10 +23,11 @@ #include #include "effectfields.h" -#include "undo.h" +#include "undo/undo.h" #include "panels/panels.h" -EffectKeyframe::EffectKeyframe() { +EffectKeyframe::EffectKeyframe() +{ pre_handle_x = -40; pre_handle_y = 0; post_handle_x = 40; diff --git a/project/keyframe.h b/effects/keyframe.h similarity index 81% rename from project/keyframe.h rename to effects/keyframe.h index 9602a670e..241d28ef8 100644 --- a/project/keyframe.h +++ b/effects/keyframe.h @@ -27,17 +27,17 @@ class EffectField; class EffectKeyframe { public: - EffectKeyframe(); + EffectKeyframe(); - long time; - int type; - QVariant data; + int type; + long time; + QVariant data; - // only for bezier type - double pre_handle_x; - double pre_handle_y; - double post_handle_x; - double post_handle_y; + // only for bezier type + double pre_handle_x; + double pre_handle_y; + double post_handle_x; + double post_handle_y; }; void delete_keyframes(QVector &selected_key_fields, QVector &selected_keys); diff --git a/effects/boxblur.frag b/effects/shaders/boxblur.frag similarity index 100% rename from effects/boxblur.frag rename to effects/shaders/boxblur.frag diff --git a/effects/boxblur.xml b/effects/shaders/boxblur.xml similarity index 100% rename from effects/boxblur.xml rename to effects/shaders/boxblur.xml diff --git a/effects/bulge.frag b/effects/shaders/bulge.frag similarity index 100% rename from effects/bulge.frag rename to effects/shaders/bulge.frag diff --git a/effects/bulge.xml b/effects/shaders/bulge.xml similarity index 100% rename from effects/bulge.xml rename to effects/shaders/bulge.xml diff --git a/effects/chromakey.frag b/effects/shaders/chromakey.frag similarity index 100% rename from effects/chromakey.frag rename to effects/shaders/chromakey.frag diff --git a/effects/chromakey.xml b/effects/shaders/chromakey.xml similarity index 100% rename from effects/chromakey.xml rename to effects/shaders/chromakey.xml diff --git a/effects/chromaticaberration.frag b/effects/shaders/chromaticaberration.frag similarity index 100% rename from effects/chromaticaberration.frag rename to effects/shaders/chromaticaberration.frag diff --git a/effects/chromaticaberration.xml b/effects/shaders/chromaticaberration.xml similarity index 100% rename from effects/chromaticaberration.xml rename to effects/shaders/chromaticaberration.xml diff --git a/effects/colorcorrection.frag b/effects/shaders/colorcorrection.frag similarity index 100% rename from effects/colorcorrection.frag rename to effects/shaders/colorcorrection.frag diff --git a/effects/colorcorrection.xml b/effects/shaders/colorcorrection.xml similarity index 100% rename from effects/colorcorrection.xml rename to effects/shaders/colorcorrection.xml diff --git a/effects/colorsel.frag b/effects/shaders/colorsel.frag similarity index 100% rename from effects/colorsel.frag rename to effects/shaders/colorsel.frag diff --git a/effects/colorsel.xml b/effects/shaders/colorsel.xml similarity index 100% rename from effects/colorsel.xml rename to effects/shaders/colorsel.xml diff --git a/effects/common.frag b/effects/shaders/common.frag similarity index 100% rename from effects/common.frag rename to effects/shaders/common.frag diff --git a/effects/common.vert b/effects/shaders/common.vert similarity index 100% rename from effects/common.vert rename to effects/shaders/common.vert diff --git a/effects/crop.frag b/effects/shaders/crop.frag similarity index 100% rename from effects/crop.frag rename to effects/shaders/crop.frag diff --git a/effects/crop.xml b/effects/shaders/crop.xml similarity index 100% rename from effects/crop.xml rename to effects/shaders/crop.xml diff --git a/effects/crossstitch.frag b/effects/shaders/crossstitch.frag similarity index 100% rename from effects/crossstitch.frag rename to effects/shaders/crossstitch.frag diff --git a/effects/crossstitch.xml b/effects/shaders/crossstitch.xml similarity index 100% rename from effects/crossstitch.xml rename to effects/shaders/crossstitch.xml diff --git a/effects/directionalblur.frag b/effects/shaders/directionalblur.frag similarity index 100% rename from effects/directionalblur.frag rename to effects/shaders/directionalblur.frag diff --git a/effects/directionalblur.xml b/effects/shaders/directionalblur.xml similarity index 100% rename from effects/directionalblur.xml rename to effects/shaders/directionalblur.xml diff --git a/effects/dropshadow.xml.disabled b/effects/shaders/dropshadow.xml.disabled similarity index 100% rename from effects/dropshadow.xml.disabled rename to effects/shaders/dropshadow.xml.disabled diff --git a/effects/emboss.frag b/effects/shaders/emboss.frag similarity index 100% rename from effects/emboss.frag rename to effects/shaders/emboss.frag diff --git a/effects/emboss.xml b/effects/shaders/emboss.xml similarity index 100% rename from effects/emboss.xml rename to effects/shaders/emboss.xml diff --git a/effects/findedges.frag b/effects/shaders/findedges.frag similarity index 100% rename from effects/findedges.frag rename to effects/shaders/findedges.frag diff --git a/effects/findedges.xml.disabled b/effects/shaders/findedges.xml.disabled similarity index 100% rename from effects/findedges.xml.disabled rename to effects/shaders/findedges.xml.disabled diff --git a/effects/fisheye.frag b/effects/shaders/fisheye.frag similarity index 100% rename from effects/fisheye.frag rename to effects/shaders/fisheye.frag diff --git a/effects/fisheye.xml b/effects/shaders/fisheye.xml similarity index 100% rename from effects/fisheye.xml rename to effects/shaders/fisheye.xml diff --git a/effects/flip.frag b/effects/shaders/flip.frag similarity index 100% rename from effects/flip.frag rename to effects/shaders/flip.frag diff --git a/effects/flip.xml b/effects/shaders/flip.xml similarity index 100% rename from effects/flip.xml rename to effects/shaders/flip.xml diff --git a/effects/gaussianblur.frag b/effects/shaders/gaussianblur.frag similarity index 100% rename from effects/gaussianblur.frag rename to effects/shaders/gaussianblur.frag diff --git a/effects/gaussianblur.xml b/effects/shaders/gaussianblur.xml similarity index 100% rename from effects/gaussianblur.xml rename to effects/shaders/gaussianblur.xml diff --git a/effects/huesatbri.frag b/effects/shaders/huesatbri.frag similarity index 100% rename from effects/huesatbri.frag rename to effects/shaders/huesatbri.frag diff --git a/effects/huesatbri.xml b/effects/shaders/huesatbri.xml similarity index 100% rename from effects/huesatbri.xml rename to effects/shaders/huesatbri.xml diff --git a/effects/invert.frag b/effects/shaders/invert.frag similarity index 100% rename from effects/invert.frag rename to effects/shaders/invert.frag diff --git a/effects/invert.xml b/effects/shaders/invert.xml similarity index 100% rename from effects/invert.xml rename to effects/shaders/invert.xml diff --git a/effects/lumakey.frag b/effects/shaders/lumakey.frag similarity index 100% rename from effects/lumakey.frag rename to effects/shaders/lumakey.frag diff --git a/effects/lumakey.xml b/effects/shaders/lumakey.xml similarity index 100% rename from effects/lumakey.xml rename to effects/shaders/lumakey.xml diff --git a/effects/noise.frag b/effects/shaders/noise.frag similarity index 100% rename from effects/noise.frag rename to effects/shaders/noise.frag diff --git a/effects/noise.xml b/effects/shaders/noise.xml similarity index 100% rename from effects/noise.xml rename to effects/shaders/noise.xml diff --git a/effects/pixelate.frag b/effects/shaders/pixelate.frag similarity index 100% rename from effects/pixelate.frag rename to effects/shaders/pixelate.frag diff --git a/effects/pixelate.xml b/effects/shaders/pixelate.xml similarity index 100% rename from effects/pixelate.xml rename to effects/shaders/pixelate.xml diff --git a/effects/posterize.frag b/effects/shaders/posterize.frag similarity index 100% rename from effects/posterize.frag rename to effects/shaders/posterize.frag diff --git a/effects/posterize.xml b/effects/shaders/posterize.xml similarity index 100% rename from effects/posterize.xml rename to effects/shaders/posterize.xml diff --git a/effects/radialblur.frag b/effects/shaders/radialblur.frag similarity index 100% rename from effects/radialblur.frag rename to effects/shaders/radialblur.frag diff --git a/effects/radialblur.xml b/effects/shaders/radialblur.xml similarity index 100% rename from effects/radialblur.xml rename to effects/shaders/radialblur.xml diff --git a/effects/ripple.frag b/effects/shaders/ripple.frag similarity index 100% rename from effects/ripple.frag rename to effects/shaders/ripple.frag diff --git a/effects/ripple.xml b/effects/shaders/ripple.xml similarity index 100% rename from effects/ripple.xml rename to effects/shaders/ripple.xml diff --git a/effects/sphere.frag b/effects/shaders/sphere.frag similarity index 100% rename from effects/sphere.frag rename to effects/shaders/sphere.frag diff --git a/effects/sphere.xml b/effects/shaders/sphere.xml similarity index 100% rename from effects/sphere.xml rename to effects/shaders/sphere.xml diff --git a/effects/swirl.frag b/effects/shaders/swirl.frag similarity index 100% rename from effects/swirl.frag rename to effects/shaders/swirl.frag diff --git a/effects/swirl.xml b/effects/shaders/swirl.xml similarity index 100% rename from effects/swirl.xml rename to effects/shaders/swirl.xml diff --git a/effects/tile.frag b/effects/shaders/tile.frag similarity index 100% rename from effects/tile.frag rename to effects/shaders/tile.frag diff --git a/effects/tile.xml b/effects/shaders/tile.xml similarity index 100% rename from effects/tile.xml rename to effects/shaders/tile.xml diff --git a/effects/toonify.frag b/effects/shaders/toonify.frag similarity index 100% rename from effects/toonify.frag rename to effects/shaders/toonify.frag diff --git a/effects/toonify.xml b/effects/shaders/toonify.xml similarity index 100% rename from effects/toonify.xml rename to effects/shaders/toonify.xml diff --git a/effects/vignette.frag b/effects/shaders/vignette.frag similarity index 100% rename from effects/vignette.frag rename to effects/shaders/vignette.frag diff --git a/effects/vignette.xml b/effects/shaders/vignette.xml similarity index 100% rename from effects/vignette.xml rename to effects/shaders/vignette.xml diff --git a/effects/volumetriclight.frag b/effects/shaders/volumetriclight.frag similarity index 100% rename from effects/volumetriclight.frag rename to effects/shaders/volumetriclight.frag diff --git a/effects/volumetriclight.xml b/effects/shaders/volumetriclight.xml similarity index 100% rename from effects/volumetriclight.xml rename to effects/shaders/volumetriclight.xml diff --git a/effects/wave.frag b/effects/shaders/wave.frag similarity index 100% rename from effects/wave.frag rename to effects/shaders/wave.frag diff --git a/effects/wave.xml b/effects/shaders/wave.xml similarity index 100% rename from effects/wave.xml rename to effects/shaders/wave.xml diff --git a/project/transition.cpp b/effects/transition.cpp similarity index 92% rename from project/transition.cpp rename to effects/transition.cpp index aaf1b811c..1378823c3 100644 --- a/project/transition.cpp +++ b/effects/transition.cpp @@ -20,12 +20,12 @@ #include "transition.h" -#include "mainwindow.h" -#include "clip.h" -#include "sequence.h" -#include "debug.h" +#include "ui/mainwindow.h" +#include "timeline/clip.h" +#include "timeline/sequence.h" +#include "global/debug.h" -#include "io/clipboard.h" +#include "project/clipboard.h" #include "effects/internal/crossdissolvetransition.h" #include "effects/internal/linearfadetransition.h" @@ -49,7 +49,7 @@ Transition::Transition(Clip *c, Clip *s, const EffectMeta* em) : length_field = new DoubleField(length_row, "length"); length_field->SetDefault(30); length_field->SetMinimum(0); - length_field->SetDisplayType(LabelSlider::LABELSLIDER_FRAMENUMBER); + length_field->SetDisplayType(LabelSlider::FrameNumber); length_field->SetFrameRate(parent_clip->sequence == nullptr ? parent_clip->cached_frame_rate() : parent_clip->sequence->frame_rate); connect(length_field, SIGNAL(changed()), this, SLOT(set_length_from_slider())); diff --git a/project/transition.h b/effects/transition.h similarity index 100% rename from project/transition.h rename to effects/transition.h diff --git a/io/config.cpp b/global/config.cpp similarity index 100% rename from io/config.cpp rename to global/config.cpp diff --git a/io/config.h b/global/config.h similarity index 100% rename from io/config.h rename to global/config.h diff --git a/io/crossplatformlib.cpp b/global/crossplatformlib.cpp similarity index 100% rename from io/crossplatformlib.cpp rename to global/crossplatformlib.cpp diff --git a/io/crossplatformlib.h b/global/crossplatformlib.h similarity index 100% rename from io/crossplatformlib.h rename to global/crossplatformlib.h diff --git a/debug.cpp b/global/debug.cpp similarity index 100% rename from debug.cpp rename to global/debug.cpp diff --git a/debug.h b/global/debug.h similarity index 100% rename from debug.h rename to global/debug.h diff --git a/oliveglobal.cpp b/global/global.cpp similarity index 95% rename from oliveglobal.cpp rename to global/global.cpp index 07dd08970..9df7c5143 100644 --- a/oliveglobal.cpp +++ b/global/global.cpp @@ -18,16 +18,14 @@ ***/ -#include "oliveglobal.h" +#include "global/global.h" -#include "mainwindow.h" #include "panels/panels.h" -#include "io/path.h" -#include "io/config.h" +#include "global/path.h" +#include "global/config.h" -#include "ui/mediaiconservice.h" #include "rendering/audio.h" @@ -39,8 +37,10 @@ #include "dialogs/speeddialog.h" #include "dialogs/actionsearch.h" -#include "project/sequence.h" +#include "timeline/sequence.h" +#include "ui/mediaiconservice.h" +#include "ui/mainwindow.h" #include "ui/updatenotification.h" #include diff --git a/oliveglobal.h b/global/global.h similarity index 96% rename from oliveglobal.h rename to global/global.h index 305beefb8..429960a11 100644 --- a/oliveglobal.h +++ b/global/global.h @@ -22,7 +22,7 @@ #define OLIVEGLOBAL_H #include -#include "project/undo.h" +#include "undo/undo.h" #include #include diff --git a/io/math.cpp b/global/math.cpp similarity index 100% rename from io/math.cpp rename to global/math.cpp diff --git a/io/math.h b/global/math.h similarity index 100% rename from io/math.h rename to global/math.h diff --git a/io/path.cpp b/global/path.cpp similarity index 100% rename from io/path.cpp rename to global/path.cpp diff --git a/io/path.h b/global/path.h similarity index 100% rename from io/path.h rename to global/path.h diff --git a/io/qpainterwrapper.cpp b/io/qpainterwrapper.cpp deleted file mode 100644 index 9d37e7641..000000000 --- a/io/qpainterwrapper.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/*** - - Olive - Non-Linear Video Editor - Copyright (C) 2019 Olive Team - - This 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 "qpainterwrapper.h" - -#include -#include "debug.h" - -// exposes several QPainter functions to QJSEngine - -QPainterWrapper painter_wrapper; - -QPainterWrapper::QPainterWrapper() {} - -QColor get_color_from_string(const QString& s) { - // workaround for alpha - if (s.at(0) == '#' && s.length() == 9) { - QColor color(s.left(7)); - color.setAlpha(s.mid(7).toInt(nullptr, 16)); - return color; - } else { - return QColor(s); - } -} - -void QPainterWrapper::fill(const QString& c) { - img->fill(get_color_from_string(c)); -} - -void QPainterWrapper::fillRect(int x, int y, int width, int height, const QString& brush) { - painter->fillRect(x, y, width, height, get_color_from_string(brush)); -} - -void QPainterWrapper::drawRect(int x, int y, int width, int height) { - painter->drawRect(x, y, width, height); -} - -void QPainterWrapper::setPen(const QString& pen) { - painter->setPen(get_color_from_string(pen)); -} - -void QPainterWrapper::setBrush(const QString& brush) { - painter->setBrush(get_color_from_string(brush)); -} diff --git a/io/qpainterwrapper.h b/io/qpainterwrapper.h deleted file mode 100644 index 1f217ef95..000000000 --- a/io/qpainterwrapper.h +++ /dev/null @@ -1,44 +0,0 @@ -/*** - - Olive - Non-Linear Video Editor - Copyright (C) 2019 Olive Team - - This 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 QPAINTERWRAPPER_H -#define QPAINTERWRAPPER_H - -#include - -class QPainter; - -class QPainterWrapper : public QObject { - Q_OBJECT -public: - QPainterWrapper(); - QImage* img; - QPainter* painter; -public slots: - void fill(const QString& color); - void fillRect(int x, int y, int width, int height, const QString& brush); - void drawRect(int x, int y, int width, int height); - void setPen(const QString& pen); - void setBrush(const QString& brush); -}; - -extern QPainterWrapper painter_wrapper; - -#endif // QPAINTERWRAPPER_H diff --git a/main.cpp b/main.cpp index 69f99ee5e..ed250177e 100644 --- a/main.cpp +++ b/main.cpp @@ -18,23 +18,21 @@ ***/ -#include "mainwindow.h" #include -#include "debug.h" - -#include "oliveglobal.h" -#include "ui/mediaiconservice.h" +#include "global/debug.h" +#include "global/config.h" +#include "global/global.h" #include "panels/timeline.h" - -#include "io/config.h" +#include "ui/mediaiconservice.h" +#include "ui/mainwindow.h" extern "C" { #include #include } -int main(int argc, char *argv[]) { +int main(int argc, char *argv[]) { olive::Global = std::unique_ptr(new OliveGlobal); bool launch_fullscreen = false; diff --git a/olive.pro b/olive.pro index baa966ea2..252f51051 100644 --- a/olive.pro +++ b/olive.pro @@ -54,7 +54,7 @@ CONFIG(debug, debug|release) { SOURCES += \ main.cpp \ - mainwindow.cpp \ + ui/mainwindow.cpp \ panels/project.cpp \ panels/effectcontrols.cpp \ panels/viewer.cpp \ @@ -64,22 +64,22 @@ SOURCES += \ ui/timelinewidget.cpp \ project/media.cpp \ project/footage.cpp \ - project/sequence.cpp \ - project/clip.cpp \ - io/config.cpp \ + timeline/sequence.cpp \ + timeline/clip.cpp \ + global/config.cpp \ dialogs/newsequencedialog.cpp \ ui/viewerwidget.cpp \ ui/viewercontainer.cpp \ dialogs/exportdialog.cpp \ ui/collapsiblewidget.cpp \ panels/panels.cpp \ - io/exportthread.cpp \ + rendering/exportthread.cpp \ ui/timelineheader.cpp \ - io/previewgenerator.cpp \ + project/previewgenerator.cpp \ ui/labelslider.cpp \ dialogs/preferencesdialog.cpp \ ui/audiomonitor.cpp \ - project/undo.cpp \ + undo/undo.cpp \ ui/scrollarea.cpp \ ui/comboboxex.cpp \ ui/colorbutton.cpp \ @@ -89,14 +89,14 @@ SOURCES += \ ui/keyframeview.cpp \ ui/texteditex.cpp \ dialogs/demonotice.cpp \ - project/marker.cpp \ + timeline/marker.cpp \ dialogs/speeddialog.cpp \ dialogs/mediapropertiesdialog.cpp \ project/projectmodel.cpp \ - io/loadthread.cpp \ + project/loadthread.cpp \ dialogs/loaddialog.cpp \ - debug.cpp \ - io/path.cpp \ + global/debug.cpp \ + global/path.cpp \ effects/internal/linearfadetransition.cpp \ effects/internal/transformeffect.cpp \ effects/internal/solideffect.cpp \ @@ -111,13 +111,11 @@ SOURCES += \ effects/internal/exponentialfadetransition.cpp \ effects/internal/logarithmicfadetransition.cpp \ effects/internal/cornerpineffect.cpp \ - io/math.cpp \ - io/qpainterwrapper.cpp \ - project/effect.cpp \ - project/transition.cpp \ - project/effectrow.cpp \ - project/effectgizmo.cpp \ - io/clipboard.cpp \ + global/math.cpp \ + effects/effect.cpp \ + effects/effectrow.cpp \ + effects/effectgizmo.cpp \ + project/clipboard.cpp \ ui/resizablescrollbar.cpp \ ui/sourceiconview.cpp \ project/sourcescommon.cpp \ @@ -126,7 +124,7 @@ SOURCES += \ ui/graphview.cpp \ ui/keyframedrawing.cpp \ ui/clickablelabel.cpp \ - project/keyframe.cpp \ + effects/keyframe.cpp \ ui/rectangleselect.cpp \ dialogs/actionsearch.cpp \ ui/embeddedfilechooser.cpp \ @@ -137,18 +135,18 @@ SOURCES += \ ui/viewerwindow.cpp \ project/projectfilter.cpp \ effects/internal/frei0reffect.cpp \ - project/effectloaders.cpp \ - io/crossplatformlib.cpp \ + effects/effectloaders.cpp \ + global/crossplatformlib.cpp \ effects/internal/vsthost.cpp \ ui/flowlayout.cpp \ dialogs/proxydialog.cpp \ - io/proxygenerator.cpp \ + project/proxygenerator.cpp \ dialogs/advancedvideodialog.cpp \ ui/cursors.cpp \ ui/menuhelper.cpp \ - oliveglobal.cpp \ + global/global.cpp \ ui/focusfilter.cpp \ - project/comboaction.cpp \ + undo/comboaction.cpp \ ui/mediaiconservice.cpp \ ui/panel.cpp \ effects/internal/dropshadoweffect.cpp \ @@ -161,20 +159,21 @@ SOURCES += \ rendering/framebufferobject.cpp \ ui/updatenotification.cpp \ ui/icons.cpp \ - project/effectfields/doublefield.cpp \ - project/effectfields/fontfield.cpp \ - project/effectfields/effectfield.cpp \ - project/effectfields/colorfield.cpp \ - project/effectfields/stringfield.cpp \ - project/effectfields/boolfield.cpp \ - project/effectfields/combofield.cpp \ - project/effectfields/filefield.cpp \ - project/effectfields/labelfield.cpp \ - project/effectfields/buttonfield.cpp \ - ui/effectui.cpp + effects/fields/doublefield.cpp \ + effects/fields/fontfield.cpp \ + effects/effectfield.cpp \ + effects/fields/colorfield.cpp \ + effects/fields/stringfield.cpp \ + effects/fields/boolfield.cpp \ + effects/fields/combofield.cpp \ + effects/fields/filefield.cpp \ + effects/fields/labelfield.cpp \ + effects/fields/buttonfield.cpp \ + ui/effectui.cpp \ + effects/transition.cpp HEADERS += \ - mainwindow.h \ + ui/mainwindow.h \ panels/project.h \ panels/effectcontrols.h \ panels/viewer.h \ @@ -184,23 +183,23 @@ HEADERS += \ ui/timelinewidget.h \ project/media.h \ project/footage.h \ - project/sequence.h \ - project/clip.h \ - io/config.h \ + timeline/sequence.h \ + timeline/clip.h \ + global/config.h \ dialogs/newsequencedialog.h \ ui/viewerwidget.h \ ui/viewercontainer.h \ dialogs/exportdialog.h \ ui/collapsiblewidget.h \ panels/panels.h \ - io/exportthread.h \ + rendering/exportthread.h \ ui/timelinetools.h \ ui/timelineheader.h \ - io/previewgenerator.h \ + project/previewgenerator.h \ ui/labelslider.h \ dialogs/preferencesdialog.h \ ui/audiomonitor.h \ - project/undo.h \ + undo/undo.h \ ui/scrollarea.h \ ui/comboboxex.h \ ui/colorbutton.h \ @@ -210,15 +209,15 @@ HEADERS += \ ui/keyframeview.h \ ui/texteditex.h \ dialogs/demonotice.h \ - project/marker.h \ - project/selection.h \ + timeline/marker.h \ + timeline/selection.h \ dialogs/speeddialog.h \ dialogs/mediapropertiesdialog.h \ project/projectmodel.h \ - io/loadthread.h \ + project/loadthread.h \ dialogs/loaddialog.h \ - debug.h \ - io/path.h \ + global/debug.h \ + global/path.h \ effects/internal/transformeffect.h \ effects/internal/solideffect.h \ effects/internal/texteffect.h \ @@ -233,14 +232,12 @@ HEADERS += \ effects/internal/exponentialfadetransition.h \ effects/internal/logarithmicfadetransition.h \ effects/internal/cornerpineffect.h \ - io/math.h \ - io/qpainterwrapper.h \ - project/effect.h \ - project/transition.h \ - project/effectrow.h \ + global/math.h \ + effects/effect.h \ + effects/effectrow.h \ effects/internal/cubetransition.h \ - project/effectgizmo.h \ - io/clipboard.h \ + effects/effectgizmo.h \ + project/clipboard.h \ ui/resizablescrollbar.h \ ui/sourceiconview.h \ project/sourcescommon.h \ @@ -249,7 +246,7 @@ HEADERS += \ ui/graphview.h \ ui/keyframedrawing.h \ ui/clickablelabel.h \ - project/keyframe.h \ + effects/keyframe.h \ ui/rectangleselect.h \ dialogs/actionsearch.h \ ui/embeddedfilechooser.h \ @@ -260,19 +257,19 @@ HEADERS += \ ui/viewerwindow.h \ project/projectfilter.h \ effects/internal/frei0reffect.h \ - project/effectloaders.h \ - io/crossplatformlib.h \ + effects/effectloaders.h \ + global/crossplatformlib.h \ effects/internal/vsthost.h \ ui/flowlayout.h \ dialogs/proxydialog.h \ - io/proxygenerator.h \ + project/proxygenerator.h \ dialogs/advancedvideodialog.h \ ui/cursors.h \ ui/menuhelper.h \ - oliveglobal.h \ + global/global.h \ project/projectelements.h \ ui/focusfilter.h \ - project/comboaction.h \ + undo/comboaction.h \ ui/mediaiconservice.h \ ui/panel.h \ effects/internal/dropshadoweffect.h \ @@ -285,18 +282,19 @@ HEADERS += \ rendering/framebufferobject.h \ ui/updatenotification.h \ ui/icons.h \ - project/effectfields/doublefield.h \ - project/effectfields/fontfield.h \ - project/effectfields/effectfield.h \ - project/effectfields.h \ - project/effectfields/colorfield.h \ - project/effectfields/stringfield.h \ - project/effectfields/boolfield.h \ - project/effectfields/combofield.h \ - project/effectfields/filefield.h \ - project/effectfields/labelfield.h \ - project/effectfields/buttonfield.h \ - ui/effectui.h + effects/fields/doublefield.h \ + effects/fields/fontfield.h \ + effects/effectfield.h \ + effects/effectfields.h \ + effects/fields/stringfield.h \ + effects/fields/filefield.h \ + effects/fields/labelfield.h \ + ui/effectui.h \ + effects/fields/boolfield.h \ + effects/fields/buttonfield.h \ + effects/fields/colorfield.h \ + effects/fields/combofield.h \ + effects/transition.h FORMS += diff --git a/panels/effectcontrols.cpp b/panels/effectcontrols.cpp index 4feaa3e05..326016598 100644 --- a/panels/effectcontrols.cpp +++ b/panels/effectcontrols.cpp @@ -33,24 +33,24 @@ #include #include "panels/panels.h" -#include "project/effect.h" -#include "project/clip.h" -#include "project/transition.h" +#include "effects/effect.h" +#include "effects/transition.h" +#include "timeline/clip.h" #include "ui/collapsiblewidget.h" -#include "project/sequence.h" -#include "project/undo.h" +#include "timeline/sequence.h" +#include "undo/undo.h" #include "panels/project.h" #include "panels/timeline.h" #include "panels/viewer.h" #include "panels/grapheditor.h" #include "ui/viewerwidget.h" #include "ui/menuhelper.h" -#include "io/clipboard.h" -#include "io/config.h" +#include "project/clipboard.h" +#include "global/config.h" #include "ui/timelineheader.h" #include "ui/keyframeview.h" #include "ui/resizablescrollbar.h" -#include "debug.h" +#include "global/debug.h" EffectControls::EffectControls(QWidget *parent) : Panel(parent), @@ -130,6 +130,22 @@ void EffectControls::menu_select(QAction* q) { } void EffectControls::update_keyframes() { + for (int i=0;iGetEffect(); + + for (int j=0;jrow_count();j++) { + + EffectRow* row = effect->row(j); + + for (int k=0;kFieldCount();k++) { + EffectField* field = row->Field(k); + + field->UpdateWidgetValue(ui->Widget(j, k), field->Now()); + } + } + } + headers->update_zoom(zoom); keyframeView->update(); } diff --git a/panels/grapheditor.cpp b/panels/grapheditor.cpp index cfe9d6723..6f720da10 100644 --- a/panels/grapheditor.cpp +++ b/panels/grapheditor.cpp @@ -30,13 +30,13 @@ #include "ui/timelinetools.h" #include "ui/labelslider.h" #include "ui/graphview.h" -#include "project/effect.h" -#include "project/effectfields.h" -#include "project/effectrow.h" -#include "project/clip.h" +#include "effects/effect.h" +#include "effects/effectfields.h" +#include "effects/effectrow.h" +#include "timeline/clip.h" #include "rendering/renderfunctions.h" #include "panels.h" -#include "debug.h" +#include "global/debug.h" GraphEditor::GraphEditor(QWidget* parent) : Panel(parent), row(nullptr) { resize(720, 480); @@ -144,10 +144,10 @@ void GraphEditor::update_panel() { for (int i=0;iFieldCount();i++) { EffectField* field = row->Field(i); if (field->type() == EffectField::EFFECT_FIELD_DOUBLE) { - slider_proxies.at(slider_index)->set_value( - row->Field(i)->GetValueAt(playhead_to_clip_seconds(field->GetParentRow()->GetParentEffect()->parent_clip, - olive::ActiveSequence->playhead)).toDouble(), - false + slider_proxies.at(slider_index)->SetValue( + row->Field(i)->GetValueAt( + playhead_to_clip_seconds(field->GetParentRow()->GetParentEffect()->parent_clip, + olive::ActiveSequence->playhead)).toDouble() ); slider_index++; } @@ -192,7 +192,7 @@ void GraphEditor::set_row(EffectRow *r) { value_layout->addWidget(slider_button); LabelSlider* slider = new LabelSlider(); - slider->set_color(get_curve_color(i, r->FieldCount()).name()); + slider->SetColor(get_curve_color(i, r->FieldCount()).name()); connect(slider, SIGNAL(valueChanged()), this, SLOT(passthrough_slider_value())); slider_proxies.append(slider); value_layout->addWidget(slider); @@ -250,7 +250,7 @@ void GraphEditor::set_key_button_enabled(bool e, int type) { void GraphEditor::passthrough_slider_value() { for (int i=0;iset_value(slider_proxies.at(i)->value(), true); + slider_proxy_sources.at(i)->SetValue(slider_proxies.at(i)->value()); } } } diff --git a/panels/grapheditor.h b/panels/grapheditor.h index 826c7bcac..0ba0f3136 100644 --- a/panels/grapheditor.h +++ b/panels/grapheditor.h @@ -30,7 +30,7 @@ #include "ui/timelineheader.h" #include "ui/labelslider.h" #include "ui/keyframenavigator.h" -#include "project/effectrow.h" +#include "effects/effectrow.h" class GraphEditor : public Panel { Q_OBJECT diff --git a/panels/panels.cpp b/panels/panels.cpp index cdd3691ef..6d8cb3ad5 100644 --- a/panels/panels.cpp +++ b/panels/panels.cpp @@ -20,13 +20,12 @@ #include "panels.h" -#include "project/sequence.h" -#include "project/clip.h" -#include "project/transition.h" -#include "io/config.h" - -#include "project/effectloaders.h" -#include "debug.h" +#include "timeline/sequence.h" +#include "timeline/clip.h" +#include "effects/transition.h" +#include "global/config.h" +#include "effects/effectloaders.h" +#include "global/debug.h" #include #include @@ -43,62 +42,6 @@ void update_effect_controls() { int mode = kTransitionNone; if (olive::ActiveSequence != nullptr) { - /* - for (int i=0;iclips.size();i++) { - Clip* clip = olive::ActiveSequence->clips.at(i).get(); - if (clip != nullptr) { - for (int j=0;jselections.size();j++) { - const Selection& s = olive::ActiveSequence->selections.at(j); - bool add = true; - if (clip->timeline_in() >= s.in && clip->timeline_out() <= s.out && clip->track() == s.track) { - mode = kTransitionNone; - } else if (selection_contains_transition(s, clip, kTransitionOpening)) { - mode = kTransitionOpening; - } else if (selection_contains_transition(s, clip, kTransitionClosing)) { - mode = kTransitionClosing; - } else { - add = false; - } - - if (add) { - if (clip->track() < 0 && vclip == -1) { - vclip = i; - } else if (clip->track() >= 0 && aclip == -1) { - aclip = i; - } else { - vclip = -2; - aclip = -2; - multiple = true; - multiple = true; - break; - } - } - } - } - } - - if (!multiple) { - // check if aclip is linked to vclip - if (vclip >= 0) selected_clips.append(vclip); - if (aclip >= 0) selected_clips.append(aclip); - if (vclip >= 0 && aclip >= 0) { - bool found = false; - ClipPtr vclip_ref = olive::ActiveSequence->clips.at(vclip); - for (int i=0;ilinked.size();i++) { - if (vclip_ref->linked.at(i) == aclip) { - found = true; - break; - } - } - if (!found) { - // only display multiple clips if they're linked - selected_clips.clear(); - multiple = true; - } - } - } - */ - selected_clips = olive::ActiveSequence->SelectedClips(); // TODO handle selecting transitions diff --git a/panels/project.cpp b/panels/project.cpp index 86fe5dbf6..a609c5147 100644 --- a/panels/project.cpp +++ b/panels/project.cpp @@ -20,21 +20,20 @@ #include "project.h" -#include "oliveglobal.h" - +#include "global/global.h" #include "panels.h" #include "rendering/renderfunctions.h" -#include "io/previewgenerator.h" -#include "project/undo.h" -#include "mainwindow.h" -#include "io/config.h" +#include "project/previewgenerator.h" +#include "undo/undo.h" +#include "ui/mainwindow.h" +#include "global/config.h" #include "rendering/cacher.h" #include "dialogs/replaceclipmediadialog.h" #include "panels/effectcontrols.h" #include "dialogs/newsequencedialog.h" #include "dialogs/mediapropertiesdialog.h" #include "dialogs/loaddialog.h" -#include "io/clipboard.h" +#include "project/clipboard.h" #include "ui/sourcetable.h" #include "ui/sourceiconview.h" #include "ui/icons.h" @@ -42,7 +41,7 @@ #include "ui/mediaiconservice.h" #include "project/sourcescommon.h" #include "project/projectfilter.h" -#include "debug.h" +#include "global/debug.h" #include #include diff --git a/panels/project.h b/panels/project.h index 6c12294e3..4ee1d779f 100644 --- a/panels/project.h +++ b/panels/project.h @@ -32,10 +32,10 @@ #include "project/projectmodel.h" #include "project/projectfilter.h" #include "project/projectelements.h" -#include "project/undo.h" #include "project/sourcescommon.h" #include "ui/panel.h" #include "ui/sourceiconview.h" +#include "undo/undo.h" #include "ui/sourcetable.h" diff --git a/panels/timeline.cpp b/panels/timeline.cpp index 48db4b0df..06d41798b 100644 --- a/panels/timeline.cpp +++ b/panels/timeline.cpp @@ -20,26 +20,24 @@ #include "timeline.h" -#include "oliveglobal.h" - +#include "global/global.h" #include "panels/panels.h" #include "project/projectelements.h" - #include "ui/timelinewidget.h" #include "ui/icons.h" #include "ui/viewerwidget.h" #include "rendering/audio.h" #include "rendering/cacher.h" #include "rendering/renderfunctions.h" -#include "io/config.h" -#include "io/clipboard.h" +#include "global/config.h" +#include "project/clipboard.h" #include "ui/timelineheader.h" #include "ui/resizablescrollbar.h" #include "ui/audiomonitor.h" #include "ui/flowlayout.h" #include "ui/cursors.h" -#include "mainwindow.h" -#include "debug.h" +#include "ui/mainwindow.h" +#include "global/debug.h" #include #include diff --git a/panels/timeline.h b/panels/timeline.h index 198e23c46..028c8977f 100644 --- a/panels/timeline.h +++ b/panels/timeline.h @@ -27,9 +27,9 @@ #include "ui/timelinewidget.h" #include "ui/timelinetools.h" -#include "project/selection.h" -#include "project/clip.h" -#include "project/undo.h" +#include "timeline/selection.h" +#include "timeline/clip.h" +#include "undo/undo.h" #include "ui/timelineheader.h" #include "ui/resizablescrollbar.h" #include "ui/audiomonitor.h" diff --git a/panels/viewer.cpp b/panels/viewer.cpp index dce62dd18..67c1f2c35 100644 --- a/panels/viewer.cpp +++ b/panels/viewer.cpp @@ -24,13 +24,13 @@ #include "timeline.h" #include "panels/project.h" #include "panels/effectcontrols.h" -#include "project/sequence.h" -#include "project/clip.h" +#include "timeline/sequence.h" +#include "timeline/clip.h" #include "panels/panels.h" -#include "io/config.h" +#include "global/config.h" #include "project/footage.h" #include "project/media.h" -#include "project/undo.h" +#include "undo/undo.h" #include "ui/audiomonitor.h" #include "rendering/renderfunctions.h" #include "ui/viewercontainer.h" @@ -38,8 +38,8 @@ #include "ui/timelineheader.h" #include "ui/resizablescrollbar.h" #include "ui/icons.h" -#include "oliveglobal.h" -#include "debug.h" +#include "global/global.h" +#include "global/debug.h" #define FRAMES_IN_ONE_MINUTE 1798 // 1800 - 2 #define FRAMES_IN_TEN_MINUTES 17978 // (FRAMES_IN_ONE_MINUTE * 10) - 2 @@ -79,10 +79,10 @@ Viewer::Viewer(QWidget *parent) : set_media(nullptr); current_timecode_slider->setEnabled(false); - current_timecode_slider->set_minimum_value(0); - current_timecode_slider->set_default_value(qSNaN()); - current_timecode_slider->set_value(0, false); - current_timecode_slider->set_display_type(LabelSlider::LABELSLIDER_FRAMENUMBER); + current_timecode_slider->SetMinimum(0); + current_timecode_slider->SetDefault(qSNaN()); + current_timecode_slider->SetValue(0); + current_timecode_slider->SetDisplayType(LabelSlider::FrameNumber); connect(current_timecode_slider, SIGNAL(valueChanged(double)), this, SLOT(update_playhead())); recording_flasher.setInterval(500); @@ -479,7 +479,7 @@ bool Viewer::WaitingForPlayWake() } void Viewer::update_playhead_timecode(long p) { - current_timecode_slider->set_value(p, false); + current_timecode_slider->SetValue(p); } void Viewer::update_end_timecode() { @@ -884,7 +884,7 @@ void Viewer::set_sequence(bool main, SequencePtr s) { go_to_end_frame->setEnabled(!null_sequence); if (!null_sequence) { - current_timecode_slider->set_frame_rate(seq->frame_rate); + current_timecode_slider->SetFrameRate(seq->frame_rate); playback_updater.setInterval(qFloor(1000 / seq->frame_rate)); diff --git a/panels/viewer.h b/panels/viewer.h index 0f4ad5bb8..8376fee6d 100644 --- a/panels/viewer.h +++ b/panels/viewer.h @@ -26,7 +26,7 @@ #include #include -#include "project/marker.h" +#include "timeline/marker.h" #include "project/media.h" #include "ui/panel.h" diff --git a/io/clipboard.cpp b/project/clipboard.cpp similarity index 86% rename from io/clipboard.cpp rename to project/clipboard.cpp index cd5de7902..47a13385b 100644 --- a/io/clipboard.cpp +++ b/project/clipboard.cpp @@ -20,15 +20,15 @@ #include "clipboard.h" -#include "project/clip.h" -#include "project/effect.h" -#include "project/transition.h" +#include "timeline/clip.h" +#include "effects/effect.h" +#include "effects/transition.h" int clipboard_type = CLIPBOARD_TYPE_CLIP; QVector clipboard; QVector clipboard_transitions; void clear_clipboard() { - clipboard.clear(); - clipboard_transitions.clear(); + clipboard.clear(); + clipboard_transitions.clear(); } diff --git a/io/clipboard.h b/project/clipboard.h similarity index 97% rename from io/clipboard.h rename to project/clipboard.h index 5cb005d2b..4ca8c580d 100644 --- a/io/clipboard.h +++ b/project/clipboard.h @@ -23,7 +23,7 @@ #include -#include +#include #define CLIPBOARD_TYPE_CLIP 0 #define CLIPBOARD_TYPE_EFFECT 1 diff --git a/project/effectfields.h b/project/effectfields.h deleted file mode 100644 index c05a3d4df..000000000 --- a/project/effectfields.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef EFFECTFIELDS_H -#define EFFECTFIELDS_H - -#include "effectfields/boolfield.h" -#include "effectfields/buttonfield.h" -#include "effectfields/colorfield.h" -#include "effectfields/combofield.h" -#include "effectfields/doublefield.h" -#include "effectfields/filefield.h" -#include "effectfields/fontfield.h" -#include "effectfields/labelfield.h" -#include "effectfields/stringfield.h" - -#endif // EFFECTFIELDS_H diff --git a/project/effectloaders.cpp b/project/effectloaders.cpp deleted file mode 100644 index 443caec1e..000000000 --- a/project/effectloaders.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/*** - - Olive - Non-Linear Video Editor - Copyright (C) 2019 Olive Team - - This 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 "effectloaders.h" - -#include "project/effect.h" -#include "project/transition.h" -#include "io/path.h" -#include "panels/panels.h" -#include "panels/effectcontrols.h" -#include "io/crossplatformlib.h" -#include "io/config.h" - -#include -#include - -#include - -#ifndef NOFREI0R -#include -typedef void (*f0rGetPluginInfo)(f0r_plugin_info_t* info); -#endif - -void load_internal_effects() { - if (!olive::CurrentRuntimeConfig.shaders_are_enabled) qWarning() << "Shaders are disabled, some effects may be nonfunctional"; - - EffectMeta em; - - // load internal effects - em.path = ":/internalshaders"; - - em.type = EFFECT_TYPE_EFFECT; - em.subtype = EFFECT_TYPE_AUDIO; - - em.name = "Volume"; - em.internal = EFFECT_INTERNAL_VOLUME; - effects.append(em); - - em.name = "Pan"; - em.internal = EFFECT_INTERNAL_PAN; - effects.append(em); - -#ifndef NOVST - em.name = "VST Plugin 2.x"; - em.internal = EFFECT_INTERNAL_VST; - effects.append(em); -#endif - - em.name = "Tone"; - em.internal = EFFECT_INTERNAL_TONE; - effects.append(em); - - em.name = "Noise"; - em.internal = EFFECT_INTERNAL_NOISE; - effects.append(em); - - em.name = "Fill Left/Right"; - em.internal = EFFECT_INTERNAL_FILLLEFTRIGHT; - effects.append(em); - - em.subtype = EFFECT_TYPE_VIDEO; - - em.name = "Transform"; - em.category = "Distort"; - em.internal = EFFECT_INTERNAL_TRANSFORM; - effects.append(em); - - em.name = "Corner Pin"; - em.internal = EFFECT_INTERNAL_CORNERPIN; - effects.append(em); - - /*em.name = "Mask"; - em.internal = EFFECT_INTERNAL_MASK; - effects.append(em);*/ - - em.name = "Shake"; - em.internal = EFFECT_INTERNAL_SHAKE; - effects.append(em); - - em.name = "Text"; - em.category = "Render"; - em.internal = EFFECT_INTERNAL_TEXT; - effects.append(em); - - em.name = "Timecode"; - em.internal = EFFECT_INTERNAL_TIMECODE; - effects.append(em); - - em.name = "Solid"; - em.internal = EFFECT_INTERNAL_SOLID; - effects.append(em); - - // internal transitions - em.type = EFFECT_TYPE_TRANSITION; - em.category = ""; - - em.name = "Cross Dissolve"; - em.internal = TRANSITION_INTERNAL_CROSSDISSOLVE; - effects.append(em); - - em.subtype = EFFECT_TYPE_AUDIO; - - em.name = "Linear Fade"; - em.internal = TRANSITION_INTERNAL_LINEARFADE; - effects.append(em); - - em.name = "Exponential Fade"; - em.internal = TRANSITION_INTERNAL_EXPONENTIALFADE; - effects.append(em); - - em.name = "Logarithmic Fade"; - em.internal = TRANSITION_INTERNAL_LOGARITHMICFADE; - effects.append(em); -} - -void load_shader_effects() { - QList effects_paths = get_effects_paths(); - - for (int h=0;h entries = effects_dir.entryList(QStringList("*.xml"), QDir::Files); - for (int i=0;istart(); -} - -#ifndef NOFREI0R -void load_frei0r_effects_worker(const QString& dir, EffectMeta& em, QVector& loaded_names) { - QDir search_dir(dir); - if (search_dir.exists()) { - QList entry_list = search_dir.entryList(LibFilter(), QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot); - for (int j=0;j(LibAddress(effect, "f0r_get_plugin_info")); - if (get_info_func != nullptr) { - f0r_plugin_info_t info; - get_info_func(&info); - - if (!loaded_names.contains(info.name) - && info.plugin_type == F0R_PLUGIN_TYPE_FILTER - && info.color_model == F0R_COLOR_MODEL_RGBA8888) { - em.name = info.name; - em.path = dir; - em.filename = entry_list.at(j); - em.tooltip = QString("%1\n%2\n%3\n%4").arg(em.name, info.author, info.explanation, em.filename); - - loaded_names.append(em.name); - - effects.append(em); - } -// qDebug() << "Found:" << info.name << "by" << info.author; - } - LibClose(effect); - } -// qDebug() << search_dir.filePath(entry_list.at(j)); - } - } - } -} - -void load_frei0r_effects() { - QList effect_dirs = get_effects_paths(); - - // add defined paths for frei0r plugins on unix -#if defined(__APPLE__) || defined(__linux__) || defined(__HAIKU__) - effect_dirs.prepend("/usr/lib/frei0r-1"); - effect_dirs.prepend("/usr/local/lib/frei0r-1"); - effect_dirs.prepend(QDir::homePath() + "/.frei0r-1/lib"); -#endif - - QString env_path(qgetenv("FREI0R_PATH")); - if (!env_path.isEmpty()) effect_dirs.append(env_path); - - QVector loaded_names; - - // search for paths - EffectMeta em; - em.category = "Frei0r"; - em.type = EFFECT_TYPE_EFFECT; - em.subtype = EFFECT_TYPE_VIDEO; - em.internal = EFFECT_INTERNAL_FREI0R; - - for (int i=0;ieffects_loaded.lock(); -} - -void EffectInit::run() { - qInfo() << "Initializing effects..."; - load_internal_effects(); - load_shader_effects(); -#ifndef NOFREI0R - load_frei0r_effects(); -#endif - panel_effect_controls->effects_loaded.unlock(); - qInfo() << "Finished initializing effects"; -} diff --git a/project/footage.cpp b/project/footage.cpp index d4654410d..bde8c4c20 100644 --- a/project/footage.cpp +++ b/project/footage.cpp @@ -23,9 +23,9 @@ #include #include #include -#include "io/previewgenerator.h" -#include "project/clip.h" +#include "project/previewgenerator.h" +#include "timeline/clip.h" Footage::Footage() { ready = (false); @@ -38,56 +38,56 @@ Footage::Footage() { proxy = (false); start_number = 0; - ready_lock.lock(); + ready_lock.lock(); } Footage::~Footage() { - reset(); + reset(); } void Footage::reset() { - if (preview_gen != nullptr) { - preview_gen->cancel(); - } - video_tracks.clear(); - audio_tracks.clear(); - ready = false; + if (preview_gen != nullptr) { + preview_gen->cancel(); + } + video_tracks.clear(); + audio_tracks.clear(); + ready = false; } long Footage::get_length_in_frames(double frame_rate) { if (length >= 0) { return qFloor((double(length) / double(AV_TIME_BASE)) * frame_rate / speed); } - return 0; + return 0; } FootageStream* Footage::get_stream_from_file_index(bool video, int index) { - if (video) { - for (int i=0;i>1; - int sqx = (diff < 0) ? -diff : 0; - int sqy = (diff > 0) ? diff : 0; - p.drawImage(sqx, sqy, video_preview); - p.end(); - video_preview_square = QIcon(pixmap); + // generate square version for QListView? + int square_size = qMax(video_preview.width(), video_preview.height()); + QPixmap pixmap(square_size, square_size); + pixmap.fill(Qt::transparent); + QPainter p(&pixmap); + int diff = (video_preview.width() - video_preview.height())>>1; + int sqx = (diff < 0) ? -diff : 0; + int sqy = (diff > 0) ? diff : 0; + p.drawImage(sqx, sqy, video_preview); + p.end(); + video_preview_square = QIcon(pixmap); } diff --git a/project/footage.h b/project/footage.h index ffbd1a001..04ff51706 100644 --- a/project/footage.h +++ b/project/footage.h @@ -34,7 +34,7 @@ extern "C" { #include #include -#include "project/marker.h" +#include "timeline/marker.h" enum VideoInterlacingMode { VIDEO_PROGRESSIVE, diff --git a/io/loadthread.cpp b/project/loadthread.cpp similarity index 99% rename from io/loadthread.cpp rename to project/loadthread.cpp index 0e3582830..eca71eb90 100644 --- a/io/loadthread.cpp +++ b/project/loadthread.cpp @@ -20,19 +20,19 @@ #include "loadthread.h" -#include "oliveglobal.h" +#include "global/global.h" -#include "mainwindow.h" +#include "ui/mainwindow.h" #include "panels/panels.h" #include "project/projectelements.h" -#include "io/config.h" +#include "global/config.h" #include "rendering/renderfunctions.h" -#include "io/previewgenerator.h" +#include "project/previewgenerator.h" #include "effects/internal/voideffect.h" -#include "debug.h" +#include "global/debug.h" #include #include diff --git a/io/loadthread.h b/project/loadthread.h similarity index 98% rename from io/loadthread.h rename to project/loadthread.h index 5888bb99f..84badc682 100644 --- a/io/loadthread.h +++ b/project/loadthread.h @@ -29,6 +29,7 @@ #include #include "project/projectelements.h" +#include "timeline/clip.h" class LoadThread : public QThread { diff --git a/project/media.cpp b/project/media.cpp index bc0afa64b..2e56801ec 100644 --- a/project/media.cpp +++ b/project/media.cpp @@ -20,25 +20,24 @@ #include "media.h" -#include "footage.h" -#include "sequence.h" -#include "undo.h" -#include "io/config.h" -#include "panels/viewer.h" -#include "panels/project.h" -#include "ui/icons.h" -#include "projectmodel.h" - -#include -#include - -#include "debug.h" - extern "C" { #include #include } +#include +#include + +#include "footage.h" +#include "timeline/sequence.h" +#include "undo/undo.h" +#include "global/config.h" +#include "panels/viewer.h" +#include "panels/project.h" +#include "ui/icons.h" +#include "projectmodel.h" +#include "global/debug.h" + QString get_interlacing_name(int interlacing) { switch (interlacing) { case VIDEO_PROGRESSIVE: return QCoreApplication::translate("InterlacingName", "None (Progressive)"); diff --git a/project/media.h b/project/media.h index 3dd26f044..77d96519b 100644 --- a/project/media.h +++ b/project/media.h @@ -25,7 +25,7 @@ #include #include -#include "project/marker.h" +#include "timeline/marker.h" #include "project/footage.h" enum MediaType { diff --git a/io/previewgenerator.cpp b/project/previewgenerator.cpp similarity index 96% rename from io/previewgenerator.cpp rename to project/previewgenerator.cpp index 1f9143a3a..3597e744b 100644 --- a/io/previewgenerator.cpp +++ b/project/previewgenerator.cpp @@ -25,9 +25,9 @@ #include "project/footage.h" #include "panels/viewer.h" #include "panels/project.h" -#include "io/config.h" -#include "io/path.h" -#include "debug.h" +#include "global/config.h" +#include "global/path.h" +#include "global/debug.h" #include #include diff --git a/io/previewgenerator.h b/project/previewgenerator.h similarity index 100% rename from io/previewgenerator.h rename to project/previewgenerator.h diff --git a/project/projectelements.h b/project/projectelements.h index 2ec53d769..6868b19c3 100644 --- a/project/projectelements.h +++ b/project/projectelements.h @@ -30,12 +30,5 @@ // includes elements the user can use in a project #include "media.h" #include "footage.h" -#include "sequence.h" - -// includes elements the user can use in a sequence -#include "clip.h" -#include "transition.h" -#include "marker.h" -#include "effect.h" #endif // PROJECTELEMENTS_H diff --git a/project/projectfilter.cpp b/project/projectfilter.cpp index 72000a046..5bc330364 100644 --- a/project/projectfilter.cpp +++ b/project/projectfilter.cpp @@ -21,21 +21,21 @@ #include "projectfilter.h" #include "project/media.h" -#include "project/sequence.h" +#include "timeline/sequence.h" #include ProjectFilter::ProjectFilter(QObject *parent) : - QSortFilterProxyModel(parent), - show_sequences(true) + QSortFilterProxyModel(parent), + show_sequences(true) {} bool ProjectFilter::get_show_sequences() { - return show_sequences; + return show_sequences; } void ProjectFilter::set_show_sequences(bool b) { - show_sequences = b; + show_sequences = b; invalidateFilter(); } @@ -50,11 +50,11 @@ bool ProjectFilter::filterAcceptsRow(int source_row, const QModelIndex &source_p Media* media = static_cast(index.internalPointer()); // hide sequences if show_sequences is false - if (!show_sequences) { - if (media != nullptr && media->get_type() == MEDIA_TYPE_SEQUENCE) { - return false; - } - } + if (!show_sequences) { + if (media != nullptr && media->get_type() == MEDIA_TYPE_SEQUENCE) { + return false; + } + } // filter by search filter string if (!search_filter.isEmpty()) { @@ -80,5 +80,5 @@ bool ProjectFilter::filterAcceptsRow(int source_row, const QModelIndex &source_p } } - return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); + return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent); } diff --git a/project/projectmodel.cpp b/project/projectmodel.cpp index b1b5022c4..8c4c66f34 100644 --- a/project/projectmodel.cpp +++ b/project/projectmodel.cpp @@ -24,7 +24,7 @@ #include "panels/viewer.h" #include "ui/viewerwidget.h" #include "project/media.h" -#include "debug.h" +#include "global/debug.h" ProjectModel olive::project_model; diff --git a/io/proxygenerator.cpp b/project/proxygenerator.cpp similarity index 96% rename from io/proxygenerator.cpp rename to project/proxygenerator.cpp index cb37a5a0a..6a6cd11ce 100644 --- a/io/proxygenerator.cpp +++ b/project/proxygenerator.cpp @@ -20,9 +20,9 @@ #include "proxygenerator.h" -#include "io/path.h" -#include "io/previewgenerator.h" -#include "mainwindow.h" +#include "global/path.h" +#include "project/previewgenerator.h" +#include "ui/mainwindow.h" #include #include diff --git a/io/proxygenerator.h b/project/proxygenerator.h similarity index 100% rename from io/proxygenerator.h rename to project/proxygenerator.h diff --git a/project/sourcescommon.cpp b/project/sourcescommon.cpp index 0156520e0..524a1b3f7 100644 --- a/project/sourcescommon.cpp +++ b/project/sourcescommon.cpp @@ -23,19 +23,19 @@ #include "ui/menuhelper.h" #include "panels/panels.h" #include "project/media.h" -#include "project/undo.h" +#include "undo/undo.h" #include "rendering/renderfunctions.h" #include "panels/timeline.h" #include "panels/project.h" #include "project/footage.h" #include "panels/viewer.h" #include "project/projectfilter.h" -#include "project/sequence.h" -#include "io/config.h" +#include "timeline/sequence.h" +#include "global/config.h" #include "dialogs/proxydialog.h" #include "ui/viewerwidget.h" -#include "io/proxygenerator.h" -#include "mainwindow.h" +#include "project/proxygenerator.h" +#include "ui/mainwindow.h" #include #include diff --git a/rendering/audio.cpp b/rendering/audio.cpp index a5e4b49a6..68a5eea9e 100644 --- a/rendering/audio.cpp +++ b/rendering/audio.cpp @@ -20,16 +20,16 @@ #include "audio.h" -#include "oliveglobal.h" +#include "global/global.h" -#include "project/sequence.h" +#include "timeline/sequence.h" #include "panels/panels.h" -#include "io/config.h" +#include "global/config.h" #include "ui/audiomonitor.h" #include "rendering/renderfunctions.h" -#include "debug.h" +#include "global/debug.h" #include #include diff --git a/rendering/audio.h b/rendering/audio.h index ba6aba7b5..6644039bb 100644 --- a/rendering/audio.h +++ b/rendering/audio.h @@ -29,22 +29,22 @@ #include #include -#include "project/sequence.h" +#include "timeline/sequence.h" class AudioSenderThread : public QThread { - Q_OBJECT + Q_OBJECT public: - AudioSenderThread(); - void run(); - void stop(); - QWaitCondition cond; - bool close; - QMutex lock; + AudioSenderThread(); + void run(); + void stop(); + QWaitCondition cond; + bool close; + QMutex lock; public slots: - void notifyReceiver(); + void notifyReceiver(); private: - QVector samples; - int send_audio_to_output(qint64 offset, int max); + QVector samples; + int send_audio_to_output(qint64 offset, int max); }; double log_volume(double linear); diff --git a/rendering/cacher.cpp b/rendering/cacher.cpp index 7c2460eed..b1f32e46c 100644 --- a/rendering/cacher.cpp +++ b/rendering/cacher.cpp @@ -37,8 +37,8 @@ #include "rendering/audio.h" #include "rendering/renderfunctions.h" #include "panels/panels.h" -#include "io/config.h" -#include "debug.h" +#include "global/config.h" +#include "global/debug.h" // Enable verbose audio messages - good for debugging reversed audio //#define AUDIOWARNINGS diff --git a/io/exportthread.cpp b/rendering/exportthread.cpp similarity index 96% rename from io/exportthread.cpp rename to rendering/exportthread.cpp index 05fff530d..e224484f2 100644 --- a/io/exportthread.cpp +++ b/rendering/exportthread.cpp @@ -20,18 +20,16 @@ #include "exportthread.h" -#include "oliveglobal.h" - -#include "project/sequence.h" - +#include "global/global.h" +#include "timeline/sequence.h" #include "panels/panels.h" #include "ui/viewerwidget.h" #include "rendering/renderthread.h" #include "rendering/renderfunctions.h" #include "rendering/audio.h" -#include "mainwindow.h" -#include "debug.h" +#include "ui/mainwindow.h" +#include "global/debug.h" extern "C" { #include diff --git a/io/exportthread.h b/rendering/exportthread.h similarity index 100% rename from io/exportthread.h rename to rendering/exportthread.h diff --git a/rendering/renderfunctions.cpp b/rendering/renderfunctions.cpp index 36286b355..da22f9ff3 100644 --- a/rendering/renderfunctions.cpp +++ b/rendering/renderfunctions.cpp @@ -34,19 +34,19 @@ extern "C" { namespace OCIO = OCIO_NAMESPACE; #endif -#include "project/clip.h" -#include "project/sequence.h" +#include "timeline/clip.h" +#include "timeline/sequence.h" #include "project/media.h" -#include "project/effect.h" +#include "effects/effect.h" #include "project/footage.h" -#include "project/transition.h" +#include "effects/transition.h" #include "ui/collapsiblewidget.h" #include "rendering/audio.h" -#include "io/math.h" -#include "io/config.h" +#include "global/math.h" +#include "global/config.h" #include "panels/timeline.h" #include "panels/viewer.h" diff --git a/rendering/renderfunctions.h b/rendering/renderfunctions.h index 21507c990..abea07c33 100644 --- a/rendering/renderfunctions.h +++ b/rendering/renderfunctions.h @@ -25,9 +25,8 @@ #include #include -#include "project/sequence.h" -#include "project/effect.h" - +#include "timeline/sequence.h" +#include "effects/effect.h" #include "panels/viewer.h" /** diff --git a/rendering/renderthread.cpp b/rendering/renderthread.cpp index 7dc2f0715..5f828468a 100644 --- a/rendering/renderthread.cpp +++ b/rendering/renderthread.cpp @@ -31,7 +31,7 @@ namespace OCIO = OCIO_NAMESPACE; #endif #include "rendering/renderfunctions.h" -#include "project/sequence.h" +#include "timeline/sequence.h" RenderThread::RenderThread() : gizmos(nullptr), diff --git a/rendering/renderthread.h b/rendering/renderthread.h index 8f0d9c3a4..4a3a95144 100644 --- a/rendering/renderthread.h +++ b/rendering/renderthread.h @@ -29,8 +29,8 @@ #include #include -#include "project/sequence.h" -#include "project/effect.h" +#include "timeline/sequence.h" +#include "effects/effect.h" #include "rendering/framebufferobject.h" // copied from source code to OCIODisplay diff --git a/project/clip.cpp b/timeline/clip.cpp similarity index 95% rename from project/clip.cpp rename to timeline/clip.cpp index a1cef5d25..0a8a9d6b9 100644 --- a/project/clip.cpp +++ b/timeline/clip.cpp @@ -22,19 +22,19 @@ #include -#include "project/effect.h" -#include "project/transition.h" +#include "effects/effect.h" +#include "effects/transition.h" #include "project/footage.h" -#include "io/config.h" +#include "global/config.h" #include "rendering/cacher.h" #include "rendering/renderfunctions.h" #include "panels/project.h" -#include "project/sequence.h" +#include "timeline/sequence.h" #include "panels/timeline.h" #include "project/media.h" -#include "io/clipboard.h" -#include "undo.h" -#include "debug.h" +#include "project/clipboard.h" +#include "undo/undo.h" +#include "global/debug.h" const int kRGBAComponentCount = 4; diff --git a/project/clip.h b/timeline/clip.h similarity index 92% rename from project/clip.h rename to timeline/clip.h index f7b52da8a..cf8435966 100644 --- a/project/clip.h +++ b/timeline/clip.h @@ -30,11 +30,11 @@ #include "rendering/cacher.h" -#include "project/effect.h" -#include "project/transition.h" -#include "project/comboaction.h" +#include "effects/effect.h" +#include "effects/transition.h" +#include "undo/comboaction.h" #include "project/media.h" -#include "footage.h" +#include "project/footage.h" #include "marker.h" diff --git a/project/marker.cpp b/timeline/marker.cpp similarity index 93% rename from project/marker.cpp rename to timeline/marker.cpp index ef2cb5014..a05985741 100644 --- a/project/marker.cpp +++ b/timeline/marker.cpp @@ -20,11 +20,11 @@ #include "marker.h" -#include "io/config.h" -#include "project/undo.h" -#include "mainwindow.h" -#include "project/sequence.h" -#include "project/clip.h" +#include "global/config.h" +#include "undo/undo.h" +#include "ui/mainwindow.h" +#include "timeline/sequence.h" +#include "timeline/clip.h" #include "panels/panels.h" #include "panels/viewer.h" diff --git a/project/marker.h b/timeline/marker.h similarity index 100% rename from project/marker.h rename to timeline/marker.h diff --git a/project/selection.h b/timeline/selection.h similarity index 100% rename from project/selection.h rename to timeline/selection.h diff --git a/project/sequence.cpp b/timeline/sequence.cpp similarity index 95% rename from project/sequence.cpp rename to timeline/sequence.cpp index a604146db..6cd2967f3 100644 --- a/project/sequence.cpp +++ b/timeline/sequence.cpp @@ -23,8 +23,7 @@ #include #include "panels/panels.h" - -#include "debug.h" +#include "global/debug.h" Sequence::Sequence() { playhead = 0; diff --git a/project/sequence.h b/timeline/sequence.h similarity index 89% rename from project/sequence.h rename to timeline/sequence.h index 558ae3db2..8893b1362 100644 --- a/project/sequence.h +++ b/timeline/sequence.h @@ -24,10 +24,9 @@ #include #include -#include "project/clip.h" -#include "project/marker.h" -#include "project/transition.h" -#include "project/selection.h" +#include "clip.h" +#include "marker.h" +#include "selection.h" class Sequence { public: diff --git a/ui/audiomonitor.cpp b/ui/audiomonitor.cpp index 0e0f9f528..239deff00 100644 --- a/ui/audiomonitor.cpp +++ b/ui/audiomonitor.cpp @@ -20,7 +20,7 @@ #include "audiomonitor.h" -#include "project/sequence.h" +#include "timeline/sequence.h" #include "rendering/audio.h" #include "panels/panels.h" #include "panels/timeline.h" @@ -39,60 +39,60 @@ extern "C" { } AudioMonitor::AudioMonitor(QWidget *parent) : - QWidget(parent) + QWidget(parent) { - clear_timer.setInterval(500); - connect(&clear_timer, SIGNAL(timeout()), this, SLOT(clear())); + clear_timer.setInterval(500); + connect(&clear_timer, SIGNAL(timeout()), this, SLOT(clear())); } void AudioMonitor::set_value(const QVector &ivalues) { - values = ivalues; - update(); + values = ivalues; + update(); - QMetaObject::invokeMethod(&clear_timer, "start", Qt::QueuedConnection); + QMetaObject::invokeMethod(&clear_timer, "start", Qt::QueuedConnection); } void AudioMonitor::clear() { - clear_timer.stop(); + clear_timer.stop(); - values.fill(1); - update(); + values.fill(1); + update(); } void AudioMonitor::resizeEvent(QResizeEvent *e) { - gradient = QLinearGradient(QPoint(0, rect().top()), QPoint(0, rect().bottom())); - gradient.setColorAt(0, Qt::red); - gradient.setColorAt(0.25, Qt::yellow); - gradient.setColorAt(1, Qt::green); - QWidget::resizeEvent(e); + gradient = QLinearGradient(QPoint(0, rect().top()), QPoint(0, rect().bottom())); + gradient.setColorAt(0, Qt::red); + gradient.setColorAt(0.25, Qt::yellow); + gradient.setColorAt(1, Qt::green); + QWidget::resizeEvent(e); } void AudioMonitor::paintEvent(QPaintEvent *) { - if (olive::ActiveSequence != nullptr && values.size() > 0) { - QPainter p(this); - int channel_x = AUDIO_MONITOR_GAP; - int channel_count = values.size(); - int channel_width = (width()/channel_count) - AUDIO_MONITOR_GAP; - int i; - for (i=0;i 0) { + QPainter p(this); + int channel_x = AUDIO_MONITOR_GAP; + int channel_count = values.size(); + int channel_width = (width()/channel_count) - AUDIO_MONITOR_GAP; + int i; + for (i=0;i #include -#include "project/clip.h" +#include "timeline/clip.h" #include "ui/menuhelper.h" #include "ui/keyframenavigator.h" +#include "panels/panels.h" EffectUI::EffectUI(Effect* e) : effect_(e) @@ -27,6 +28,8 @@ EffectUI::EffectUI(Effect* e) : int maximum_column = 0; + widgets_.resize(e->row_count()); + for (int i=0;irow_count();i++) { EffectRow* row = e->row(i); @@ -36,12 +39,16 @@ EffectUI::EffectUI(Effect* e) : layout_->addWidget(row_label, i, 0); + widgets_[i].resize(row->FieldCount()); + int column = 1; for (int j=0;jFieldCount();j++) { EffectField* field = row->Field(j); QWidget* widget = field->CreateWidget(); + widgets_[i][j] = widget; + layout_->addWidget(widget, i, column, 1, field->GetColumnSpan()); column += field->GetColumnSpan(); @@ -64,6 +71,7 @@ EffectUI::EffectUI(Effect* e) : connect(nav, SIGNAL(goto_next_key()), row, SLOT(GoToNextKeyframe())); connect(nav, SIGNAL(keyframe_enabled_changed(bool)), row, SLOT(SetKeyframingEnabled(bool))); connect(nav, SIGNAL(clicked()), row, SLOT(FocusRow())); + connect(row, SIGNAL(KeyframingSetChanged(bool)), nav, SLOT(enable_keyframes(bool))); layout_->addWidget(nav, i, maximum_column); } @@ -76,10 +84,17 @@ Effect *EffectUI::GetEffect() return effect_; } -int EffectUI::GetRowPos(int row) -{ +int EffectUI::GetRowY(int row, QWidget* mapToWidget) { QLabel* row_label = labels_.at(row); - return mapToGlobal(row_label->rect().center()).y(); + return row_label->y() + + row_label->height() / 2 + + mapToWidget->mapFrom(panel_effect_controls, contents->mapTo(panel_effect_controls, contents->pos())).y() + - title_bar->height(); +} + +QWidget *EffectUI::Widget(int row, int field) +{ + return widgets_.at(row).at(field); } void EffectUI::show_context_menu(const QPoint& pos) { diff --git a/ui/effectui.h b/ui/effectui.h index 3191fc90c..81de6871e 100644 --- a/ui/effectui.h +++ b/ui/effectui.h @@ -2,7 +2,7 @@ #define EFFECTUI_H #include "collapsiblewidget.h" -#include "project/effect.h" +#include "effects/effect.h" class EffectUI : public CollapsibleWidget { Q_OBJECT @@ -11,7 +11,9 @@ public: Effect* GetEffect(); - int GetRowPos(int row); + int GetRowY(int row, QWidget *mapToWidget); + + QWidget* Widget(int row, int field); signals: void CutRequested(); void CopyRequested(); @@ -20,6 +22,7 @@ private: Effect* effect_; QGridLayout* layout_; QVector labels_; + QVector< QVector > widgets_; private slots: void show_context_menu(const QPoint&); }; diff --git a/ui/focusfilter.cpp b/ui/focusfilter.cpp index ae280ad04..d942279eb 100644 --- a/ui/focusfilter.cpp +++ b/ui/focusfilter.cpp @@ -21,7 +21,7 @@ #include "focusfilter.h" #include "panels/panels.h" -#include "project/sequence.h" +#include "timeline/sequence.h" #include "ui/timelineheader.h" FocusFilter olive::FocusFilter; diff --git a/ui/graphview.cpp b/ui/graphview.cpp index bc08d2a6c..f6b6cd124 100644 --- a/ui/graphview.cpp +++ b/ui/graphview.cpp @@ -26,18 +26,17 @@ #include #include -#include "io/config.h" +#include "global/config.h" #include "panels/panels.h" #include "panels/timeline.h" #include "panels/viewer.h" -#include "project/sequence.h" +#include "timeline/sequence.h" #include "ui/keyframedrawing.h" -#include "project/undo.h" -#include "project/effect.h" -#include "project/clip.h" +#include "undo/undo.h" +#include "effects/effect.h" +#include "timeline/clip.h" #include "ui/rectangleselect.h" - -#include "debug.h" +#include "global/debug.h" const double kGraphZoomSpeed = 0.05; @@ -702,7 +701,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) { void GraphView::mouseReleaseEvent(QMouseEvent *) { if (click_add_proc) { - olive::UndoStack.push(new KeyframeFieldSet(click_add_field, click_add_key)); + olive::UndoStack.push(new KeyframeAdd(click_add_field, click_add_key)); } else if (moved_keys && selected_keys.size() > 0) { ComboAction* ca = new ComboAction(); switch (current_handle) { diff --git a/ui/graphview.h b/ui/graphview.h index bc1e96473..285048882 100644 --- a/ui/graphview.h +++ b/ui/graphview.h @@ -24,8 +24,8 @@ #include #include -#include "project/effectrow.h" -#include "project/effectfields.h" +#include "effects/effectrow.h" +#include "effects/effectfields.h" QColor get_curve_color(int index, int length); diff --git a/ui/keyframenavigator.h b/ui/keyframenavigator.h index b0141aeb1..772a1f8f7 100644 --- a/ui/keyframenavigator.h +++ b/ui/keyframenavigator.h @@ -32,8 +32,9 @@ class KeyframeNavigator : public QWidget public: KeyframeNavigator(QWidget* parent = nullptr, bool addLeftPad = true); ~KeyframeNavigator(); - void enable_keyframes(bool); + void enable_keyframe_toggle(bool); + void enable_keyframes(bool); signals: void goto_previous_key(); void toggle_key(); diff --git a/ui/keyframeview.cpp b/ui/keyframeview.cpp index b0a0beb46..7e9bff745 100644 --- a/ui/keyframeview.cpp +++ b/ui/keyframeview.cpp @@ -20,22 +20,22 @@ #include "keyframeview.h" -#include "project/effect.h" +#include "effects/effect.h" #include "ui/collapsiblewidget.h" #include "panels/panels.h" -#include "project/clip.h" +#include "timeline/clip.h" #include "panels/timeline.h" #include "ui/timelineheader.h" -#include "project/undo.h" +#include "undo/undo.h" #include "panels/viewer.h" #include "ui/viewerwidget.h" -#include "project/sequence.h" +#include "timeline/sequence.h" #include "panels/grapheditor.h" #include "ui/keyframedrawing.h" #include "ui/clickablelabel.h" #include "ui/resizablescrollbar.h" #include "ui/rectangleselect.h" -#include "project/keyframe.h" +#include "effects/keyframe.h" #include "ui/graphview.h" #include @@ -124,7 +124,7 @@ void KeyframeView::paintEvent(QPaintEvent*) { for (int j=0;jrow_count();j++) { EffectRow* row = e->row(j); - int keyframe_y = container->GetRowPos(j); + int keyframe_y = container->GetRowY(j, this); QVector key_times; diff --git a/ui/labelslider.cpp b/ui/labelslider.cpp index 439581789..614c8b556 100644 --- a/ui/labelslider.cpp +++ b/ui/labelslider.cpp @@ -20,11 +20,11 @@ #include "labelslider.h" -#include "project/undo.h" +#include "undo/undo.h" #include "panels/viewer.h" -#include "io/config.h" -#include "io/math.h" -#include "debug.h" +#include "global/config.h" +#include "global/math.h" +#include "global/debug.h" #include #include @@ -40,28 +40,33 @@ LabelSlider::LabelSlider(QWidget* parent) : QLabel(parent) { drag_proc = false; min_enabled = false; max_enabled = false; - set_color(); - set_default_cursor(); + SetColor(); + SetDefaultCursor(); internal_value = -1; set = false; - display_type = LABELSLIDER_NORMAL; + display_type = Normal; - set_default_value(0); + SetDefault(0); setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu(const QPoint&))); + connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowContextMenu(const QPoint&))); } -void LabelSlider::set_frame_rate(double d) { +void LabelSlider::SetFrameRate(double d) { frame_rate = d; } -void LabelSlider::set_display_type(const DisplayType& type) { - display_type = type; - setText(valueToString()); +void LabelSlider::SetDecimalPlaces(int places) +{ + decimal_places = places; } -void LabelSlider::set_value(double v, bool userSet) { +void LabelSlider::SetDisplayType(const DisplayType& type) { + display_type = type; + setText(ValueToString()); +} + +void LabelSlider::SetValue(double v) { set = true; if (!qFuzzyCompare(v, internal_value)) { if (min_enabled && v < min_value) { @@ -72,32 +77,25 @@ void LabelSlider::set_value(double v, bool userSet) { internal_value = v; } - setText(valueToString()); - if (userSet) { - emit valueChanged(internal_value); - } + setText(ValueToString()); } } -bool LabelSlider::is_set() { - return set; -} - -bool LabelSlider::is_dragging() { +bool LabelSlider::IsDragging() { return drag_proc; } -QString LabelSlider::valueToString() { +QString LabelSlider::ValueToString() { double v = internal_value; if (qIsNaN(v)) { return "---"; } else { switch (display_type) { - case LABELSLIDER_FRAMENUMBER: + case FrameNumber: return frame_to_timecode(long(v), olive::CurrentConfig.timecode_view, frame_rate); - case LABELSLIDER_PERCENT: + case Percent: return QString::number((v*100), 'f', decimal_places).append("%"); - case LABELSLIDER_DECIBEL: + case Decibel: { QString db_str; @@ -120,15 +118,7 @@ QString LabelSlider::valueToString() { } } -double LabelSlider::getPreviousValue() { - return previous_value; -} - -void LabelSlider::set_previous_value() { - previous_value = internal_value; -} - -void LabelSlider::set_color(QString c) { +void LabelSlider::SetColor(QString c) { if (c.isEmpty()) c = "#ffc000"; setStyleSheet("QLabel{color:" + c + ";text-decoration:underline;}QLabel:disabled{color:#808080;}"); } @@ -137,20 +127,20 @@ double LabelSlider::value() { return internal_value; } -void LabelSlider::set_default_value(double v) { +void LabelSlider::SetDefault(double v) { default_value = v; if (!set) { - set_value(v, false); + SetValue(v); set = false; } } -void LabelSlider::set_minimum_value(double v) { +void LabelSlider::SetMinimum(double v) { min_value = v; min_enabled = true; } -void LabelSlider::set_maximum_value(double v) { +void LabelSlider::SetMaximum(double v) { max_value = v; max_enabled = true; } @@ -166,7 +156,7 @@ void LabelSlider::mousePressEvent(QMouseEvent *ev) { if (ev->modifiers() & Qt::AltModifier) { // reset to default - reset_to_default_value(); + ResetToDefault(); } else { @@ -174,7 +164,7 @@ void LabelSlider::mousePressEvent(QMouseEvent *ev) { if (qIsNaN(internal_value)) internal_value = 0; // hide the cursor and store information about it for dragging - set_active_cursor(); + SetActiveCursor(); drag_start = true; drag_start_x = cursor().pos().x(); @@ -206,7 +196,7 @@ void LabelSlider::mouseMoveEvent(QMouseEvent* event) { // ctrl + drag drags in smaller increments if (event->modifiers() & Qt::ControlModifier) diff *= 0.01; - if (display_type == LABELSLIDER_PERCENT) { + if (display_type == Percent) { // we'll also need to drag in smaller increments for a percent value diff *= 0.01; @@ -215,7 +205,7 @@ void LabelSlider::mouseMoveEvent(QMouseEvent* event) { // determine what the new value will be double new_value; - if (display_type == LABELSLIDER_DECIBEL) { + if (display_type == Decibel) { // we move in terms of dB for decibel display new_value = db_to_amplitude(amplitude_to_db(internal_value) + diff); @@ -227,7 +217,8 @@ void LabelSlider::mouseMoveEvent(QMouseEvent* event) { } // set internal value - set_value(new_value, true); + SetValue(new_value); + emit valueChanged(internal_value); // keep the cursor in the same location while dragging cursor().setPos(drag_start_x, drag_start_y); @@ -238,7 +229,7 @@ void LabelSlider::mouseReleaseEvent(QMouseEvent*) { if (drag_start) { // unhide cursor - set_default_cursor(); + SetDefaultCursor(); drag_start = false; @@ -253,49 +244,47 @@ void LabelSlider::mouseReleaseEvent(QMouseEvent*) { } else { - prompt_for_value(); + ShowDialog(); } } } -void LabelSlider::set_default_cursor() { +void LabelSlider::SetDefaultCursor() { setCursor(Qt::SizeHorCursor); } -void LabelSlider::set_active_cursor() { +void LabelSlider::SetActiveCursor() { setCursor(Qt::BlankCursor); } -void LabelSlider::show_context_menu(const QPoint &pos) +void LabelSlider::ShowContextMenu(const QPoint &pos) { QMenu menu(this); - menu.addAction(tr("&Edit"), this, SLOT(prompt_for_value())); + menu.addAction(tr("&Edit"), this, SLOT(ShowDialog())); menu.addSeparator(); - menu.addAction(tr("&Reset to Default"), this, SLOT(reset_to_default_value())); + menu.addAction(tr("&Reset to Default"), this, SLOT(ResetToDefault())); menu.exec(mapToGlobal(pos)); } -void LabelSlider::reset_to_default_value() +void LabelSlider::ResetToDefault() { // if the value is not already default, and there is a default to set if (!qFuzzyCompare(internal_value, default_value) && !qIsNaN(default_value)) { - // cache current value - set_previous_value(); - // set back to default - set_value(default_value, true); + SetValue(default_value); + emit valueChanged(internal_value); } } -void LabelSlider::prompt_for_value() +void LabelSlider::ShowDialog() { // if the user didn't actually drag, and just clicked in one place, // we instead present a dialog prompt for the user to enter a @@ -303,7 +292,7 @@ void LabelSlider::prompt_for_value() double d = internal_value; - if (display_type == LABELSLIDER_FRAMENUMBER) { + if (display_type == FrameNumber) { // ask the user to enter a timecode QString s = QInputDialog::getText( @@ -311,7 +300,7 @@ void LabelSlider::prompt_for_value() tr("Set Value"), tr("New value:"), QLineEdit::Normal, - valueToString() + ValueToString() ); if (s.isEmpty()) return; @@ -325,9 +314,9 @@ void LabelSlider::prompt_for_value() // value to show double shown_value = internal_value; - if (display_type == LABELSLIDER_PERCENT) { + if (display_type == Percent) { shown_value *= 100; - } else if (display_type == LABELSLIDER_DECIBEL) { + } else if (display_type == Decibel) { shown_value = amplitude_to_db(shown_value); } @@ -336,7 +325,7 @@ void LabelSlider::prompt_for_value() if (min_enabled) { // if this field has a minimum value set, use it shown_minimum_value = min_value; - } else if (display_type == LABELSLIDER_DECIBEL) { + } else if (display_type == Decibel) { // minimum decibel amount is -96db shown_minimum_value = -96; } else { @@ -358,16 +347,16 @@ void LabelSlider::prompt_for_value() if (!ok) return; // convert shown value back to internal value - if (display_type == LABELSLIDER_PERCENT) { + if (display_type == Percent) { d *= 0.01; - } else if (display_type == LABELSLIDER_DECIBEL) { + } else if (display_type == Decibel) { d = db_to_amplitude(d); } } // if the value actually changed, trigger a change event if (!qFuzzyCompare(d, internal_value)) { - set_previous_value(); - set_value(d, true); + SetValue(d); + emit valueChanged(internal_value); } } diff --git a/ui/labelslider.h b/ui/labelslider.h index a0ddc6a02..e7550513c 100644 --- a/ui/labelslider.h +++ b/ui/labelslider.h @@ -37,20 +37,66 @@ public: LabelSlider(QWidget* parent = nullptr); /** - * @brief Set the display frame rate + * @brief Set the value + * @param v * - * If the `display_type` is set to LABELSLIDER_FRAMENUMBER, this function sets how many frames per second the - * timecode will be in. + * Value to set to. * - * @param d + * @param userSet + * + * **TRUE** if this was called through a user action, **FALSE** if this was called through some other way. The + * only difference is **TRUE** will emit a signal (valueChanged()) indicating that the value has changed, and + * **FALSE** will not. */ - void set_frame_rate(double d); + void SetValue(double v); + + /** + * @brief Set the default value + * + * If a default value is set, alt+clicking the LabelSlider will return to the default value. + * + * @param v + * + * Value to set as default + */ + void SetDefault(double v); + + /** + * @brief Set the minimum value + * + * If a minimum value is set, the value will never go below it. If the user manually sets a value lower than + * the minimum, it will automatically snap to the minimum. + * + * @param v + * + * Value to set as minimum + */ + void SetMinimum(double v); + + /** + * @brief Set the maximum value + * + * If a maximum value is set, the value will never go above it. If the user manually sets a value higher than + * the maximum, it will automatically snap to the maximum. + * + * @param v + * + * Value to set as maximum + */ + void SetMaximum(double v); + + /** + * @brief Returns the internal value as a double + * @return The internal value. This will not respect the `display_type`, i.e. 100% will return as 1.0, 12dB will + * return as 400%, and a timecode will return as a frame number. + */ + double value(); enum DisplayType { - LABELSLIDER_NORMAL, - LABELSLIDER_FRAMENUMBER, - LABELSLIDER_PERCENT, - LABELSLIDER_DECIBEL + Normal, + FrameNumber, + Percent, + Decibel }; /** @@ -67,107 +113,13 @@ public: * * The display type to set to. */ - void set_display_type(const DisplayType& type); - - /** - * @brief Set the value - * @param v - * - * Value to set to. - * - * @param userSet - * - * **TRUE** if this was called through a user action, **FALSE** if this was called through some other way. The - * only difference is **TRUE** will emit a signal (valueChanged()) indicating that the value has changed, and - * **FALSE** will not. - */ - void set_value(double v, bool userSet); - - /** - * @brief Set the default value - * - * If a default value is set, alt+clicking the LabelSlider will return to the default value. - * - * @param v - * - * Value to set as default - */ - void set_default_value(double v); - - /** - * @brief Set the minimum value - * - * If a minimum value is set, the value will never go below it. If the user manually sets a value lower than - * the minimum, it will automatically snap to the minimum. - * - * @param v - * - * Value to set as minimum - */ - void set_minimum_value(double v); - - /** - * @brief Set the maximum value - * - * If a maximum value is set, the value will never go above it. If the user manually sets a value higher than - * the maximum, it will automatically snap to the maximum. - * - * @param v - * - * Value to set as maximum - */ - void set_maximum_value(double v); - - /** - * @brief Returns the internal value as a double - * @return The internal value. This will not respect the `display_type`, i.e. 100% will return as 1.0, 12dB will - * return as 400%, and a timecode will return as a frame number. - */ - double value(); - - /** - * @brief Returns whether a value has been set or not - * - * If a value has been entered by any means (i.e. if set_value() was called), this will be **TRUE**. If set_value() - * has not been called and is_set() is **FALSE**, calling set_default_value() will automatically set the value - * to the default value WITHOUT changing the is_set() state (i.e. it will still be **FALSE** and calling - * set_default_value() again will change the current value again unless it's been changed through some other means - * in that time). - * - * @return **TRUE** if a value has been set, **FALSE** if not. - */ - bool is_set(); + void SetDisplayType(const DisplayType& type); /** * @brief Returns whether the user is currently dragging * @return **TRUE** if the user is dragging, **FALSE** if not. */ - bool is_dragging(); - - /** - * @brief Convert the internal value to a displayed string according to `display_type` - * @return The internal value as a string - */ - QString valueToString(); - - /** - * @brief Returns whatever value was set before the last set_value() - * - * For various reasons (largely undo capabilities) it is helpful to retrieve whatever the value was before the - * current one. If the user dragged the current value, this will return the value just before the user started - * dragging. - * - * @return The previous value - */ - double getPreviousValue(); - - /** - * @brief Updates previous value - * - * Called internally to store the current value as the previous value in anticipation of an upcoming value change. - * Can also be called externally (mainly for dragged EffectGizmos) in anticipation of an external change. - */ - void set_previous_value(); + bool IsDragging(); /** * @brief Set the display color @@ -175,24 +127,43 @@ public: * * Color to set to */ - void set_color(QString c = nullptr); + void SetColor(QString c = nullptr); + + /** + * @brief Set the display frame rate + * + * If the `display_type` is set to LABELSLIDER_FRAMENUMBER, this function sets how many frames per second the + * timecode will be in. + * + * @param d + */ + void SetFrameRate(double d); /** * @brief Set how many decimal places to show for a floating-point number * * Defaults to 1 */ - int decimal_places; + void SetDecimalPlaces(int places); protected: void mousePressEvent(QMouseEvent *ev); void mouseMoveEvent(QMouseEvent *ev); void mouseReleaseEvent(QMouseEvent *ev); private: + + /** + * @brief Convert the internal value to a displayed string according to `display_type` + * @return The internal value as a string + */ + QString ValueToString(); + double default_value; double internal_value; double drag_start_value; double previous_value; + int decimal_places; + bool min_enabled; double min_value; bool max_enabled; @@ -212,12 +183,12 @@ private: /** * @brief Internal function to set the standard cursor (usually SizeHorCursor) */ - void set_default_cursor(); + void SetDefaultCursor(); /** * @brief Internal function to set the cursor while dragging (usually NoCursor aka invisible) */ - void set_active_cursor(); + void SetActiveCursor(); private slots: /** * @brief Context menu slot to be connected to QWidget::customContextMenuRequested(const QPoint&) @@ -226,12 +197,12 @@ private slots: * * Current cursor position */ - void show_context_menu(const QPoint& pos); + void ShowContextMenu(const QPoint& pos); /** * @brief Slot to reset current value to the default value */ - void reset_to_default_value(); + void ResetToDefault(); /** * @brief Show prompt asking for value @@ -240,7 +211,7 @@ private slots: * Will show an input dialog asking for a new value to be entered manually. Asks for units in the selected * display type and converts them back to the internal value type. */ - void prompt_for_value(); + void ShowDialog(); signals: /** * @brief valueChanged signal diff --git a/mainwindow.cpp b/ui/mainwindow.cpp similarity index 97% rename from mainwindow.cpp rename to ui/mainwindow.cpp index ad4d885c2..9c14f7da4 100644 --- a/mainwindow.cpp +++ b/ui/mainwindow.cpp @@ -20,16 +20,18 @@ #include "mainwindow.h" -#include "oliveglobal.h" +#include "global/global.h" #include "ui/menuhelper.h" #include "project/projectelements.h" +#include "timeline/clip.h" -#include "io/config.h" -#include "io/path.h" -#include "io/proxygenerator.h" +#include "global/config.h" +#include "global/path.h" +#include "global/debug.h" +#include "project/proxygenerator.h" #include "project/projectfilter.h" #include "ui/sourcetable.h" @@ -47,8 +49,6 @@ #include "rendering/audio.h" #include "rendering/renderfunctions.h" -#include "debug.h" - #include #include #include diff --git a/mainwindow.h b/ui/mainwindow.h similarity index 100% rename from mainwindow.h rename to ui/mainwindow.h diff --git a/ui/menuhelper.cpp b/ui/menuhelper.cpp index aad6a8fac..859f5e493 100644 --- a/ui/menuhelper.cpp +++ b/ui/menuhelper.cpp @@ -25,10 +25,10 @@ #include #include -#include "io/config.h" -#include "io/clipboard.h" -#include "mainwindow.h" -#include "oliveglobal.h" +#include "global/config.h" +#include "project/clipboard.h" +#include "ui/mainwindow.h" +#include "global/global.h" #include "panels/panels.h" #include "ui/focusfilter.h" diff --git a/ui/scrollarea.cpp b/ui/scrollarea.cpp index 24d731545..4249a39f3 100644 --- a/ui/scrollarea.cpp +++ b/ui/scrollarea.cpp @@ -23,7 +23,7 @@ #include #include -#include "io/config.h" +#include "global/config.h" #include "panels/panels.h" #include "panels/timeline.h" diff --git a/ui/sourceiconview.cpp b/ui/sourceiconview.cpp index f8f6bad82..66c62e6cf 100644 --- a/ui/sourceiconview.cpp +++ b/ui/sourceiconview.cpp @@ -25,65 +25,65 @@ #include "panels/project.h" #include "project/media.h" #include "project/sourcescommon.h" -#include "debug.h" +#include "global/debug.h" SourceIconView::SourceIconView(QWidget *parent) : QListView(parent) { - setSelectionMode(QAbstractItemView::ExtendedSelection); - setResizeMode(QListView::Adjust); - setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&))); - connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu())); + setSelectionMode(QAbstractItemView::ExtendedSelection); + setResizeMode(QListView::Adjust); + setContextMenuPolicy(Qt::CustomContextMenu); + connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&))); + connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu())); } void SourceIconView::show_context_menu() { - project_parent->sources_common->show_context_menu(this, selectedIndexes()); + project_parent->sources_common->show_context_menu(this, selectedIndexes()); } void SourceIconView::item_click(const QModelIndex& index) { - if (selectedIndexes().size() == 1 && index.column() == 0) { - project_parent->sources_common->item_click(project_parent->item_to_media(index), index); - } + if (selectedIndexes().size() == 1 && index.column() == 0) { + project_parent->sources_common->item_click(project_parent->item_to_media(index), index); + } } void SourceIconView::mousePressEvent(QMouseEvent* event) { - project_parent->sources_common->mousePressEvent(event); - if (!indexAt(event->pos()).isValid()) selectionModel()->clear(); - QListView::mousePressEvent(event); + project_parent->sources_common->mousePressEvent(event); + if (!indexAt(event->pos()).isValid()) selectionModel()->clear(); + QListView::mousePressEvent(event); } void SourceIconView::dragEnterEvent(QDragEnterEvent *event) { - if (event->mimeData()->hasUrls()) { - event->acceptProposedAction(); - } else { - QListView::dragEnterEvent(event); - } + if (event->mimeData()->hasUrls()) { + event->acceptProposedAction(); + } else { + QListView::dragEnterEvent(event); + } } void SourceIconView::dragMoveEvent(QDragMoveEvent *event) { - if (event->mimeData()->hasUrls()) { - event->acceptProposedAction(); - } else { - QListView::dragMoveEvent(event); - } + if (event->mimeData()->hasUrls()) { + event->acceptProposedAction(); + } else { + QListView::dragMoveEvent(event); + } } void SourceIconView::dropEvent(QDropEvent* event) { - QModelIndex drop_item = indexAt(event->pos()); - if (!drop_item.isValid()) drop_item = rootIndex(); - project_parent->sources_common->dropEvent(this, event, drop_item, selectedIndexes()); + QModelIndex drop_item = indexAt(event->pos()); + if (!drop_item.isValid()) drop_item = rootIndex(); + project_parent->sources_common->dropEvent(this, event, drop_item, selectedIndexes()); } void SourceIconView::mouseDoubleClickEvent(QMouseEvent *) { - bool default_behavior = true; - if (selectedIndexes().size() == 1) { - Media* m = project_parent->item_to_media(selectedIndexes().at(0)); - if (m->get_type() == MEDIA_TYPE_FOLDER) { - default_behavior = false; - setRootIndex(selectedIndexes().at(0)); - emit changed_root(); - } - } - if (default_behavior) { + bool default_behavior = true; + if (selectedIndexes().size() == 1) { + Media* m = project_parent->item_to_media(selectedIndexes().at(0)); + if (m->get_type() == MEDIA_TYPE_FOLDER) { + default_behavior = false; + setRootIndex(selectedIndexes().at(0)); + emit changed_root(); + } + } + if (default_behavior) { project_parent->sources_common->mouseDoubleClickEvent(selectedIndexes()); - } + } } diff --git a/ui/sourcetable.cpp b/ui/sourcetable.cpp index 9f88b2779..a421cd80b 100644 --- a/ui/sourcetable.cpp +++ b/ui/sourcetable.cpp @@ -26,13 +26,13 @@ #include "panels/viewer.h" #include "panels/panels.h" #include "rendering/renderfunctions.h" -#include "project/undo.h" -#include "project/sequence.h" +#include "undo/undo.h" +#include "timeline/sequence.h" #include "mainwindow.h" -#include "io/config.h" +#include "global/config.h" #include "project/media.h" #include "project/sourcescommon.h" -#include "debug.h" +#include "global/debug.h" #include #include @@ -46,30 +46,30 @@ #include SourceTable::SourceTable(QWidget* parent) : QTreeView(parent) { - setSortingEnabled(true); - setAcceptDrops(true); - sortByColumn(0, Qt::AscendingOrder); - setContextMenuPolicy(Qt::CustomContextMenu); - setEditTriggers(QAbstractItemView::NoEditTriggers); - setDragDropMode(QAbstractItemView::DragDrop); - setSelectionMode(QAbstractItemView::ExtendedSelection); - connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&))); - connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu())); + setSortingEnabled(true); + setAcceptDrops(true); + sortByColumn(0, Qt::AscendingOrder); + setContextMenuPolicy(Qt::CustomContextMenu); + setEditTriggers(QAbstractItemView::NoEditTriggers); + setDragDropMode(QAbstractItemView::DragDrop); + setSelectionMode(QAbstractItemView::ExtendedSelection); + connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&))); + connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu())); } void SourceTable::show_context_menu() { - project_parent->sources_common->show_context_menu(this, selectionModel()->selectedRows()); + project_parent->sources_common->show_context_menu(this, selectionModel()->selectedRows()); } void SourceTable::item_click(const QModelIndex& index) { - if (selectionModel()->selectedRows().size() == 1 && index.column() == 0) { - project_parent->sources_common->item_click(project_parent->item_to_media(index), index); - } + if (selectionModel()->selectedRows().size() == 1 && index.column() == 0) { + project_parent->sources_common->item_click(project_parent->item_to_media(index), index); + } } void SourceTable::mousePressEvent(QMouseEvent* event) { - project_parent->sources_common->mousePressEvent(event); - QTreeView::mousePressEvent(event); + project_parent->sources_common->mousePressEvent(event); + QTreeView::mousePressEvent(event); } void SourceTable::mouseDoubleClickEvent(QMouseEvent* ) { @@ -77,21 +77,21 @@ void SourceTable::mouseDoubleClickEvent(QMouseEvent* ) { } void SourceTable::dragEnterEvent(QDragEnterEvent *event) { - if (event->mimeData()->hasUrls()) { - event->acceptProposedAction(); - } else { - QTreeView::dragEnterEvent(event); - } + if (event->mimeData()->hasUrls()) { + event->acceptProposedAction(); + } else { + QTreeView::dragEnterEvent(event); + } } void SourceTable::dragMoveEvent(QDragMoveEvent *event) { - if (event->mimeData()->hasUrls()) { - event->acceptProposedAction(); - } else { - QTreeView::dragMoveEvent(event); - } + if (event->mimeData()->hasUrls()) { + event->acceptProposedAction(); + } else { + QTreeView::dragMoveEvent(event); + } } void SourceTable::dropEvent(QDropEvent* event) { - project_parent->sources_common->dropEvent(this, event, indexAt(event->pos()), selectionModel()->selectedRows()); + project_parent->sources_common->dropEvent(this, event, indexAt(event->pos()), selectionModel()->selectedRows()); } diff --git a/ui/timelineheader.cpp b/ui/timelineheader.cpp index f32621ea7..510132704 100644 --- a/ui/timelineheader.cpp +++ b/ui/timelineheader.cpp @@ -23,13 +23,13 @@ #include "mainwindow.h" #include "panels/panels.h" #include "panels/timeline.h" -#include "project/sequence.h" -#include "project/undo.h" +#include "timeline/sequence.h" +#include "undo/undo.h" #include "project/media.h" #include "panels/viewer.h" -#include "io/config.h" +#include "global/config.h" #include "ui/menuhelper.h" -#include "debug.h" +#include "global/debug.h" #include #include diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp index a9a4ea197..af6f142c8 100644 --- a/ui/timelinewidget.cpp +++ b/ui/timelinewidget.cpp @@ -20,15 +20,15 @@ #include "timelinewidget.h" -#include "oliveglobal.h" +#include "global/global.h" #include "panels/panels.h" #include "project/projectelements.h" #include "rendering/audio.h" -#include "io/config.h" +#include "global/config.h" #include "ui/sourcetable.h" #include "ui/sourceiconview.h" -#include "project/undo.h" +#include "undo/undo.h" #include "ui/viewerwidget.h" #include "ui/resizablescrollbar.h" #include "dialogs/newsequencedialog.h" @@ -39,9 +39,9 @@ #include "ui/menuhelper.h" #include "ui/focusfilter.h" #include "dialogs/clippropertiesdialog.h" -#include "debug.h" +#include "global/debug.h" -#include "project/effect.h" +#include "effects/effect.h" #include "effects/internal/solideffect.h" #include "effects/internal/texteffect.h" diff --git a/ui/timelinewidget.h b/ui/timelinewidget.h index 00fce1c4d..2965dd37c 100644 --- a/ui/timelinewidget.h +++ b/ui/timelinewidget.h @@ -28,11 +28,11 @@ #include #include -#include "project/sequence.h" -#include "project/clip.h" +#include "timeline/sequence.h" +#include "timeline/clip.h" #include "project/footage.h" #include "project/media.h" -#include "project/undo.h" +#include "undo/undo.h" #include "timelinetools.h" class Timeline; diff --git a/ui/viewercontainer.cpp b/ui/viewercontainer.cpp index c247ae0f6..9f9d62367 100644 --- a/ui/viewercontainer.cpp +++ b/ui/viewercontainer.cpp @@ -28,67 +28,67 @@ #include "viewerwidget.h" #include "panels/viewer.h" -#include "project/sequence.h" -#include "debug.h" +#include "timeline/sequence.h" +#include "global/debug.h" // enforces aspect ratio ViewerContainer::ViewerContainer(QWidget *parent) : - QWidget(parent), - fit(true), - child(nullptr) + QWidget(parent), + fit(true), + child(nullptr) { - horizontal_scrollbar = new QScrollBar(Qt::Horizontal, this); - vertical_scrollbar = new QScrollBar(Qt::Vertical, this); + horizontal_scrollbar = new QScrollBar(Qt::Horizontal, this); + vertical_scrollbar = new QScrollBar(Qt::Vertical, this); - horizontal_scrollbar->setVisible(false); - vertical_scrollbar->setVisible(false); + horizontal_scrollbar->setVisible(false); + vertical_scrollbar->setVisible(false); - horizontal_scrollbar->setSingleStep(20); - vertical_scrollbar->setSingleStep(20); + horizontal_scrollbar->setSingleStep(20); + vertical_scrollbar->setSingleStep(20); - child = new ViewerWidget(this); - child->container = this; + child = new ViewerWidget(this); + child->container = this; - connect(horizontal_scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scroll_changed())); - connect(vertical_scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scroll_changed())); + connect(horizontal_scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scroll_changed())); + connect(vertical_scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scroll_changed())); } ViewerContainer::~ViewerContainer() {} void ViewerContainer::dragScrollPress(const QPoint &p) { - drag_start_x = p.x(); - drag_start_y = p.y(); + drag_start_x = p.x(); + drag_start_y = p.y(); - horiz_start = horizontal_scrollbar->value(); - vert_start = vertical_scrollbar->value(); + horiz_start = horizontal_scrollbar->value(); + vert_start = vertical_scrollbar->value(); } void ViewerContainer::dragScrollMove(const QPoint &p) { - int this_x = p.x(); - int this_y = p.y(); + int this_x = p.x(); + int this_y = p.y(); - horizontal_scrollbar->setValue(horiz_start + (drag_start_x-this_x)); - vertical_scrollbar->setValue(vert_start + (drag_start_y-this_y)); + horizontal_scrollbar->setValue(horiz_start + (drag_start_x-this_x)); + vertical_scrollbar->setValue(vert_start + (drag_start_y-this_y)); } void ViewerContainer::parseWheelEvent(QWheelEvent *event) { - if (event->modifiers() & Qt::AltModifier) { - QApplication::sendEvent(horizontal_scrollbar, event); - } else { - QApplication::sendEvent(vertical_scrollbar, event); - } + if (event->modifiers() & Qt::AltModifier) { + QApplication::sendEvent(horizontal_scrollbar, event); + } else { + QApplication::sendEvent(vertical_scrollbar, event); + } } void ViewerContainer::adjust() { - if (viewer->seq != nullptr) { - if (child->waveform) { - child->move(0, 0); - child->resize(size()); - } else { - horizontal_scrollbar->setVisible(false); - vertical_scrollbar->setVisible(false); + if (viewer->seq != nullptr) { + if (child->waveform) { + child->move(0, 0); + child->resize(size()); + } else { + horizontal_scrollbar->setVisible(false); + vertical_scrollbar->setVisible(false); - int zoomed_width = qRound(double(viewer->seq->width)*zoom); + int zoomed_width = qRound(double(viewer->seq->width)*zoom); int zoomed_height = qRound(double(viewer->seq->height)*zoom); if (fit || zoomed_width > width() || zoomed_height > height()) { @@ -147,28 +147,28 @@ void ViewerContainer::adjust() { child->move(zoomed_x, zoomed_y); child->resize(zoomed_width, zoomed_height); } - } - } + } + } } void ViewerContainer::adjust_scrollbars() { - horizontal_scrollbar->move(0, height()-horizontal_scrollbar->height()); - horizontal_scrollbar->setFixedWidth(qMax(0, width()-vertical_scrollbar->width())); - horizontal_scrollbar->setPageStep(width()); + horizontal_scrollbar->move(0, height()-horizontal_scrollbar->height()); + horizontal_scrollbar->setFixedWidth(qMax(0, width()-vertical_scrollbar->width())); + horizontal_scrollbar->setPageStep(width()); - vertical_scrollbar->move(width() - vertical_scrollbar->width(), 0); - vertical_scrollbar->setFixedHeight(qMax(0, height()-horizontal_scrollbar->height())); - vertical_scrollbar->setPageStep(height()); + vertical_scrollbar->move(width() - vertical_scrollbar->width(), 0); + vertical_scrollbar->setFixedHeight(qMax(0, height()-horizontal_scrollbar->height())); + vertical_scrollbar->setPageStep(height()); } void ViewerContainer::resizeEvent(QResizeEvent *event) { - event->accept(); - adjust(); + event->accept(); + adjust(); } void ViewerContainer::scroll_changed() { - child->set_scroll( - double(horizontal_scrollbar->value())/double(horizontal_scrollbar->maximum()), - double(vertical_scrollbar->value())/double(vertical_scrollbar->maximum()) - ); + child->set_scroll( + double(horizontal_scrollbar->value())/double(horizontal_scrollbar->maximum()), + double(vertical_scrollbar->value())/double(vertical_scrollbar->maximum()) + ); } diff --git a/ui/viewerwidget.cpp b/ui/viewerwidget.cpp index 0db17dc66..50c40f832 100644 --- a/ui/viewerwidget.cpp +++ b/ui/viewerwidget.cpp @@ -46,11 +46,11 @@ extern "C" { #include "project/projectelements.h" #include "rendering/renderfunctions.h" #include "rendering/audio.h" -#include "io/config.h" -#include "debug.h" -#include "io/math.h" +#include "global/config.h" +#include "global/debug.h" +#include "global/math.h" #include "ui/collapsiblewidget.h" -#include "project/undo.h" +#include "undo/undo.h" #include "project/media.h" #include "ui/viewercontainer.h" #include "rendering/cacher.h" diff --git a/ui/viewerwidget.h b/ui/viewerwidget.h index adee06ff3..f01ae7063 100644 --- a/ui/viewerwidget.h +++ b/ui/viewerwidget.h @@ -30,9 +30,9 @@ #include #include -#include "project/clip.h" +#include "timeline/clip.h" #include "project/footage.h" -#include "project/effect.h" +#include "effects/effect.h" #include "ui/viewerwindow.h" #include "ui/viewercontainer.h" #include "rendering/renderthread.h" diff --git a/project/comboaction.cpp b/undo/comboaction.cpp similarity index 100% rename from project/comboaction.cpp rename to undo/comboaction.cpp diff --git a/project/comboaction.h b/undo/comboaction.h similarity index 100% rename from project/comboaction.h rename to undo/comboaction.h diff --git a/project/undo.cpp b/undo/undo.cpp similarity index 97% rename from project/undo.cpp rename to undo/undo.cpp index 1aa79eab3..e30228e9b 100644 --- a/project/undo.cpp +++ b/undo/undo.cpp @@ -25,28 +25,22 @@ #include #include -#include "project/clip.h" -#include "project/sequence.h" +#include "global/global.h" #include "panels/panels.h" #include "panels/project.h" #include "panels/effectcontrols.h" #include "panels/viewer.h" #include "panels/timeline.h" #include "ui/sourcetable.h" -#include "project/effect.h" -#include "project/transition.h" #include "project/footage.h" #include "rendering/renderfunctions.h" #include "rendering/cacher.h" -#include "io/previewgenerator.h" #include "ui/labelslider.h" #include "ui/viewerwidget.h" -#include "project/marker.h" -#include "mainwindow.h" -#include "io/clipboard.h" #include "project/media.h" -#include "debug.h" -#include "oliveglobal.h" +#include "project/clipboard.h" +#include "project/previewgenerator.h" +#include "ui/mainwindow.h" QUndoStack olive::UndoStack; @@ -598,9 +592,10 @@ void MediaRename::doRedo() { item->set_name(to); } -KeyframeDelete::KeyframeDelete(EffectField *ifield, int iindex) { - field = ifield; - index = iindex; +KeyframeDelete::KeyframeDelete(EffectField *ifield, int iindex) : + field(ifield), + index(iindex) +{ } void KeyframeDelete::doUndo() { @@ -1066,24 +1061,24 @@ void SetLong::doRedo() { *p = newval; } -KeyframeFieldSet::KeyframeFieldSet(EffectField *ifield, int ii) { - field = ifield; - index = ii; - key = ifield->keyframes.at(ii); - done = true; +KeyframeAdd::KeyframeAdd(EffectField *ifield, int ii) : + field(ifield), + index(ii), + key(ifield->keyframes.at(ii)), + done(true) +{ } -void KeyframeFieldSet::doUndo() { +void KeyframeAdd::doUndo() { field->keyframes.removeAt(index); - done = false; } -void KeyframeFieldSet::doRedo() { +void KeyframeAdd::doRedo() { if (!done) { field->keyframes.insert(index, key); + done = true; } - done = true; } SetIsKeyframing::SetIsKeyframing(EffectRow *irow, bool ib) { diff --git a/project/undo.h b/undo/undo.h similarity index 98% rename from project/undo.h rename to undo/undo.h index 62f53a50c..4327839f2 100644 --- a/project/undo.h +++ b/undo/undo.h @@ -21,13 +21,6 @@ #ifndef UNDO_H #define UNDO_H -#include "project/projectelements.h" -#include "project/selection.h" -#include "project/effectfields/effectfield.h" - -#include "ui/labelslider.h" -#include "ui/sourcetable.h" - #include #include #include @@ -35,6 +28,16 @@ #include #include +#include "project/projectelements.h" +#include "timeline/selection.h" +#include "timeline/clip.h" +#include "timeline/sequence.h" +#include "effects/transition.h" +#include "effects/effectfield.h" + +#include "ui/labelslider.h" +#include "ui/sourcetable.h" + namespace olive { extern QUndoStack UndoStack; } @@ -319,11 +322,9 @@ private: EffectKeyframe deleted_key; }; -// a more modern version of the above, could probably replace it -// assumes the keyframe already exists -class KeyframeFieldSet : public OliveAction { +class KeyframeAdd : public OliveAction { public: - KeyframeFieldSet(EffectField* ifield, int ii); + KeyframeAdd(EffectField* ifield, int ii); virtual void doUndo() override; virtual void doRedo() override; private: