merge of long discussed new pipeline
This commit is contained in:
+52
-28
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include <QLinearGradient>
|
||||
#include <QtMath>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#define AUDIO_MONITOR_PEAK_HEIGHT 15
|
||||
#define AUDIO_MONITOR_GAP 3
|
||||
|
||||
@@ -39,23 +37,33 @@ extern "C" {
|
||||
}
|
||||
|
||||
AudioMonitor::AudioMonitor(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
QWidget(parent),
|
||||
peaked_(false)
|
||||
{
|
||||
clear_timer.setInterval(500);
|
||||
connect(&clear_timer, SIGNAL(timeout()), this, SLOT(clear()));
|
||||
}
|
||||
|
||||
void AudioMonitor::set_value(const QVector<double> &ivalues) {
|
||||
values = ivalues;
|
||||
update();
|
||||
void AudioMonitor::set_value(const QVector<float> &ivalues) {
|
||||
if (value_lock.tryLock()) {
|
||||
values = ivalues;
|
||||
|
||||
QMetaObject::invokeMethod(&clear_timer, "start", Qt::QueuedConnection);
|
||||
if (peaked_.size() != values.size()) {
|
||||
peaked_.resize(values.size());
|
||||
peaked_.fill(false);
|
||||
}
|
||||
|
||||
value_lock.unlock();
|
||||
|
||||
QMetaObject::invokeMethod(this, "update", Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(&clear_timer, "start", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioMonitor::clear() {
|
||||
clear_timer.stop();
|
||||
|
||||
values.fill(1);
|
||||
peaked_.fill(false);
|
||||
values.fill(0.0);
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -67,24 +75,39 @@ void AudioMonitor::resizeEvent(QResizeEvent *e) {
|
||||
QWidget::resizeEvent(e);
|
||||
}
|
||||
|
||||
void AudioMonitor::mousePressEvent(QMouseEvent *)
|
||||
{
|
||||
peaked_.fill(false);
|
||||
update();
|
||||
}
|
||||
|
||||
void AudioMonitor::paintEvent(QPaintEvent *) {
|
||||
if (olive::ActiveSequence != nullptr && values.size() > 0) {
|
||||
value_lock.lock();
|
||||
if (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<channel_count;i++) {
|
||||
|
||||
for (int i=0;i<channel_count;i++) {
|
||||
|
||||
// Fill audio monitor with red-yellow-green gradient
|
||||
QRect r(channel_x, AUDIO_MONITOR_PEAK_HEIGHT + AUDIO_MONITOR_GAP, channel_width, height());
|
||||
p.fillRect(r, gradient);
|
||||
|
||||
bool peak = false;
|
||||
// Check if we've peaked
|
||||
if (!peaked_[i] && values.at(i) > 1.0f) {
|
||||
peaked_[i] = true;
|
||||
}
|
||||
|
||||
r.setHeight(qRound(r.height()*(values.at(i))));
|
||||
peak = (r.height() == 0);
|
||||
// We draw an inverted dark shadow over the gradient to represent to are not lit up
|
||||
// TODO change to decibel representation
|
||||
float val = 1.0f - qMin(1.0f, values.at(i));
|
||||
r.setHeight(qRound(r.height()*val));
|
||||
|
||||
QRect peak_rect(channel_x, 0, channel_width, AUDIO_MONITOR_PEAK_HEIGHT);
|
||||
if (peak) {
|
||||
if (peaked_[i]) {
|
||||
// We're peaked on this channel, so we light up the peak light
|
||||
p.fillRect(peak_rect, QColor(255, 0, 0));
|
||||
} else {
|
||||
p.fillRect(peak_rect, QColor(64, 0, 0));
|
||||
@@ -95,4 +118,5 @@ void AudioMonitor::paintEvent(QPaintEvent *) {
|
||||
channel_x += channel_width + AUDIO_MONITOR_GAP;
|
||||
}
|
||||
}
|
||||
value_lock.unlock();
|
||||
}
|
||||
|
||||
+37
-17
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
#include <QMutex>
|
||||
|
||||
/**
|
||||
* @brief The AudioMonitor class
|
||||
@@ -52,22 +53,29 @@ public:
|
||||
* An array of doubles between 0.0 and 1.0 to display the amplitude. 0.0 is no audio, 1.0 is full volume. Each array
|
||||
* entry is a channel and the audio monitor will automatically adjust to the channel count in the array.
|
||||
*/
|
||||
void set_value(const QVector<double>& values);
|
||||
void set_value(const QVector<float> &values);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Internal paint event
|
||||
*
|
||||
* Paints the
|
||||
* Paints the audio monitor
|
||||
*/
|
||||
void paintEvent(QPaintEvent *);
|
||||
virtual void paintEvent(QPaintEvent *) override;
|
||||
|
||||
/**
|
||||
* @brief Internal resize event handler
|
||||
*
|
||||
* Triggers a repaint when the widget is resized.
|
||||
*/
|
||||
void resizeEvent(QResizeEvent *);
|
||||
virtual void resizeEvent(QResizeEvent *) override;
|
||||
|
||||
/**
|
||||
* @brief Internal mouse press handler
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
signals:
|
||||
|
||||
@@ -82,7 +90,14 @@ private:
|
||||
/**
|
||||
* @brief Internal value storage
|
||||
*/
|
||||
QVector<double> values;
|
||||
QVector<float> values;
|
||||
|
||||
/**
|
||||
* @brief Value mutex
|
||||
*
|
||||
* Audio is often processed and sent to this object from other threads. To keep them synchronized, we lock them here.
|
||||
*/
|
||||
QMutex value_lock;
|
||||
|
||||
/**
|
||||
* @brief Internal timer to clear the audio monitor after a certain amount of time
|
||||
@@ -92,6 +107,11 @@ private:
|
||||
*/
|
||||
QTimer clear_timer;
|
||||
|
||||
/**
|
||||
* @brief Internal variable for whether audio played as peaked or not
|
||||
*/
|
||||
QVector<bool> peaked_;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief Slot to clear the audio monitor
|
||||
|
||||
+20
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "blur.h"
|
||||
|
||||
void olive::ui::blur(QImage& result, const QRect& rect, int radius, bool alphaOnly) {
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef BLUR_H
|
||||
#define BLUR_H
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "checkboxex.h"
|
||||
|
||||
#include "undo/undostack.h"
|
||||
#include "undo/undo.h"
|
||||
|
||||
CheckboxEx::CheckboxEx(QWidget* parent) : QCheckBox(parent) {
|
||||
// connect(this, SIGNAL(clicked(bool)), this, SLOT(checkbox_command()));
|
||||
}
|
||||
|
||||
void CheckboxEx::checkbox_command() {
|
||||
CheckboxCommand* c = new CheckboxCommand(this);
|
||||
olive::UndoStack.push(c);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef CHECKBOXEX_H
|
||||
#define CHECKBOXEX_H
|
||||
|
||||
#include <QCheckBox>
|
||||
|
||||
class CheckboxEx : public QCheckBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CheckboxEx(QWidget* parent = 0);
|
||||
private slots:
|
||||
void checkbox_command();
|
||||
};
|
||||
|
||||
#endif // CHECKBOXEX_H
|
||||
+20
-15
@@ -1,33 +1,38 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
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 "clickablelabel.h"
|
||||
|
||||
ClickableLabel::ClickableLabel(QWidget *parent, Qt::WindowFlags f) :
|
||||
QLabel(parent, f)
|
||||
QLabel(parent, f)
|
||||
{}
|
||||
|
||||
ClickableLabel::ClickableLabel(const QString &text, QWidget *parent, Qt::WindowFlags f) :
|
||||
QLabel(text, parent, f)
|
||||
QLabel(text, parent, f)
|
||||
{}
|
||||
|
||||
void ClickableLabel::mousePressEvent(QMouseEvent *) {
|
||||
emit clicked();
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
void ClickableLabel::mouseDoubleClickEvent(QMouseEvent *ev)
|
||||
{
|
||||
emit double_clicked();
|
||||
}
|
||||
|
||||
+19
-17
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -29,13 +29,15 @@
|
||||
* Simple QLabel-derived class that emits a clicked() signal when the widget receives a mouse press event.
|
||||
*/
|
||||
class ClickableLabel : public QLabel {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
ClickableLabel(QWidget * parent = 0, Qt::WindowFlags f = 0);
|
||||
ClickableLabel(const QString & text, QWidget * parent = 0, Qt::WindowFlags f = 0);
|
||||
void mousePressEvent(QMouseEvent *ev);
|
||||
ClickableLabel(QWidget * parent = nullptr, Qt::WindowFlags f = nullptr);
|
||||
ClickableLabel(const QString & text, QWidget * parent = nullptr, Qt::WindowFlags f = nullptr);
|
||||
virtual void mousePressEvent(QMouseEvent *ev) override;
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *ev) override;
|
||||
signals:
|
||||
void clicked();
|
||||
void clicked();
|
||||
void double_clicked();
|
||||
};
|
||||
|
||||
#endif // CLICKABLELABEL_H
|
||||
|
||||
+85
-38
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -29,13 +29,16 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QWidget>
|
||||
#include <QPainter>
|
||||
#include <QStyle>
|
||||
#include <QApplication>
|
||||
|
||||
#include "ui/icons.h"
|
||||
#include "global/debug.h"
|
||||
|
||||
CollapsibleWidget::CollapsibleWidget(QWidget* parent) : QWidget(parent) {
|
||||
selected = false;
|
||||
|
||||
CollapsibleWidget::CollapsibleWidget(QWidget* parent) :
|
||||
QWidget(parent),
|
||||
contents(nullptr)
|
||||
{
|
||||
layout = new QVBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
@@ -58,24 +61,13 @@ CollapsibleWidget::CollapsibleWidget(QWidget* parent) : QWidget(parent) {
|
||||
title_bar_layout->addStretch();
|
||||
layout->addWidget(title_bar);
|
||||
|
||||
connect(title_bar, SIGNAL(select(bool, bool)), this, SLOT(header_click(bool, bool)));
|
||||
connect(title_bar, SIGNAL(select()), this, SLOT(Selected()));
|
||||
|
||||
set_button_icon(true);
|
||||
|
||||
contents = nullptr;
|
||||
}
|
||||
|
||||
void CollapsibleWidget::header_click(bool s, bool deselect) {
|
||||
selected = s;
|
||||
title_bar->selected = s;
|
||||
if (s) {
|
||||
QPalette p = title_bar->palette();
|
||||
p.setColor(QPalette::Background, QColor(255, 255, 255, 64));
|
||||
title_bar->setPalette(p);
|
||||
} else {
|
||||
title_bar->setPalette(palette());
|
||||
}
|
||||
if (deselect) emit deselect_others(this);
|
||||
void CollapsibleWidget::Selected() {
|
||||
emit deselect_others(this);
|
||||
}
|
||||
|
||||
bool CollapsibleWidget::IsFocused() {
|
||||
@@ -96,7 +88,17 @@ void CollapsibleWidget::SetExpanded(bool s)
|
||||
|
||||
bool CollapsibleWidget::IsSelected()
|
||||
{
|
||||
return selected;
|
||||
return title_bar->IsSelected();
|
||||
}
|
||||
|
||||
void CollapsibleWidget::Deselect()
|
||||
{
|
||||
title_bar->SetSelected(false);
|
||||
}
|
||||
|
||||
void CollapsibleWidget::SetSelectable(bool s)
|
||||
{
|
||||
title_bar->SetSelectable(s);
|
||||
}
|
||||
|
||||
void CollapsibleWidget::set_button_icon(bool open) {
|
||||
@@ -108,7 +110,6 @@ void CollapsibleWidget::SetContents(QWidget* c) {
|
||||
contents = c;
|
||||
if (!existing) {
|
||||
layout->addWidget(contents);
|
||||
connect(enabled_check, SIGNAL(toggled(bool)), contents, SLOT(setEnabled(bool)));
|
||||
connect(collapse_button, SIGNAL(clicked()), this, SLOT(on_visible_change()));
|
||||
}
|
||||
}
|
||||
@@ -126,19 +127,65 @@ void CollapsibleWidget::on_visible_change() {
|
||||
SetExpanded(!IsExpanded());
|
||||
}
|
||||
|
||||
CollapsibleWidgetHeader::CollapsibleWidgetHeader(QWidget* parent) : QWidget(parent), selected(false) {
|
||||
CollapsibleWidgetHeader::CollapsibleWidgetHeader(QWidget* parent) :
|
||||
QWidget(parent),
|
||||
selected_(false),
|
||||
selectable_(true)
|
||||
{
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
}
|
||||
|
||||
bool CollapsibleWidgetHeader::IsSelected()
|
||||
{
|
||||
return selected_;
|
||||
}
|
||||
|
||||
void CollapsibleWidgetHeader::SetSelected(bool s, bool deselect_others)
|
||||
{
|
||||
selected_ = s;
|
||||
|
||||
if (s) {
|
||||
QPalette p = palette();
|
||||
p.setColor(QPalette::Background, QColor(255, 255, 255, 64));
|
||||
setPalette(p);
|
||||
} else {
|
||||
setPalette(qApp->palette());
|
||||
}
|
||||
|
||||
if (deselect_others) {
|
||||
emit select();
|
||||
}
|
||||
}
|
||||
|
||||
void CollapsibleWidgetHeader::SetSelectable(bool s)
|
||||
{
|
||||
selectable_ = s;
|
||||
|
||||
if (!selectable_ && selected_) {
|
||||
SetSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool CollapsibleWidgetHeader::event(QEvent *event)
|
||||
{
|
||||
if (!selectable_
|
||||
&& (event->type() == QEvent::MouseButtonPress
|
||||
|| event->type() == QEvent::MouseButtonRelease
|
||||
|| event->type() == QEvent::MouseMove
|
||||
|| event->type() == QEvent::MouseButtonDblClick)
|
||||
&& QApplication::sendEvent(parent(), event)) {
|
||||
return true;
|
||||
}
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
void CollapsibleWidgetHeader::mousePressEvent(QMouseEvent* event) {
|
||||
if (selected) {
|
||||
if ((event->modifiers() & Qt::ShiftModifier)) {
|
||||
selected = false;
|
||||
emit select(selected, false);
|
||||
if (selected_) {
|
||||
if (event->modifiers() & Qt::ShiftModifier) {
|
||||
SetSelected(false);
|
||||
}
|
||||
} else {
|
||||
selected = true;
|
||||
emit select(selected, !(event->modifiers() & Qt::ShiftModifier));
|
||||
SetSelected(true, !(event->modifiers() & Qt::ShiftModifier));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+28
-18
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -34,12 +34,20 @@ class CollapsibleWidgetHeader : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
CollapsibleWidgetHeader(QWidget* parent = nullptr);
|
||||
bool selected;
|
||||
|
||||
bool IsSelected();
|
||||
void SetSelected(bool s, bool deselect_others = false);
|
||||
|
||||
void SetSelectable(bool s);
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
virtual bool event(QEvent *event) override;
|
||||
virtual void mousePressEvent(QMouseEvent* event) override;
|
||||
virtual void paintEvent(QPaintEvent *event) override;
|
||||
signals:
|
||||
void select(bool, bool);
|
||||
void select();
|
||||
private:
|
||||
bool selected_;
|
||||
bool selectable_;
|
||||
};
|
||||
|
||||
class CollapsibleWidget : public QWidget
|
||||
@@ -53,13 +61,15 @@ public:
|
||||
bool IsFocused();
|
||||
bool IsExpanded();
|
||||
void SetExpanded(bool s);
|
||||
|
||||
bool IsSelected();
|
||||
void Deselect();
|
||||
void SetSelectable(bool s);
|
||||
protected:
|
||||
QCheckBox* enabled_check;
|
||||
CollapsibleWidgetHeader* title_bar;
|
||||
QWidget* contents;
|
||||
private:
|
||||
bool selected;
|
||||
QLabel* header;
|
||||
QVBoxLayout* layout;
|
||||
QPushButton* collapse_button;
|
||||
@@ -75,7 +85,7 @@ private slots:
|
||||
void on_visible_change();
|
||||
|
||||
public slots:
|
||||
void header_click(bool s, bool deselect);
|
||||
void Selected();
|
||||
};
|
||||
|
||||
#endif // COLLAPSIBLEWIDGET_H
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+86
-61
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "effectui.h"
|
||||
|
||||
#include <QPoint>
|
||||
@@ -9,7 +29,7 @@
|
||||
#include "ui/menu.h"
|
||||
#include "panels/panels.h"
|
||||
|
||||
EffectUI::EffectUI(Effect* e) :
|
||||
EffectUI::EffectUI(Node* e) :
|
||||
effect_(e)
|
||||
{
|
||||
Q_ASSERT(e != nullptr);
|
||||
@@ -17,7 +37,7 @@ EffectUI::EffectUI(Effect* e) :
|
||||
QString effect_name;
|
||||
|
||||
// If this effect is actually a transition
|
||||
if (e->meta->type == EFFECT_TYPE_TRANSITION) {
|
||||
if (e->type() == EFFECT_TYPE_TRANSITION) {
|
||||
|
||||
Transition* t = static_cast<Transition*>(e);
|
||||
|
||||
@@ -49,17 +69,17 @@ EffectUI::EffectUI(Effect* e) :
|
||||
|
||||
// See if the transition is the clip's opening or closing transition and label it accordingly
|
||||
if (both_selected) {
|
||||
effect_name = t->name;
|
||||
effect_name = t->name();
|
||||
} else if (selected_clip->opening_transition.get() == t) {
|
||||
effect_name = tr("%1 (Opening)").arg(t->name);
|
||||
effect_name = tr("%1 (Opening)").arg(t->name());
|
||||
} else {
|
||||
effect_name = tr("%1 (Closing)").arg(t->name);
|
||||
effect_name = tr("%1 (Closing)").arg(t->name());
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Otherwise just set the title normally
|
||||
effect_name = e->name;
|
||||
effect_name = e->name();
|
||||
|
||||
}
|
||||
|
||||
@@ -69,6 +89,9 @@ EffectUI::EffectUI(Effect* e) :
|
||||
ui->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
|
||||
SetContents(ui);
|
||||
|
||||
title_bar->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum);
|
||||
|
||||
SetExpanded(e->IsExpanded());
|
||||
connect(this, SIGNAL(visibleChanged(bool)), e, SLOT(SetExpanded(bool)));
|
||||
|
||||
@@ -80,9 +103,8 @@ EffectUI::EffectUI(Effect* e) :
|
||||
this,
|
||||
SLOT(show_context_menu(const QPoint&)));
|
||||
|
||||
int maximum_column = 0;
|
||||
|
||||
widgets_.resize(e->row_count());
|
||||
keyframe_navigators_.resize(e->row_count());
|
||||
|
||||
for (int i=0;i<e->row_count();i++) {
|
||||
EffectRow* row = e->row(i);
|
||||
@@ -92,55 +114,50 @@ EffectUI::EffectUI(Effect* e) :
|
||||
|
||||
labels_.append(row_label);
|
||||
|
||||
layout_->addWidget(row_label, i, 0);
|
||||
if (row->IsNodeOutput()) {
|
||||
|
||||
widgets_[i].resize(row->FieldCount());
|
||||
|
||||
int column = 1;
|
||||
for (int j=0;j<row->FieldCount();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();
|
||||
}
|
||||
|
||||
// Find maximum column to place keyframe controls
|
||||
maximum_column = qMax(row->FieldCount(), maximum_column);
|
||||
}
|
||||
|
||||
// Create keyframe controls
|
||||
maximum_column++;
|
||||
|
||||
keyframe_navigators_.resize(e->row_count());
|
||||
|
||||
for (int i=0;i<e->row_count();i++) {
|
||||
EffectRow* row = e->row(i);
|
||||
|
||||
KeyframeNavigator* nav;
|
||||
|
||||
if (row->IsKeyframable()) {
|
||||
|
||||
nav = new KeyframeNavigator();
|
||||
|
||||
nav->enable_keyframes(row->IsKeyframing());
|
||||
|
||||
AttachKeyframeNavigationToRow(row, nav);
|
||||
|
||||
layout_->addWidget(nav, i, maximum_column);
|
||||
row_label->setAlignment(Qt::AlignRight);
|
||||
layout_->addWidget(row_label, i, 2);
|
||||
|
||||
} else {
|
||||
|
||||
nav = nullptr;
|
||||
layout_->addWidget(row_label, i, 0);
|
||||
|
||||
widgets_[i].resize(row->FieldCount());
|
||||
|
||||
QGridLayout* field_layout = new QGridLayout();
|
||||
for (int j=0;j<row->FieldCount();j++) {
|
||||
EffectField* field = row->Field(j);
|
||||
|
||||
QWidget* widget = field->CreateWidget();
|
||||
|
||||
widgets_[i][j] = widget;
|
||||
|
||||
field_layout->addWidget(widget, 0, j);
|
||||
}
|
||||
layout_->addLayout(field_layout, i, 1);
|
||||
|
||||
KeyframeNavigator* nav;
|
||||
|
||||
if (row->IsKeyframable()) {
|
||||
|
||||
nav = new KeyframeNavigator();
|
||||
|
||||
nav->enable_keyframes(row->IsKeyframing());
|
||||
|
||||
AttachKeyframeNavigationToRow(row, nav);
|
||||
|
||||
layout_->addWidget(nav, i, 2);
|
||||
|
||||
} else {
|
||||
|
||||
nav = nullptr;
|
||||
|
||||
}
|
||||
|
||||
keyframe_navigators_[i] = nav;
|
||||
|
||||
}
|
||||
|
||||
keyframe_navigators_[i] = nav;
|
||||
|
||||
}
|
||||
|
||||
enabled_check->setChecked(e->IsEnabled());
|
||||
@@ -148,10 +165,10 @@ EffectUI::EffectUI(Effect* e) :
|
||||
connect(enabled_check, SIGNAL(toggled(bool)), e, SLOT(FieldChanged()));
|
||||
}
|
||||
|
||||
void EffectUI::AddAdditionalEffect(Effect *e)
|
||||
void EffectUI::AddAdditionalEffect(Node *e)
|
||||
{
|
||||
// Ensure this is the same kind of effect and will be fully compatible
|
||||
Q_ASSERT(e->meta == effect_->meta);
|
||||
Q_ASSERT(e->id() == effect_->id());
|
||||
|
||||
// Add 'multiple' modifier to header label (but only once)
|
||||
if (additional_effects_.isEmpty()) {
|
||||
@@ -181,7 +198,7 @@ void EffectUI::AddAdditionalEffect(Effect *e)
|
||||
}
|
||||
}
|
||||
|
||||
Effect *EffectUI::GetEffect()
|
||||
Node *EffectUI::GetEffect()
|
||||
{
|
||||
return effect_;
|
||||
}
|
||||
@@ -193,16 +210,24 @@ int EffectUI::GetRowY(int row, QWidget* mapToWidget) {
|
||||
|
||||
QLabel* row_label = labels_.at(row);
|
||||
|
||||
int mapped_coord;
|
||||
if (mapToWidget == nullptr) {
|
||||
mapped_coord = contents->pos().y();
|
||||
} else {
|
||||
// FIXME Problematic now that EffectUIs are used outside of EffectControls
|
||||
mapped_coord = mapToWidget->mapFrom(panel_effect_controls, contents->mapTo(panel_effect_controls, contents->pos())).y();
|
||||
mapped_coord -= title_bar->height();
|
||||
}
|
||||
|
||||
// Get center point of label (label->rect()->center()->y() - instead of y()+height/2 - produces an inaccurate result)
|
||||
return row_label->y()
|
||||
+ row_label->height() / 2
|
||||
+ mapToWidget->mapFrom(panel_effect_controls, contents->mapTo(panel_effect_controls, contents->pos())).y()
|
||||
- title_bar->height();
|
||||
+ mapped_coord;
|
||||
}
|
||||
|
||||
void EffectUI::UpdateFromEffect()
|
||||
{
|
||||
Effect* effect = GetEffect();
|
||||
Node* effect = GetEffect();
|
||||
|
||||
for (int j=0;j<effect->row_count();j++) {
|
||||
|
||||
@@ -214,7 +239,7 @@ void EffectUI::UpdateFromEffect()
|
||||
// Check if this UI object is attached to one effect or many
|
||||
if (additional_effects_.isEmpty()) {
|
||||
|
||||
field->UpdateWidgetValue(Widget(j, k), field->Now());
|
||||
field->UpdateWidgetValue(Widget(j, k), effect->Now());
|
||||
|
||||
} else {
|
||||
|
||||
@@ -224,14 +249,14 @@ void EffectUI::UpdateFromEffect()
|
||||
EffectField* previous_field = i > 0 ? additional_effects_.at(i-1)->row(j)->Field(k) : field;
|
||||
EffectField* additional_field = additional_effects_.at(i)->row(j)->Field(k);
|
||||
|
||||
if (additional_field->GetValueAt(additional_field->Now()) != previous_field->GetValueAt(previous_field->Now())) {
|
||||
if (additional_field->GetValueAt(additional_effects_.at(i)->Now()) != previous_field->GetValueAt(additional_effects_.at(i-1)->Now())) {
|
||||
same_value = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (same_value) {
|
||||
field->UpdateWidgetValue(Widget(j, k), field->Now());
|
||||
field->UpdateWidgetValue(Widget(j, k), effect->Now());
|
||||
} else {
|
||||
field->UpdateWidgetValue(Widget(j, k), qSNaN());
|
||||
}
|
||||
@@ -276,7 +301,7 @@ void EffectUI::AttachKeyframeNavigationToRow(EffectRow *row, KeyframeNavigator *
|
||||
}
|
||||
|
||||
void EffectUI::show_context_menu(const QPoint& pos) {
|
||||
if (effect_->meta->type == EFFECT_TYPE_EFFECT) {
|
||||
if (effect_->type() == EFFECT_TYPE_EFFECT) {
|
||||
Menu menu;
|
||||
|
||||
Clip* c = effect_->parent_clip;
|
||||
|
||||
+31
-7
@@ -1,8 +1,30 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef EFFECTUI_H
|
||||
#define EFFECTUI_H
|
||||
|
||||
#include "collapsiblewidget.h"
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
#include "ui/nodeui.h"
|
||||
#include "ui/keyframenavigator.h"
|
||||
|
||||
/**
|
||||
* @brief The EffectUI class
|
||||
@@ -28,7 +50,7 @@ public:
|
||||
*
|
||||
* The Effect to make a UI of. It must be a valid object.
|
||||
*/
|
||||
EffectUI(Effect* e);
|
||||
EffectUI(Node* e);
|
||||
|
||||
/**
|
||||
* @brief Attach additional effects to this UI
|
||||
@@ -41,7 +63,7 @@ public:
|
||||
*
|
||||
* The Effect to add to this UI object.
|
||||
*/
|
||||
void AddAdditionalEffect(Effect* e);
|
||||
void AddAdditionalEffect(Node* e);
|
||||
|
||||
/**
|
||||
* @brief Get the primary Effect that this UI object was created for
|
||||
@@ -50,7 +72,7 @@ public:
|
||||
*
|
||||
* The Effect object passed to the constructor when creating this EffectUI.
|
||||
*/
|
||||
Effect* GetEffect();
|
||||
Node* GetEffect();
|
||||
|
||||
/**
|
||||
* @brief Get the Y position of a given row
|
||||
@@ -74,7 +96,7 @@ public:
|
||||
*
|
||||
* The row's Y position.
|
||||
*/
|
||||
int GetRowY(int row, QWidget *mapToWidget);
|
||||
int GetRowY(int row, QWidget *mapToWidget = nullptr);
|
||||
|
||||
/**
|
||||
* @brief Update widgets with the current Effect's values.
|
||||
@@ -111,6 +133,8 @@ public:
|
||||
*/
|
||||
bool IsAttachedToClip(Clip* c);
|
||||
|
||||
protected:
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Cut signal
|
||||
@@ -148,12 +172,12 @@ private:
|
||||
/**
|
||||
* @brief Internal reference to the Effect this object was constructed around.
|
||||
*/
|
||||
Effect* effect_;
|
||||
Node* effect_;
|
||||
|
||||
/**
|
||||
* @brief Internal array of additional Effect objects attached to this UI.
|
||||
*/
|
||||
QVector<Effect*> additional_effects_;
|
||||
QVector<Node*> additional_effects_;
|
||||
|
||||
/**
|
||||
* @brief Layout for UI widgets
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+39
-33
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -93,14 +93,14 @@ void FocusFilter::go_to_end() {
|
||||
|
||||
void FocusFilter::set_viewer_fullscreen() {
|
||||
if (get_focused_panel() == panel_footage_viewer) {
|
||||
panel_footage_viewer->viewer_widget->set_fullscreen();
|
||||
panel_footage_viewer->viewer_widget()->set_fullscreen();
|
||||
} else {
|
||||
panel_sequence_viewer->viewer_widget->set_fullscreen();
|
||||
panel_sequence_viewer->viewer_widget()->set_fullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
void FocusFilter::set_marker() {
|
||||
if (olive::ActiveSequence != nullptr) {
|
||||
if (Timeline::GetTopSequence() != nullptr) {
|
||||
QDockWidget* focused_panel = get_focused_panel();
|
||||
|
||||
if (focused_panel == panel_footage_viewer) {
|
||||
@@ -108,7 +108,7 @@ void FocusFilter::set_marker() {
|
||||
} else if (focused_panel == panel_sequence_viewer) {
|
||||
panel_sequence_viewer->set_marker();
|
||||
} else {
|
||||
panel_timeline->set_marker();
|
||||
panel_timeline.first()->set_marker();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -190,28 +190,34 @@ void FocusFilter::clear_inout() {
|
||||
}
|
||||
|
||||
void FocusFilter::delete_function() {
|
||||
if (panel_timeline->headers->hasFocus()) {
|
||||
panel_timeline->headers->delete_markers();
|
||||
if (panel_timeline.first()->headers->hasFocus()) {
|
||||
panel_timeline.first()->headers->delete_markers();
|
||||
} else if (panel_footage_viewer->headers->hasFocus()) {
|
||||
panel_footage_viewer->headers->delete_markers();
|
||||
} else if (panel_sequence_viewer->headers->hasFocus()) {
|
||||
panel_sequence_viewer->headers->delete_markers();
|
||||
} else if (panel_effect_controls->is_focused()) {
|
||||
} else if (panel_effect_controls->focused()) {
|
||||
panel_effect_controls->DeleteSelectedEffects();
|
||||
} else if (panel_project->is_focused()) {
|
||||
panel_project->delete_selected_media();
|
||||
} else if (panel_effect_controls->keyframe_focus()) {
|
||||
} else if (panel_project.first()->focused()) {
|
||||
panel_project.first()->delete_selected_media();
|
||||
} else if (panel_effect_controls->focused()) {
|
||||
panel_effect_controls->delete_selected_keyframes();
|
||||
} else if (panel_graph_editor->view_is_focused()) {
|
||||
} else if (panel_graph_editor->focused()) {
|
||||
panel_graph_editor->delete_selected_keys();
|
||||
} else {
|
||||
panel_timeline->delete_selection(olive::ActiveSequence->selections, false);
|
||||
Sequence* top_sequence = Timeline::GetTopSequence().get();
|
||||
if (top_sequence != nullptr) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
top_sequence->DeleteAreas(ca, top_sequence->Selections(), true);
|
||||
olive::undo_stack.push(ca);
|
||||
update_ui(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FocusFilter::duplicate() {
|
||||
if (panel_project->is_focused()) {
|
||||
panel_project->duplicate_selected();
|
||||
if (panel_project.first()->focused()) {
|
||||
panel_project.first()->duplicate_selected();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +226,7 @@ void FocusFilter::select_all() {
|
||||
if (focused_panel == panel_graph_editor) {
|
||||
panel_graph_editor->select_all();
|
||||
} else {
|
||||
panel_timeline->select_all();
|
||||
panel_timeline.first()->select_all();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +239,7 @@ void FocusFilter::zoom_in() {
|
||||
} else if (focused_panel == panel_sequence_viewer) {
|
||||
panel_sequence_viewer->set_zoom(true);
|
||||
} else {
|
||||
panel_timeline->zoom_in();
|
||||
panel_timeline.first()->zoom_in();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,28 +252,28 @@ void FocusFilter::zoom_out() {
|
||||
} else if (focused_panel == panel_sequence_viewer) {
|
||||
panel_sequence_viewer->set_zoom(false);
|
||||
} else {
|
||||
panel_timeline->zoom_out();
|
||||
panel_timeline.first()->zoom_out();
|
||||
}
|
||||
}
|
||||
|
||||
void FocusFilter::cut() {
|
||||
if (olive::ActiveSequence != nullptr) {
|
||||
if (Timeline::GetTopSequence() != nullptr) {
|
||||
QDockWidget* focused_panel = get_focused_panel();
|
||||
if (panel_effect_controls == focused_panel) {
|
||||
panel_effect_controls->copy(true);
|
||||
} else {
|
||||
panel_timeline->copy(true);
|
||||
panel_timeline.first()->copy(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FocusFilter::copy() {
|
||||
if (olive::ActiveSequence != nullptr) {
|
||||
if (Timeline::GetTopSequence() != nullptr) {
|
||||
QDockWidget* focused_panel = get_focused_panel();
|
||||
if (panel_effect_controls == focused_panel) {
|
||||
panel_effect_controls->copy(false);
|
||||
} else {
|
||||
panel_timeline->copy(false);
|
||||
panel_timeline.first()->copy(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
@@ -1,35 +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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "fontcombobox.h"
|
||||
|
||||
#include <QFontDatabase>
|
||||
|
||||
FontCombobox::FontCombobox(QWidget* parent) : QComboBox(parent) {
|
||||
addItems(QFontDatabase().families());
|
||||
|
||||
value = currentText();
|
||||
|
||||
connect(this, SIGNAL(currentTextChanged(QString)), this, SLOT(updateInternals()));
|
||||
}
|
||||
|
||||
void FontCombobox::updateInternals() {
|
||||
value = currentText();
|
||||
}
|
||||
@@ -1,36 +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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef FONTCOMBOBOX_H
|
||||
#define FONTCOMBOBOX_H
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
class FontCombobox : public QComboBox {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FontCombobox(QWidget* parent = nullptr);
|
||||
private slots:
|
||||
void updateInternals();
|
||||
private:
|
||||
QString value;
|
||||
};
|
||||
|
||||
#endif // FONTCOMBOBOX_H
|
||||
+19
-19
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "ui/keyframedrawing.h"
|
||||
#include "undo/undo.h"
|
||||
#include "undo/undostack.h"
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "ui/rectangleselect.h"
|
||||
#include "ui/menu.h"
|
||||
@@ -347,7 +347,7 @@ void GraphView::paintEvent(QPaintEvent *) {
|
||||
p.drawLine(playhead_x, 0, playhead_x, height());
|
||||
|
||||
if (rect_select) {
|
||||
draw_selection_rectangle(p, QRect(rect_select_x, rect_select_y, rect_select_w, rect_select_h));
|
||||
olive::ui::DrawSelectionRectangle(p, QRect(rect_select_x, rect_select_y, rect_select_w, rect_select_h));
|
||||
p.setBrush(Qt::NoBrush);
|
||||
}
|
||||
}
|
||||
@@ -470,7 +470,7 @@ void GraphView::mousePressEvent(QMouseEvent *event) {
|
||||
void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
if (!mousedown || !click_add) unsetCursor();
|
||||
if (mousedown) {
|
||||
if (event->buttons() & Qt::MiddleButton || panel_timeline->tool == TIMELINE_TOOL_HAND) {
|
||||
if (event->buttons() & Qt::MiddleButton || olive::timeline::current_tool == olive::timeline::TIMELINE_TOOL_HAND) {
|
||||
set_scroll_x(x_scroll + start_x - event->pos().x());
|
||||
set_scroll_y(y_scroll + event->pos().y() - start_y);
|
||||
start_x = event->pos().x();
|
||||
@@ -701,7 +701,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
|
||||
void GraphView::mouseReleaseEvent(QMouseEvent *) {
|
||||
if (click_add_proc) {
|
||||
olive::UndoStack.push(new KeyframeAdd(click_add_field, click_add_key));
|
||||
olive::undo_stack.push(new KeyframeAdd(click_add_field, click_add_key));
|
||||
} else if (moved_keys && selected_keys.size() > 0) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
switch (current_handle) {
|
||||
@@ -723,7 +723,7 @@ void GraphView::mouseReleaseEvent(QMouseEvent *) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
}
|
||||
moved_keys = false;
|
||||
mousedown = false;
|
||||
@@ -757,7 +757,7 @@ void GraphView::wheelEvent(QWheelEvent *event) {
|
||||
double new_x_zoom = x_zoom;
|
||||
double new_y_zoom = y_zoom;
|
||||
|
||||
if (ctrl != olive::CurrentConfig.scroll_zooms) {
|
||||
if (ctrl != olive::config.scroll_zooms) {
|
||||
zooming = true;
|
||||
}
|
||||
|
||||
@@ -849,7 +849,7 @@ void GraphView::set_selected_keyframe_type(int type) {
|
||||
EffectKeyframe& key = row->Field(selected_keys_fields.at(i))->keyframes[selected_keys.at(i)];
|
||||
ca->append(new SetInt(&key.type, type));
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
update_ui(false);
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "icons.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
+20
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef ICONS_H
|
||||
#define ICONS_H
|
||||
|
||||
|
||||
+13
-13
@@ -1,26 +1,26 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
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 "keyframedrawing.h"
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
#include "timeline/clip.h"
|
||||
|
||||
#define KEYFRAME_POINT_COUNT 4
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+29
-27
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <QMouseEvent>
|
||||
#include <QtMath>
|
||||
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "panels/panels.h"
|
||||
#include "timeline/clip.h"
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "effects/keyframe.h"
|
||||
#include "ui/graphview.h"
|
||||
#include "ui/menu.h"
|
||||
#include "global/math.h"
|
||||
|
||||
KeyframeView::KeyframeView(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@@ -95,7 +96,7 @@ void KeyframeView::menu_set_key_type(QAction* a) {
|
||||
EffectField* f = selected_fields.at(i);
|
||||
ca->append(new SetInt(&f->keyframes[selected_keyframes.at(i)].type, a->data().toInt()));
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
update_ui(false);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +120,7 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
||||
for (int j=0;j<open_effects_.size();j++) {
|
||||
|
||||
EffectUI* container = open_effects_.at(j);
|
||||
Effect* e = container->GetEffect();
|
||||
Node* e = container->GetEffect();
|
||||
|
||||
if (container->IsExpanded()) {
|
||||
for (int j=0;j<e->row_count();j++) {
|
||||
@@ -172,8 +173,9 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
||||
panel_effect_controls->horizontalScrollBar->setMaximum(qMax(max_width - width(), 0));
|
||||
header->set_visible_in(visible_in);
|
||||
|
||||
int playhead_x = getScreenPointFromFrame(panel_effect_controls->zoom, olive::ActiveSequence->playhead-visible_in) - x_scroll;
|
||||
if (dragging && panel_timeline->snapped) {
|
||||
int playhead_x = getScreenPointFromFrame(panel_effect_controls->zoom,
|
||||
open_effects_.first()->GetEffect()->parent_clip->track()->sequence()->playhead-visible_in) - x_scroll;
|
||||
if (dragging && olive::timeline::snapped) {
|
||||
p.setPen(Qt::white);
|
||||
} else {
|
||||
p.setPen(Qt::red);
|
||||
@@ -182,7 +184,7 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
||||
}
|
||||
|
||||
if (select_rect) {
|
||||
draw_selection_rectangle(p, QRect(rect_select_x, rect_select_y, rect_select_w, rect_select_h));
|
||||
olive::ui::DrawSelectionRectangle(p, QRect(rect_select_x, rect_select_y, rect_select_w, rect_select_h));
|
||||
}
|
||||
|
||||
/*if (mouseover && mouseover_row < rowY.size()) {
|
||||
@@ -234,7 +236,7 @@ void KeyframeView::mousePressEvent(QMouseEvent *event) {
|
||||
rect_select_w = 0;
|
||||
rect_select_h = 0;
|
||||
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_HAND || event->buttons() & Qt::MiddleButton) {
|
||||
if (olive::timeline::current_tool == olive::timeline::TIMELINE_TOOL_HAND || event->buttons() & Qt::MiddleButton) {
|
||||
scroll_drag = true;
|
||||
return;
|
||||
}
|
||||
@@ -323,7 +325,7 @@ void KeyframeView::mousePressEvent(QMouseEvent *event) {
|
||||
}
|
||||
|
||||
void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_HAND) {
|
||||
if (olive::timeline::current_tool == olive::timeline::TIMELINE_TOOL_HAND) {
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
} else {
|
||||
unsetCursor();
|
||||
@@ -376,14 +378,14 @@ void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
|
||||
long frame_diff = current_frame - drag_frame_start;
|
||||
|
||||
// snapping to playhead
|
||||
panel_timeline->snapped = false;
|
||||
if (panel_timeline->snapping) {
|
||||
olive::timeline::snapped = false;
|
||||
if (olive::timeline::snapping) {
|
||||
for (int i=0;i<selected_keyframes.size();i++) {
|
||||
EffectField* field = selected_fields.at(i);
|
||||
Clip* c = field->GetParentRow()->GetParentEffect()->parent_clip;
|
||||
long key_time = old_key_vals.at(i) + frame_diff - c->clip_in() + c->timeline_in();
|
||||
long key_eval = key_time;
|
||||
if (panel_timeline->snap_to_point(olive::ActiveSequence->playhead, &key_eval)) {
|
||||
if (olive::timeline::SnapToPoint(c->track()->sequence()->playhead, &key_eval, header->get_zoom())) {
|
||||
frame_diff += (key_eval - key_time);
|
||||
break;
|
||||
}
|
||||
@@ -398,10 +400,10 @@ void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
|
||||
while (!keyframeIsSelected(field, j) && field->keyframes.at(j).time == eval_key + frame_diff) {
|
||||
if (last_frame_diff > frame_diff) {
|
||||
frame_diff++;
|
||||
panel_timeline->snapped = false;
|
||||
olive::timeline::snapped = false;
|
||||
} else {
|
||||
frame_diff--;
|
||||
panel_timeline->snapped = false;
|
||||
olive::timeline::snapped = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,13 +434,13 @@ void KeyframeView::mouseReleaseEvent(QMouseEvent*) {
|
||||
selected_fields.at(i)->keyframes.at(selected_keyframes.at(i)).time
|
||||
));
|
||||
}
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
}
|
||||
|
||||
select_rect = false;
|
||||
dragging = false;
|
||||
mousedown = false;
|
||||
scroll_drag = false;
|
||||
panel_timeline->snapped = false;
|
||||
olive::timeline::snapped = false;
|
||||
update_ui(false);
|
||||
}
|
||||
|
||||
+13
-13
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "ui/effectui.h"
|
||||
|
||||
class Clip;
|
||||
class Effect;
|
||||
class Node;
|
||||
class EffectRow;
|
||||
class EffectField;
|
||||
class TimelineHeader;
|
||||
|
||||
+15
-15
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <QMenu>
|
||||
|
||||
#include "undo/undo.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "global/timing.h"
|
||||
#include "global/config.h"
|
||||
#include "global/math.h"
|
||||
#include "global/debug.h"
|
||||
@@ -94,7 +94,7 @@ QString LabelSlider::ValueToString() {
|
||||
} else {
|
||||
switch (display_type) {
|
||||
case FrameNumber:
|
||||
return frame_to_timecode(long(v), olive::CurrentConfig.timecode_view, frame_rate);
|
||||
return frame_to_timecode(long(v), olive::config.timecode_view, frame_rate);
|
||||
case Percent:
|
||||
return QString::number((v*100), 'f', decimal_places).append("%");
|
||||
case Decibel:
|
||||
@@ -311,7 +311,7 @@ void LabelSlider::ShowDialog()
|
||||
if (s.isEmpty()) return;
|
||||
|
||||
// parse string timecode to a frame number
|
||||
d = timecode_to_frame(s, olive::CurrentConfig.timecode_view, frame_rate);
|
||||
d = timecode_to_frame(s, olive::config.timecode_view, frame_rate);
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
+111
-106
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include "rendering/audio.h"
|
||||
#include "rendering/renderfunctions.h"
|
||||
#include "undo/undostack.h"
|
||||
#include "effects/effectloaders.h"
|
||||
|
||||
MainWindow* olive::MainWindow;
|
||||
|
||||
@@ -145,33 +146,36 @@ void MainWindow::setup_layout(bool reset) {
|
||||
removeDockWidget(olive::panels.at(i));
|
||||
}
|
||||
|
||||
addDockWidget(Qt::TopDockWidgetArea, panel_project);
|
||||
addDockWidget(Qt::TopDockWidgetArea, panel_project.first());
|
||||
addDockWidget(Qt::TopDockWidgetArea, panel_graph_editor);
|
||||
addDockWidget(Qt::TopDockWidgetArea, panel_node_editor);
|
||||
addDockWidget(Qt::TopDockWidgetArea, panel_footage_viewer);
|
||||
tabifyDockWidget(panel_footage_viewer, panel_effect_controls);
|
||||
panel_footage_viewer->raise();
|
||||
addDockWidget(Qt::TopDockWidgetArea, panel_sequence_viewer);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, panel_timeline);
|
||||
addDockWidget(Qt::BottomDockWidgetArea, panel_timeline.first());
|
||||
|
||||
panel_project->show();
|
||||
panel_project.first()->show();
|
||||
panel_effect_controls->show();
|
||||
panel_footage_viewer->show();
|
||||
panel_sequence_viewer->show();
|
||||
panel_timeline->show();
|
||||
panel_timeline.first()->show();
|
||||
panel_graph_editor->hide();
|
||||
panel_node_editor->hide();
|
||||
|
||||
panel_project->setFloating(false);
|
||||
panel_project.first()->setFloating(false);
|
||||
panel_effect_controls->setFloating(false);
|
||||
panel_footage_viewer->setFloating(false);
|
||||
panel_sequence_viewer->setFloating(false);
|
||||
panel_timeline->setFloating(false);
|
||||
panel_timeline.first()->setFloating(false);
|
||||
panel_graph_editor->setFloating(true);
|
||||
panel_node_editor->setFloating(true);
|
||||
|
||||
resizeDocks({panel_project, panel_footage_viewer, panel_sequence_viewer},
|
||||
resizeDocks({panel_project.first(), panel_footage_viewer, panel_sequence_viewer},
|
||||
{width()/3, width()/3, width()/3},
|
||||
Qt::Horizontal);
|
||||
|
||||
resizeDocks({panel_project, panel_timeline},
|
||||
resizeDocks({panel_project.first(), panel_timeline.first()},
|
||||
{height()/2, height()/2},
|
||||
Qt::Vertical);
|
||||
}
|
||||
@@ -183,6 +187,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
first_show(true)
|
||||
{
|
||||
EffectInit::StartLoading();
|
||||
|
||||
olive::cursor::Initialize();
|
||||
|
||||
open_debug_file();
|
||||
@@ -239,19 +245,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
}
|
||||
|
||||
// search for open recents list
|
||||
QFile f(olive::Global->get_recent_project_list_file());
|
||||
if (f.exists() && f.open(QFile::ReadOnly | QFile::Text)) {
|
||||
QTextStream text_stream(&f);
|
||||
while (true) {
|
||||
QString line = text_stream.readLine();
|
||||
if (line.isNull()) {
|
||||
break;
|
||||
} else {
|
||||
recent_projects.append(line);
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
olive::Global->load_recent_projects();
|
||||
}
|
||||
}
|
||||
QString config_path = get_config_path();
|
||||
@@ -260,7 +254,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
config_dir.mkpath(".");
|
||||
QString config_fn = config_dir.filePath("config.xml");
|
||||
if (QFileInfo::exists(config_fn)) {
|
||||
olive::CurrentConfig.load(config_fn);
|
||||
olive::config.load(config_fn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,6 +262,18 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
olive::icon::Initialize();
|
||||
|
||||
// Load OpenColorIO configuration if set
|
||||
if (olive::config.enable_color_management && !olive::config.ocio_config_path.isEmpty()) {
|
||||
try {
|
||||
OCIO::SetCurrentConfig(OCIO::Config::CreateFromFile(olive::config.ocio_config_path.toUtf8()));
|
||||
} catch (OCIO::Exception& e) {
|
||||
QMessageBox::critical(this,
|
||||
tr("OpenColorIO Config Error"),
|
||||
tr("Failed to set OpenColorIO configuration: %1").arg(e.what()),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
|
||||
alloc_panels(this);
|
||||
|
||||
// populate menu bars
|
||||
@@ -280,7 +286,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
olive::Global->check_for_autorecovery_file();
|
||||
|
||||
// lock panels if the config says so
|
||||
set_panels_locked(olive::CurrentConfig.locked_panels);
|
||||
set_panels_locked(olive::config.locked_panels);
|
||||
|
||||
// set up output audio device
|
||||
init_audio();
|
||||
@@ -397,8 +403,8 @@ void MainWindow::Restyle()
|
||||
qApp->setStyle(QStyleFactory::create("Fusion"));
|
||||
|
||||
// Set up whether to load custom CSS or default CSS+palette
|
||||
if (!olive::CurrentConfig.css_path.isEmpty()
|
||||
&& load_css_from_file(olive::CurrentConfig.css_path)) {
|
||||
if (!olive::config.css_path.isEmpty()
|
||||
&& load_css_from_file(olive::config.css_path)) {
|
||||
|
||||
qApp->setPalette(qApp->style()->standardPalette());
|
||||
|
||||
@@ -407,7 +413,7 @@ void MainWindow::Restyle()
|
||||
// set default palette
|
||||
QPalette palette;
|
||||
|
||||
if (olive::CurrentConfig.style == olive::styling::kOliveDefaultLight) {
|
||||
if (olive::config.style == olive::styling::kOliveDefaultLight) {
|
||||
|
||||
palette.setColor(QPalette::Window, QColor(208, 208, 208));
|
||||
palette.setColor(QPalette::WindowText, Qt::black);
|
||||
@@ -463,7 +469,7 @@ void MainWindow::Restyle()
|
||||
|
||||
// Windows menus have the option of being native, so we may not need this CSS
|
||||
#ifdef Q_OS_WIN
|
||||
if (!olive::CurrentConfig.use_native_menu_styling) {
|
||||
if (!olive::config.use_native_menu_styling) {
|
||||
#endif
|
||||
stylesheet.append("QMenu::separator { background: #404040; }");
|
||||
#ifdef Q_OS_WIN
|
||||
@@ -480,14 +486,14 @@ void MainWindow::Restyle()
|
||||
}
|
||||
|
||||
void MainWindow::editMenu_About_To_Be_Shown() {
|
||||
undo_action->setEnabled(olive::UndoStack.canUndo());
|
||||
redo_action->setEnabled(olive::UndoStack.canRedo());
|
||||
undo_action->setEnabled(olive::undo_stack.canUndo());
|
||||
redo_action->setEnabled(olive::undo_stack.canRedo());
|
||||
}
|
||||
|
||||
void MainWindow::setup_menus() {
|
||||
QMenuBar* menuBar = new QMenuBar(this);
|
||||
|
||||
if (olive::CurrentConfig.use_native_menu_styling) {
|
||||
if (olive::config.use_native_menu_styling) {
|
||||
OliveGlobal::SetNativeStyling(menuBar);
|
||||
}
|
||||
|
||||
@@ -506,7 +512,7 @@ void MainWindow::setup_menus() {
|
||||
|
||||
open_recent = MenuHelper::create_submenu(file_menu);
|
||||
|
||||
clear_open_recent_action = MenuHelper::create_menu_action(nullptr, "clearopenrecent", panel_project, SLOT(clear_recent_projects()));
|
||||
clear_open_recent_action = MenuHelper::create_menu_action(nullptr, "clearopenrecent", olive::Global.get(), SLOT(clear_recent_projects()));
|
||||
|
||||
save_project = MenuHelper::create_menu_action(file_menu, "saveproj", olive::Global.get(), SLOT(save_project()), QKeySequence("Ctrl+S"));
|
||||
|
||||
@@ -514,7 +520,7 @@ void MainWindow::setup_menus() {
|
||||
|
||||
file_menu->addSeparator();
|
||||
|
||||
import_action = MenuHelper::create_menu_action(file_menu, "import", panel_project, SLOT(import_dialog()), QKeySequence("Ctrl+I"));
|
||||
import_action = MenuHelper::create_menu_action(file_menu, "import", olive::Global.get(), SLOT(open_import_dialog()), QKeySequence("Ctrl+I"));
|
||||
|
||||
file_menu->addSeparator();
|
||||
|
||||
@@ -538,7 +544,7 @@ void MainWindow::setup_menus() {
|
||||
edit_menu->addSeparator();
|
||||
|
||||
select_all_action = MenuHelper::create_menu_action(edit_menu, "selectall", &olive::FocusFilter, SLOT(select_all()), QKeySequence("Ctrl+A"));
|
||||
deselect_all_action = MenuHelper::create_menu_action(edit_menu, "deselectall", panel_timeline, SLOT(deselect()), QKeySequence("Ctrl+Shift+A"));
|
||||
deselect_all_action = MenuHelper::create_menu_action(edit_menu, "deselectall", panel_timeline.first(), SLOT(deselect()), QKeySequence("Ctrl+Shift+A"));
|
||||
|
||||
edit_menu->addSeparator();
|
||||
|
||||
@@ -546,16 +552,16 @@ void MainWindow::setup_menus() {
|
||||
|
||||
edit_menu->addSeparator();
|
||||
|
||||
ripple_to_in_point_ = MenuHelper::create_menu_action(edit_menu, "rippletoin", panel_timeline, SLOT(ripple_to_in_point()), QKeySequence("Q"));
|
||||
ripple_to_out_point_ = MenuHelper::create_menu_action(edit_menu, "rippletoout", panel_timeline, SLOT(ripple_to_out_point()), QKeySequence("W"));
|
||||
edit_to_in_point_ = MenuHelper::create_menu_action(edit_menu, "edittoin", panel_timeline, SLOT(edit_to_in_point()), QKeySequence("Ctrl+Alt+Q"));
|
||||
edit_to_out_point_ = MenuHelper::create_menu_action(edit_menu, "edittoout", panel_timeline, SLOT(edit_to_out_point()), QKeySequence("Ctrl+Alt+W"));
|
||||
ripple_to_in_point_ = MenuHelper::create_menu_action(edit_menu, "rippletoin", panel_timeline.first(), SLOT(ripple_to_in_point()), QKeySequence("Q"));
|
||||
ripple_to_out_point_ = MenuHelper::create_menu_action(edit_menu, "rippletoout", panel_timeline.first(), SLOT(ripple_to_out_point()), QKeySequence("W"));
|
||||
edit_to_in_point_ = MenuHelper::create_menu_action(edit_menu, "edittoin", panel_timeline.first(), SLOT(edit_to_in_point()), QKeySequence("Ctrl+Alt+Q"));
|
||||
edit_to_out_point_ = MenuHelper::create_menu_action(edit_menu, "edittoout", panel_timeline.first(), SLOT(edit_to_out_point()), QKeySequence("Ctrl+Alt+W"));
|
||||
|
||||
edit_menu->addSeparator();
|
||||
|
||||
olive::MenuHelper.make_inout_menu(edit_menu);
|
||||
delete_inout_point_ = MenuHelper::create_menu_action(edit_menu, "deleteinout", panel_timeline, SLOT(delete_inout()), QKeySequence(";"));
|
||||
ripple_delete_inout_point_ = MenuHelper::create_menu_action(edit_menu, "rippledeleteinout", panel_timeline, SLOT(ripple_delete_inout()), QKeySequence("'"));
|
||||
delete_inout_point_ = MenuHelper::create_menu_action(edit_menu, "deleteinout", panel_timeline.first(), SLOT(delete_inout()), QKeySequence(";"));
|
||||
ripple_delete_inout_point_ = MenuHelper::create_menu_action(edit_menu, "rippledeleteinout", panel_timeline.first(), SLOT(ripple_delete_inout()), QKeySequence("'"));
|
||||
|
||||
edit_menu->addSeparator();
|
||||
|
||||
@@ -567,21 +573,17 @@ void MainWindow::setup_menus() {
|
||||
|
||||
zoom_in_ = MenuHelper::create_menu_action(view_menu, "zoomin", &olive::FocusFilter, SLOT(zoom_in()), QKeySequence("="));
|
||||
zoom_out_ = MenuHelper::create_menu_action(view_menu, "zoomout", &olive::FocusFilter, SLOT(zoom_out()), QKeySequence("-"));
|
||||
increase_track_height_ = MenuHelper::create_menu_action(view_menu, "vzoomin", panel_timeline, SLOT(IncreaseTrackHeight()), QKeySequence("Ctrl+="));
|
||||
decrease_track_height_ = MenuHelper::create_menu_action(view_menu, "vzoomout", panel_timeline, SLOT(DecreaseTrackHeight()), QKeySequence("Ctrl+-"));
|
||||
increase_track_height_ = MenuHelper::create_menu_action(view_menu, "vzoomin", panel_timeline.first(), SLOT(IncreaseTrackHeight()), QKeySequence("Ctrl+="));
|
||||
decrease_track_height_ = MenuHelper::create_menu_action(view_menu, "vzoomout", panel_timeline.first(), SLOT(DecreaseTrackHeight()), QKeySequence("Ctrl+-"));
|
||||
|
||||
show_all = MenuHelper::create_menu_action(view_menu, "showall", panel_timeline, SLOT(toggle_show_all()), QKeySequence("\\"));
|
||||
show_all = MenuHelper::create_menu_action(view_menu, "showall", panel_timeline.first(), SLOT(toggle_show_all()), QKeySequence("\\"));
|
||||
show_all->setCheckable(true);
|
||||
|
||||
view_menu->addSeparator();
|
||||
|
||||
track_lines = MenuHelper::create_menu_action(view_menu, "tracklines", &olive::MenuHelper, SLOT(toggle_bool_action()));
|
||||
track_lines->setCheckable(true);
|
||||
track_lines->setData(reinterpret_cast<quintptr>(&olive::CurrentConfig.show_track_lines));
|
||||
|
||||
rectified_waveforms = MenuHelper::create_menu_action(view_menu, "rectifiedwaveforms", &olive::MenuHelper, SLOT(toggle_bool_action()));
|
||||
rectified_waveforms->setCheckable(true);
|
||||
rectified_waveforms->setData(reinterpret_cast<quintptr>(&olive::CurrentConfig.rectified_waveforms));
|
||||
rectified_waveforms->setData(reinterpret_cast<quintptr>(&olive::config.rectified_waveforms));
|
||||
|
||||
view_menu->addSeparator();
|
||||
|
||||
@@ -658,8 +660,8 @@ void MainWindow::setup_menus() {
|
||||
|
||||
playback_menu->addSeparator();
|
||||
|
||||
go_to_prev_cut_ = MenuHelper::create_menu_action(playback_menu, "prevcut", panel_timeline, SLOT(previous_cut()), QKeySequence("Up"));
|
||||
go_to_next_cut_ = MenuHelper::create_menu_action(playback_menu, "nextcut", panel_timeline, SLOT(next_cut()), QKeySequence("Down"));
|
||||
go_to_prev_cut_ = MenuHelper::create_menu_action(playback_menu, "prevcut", panel_sequence_viewer, SLOT(prev_cut()), QKeySequence("Up"));
|
||||
go_to_next_cut_ = MenuHelper::create_menu_action(playback_menu, "nextcut", panel_sequence_viewer, SLOT(next_cut()), QKeySequence("Down"));
|
||||
|
||||
playback_menu->addSeparator();
|
||||
|
||||
@@ -676,7 +678,7 @@ void MainWindow::setup_menus() {
|
||||
|
||||
loop_action_ = MenuHelper::create_menu_action(playback_menu, "loop", &olive::MenuHelper, SLOT(toggle_bool_action()));
|
||||
loop_action_->setCheckable(true);
|
||||
loop_action_->setData(reinterpret_cast<quintptr>(&olive::CurrentConfig.loop));
|
||||
loop_action_->setData(reinterpret_cast<quintptr>(&olive::config.loop));
|
||||
|
||||
// INITIALIZE WINDOW MENU
|
||||
|
||||
@@ -684,7 +686,7 @@ void MainWindow::setup_menus() {
|
||||
|
||||
window_project_action = MenuHelper::create_menu_action(window_menu, "panelproject", this, SLOT(toggle_panel_visibility()));
|
||||
window_project_action->setCheckable(true);
|
||||
window_project_action->setData(reinterpret_cast<quintptr>(panel_project));
|
||||
window_project_action->setData(reinterpret_cast<quintptr>(panel_project.first()));
|
||||
|
||||
window_effectcontrols_action = MenuHelper::create_menu_action(window_menu, "paneleffectcontrols", this, SLOT(toggle_panel_visibility()));
|
||||
window_effectcontrols_action->setCheckable(true);
|
||||
@@ -692,12 +694,16 @@ void MainWindow::setup_menus() {
|
||||
|
||||
window_timeline_action = MenuHelper::create_menu_action(window_menu, "paneltimeline", this, SLOT(toggle_panel_visibility()));
|
||||
window_timeline_action->setCheckable(true);
|
||||
window_timeline_action->setData(reinterpret_cast<quintptr>(panel_timeline));
|
||||
window_timeline_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()));
|
||||
|
||||
window_graph_editor_action = MenuHelper::create_menu_action(window_menu, "panelgrapheditor", this, SLOT(toggle_panel_visibility()));
|
||||
window_graph_editor_action->setCheckable(true);
|
||||
window_graph_editor_action->setData(reinterpret_cast<quintptr>(panel_graph_editor));
|
||||
|
||||
window_node_editor_action = MenuHelper::create_menu_action(window_menu, "panelnodeeditor", this, SLOT(toggle_panel_visibility()));
|
||||
window_node_editor_action->setCheckable(true);
|
||||
window_node_editor_action->setData(reinterpret_cast<quintptr>(panel_node_editor));
|
||||
|
||||
window_footageviewer_action = MenuHelper::create_menu_action(window_menu, "panelfootageviewer", this, SLOT(toggle_panel_visibility()));
|
||||
window_footageviewer_action->setCheckable(true);
|
||||
window_footageviewer_action->setData(reinterpret_cast<quintptr>(panel_footage_viewer));
|
||||
@@ -726,49 +732,49 @@ void MainWindow::setup_menus() {
|
||||
|
||||
pointer_tool_action = MenuHelper::create_menu_action(tools_menu, "pointertool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("V"));
|
||||
pointer_tool_action->setCheckable(true);
|
||||
pointer_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolArrowButton));
|
||||
pointer_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolArrowButton));
|
||||
tools_group->addAction(pointer_tool_action);
|
||||
|
||||
edit_tool_action = MenuHelper::create_menu_action(tools_menu, "edittool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("X"));
|
||||
edit_tool_action->setCheckable(true);
|
||||
edit_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolEditButton));
|
||||
edit_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolEditButton));
|
||||
tools_group->addAction(edit_tool_action);
|
||||
|
||||
ripple_tool_action = MenuHelper::create_menu_action(tools_menu, "rippletool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("B"));
|
||||
ripple_tool_action->setCheckable(true);
|
||||
ripple_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolRippleButton));
|
||||
ripple_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolRippleButton));
|
||||
tools_group->addAction(ripple_tool_action);
|
||||
|
||||
razor_tool_action = MenuHelper::create_menu_action(tools_menu, "razortool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("C"));
|
||||
razor_tool_action->setCheckable(true);
|
||||
razor_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolRazorButton));
|
||||
razor_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolRazorButton));
|
||||
tools_group->addAction(razor_tool_action);
|
||||
|
||||
slip_tool_action = MenuHelper::create_menu_action(tools_menu, "sliptool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("Y"));
|
||||
slip_tool_action->setCheckable(true);
|
||||
slip_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolSlipButton));
|
||||
slip_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolSlipButton));
|
||||
tools_group->addAction(slip_tool_action);
|
||||
|
||||
slide_tool_action = MenuHelper::create_menu_action(tools_menu, "slidetool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("U"));
|
||||
slide_tool_action->setCheckable(true);
|
||||
slide_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolSlideButton));
|
||||
slide_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolSlideButton));
|
||||
tools_group->addAction(slide_tool_action);
|
||||
|
||||
hand_tool_action = MenuHelper::create_menu_action(tools_menu, "handtool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("H"));
|
||||
hand_tool_action->setCheckable(true);
|
||||
hand_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolHandButton));
|
||||
hand_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolHandButton));
|
||||
tools_group->addAction(hand_tool_action);
|
||||
|
||||
transition_tool_action = MenuHelper::create_menu_action(tools_menu, "transitiontool", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("T"));
|
||||
transition_tool_action->setCheckable(true);
|
||||
transition_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline->toolTransitionButton));
|
||||
transition_tool_action->setData(reinterpret_cast<quintptr>(panel_timeline.first()->toolTransitionButton));
|
||||
tools_group->addAction(transition_tool_action);
|
||||
|
||||
tools_menu->addSeparator();
|
||||
|
||||
snap_toggle = MenuHelper::create_menu_action(tools_menu, "snapping", &olive::MenuHelper, SLOT(menu_click_button()), QKeySequence("S"));
|
||||
snap_toggle->setCheckable(true);
|
||||
snap_toggle->setData(reinterpret_cast<quintptr>(panel_timeline->snappingButton));
|
||||
snap_toggle->setData(reinterpret_cast<quintptr>(panel_timeline.first()->snappingButton));
|
||||
|
||||
tools_menu->addSeparator();
|
||||
|
||||
@@ -850,7 +856,6 @@ void MainWindow::Retranslate()
|
||||
increase_track_height_->setText(tr("Increase Track Height"));
|
||||
decrease_track_height_->setText(tr("Decrease Track Height"));
|
||||
show_all->setText(tr("Toggle Show All"));
|
||||
track_lines->setText(tr("Track Lines"));
|
||||
rectified_waveforms->setText(tr("Rectified Waveforms"));
|
||||
frames_action->setText(tr("Frames"));
|
||||
drop_frame_action->setText(tr("Drop Frame"));
|
||||
@@ -892,6 +897,7 @@ void MainWindow::Retranslate()
|
||||
window_effectcontrols_action->setText(tr("Effect Controls"));
|
||||
window_timeline_action->setText(tr("Timeline"));
|
||||
window_graph_editor_action->setText(tr("Graph Editor"));
|
||||
window_node_editor_action->setText(tr("Node Editor"));
|
||||
window_footageviewer_action->setText(tr("Media Viewer"));
|
||||
window_sequenceviewer_action->setText(tr("Sequence Viewer"));
|
||||
|
||||
@@ -955,18 +961,19 @@ void MainWindow::closeEvent(QCloseEvent *e) {
|
||||
panel_graph_editor->set_row(nullptr);
|
||||
panel_effect_controls->Clear(true);
|
||||
|
||||
olive::Global->set_sequence(nullptr);
|
||||
panel_footage_viewer->viewer_widget()->close_window();
|
||||
panel_sequence_viewer->viewer_widget()->close_window();
|
||||
|
||||
panel_footage_viewer->viewer_widget->close_window();
|
||||
panel_sequence_viewer->viewer_widget->close_window();
|
||||
|
||||
panel_footage_viewer->set_main_sequence();
|
||||
olive::undo_stack.clear();
|
||||
|
||||
QString data_dir = get_data_path();
|
||||
QString config_path = get_config_path();
|
||||
|
||||
const QString& autorecovery_filename = olive::Global->get_autorecovery_filename();
|
||||
if (!data_dir.isEmpty() && !autorecovery_filename.isEmpty()) {
|
||||
if (QFile::exists(autorecovery_filename)) {
|
||||
QFile::rename(autorecovery_filename, autorecovery_filename + "." + QDateTime::currentDateTimeUtc().toString("yyyyMMddHHmmss"));
|
||||
QFile::rename(autorecovery_filename,
|
||||
autorecovery_filename + "." + QDateTime::currentDateTimeUtc().toString("yyyyMMddHHmmss"));
|
||||
}
|
||||
}
|
||||
if (!config_path.isEmpty()) {
|
||||
@@ -975,7 +982,7 @@ void MainWindow::closeEvent(QCloseEvent *e) {
|
||||
QString config_fn = config_dir.filePath("config.xml");
|
||||
|
||||
// save settings
|
||||
olive::CurrentConfig.save(config_fn);
|
||||
olive::config.save(config_fn);
|
||||
|
||||
// save panel layout
|
||||
QFile panel_config(get_config_dir().filePath("layout"));
|
||||
@@ -1118,32 +1125,30 @@ void MainWindow::playbackMenu_About_To_Be_Shown() {
|
||||
}
|
||||
|
||||
void MainWindow::viewMenu_About_To_Be_Shown() {
|
||||
olive::MenuHelper.set_bool_action_checked(track_lines);
|
||||
|
||||
olive::MenuHelper.set_bool_action_checked(rectified_waveforms);
|
||||
|
||||
olive::MenuHelper.set_int_action_checked(frames_action, olive::CurrentConfig.timecode_view);
|
||||
olive::MenuHelper.set_int_action_checked(drop_frame_action, olive::CurrentConfig.timecode_view);
|
||||
olive::MenuHelper.set_int_action_checked(nondrop_frame_action, olive::CurrentConfig.timecode_view);
|
||||
olive::MenuHelper.set_int_action_checked(milliseconds_action, olive::CurrentConfig.timecode_view);
|
||||
olive::MenuHelper.set_int_action_checked(frames_action, olive::config.timecode_view);
|
||||
olive::MenuHelper.set_int_action_checked(drop_frame_action, olive::config.timecode_view);
|
||||
olive::MenuHelper.set_int_action_checked(nondrop_frame_action, olive::config.timecode_view);
|
||||
olive::MenuHelper.set_int_action_checked(milliseconds_action, olive::config.timecode_view);
|
||||
|
||||
title_safe_off->setChecked(!olive::CurrentConfig.show_title_safe_area);
|
||||
title_safe_default->setChecked(olive::CurrentConfig.show_title_safe_area
|
||||
&& !olive::CurrentConfig.use_custom_title_safe_ratio);
|
||||
title_safe_43->setChecked(olive::CurrentConfig.show_title_safe_area
|
||||
&& olive::CurrentConfig.use_custom_title_safe_ratio
|
||||
&& qFuzzyCompare(olive::CurrentConfig.custom_title_safe_ratio, title_safe_43->data().toDouble()));
|
||||
title_safe_169->setChecked(olive::CurrentConfig.show_title_safe_area
|
||||
&& olive::CurrentConfig.use_custom_title_safe_ratio
|
||||
&& qFuzzyCompare(olive::CurrentConfig.custom_title_safe_ratio, title_safe_169->data().toDouble()));
|
||||
title_safe_custom->setChecked(olive::CurrentConfig.show_title_safe_area
|
||||
&& olive::CurrentConfig.use_custom_title_safe_ratio
|
||||
title_safe_off->setChecked(!olive::config.show_title_safe_area);
|
||||
title_safe_default->setChecked(olive::config.show_title_safe_area
|
||||
&& !olive::config.use_custom_title_safe_ratio);
|
||||
title_safe_43->setChecked(olive::config.show_title_safe_area
|
||||
&& olive::config.use_custom_title_safe_ratio
|
||||
&& qFuzzyCompare(olive::config.custom_title_safe_ratio, title_safe_43->data().toDouble()));
|
||||
title_safe_169->setChecked(olive::config.show_title_safe_area
|
||||
&& olive::config.use_custom_title_safe_ratio
|
||||
&& qFuzzyCompare(olive::config.custom_title_safe_ratio, title_safe_169->data().toDouble()));
|
||||
title_safe_custom->setChecked(olive::config.show_title_safe_area
|
||||
&& olive::config.use_custom_title_safe_ratio
|
||||
&& !title_safe_43->isChecked()
|
||||
&& !title_safe_169->isChecked());
|
||||
|
||||
full_screen->setChecked(windowState() == Qt::WindowFullScreen);
|
||||
|
||||
show_all->setChecked(panel_timeline->showing_all);
|
||||
show_all->setChecked(panel_timeline.first()->showing_all);
|
||||
}
|
||||
|
||||
void MainWindow::toolMenu_About_To_Be_Shown() {
|
||||
@@ -1157,9 +1162,9 @@ void MainWindow::toolMenu_About_To_Be_Shown() {
|
||||
olive::MenuHelper.set_button_action_checked(transition_tool_action);
|
||||
olive::MenuHelper.set_button_action_checked(snap_toggle);
|
||||
|
||||
olive::MenuHelper.set_int_action_checked(no_autoscroll, olive::CurrentConfig.autoscroll);
|
||||
olive::MenuHelper.set_int_action_checked(page_autoscroll, olive::CurrentConfig.autoscroll);
|
||||
olive::MenuHelper.set_int_action_checked(smooth_autoscroll, olive::CurrentConfig.autoscroll);
|
||||
olive::MenuHelper.set_int_action_checked(no_autoscroll, olive::config.autoscroll);
|
||||
olive::MenuHelper.set_int_action_checked(page_autoscroll, olive::config.autoscroll);
|
||||
olive::MenuHelper.set_int_action_checked(smooth_autoscroll, olive::config.autoscroll);
|
||||
}
|
||||
|
||||
void MainWindow::toggle_panel_visibility() {
|
||||
@@ -1192,15 +1197,15 @@ void MainWindow::set_panels_locked(bool locked)
|
||||
}
|
||||
}
|
||||
|
||||
olive::CurrentConfig.locked_panels = locked;
|
||||
olive::config.locked_panels = locked;
|
||||
}
|
||||
|
||||
void MainWindow::fileMenu_About_To_Be_Shown() {
|
||||
if (recent_projects.size() > 0) {
|
||||
if (olive::Global->recent_project_count() > 0) {
|
||||
open_recent->clear();
|
||||
open_recent->setEnabled(true);
|
||||
for (int i=0;i<recent_projects.size();i++) {
|
||||
QAction* action = open_recent->addAction(recent_projects.at(i));
|
||||
for (int i=0;i<olive::Global->recent_project_count();i++) {
|
||||
QAction* action = open_recent->addAction(olive::Global->recent_project(i));
|
||||
action->setProperty("keyignore", true);
|
||||
action->setData(i);
|
||||
connect(action, SIGNAL(triggered()), &olive::MenuHelper, SLOT(open_recent_from_menu()));
|
||||
|
||||
+13
-13
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -263,7 +263,6 @@ private:
|
||||
QAction* zoom_out_;
|
||||
QAction* increase_track_height_;
|
||||
QAction* decrease_track_height_;
|
||||
QAction* track_lines;
|
||||
QAction* frames_action;
|
||||
QAction* drop_frame_action;
|
||||
QAction* nondrop_frame_action;
|
||||
@@ -309,6 +308,7 @@ private:
|
||||
QAction* window_effectcontrols_action;
|
||||
QAction* window_timeline_action;
|
||||
QAction* window_graph_editor_action;
|
||||
QAction* window_node_editor_action;
|
||||
QAction* window_footageviewer_action;
|
||||
QAction* window_sequenceviewer_action;
|
||||
|
||||
|
||||
+16
-13
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -37,12 +37,13 @@ MediaIconService::MediaIconService() {
|
||||
throbber_pixmap_ = QPixmap(":/icons/throbber.png");
|
||||
}
|
||||
|
||||
void MediaIconService::SetMediaIcon(Media *media, int icon_type) {
|
||||
void MediaIconService::SetMediaIcon(Media *media, IconType icon_type) {
|
||||
// if this icon is already part of the throbber animation loop, remove it
|
||||
if (throbber_items_.contains(media)) {
|
||||
throbber_lock_.lock();
|
||||
|
||||
throbber_items_.removeAll(media);
|
||||
media->disable_thumbnail(false);
|
||||
|
||||
throbber_lock_.unlock();
|
||||
|
||||
@@ -66,6 +67,8 @@ void MediaIconService::SetMediaIcon(Media *media, int icon_type) {
|
||||
case ICON_TYPE_LOADING:
|
||||
throbber_items_.append(media);
|
||||
|
||||
media->disable_thumbnail(true);
|
||||
|
||||
// if the animation timer isn't running, start it
|
||||
if (!throbber_animator_.isActive()) {
|
||||
// set starting frame to 0
|
||||
|
||||
+13
-13
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -40,7 +40,7 @@ class MediaIconService : public QObject {
|
||||
public:
|
||||
MediaIconService();
|
||||
public slots:
|
||||
void SetMediaIcon(Media* media, int icon_type);
|
||||
void SetMediaIcon(Media* media, IconType icon_type);
|
||||
signals:
|
||||
void IconChanged();
|
||||
private slots:
|
||||
|
||||
+22
-2
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "menu.h"
|
||||
|
||||
#include "global/global.h"
|
||||
@@ -6,7 +26,7 @@
|
||||
Menu::Menu(QWidget *parent) :
|
||||
QMenu(parent)
|
||||
{
|
||||
if (olive::CurrentConfig.use_native_menu_styling) {
|
||||
if (olive::config.use_native_menu_styling) {
|
||||
OliveGlobal::SetNativeStyling(this);
|
||||
}
|
||||
}
|
||||
@@ -14,7 +34,7 @@ Menu::Menu(QWidget *parent) :
|
||||
Menu::Menu(const QString &title, QWidget *parent) :
|
||||
QMenu(title, parent)
|
||||
{
|
||||
if (olive::CurrentConfig.use_native_menu_styling) {
|
||||
if (olive::config.use_native_menu_styling) {
|
||||
OliveGlobal::SetNativeStyling(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef MENU_H
|
||||
#define MENU_H
|
||||
|
||||
|
||||
+32
-32
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <QStyleFactory>
|
||||
|
||||
#include "global/config.h"
|
||||
#include "project/clipboard.h"
|
||||
#include "global/clipboard.h"
|
||||
#include "ui/mainwindow.h"
|
||||
#include "global/global.h"
|
||||
#include "panels/panels.h"
|
||||
@@ -39,10 +39,10 @@ void MenuHelper::InitializeSharedMenus()
|
||||
new_project_ = create_menu_action(nullptr, "newproj", olive::Global.get(), SLOT(new_project()), QKeySequence("Ctrl+N"));
|
||||
new_project_->setParent(this);
|
||||
|
||||
new_sequence_ = create_menu_action(nullptr, "newseq", panel_project, SLOT(new_sequence()), QKeySequence("Ctrl+Shift+N"));
|
||||
new_sequence_ = create_menu_action(nullptr, "newseq", olive::Global.get(), SLOT(open_new_sequence_dialog()), QKeySequence("Ctrl+Shift+N"));
|
||||
new_sequence_->setParent(this);
|
||||
|
||||
new_folder_ = create_menu_action(nullptr, "newfolder", panel_project, SLOT(new_folder()));
|
||||
new_folder_ = create_menu_action(nullptr, "newfolder", panel_project.first(), SLOT(new_folder()));
|
||||
new_folder_->setParent(this);
|
||||
|
||||
set_in_point_ = create_menu_action(nullptr, "setinpoint", &olive::FocusFilter, SLOT(set_in_point()), QKeySequence("I"));
|
||||
@@ -60,16 +60,16 @@ void MenuHelper::InitializeSharedMenus()
|
||||
clear_inout_point = create_menu_action(nullptr, "clearinout", &olive::FocusFilter, SLOT(clear_inout()), QKeySequence("G"));
|
||||
clear_inout_point->setParent(this);
|
||||
|
||||
add_default_transition_ = create_menu_action(nullptr, "deftransition", panel_timeline, SLOT(add_transition()), QKeySequence("Ctrl+Shift+D"));
|
||||
add_default_transition_ = create_menu_action(nullptr, "deftransition", panel_timeline.first(), SLOT(add_transition()), QKeySequence("Ctrl+Shift+D"));
|
||||
add_default_transition_->setParent(this);
|
||||
|
||||
link_unlink_ = create_menu_action(nullptr, "linkunlink", panel_timeline, SLOT(toggle_links()), QKeySequence("Ctrl+L"));
|
||||
link_unlink_ = create_menu_action(nullptr, "linkunlink", panel_timeline.first(), SLOT(toggle_links()), QKeySequence("Ctrl+L"));
|
||||
link_unlink_->setParent(this);
|
||||
|
||||
enable_disable_ = create_menu_action(nullptr, "enabledisable", panel_timeline, SLOT(toggle_enable_on_selected_clips()), QKeySequence("Shift+E"));
|
||||
enable_disable_ = create_menu_action(nullptr, "enabledisable", panel_timeline.first(), SLOT(toggle_enable_on_selected_clips()), QKeySequence("Shift+E"));
|
||||
enable_disable_->setParent(this);
|
||||
|
||||
nest_ = create_menu_action(nullptr, "nest", panel_timeline, SLOT(nest()));
|
||||
nest_ = create_menu_action(nullptr, "nest", panel_timeline.first(), SLOT(nest()));
|
||||
nest_->setParent(this);
|
||||
|
||||
cut_ = create_menu_action(nullptr, "cut", &olive::FocusFilter, SLOT(cut()), QKeySequence("Ctrl+X"));
|
||||
@@ -90,10 +90,10 @@ void MenuHelper::InitializeSharedMenus()
|
||||
delete_ = create_menu_action(nullptr, "delete", &olive::FocusFilter, SLOT(delete_function()), QKeySequence("Del"));
|
||||
delete_->setParent(this);
|
||||
|
||||
ripple_delete_ = create_menu_action(nullptr, "rippledelete", panel_timeline, SLOT(ripple_delete()), QKeySequence("Shift+Del"));
|
||||
ripple_delete_ = create_menu_action(nullptr, "rippledelete", panel_timeline.first(), SLOT(ripple_delete()), QKeySequence("Shift+Del"));
|
||||
ripple_delete_->setParent(this);
|
||||
|
||||
split_ = create_menu_action(nullptr, "split", panel_timeline, SLOT(split_at_playhead()), QKeySequence("Ctrl+K"));
|
||||
split_ = create_menu_action(nullptr, "split", panel_timeline.first(), SLOT(split_at_playhead()), QKeySequence("Ctrl+K"));
|
||||
split_->setParent(this);
|
||||
|
||||
Retranslate();
|
||||
@@ -193,23 +193,23 @@ void MenuHelper::set_titlesafe_from_menu() {
|
||||
if (qIsNaN(tsa)) {
|
||||
|
||||
// disable title safe area
|
||||
olive::CurrentConfig.show_title_safe_area = false;
|
||||
olive::config.show_title_safe_area = false;
|
||||
|
||||
} else {
|
||||
|
||||
// using title safe area
|
||||
olive::CurrentConfig.show_title_safe_area = true;
|
||||
olive::config.show_title_safe_area = true;
|
||||
|
||||
// are we using the default area aspect ratio, or a specific one
|
||||
if (qIsNull(tsa)) {
|
||||
|
||||
// default title safe area
|
||||
olive::CurrentConfig.use_custom_title_safe_ratio = false;
|
||||
olive::config.use_custom_title_safe_ratio = false;
|
||||
|
||||
} else {
|
||||
|
||||
// using a specific aspect ratio
|
||||
olive::CurrentConfig.use_custom_title_safe_ratio = true;
|
||||
olive::config.use_custom_title_safe_ratio = true;
|
||||
|
||||
if (tsa < 0.0) {
|
||||
|
||||
@@ -229,25 +229,25 @@ void MenuHelper::set_titlesafe_from_menu() {
|
||||
|
||||
if (!input.isEmpty()) {
|
||||
QStringList inputList = input.split(':');
|
||||
olive::CurrentConfig.custom_title_safe_ratio = inputList.at(0).toDouble()/inputList.at(1).toDouble();
|
||||
olive::config.custom_title_safe_ratio = inputList.at(0).toDouble()/inputList.at(1).toDouble();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// specified tsa is a specific custom aspect ratio
|
||||
olive::CurrentConfig.custom_title_safe_ratio = tsa;
|
||||
olive::config.custom_title_safe_ratio = tsa;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
panel_sequence_viewer->viewer_widget()->update();
|
||||
}
|
||||
|
||||
void MenuHelper::set_autoscroll() {
|
||||
QAction* action = static_cast<QAction*>(sender());
|
||||
olive::CurrentConfig.autoscroll = action->data().toInt();
|
||||
olive::config.autoscroll = action->data().toInt();
|
||||
}
|
||||
|
||||
void MenuHelper::menu_click_button() {
|
||||
@@ -256,7 +256,7 @@ void MenuHelper::menu_click_button() {
|
||||
|
||||
void MenuHelper::set_timecode_view() {
|
||||
QAction* action = static_cast<QAction*>(sender());
|
||||
olive::CurrentConfig.timecode_view = action->data().toInt();
|
||||
olive::config.timecode_view = action->data().toInt();
|
||||
update_ui(false);
|
||||
}
|
||||
|
||||
@@ -267,8 +267,8 @@ void MenuHelper::open_recent_from_menu() {
|
||||
|
||||
void MenuHelper::create_effect_paste_action(QMenu *menu)
|
||||
{
|
||||
QAction* paste_action = menu->addAction(tr("&Paste"), panel_timeline, SLOT(paste(bool)));
|
||||
paste_action->setEnabled(clipboard.size() > 0 && clipboard_type == CLIPBOARD_TYPE_EFFECT);
|
||||
QAction* paste_action = menu->addAction(tr("&Paste"), olive::Global.get(), SLOT(paste(bool)));
|
||||
paste_action->setEnabled(olive::clipboard.Count() > 0 && olive::clipboard.type() == Clipboard::CLIPBOARD_TYPE_EFFECT);
|
||||
}
|
||||
|
||||
Menu* MenuHelper::create_submenu(QMenuBar* parent,
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#include "nodeedgeui.h"
|
||||
|
||||
#include <QPen>
|
||||
#include <QGraphicsScene>
|
||||
|
||||
#include "global/math.h"
|
||||
#include "ui/effectui.h"
|
||||
|
||||
NodeEdgeUI::NodeEdgeUI(NodeEdge* edge) :
|
||||
edge_(edge),
|
||||
output_node_(nullptr),
|
||||
input_node_(nullptr)
|
||||
{
|
||||
setPen(QPen(Qt::white, 2));
|
||||
}
|
||||
|
||||
void NodeEdgeUI::adjust()
|
||||
{
|
||||
if (output_node_ == nullptr) {
|
||||
// Locate the output and input nodes' UIs
|
||||
|
||||
QList<QGraphicsItem*> all_items = scene()->items();
|
||||
|
||||
for (int j=0;j<all_items.size();j++) {
|
||||
NodeUI* node = dynamic_cast<NodeUI*>(all_items.at(j));
|
||||
if (node != nullptr) {
|
||||
|
||||
// Check if this node has the output row
|
||||
int row_index = node->GetNode()->IndexOfRow(edge_->output());
|
||||
|
||||
if (row_index > -1) {
|
||||
output_node_ = node;
|
||||
output_index_ = row_index;
|
||||
}
|
||||
|
||||
// Check if this node has the input row
|
||||
row_index = node->GetNode()->IndexOfRow(edge_->input());
|
||||
|
||||
if (row_index > -1) {
|
||||
input_node_ = node;
|
||||
input_index_ = row_index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setPath(GetEdgePath(output_node_->pos() + output_node_->GetNodeSocketRects().at(output_index_).center(),
|
||||
input_node_->pos() + input_node_->GetNodeSocketRects().at(input_index_).center()));
|
||||
}
|
||||
|
||||
NodeEdge *NodeEdgeUI::edge()
|
||||
{
|
||||
return edge_;
|
||||
}
|
||||
|
||||
QPainterPath NodeEdgeUI::GetEdgePath(const QPointF &start_pos, const QPointF &end_pos)
|
||||
{
|
||||
double mid_x = double_lerp(start_pos.x(), end_pos.x(), 0.5);
|
||||
|
||||
QPainterPath path_;
|
||||
path_.moveTo(start_pos);
|
||||
path_.cubicTo(QPointF(mid_x, start_pos.y()),
|
||||
QPointF(mid_x, end_pos.y()),
|
||||
end_pos);
|
||||
|
||||
return path_;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef NODEEDGEUI_H
|
||||
#define NODEEDGEUI_H
|
||||
|
||||
#include <QGraphicsPathItem>
|
||||
|
||||
#include "nodeui.h"
|
||||
|
||||
class NodeEdgeUI : public QGraphicsPathItem {
|
||||
public:
|
||||
NodeEdgeUI(NodeEdge* edge);
|
||||
|
||||
static QPainterPath GetEdgePath(const QPointF& start_pos, const QPointF& end_pos);
|
||||
|
||||
void adjust();
|
||||
NodeEdge* edge();
|
||||
|
||||
private:
|
||||
NodeEdge* edge_;
|
||||
|
||||
NodeUI* output_node_;
|
||||
int output_index_;
|
||||
NodeUI* input_node_;
|
||||
int input_index_;
|
||||
};
|
||||
|
||||
#endif // NODEEDGEUI_H
|
||||
+323
@@ -0,0 +1,323 @@
|
||||
#include "nodeui.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMouseEvent>
|
||||
#include <QApplication>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsProxyWidget>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QPainter>
|
||||
|
||||
#include "ui/effectui.h"
|
||||
#include "ui/nodeedgeui.h"
|
||||
|
||||
const int kRoundedRectRadius = 5;
|
||||
const int kTextPadding = 4;
|
||||
const int kNodePlugSize = 12;
|
||||
|
||||
NodeUI::NodeUI() :
|
||||
node_(nullptr),
|
||||
drag_destination_(nullptr),
|
||||
clicked_socket_(-1)
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemIsMovable, true);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
}
|
||||
|
||||
void NodeUI::AddToScene(QGraphicsScene *scene)
|
||||
{
|
||||
scene->addItem(this);
|
||||
}
|
||||
|
||||
void NodeUI::SetNode(Node *n)
|
||||
{
|
||||
node_ = n;
|
||||
|
||||
QRectF rectangle;
|
||||
|
||||
rectangle.setTopLeft(pos());
|
||||
rectangle.setSize(QSizeF(200, GetRowY(node_->row_count())));
|
||||
|
||||
QRectF inner_rect = rectangle;
|
||||
inner_rect.setX(inner_rect.x() + kNodePlugSize/2);
|
||||
inner_rect.setWidth(inner_rect.width() - kNodePlugSize/2);
|
||||
|
||||
drag_path_ = QPainterPath();
|
||||
drag_path_.addRoundedRect(inner_rect, kRoundedRectRadius, kRoundedRectRadius);
|
||||
|
||||
setRect(rectangle);
|
||||
}
|
||||
|
||||
Node *NodeUI::GetNode()
|
||||
{
|
||||
return node_;
|
||||
}
|
||||
|
||||
void NodeUI::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||
{
|
||||
Q_UNUSED(widget)
|
||||
|
||||
// Draw node sockets
|
||||
QVector<QRectF> sockets = GetNodeSocketRects();
|
||||
if (!sockets.isEmpty()) {
|
||||
painter->setPen(Qt::black);
|
||||
painter->setBrush(Qt::gray);
|
||||
|
||||
for (int i=0;i<sockets.size();i++) {
|
||||
painter->drawEllipse(sockets.at(i));
|
||||
}
|
||||
}
|
||||
|
||||
// Draw main background rounded rectangle
|
||||
QPalette palette = qApp->palette();
|
||||
|
||||
if (option->state & QStyle::State_Selected) {
|
||||
painter->setPen(palette.highlight().color());
|
||||
} else {
|
||||
painter->setPen(palette.base().color());
|
||||
}
|
||||
painter->setBrush(palette.window());
|
||||
painter->drawPath(drag_path_);
|
||||
|
||||
// Draw node title
|
||||
painter->setPen(palette.text().color());
|
||||
int left_text_x = rect().x() + kNodePlugSize/2 + kTextPadding;
|
||||
painter->drawText(left_text_x,
|
||||
GetRowY(-1) + qApp->fontMetrics().ascent(),
|
||||
node_->name());
|
||||
|
||||
// Draw node row names
|
||||
for (int i=0;i<node_->row_count();i++) {
|
||||
int text_x;
|
||||
|
||||
if (node_->row(i)->IsNodeOutput()) {
|
||||
// right alignment
|
||||
text_x = rect().right() - kNodePlugSize/2 - qApp->fontMetrics().width(node_->row(i)->name()) - kTextPadding;
|
||||
} else {
|
||||
// left alignment
|
||||
text_x = left_text_x;
|
||||
}
|
||||
|
||||
painter->drawText(text_x,
|
||||
GetRowY(i) + qApp->fontMetrics().ascent(),
|
||||
node_->row(i)->name());
|
||||
}
|
||||
|
||||
// Draw title splitter line
|
||||
int line_y = GetRowY(-1) + qApp->fontMetrics().height() + kTextPadding/2;
|
||||
painter->drawLine(rect().x() + kNodePlugSize/2, line_y, rect().right() - kNodePlugSize/2, line_y);
|
||||
}
|
||||
|
||||
void NodeUI::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
QVector<QRectF> sockets = GetNodeSocketRects();
|
||||
|
||||
clicked_socket_ = -1;
|
||||
drag_destination_ = nullptr;
|
||||
|
||||
for (int i=0;i<sockets.size();i++) {
|
||||
if (sockets.at(i).contains(event->pos())) {
|
||||
clicked_socket_ = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (clicked_socket_ > -1) {
|
||||
|
||||
// See if this socket already has an edge connected
|
||||
QVector<NodeEdgePtr> edges = node_->row(clicked_socket_)->edges();
|
||||
if (!edges.isEmpty() && edges.last()->input()->GetParentEffect() == node_) {
|
||||
|
||||
NodeEdge* e = edges.last().get();
|
||||
|
||||
// If this node is the edge's "input", then we'll drag that instead of creating a new edge
|
||||
|
||||
EffectRow* other_row = e->output();
|
||||
|
||||
Node* other_node = other_row->GetParentEffect();
|
||||
|
||||
int other_row_index = other_node->IndexOfRow(other_row);
|
||||
|
||||
NodeUI* other_node_ui = FindUIFromNode(other_node);
|
||||
|
||||
// Start an edge at the opposite end
|
||||
drag_line_start_ = other_node_ui->pos() + other_node_ui->GetNodeSocketRects().at(other_row_index).center();
|
||||
|
||||
drag_source_ = other_row;
|
||||
|
||||
// Disconnect the existing edge, and treat our dynamic one as an edit of that one
|
||||
EffectRow::DisconnectEdge(edges.last());
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// Start a new edge here
|
||||
drag_line_start_ = pos() + sockets.at(clicked_socket_).center();
|
||||
|
||||
drag_source_ = node_->row(clicked_socket_);
|
||||
|
||||
}
|
||||
|
||||
drag_line_ = scene()->addPath(NodeEdgeUI::GetEdgePath(drag_line_start_, event->scenePos()));
|
||||
|
||||
if (!edges.isEmpty()) {
|
||||
drag_line_->setPen(QPen(Qt::white, 2));
|
||||
} else {
|
||||
drag_line_->setPen(QPen(Qt::gray, 2));
|
||||
}
|
||||
|
||||
event->accept();
|
||||
} else {
|
||||
QGraphicsItem::mousePressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeUI::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (clicked_socket_ > -1) {
|
||||
|
||||
bool line_is_touching_node = false;
|
||||
drag_destination_ = nullptr;
|
||||
|
||||
QPointF drag_line_end = event->scenePos();
|
||||
|
||||
// Get all the graphics items at this mouse position
|
||||
QList<QGraphicsItem *> mouse_items = scene()->items(event->scenePos());
|
||||
for (int j=0;j<mouse_items.size();j++) {
|
||||
|
||||
// See if the graphics item here is a node
|
||||
NodeUI* mouse_node = dynamic_cast<NodeUI*>(mouse_items.at(j));
|
||||
if (mouse_node != nullptr) {
|
||||
|
||||
// If so, get this node's sockets and loop through them
|
||||
QVector<QRectF> mouse_nodes_sockets = mouse_node->GetNodeSocketRects();
|
||||
for (int i=0;i<mouse_nodes_sockets.size();i++) {
|
||||
|
||||
// See if this socket contains the mouse cursor
|
||||
if (mouse_nodes_sockets.at(i).contains(event->scenePos() - mouse_node->pos())) {
|
||||
|
||||
// If so, see if the two rows can be connected
|
||||
|
||||
EffectRow* local_row = drag_source_;
|
||||
EffectRow* remote_row = mouse_node->GetRowFromIndex(i);
|
||||
|
||||
// Ensure one is an input and one is an output and whether their data types are compatible
|
||||
if (local_row->IsNodeInput() != remote_row->IsNodeInput()) {
|
||||
|
||||
// Determine which row is the input and which row is the output
|
||||
EffectRow* input_row = (local_row->IsNodeInput()) ? local_row : remote_row;
|
||||
EffectRow* output_row = (local_row->IsNodeInput()) ? remote_row : local_row;
|
||||
|
||||
if (input_row->CanAcceptDataType(output_row->OutputDataType())) {
|
||||
// This is a valid connection
|
||||
line_is_touching_node = true;
|
||||
|
||||
// Snap drag line to this socket
|
||||
drag_line_end = mouse_node->pos() + mouse_nodes_sockets.at(i).center();
|
||||
|
||||
// Cancel loop since we have a connection now
|
||||
j = mouse_items.size();
|
||||
|
||||
// Cache destination row
|
||||
drag_destination_ = remote_row;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (line_is_touching_node) {
|
||||
drag_line_->setPen(QPen(Qt::white, 2));
|
||||
} else {
|
||||
drag_line_->setPen(QPen(Qt::gray, 2));
|
||||
}
|
||||
|
||||
drag_line_->setPath(NodeEdgeUI::GetEdgePath(drag_line_start_, drag_line_end));
|
||||
|
||||
event->accept();
|
||||
|
||||
} else {
|
||||
QGraphicsItem::mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeUI::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (clicked_socket_ > -1) {
|
||||
scene()->removeItem(drag_line_);
|
||||
delete drag_line_;
|
||||
|
||||
event->accept();
|
||||
|
||||
if (drag_destination_ != nullptr) {
|
||||
EffectRow::ConnectEdge(drag_source_, drag_destination_);
|
||||
}
|
||||
} else {
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
QVector<QRectF> NodeUI::GetNodeSocketRects()
|
||||
{
|
||||
QVector<QRectF> rects;
|
||||
|
||||
if (node_ != nullptr) {
|
||||
Node* e = node_;
|
||||
|
||||
for (int i=0;i<e->row_count();i++) {
|
||||
|
||||
EffectRow* row = e->row(i);
|
||||
|
||||
if (row->IsNodeInput() || row->IsNodeOutput()) {
|
||||
qreal x = (row->IsNodeOutput()) ? rect().right() - kNodePlugSize : rect().x();
|
||||
int y = GetRowY(i) + qApp->fontMetrics().height()/2;
|
||||
|
||||
rects.append(QRectF(x,
|
||||
rect().y() + y - kNodePlugSize/2,
|
||||
kNodePlugSize,
|
||||
kNodePlugSize));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rects;
|
||||
}
|
||||
|
||||
EffectRow *NodeUI::GetRowFromIndex(int i)
|
||||
{
|
||||
if (node_ != nullptr && i < node_->row_count()) {
|
||||
return node_->row(i);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NodeUI *NodeUI::FindUIFromNode(Node* n)
|
||||
{
|
||||
QList<QGraphicsItem*> all_items = scene()->items();
|
||||
|
||||
for (int j=0;j<all_items.size();j++) {
|
||||
NodeUI* node = dynamic_cast<NodeUI*>(all_items.at(j));
|
||||
if (node != nullptr) {
|
||||
|
||||
// Check if this node has the specified
|
||||
|
||||
if (node->node_ == n) {
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int NodeUI::GetRowY(int index)
|
||||
{
|
||||
return (qApp->fontMetrics().height() + kTextPadding) * (index + 1) + kTextPadding;
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#ifndef NODEUI_H
|
||||
#define NODEUI_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGraphicsItem>
|
||||
|
||||
class EffectUI;
|
||||
class EffectRow;
|
||||
class NodeEdge;
|
||||
class Node;
|
||||
|
||||
class NodeUI : public QGraphicsRectItem {
|
||||
public:
|
||||
NodeUI();
|
||||
|
||||
void AddToScene(QGraphicsScene* scene);
|
||||
//void Resize(const QSize& s);
|
||||
void SetNode(Node* n);
|
||||
Node* GetNode();
|
||||
|
||||
QVector<QRectF> GetNodeSocketRects();
|
||||
|
||||
protected:
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
|
||||
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event) override;
|
||||
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
EffectRow *GetRowFromIndex(int i);
|
||||
NodeUI* FindUIFromNode(Node* n);
|
||||
int GetRowY(int index);
|
||||
|
||||
Node* node_;
|
||||
|
||||
QGraphicsPathItem* drag_line_;
|
||||
QPointF drag_line_start_;
|
||||
EffectRow* drag_source_;
|
||||
EffectRow* drag_destination_;
|
||||
QPainterPath drag_path_;
|
||||
|
||||
int clicked_socket_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // NODEUI_H
|
||||
@@ -0,0 +1,69 @@
|
||||
#include "nodeview.h"
|
||||
|
||||
#include <QWheelEvent>
|
||||
#include <QScrollBar>
|
||||
#include <QDebug>
|
||||
|
||||
#include "ui/menu.h"
|
||||
#include "nodes/node.h"
|
||||
|
||||
NodeView::NodeView(QGraphicsScene *scene, QWidget *parent) :
|
||||
QGraphicsView(scene, parent),
|
||||
hand_moving_(false)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
setWindowTitle(tr("Node Editor"));
|
||||
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
}
|
||||
|
||||
void NodeView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::MidButton) {
|
||||
hand_moving_ = true;
|
||||
drag_start_ = event->pos();
|
||||
} else if (event->button() == Qt::RightButton && scene()->itemAt(mapToScene(event->pos()), QTransform()) == nullptr) {
|
||||
|
||||
// If the user clicked with the right button on empty space, show the context menu
|
||||
emit RequestContextMenu();
|
||||
|
||||
} else {
|
||||
QGraphicsView::mousePressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeView::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (hand_moving_) {
|
||||
QPoint delta = event->pos() - drag_start_;
|
||||
|
||||
horizontalScrollBar()->setValue(horizontalScrollBar()->value() - delta.x());
|
||||
verticalScrollBar()->setValue(verticalScrollBar()->value() - delta.y());
|
||||
|
||||
drag_start_ = event->pos();
|
||||
} else {
|
||||
QGraphicsView::mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeView::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (!hand_moving_) {
|
||||
QGraphicsView::mouseReleaseEvent(event);
|
||||
}
|
||||
hand_moving_ = false;
|
||||
}
|
||||
|
||||
void NodeView::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
if (event->angleDelta().y() < 0) {
|
||||
scale(0.9, 0.9);
|
||||
} else {
|
||||
scale(1.1, 1.1);
|
||||
}
|
||||
} else {
|
||||
QGraphicsView::wheelEvent(event);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef NODEVIEW_H
|
||||
#define NODEVIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
|
||||
#include "timeline/tracktypes.h"
|
||||
|
||||
class NodeView : public QGraphicsView {
|
||||
Q_OBJECT
|
||||
public:
|
||||
NodeView(QGraphicsScene *scene, QWidget* parent = nullptr);
|
||||
|
||||
signals:
|
||||
void RequestContextMenu();
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
||||
virtual void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
virtual void wheelEvent(QWheelEvent *event) override;
|
||||
|
||||
private:
|
||||
bool hand_moving_;
|
||||
QPoint drag_start_;
|
||||
|
||||
};
|
||||
|
||||
#endif // NODEVIEW_H
|
||||
+17
-15
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
QVector<Panel*> olive::panels;
|
||||
|
||||
Panel::Panel(QWidget *parent) : QDockWidget (parent) {
|
||||
// setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
// setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
olive::panels.append(this);
|
||||
}
|
||||
|
||||
@@ -37,6 +34,11 @@ Panel::~Panel()
|
||||
olive::panels.removeAll(this);
|
||||
}
|
||||
|
||||
bool Panel::focused()
|
||||
{
|
||||
return hasFocus();
|
||||
}
|
||||
|
||||
void Panel::LoadLayoutState(const QByteArray &) {}
|
||||
|
||||
QByteArray Panel::SaveLayoutState()
|
||||
|
||||
+14
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -31,6 +31,8 @@ public:
|
||||
|
||||
virtual void Retranslate() = 0;
|
||||
|
||||
virtual bool focused();
|
||||
|
||||
virtual void LoadLayoutState(const QByteArray& data);
|
||||
virtual QByteArray SaveLayoutState();
|
||||
protected:
|
||||
|
||||
+16
-16
@@ -1,27 +1,27 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
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 "rectangleselect.h"
|
||||
|
||||
void draw_selection_rectangle(QPainter& painter, const QRect& rect) {
|
||||
painter.setPen(QColor(204, 204, 204));
|
||||
painter.setBrush(QColor(0, 0, 0, 32));
|
||||
painter.drawRect(rect);
|
||||
void olive::ui::DrawSelectionRectangle(QPainter& painter, const QRect& rect) {
|
||||
painter.setPen(QColor(204, 204, 204));
|
||||
painter.setBrush(QColor(0, 0, 0, 32));
|
||||
painter.drawRect(rect);
|
||||
}
|
||||
|
||||
+19
-13
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
namespace olive {
|
||||
namespace ui {
|
||||
|
||||
/**
|
||||
* @brief Routine for drawing a drag selection rectangle for any given QPainter
|
||||
*
|
||||
@@ -34,6 +37,9 @@
|
||||
*
|
||||
* Rectangle to draw
|
||||
*/
|
||||
void draw_selection_rectangle(QPainter& painter, const QRect& rect);
|
||||
void DrawSelectionRectangle(QPainter& painter, const QRect& rect);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // RECTANGLESELECT_H
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+26
-26
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -25,25 +25,25 @@
|
||||
|
||||
class ResizableScrollBar : public QScrollBar
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
ResizableScrollBar(QWidget * parent = 0);
|
||||
bool is_resizing();
|
||||
ResizableScrollBar(QWidget * parent = nullptr);
|
||||
bool is_resizing();
|
||||
signals:
|
||||
void resize_move(double i);
|
||||
void resize_move(double i);
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *) override;
|
||||
void mouseMoveEvent(QMouseEvent *) override;
|
||||
void mouseReleaseEvent(QMouseEvent *) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *) override;
|
||||
void mouseMoveEvent(QMouseEvent *) override;
|
||||
void mouseReleaseEvent(QMouseEvent *) override;
|
||||
private:
|
||||
bool resize_init;
|
||||
bool resize_proc;
|
||||
int resize_start;
|
||||
bool resize_top;
|
||||
bool resize_init;
|
||||
bool resize_proc;
|
||||
int resize_start;
|
||||
bool resize_top;
|
||||
|
||||
int resize_start_max;
|
||||
int resize_start_width;
|
||||
int resize_start_max;
|
||||
int resize_start_width;
|
||||
};
|
||||
|
||||
#endif // RESIZABLESCROLLBAR_H
|
||||
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "scrollarea.h"
|
||||
|
||||
#include <QWheelEvent>
|
||||
#include <QDebug>
|
||||
|
||||
#include "global/config.h"
|
||||
#include "panels/panels.h"
|
||||
#include "panels/timeline.h"
|
||||
|
||||
ScrollArea::ScrollArea(QWidget* parent) : QScrollArea(parent) {}
|
||||
|
||||
void ScrollArea::wheelEvent(QWheelEvent *e) {
|
||||
if (olive::CurrentConfig.scroll_zooms) {
|
||||
e->ignore();
|
||||
|
||||
if (e->angleDelta().y() > 0) {
|
||||
panel_timeline->zoom_in();
|
||||
} else if (e->angleDelta().y() < 0) {
|
||||
panel_timeline->zoom_out();
|
||||
}
|
||||
} else {
|
||||
QScrollArea::wheelEvent(e);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef SCROLLAREA_H
|
||||
#define SCROLLAREA_H
|
||||
|
||||
#include <QScrollArea>
|
||||
|
||||
class ScrollArea : public QScrollArea
|
||||
{
|
||||
public:
|
||||
ScrollArea(QWidget* parent = 0);
|
||||
void wheelEvent(QWheelEvent *);
|
||||
};
|
||||
|
||||
#endif // SCROLLAREA_H
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+22
-2
@@ -1,10 +1,30 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "styling.h"
|
||||
|
||||
#include "global/config.h"
|
||||
|
||||
bool olive::styling::UseDarkIcons()
|
||||
{
|
||||
return olive::CurrentConfig.style == kOliveDefaultLight || olive::CurrentConfig.style == kNativeDarkIcons;
|
||||
return olive::config.style == kOliveDefaultLight || olive::config.style == kNativeDarkIcons;
|
||||
}
|
||||
|
||||
QColor olive::styling::GetIconColor()
|
||||
@@ -20,5 +40,5 @@ QColor olive::styling::GetIconColor()
|
||||
|
||||
bool olive::styling::UseNativeUI()
|
||||
{
|
||||
return olive::CurrentConfig.style == kNativeLightIcons || olive::CurrentConfig.style == kNativeDarkIcons;
|
||||
return olive::config.style == kNativeLightIcons || olive::config.style == kNativeDarkIcons;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef STYLING_H
|
||||
#define STYLING_H
|
||||
|
||||
|
||||
+15
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -35,6 +35,9 @@ TextEditEx::TextEditEx(QWidget *parent, bool enable_rich_text) :
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
layout->setSpacing(0);
|
||||
layout->setMargin(0);
|
||||
|
||||
text_editor_ = new QTextEdit();
|
||||
text_editor_->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Expanding);
|
||||
connect(text_editor_, SIGNAL(textChanged()), this, SLOT(queue_text_modified()));
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
#include "timelinearea.h"
|
||||
|
||||
#include <QScrollArea>
|
||||
|
||||
#include "panels/timeline.h"
|
||||
#include "global/config.h"
|
||||
|
||||
int olive::timeline::kTimelineLabelFixedWidth = 200;
|
||||
|
||||
TimelineArea::TimelineArea(Timeline* timeline, olive::timeline::Alignment alignment) :
|
||||
timeline_(timeline),
|
||||
track_list_(nullptr),
|
||||
alignment_(alignment)
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
// LABELS
|
||||
label_container_ = new QWidget();
|
||||
label_container_layout_ = new QVBoxLayout(label_container_);
|
||||
label_container_layout_->setMargin(0);
|
||||
label_container_layout_->setSpacing(0);
|
||||
label_container_layout_->addStretch();
|
||||
|
||||
// LABEL SCROLLAREA
|
||||
QScrollArea* label_area = new QScrollArea();
|
||||
label_area->setFrameShape(QFrame::NoFrame);
|
||||
label_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
label_area->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
label_area->verticalScrollBar()->setMaximum(INT_MAX);
|
||||
label_area->setWidgetResizable(true);
|
||||
label_area->setFixedWidth(olive::timeline::kTimelineLabelFixedWidth);
|
||||
label_area->setWidget(label_container_);
|
||||
layout->addWidget(label_area);
|
||||
|
||||
// VIEW
|
||||
view_ = new TimelineView(timeline_);
|
||||
view_->SetAlignment(alignment_);
|
||||
layout->addWidget(view_);
|
||||
|
||||
// SCROLLBAR
|
||||
scrollbar_ = new QScrollBar(Qt::Vertical);
|
||||
layout->addWidget(scrollbar_);
|
||||
|
||||
connect(scrollbar_, SIGNAL(valueChanged(int)), view_, SLOT(setScroll(int)));
|
||||
connect(scrollbar_, SIGNAL(valueChanged(int)), label_area->verticalScrollBar(), SLOT(setValue(int)));
|
||||
connect(view_, SIGNAL(setScrollMaximum(int)), this, SLOT(setScrollMaximum(int)));
|
||||
connect(view_, SIGNAL(requestScrollChange(int)), scrollbar_, SLOT(setValue(int)));
|
||||
}
|
||||
|
||||
void TimelineArea::SetTrackList(Sequence *sequence, olive::TrackType track_list)
|
||||
{
|
||||
if (track_list_ != nullptr) {
|
||||
disconnect(track_list_, SIGNAL(TrackCountChanged()), this, SLOT(RefreshLabels()));
|
||||
}
|
||||
|
||||
if (sequence == nullptr) {
|
||||
|
||||
track_list_ = nullptr;
|
||||
|
||||
} else {
|
||||
|
||||
track_list_ = sequence->GetTrackList(track_list);
|
||||
connect(track_list_, SIGNAL(TrackCountChanged()), this, SLOT(RefreshLabels()));
|
||||
|
||||
}
|
||||
|
||||
RefreshLabels();
|
||||
|
||||
view_->SetTrackList(track_list_);
|
||||
|
||||
}
|
||||
|
||||
void TimelineArea::SetAlignment(olive::timeline::Alignment alignment)
|
||||
{
|
||||
view_->SetAlignment(alignment);
|
||||
alignment_ = alignment;
|
||||
|
||||
RefreshLabels();
|
||||
}
|
||||
|
||||
TrackList *TimelineArea::track_list()
|
||||
{
|
||||
return track_list_;
|
||||
}
|
||||
|
||||
TimelineView *TimelineArea::view()
|
||||
{
|
||||
return view_;
|
||||
}
|
||||
|
||||
void TimelineArea::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
|
||||
// TODO: implement pixel scrolling
|
||||
|
||||
bool shift = (event->modifiers() & Qt::ShiftModifier);
|
||||
bool ctrl = (event->modifiers() & Qt::ControlModifier);
|
||||
bool alt = (event->modifiers() & Qt::AltModifier);
|
||||
|
||||
// "Scroll Zooms" false + Control up : not zooming
|
||||
// "Scroll Zooms" false + Control down: zooming
|
||||
// "Scroll Zooms" true + Control up : zooming
|
||||
// "Scroll Zooms" true + Control down: not zooming
|
||||
bool zooming = (olive::config.scroll_zooms != ctrl);
|
||||
|
||||
// Allow shift for axis swap, but don't swap on zoom... Unless
|
||||
// we need to override Qt's axis swap via Alt
|
||||
bool swap_hv = ((shift != olive::config.invert_timeline_scroll_axes) &
|
||||
!zooming) | (alt & !shift & zooming);
|
||||
|
||||
int delta_h = swap_hv ? event->angleDelta().y() : event->angleDelta().x();
|
||||
int delta_v = swap_hv ? event->angleDelta().x() : event->angleDelta().y();
|
||||
|
||||
if (zooming) {
|
||||
|
||||
// Zoom only uses vertical scrolling, to avoid glitches on touchpads.
|
||||
// Don't do anything if not scrolling vertically.
|
||||
|
||||
if (delta_v != 0) {
|
||||
|
||||
// delta_v == 120 for one click of a mousewheel. Less or more for a
|
||||
// touchpad gesture. Calculate speed to compensate.
|
||||
// 120 = ratio of 4/3 (1.33), -120 = ratio of 3/4 (.75)
|
||||
|
||||
double zoom_ratio = 1.0 + (abs(delta_v) * 0.33 / 120);
|
||||
|
||||
if (delta_v < 0) {
|
||||
zoom_ratio = 1.0 / zoom_ratio;
|
||||
}
|
||||
|
||||
timeline_->multiply_zoom(zoom_ratio);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
// Use the Timeline's main scrollbar for horizontal scrolling, and this
|
||||
// widget's scrollbar for vertical scrolling.
|
||||
|
||||
QScrollBar* bar_v = scrollbar_;
|
||||
QScrollBar* bar_h = timeline_->horizontalScrollBar;
|
||||
|
||||
// Match the wheel events to the size of a step as per
|
||||
// https://doc.qt.io/qt-5/qwheelevent.html#angleDelta
|
||||
|
||||
int step_h = bar_h->singleStep() * delta_h / -120;
|
||||
int step_v = bar_v->singleStep() * delta_v / -120;
|
||||
|
||||
// Apply to appropriate scrollbars
|
||||
|
||||
bar_h->setValue(bar_h->value() + step_h);
|
||||
bar_v->setValue(bar_v->value() + step_v);
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineArea::RefreshLabels()
|
||||
{
|
||||
if (track_list_ == nullptr) {
|
||||
|
||||
labels_.clear();
|
||||
|
||||
} else {
|
||||
|
||||
labels_.resize(track_list_->TrackCount());
|
||||
for (int i=0;i<labels_.size();i++) {
|
||||
labels_[i] = std::make_shared<TimelineLabel>();
|
||||
labels_[i]->SetTrack(track_list_->TrackAt(i));
|
||||
labels_[i]->SetAlignment(alignment_);
|
||||
|
||||
switch (alignment_) {
|
||||
case olive::timeline::kAlignmentTop:
|
||||
label_container_layout_->insertWidget(label_container_layout_->count()-1, labels_[i].get());
|
||||
break;
|
||||
case olive::timeline::kAlignmentBottom:
|
||||
label_container_layout_->insertWidget(1, labels_[i].get());
|
||||
break;
|
||||
case olive::timeline::kAlignmentSingle:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineArea::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
scrollbar_->setPageStep(view_->height());
|
||||
}
|
||||
|
||||
void TimelineArea::setScrollMaximum(int maximum)
|
||||
{
|
||||
scrollbar_->setMaximum(qMax(0, maximum - view_->height()));
|
||||
label_container_->setMinimumHeight(maximum);
|
||||
// label_container_->setFixedHeight(maximum);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef TIMELINEAREA_H
|
||||
#define TIMELINEAREA_H
|
||||
|
||||
#include "timeline/sequence.h"
|
||||
#include "timeline/track.h"
|
||||
#include "timeline/tracklist.h"
|
||||
#include "timeline/timelinefunctions.h"
|
||||
#include "ui/timelineview.h"
|
||||
#include "ui/timelinelabel.h"
|
||||
|
||||
class TimelineArea : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TimelineArea(Timeline *timeline, olive::timeline::Alignment alignment = olive::timeline::kAlignmentTop);
|
||||
|
||||
void SetTrackList(Sequence* sequence, olive::TrackType track_list);
|
||||
void SetAlignment(olive::timeline::Alignment alignment);
|
||||
|
||||
TrackList* track_list();
|
||||
TimelineView* view();
|
||||
|
||||
virtual void wheelEvent(QWheelEvent *event) override;
|
||||
public slots:
|
||||
void RefreshLabels();
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
private:
|
||||
Timeline* timeline_;
|
||||
TrackList* track_list_;
|
||||
TimelineView* view_;
|
||||
QVector<TimelineLabelPtr> labels_;
|
||||
olive::timeline::Alignment alignment_;
|
||||
QVBoxLayout* label_container_layout_;
|
||||
QScrollBar* scrollbar_;
|
||||
QWidget* label_container_;
|
||||
private slots:
|
||||
void setScrollMaximum(int);
|
||||
};
|
||||
|
||||
#endif // TIMELINEAREA_H
|
||||
+31
-31
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "panels/panels.h"
|
||||
#include "panels/timeline.h"
|
||||
#include "global/math.h"
|
||||
#include "timeline/sequence.h"
|
||||
#include "undo/undo.h"
|
||||
#include "project/media.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "global/timing.h"
|
||||
#include "global/config.h"
|
||||
#include "global/global.h"
|
||||
#include "ui/menu.h"
|
||||
@@ -94,7 +94,7 @@ int TimelineHeader::getHeaderScreenPointFromFrame(long frame) {
|
||||
|
||||
void TimelineHeader::set_playhead(int mouse_x) {
|
||||
long frame = getHeaderFrameFromScreenPoint(mouse_x);
|
||||
if (snapping) panel_timeline->snap_to_timeline(&frame, false, true, true);
|
||||
if (snapping) viewer->seq->SnapPoint(&frame, zoom, false, true, true);
|
||||
if (frame != viewer->seq->playhead) {
|
||||
viewer->seek(frame);
|
||||
}
|
||||
@@ -114,10 +114,10 @@ void TimelineHeader::set_in_point(long new_in) {
|
||||
if (new_out == new_in) {
|
||||
new_in--;
|
||||
} else if (new_out < new_in) {
|
||||
new_out = viewer->seq->getEndFrame();
|
||||
new_out = viewer->seq->GetEndFrame();
|
||||
}
|
||||
|
||||
olive::UndoStack.push(new SetTimelineInOutCommand(viewer->seq.get(), true, new_in, new_out));
|
||||
olive::undo_stack.push(new SetTimelineInOutCommand(viewer->seq.get(), true, new_in, new_out));
|
||||
update_parents();
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ void TimelineHeader::set_out_point(long new_out) {
|
||||
new_in = 0;
|
||||
}
|
||||
|
||||
olive::UndoStack.push(new SetTimelineInOutCommand(viewer->seq.get(), true, new_in, new_out));
|
||||
olive::undo_stack.push(new SetTimelineInOutCommand(viewer->seq.get(), true, new_in, new_out));
|
||||
update_parents();
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ void TimelineHeader::show_text(bool enable) {
|
||||
void TimelineHeader::mousePressEvent(QMouseEvent* event) {
|
||||
if (viewer->seq != nullptr && event->buttons() & Qt::LeftButton) {
|
||||
if (resizing_workarea) {
|
||||
sequence_end = viewer->seq->getEndFrame();
|
||||
sequence_end = viewer->seq->GetEndFrame();
|
||||
} else {
|
||||
/*int
|
||||
QPoint start(in_x, height()+2);
|
||||
@@ -216,7 +216,7 @@ void TimelineHeader::mouseMoveEvent(QMouseEvent* event) {
|
||||
if (dragging) {
|
||||
if (resizing_workarea) {
|
||||
long frame = getHeaderFrameFromScreenPoint(event->pos().x());
|
||||
if (snapping) panel_timeline->snap_to_timeline(&frame, true, true, false);
|
||||
if (snapping) viewer->seq->SnapPoint(&frame, zoom, true, true, false);
|
||||
|
||||
if (resizing_workarea_in) {
|
||||
temp_workarea_in = qMax(qMin(temp_workarea_out-1, frame), 0L);
|
||||
@@ -231,7 +231,7 @@ void TimelineHeader::mouseMoveEvent(QMouseEvent* event) {
|
||||
// snap markers
|
||||
for (int i=0;i<selected_markers.size();i++) {
|
||||
long fm = selected_marker_original_times.at(i) + frame_movement;
|
||||
if (snapping && panel_timeline->snap_to_timeline(&fm, true, false, true)) {
|
||||
if (snapping && viewer->seq->SnapPoint(&fm, zoom, true, false, true)) {
|
||||
frame_movement = fm - selected_marker_original_times.at(i);
|
||||
break;
|
||||
}
|
||||
@@ -282,7 +282,7 @@ void TimelineHeader::mouseReleaseEvent(QMouseEvent*) {
|
||||
if (viewer->seq != nullptr) {
|
||||
dragging = false;
|
||||
if (resizing_workarea) {
|
||||
olive::UndoStack.push(new SetTimelineInOutCommand(viewer->seq.get(), true, temp_workarea_in, temp_workarea_out));
|
||||
olive::undo_stack.push(new SetTimelineInOutCommand(viewer->seq.get(), true, temp_workarea_in, temp_workarea_out));
|
||||
} else if (dragging_markers && selected_markers.size() > 0) {
|
||||
bool moved = false;
|
||||
ComboAction* ca = new ComboAction();
|
||||
@@ -294,7 +294,7 @@ void TimelineHeader::mouseReleaseEvent(QMouseEvent*) {
|
||||
}
|
||||
}
|
||||
if (moved) {
|
||||
olive::UndoStack.push(ca);
|
||||
olive::undo_stack.push(ca);
|
||||
} else {
|
||||
delete ca;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ void TimelineHeader::mouseReleaseEvent(QMouseEvent*) {
|
||||
resizing_workarea = false;
|
||||
dragging = false;
|
||||
dragging_markers = false;
|
||||
panel_timeline->snapped = false;
|
||||
olive::timeline::snapped = false;
|
||||
update_parents();
|
||||
}
|
||||
}
|
||||
@@ -332,7 +332,7 @@ void TimelineHeader::delete_markers() {
|
||||
// Send command to delete selected markers
|
||||
DeleteMarkerAction* dma = new DeleteMarkerAction(viewer->marker_ref);
|
||||
dma->markers.append(selected_markers);
|
||||
olive::UndoStack.push(dma);
|
||||
olive::undo_stack.push(dma);
|
||||
|
||||
// remove any indices for the selected markers that no longer exist
|
||||
for (int i=0;i<selected_markers.size();i++) {
|
||||
@@ -389,14 +389,14 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
// draw text
|
||||
bool draw_text = false;
|
||||
if (text_enabled && lineX-textWidth > lastTextBoundary) {
|
||||
timecode = frame_to_timecode(frame + in_visible, olive::CurrentConfig.timecode_view, viewer->seq->frame_rate);
|
||||
timecode = frame_to_timecode(frame + in_visible, olive::config.timecode_view, viewer->seq->frame_rate);
|
||||
fullTextWidth = fm.width(timecode);
|
||||
textWidth = fullTextWidth>>1;
|
||||
|
||||
text_x = lineX;
|
||||
|
||||
// centers the text to that point on the timeline, LEFT aligns it if not
|
||||
if (olive::CurrentConfig.center_timeline_timecodes) {
|
||||
if (olive::config.center_timeline_timecodes) {
|
||||
text_x -= textWidth;
|
||||
} else {
|
||||
text_x += TEXT_PADDING_FROM_LINE;
|
||||
@@ -416,7 +416,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
|
||||
// draw line markers
|
||||
p.setPen(Qt::gray);
|
||||
p.drawLine(lineX, (!olive::CurrentConfig.center_timeline_timecodes && draw_text) ? 0 : yoff, lineX, height());
|
||||
p.drawLine(lineX, (!olive::config.center_timeline_timecodes && draw_text) ? 0 : yoff, lineX, height());
|
||||
|
||||
// draw sub-line markers
|
||||
for (int j=1;j<sublineCount;j++) {
|
||||
@@ -455,7 +455,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
}
|
||||
}
|
||||
|
||||
draw_marker(p, marker_x, yoff, height()-1, selected);
|
||||
Marker::Draw(p, marker_x, yoff, height()-1, selected);
|
||||
}
|
||||
|
||||
// draw playhead triangle
|
||||
@@ -485,8 +485,8 @@ void TimelineHeader::show_context_menu(const QPoint &pos) {
|
||||
|
||||
QAction* center_timecodes = menu.addAction(tr("Center Timecodes"), &olive::MenuHelper, SLOT(toggle_bool_action()));
|
||||
center_timecodes->setCheckable(true);
|
||||
center_timecodes->setChecked(olive::CurrentConfig.center_timeline_timecodes);
|
||||
center_timecodes->setData(reinterpret_cast<quintptr>(&olive::CurrentConfig.center_timeline_timecodes));
|
||||
center_timecodes->setChecked(olive::config.center_timeline_timecodes);
|
||||
center_timecodes->setData(reinterpret_cast<quintptr>(&olive::config.center_timeline_timecodes));
|
||||
|
||||
menu.exec(mapToGlobal(pos));
|
||||
}
|
||||
|
||||
+53
-53
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -30,68 +30,68 @@ bool center_scroll_to_playhead(QScrollBar* bar, double zoom, long playhead);
|
||||
|
||||
class TimelineHeader : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TimelineHeader(QWidget *parent = 0);
|
||||
void set_in_point(long p);
|
||||
void set_out_point(long p);
|
||||
explicit TimelineHeader(QWidget *parent = 0);
|
||||
void set_in_point(long p);
|
||||
void set_out_point(long p);
|
||||
|
||||
Viewer* viewer;
|
||||
Viewer* viewer;
|
||||
|
||||
bool snapping;
|
||||
bool snapping;
|
||||
|
||||
void show_text(bool enable);
|
||||
double get_zoom();
|
||||
void delete_markers();
|
||||
void set_scrollbar_max(QScrollBar* bar, long sequence_end_frame, int offset);
|
||||
void show_text(bool enable);
|
||||
double get_zoom();
|
||||
void delete_markers();
|
||||
void set_scrollbar_max(QScrollBar* bar, long sequence_end_frame, int offset);
|
||||
|
||||
public slots:
|
||||
void update_zoom(double z);
|
||||
void set_scroll(int);
|
||||
void set_visible_in(long i);
|
||||
void show_context_menu(const QPoint &pos);
|
||||
void resized_scroll_listener(double d);
|
||||
void update_zoom(double z);
|
||||
void set_scroll(int);
|
||||
void set_visible_in(long i);
|
||||
void show_context_menu(const QPoint &pos);
|
||||
void resized_scroll_listener(double d);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*);
|
||||
void mousePressEvent(QMouseEvent*);
|
||||
void mouseMoveEvent(QMouseEvent*);
|
||||
void mouseReleaseEvent(QMouseEvent*);
|
||||
void focusOutEvent(QFocusEvent*);
|
||||
void paintEvent(QPaintEvent*);
|
||||
void mousePressEvent(QMouseEvent*);
|
||||
void mouseMoveEvent(QMouseEvent*);
|
||||
void mouseReleaseEvent(QMouseEvent*);
|
||||
void focusOutEvent(QFocusEvent*);
|
||||
|
||||
private:
|
||||
void update_parents();
|
||||
void update_parents();
|
||||
|
||||
bool dragging;
|
||||
bool dragging;
|
||||
|
||||
bool resizing_workarea;
|
||||
bool resizing_workarea_in;
|
||||
long temp_workarea_in;
|
||||
long temp_workarea_out;
|
||||
long sequence_end;
|
||||
bool resizing_workarea;
|
||||
bool resizing_workarea_in;
|
||||
long temp_workarea_in;
|
||||
long temp_workarea_out;
|
||||
long sequence_end;
|
||||
|
||||
double zoom;
|
||||
double zoom;
|
||||
|
||||
long in_visible;
|
||||
long in_visible;
|
||||
|
||||
void set_playhead(int mouse_x);
|
||||
void set_playhead(int mouse_x);
|
||||
|
||||
int get_marker_offset();
|
||||
int get_marker_offset();
|
||||
|
||||
QFontMetrics fm;
|
||||
QFontMetrics fm;
|
||||
|
||||
int drag_start;
|
||||
bool dragging_markers;
|
||||
QVector<int> selected_markers;
|
||||
QVector<long> selected_marker_original_times;
|
||||
int drag_start;
|
||||
bool dragging_markers;
|
||||
QVector<int> selected_markers;
|
||||
QVector<long> selected_marker_original_times;
|
||||
|
||||
long getHeaderFrameFromScreenPoint(int x);
|
||||
int getHeaderScreenPointFromFrame(long frame);
|
||||
long getHeaderFrameFromScreenPoint(int x);
|
||||
int getHeaderScreenPointFromFrame(long frame);
|
||||
|
||||
int scroll;
|
||||
int scroll;
|
||||
|
||||
int height_actual;
|
||||
bool text_enabled;
|
||||
int height_actual;
|
||||
bool text_enabled;
|
||||
|
||||
signals:
|
||||
};
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
#include "timelinelabel.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QInputDialog>
|
||||
|
||||
TimelineLabel::TimelineLabel() :
|
||||
track_(nullptr),
|
||||
alignment_(olive::timeline::kAlignmentTop)
|
||||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(layout->spacing()/2);
|
||||
|
||||
label_ = new ClickableLabel();
|
||||
layout->addWidget(label_);
|
||||
connect(label_, SIGNAL(double_clicked()), this, SLOT(RenameTrack()));
|
||||
|
||||
mute_button_ = new QPushButton("M");
|
||||
QSize fixed_size(mute_button_->sizeHint().height(), mute_button_->sizeHint().height());
|
||||
fixed_size *= 0.75;
|
||||
mute_button_->setFixedSize(fixed_size);
|
||||
mute_button_->setStyleSheet("QPushButton::checked { background: red; }");
|
||||
mute_button_->setCheckable(true);
|
||||
layout->addWidget(mute_button_);
|
||||
|
||||
solo_button_ = new QPushButton("S");
|
||||
solo_button_->setFixedSize(fixed_size);
|
||||
solo_button_->setStyleSheet("QPushButton::checked { background: yellow; }");
|
||||
solo_button_->setCheckable(true);
|
||||
layout->addWidget(solo_button_);
|
||||
|
||||
lock_button_ = new QPushButton("L");
|
||||
lock_button_->setFixedSize(fixed_size);
|
||||
lock_button_->setStyleSheet("QPushButton::checked { background: gray; }");
|
||||
lock_button_->setCheckable(true);
|
||||
layout->addWidget(lock_button_);
|
||||
}
|
||||
|
||||
void TimelineLabel::SetTrack(Track *track)
|
||||
{
|
||||
if (track_ != nullptr) {
|
||||
disconnect(mute_button_, SIGNAL(toggled(bool)), track_, SLOT(SetMuted(bool)));
|
||||
disconnect(solo_button_, SIGNAL(toggled(bool)), track_, SLOT(SetSoloed(bool)));
|
||||
disconnect(lock_button_, SIGNAL(toggled(bool)), track_, SLOT(SetLocked(bool)));
|
||||
}
|
||||
|
||||
track_ = track;
|
||||
|
||||
if (track_ != nullptr) {
|
||||
UpdateState();
|
||||
|
||||
connect(mute_button_, SIGNAL(toggled(bool)), track_, SLOT(SetMuted(bool)));
|
||||
connect(solo_button_, SIGNAL(toggled(bool)), track_, SLOT(SetSoloed(bool)));
|
||||
connect(lock_button_, SIGNAL(toggled(bool)), track_, SLOT(SetLocked(bool)));
|
||||
|
||||
connect(track_, SIGNAL(HeightChanged(int)), this, SLOT(UpdateHeight(int)));
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineLabel::UpdateState()
|
||||
{
|
||||
label_->setText(track_->name());
|
||||
|
||||
UpdateHeight(track_->height());
|
||||
|
||||
mute_button_->setChecked(track_->IsMuted());
|
||||
solo_button_->setChecked(track_->IsSoloed());
|
||||
lock_button_->setChecked(track_->IsLocked());
|
||||
}
|
||||
|
||||
void TimelineLabel::SetAlignment(olive::timeline::Alignment alignment)
|
||||
{
|
||||
alignment_ = alignment;
|
||||
update();
|
||||
}
|
||||
|
||||
void TimelineLabel::paintEvent(QPaintEvent *)
|
||||
{
|
||||
if (alignment_ != olive::timeline::kAlignmentTop && alignment_ != olive::timeline::kAlignmentBottom) {
|
||||
return;
|
||||
}
|
||||
|
||||
QPainter p(this);
|
||||
|
||||
p.setPen(QColor(0, 0, 0, 96));
|
||||
|
||||
int line_y = (alignment_ == olive::timeline::kAlignmentTop) ? height() - 1 : 0;
|
||||
|
||||
p.drawLine(0, line_y, width(), line_y);
|
||||
}
|
||||
|
||||
void TimelineLabel::RenameTrack()
|
||||
{
|
||||
bool ok;
|
||||
QString new_name = QInputDialog::getText(this,
|
||||
tr("Rename Track"),
|
||||
tr("Enter the new name for this track"),
|
||||
QLineEdit::Normal,
|
||||
track_->name(),
|
||||
&ok);
|
||||
if (ok) {
|
||||
track_->SetName(new_name);
|
||||
|
||||
UpdateState();
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineLabel::UpdateHeight(int h)
|
||||
{
|
||||
setFixedHeight(h+1);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef TIMELINELABEL_H
|
||||
#define TIMELINELABEL_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <memory>
|
||||
|
||||
#include "ui/clickablelabel.h"
|
||||
#include "timeline/track.h"
|
||||
#include "timeline/timelinefunctions.h"
|
||||
|
||||
class TimelineLabel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TimelineLabel();
|
||||
|
||||
void SetTrack(Track* track);
|
||||
void UpdateState();
|
||||
void SetAlignment(olive::timeline::Alignment alignment);
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *event) override;
|
||||
private:
|
||||
QPushButton* mute_button_;
|
||||
QPushButton* solo_button_;
|
||||
QPushButton* lock_button_;
|
||||
|
||||
ClickableLabel* label_;
|
||||
|
||||
Track* track_;
|
||||
|
||||
olive::timeline::Alignment alignment_;
|
||||
private slots:
|
||||
void RenameTrack();
|
||||
void UpdateHeight(int h);
|
||||
};
|
||||
|
||||
using TimelineLabelPtr = std::shared_ptr<TimelineLabel>;
|
||||
|
||||
#endif // TIMELINELABEL_H
|
||||
@@ -1,39 +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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINETOOLS_H
|
||||
#define TIMELINETOOLS_H
|
||||
|
||||
enum TimelineTool {
|
||||
TIMELINE_TOOL_POINTER,
|
||||
TIMELINE_TOOL_EDIT,
|
||||
TIMELINE_TOOL_RAZOR,
|
||||
TIMELINE_TOOL_RIPPLE,
|
||||
TIMELINE_TOOL_ROLLING,
|
||||
TIMELINE_TOOL_SLIP,
|
||||
TIMELINE_TOOL_SLIDE,
|
||||
TIMELINE_TOOL_HAND,
|
||||
TIMELINE_TOOL_ZOOM,
|
||||
TIMELINE_TOOL_MENU,
|
||||
TIMELINE_TOOL_TRANSITION,
|
||||
TIMELINE_TOOL_COUNT
|
||||
};
|
||||
|
||||
#endif // TIMELINETOOLS_H
|
||||
+3381
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,127 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEWIDGET_H
|
||||
#define TIMELINEWIDGET_H
|
||||
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
#include <QScrollBar>
|
||||
#include <QPainter>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include "timeline/sequence.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "timeline/timelinetools.h"
|
||||
#include "timeline/timelinefunctions.h"
|
||||
#include "project/footage.h"
|
||||
#include "project/media.h"
|
||||
#include "undo/undo.h"
|
||||
|
||||
class Timeline;
|
||||
|
||||
class TimelineView : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TimelineView(Timeline *parent);
|
||||
|
||||
void SetAlignment(olive::timeline::Alignment alignment);
|
||||
void SetTrackList(TrackList* tl);
|
||||
|
||||
Track* getTrackFromScreenPoint(int y);
|
||||
int getScreenPointFromTrack(Track* track);
|
||||
|
||||
int getTrackIndexFromScreenPoint(int y);
|
||||
int getScreenPointFromTrackIndex(int track);
|
||||
|
||||
int getTrackHeightFromTrackIndex(int track);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*);
|
||||
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
void dropEvent(QDropEvent* event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
private:
|
||||
void init_ghosts();
|
||||
void update_ghosts(const QPoint& mouse_pos, bool lock_frame);
|
||||
|
||||
Timeline* ParentTimeline();
|
||||
Sequence* sequence();
|
||||
void delete_area_under_ghosts(ComboAction* ca, Sequence *s);
|
||||
void insert_clips(ComboAction* ca, Sequence *s);
|
||||
bool current_tool_shows_cursor();
|
||||
void draw_transition(QPainter& p, Clip *c, const QRect& clip_rect, QRect& text_rect, int transition_type);
|
||||
Clip* GetClipAtCursor();
|
||||
|
||||
QVector<Track*> GetSplitTracksFromMouseCoords(bool also_split_links, long frame, int top, int bottom);
|
||||
|
||||
void VerifyTransitionsAfterCreating(ComboAction* ca, Clip* open, Clip* close, long transition_start, long transition_end);
|
||||
void VerifyTransitionHelper();
|
||||
|
||||
int GetTotalAreaHeight();
|
||||
|
||||
Timeline* timeline_;
|
||||
|
||||
olive::timeline::Alignment alignment_;
|
||||
TrackList* track_list_;
|
||||
|
||||
bool track_resizing;
|
||||
Track* track_target;
|
||||
|
||||
QVector<Clip*> pre_clips;
|
||||
QVector<Clip*> post_clips;
|
||||
|
||||
Media* rc_reveal_media;
|
||||
|
||||
SequencePtr self_created_sequence;
|
||||
|
||||
QTimer tooltip_timer;
|
||||
Clip* tooltip_clip;
|
||||
|
||||
int scroll;
|
||||
|
||||
signals:
|
||||
void setScrollMaximum(int);
|
||||
void requestScrollChange(int);
|
||||
|
||||
public slots:
|
||||
void setScroll(int);
|
||||
|
||||
private slots:
|
||||
void reveal_media();
|
||||
void show_context_menu(const QPoint& pos);
|
||||
void toggle_autoscale();
|
||||
void tooltip_timer_timeout();
|
||||
void open_sequence_properties();
|
||||
void show_clip_properties();
|
||||
};
|
||||
|
||||
#endif // TIMELINEWIDGET_H
|
||||
@@ -1,114 +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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEWIDGET_H
|
||||
#define TIMELINEWIDGET_H
|
||||
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
#include <QScrollBar>
|
||||
#include <QPainter>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
#include "timeline/sequence.h"
|
||||
#include "timeline/clip.h"
|
||||
#include "project/footage.h"
|
||||
#include "project/media.h"
|
||||
#include "undo/undo.h"
|
||||
#include "timelinetools.h"
|
||||
|
||||
class Timeline;
|
||||
|
||||
struct TimelineTrackHeight {
|
||||
int index;
|
||||
int height;
|
||||
};
|
||||
|
||||
bool same_sign(int a, int b);
|
||||
void draw_waveform(ClipPtr clip, const FootageStream *ms, long media_length, QPainter* p, const QRect& clip_rect, int waveform_start, int waveform_limit, double zoom);
|
||||
|
||||
class TimelineWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TimelineWidget(QWidget *parent = 0);
|
||||
QScrollBar* scrollBar;
|
||||
bool bottom_align;
|
||||
|
||||
public slots:
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*);
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
void dropEvent(QDropEvent* event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
private:
|
||||
void init_ghosts();
|
||||
void update_ghosts(const QPoint& mouse_pos, bool lock_frame);
|
||||
bool is_track_visible(int track);
|
||||
int getTrackFromScreenPoint(int y);
|
||||
int getScreenPointFromTrack(int track);
|
||||
int getClipIndexFromCoords(long frame, int track);
|
||||
|
||||
void VerifyTransitionHelper();
|
||||
|
||||
bool track_resizing;
|
||||
int track_target;
|
||||
|
||||
QVector<ClipPtr> pre_clips;
|
||||
QVector<ClipPtr> post_clips;
|
||||
|
||||
Media* rc_reveal_media;
|
||||
|
||||
SequencePtr self_created_sequence;
|
||||
|
||||
QTimer tooltip_timer;
|
||||
int tooltip_clip;
|
||||
|
||||
int scroll;
|
||||
|
||||
SetSelectionsCommand* selection_command;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void setScroll(int);
|
||||
|
||||
private slots:
|
||||
void reveal_media();
|
||||
void show_context_menu(const QPoint& pos);
|
||||
void toggle_autoscale();
|
||||
void tooltip_timer_timeout();
|
||||
void open_sequence_properties();
|
||||
void show_clip_properties();
|
||||
};
|
||||
|
||||
#endif // TIMELINEWIDGET_H
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "updatenotification.h"
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
/***
|
||||
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef UPDATENOTIFICATION_H
|
||||
#define UPDATENOTIFICATION_H
|
||||
|
||||
|
||||
+12
-12
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
|
||||
+33
-33
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -28,42 +28,42 @@ class QScrollBar;
|
||||
|
||||
class ViewerContainer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ViewerContainer(QWidget *parent = 0);
|
||||
~ViewerContainer();
|
||||
explicit ViewerContainer(QWidget *parent = 0);
|
||||
~ViewerContainer();
|
||||
|
||||
bool fit;
|
||||
double zoom;
|
||||
bool fit;
|
||||
double zoom;
|
||||
|
||||
void dragScrollPress(const QPoint&);
|
||||
void dragScrollMove(const QPoint&);
|
||||
void parseWheelEvent(QWheelEvent* event);
|
||||
void dragScrollPress(const QPoint&);
|
||||
void dragScrollMove(const QPoint&);
|
||||
void parseWheelEvent(QWheelEvent* event);
|
||||
|
||||
Viewer* viewer;
|
||||
ViewerWidget* child;
|
||||
void adjust();
|
||||
Viewer* viewer;
|
||||
ViewerWidget* child;
|
||||
void adjust();
|
||||
|
||||
// manually moves scrollbars into the correct position
|
||||
void adjust_scrollbars();
|
||||
// manually moves scrollbars into the correct position
|
||||
void adjust_scrollbars();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private slots:
|
||||
void scroll_changed();
|
||||
void scroll_changed();
|
||||
|
||||
private:
|
||||
int drag_start_x;
|
||||
int drag_start_y;
|
||||
int horiz_start;
|
||||
int vert_start;
|
||||
QScrollBar* horizontal_scrollbar;
|
||||
QScrollBar* vertical_scrollbar;
|
||||
int drag_start_x;
|
||||
int drag_start_y;
|
||||
int horiz_start;
|
||||
int vert_start;
|
||||
QScrollBar* horizontal_scrollbar;
|
||||
QScrollBar* vertical_scrollbar;
|
||||
};
|
||||
|
||||
#endif // VIEWERCONTAINER_H
|
||||
|
||||
+331
-173
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -27,8 +27,8 @@ extern "C" {
|
||||
#include <QPainter>
|
||||
#include <QAudioOutput>
|
||||
#include <QOpenGLShaderProgram>
|
||||
#include <QOpenGLExtraFunctions>
|
||||
#include <QtMath>
|
||||
#include <QOpenGLFramebufferObject>
|
||||
#include <QMouseEvent>
|
||||
#include <QMimeData>
|
||||
#include <QDrag>
|
||||
@@ -40,6 +40,7 @@ extern "C" {
|
||||
#include <QApplication>
|
||||
#include <QScreen>
|
||||
#include <QMessageBox>
|
||||
#include <QOpenGLBuffer>
|
||||
|
||||
#include "panels/panels.h"
|
||||
#include "project/projectelements.h"
|
||||
@@ -48,17 +49,23 @@ extern "C" {
|
||||
#include "global/config.h"
|
||||
#include "global/debug.h"
|
||||
#include "global/math.h"
|
||||
#include "global/timing.h"
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "undo/undo.h"
|
||||
#include "project/media.h"
|
||||
#include "ui/viewercontainer.h"
|
||||
#include "rendering/cacher.h"
|
||||
#include "ui/timelinewidget.h"
|
||||
#include "ui/timelineview.h"
|
||||
#include "rendering/renderfunctions.h"
|
||||
#include "rendering/renderthread.h"
|
||||
#include "rendering/shadergenerators.h"
|
||||
#include "ui/viewerwindow.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/waveform.h"
|
||||
#include "mainwindow.h"
|
||||
#include "effects/effectgizmo.h"
|
||||
|
||||
const int kTitleActionSafeVertexSize = 84;
|
||||
|
||||
ViewerWidget::ViewerWidget(QWidget *parent) :
|
||||
QOpenGLWidget(parent),
|
||||
@@ -77,17 +84,14 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
|
||||
|
||||
renderer = new RenderThread();
|
||||
renderer->start(QThread::HighestPriority);
|
||||
connect(renderer, SIGNAL(ready()), this, SLOT(queue_repaint()));
|
||||
connect(renderer, SIGNAL(finished()), renderer, SLOT(deleteLater()));
|
||||
renderer.start(QThread::HighestPriority);
|
||||
connect(&renderer, SIGNAL(ready()), this, SLOT(queue_repaint()));
|
||||
|
||||
window = new ViewerWindow(this);
|
||||
}
|
||||
|
||||
ViewerWidget::~ViewerWidget() {
|
||||
renderer->cancel();
|
||||
delete renderer;
|
||||
renderer.cancel();
|
||||
}
|
||||
|
||||
void ViewerWidget::set_waveform_scroll(int s) {
|
||||
@@ -144,7 +148,7 @@ void ViewerWidget::show_context_menu() {
|
||||
connect(&zoom_menu, SIGNAL(triggered(QAction*)), this, SLOT(set_menu_zoom(QAction*)));
|
||||
menu.addMenu(&zoom_menu);
|
||||
|
||||
if (!viewer->is_main_sequence()) {
|
||||
if (viewer->mode() != Viewer::kTimelineMode) {
|
||||
menu.addAction(tr("Close Media"), viewer, SLOT(close_media()));
|
||||
}
|
||||
|
||||
@@ -165,7 +169,7 @@ void ViewerWidget::save_frame() {
|
||||
fn += selected_ext;
|
||||
}
|
||||
|
||||
renderer->start_render(context(), viewer->seq.get(), 1, fn);
|
||||
renderer.start_render(context(), viewer->seq.get(), 1, fn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,9 +217,20 @@ void ViewerWidget::retry() {
|
||||
}
|
||||
|
||||
void ViewerWidget::initializeGL() {
|
||||
initializeOpenGLFunctions();
|
||||
context()->functions()->initializeOpenGLFunctions();
|
||||
|
||||
connect(context(), SIGNAL(aboutToBeDestroyed()), this, SLOT(context_destroy()), Qt::DirectConnection);
|
||||
|
||||
pipeline_ = olive::shader::GetPipeline();
|
||||
|
||||
vao_.create();
|
||||
|
||||
title_safe_area_buffer_.create();
|
||||
title_safe_area_buffer_.bind();
|
||||
title_safe_area_buffer_.allocate(nullptr, kTitleActionSafeVertexSize * sizeof(GLfloat));
|
||||
title_safe_area_buffer_.release();
|
||||
|
||||
gizmo_buffer_.create();
|
||||
}
|
||||
|
||||
void ViewerWidget::frame_update() {
|
||||
@@ -225,7 +240,7 @@ void ViewerWidget::frame_update() {
|
||||
update();
|
||||
} else {
|
||||
doneCurrent();
|
||||
renderer->start_render(context(), viewer->seq.get(), viewer->get_playback_speed());
|
||||
renderer.start_render(context(), viewer->seq.get(), viewer->get_playback_speed());
|
||||
}
|
||||
|
||||
// render the audio
|
||||
@@ -234,7 +249,7 @@ void ViewerWidget::frame_update() {
|
||||
}
|
||||
|
||||
RenderThread *ViewerWidget::get_renderer() {
|
||||
return renderer;
|
||||
return &renderer;
|
||||
}
|
||||
|
||||
void ViewerWidget::set_scroll(double x, double y) {
|
||||
@@ -247,12 +262,37 @@ void ViewerWidget::seek_from_click(int x) {
|
||||
viewer->seek(getFrameFromScreenPoint(waveform_zoom, x+waveform_scroll));
|
||||
}
|
||||
|
||||
QMatrix4x4 ViewerWidget::get_matrix()
|
||||
{
|
||||
QMatrix4x4 matrix;
|
||||
|
||||
double zoom_factor = container->zoom/(double(width())/double(viewer->seq->width));
|
||||
|
||||
if (zoom_factor > 1.0) {
|
||||
double zoom_size = (zoom_factor*2.0) - 2.0;
|
||||
|
||||
matrix.translate((-(x_scroll-0.5))*zoom_size, (y_scroll-0.5)*zoom_size);
|
||||
matrix.scale(zoom_factor);
|
||||
}
|
||||
|
||||
return matrix;
|
||||
}
|
||||
|
||||
void ViewerWidget::context_destroy() {
|
||||
makeCurrent();
|
||||
if (viewer->seq != nullptr) {
|
||||
close_active_clips(viewer->seq.get());
|
||||
|
||||
renderer.delete_ctx();
|
||||
|
||||
title_safe_area_buffer_.destroy();
|
||||
|
||||
if (gizmo_buffer_.isCreated()) {
|
||||
gizmo_buffer_.destroy();
|
||||
}
|
||||
renderer->delete_ctx();
|
||||
|
||||
vao_.destroy();
|
||||
|
||||
pipeline_ = nullptr;
|
||||
|
||||
doneCurrent();
|
||||
}
|
||||
|
||||
@@ -300,7 +340,12 @@ void ViewerWidget::move_gizmos(QMouseEvent *event, bool done) {
|
||||
int x_movement = qRound((event->pos().x() - drag_start_x)*multiplier);
|
||||
int y_movement = qRound((event->pos().y() - drag_start_y)*multiplier);
|
||||
|
||||
gizmos->gizmo_move(selected_gizmo, x_movement, y_movement, get_timecode(gizmos->parent_clip, gizmos->parent_clip->sequence->playhead), done);
|
||||
gizmos->gizmo_move(selected_gizmo,
|
||||
x_movement,
|
||||
y_movement,
|
||||
get_timecode(gizmos->parent_clip,
|
||||
gizmos->parent_clip->track()->sequence()->playhead),
|
||||
done);
|
||||
|
||||
gizmo_x_mvmt += x_movement;
|
||||
gizmo_y_mvmt += y_movement;
|
||||
@@ -313,7 +358,7 @@ void ViewerWidget::move_gizmos(QMouseEvent *event, bool done) {
|
||||
void ViewerWidget::mousePressEvent(QMouseEvent* event) {
|
||||
if (waveform) {
|
||||
seek_from_click(event->x());
|
||||
} else if (event->buttons() & Qt::MiddleButton || panel_timeline->tool == TIMELINE_TOOL_HAND) {
|
||||
} else if (event->buttons() & Qt::MiddleButton || olive::timeline::current_tool == olive::timeline::TIMELINE_TOOL_HAND) {
|
||||
container->dragScrollPress(event->pos()*container->zoom);
|
||||
} else if (event->buttons() & Qt::LeftButton) {
|
||||
drag_start_x = event->pos().x();
|
||||
@@ -329,13 +374,13 @@ void ViewerWidget::mousePressEvent(QMouseEvent* event) {
|
||||
|
||||
void ViewerWidget::mouseMoveEvent(QMouseEvent* event) {
|
||||
unsetCursor();
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_HAND) {
|
||||
if (olive::timeline::current_tool == olive::timeline::TIMELINE_TOOL_HAND) {
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
}
|
||||
if (dragging) {
|
||||
if (waveform) {
|
||||
seek_from_click(event->x());
|
||||
} else if (event->buttons() & Qt::MiddleButton || panel_timeline->tool == TIMELINE_TOOL_HAND) {
|
||||
} else if (event->buttons() & Qt::MiddleButton || olive::timeline::current_tool == olive::timeline::TIMELINE_TOOL_HAND) {
|
||||
container->dragScrollMove(event->pos()*container->zoom);
|
||||
} else if (event->buttons() & Qt::LeftButton) {
|
||||
if (gizmos == nullptr) {
|
||||
@@ -359,7 +404,7 @@ void ViewerWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
if (dragging
|
||||
&& gizmos != nullptr
|
||||
&& event->button() == Qt::LeftButton
|
||||
&& panel_timeline->tool != TIMELINE_TOOL_HAND) {
|
||||
&& olive::timeline::current_tool != olive::timeline::TIMELINE_TOOL_HAND) {
|
||||
move_gizmos(event, true);
|
||||
}
|
||||
dragging = false;
|
||||
@@ -375,7 +420,7 @@ void ViewerWidget::close_window() {
|
||||
|
||||
void ViewerWidget::wait_until_render_is_paused()
|
||||
{
|
||||
renderer->wait_until_paused();
|
||||
renderer.wait_until_paused();
|
||||
}
|
||||
|
||||
void ViewerWidget::draw_waveform_func() {
|
||||
@@ -393,224 +438,337 @@ void ViewerWidget::draw_waveform_func() {
|
||||
wr.setX(wr.x() - waveform_scroll);
|
||||
|
||||
p.setPen(Qt::green);
|
||||
draw_waveform(waveform_clip, waveform_ms, waveform_clip->timeline_out(), &p, wr, waveform_scroll, width()+waveform_scroll, waveform_zoom);
|
||||
olive::ui::DrawWaveform(waveform_clip.get(), waveform_ms, waveform_clip->timeline_out(), &p, wr, waveform_scroll, width()+waveform_scroll, waveform_zoom);
|
||||
p.setPen(Qt::red);
|
||||
int playhead_x = getScreenPointFromFrame(waveform_zoom, viewer->seq->playhead) - waveform_scroll;
|
||||
p.drawLine(playhead_x, 0, playhead_x, height());
|
||||
}
|
||||
|
||||
void ViewerWidget::draw_title_safe_area() {
|
||||
double halfWidth = 0.5;
|
||||
double halfHeight = 0.5;
|
||||
double viewportAr = (double) width() / (double) height();
|
||||
double halfAr = viewportAr*0.5;
|
||||
QOpenGLFunctions* func = context()->functions();
|
||||
|
||||
if (olive::CurrentConfig.use_custom_title_safe_ratio && olive::CurrentConfig.custom_title_safe_ratio > 0) {
|
||||
if (olive::CurrentConfig.custom_title_safe_ratio > viewportAr) {
|
||||
halfHeight = (olive::CurrentConfig.custom_title_safe_ratio/viewportAr)*0.5;
|
||||
pipeline_->bind();
|
||||
|
||||
|
||||
float ar = float(width()) / float(height());
|
||||
|
||||
float horizontal_cross_size = 0.05f / ar;
|
||||
|
||||
// Set matrix to 0.0 -> 1.0 on both axes
|
||||
QMatrix4x4 matrix;
|
||||
matrix.ortho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
|
||||
|
||||
// adjust the horizontal center cross by the aspect ratio to appear "square"
|
||||
if (olive::config.use_custom_title_safe_ratio && olive::config.custom_title_safe_ratio > 0) {
|
||||
if (ar > olive::config.custom_title_safe_ratio) {
|
||||
matrix.translate(((ar - olive::config.custom_title_safe_ratio) / 2.0) / ar, 0.0f);
|
||||
matrix.scale(olive::config.custom_title_safe_ratio / ar, 1.0f);
|
||||
} else {
|
||||
halfWidth = (viewportAr/olive::CurrentConfig.custom_title_safe_ratio)*0.5;
|
||||
matrix.translate(0.0f, (((olive::config.custom_title_safe_ratio - ar) / 2.0) / olive::config.custom_title_safe_ratio));
|
||||
matrix.scale(1.0f, ar / olive::config.custom_title_safe_ratio);
|
||||
}
|
||||
|
||||
horizontal_cross_size *= ar/olive::config.custom_title_safe_ratio;
|
||||
}
|
||||
|
||||
glLoadIdentity();
|
||||
glOrtho(-halfWidth, halfWidth, halfHeight, -halfHeight, 0, 1);
|
||||
float adjusted_cross_x1 = 0.5f - horizontal_cross_size;
|
||||
float adjusted_cross_x2 = 0.5f + horizontal_cross_size;
|
||||
|
||||
glColor4f(0.66f, 0.66f, 0.66f, 1.0f);
|
||||
glBegin(GL_LINES);
|
||||
pipeline_->setUniformValue("mvp_matrix", matrix);
|
||||
pipeline_->setUniformValue("color_only", true);
|
||||
pipeline_->setUniformValue("color_only_color", QColor(192, 192, 192, 255));
|
||||
|
||||
// action safe rectangle
|
||||
glVertex2d(-0.45, -0.45);
|
||||
glVertex2d(0.45, -0.45);
|
||||
glVertex2d(0.45, -0.45);
|
||||
glVertex2d(0.45, 0.45);
|
||||
glVertex2d(0.45, 0.45);
|
||||
glVertex2d(-0.45, 0.45);
|
||||
glVertex2d(-0.45, 0.45);
|
||||
glVertex2d(-0.45, -0.45);
|
||||
|
||||
// title safe rectangle
|
||||
glVertex2d(-0.4, -0.4);
|
||||
glVertex2d(0.4, -0.4);
|
||||
glVertex2d(0.4, -0.4);
|
||||
glVertex2d(0.4, 0.4);
|
||||
glVertex2d(0.4, 0.4);
|
||||
glVertex2d(-0.4, 0.4);
|
||||
glVertex2d(-0.4, 0.4);
|
||||
glVertex2d(-0.4, -0.4);
|
||||
|
||||
// horizontal centers
|
||||
glVertex2d(-0.45, 0);
|
||||
glVertex2d(-0.375, 0);
|
||||
glVertex2d(0.45, 0);
|
||||
glVertex2d(0.375, 0);
|
||||
GLfloat vertices[] = {
|
||||
// action safe lines
|
||||
0.05f, 0.05f, 0.0f,
|
||||
0.95f, 0.05f, 0.0f,
|
||||
|
||||
// vertical centers
|
||||
glVertex2d(0, -0.45);
|
||||
glVertex2d(0, -0.375);
|
||||
glVertex2d(0, 0.45);
|
||||
glVertex2d(0, 0.375);
|
||||
0.95f, 0.05f, 0.0f,
|
||||
0.95f, 0.95f, 0.0f,
|
||||
|
||||
glEnd();
|
||||
0.95f, 0.95f, 0.0f,
|
||||
0.05f, 0.95f, 0.0f,
|
||||
|
||||
// center cross
|
||||
glLoadIdentity();
|
||||
glOrtho(-halfAr, halfAr, 0.5, -0.5, -1, 1);
|
||||
0.05f, 0.95f, 0.0f,
|
||||
0.05f, 0.05f, 0.0f,
|
||||
|
||||
glBegin(GL_LINES);
|
||||
// title safe lines
|
||||
0.1f, 0.1f, 0.0f,
|
||||
0.9f, 0.1f, 0.0f,
|
||||
|
||||
glVertex2d(-0.05, 0);
|
||||
glVertex2d(0.05, 0);
|
||||
glVertex2d(0, -0.05);
|
||||
glVertex2d(0, 0.05);
|
||||
0.9f, 0.1f, 0.0f,
|
||||
0.9f, 0.9f, 0.0f,
|
||||
|
||||
0.9f, 0.9f, 0.0f,
|
||||
0.1f, 0.9f, 0.0f,
|
||||
|
||||
0.1f, 0.9f, 0.0f,
|
||||
0.1f, 0.1f, 0.0f,
|
||||
|
||||
// side-center markers
|
||||
0.05f, 0.5f, 0.0f,
|
||||
0.125f, 0.5f, 0.0f,
|
||||
|
||||
0.95f, 0.5f, 0.0f,
|
||||
0.875f, 0.5f, 0.0f,
|
||||
|
||||
0.5f, 0.05f, 0.0f,
|
||||
0.5f, 0.125f, 0.0f,
|
||||
|
||||
0.5f, 0.95f, 0.0f,
|
||||
0.5f, 0.875f, 0.0f,
|
||||
|
||||
// horizontal center cross marker
|
||||
adjusted_cross_x1, 0.5f, 0.0f,
|
||||
adjusted_cross_x2, 0.5f, 0.0f,
|
||||
|
||||
// vertical center cross marker
|
||||
0.5f, 0.45f, 0.0f,
|
||||
0.5f, 0.55f, 0.0f
|
||||
};
|
||||
|
||||
vao_.bind();
|
||||
|
||||
title_safe_area_buffer_.bind();
|
||||
title_safe_area_buffer_.write(0, vertices, kTitleActionSafeVertexSize * sizeof(GLfloat));
|
||||
|
||||
GLuint vertex_location = pipeline_->attributeLocation("a_position");
|
||||
func->glEnableVertexAttribArray(vertex_location);
|
||||
func->glVertexAttribPointer(vertex_location, 3, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
|
||||
func->glDrawArrays(GL_LINES, 0, 28);
|
||||
|
||||
pipeline_->setUniformValue("color_only", false);
|
||||
|
||||
title_safe_area_buffer_.release();
|
||||
|
||||
vao_.release();
|
||||
|
||||
pipeline_->release();
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
||||
void ViewerWidget::draw_gizmos() {
|
||||
float color[4];
|
||||
glGetFloatv(GL_CURRENT_COLOR, color);
|
||||
QOpenGLFunctions* func = context()->functions();
|
||||
|
||||
double dot_size = GIZMO_DOT_SIZE / double(width()) * viewer->seq->width;
|
||||
double target_size = GIZMO_TARGET_SIZE / double(width()) * viewer->seq->width;
|
||||
pipeline_->bind();
|
||||
|
||||
double zoom_factor = container->zoom/(double(width())/double(viewer->seq->width));
|
||||
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
QMatrix4x4 matrix;
|
||||
matrix.ortho(0, viewer->seq->width, 0, viewer->seq->height, -1, 1);
|
||||
matrix.scale(zoom_factor, zoom_factor);
|
||||
matrix.translate(-(viewer->seq->width-(width()/container->zoom))*x_scroll,
|
||||
-((viewer->seq->height-(height()/container->zoom))*(1.0-y_scroll)));
|
||||
|
||||
glOrtho(0, viewer->seq->width, 0, viewer->seq->height, -1, 10);
|
||||
glScaled(zoom_factor, zoom_factor, 0.0);
|
||||
glTranslated(-(viewer->seq->width-(width()/container->zoom))*x_scroll,
|
||||
-((viewer->seq->height-(height()/container->zoom))*(1.0-y_scroll)),
|
||||
0);
|
||||
// Set transformation matrix
|
||||
pipeline_->setUniformValue("mvp_matrix", matrix);
|
||||
|
||||
// Set pipeline shader to draw full white
|
||||
pipeline_->setUniformValue("color_only", true);
|
||||
pipeline_->setUniformValue("color_only_color", QColor(255, 255, 255, 255));
|
||||
|
||||
// Set up constants for gizmo sizes
|
||||
float size_diff = float(viewer->seq->width) / float(width());
|
||||
float dot_size = GIZMO_DOT_SIZE * size_diff;
|
||||
float target_size = GIZMO_TARGET_SIZE * size_diff;
|
||||
|
||||
QVector<GLfloat> vertices;
|
||||
|
||||
float gizmo_z = 0.0f;
|
||||
for (int j=0;j<gizmos->gizmo_count();j++) {
|
||||
|
||||
EffectGizmo* g = gizmos->gizmo(j);
|
||||
glColor4d(g->color.redF(), g->color.greenF(), g->color.blueF(), 1.0);
|
||||
|
||||
switch (g->get_type()) {
|
||||
case GIZMO_TYPE_DOT: // draw dot
|
||||
glBegin(GL_QUADS);
|
||||
glVertex3f(g->screen_pos[0].x()-dot_size, g->screen_pos[0].y()-dot_size, gizmo_z);
|
||||
glVertex3f(g->screen_pos[0].x()+dot_size, g->screen_pos[0].y()-dot_size, gizmo_z);
|
||||
glVertex3f(g->screen_pos[0].x()+dot_size, g->screen_pos[0].y()+dot_size, gizmo_z);
|
||||
glVertex3f(g->screen_pos[0].x()-dot_size, g->screen_pos[0].y()+dot_size, gizmo_z);
|
||||
glEnd();
|
||||
case GIZMO_TYPE_DOT:
|
||||
|
||||
// Draw standard square dot
|
||||
|
||||
vertices.append(g->screen_pos[0].x()-dot_size);
|
||||
vertices.append(g->screen_pos[0].y()-dot_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[0].x()+dot_size);
|
||||
vertices.append(g->screen_pos[0].y()-dot_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[0].x()+dot_size);
|
||||
vertices.append(g->screen_pos[0].y()+dot_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[0].x()-dot_size);
|
||||
vertices.append(g->screen_pos[0].y()+dot_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
break;
|
||||
case GIZMO_TYPE_POLY: // draw lines
|
||||
glBegin(GL_LINES);
|
||||
case GIZMO_TYPE_POLY:
|
||||
|
||||
// Draw an arbitrary polygon with lines
|
||||
|
||||
for (int k=1;k<g->get_point_count();k++) {
|
||||
glVertex3f(g->screen_pos[k-1].x(), g->screen_pos[k-1].y(), gizmo_z);
|
||||
glVertex3f(g->screen_pos[k].x(), g->screen_pos[k].y(), gizmo_z);
|
||||
|
||||
vertices.append(g->screen_pos[k-1].x());
|
||||
vertices.append(g->screen_pos[k-1].y());
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[k].x());
|
||||
vertices.append(g->screen_pos[k].y());
|
||||
vertices.append(0.0f);
|
||||
|
||||
}
|
||||
glVertex3f(g->screen_pos[g->get_point_count()-1].x(), g->screen_pos[g->get_point_count()-1].y(), gizmo_z);
|
||||
glVertex3f(g->screen_pos[0].x(), g->screen_pos[0].y(), gizmo_z);
|
||||
glEnd();
|
||||
|
||||
vertices.append(g->screen_pos[g->get_point_count()-1].x());
|
||||
vertices.append(g->screen_pos[g->get_point_count()-1].y());
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[0].x());
|
||||
vertices.append(g->screen_pos[0].y());
|
||||
vertices.append(0.0f);
|
||||
|
||||
break;
|
||||
case GIZMO_TYPE_TARGET: // draw target
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(g->screen_pos[0].x()-target_size, g->screen_pos[0].y()-target_size, gizmo_z);
|
||||
glVertex3f(g->screen_pos[0].x()+target_size, g->screen_pos[0].y()-target_size, gizmo_z);
|
||||
case GIZMO_TYPE_TARGET:
|
||||
|
||||
glVertex3f(g->screen_pos[0].x()+target_size, g->screen_pos[0].y()-target_size, gizmo_z);
|
||||
glVertex3f(g->screen_pos[0].x()+target_size, g->screen_pos[0].y()+target_size, gizmo_z);
|
||||
// Draw "target" gizmo (square with two lines through the middle)
|
||||
|
||||
glVertex3f(g->screen_pos[0].x()+target_size, g->screen_pos[0].y()+target_size, gizmo_z);
|
||||
glVertex3f(g->screen_pos[0].x()-target_size, g->screen_pos[0].y()+target_size, gizmo_z);
|
||||
vertices.append(g->screen_pos[0].x()-target_size);
|
||||
vertices.append(g->screen_pos[0].y()-target_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
glVertex3f(g->screen_pos[0].x()-target_size, g->screen_pos[0].y()+target_size, gizmo_z);
|
||||
glVertex3f(g->screen_pos[0].x()-target_size, g->screen_pos[0].y()-target_size, gizmo_z);
|
||||
vertices.append(g->screen_pos[0].x()+target_size);
|
||||
vertices.append(g->screen_pos[0].y()-target_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
glVertex3f(g->screen_pos[0].x()-target_size, g->screen_pos[0].y(), gizmo_z);
|
||||
glVertex3f(g->screen_pos[0].x()+target_size, g->screen_pos[0].y(), gizmo_z);
|
||||
vertices.append(g->screen_pos[0].x()+target_size);
|
||||
vertices.append(g->screen_pos[0].y()-target_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[0].x()+target_size);
|
||||
vertices.append(g->screen_pos[0].y()+target_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[0].x()+target_size);
|
||||
vertices.append(g->screen_pos[0].y()+target_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[0].x()-target_size);
|
||||
vertices.append(g->screen_pos[0].y()+target_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[0].x()-target_size);
|
||||
vertices.append(g->screen_pos[0].y()+target_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[0].x()-target_size);
|
||||
vertices.append(g->screen_pos[0].y()-target_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
|
||||
|
||||
vertices.append(g->screen_pos[0].x()-target_size);
|
||||
vertices.append(g->screen_pos[0].y());
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[0].x()+target_size);
|
||||
vertices.append(g->screen_pos[0].y());
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[0].x());
|
||||
vertices.append(g->screen_pos[0].y()-target_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
vertices.append(g->screen_pos[0].x());
|
||||
vertices.append(g->screen_pos[0].y()+target_size);
|
||||
vertices.append(0.0f);
|
||||
|
||||
glVertex3f(g->screen_pos[0].x(), g->screen_pos[0].y()-target_size, gizmo_z);
|
||||
glVertex3f(g->screen_pos[0].x(), g->screen_pos[0].y()+target_size, gizmo_z);
|
||||
glEnd();
|
||||
break;
|
||||
}
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
glColor4f(color[0], color[1], color[2], color[3]);
|
||||
vao_.bind();
|
||||
|
||||
// The gizmo buffer may have been destroyed or not created yet, ensure it's created here
|
||||
if (!gizmo_buffer_.isCreated() && !gizmo_buffer_.create()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gizmo_buffer_.bind();
|
||||
|
||||
// Get the total byte size of the vertex array
|
||||
int gizmo_buffer_desired_size = vertices.size() * sizeof(GLfloat);
|
||||
|
||||
// Determine if the gizmo count has changed, and if so reallocate the buffer
|
||||
if (gizmo_buffer_.size() != gizmo_buffer_desired_size) {
|
||||
gizmo_buffer_.allocate(vertices.constData(), gizmo_buffer_desired_size);
|
||||
} else {
|
||||
gizmo_buffer_.write(0, vertices.constData(), gizmo_buffer_desired_size);
|
||||
}
|
||||
|
||||
|
||||
GLuint vertex_location = pipeline_->attributeLocation("a_position");
|
||||
func->glEnableVertexAttribArray(vertex_location);
|
||||
func->glVertexAttribPointer(vertex_location, 3, GL_FLOAT, GL_FALSE, 0, 0);
|
||||
|
||||
gizmo_buffer_.release();
|
||||
|
||||
func->glDrawArrays(GL_LINES, 0, vertices.size() / 3);
|
||||
|
||||
pipeline_->setUniformValue("color_only", false);
|
||||
|
||||
vao_.release();
|
||||
|
||||
pipeline_->release();
|
||||
|
||||
}
|
||||
|
||||
void ViewerWidget::paintGL() {
|
||||
if (waveform) {
|
||||
draw_waveform_func();
|
||||
} else {
|
||||
const GLuint tex = renderer->get_texture();
|
||||
QMutex* tex_lock = renderer->get_texture_mutex();
|
||||
const GLuint tex = renderer.get_texture();
|
||||
QMutex* tex_lock = renderer.get_texture_mutex();
|
||||
|
||||
tex_lock->lock();
|
||||
|
||||
QOpenGLFunctions* f = context()->functions();
|
||||
|
||||
makeCurrent();
|
||||
|
||||
// clear to solid black
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
f->glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
f->glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// set color multipler to straight white
|
||||
glColor4f(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
// set screen coords to widget size
|
||||
glLoadIdentity();
|
||||
glOrtho(-1, 1, -1, 1, -1, 1);
|
||||
|
||||
// draw texture from render thread
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
f->glViewport(0, 0, width(), height());
|
||||
|
||||
context()->functions()->glGenerateMipmap(GL_TEXTURE_2D);
|
||||
f->glBindTexture(GL_TEXTURE_2D, tex);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
olive::rendering::Blit(pipeline_.get(), true, get_matrix());
|
||||
|
||||
double zoom_factor = container->zoom/(double(width())/double(viewer->seq->width));
|
||||
double zoom_size = (zoom_factor*2.0) - 2.0;
|
||||
double zoom_left = -zoom_size*x_scroll - 1.0;
|
||||
double zoom_right = zoom_size*(1.0-x_scroll) + 1.0;
|
||||
double zoom_bottom = -zoom_size*(1.0-y_scroll) - 1.0;
|
||||
double zoom_top = zoom_size*(y_scroll) + 1.0;
|
||||
|
||||
//zoom_left *= ar_diff;
|
||||
//zoom_right *= ar_diff;
|
||||
|
||||
glVertex2d(zoom_left, zoom_bottom);
|
||||
glTexCoord2d(0, 0);
|
||||
glVertex2d(zoom_left, zoom_top);
|
||||
glTexCoord2d(1, 0);
|
||||
glVertex2d(zoom_right, zoom_top);
|
||||
glTexCoord2d(1, 1);
|
||||
glVertex2d(zoom_right, zoom_bottom);
|
||||
glTexCoord2d(0, 1);
|
||||
|
||||
glEnd();
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
f->glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
// draw title/action safe area
|
||||
if (olive::CurrentConfig.show_title_safe_area) {
|
||||
if (olive::config.show_title_safe_area) {
|
||||
draw_title_safe_area();
|
||||
}
|
||||
|
||||
gizmos = renderer->gizmos;
|
||||
gizmos = renderer.gizmos;
|
||||
if (gizmos != nullptr) {
|
||||
draw_gizmos();
|
||||
}
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
glFinish();
|
||||
|
||||
if (window->isVisible()) {
|
||||
window->set_texture(tex, double(viewer->seq->width)/double(viewer->seq->height), tex_lock);
|
||||
}
|
||||
|
||||
tex_lock->unlock();
|
||||
|
||||
if (renderer->did_texture_fail() && !viewer->playing) {
|
||||
if (renderer.did_texture_fail() && !viewer->playing) {
|
||||
doneCurrent();
|
||||
renderer->start_render(context(), viewer->seq.get(), viewer->get_playback_speed());
|
||||
renderer.start_render(context(), viewer->seq.get(), viewer->get_playback_speed());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+25
-16
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -29,10 +29,12 @@
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QOpenGLVertexArrayObject>
|
||||
#include <QOpenGLBuffer>
|
||||
|
||||
#include "timeline/clip.h"
|
||||
#include "project/footage.h"
|
||||
#include "effects/effect.h"
|
||||
#include "nodes/node.h"
|
||||
#include "ui/viewerwindow.h"
|
||||
#include "ui/viewercontainer.h"
|
||||
#include "rendering/renderthread.h"
|
||||
@@ -41,7 +43,7 @@ class Viewer;
|
||||
class QOpenGLFramebufferObject;
|
||||
struct GLTextureCoords;
|
||||
|
||||
class ViewerWidget : public QOpenGLWidget, QOpenGLFunctions
|
||||
class ViewerWidget : public QOpenGLWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -81,16 +83,23 @@ private:
|
||||
void move_gizmos(QMouseEvent *event, bool done);
|
||||
bool dragging;
|
||||
void seek_from_click(int x);
|
||||
Effect* gizmos;
|
||||
QMatrix4x4 get_matrix();
|
||||
Node* gizmos;
|
||||
int drag_start_x;
|
||||
int drag_start_y;
|
||||
int gizmo_x_mvmt;
|
||||
int gizmo_y_mvmt;
|
||||
EffectGizmo* selected_gizmo;
|
||||
RenderThread* renderer;
|
||||
RenderThread renderer;
|
||||
ViewerWindow* window;
|
||||
double x_scroll;
|
||||
double y_scroll;
|
||||
|
||||
QOpenGLShaderProgramPtr pipeline_;
|
||||
QOpenGLVertexArrayObject vao_;
|
||||
QOpenGLBuffer gizmo_buffer_;
|
||||
QOpenGLBuffer title_safe_area_buffer_;
|
||||
|
||||
private slots:
|
||||
void context_destroy();
|
||||
void retry();
|
||||
|
||||
+60
-65
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -28,27 +28,28 @@
|
||||
#include <QShortcut>
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QOpenGLContext>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "rendering/renderfunctions.h"
|
||||
#include "rendering/shadergenerators.h"
|
||||
#include "ui/mainwindow.h"
|
||||
|
||||
ViewerWindow::ViewerWindow(QWidget *parent) :
|
||||
QOpenGLWidget(parent, Qt::Window),
|
||||
texture(0),
|
||||
mutex(nullptr),
|
||||
show_fullscreen_msg(false)
|
||||
texture_(0),
|
||||
mutex_(nullptr),
|
||||
show_fullscreen_msg_(false)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
|
||||
fullscreen_msg_timer.setInterval(2000);
|
||||
connect(&fullscreen_msg_timer, SIGNAL(timeout()), this, SLOT(fullscreen_msg_timeout()));
|
||||
fullscreen_msg_timer_.setInterval(2000);
|
||||
connect(&fullscreen_msg_timer_, SIGNAL(timeout()), this, SLOT(fullscreen_msg_timeout()));
|
||||
}
|
||||
|
||||
void ViewerWindow::set_texture(GLuint t, double iar, QMutex* imutex) {
|
||||
texture = t;
|
||||
ar = iar;
|
||||
mutex = imutex;
|
||||
texture_ = t;
|
||||
ar_ = iar;
|
||||
mutex_ = imutex;
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -94,71 +95,65 @@ void ViewerWindow::keyPressEvent(QKeyEvent *e) {
|
||||
}
|
||||
|
||||
void ViewerWindow::mousePressEvent(QMouseEvent *e) {
|
||||
if (show_fullscreen_msg && fullscreen_msg_rect.contains(e->pos())) {
|
||||
if (show_fullscreen_msg_ && fullscreen_msg_rect_.contains(e->pos())) {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerWindow::mouseMoveEvent(QMouseEvent *) {
|
||||
fullscreen_msg_timer.start();
|
||||
if (!show_fullscreen_msg) {
|
||||
show_fullscreen_msg = true;
|
||||
fullscreen_msg_timer_.start();
|
||||
if (!show_fullscreen_msg_) {
|
||||
show_fullscreen_msg_ = true;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerWindow::initializeGL()
|
||||
{
|
||||
pipeline_ = olive::shader::GetPipeline();
|
||||
}
|
||||
|
||||
void ViewerWindow::paintGL() {
|
||||
if (texture > 0) {
|
||||
if (mutex != nullptr) mutex->lock();
|
||||
if (texture_ > 0) {
|
||||
if (mutex_ != nullptr) mutex_->lock();
|
||||
|
||||
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
QOpenGLFunctions* f = context()->functions();
|
||||
//QOpenGLExtraFunctions* xf = context()->extraFunctions();
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
makeCurrent();
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
// clear to solid black
|
||||
f->glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||
f->glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glLoadIdentity();
|
||||
glOrtho(0, 1, 0, 1, -1, 1);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
// draw texture from render thread
|
||||
|
||||
double top = 0;
|
||||
double left = 0;
|
||||
double right = 1;
|
||||
double bottom = 1;
|
||||
|
||||
double widget_ar = double(width()) / double(height());
|
||||
QMatrix4x4 matrix;
|
||||
|
||||
if (widget_ar > ar) {
|
||||
double width = 1.0 * ar / widget_ar;
|
||||
left = (1.0 - width)*0.5;
|
||||
right = left + width;
|
||||
double widget_ar = (double(width()) / double(height()));
|
||||
if (widget_ar > ar_) {
|
||||
matrix.scale(ar_ / widget_ar, 1.0);
|
||||
} else {
|
||||
double height = 1.0 / ar * widget_ar;
|
||||
top = (1.0 - height)*0.5;
|
||||
bottom = top + height;
|
||||
matrix.scale(1.0f, widget_ar / ar_);
|
||||
}
|
||||
|
||||
glVertex2d(left, top);
|
||||
glTexCoord2d(0, 0);
|
||||
glVertex2d(left, bottom);
|
||||
glTexCoord2d(1, 0);
|
||||
glVertex2d(right, bottom);
|
||||
glTexCoord2d(1, 1);
|
||||
glVertex2d(right, top);
|
||||
glTexCoord2d(0, 1);
|
||||
|
||||
glEnd();
|
||||
f->glViewport(0, 0, width(), height());
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
f->glBindTexture(GL_TEXTURE_2D, texture_);
|
||||
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
olive::rendering::Blit(pipeline_.get(), true, matrix);
|
||||
|
||||
if (mutex != nullptr) mutex->unlock();
|
||||
f->glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
|
||||
|
||||
if (mutex_ != nullptr) mutex_->unlock();
|
||||
}
|
||||
|
||||
if (show_fullscreen_msg) {
|
||||
if (show_fullscreen_msg_) {
|
||||
QPainter p(this);
|
||||
|
||||
QFont f = p.font();
|
||||
@@ -178,21 +173,21 @@ void ViewerWindow::paintGL() {
|
||||
|
||||
int rect_padding = 8;
|
||||
|
||||
fullscreen_msg_rect = QRect(text_x-rect_padding,
|
||||
fullscreen_msg_rect_ = QRect(text_x-rect_padding,
|
||||
fm.height()-rect_padding,
|
||||
text_width+rect_padding+rect_padding,
|
||||
fm.height()+rect_padding+rect_padding);
|
||||
|
||||
p.drawRect(fullscreen_msg_rect);
|
||||
p.drawRect(fullscreen_msg_rect_);
|
||||
|
||||
p.drawText(text_x, text_y, fs_str);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerWindow::fullscreen_msg_timeout() {
|
||||
fullscreen_msg_timer.stop();
|
||||
if (show_fullscreen_msg) {
|
||||
show_fullscreen_msg = false;
|
||||
fullscreen_msg_timer_.stop();
|
||||
if (show_fullscreen_msg_) {
|
||||
show_fullscreen_msg_ = false;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
+24
-21
@@ -1,20 +1,20 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 Olive Team
|
||||
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 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.
|
||||
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/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
@@ -23,10 +23,11 @@
|
||||
|
||||
#include <QOpenGLWidget>
|
||||
#include <QTimer>
|
||||
#include <QMutex>
|
||||
#include <QMenu>
|
||||
#include <QShortcut>
|
||||
|
||||
class QMutex;
|
||||
class QMenu;
|
||||
class QShortcut;
|
||||
#include "rendering/qopenglshaderprogramptr.h"
|
||||
|
||||
class ViewerWindow : public QOpenGLWidget {
|
||||
Q_OBJECT
|
||||
@@ -39,20 +40,22 @@ protected:
|
||||
virtual void mousePressEvent(QMouseEvent*) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent*) override;
|
||||
|
||||
virtual void initializeGL() override;
|
||||
virtual void paintGL() override;
|
||||
private:
|
||||
GLuint texture;
|
||||
double ar;
|
||||
QMutex* mutex;
|
||||
GLuint texture_;
|
||||
double ar_;
|
||||
QMutex* mutex_;
|
||||
QOpenGLShaderProgramPtr pipeline_;
|
||||
|
||||
// shortcuts
|
||||
void shortcut_copier(QVector<QShortcut*>& shortcuts, QMenu* menu);
|
||||
QVector<QShortcut*> shortcuts_;
|
||||
|
||||
// exit full screen message
|
||||
QTimer fullscreen_msg_timer;
|
||||
bool show_fullscreen_msg;
|
||||
QRect fullscreen_msg_rect;
|
||||
QTimer fullscreen_msg_timer_;
|
||||
bool show_fullscreen_msg_;
|
||||
QRect fullscreen_msg_rect_;
|
||||
private slots:
|
||||
void fullscreen_msg_timeout();
|
||||
};
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#include "waveform.h"
|
||||
|
||||
#include <QtMath>
|
||||
|
||||
#include "global/config.h"
|
||||
|
||||
int ConvertSampleToHeight(qint8 signed_sample, int channel_height) {
|
||||
int half_channel_height = channel_height >> 1;
|
||||
return (half_channel_height) + qRound(((double(signed_sample) / 128.0)) * half_channel_height);
|
||||
}
|
||||
|
||||
void olive::ui::DrawWaveform(Clip* clip,
|
||||
const FootageStream* ms,
|
||||
long media_length,
|
||||
QPainter *p,
|
||||
const QRect& clip_rect,
|
||||
int waveform_start,
|
||||
int waveform_limit,
|
||||
double zoom) {
|
||||
|
||||
int divider = ms->audio_channels;
|
||||
|
||||
int channel_height = clip_rect.height()/ms->audio_channels;
|
||||
|
||||
int last_waveform_index = -1;
|
||||
|
||||
for (int i=waveform_start;i<waveform_limit;i++) {
|
||||
int waveform_index = qFloor((((clip->clip_in() + (double(i)/zoom))/media_length) * ms->audio_preview.size())/divider)*divider;
|
||||
|
||||
if (clip->reversed()) {
|
||||
waveform_index = ms->audio_preview.size() - waveform_index - (ms->audio_channels * 2);
|
||||
}
|
||||
|
||||
if (last_waveform_index < 0) last_waveform_index = waveform_index;
|
||||
|
||||
for (int j=0;j<ms->audio_channels;j++) {
|
||||
int bottom = clip_rect.top()+channel_height*(j+1);
|
||||
|
||||
int offset_range_start = last_waveform_index+(j*2);
|
||||
int offset_range_end = waveform_index+(j*2);
|
||||
int offset_range_min = qMin(offset_range_start, offset_range_end);
|
||||
int offset_range_max = qMax(offset_range_start, offset_range_end);
|
||||
|
||||
// Break if we're about to draw from an index that doesn't exist
|
||||
if (offset_range_min+1 >= ms->audio_preview.size()) {
|
||||
break;
|
||||
}
|
||||
|
||||
int min = ConvertSampleToHeight(ms->audio_preview.at(offset_range_min), channel_height);
|
||||
int max = ConvertSampleToHeight(ms->audio_preview.at(offset_range_min+1), channel_height);
|
||||
|
||||
if ((offset_range_max + 1) < ms->audio_preview.size()) {
|
||||
|
||||
// for waveform drawings, we get the maximum below 0 and maximum above 0 for this waveform range
|
||||
for (int k=offset_range_min+2;k<=offset_range_max;k+=2) {
|
||||
min = ConvertSampleToHeight(ms->audio_preview.at(k), channel_height);
|
||||
max = ConvertSampleToHeight(ms->audio_preview.at(k+1), channel_height);
|
||||
}
|
||||
|
||||
// draw waveforms
|
||||
if (olive::config.rectified_waveforms) {
|
||||
p->drawLine(clip_rect.left()+i, bottom, clip_rect.left()+i, bottom - (max - min));
|
||||
} else {
|
||||
p->drawLine(clip_rect.left()+i, bottom - min, clip_rect.left()+i, bottom - max);
|
||||
}
|
||||
}
|
||||
}
|
||||
last_waveform_index = waveform_index;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef WAVEFORM_H
|
||||
#define WAVEFORM_H
|
||||
|
||||
#include <QPainter>
|
||||
#include <QRect>
|
||||
|
||||
#include "timeline/clip.h"
|
||||
#include "project/footage.h"
|
||||
|
||||
namespace olive {
|
||||
namespace ui {
|
||||
|
||||
void DrawWaveform(Clip* clip,
|
||||
const FootageStream *ms,
|
||||
long media_length,
|
||||
QPainter* p,
|
||||
const QRect& clip_rect,
|
||||
int waveform_start,
|
||||
int waveform_limit,
|
||||
double zoom);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // WAVEFORM_H
|
||||
Reference in New Issue
Block a user