began reimpl of speed/dur diag

This commit is contained in:
itsmattkc
2021-08-01 11:25:23 -07:00
parent 8054124924
commit b20a839332
6 changed files with 164 additions and 0 deletions
+1
View File
@@ -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)
+22
View File
@@ -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 <http://www.gnu.org/licenses/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
dialog/speedduration/speeddurationdialog.cpp
dialog/speedduration/speeddurationdialog.h
PARENT_SCOPE
)
@@ -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 <http://www.gnu.org/licenses/>.
***/
#include "speeddurationdialog.h"
#include <QDialogButtonBox>
#include <QGridLayout>
namespace olive {
SpeedDurationDialog::SpeedDurationDialog(const QVector<ClipBlock *> &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);
}
}
@@ -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 <http://www.gnu.org/licenses/>.
***/
#ifndef SPEEDDURATIONDIALOG_H
#define SPEEDDURATIONDIALOG_H
#include <QCheckBox>
#include <QDialog>
#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<ClipBlock*> &clips, QWidget *parent = nullptr);
signals:
private:
FloatSlider *speed_slider_;
RationalSlider *dur_slider_;
QCheckBox *ripple_box_;
};
}
#endif // SPEEDDURATIONDIALOG_H
+25
View File
@@ -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<TimelinePanel>();
if (timeline) {
QVector<Block*> sel = timeline->GetSelectedBlocks();
QVector<ClipBlock*> clips;
foreach (Block *b, sel) {
ClipBlock *c = dynamic_cast<ClipBlock*>(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"));
+3
View File
@@ -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();
};
}