diff --git a/app/dialog/CMakeLists.txt b/app/dialog/CMakeLists.txt
index b1a19fe5a..ff82a6b2c 100644
--- a/app/dialog/CMakeLists.txt
+++ b/app/dialog/CMakeLists.txt
@@ -28,6 +28,7 @@ add_subdirectory(preferences)
add_subdirectory(progress)
add_subdirectory(rendercancel)
add_subdirectory(sequence)
+add_subdirectory(speedduration)
add_subdirectory(task)
add_subdirectory(text)
diff --git a/app/dialog/speedduration/CMakeLists.txt b/app/dialog/speedduration/CMakeLists.txt
new file mode 100644
index 000000000..42471bd32
--- /dev/null
+++ b/app/dialog/speedduration/CMakeLists.txt
@@ -0,0 +1,22 @@
+# Olive - Non-Linear Video Editor
+# Copyright (C) 2021 Olive Team
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+set(OLIVE_SOURCES
+ ${OLIVE_SOURCES}
+ dialog/speedduration/speeddurationdialog.cpp
+ dialog/speedduration/speeddurationdialog.h
+ PARENT_SCOPE
+)
diff --git a/app/dialog/speedduration/speeddurationdialog.cpp b/app/dialog/speedduration/speeddurationdialog.cpp
new file mode 100644
index 000000000..be2bc38b6
--- /dev/null
+++ b/app/dialog/speedduration/speeddurationdialog.cpp
@@ -0,0 +1,61 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2021 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
+#include "speeddurationdialog.h"
+
+#include
+#include
+
+namespace olive {
+
+SpeedDurationDialog::SpeedDurationDialog(const QVector &clips, QWidget *parent) :
+ QDialog(parent)
+{
+ QGridLayout *layout = new QGridLayout(this);
+
+ int row = 0;
+
+ layout->addWidget(new QLabel(tr("Speed:")), row, 0);
+
+ FloatSlider *speed_slider_ = new FloatSlider();
+ layout->addWidget(speed_slider_, row, 1);
+
+ row++;
+
+ layout->addWidget(new QLabel(tr("Duration:")), row, 0);
+
+ dur_slider_ = new RationalSlider();
+ layout->addWidget(dur_slider_, row, 1);
+
+ row++;
+
+ ripple_box_ = new QCheckBox();
+ layout->addWidget(ripple_box_, row, 0, 1, 2);
+
+ row++;
+
+ QDialogButtonBox *btns = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ btns->setCenterButtons(true);
+ connect(btns, &QDialogButtonBox::accepted, this, &SpeedDurationDialog::accept);
+ connect(btns, &QDialogButtonBox::rejected, this, &SpeedDurationDialog::reject);
+ layout->addWidget(btns, row, 0, 1, 2);
+}
+
+}
diff --git a/app/dialog/speedduration/speeddurationdialog.h b/app/dialog/speedduration/speeddurationdialog.h
new file mode 100644
index 000000000..aadfee411
--- /dev/null
+++ b/app/dialog/speedduration/speeddurationdialog.h
@@ -0,0 +1,52 @@
+/***
+
+ Olive - Non-Linear Video Editor
+ Copyright (C) 2021 Olive Team
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+
+***/
+
+#ifndef SPEEDDURATIONDIALOG_H
+#define SPEEDDURATIONDIALOG_H
+
+#include
+#include
+
+#include "node/block/clip/clip.h"
+#include "widget/slider/floatslider.h"
+#include "widget/slider/rationalslider.h"
+
+namespace olive {
+
+class SpeedDurationDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit SpeedDurationDialog(const QVector &clips, QWidget *parent = nullptr);
+
+signals:
+
+private:
+ FloatSlider *speed_slider_;
+
+ RationalSlider *dur_slider_;
+
+ QCheckBox *ripple_box_;
+
+};
+
+}
+
+#endif // SPEEDDURATIONDIALOG_H
diff --git a/app/widget/menu/menushared.cpp b/app/widget/menu/menushared.cpp
index f2a7f2494..79623abbe 100644
--- a/app/widget/menu/menushared.cpp
+++ b/app/widget/menu/menushared.cpp
@@ -22,8 +22,10 @@
#include "core.h"
#include "common/timecodefunctions.h"
+#include "dialog/speedduration/speeddurationdialog.h"
#include "panel/panelmanager.h"
#include "panel/timeline/timeline.h"
+#include "window/mainwindow/mainwindow.h"
namespace olive {
@@ -45,6 +47,7 @@ MenuShared::MenuShared()
edit_delete_item_ = Menu::CreateItem(this, "delete", this, &MenuShared::DeleteSelectedTriggered, "Del");
edit_ripple_delete_item_ = Menu::CreateItem(this, "rippledelete", this, &MenuShared::RippleDeleteTriggered, "Shift+Del");
edit_split_item_ = Menu::CreateItem(this, "split", this, &MenuShared::SplitAtPlayheadTriggered, "Ctrl+K");
+ edit_speedduration_item_ = Menu::CreateItem(this, "speeddur", this, &MenuShared::SpeedDurationTriggered);
// "In/Out" menu shared items
inout_set_in_item_ = Menu::CreateItem(this, "setinpoint", this, &MenuShared::SetInTriggered, "I");
@@ -134,6 +137,7 @@ void MenuShared::AddItemsForEditMenu(Menu *m, bool for_clips)
if (for_clips) {
m->addAction(edit_ripple_delete_item_);
m->addAction(edit_split_item_);
+ m->addAction(edit_speedduration_item_);
}
}
@@ -301,6 +305,26 @@ void MenuShared::ColorLabelTriggered(int color_index)
PanelManager::instance()->CurrentlyFocused()->SetColorLabel(color_index);
}
+void MenuShared::SpeedDurationTriggered()
+{
+ TimelinePanel* timeline = PanelManager::instance()->MostRecentlyFocused();
+
+ if (timeline) {
+ QVector sel = timeline->GetSelectedBlocks();
+ QVector clips;
+
+ foreach (Block *b, sel) {
+ ClipBlock *c = dynamic_cast(b);
+ if (c) {
+ clips.append(c);
+ }
+ }
+
+ SpeedDurationDialog sdd(clips, Core::instance()->main_window());
+ sdd.exec();
+ }
+}
+
void MenuShared::Retranslate()
{
// "New" menu shared items
@@ -317,6 +341,7 @@ void MenuShared::Retranslate()
edit_delete_item_->setText(tr("Delete"));
edit_ripple_delete_item_->setText(tr("Ripple Delete"));
edit_split_item_->setText(tr("Split"));
+ edit_speedduration_item_->setText(tr("Speed/Duration"));
// "In/Out" menu shared items
inout_set_in_item_->setText(tr("Set In Point"));
diff --git a/app/widget/menu/menushared.h b/app/widget/menu/menushared.h
index 34d2cecb4..cdc3dcdec 100644
--- a/app/widget/menu/menushared.h
+++ b/app/widget/menu/menushared.h
@@ -75,6 +75,7 @@ private:
QAction* edit_delete_item_;
QAction* edit_ripple_delete_item_;
QAction* edit_split_item_;
+ QAction* edit_speedduration_item_;
// "In/Out" menu shared items
QAction* inout_set_in_item_;
@@ -145,6 +146,8 @@ private slots:
void ColorLabelTriggered(int color_index);
+ void SpeedDurationTriggered();
+
};
}