Merge pull request #223 from olive-editor/timelinebehaviorfixes
tons of fixes and enhancements
This commit is contained in:
+21
-8
@@ -1,14 +1,27 @@
|
||||
#include "aboutdialog.h"
|
||||
#include "ui_aboutdialog.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
AboutDialog::AboutDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AboutDialog)
|
||||
QDialog(parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
setWindowTitle("About Olive");
|
||||
setMaximumWidth(360);
|
||||
|
||||
AboutDialog::~AboutDialog()
|
||||
{
|
||||
delete ui;
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setSpacing(20);
|
||||
setLayout(layout);
|
||||
|
||||
QLabel* label = new QLabel("<html><head/><body><p><img src=\":/icons/olive-splash.png\"/></p><p><a href=\"https://www.olivevideoeditor.org/\"><span style=\" text-decoration: underline; color:#007af4;\">https://www.olivevideoeditor.org/</span></a></p><p>Olive is a non-linear video editor. This software is free and protected by the GNU GPL.</p><p>Olive Team is obliged to inform users that Olive source code is available for download from its website.</p><p>Olive uses (at least) the following libraries in accordance with the GNU GPL/LGPL:</p><p>Qt, FFmpeg, libass, libfreetype, libmp3lame, libopenjpeg, libopus, libtheora, libtwolame, libvpx, libwavpack, libwebp, libx264, libx265, lzma, bzlib, zlib, libvidstab, libvorbis.</p></body></html>");
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
label->setWordWrap(true);
|
||||
layout->addWidget(label);
|
||||
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok, this);
|
||||
buttons->setCenterButtons(true);
|
||||
layout->addWidget(buttons);
|
||||
|
||||
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
}
|
||||
|
||||
@@ -3,20 +3,12 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class AboutDialog;
|
||||
}
|
||||
|
||||
class AboutDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutDialog(QWidget *parent = 0);
|
||||
~AboutDialog();
|
||||
|
||||
private:
|
||||
Ui::AboutDialog *ui;
|
||||
};
|
||||
|
||||
#endif // ABOUTDIALOG_H
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AboutDialog</class>
|
||||
<widget class="QDialog" name="AboutDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>358</width>
|
||||
<height>422</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>About Olive</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><img src=":/icons/olive-splash.png"/></p><p><a href="https://www.olivevideoeditor.org/"><span style=" text-decoration: underline; color:#007af4;">https://www.olivevideoeditor.org/</span></a></p><p>Olive is a non-linear video editor. This software is free and protected by the GNU GPL.</p><p>Olive Team is obliged to inform users that Olive source code is available for download from its website.</p><p>Olive uses (at least) the following libraries in accordance with the GNU GPL/LGPL:</p><p>Qt, FFmpeg, libass, libfreetype, libmp3lame, libopenjpeg, libopus, libtheora, libtwolame, libvpx, libwavpack, libwebp, libx264, libx265, lzma, bzlib, zlib, libvidstab, libvorbis.</p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AboutDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AboutDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
+27
-8
@@ -1,14 +1,33 @@
|
||||
#include "demonotice.h"
|
||||
#include "ui_demonotice.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
DemoNotice::DemoNotice(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DemoNotice)
|
||||
QDialog(parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
setWindowTitle("Welcome to Olive!");
|
||||
setMaximumWidth(600);
|
||||
|
||||
DemoNotice::~DemoNotice()
|
||||
{
|
||||
delete ui;
|
||||
QVBoxLayout* vlayout = new QVBoxLayout();
|
||||
setLayout(vlayout);
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout();
|
||||
layout->setMargin(10);
|
||||
layout->setSpacing(20);
|
||||
|
||||
QLabel* icon = new QLabel("<html><head/><body><p><img src=\":/icons/olive-splash.png\"/></p></body></html>");
|
||||
layout->addWidget(icon);
|
||||
|
||||
QLabel* text = new QLabel("<html><head/><body><p><span style=\" font-size:14pt;\">Welcome to Olive!</span></p><p>Olive is a free open-source video editor released under the GNU GPL. If you have paid for this software, you have been scammed.</p><p>This software is currently in ALPHA which means it is unstable and very likely to crash, have bugs, and have missing features. We offer no warranty so use at your own risk. Please report any bugs or feature requests at <a href=\"https://olivevideoeditor.org/\"><span style=\" text-decoration: underline; color:#007af4;\">www.olivevideoeditor.org</span></a></p><p>Thank you for trying Olive and we hope you enjoy it!</p></body></html>");
|
||||
text->setWordWrap(true);
|
||||
layout->addWidget(text);
|
||||
|
||||
vlayout->addLayout(layout);
|
||||
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok, this);
|
||||
buttons->setCenterButtons(true);
|
||||
connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
vlayout->addWidget(buttons);
|
||||
}
|
||||
|
||||
@@ -3,20 +3,11 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class DemoNotice;
|
||||
}
|
||||
|
||||
class DemoNotice : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DemoNotice(QWidget *parent = 0);
|
||||
~DemoNotice();
|
||||
|
||||
private:
|
||||
Ui::DemoNotice *ui;
|
||||
};
|
||||
|
||||
#endif // DEMONOTICE_H
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DemoNotice</class>
|
||||
<widget class="QDialog" name="DemoNotice">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>511</width>
|
||||
<height>249</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Welcome</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><img src=":/icons/olive-splash.png"/></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:14pt;">Welcome to Olive!</span></p><p>Olive is a free open-source video editor released under the GNU GPL. If you have paid for this software, you have been scammed.</p><p>This software is currently in ALPHA which means it is unstable and very likely to crash, have bugs, and have missing features. We offer no warranty so use at your own risk. Please report any bugs or feature requests at <a href="https://olivevideoeditor.org/"><span style=" text-decoration: underline; color:#007af4;">www.olivevideoeditor.org</span></a></p><p>Thank you for trying Olive and we hope you enjoy it!</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DemoNotice</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DemoNotice</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
+307
-154
@@ -1,5 +1,4 @@
|
||||
#include "exportdialog.h"
|
||||
#include "ui_exportdialog.h"
|
||||
|
||||
#include <QOpenGLWidget>
|
||||
#include <QFileDialog>
|
||||
@@ -7,6 +6,14 @@
|
||||
#include <QMessageBox>
|
||||
#include <QOpenGLContext>
|
||||
#include <QtMath>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QGroupBox>
|
||||
#include <QComboBox>
|
||||
#include <QSpinBox>
|
||||
#include <QPushButton>
|
||||
#include <QProgressBar>
|
||||
|
||||
#include "debug.h"
|
||||
#include "panels/panels.h"
|
||||
@@ -48,15 +55,14 @@ enum ExportFormats {
|
||||
};
|
||||
|
||||
ExportDialog::ExportDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ExportDialog)
|
||||
QDialog(parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setup_ui();
|
||||
|
||||
ui->rangeCombobox->setCurrentIndex(0);
|
||||
rangeCombobox->setCurrentIndex(0);
|
||||
if (sequence->using_workarea) {
|
||||
ui->rangeCombobox->setEnabled(sequence->using_workarea);
|
||||
ui->rangeCombobox->setCurrentIndex(1);
|
||||
rangeCombobox->setEnabled(sequence->using_workarea);
|
||||
rangeCombobox->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
format_strings.resize(FORMAT_SIZE);
|
||||
@@ -83,27 +89,25 @@ ExportDialog::ExportDialog(QWidget *parent) :
|
||||
format_strings[FORMAT_WMV] = "Windows Media";
|
||||
|
||||
for (int i=0;i<FORMAT_SIZE;i++) {
|
||||
ui->formatCombobox->addItem(format_strings[i]);
|
||||
formatCombobox->addItem(format_strings[i]);
|
||||
}
|
||||
ui->formatCombobox->setCurrentIndex(FORMAT_MPEG4);
|
||||
formatCombobox->setCurrentIndex(FORMAT_MPEG4);
|
||||
|
||||
ui->widthSpinbox->setValue(sequence->width);
|
||||
ui->heightSpinbox->setValue(sequence->height);
|
||||
ui->samplingRateSpinbox->setValue(sequence->audio_frequency);
|
||||
ui->framerateSpinbox->setValue(sequence->frame_rate);
|
||||
widthSpinbox->setValue(sequence->width);
|
||||
heightSpinbox->setValue(sequence->height);
|
||||
samplingRateSpinbox->setValue(sequence->audio_frequency);
|
||||
framerateSpinbox->setValue(sequence->frame_rate);
|
||||
}
|
||||
|
||||
ExportDialog::~ExportDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
{}
|
||||
|
||||
void ExportDialog::on_formatCombobox_currentIndexChanged(int index)
|
||||
void ExportDialog::format_changed(int index)
|
||||
{
|
||||
format_vcodecs.clear();
|
||||
format_acodecs.clear();
|
||||
ui->vcodecCombobox->clear();
|
||||
ui->acodecCombobox->clear();
|
||||
vcodecCombobox->clear();
|
||||
acodecCombobox->clear();
|
||||
|
||||
int default_vcodec = 0;
|
||||
int default_acodec = 0;
|
||||
@@ -241,7 +245,7 @@ void ExportDialog::on_formatCombobox_currentIndexChanged(int index)
|
||||
format_acodecs.append(AV_CODEC_ID_OPUS);
|
||||
format_acodecs.append(AV_CODEC_ID_VORBIS);
|
||||
|
||||
default_acodec = 1;
|
||||
default_acodec = 1;
|
||||
break;
|
||||
case FORMAT_MOV:
|
||||
format_vcodecs.append(AV_CODEC_ID_QTRLE);
|
||||
@@ -288,60 +292,56 @@ void ExportDialog::on_formatCombobox_currentIndexChanged(int index)
|
||||
for (int i=0;i<format_vcodecs.size();i++) {
|
||||
codec_info = avcodec_find_encoder((enum AVCodecID) format_vcodecs.at(i));
|
||||
if (codec_info == NULL) {
|
||||
ui->vcodecCombobox->addItem("NULL");
|
||||
vcodecCombobox->addItem("NULL");
|
||||
} else {
|
||||
ui->vcodecCombobox->addItem(codec_info->long_name);
|
||||
vcodecCombobox->addItem(codec_info->long_name);
|
||||
}
|
||||
}
|
||||
for (int i=0;i<format_acodecs.size();i++) {
|
||||
codec_info = avcodec_find_encoder((enum AVCodecID) format_acodecs.at(i));
|
||||
if (codec_info == NULL) {
|
||||
ui->acodecCombobox->addItem("NULL");
|
||||
acodecCombobox->addItem("NULL");
|
||||
} else {
|
||||
ui->acodecCombobox->addItem(codec_info->long_name);
|
||||
acodecCombobox->addItem(codec_info->long_name);
|
||||
}
|
||||
}
|
||||
|
||||
ui->vcodecCombobox->setCurrentIndex(default_vcodec);
|
||||
ui->acodecCombobox->setCurrentIndex(default_acodec);
|
||||
vcodecCombobox->setCurrentIndex(default_vcodec);
|
||||
acodecCombobox->setCurrentIndex(default_acodec);
|
||||
|
||||
bool video_enabled = format_vcodecs.size() != 0;
|
||||
bool audio_enabled = format_acodecs.size() != 0;
|
||||
ui->videoGroupbox->setChecked(video_enabled);
|
||||
ui->audioGroupbox->setChecked(audio_enabled);
|
||||
ui->videoGroupbox->setEnabled(video_enabled);
|
||||
ui->audioGroupbox->setEnabled(audio_enabled);
|
||||
}
|
||||
|
||||
void ExportDialog::on_pushButton_2_clicked() {
|
||||
close();
|
||||
videoGroupbox->setChecked(video_enabled);
|
||||
audioGroupbox->setChecked(audio_enabled);
|
||||
videoGroupbox->setEnabled(video_enabled);
|
||||
audioGroupbox->setEnabled(audio_enabled);
|
||||
}
|
||||
|
||||
void ExportDialog::render_thread_finished() {
|
||||
if (ui->progressBar->value() < 100 && !cancelled) {
|
||||
QMessageBox::critical(this, "Export Failed", "Export failed - " + export_error, QMessageBox::Ok);
|
||||
}
|
||||
prep_ui_for_render(false);
|
||||
panel_sequence_viewer->viewer_widget->makeCurrent();
|
||||
panel_sequence_viewer->viewer_widget->initializeGL();
|
||||
update_ui(false);
|
||||
if (ui->progressBar->value() == 100) close();
|
||||
if (progressBar->value() < 100 && !cancelled) {
|
||||
QMessageBox::critical(this, "Export Failed", "Export failed - " + export_error, QMessageBox::Ok);
|
||||
}
|
||||
prep_ui_for_render(false);
|
||||
panel_sequence_viewer->viewer_widget->makeCurrent();
|
||||
panel_sequence_viewer->viewer_widget->initializeGL();
|
||||
update_ui(false);
|
||||
if (progressBar->value() == 100) accept();
|
||||
}
|
||||
|
||||
void ExportDialog::prep_ui_for_render(bool r) {
|
||||
ui->pushButton->setEnabled(!r);
|
||||
ui->pushButton_2->setEnabled(!r);
|
||||
ui->renderCancel->setEnabled(r);
|
||||
export_button->setEnabled(!r);
|
||||
cancel_button->setEnabled(!r);
|
||||
renderCancel->setEnabled(r);
|
||||
}
|
||||
|
||||
void ExportDialog::on_pushButton_clicked() {
|
||||
if (ui->widthSpinbox->value()%2 == 1 || ui->heightSpinbox->value()%2 == 1) {
|
||||
void ExportDialog::export_action() {
|
||||
if (widthSpinbox->value()%2 == 1 || heightSpinbox->value()%2 == 1) {
|
||||
QMessageBox::critical(this, "Invalid dimensions", "Export width and height must both be even numbers/divisible by 2.", QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
|
||||
QString ext;
|
||||
switch (ui->formatCombobox->currentIndex()) {
|
||||
switch (formatCombobox->currentIndex()) {
|
||||
case FORMAT_3GPP:
|
||||
ext = "3gp";
|
||||
break;
|
||||
@@ -366,57 +366,57 @@ void ExportDialog::on_pushButton_clicked() {
|
||||
case FORMAT_GIF:
|
||||
ext = "gif";
|
||||
break;
|
||||
case FORMAT_IMG:
|
||||
switch (format_vcodecs.at(ui->vcodecCombobox->currentIndex())) {
|
||||
case AV_CODEC_ID_BMP:
|
||||
ext = "bmp";
|
||||
break;
|
||||
case AV_CODEC_ID_MJPEG:
|
||||
ext = "jpg";
|
||||
break;
|
||||
case AV_CODEC_ID_JPEG2000:
|
||||
ext = "jp2";
|
||||
break;
|
||||
case AV_CODEC_ID_PSD:
|
||||
ext = "psd";
|
||||
break;
|
||||
case AV_CODEC_ID_PNG:
|
||||
ext = "png";
|
||||
break;
|
||||
case AV_CODEC_ID_TIFF:
|
||||
ext = "tif";
|
||||
break;
|
||||
default:
|
||||
case FORMAT_IMG:
|
||||
switch (format_vcodecs.at(vcodecCombobox->currentIndex())) {
|
||||
case AV_CODEC_ID_BMP:
|
||||
ext = "bmp";
|
||||
break;
|
||||
case AV_CODEC_ID_MJPEG:
|
||||
ext = "jpg";
|
||||
break;
|
||||
case AV_CODEC_ID_JPEG2000:
|
||||
ext = "jp2";
|
||||
break;
|
||||
case AV_CODEC_ID_PSD:
|
||||
ext = "psd";
|
||||
break;
|
||||
case AV_CODEC_ID_PNG:
|
||||
ext = "png";
|
||||
break;
|
||||
case AV_CODEC_ID_TIFF:
|
||||
ext = "tif";
|
||||
break;
|
||||
default:
|
||||
dout << "[ERROR] Invalid codec selection for an image sequence";
|
||||
QMessageBox::critical(this, "Invalid codec", "Couldn't determine output parameters for the selected codec. This is a bug, please contact the developers.", QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
QMessageBox::critical(this, "Invalid codec", "Couldn't determine output parameters for the selected codec. This is a bug, please contact the developers.", QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case FORMAT_MP3:
|
||||
ext = "mp3";
|
||||
break;
|
||||
case FORMAT_MPEG1:
|
||||
if (ui->videoGroupbox->isChecked() && !ui->audioGroupbox->isChecked()) {
|
||||
if (videoGroupbox->isChecked() && !audioGroupbox->isChecked()) {
|
||||
ext = "m1v";
|
||||
} else if (!ui->videoGroupbox->isChecked() && ui->audioGroupbox->isChecked()) {
|
||||
} else if (!videoGroupbox->isChecked() && audioGroupbox->isChecked()) {
|
||||
ext = "m1a";
|
||||
} else {
|
||||
ext = "mpg";
|
||||
}
|
||||
break;
|
||||
case FORMAT_MPEG2:
|
||||
if (ui->videoGroupbox->isChecked() && !ui->audioGroupbox->isChecked()) {
|
||||
if (videoGroupbox->isChecked() && !audioGroupbox->isChecked()) {
|
||||
ext = "m2v";
|
||||
} else if (!ui->videoGroupbox->isChecked() && ui->audioGroupbox->isChecked()) {
|
||||
} else if (!videoGroupbox->isChecked() && audioGroupbox->isChecked()) {
|
||||
ext = "m2a";
|
||||
} else {
|
||||
ext = "mpg";
|
||||
}
|
||||
break;
|
||||
case FORMAT_MPEG4:
|
||||
if (ui->videoGroupbox->isChecked() && !ui->audioGroupbox->isChecked()) {
|
||||
if (videoGroupbox->isChecked() && !audioGroupbox->isChecked()) {
|
||||
ext = "m4v";
|
||||
} else if (!ui->videoGroupbox->isChecked() && ui->audioGroupbox->isChecked()) {
|
||||
} else if (!videoGroupbox->isChecked() && audioGroupbox->isChecked()) {
|
||||
ext = "m4a";
|
||||
} else {
|
||||
ext = "mp4";
|
||||
@@ -426,7 +426,7 @@ void ExportDialog::on_pushButton_clicked() {
|
||||
ext = "ts";
|
||||
break;
|
||||
case FORMAT_MKV:
|
||||
if (!ui->videoGroupbox->isChecked()) {
|
||||
if (!videoGroupbox->isChecked()) {
|
||||
ext = "mka";
|
||||
} else {
|
||||
ext = "mkv";
|
||||
@@ -438,14 +438,14 @@ void ExportDialog::on_pushButton_clicked() {
|
||||
case FORMAT_MOV:
|
||||
ext = "mov";
|
||||
break;
|
||||
case FORMAT_WAV:
|
||||
ext = "wav";
|
||||
break;
|
||||
case FORMAT_WAV:
|
||||
ext = "wav";
|
||||
break;
|
||||
case FORMAT_WEBM:
|
||||
ext = "webm";
|
||||
break;
|
||||
case FORMAT_WMV:
|
||||
if (ui->videoGroupbox->isChecked()) {
|
||||
if (videoGroupbox->isChecked()) {
|
||||
ext = "wmv";
|
||||
} else {
|
||||
ext = "wma";
|
||||
@@ -453,66 +453,66 @@ void ExportDialog::on_pushButton_clicked() {
|
||||
break;
|
||||
default:
|
||||
dout << "[ERROR] Invalid format - this is a bug, please inform the developers";
|
||||
QMessageBox::critical(this, "Invalid format", "Couldn't determine output format. This is a bug, please contact the developers.", QMessageBox::Ok);
|
||||
QMessageBox::critical(this, "Invalid format", "Couldn't determine output format. This is a bug, please contact the developers.", QMessageBox::Ok);
|
||||
return;
|
||||
}
|
||||
QString filename = QFileDialog::getSaveFileName(this, "Export Media", "", format_strings[ui->formatCombobox->currentIndex()] + " (*." + ext + ")");
|
||||
QString filename = QFileDialog::getSaveFileName(this, "Export Media", "", format_strings[formatCombobox->currentIndex()] + " (*." + ext + ")");
|
||||
if (!filename.isEmpty()) {
|
||||
if (!filename.endsWith("." + ext, Qt::CaseInsensitive)) {
|
||||
filename += "." + ext;
|
||||
}
|
||||
if (!filename.endsWith("." + ext, Qt::CaseInsensitive)) {
|
||||
filename += "." + ext;
|
||||
}
|
||||
|
||||
if (ui->formatCombobox->currentIndex() == FORMAT_IMG) {
|
||||
int ext_location = filename.lastIndexOf('.');
|
||||
if (ext_location > filename.lastIndexOf('/')) {
|
||||
filename.insert(ext_location, 'd');
|
||||
filename.insert(ext_location, '5');
|
||||
filename.insert(ext_location, '0');
|
||||
filename.insert(ext_location, '%');
|
||||
}
|
||||
}
|
||||
if (formatCombobox->currentIndex() == FORMAT_IMG) {
|
||||
int ext_location = filename.lastIndexOf('.');
|
||||
if (ext_location > filename.lastIndexOf('/')) {
|
||||
filename.insert(ext_location, 'd');
|
||||
filename.insert(ext_location, '5');
|
||||
filename.insert(ext_location, '0');
|
||||
filename.insert(ext_location, '%');
|
||||
}
|
||||
}
|
||||
|
||||
et = new ExportThread();
|
||||
|
||||
connect(et, SIGNAL(finished()), et, SLOT(deleteLater()));
|
||||
connect(et, SIGNAL(finished()), this, SLOT(render_thread_finished()));
|
||||
connect(et, SIGNAL(progress_changed(int, qint64)), this, SLOT(update_progress_bar(int, qint64)));
|
||||
connect(et, SIGNAL(finished()), this, SLOT(render_thread_finished()));
|
||||
connect(et, SIGNAL(progress_changed(int, qint64)), this, SLOT(update_progress_bar(int, qint64)));
|
||||
|
||||
closeActiveClips(sequence, true);
|
||||
|
||||
mainWindow->autorecover_interval();
|
||||
mainWindow->autorecover_interval();
|
||||
|
||||
rendering = true;
|
||||
panel_sequence_viewer->viewer_widget->context()->doneCurrent();
|
||||
panel_sequence_viewer->viewer_widget->context()->moveToThread(et);
|
||||
|
||||
prep_ui_for_render(true);
|
||||
prep_ui_for_render(true);
|
||||
|
||||
et->filename = filename;
|
||||
et->video_enabled = ui->videoGroupbox->isChecked();
|
||||
if (et->video_enabled) {
|
||||
et->video_codec = format_vcodecs.at(ui->vcodecCombobox->currentIndex());
|
||||
et->video_width = ui->widthSpinbox->value();
|
||||
et->video_height = ui->heightSpinbox->value();
|
||||
et->video_frame_rate = ui->framerateSpinbox->value();
|
||||
et->video_compression_type = ui->compressionTypeCombobox->currentData().toInt();
|
||||
et->video_bitrate = ui->videobitrateSpinbox->value();
|
||||
}
|
||||
et->audio_enabled = ui->audioGroupbox->isChecked();
|
||||
if (et->audio_enabled) {
|
||||
et->audio_codec = format_acodecs.at(ui->acodecCombobox->currentIndex());
|
||||
et->audio_sampling_rate = ui->samplingRateSpinbox->value();
|
||||
et->audio_bitrate = ui->audiobitrateSpinbox->value();
|
||||
}
|
||||
et->video_enabled = videoGroupbox->isChecked();
|
||||
if (et->video_enabled) {
|
||||
et->video_codec = format_vcodecs.at(vcodecCombobox->currentIndex());
|
||||
et->video_width = widthSpinbox->value();
|
||||
et->video_height = heightSpinbox->value();
|
||||
et->video_frame_rate = framerateSpinbox->value();
|
||||
et->video_compression_type = compressionTypeCombobox->currentData().toInt();
|
||||
et->video_bitrate = videobitrateSpinbox->value();
|
||||
}
|
||||
et->audio_enabled = audioGroupbox->isChecked();
|
||||
if (et->audio_enabled) {
|
||||
et->audio_codec = format_acodecs.at(acodecCombobox->currentIndex());
|
||||
et->audio_sampling_rate = samplingRateSpinbox->value();
|
||||
et->audio_bitrate = audiobitrateSpinbox->value();
|
||||
}
|
||||
|
||||
et->start_frame = 0;
|
||||
et->end_frame = sequence->getEndFrame(); // entire sequence
|
||||
if (ui->rangeCombobox->currentIndex() == 1) {
|
||||
et->start_frame = qMax(sequence->workarea_in, et->start_frame);
|
||||
et->end_frame = qMin(sequence->workarea_out, et->end_frame);
|
||||
}
|
||||
et->start_frame = 0;
|
||||
et->end_frame = sequence->getEndFrame(); // entire sequence
|
||||
if (rangeCombobox->currentIndex() == 1) {
|
||||
et->start_frame = qMax(sequence->workarea_in, et->start_frame);
|
||||
et->end_frame = qMin(sequence->workarea_out, et->end_frame);
|
||||
}
|
||||
|
||||
et->ed = this;
|
||||
et->ed = this;
|
||||
cancelled = false;
|
||||
|
||||
et->start();
|
||||
@@ -520,54 +520,207 @@ void ExportDialog::on_pushButton_clicked() {
|
||||
}
|
||||
|
||||
void ExportDialog::update_progress_bar(int value, qint64 remaining_ms) {
|
||||
// convert ms to H:MM:SS
|
||||
int seconds = qFloor(remaining_ms*0.001)%60;
|
||||
int minutes = qFloor(remaining_ms/60000)%60;
|
||||
int hours = qFloor(remaining_ms/3600000);
|
||||
ui->progressBar->setFormat("%p% (ETA: " + QString::number(hours) + ":" + QString::number(minutes).rightJustified(2, '0') + ":" + QString::number(seconds).rightJustified(2, '0') + ")");
|
||||
// convert ms to H:MM:SS
|
||||
int seconds = qFloor(remaining_ms*0.001)%60;
|
||||
int minutes = qFloor(remaining_ms/60000)%60;
|
||||
int hours = qFloor(remaining_ms/3600000);
|
||||
progressBar->setFormat("%p% (ETA: " + QString::number(hours) + ":" + QString::number(minutes).rightJustified(2, '0') + ":" + QString::number(seconds).rightJustified(2, '0') + ")");
|
||||
|
||||
ui->progressBar->setValue(value);
|
||||
progressBar->setValue(value);
|
||||
}
|
||||
|
||||
void ExportDialog::on_renderCancel_clicked() {
|
||||
panel_sequence_viewer->viewer_widget->force_quit = true;
|
||||
void ExportDialog::cancel_render() {
|
||||
panel_sequence_viewer->viewer_widget->force_quit = true;
|
||||
et->continueEncode = false;
|
||||
cancelled = true;
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
void ExportDialog::on_vcodecCombobox_currentIndexChanged(int index) {
|
||||
ui->compressionTypeCombobox->clear();
|
||||
void ExportDialog::vcodec_changed(int index) {
|
||||
compressionTypeCombobox->clear();
|
||||
if ((format_vcodecs.size() > 0 && format_vcodecs.at(index) == AV_CODEC_ID_H264)) {
|
||||
ui->compressionTypeCombobox->setEnabled(true);
|
||||
ui->compressionTypeCombobox->addItem("Quality-based (Constant Rate Factor)", COMPRESSION_TYPE_CFR);
|
||||
// ui->compressionTypeCombobox->addItem("File size-based (Two-Pass)", COMPRESSION_TYPE_TARGETSIZE);
|
||||
// ui->compressionTypeCombobox->addItem("Average bitrate (Two-Pass)", COMPRESSION_TYPE_TARGETBR);
|
||||
compressionTypeCombobox->setEnabled(true);
|
||||
compressionTypeCombobox->addItem("Quality-based (Constant Rate Factor)", COMPRESSION_TYPE_CFR);
|
||||
// compressionTypeCombobox->addItem("File size-based (Two-Pass)", COMPRESSION_TYPE_TARGETSIZE);
|
||||
// compressionTypeCombobox->addItem("Average bitrate (Two-Pass)", COMPRESSION_TYPE_TARGETBR);
|
||||
} else {
|
||||
ui->compressionTypeCombobox->addItem("Constant Bitrate", COMPRESSION_TYPE_CBR);
|
||||
ui->compressionTypeCombobox->setCurrentIndex(0);
|
||||
ui->compressionTypeCombobox->setEnabled(false);
|
||||
compressionTypeCombobox->addItem("Constant Bitrate", COMPRESSION_TYPE_CBR);
|
||||
compressionTypeCombobox->setCurrentIndex(0);
|
||||
compressionTypeCombobox->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ExportDialog::on_compressionTypeCombobox_currentIndexChanged(int) {
|
||||
ui->videobitrateSpinbox->setToolTip("");
|
||||
ui->videobitrateSpinbox->setMinimum(0);
|
||||
ui->videobitrateSpinbox->setMaximum(99.99);
|
||||
switch (ui->compressionTypeCombobox->currentData().toInt()) {
|
||||
void ExportDialog::comp_type_changed(int) {
|
||||
videobitrateSpinbox->setToolTip("");
|
||||
videobitrateSpinbox->setMinimum(0);
|
||||
videobitrateSpinbox->setMaximum(99.99);
|
||||
switch (compressionTypeCombobox->currentData().toInt()) {
|
||||
case COMPRESSION_TYPE_CBR:
|
||||
case COMPRESSION_TYPE_TARGETBR:
|
||||
ui->videoBitrateLabel->setText("Bitrate (Mbps):");
|
||||
ui->videobitrateSpinbox->setValue(qMax(0.5, (double) qRound((0.01528 * sequence->height) - 4.5)));
|
||||
videoBitrateLabel->setText("Bitrate (Mbps):");
|
||||
videobitrateSpinbox->setValue(qMax(0.5, (double) qRound((0.01528 * sequence->height) - 4.5)));
|
||||
break;
|
||||
case COMPRESSION_TYPE_CFR:
|
||||
ui->videoBitrateLabel->setText("Quality (CRF):");
|
||||
ui->videobitrateSpinbox->setValue(36);
|
||||
ui->videobitrateSpinbox->setMaximum(51);
|
||||
ui->videobitrateSpinbox->setToolTip("Quality Factor:\n\n0 = lossless\n17-18 = visually lossless (compressed, but unnoticeable)\n23 = high quality\n51 = lowest quality possible");
|
||||
videoBitrateLabel->setText("Quality (CRF):");
|
||||
videobitrateSpinbox->setValue(36);
|
||||
videobitrateSpinbox->setMaximum(51);
|
||||
videobitrateSpinbox->setToolTip("Quality Factor:\n\n0 = lossless\n17-18 = visually lossless (compressed, but unnoticeable)\n23 = high quality\n51 = lowest quality possible");
|
||||
break;
|
||||
case COMPRESSION_TYPE_TARGETSIZE:
|
||||
ui->videoBitrateLabel->setText("Target File Size (MB):");
|
||||
ui->videobitrateSpinbox->setValue(100);
|
||||
videoBitrateLabel->setText("Target File Size (MB):");
|
||||
videobitrateSpinbox->setValue(100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ExportDialog::setup_ui() {
|
||||
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
|
||||
|
||||
QHBoxLayout* horizontalLayout = new QHBoxLayout();
|
||||
|
||||
horizontalLayout->addWidget(new QLabel("Format:"));
|
||||
|
||||
formatCombobox = new QComboBox(this);
|
||||
|
||||
horizontalLayout->addWidget(formatCombobox);
|
||||
|
||||
verticalLayout->addLayout(horizontalLayout);
|
||||
|
||||
QHBoxLayout* horizontalLayout_4 = new QHBoxLayout();
|
||||
|
||||
horizontalLayout_4->addWidget(new QLabel("Range:"));
|
||||
|
||||
rangeCombobox = new QComboBox(this);
|
||||
rangeCombobox->addItem("Entire Sequence");
|
||||
rangeCombobox->addItem("In to Out");
|
||||
|
||||
horizontalLayout_4->addWidget(rangeCombobox);
|
||||
|
||||
verticalLayout->addLayout(horizontalLayout_4);
|
||||
|
||||
videoGroupbox = new QGroupBox(this);
|
||||
videoGroupbox->setTitle("Video");
|
||||
videoGroupbox->setFlat(false);
|
||||
videoGroupbox->setCheckable(true);
|
||||
QGridLayout* gridLayout = new QGridLayout(videoGroupbox);
|
||||
|
||||
gridLayout->addWidget(new QLabel("Compression Type:"), 4, 0, 1, 1);
|
||||
|
||||
compressionTypeCombobox = new QComboBox(videoGroupbox);
|
||||
compressionTypeCombobox->addItem("Quality-based (Constant Rate Factor)");
|
||||
compressionTypeCombobox->addItem("File size-based (Two-Pass)");
|
||||
|
||||
gridLayout->addWidget(compressionTypeCombobox, 4, 1, 1, 1);
|
||||
|
||||
gridLayout->addWidget(new QLabel("Codec:"), 0, 0, 1, 1);
|
||||
|
||||
vcodecCombobox = new QComboBox(videoGroupbox);
|
||||
|
||||
gridLayout->addWidget(vcodecCombobox, 0, 1, 1, 1);
|
||||
|
||||
gridLayout->addWidget(new QLabel("Height:"), 2, 0, 1, 1);
|
||||
|
||||
gridLayout->addWidget(new QLabel("Width:"), 1, 0, 1, 1);
|
||||
|
||||
heightSpinbox = new QSpinBox(videoGroupbox);
|
||||
heightSpinbox->setMaximum(16777216);
|
||||
|
||||
gridLayout->addWidget(heightSpinbox, 2, 1, 1, 1);
|
||||
|
||||
widthSpinbox = new QSpinBox(videoGroupbox);
|
||||
widthSpinbox->setMaximum(16777216);
|
||||
|
||||
gridLayout->addWidget(widthSpinbox, 1, 1, 1, 1);
|
||||
|
||||
videobitrateSpinbox = new QDoubleSpinBox(videoGroupbox);
|
||||
videobitrateSpinbox->setMaximum(100);
|
||||
videobitrateSpinbox->setValue(2);
|
||||
|
||||
gridLayout->addWidget(videobitrateSpinbox, 5, 1, 1, 1);
|
||||
|
||||
videoBitrateLabel = new QLabel(videoGroupbox);
|
||||
|
||||
gridLayout->addWidget(videoBitrateLabel, 5, 0, 1, 1);
|
||||
|
||||
gridLayout->addWidget(new QLabel("Frame Rate:"), 3, 0, 1, 1);
|
||||
|
||||
framerateSpinbox = new QDoubleSpinBox(videoGroupbox);
|
||||
framerateSpinbox->setMaximum(60);
|
||||
framerateSpinbox->setValue(0);
|
||||
|
||||
gridLayout->addWidget(framerateSpinbox, 3, 1, 1, 1);
|
||||
|
||||
|
||||
verticalLayout->addWidget(videoGroupbox);
|
||||
|
||||
audioGroupbox = new QGroupBox(this);
|
||||
audioGroupbox->setTitle("Audio");
|
||||
audioGroupbox->setCheckable(true);
|
||||
|
||||
QGridLayout* gridLayout_2 = new QGridLayout(audioGroupbox);
|
||||
gridLayout_2->addWidget(new QLabel("Codec:"), 0, 0, 1, 1);
|
||||
|
||||
acodecCombobox = new QComboBox(audioGroupbox);
|
||||
|
||||
gridLayout_2->addWidget(acodecCombobox, 0, 1, 1, 1);
|
||||
|
||||
samplingRateSpinbox = new QSpinBox(audioGroupbox);
|
||||
samplingRateSpinbox->setMaximum(96000);
|
||||
samplingRateSpinbox->setValue(0);
|
||||
|
||||
gridLayout_2->addWidget(samplingRateSpinbox, 1, 1, 1, 1);
|
||||
|
||||
gridLayout_2->addWidget(new QLabel("Sampling Rate:"), 1, 0, 1, 1);
|
||||
|
||||
gridLayout_2->addWidget(new QLabel("Bitrate (Kbps/CBR):"), 3, 0, 1, 1);
|
||||
|
||||
audiobitrateSpinbox = new QSpinBox(audioGroupbox);
|
||||
audiobitrateSpinbox->setMaximum(320);
|
||||
audiobitrateSpinbox->setValue(256);
|
||||
|
||||
gridLayout_2->addWidget(audiobitrateSpinbox, 3, 1, 1, 1);
|
||||
|
||||
|
||||
verticalLayout->addWidget(audioGroupbox);
|
||||
|
||||
QHBoxLayout* horizontalLayout_3 = new QHBoxLayout();
|
||||
progressBar = new QProgressBar(this);
|
||||
progressBar->setFormat("%p% (ETA: 0:00:00)");
|
||||
progressBar->setEnabled(false);
|
||||
progressBar->setValue(0);
|
||||
|
||||
horizontalLayout_3->addWidget(progressBar);
|
||||
|
||||
renderCancel = new QPushButton(this);
|
||||
renderCancel->setText("x");
|
||||
renderCancel->setEnabled(false);
|
||||
renderCancel->setMaximumSize(QSize(20, 16777215));
|
||||
connect(renderCancel, SIGNAL(clicked(bool)), this, SLOT(cancel_render()));
|
||||
|
||||
horizontalLayout_3->addWidget(renderCancel);
|
||||
|
||||
|
||||
verticalLayout->addLayout(horizontalLayout_3);
|
||||
|
||||
QHBoxLayout* horizontalLayout_2 = new QHBoxLayout();
|
||||
horizontalLayout_2->addStretch();
|
||||
|
||||
export_button = new QPushButton(this);
|
||||
export_button->setText("Export");
|
||||
connect(export_button, SIGNAL(clicked(bool)), this, SLOT(export_action()));
|
||||
|
||||
horizontalLayout_2->addWidget(export_button);
|
||||
|
||||
cancel_button = new QPushButton(this);
|
||||
cancel_button->setText("Cancel");
|
||||
connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(reject()));
|
||||
|
||||
horizontalLayout_2->addWidget(cancel_button);
|
||||
|
||||
horizontalLayout_2->addStretch();
|
||||
|
||||
verticalLayout->addLayout(horizontalLayout_2);
|
||||
|
||||
connect(formatCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(format_changed(int)));
|
||||
connect(compressionTypeCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(comp_type_changed(int)));
|
||||
connect(vcodecCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(vcodec_changed(int)));
|
||||
}
|
||||
|
||||
+37
-25
@@ -3,48 +3,60 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class ExportDialog;
|
||||
}
|
||||
|
||||
struct Sequence;
|
||||
class ExportThread;
|
||||
class QComboBox;
|
||||
class QSpinBox;
|
||||
class QDoubleSpinBox;
|
||||
class QLabel;
|
||||
class QProgressBar;
|
||||
class QGroupBox;
|
||||
|
||||
class ExportDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ExportDialog(QWidget *parent = 0);
|
||||
~ExportDialog();
|
||||
QString export_error;
|
||||
~ExportDialog();
|
||||
QString export_error;
|
||||
|
||||
private slots:
|
||||
void on_formatCombobox_currentIndexChanged(int index);
|
||||
|
||||
void on_pushButton_2_clicked();
|
||||
|
||||
void on_pushButton_clicked();
|
||||
|
||||
void update_progress_bar(int value, qint64 remaining_ms);
|
||||
|
||||
void on_renderCancel_clicked();
|
||||
|
||||
void render_thread_finished();
|
||||
|
||||
void on_vcodecCombobox_currentIndexChanged(int index);
|
||||
|
||||
void on_compressionTypeCombobox_currentIndexChanged(int index);
|
||||
void format_changed(int index);
|
||||
void export_action();
|
||||
void update_progress_bar(int value, qint64 remaining_ms);
|
||||
void cancel_render();
|
||||
void render_thread_finished();
|
||||
void vcodec_changed(int index);
|
||||
void comp_type_changed(int index);
|
||||
|
||||
private:
|
||||
Ui::ExportDialog *ui;
|
||||
|
||||
QVector<QString> format_strings;
|
||||
QVector<int> format_vcodecs;
|
||||
QVector<int> format_acodecs;
|
||||
void setup_ui();
|
||||
|
||||
ExportThread* et;
|
||||
ExportThread* et;
|
||||
void prep_ui_for_render(bool r);
|
||||
bool cancelled;
|
||||
bool cancelled;
|
||||
|
||||
QComboBox* rangeCombobox;
|
||||
QSpinBox* widthSpinbox;
|
||||
QDoubleSpinBox* videobitrateSpinbox;
|
||||
QLabel* videoBitrateLabel;
|
||||
QDoubleSpinBox* framerateSpinbox;
|
||||
QComboBox* vcodecCombobox;
|
||||
QComboBox* acodecCombobox;
|
||||
QSpinBox* samplingRateSpinbox;
|
||||
QSpinBox* audiobitrateSpinbox;
|
||||
QProgressBar* progressBar;
|
||||
QComboBox* formatCombobox;
|
||||
QSpinBox* heightSpinbox;
|
||||
QPushButton* export_button;
|
||||
QPushButton* cancel_button;
|
||||
QPushButton* renderCancel;
|
||||
QGroupBox* videoGroupbox;
|
||||
QGroupBox* audioGroupbox;
|
||||
QComboBox* compressionTypeCombobox;
|
||||
};
|
||||
|
||||
#endif // EXPORTDIALOG_H
|
||||
|
||||
@@ -1,317 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ExportDialog</class>
|
||||
<widget class="QDialog" name="ExportDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>443</width>
|
||||
<height>562</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Export</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Format: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="formatCombobox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Range:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="rangeCombobox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Entire Sequence</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>In to Out</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="videoGroupbox">
|
||||
<property name="title">
|
||||
<string>Video</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="compressionTypeLabel">
|
||||
<property name="text">
|
||||
<string>Compression Type:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="compressionTypeCombobox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Quality-based (Constant Rate Factor)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>File size-based (Two-Pass)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Codec:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="vcodecCombobox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Width:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="heightSpinbox">
|
||||
<property name="maximum">
|
||||
<number>16777216</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="widthSpinbox">
|
||||
<property name="maximum">
|
||||
<number>16777216</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QDoubleSpinBox" name="videobitrateSpinbox">
|
||||
<property name="maximum">
|
||||
<double>100.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>2.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="videoBitrateLabel">
|
||||
<property name="text">
|
||||
<string>Bitrate (Mbps):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Frame Rate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="framerateSpinbox">
|
||||
<property name="maximum">
|
||||
<double>60.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="audioGroupbox">
|
||||
<property name="title">
|
||||
<string>Audio</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Codec:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="acodecCombobox"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="samplingRateSpinbox">
|
||||
<property name="maximum">
|
||||
<number>96000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Sampling Rate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Bitrate (Kbps/CBR):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="audiobitrateSpinbox">
|
||||
<property name="maximum">
|
||||
<number>320</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>256</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string>%p% (ETA: 0:00:00)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="renderCancel">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>x</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Export</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>formatCombobox</tabstop>
|
||||
<tabstop>videoGroupbox</tabstop>
|
||||
<tabstop>vcodecCombobox</tabstop>
|
||||
<tabstop>widthSpinbox</tabstop>
|
||||
<tabstop>heightSpinbox</tabstop>
|
||||
<tabstop>framerateSpinbox</tabstop>
|
||||
<tabstop>videobitrateSpinbox</tabstop>
|
||||
<tabstop>audioGroupbox</tabstop>
|
||||
<tabstop>acodecCombobox</tabstop>
|
||||
<tabstop>samplingRateSpinbox</tabstop>
|
||||
<tabstop>audiobitrateSpinbox</tabstop>
|
||||
<tabstop>renderCancel</tabstop>
|
||||
<tabstop>pushButton</tabstop>
|
||||
<tabstop>pushButton_2</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+14
-13
@@ -14,39 +14,40 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
LoadDialog::LoadDialog(QWidget *parent, bool autorecovery) : QDialog(parent) {
|
||||
setWindowTitle("Loading...");
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
setLayout(layout);
|
||||
|
||||
layout->addWidget(new QLabel("Loading '" + project_url.mid(project_url.lastIndexOf('/')+1) + "'..."));
|
||||
layout->addWidget(new QLabel("Loading '" + project_url.mid(project_url.lastIndexOf('/')+1) + "'..."));
|
||||
|
||||
bar = new QProgressBar();
|
||||
bar->setValue(0);
|
||||
bar->setValue(0);
|
||||
layout->addWidget(bar);
|
||||
|
||||
cancel_button = new QPushButton("Cancel");
|
||||
connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(cancel()));
|
||||
cancel_button = new QPushButton("Cancel");
|
||||
connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(cancel()));
|
||||
|
||||
hboxLayout = new QHBoxLayout();
|
||||
hboxLayout = new QHBoxLayout();
|
||||
hboxLayout->addStretch();
|
||||
hboxLayout->addWidget(cancel_button);
|
||||
hboxLayout->addStretch();
|
||||
|
||||
layout->addLayout(hboxLayout);
|
||||
|
||||
update();
|
||||
update();
|
||||
|
||||
lt = new LoadThread(this, autorecovery);
|
||||
QObject::connect(lt, SIGNAL(success()), this, SLOT(thread_done()));
|
||||
lt = new LoadThread(this, autorecovery);
|
||||
QObject::connect(lt, SIGNAL(success()), this, SLOT(thread_done()));
|
||||
QObject::connect(lt, SIGNAL(error()), this, SLOT(die()));
|
||||
QObject::connect(lt, SIGNAL(report_progress(int)), bar, SLOT(setValue(int)));
|
||||
lt->start();
|
||||
QObject::connect(lt, SIGNAL(report_progress(int)), bar, SLOT(setValue(int)));
|
||||
lt->start();
|
||||
}
|
||||
|
||||
void LoadDialog::cancel() {
|
||||
lt->cancel();
|
||||
lt->wait();
|
||||
lt->cancel();
|
||||
lt->wait();
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -56,5 +57,5 @@ void LoadDialog::die() {
|
||||
}
|
||||
|
||||
void LoadDialog::thread_done() {
|
||||
accept();
|
||||
accept();
|
||||
}
|
||||
|
||||
+200
-81
@@ -1,5 +1,4 @@
|
||||
#include "newsequencedialog.h"
|
||||
#include "ui_newsequencedialog.h"
|
||||
|
||||
#include "panels/panels.h"
|
||||
#include "panels/project.h"
|
||||
@@ -8,82 +7,70 @@
|
||||
#include "project/clip.h"
|
||||
#include "panels/timeline.h"
|
||||
#include "playback/playback.h"
|
||||
#include "project/media.h"
|
||||
|
||||
#include <QVariant>
|
||||
#include <QVBoxLayout>
|
||||
#include <QComboBox>
|
||||
#include <QGroupBox>
|
||||
#include <QGridLayout>
|
||||
#include <QSpinBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
}
|
||||
|
||||
NewSequenceDialog::NewSequenceDialog(QWidget *parent) :
|
||||
NewSequenceDialog::NewSequenceDialog(QWidget *parent, Media *existing) :
|
||||
QDialog(parent),
|
||||
existing_sequence(NULL),
|
||||
ui(new Ui::NewSequenceDialog)
|
||||
existing_item(existing)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setup_ui();
|
||||
|
||||
ui->frame_rate_combobox->addItem("10 FPS", 10.0);
|
||||
ui->frame_rate_combobox->addItem("12.5 FPS", 12.5);
|
||||
ui->frame_rate_combobox->addItem("15 FPS", 15.0);
|
||||
ui->frame_rate_combobox->addItem("23.976 FPS", 23.976);
|
||||
ui->frame_rate_combobox->addItem("24 FPS", 24.0);
|
||||
ui->frame_rate_combobox->addItem("25 FPS", 25.0);
|
||||
ui->frame_rate_combobox->addItem("29.97 FPS", 29.97);
|
||||
ui->frame_rate_combobox->addItem("30 FPS", 30.0);
|
||||
ui->frame_rate_combobox->addItem("50 FPS", 50.0);
|
||||
ui->frame_rate_combobox->addItem("59.94 FPS", 59.94);
|
||||
ui->frame_rate_combobox->addItem("60 FPS", 60.0);
|
||||
ui->frame_rate_combobox->setCurrentIndex(6);
|
||||
if (existing != NULL) {
|
||||
existing_sequence = existing->to_sequence();
|
||||
setWindowTitle("Editing \"" + existing_sequence->name + "\"");
|
||||
|
||||
ui->audio_frequency_combobox->addItem("22050 Hz", 22050);
|
||||
ui->audio_frequency_combobox->addItem("24000 Hz", 24000);
|
||||
ui->audio_frequency_combobox->addItem("32000 Hz", 32000);
|
||||
ui->audio_frequency_combobox->addItem("44100 Hz", 44100);
|
||||
ui->audio_frequency_combobox->addItem("48000 Hz", 48000);
|
||||
ui->audio_frequency_combobox->addItem("88200 Hz", 88200);
|
||||
ui->audio_frequency_combobox->addItem("96000 Hz", 96000);
|
||||
ui->audio_frequency_combobox->setCurrentIndex(4);
|
||||
}
|
||||
|
||||
NewSequenceDialog::~NewSequenceDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void NewSequenceDialog::set_sequence_name(const QString& s) {
|
||||
ui->lineEdit->setText(s);
|
||||
}
|
||||
|
||||
void NewSequenceDialog::showEvent(QShowEvent *) {
|
||||
if (existing_sequence != NULL) {
|
||||
ui->width_numeric->setValue(existing_sequence->width);
|
||||
ui->height_numeric->setValue(existing_sequence->height);
|
||||
width_numeric->setValue(existing_sequence->width);
|
||||
height_numeric->setValue(existing_sequence->height);
|
||||
int comp_rate = qRound(existing_sequence->frame_rate*100);
|
||||
for (int i=0;i<ui->frame_rate_combobox->count();i++) {
|
||||
if (qRound(ui->frame_rate_combobox->itemData(i).toDouble()*100) == comp_rate) {
|
||||
ui->frame_rate_combobox->setCurrentIndex(i);
|
||||
for (int i=0;i<frame_rate_combobox->count();i++) {
|
||||
if (qRound(frame_rate_combobox->itemData(i).toDouble()*100) == comp_rate) {
|
||||
frame_rate_combobox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ui->lineEdit->setText(existing_sequence->name);
|
||||
for (int i=0;i<ui->audio_frequency_combobox->count();i++) {
|
||||
if (ui->audio_frequency_combobox->itemData(i) == existing_sequence->audio_frequency) {
|
||||
ui->audio_frequency_combobox->setCurrentIndex(i);
|
||||
lineEdit->setText(existing_sequence->name);
|
||||
for (int i=0;i<audio_frequency_combobox->count();i++) {
|
||||
if (audio_frequency_combobox->itemData(i) == existing_sequence->audio_frequency) {
|
||||
audio_frequency_combobox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
existing_sequence = NULL;
|
||||
setWindowTitle("New Sequence");
|
||||
}
|
||||
}
|
||||
|
||||
void NewSequenceDialog::on_buttonBox_accepted() {
|
||||
NewSequenceDialog::~NewSequenceDialog()
|
||||
{}
|
||||
|
||||
void NewSequenceDialog::set_sequence_name(const QString& s) {
|
||||
lineEdit->setText(s);
|
||||
}
|
||||
|
||||
void NewSequenceDialog::create() {
|
||||
if (existing_sequence == NULL) {
|
||||
Sequence* s = new Sequence();
|
||||
|
||||
s->name = ui->lineEdit->text();
|
||||
s->width = ui->width_numeric->value();
|
||||
s->height = ui->height_numeric->value();
|
||||
s->frame_rate = ui->frame_rate_combobox->currentData().toDouble();
|
||||
s->audio_frequency = ui->audio_frequency_combobox->currentData().toInt();
|
||||
s->name = lineEdit->text();
|
||||
s->width = width_numeric->value();
|
||||
s->height = height_numeric->value();
|
||||
s->frame_rate = frame_rate_combobox->currentData().toDouble();
|
||||
s->audio_frequency = audio_frequency_combobox->currentData().toInt();
|
||||
s->audio_layout = AV_CH_LAYOUT_STEREO;
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
@@ -92,14 +79,14 @@ void NewSequenceDialog::on_buttonBox_accepted() {
|
||||
} else {
|
||||
ComboAction* ca = new ComboAction();
|
||||
|
||||
double multiplier = ui->frame_rate_combobox->currentData().toDouble() / existing_sequence->frame_rate;
|
||||
double multiplier = frame_rate_combobox->currentData().toDouble() / existing_sequence->frame_rate;
|
||||
|
||||
EditSequenceCommand* esc = new EditSequenceCommand(existing_item, existing_sequence);
|
||||
esc->name = ui->lineEdit->text();
|
||||
esc->width = ui->width_numeric->value();
|
||||
esc->height = ui->height_numeric->value();
|
||||
esc->frame_rate = ui->frame_rate_combobox->currentData().toDouble();
|
||||
esc->audio_frequency = ui->audio_frequency_combobox->currentData().toInt();
|
||||
esc->name = lineEdit->text();
|
||||
esc->width = width_numeric->value();
|
||||
esc->height = height_numeric->value();
|
||||
esc->frame_rate = frame_rate_combobox->currentData().toDouble();
|
||||
esc->audio_frequency = audio_frequency_combobox->currentData().toInt();
|
||||
esc->audio_layout = AV_CH_LAYOUT_STEREO;
|
||||
ca->append(esc);
|
||||
|
||||
@@ -112,51 +99,183 @@ void NewSequenceDialog::on_buttonBox_accepted() {
|
||||
|
||||
undo_stack.push(ca);
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
void NewSequenceDialog::on_comboBox_currentIndexChanged(int index)
|
||||
void NewSequenceDialog::preset_changed(int index)
|
||||
{
|
||||
switch (index) {
|
||||
case 0: // FILM 4K
|
||||
ui->width_numeric->setValue(4096);
|
||||
ui->height_numeric->setValue(2160);
|
||||
|
||||
width_numeric->setValue(4096);
|
||||
height_numeric->setValue(2160);
|
||||
break;
|
||||
case 1: // TV 4K
|
||||
ui->width_numeric->setValue(3840);
|
||||
ui->height_numeric->setValue(2160);
|
||||
width_numeric->setValue(3840);
|
||||
height_numeric->setValue(2160);
|
||||
break;
|
||||
case 2: // 1080p
|
||||
ui->width_numeric->setValue(1920);
|
||||
ui->height_numeric->setValue(1080);
|
||||
width_numeric->setValue(1920);
|
||||
height_numeric->setValue(1080);
|
||||
break;
|
||||
case 3: // 720p
|
||||
ui->width_numeric->setValue(1280);
|
||||
ui->height_numeric->setValue(720);
|
||||
width_numeric->setValue(1280);
|
||||
height_numeric->setValue(720);
|
||||
break;
|
||||
case 4: // 480p
|
||||
ui->width_numeric->setValue(640);
|
||||
ui->height_numeric->setValue(480);
|
||||
width_numeric->setValue(640);
|
||||
height_numeric->setValue(480);
|
||||
break;
|
||||
case 5: // 360p
|
||||
ui->width_numeric->setValue(640);
|
||||
ui->height_numeric->setValue(360);
|
||||
width_numeric->setValue(640);
|
||||
height_numeric->setValue(360);
|
||||
break;
|
||||
case 6: // 240p
|
||||
ui->width_numeric->setValue(320);
|
||||
ui->height_numeric->setValue(240);
|
||||
width_numeric->setValue(320);
|
||||
height_numeric->setValue(240);
|
||||
break;
|
||||
case 7: // 144p
|
||||
ui->width_numeric->setValue(192);
|
||||
ui->height_numeric->setValue(144);
|
||||
width_numeric->setValue(192);
|
||||
height_numeric->setValue(144);
|
||||
break;
|
||||
case 8: // NTSC (480i)
|
||||
ui->width_numeric->setValue(720);
|
||||
ui->height_numeric->setValue(480);
|
||||
width_numeric->setValue(720);
|
||||
height_numeric->setValue(480);
|
||||
break;
|
||||
case 9: // PAL (576i)
|
||||
ui->width_numeric->setValue(720);
|
||||
ui->height_numeric->setValue(576);
|
||||
width_numeric->setValue(720);
|
||||
height_numeric->setValue(576);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void NewSequenceDialog::setup_ui() {
|
||||
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
|
||||
|
||||
QWidget* widget = new QWidget(this);
|
||||
|
||||
QHBoxLayout* horizontalLayout_2 = new QHBoxLayout(widget);
|
||||
horizontalLayout_2->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
horizontalLayout_2->addWidget(new QLabel("Preset:"));
|
||||
|
||||
preset_combobox = new QComboBox(widget);
|
||||
|
||||
preset_combobox->addItem("Film 4K");
|
||||
preset_combobox->addItem("TV 4K (Ultra HD/2160p)");
|
||||
preset_combobox->addItem("1080p");
|
||||
preset_combobox->addItem("720p");
|
||||
preset_combobox->addItem("480p");
|
||||
preset_combobox->addItem("360p");
|
||||
preset_combobox->addItem("240p");
|
||||
preset_combobox->addItem("144p");
|
||||
preset_combobox->addItem("NTSC (480i)");
|
||||
preset_combobox->addItem("PAL (576i)");
|
||||
preset_combobox->addItem("Custom");
|
||||
preset_combobox->setCurrentIndex(2);
|
||||
|
||||
horizontalLayout_2->addWidget(preset_combobox);
|
||||
|
||||
verticalLayout->addWidget(widget);
|
||||
|
||||
QGroupBox* groupBox = new QGroupBox(this);
|
||||
groupBox->setTitle("Video");
|
||||
|
||||
QGridLayout* gridLayout = new QGridLayout(groupBox);
|
||||
|
||||
height_numeric = new QSpinBox(groupBox);
|
||||
height_numeric->setMaximum(9999);
|
||||
height_numeric->setValue(1080);
|
||||
|
||||
gridLayout->addWidget(height_numeric, 1, 2, 1, 2);
|
||||
|
||||
width_numeric = new QSpinBox(groupBox);
|
||||
width_numeric->setMaximum(9999);
|
||||
width_numeric->setValue(1920);
|
||||
|
||||
gridLayout->addWidget(width_numeric, 0, 2, 1, 2);
|
||||
|
||||
gridLayout->addWidget(new QLabel("Width:"), 0, 0, 1, 1);
|
||||
|
||||
gridLayout->addWidget(new QLabel("Pixel Aspect Ratio:"), 4, 0, 1, 1);
|
||||
|
||||
gridLayout->addWidget(new QLabel("Interlacing:"), 6, 0, 1, 1);
|
||||
|
||||
gridLayout->addWidget(new QLabel("Height:"), 1, 0, 1, 2);
|
||||
|
||||
par_combobox = new QComboBox(groupBox);
|
||||
par_combobox->addItem("Square Pixels (1.0)");
|
||||
|
||||
gridLayout->addWidget(par_combobox, 4, 2, 1, 2);
|
||||
|
||||
interlacing_combobox = new QComboBox(groupBox);
|
||||
interlacing_combobox->addItem("None (Progressive)");
|
||||
interlacing_combobox->addItem("Upper Field First");
|
||||
interlacing_combobox->addItem("Lower Field First");
|
||||
|
||||
gridLayout->addWidget(interlacing_combobox, 6, 2, 1, 2);
|
||||
|
||||
frame_rate_combobox = new QComboBox(groupBox);
|
||||
frame_rate_combobox->addItem("10 FPS", 10.0);
|
||||
frame_rate_combobox->addItem("12.5 FPS", 12.5);
|
||||
frame_rate_combobox->addItem("15 FPS", 15.0);
|
||||
frame_rate_combobox->addItem("23.976 FPS", 23.976);
|
||||
frame_rate_combobox->addItem("24 FPS", 24.0);
|
||||
frame_rate_combobox->addItem("25 FPS", 25.0);
|
||||
frame_rate_combobox->addItem("29.97 FPS", 29.97);
|
||||
frame_rate_combobox->addItem("30 FPS", 30.0);
|
||||
frame_rate_combobox->addItem("50 FPS", 50.0);
|
||||
frame_rate_combobox->addItem("59.94 FPS", 59.94);
|
||||
frame_rate_combobox->addItem("60 FPS", 60.0);
|
||||
frame_rate_combobox->setCurrentIndex(6);
|
||||
|
||||
gridLayout->addWidget(frame_rate_combobox, 2, 2, 1, 2);
|
||||
|
||||
gridLayout->addWidget(new QLabel("Frame Rate:"), 2, 0, 1, 1);
|
||||
|
||||
verticalLayout->addWidget(groupBox);
|
||||
|
||||
QGroupBox* groupBox_2 = new QGroupBox(this);
|
||||
groupBox_2->setTitle("Audio");
|
||||
|
||||
QGridLayout* gridLayout_2 = new QGridLayout(groupBox_2);
|
||||
|
||||
gridLayout_2->addWidget(new QLabel("Sample Rate: "), 0, 0, 1, 1);
|
||||
|
||||
audio_frequency_combobox = new QComboBox(groupBox_2);
|
||||
audio_frequency_combobox->addItem("22050 Hz", 22050);
|
||||
audio_frequency_combobox->addItem("24000 Hz", 24000);
|
||||
audio_frequency_combobox->addItem("32000 Hz", 32000);
|
||||
audio_frequency_combobox->addItem("44100 Hz", 44100);
|
||||
audio_frequency_combobox->addItem("48000 Hz", 48000);
|
||||
audio_frequency_combobox->addItem("88200 Hz", 88200);
|
||||
audio_frequency_combobox->addItem("96000 Hz", 96000);
|
||||
audio_frequency_combobox->setCurrentIndex(4);
|
||||
|
||||
gridLayout_2->addWidget(audio_frequency_combobox, 0, 1, 1, 1);
|
||||
|
||||
verticalLayout->addWidget(groupBox_2);
|
||||
|
||||
QWidget* widget_2 = new QWidget(this);
|
||||
QHBoxLayout* horizontalLayout = new QHBoxLayout(widget_2);
|
||||
horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
horizontalLayout->addWidget(new QLabel("Name:"));
|
||||
|
||||
lineEdit = new QLineEdit(widget_2);
|
||||
|
||||
horizontalLayout->addWidget(lineEdit);
|
||||
|
||||
verticalLayout->addWidget(widget_2);
|
||||
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setOrientation(Qt::Horizontal);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
buttonBox->setCenterButtons(true);
|
||||
|
||||
verticalLayout->addWidget(buttonBox);
|
||||
|
||||
connect(preset_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(preset_changed(int)));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(create()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
+20
-13
@@ -5,32 +5,39 @@
|
||||
|
||||
class Project;
|
||||
class Media;
|
||||
class QComboBox;
|
||||
class QSpinBox;
|
||||
class QLineEdit;
|
||||
struct Sequence;
|
||||
|
||||
namespace Ui {
|
||||
class NewSequenceDialog;
|
||||
}
|
||||
|
||||
class NewSequenceDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NewSequenceDialog(QWidget *parent = 0);
|
||||
explicit NewSequenceDialog(QWidget *parent = 0, Media* existing = 0);
|
||||
~NewSequenceDialog();
|
||||
Sequence* existing_sequence;
|
||||
Media* existing_item;
|
||||
|
||||
void set_sequence_name(const QString& s);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *);
|
||||
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
void on_comboBox_currentIndexChanged(int index);
|
||||
void create();
|
||||
void preset_changed(int index);
|
||||
|
||||
private:
|
||||
Ui::NewSequenceDialog *ui;
|
||||
Sequence* existing_sequence;
|
||||
Media* existing_item;
|
||||
|
||||
void setup_ui();
|
||||
|
||||
QComboBox* preset_combobox;
|
||||
QSpinBox* height_numeric;
|
||||
QSpinBox* width_numeric;
|
||||
QComboBox* par_combobox;
|
||||
QComboBox* interlacing_combobox;
|
||||
QComboBox* frame_rate_combobox;
|
||||
QComboBox* audio_frequency_combobox;
|
||||
QLineEdit* lineEdit;
|
||||
};
|
||||
|
||||
#endif // NEWSEQUENCEDIALOG_H
|
||||
|
||||
@@ -1,370 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NewSequenceDialog</class>
|
||||
<widget class="QDialog" name="NewSequenceDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>298</width>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>New Sequence</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Preset: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Film 4K</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>TV 4K (Ultra HD/2160p)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1080p</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>720p</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>480p</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>360p</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>240p</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>144p</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>NTSC (480i)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>PAL (576i)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Video</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="height_numeric">
|
||||
<property name="maximum">
|
||||
<number>9999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1080</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" colspan="2">
|
||||
<widget class="QSpinBox" name="width_numeric">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>9999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1920</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Width: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pixel Aspect Ratio: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Interlacing:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Height: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="par_combobox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Square Pixels (1.0)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="interlacing_combobox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None (Progressive)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Upper Field First</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Lower Field First</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="2">
|
||||
<widget class="QComboBox" name="frame_rate_combobox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Frame Rate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Audio</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sample Rate: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="audio_frequency_combobox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Name: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<property name="text">
|
||||
<string>Sequence 01</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>comboBox</tabstop>
|
||||
<tabstop>width_numeric</tabstop>
|
||||
<tabstop>height_numeric</tabstop>
|
||||
<tabstop>frame_rate_combobox</tabstop>
|
||||
<tabstop>par_combobox</tabstop>
|
||||
<tabstop>interlacing_combobox</tabstop>
|
||||
<tabstop>audio_frequency_combobox</tabstop>
|
||||
<tabstop>lineEdit</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>NewSequenceDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>NewSequenceDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
+137
-57
@@ -1,83 +1,163 @@
|
||||
#include "preferencesdialog.h"
|
||||
#include "ui_preferencesdialog.h"
|
||||
|
||||
#include "io/config.h"
|
||||
|
||||
#include <QMenuBar>
|
||||
#include <QAction>
|
||||
#include <QVBoxLayout>
|
||||
#include <QTabWidget>
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include <QGroupBox>
|
||||
#include <QRadioButton>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QTreeWidget>
|
||||
#include <QVector>
|
||||
|
||||
KeySequenceEditor::KeySequenceEditor(QAction* a)
|
||||
: QKeySequenceEdit(0), action(a) {
|
||||
setKeySequence(action->shortcut());
|
||||
connect(this, SIGNAL(editingFinished()), this, SLOT(set_action_shortcut()));
|
||||
KeySequenceEditor::KeySequenceEditor(QWidget* parent, QAction* a)
|
||||
: QKeySequenceEdit(parent), action(a) {
|
||||
setKeySequence(action->shortcut());
|
||||
//connect(this, SIGNAL(editingFinished()), this, SLOT(set_action_shortcut()));
|
||||
}
|
||||
|
||||
void KeySequenceEditor::set_action_shortcut() {
|
||||
action->setShortcut(keySequence());
|
||||
action->setShortcut(keySequence());
|
||||
}
|
||||
|
||||
PreferencesDialog::PreferencesDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::PreferencesDialog)
|
||||
QDialog(parent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowTitle("Preferences");
|
||||
setup_ui();
|
||||
|
||||
ui->accurateSeekButton->setChecked(!config.fast_seeking);
|
||||
ui->fastSeekButton->setChecked(config.fast_seeking);
|
||||
ui->recordingComboBox->setCurrentIndex(config.recording_mode - 1);
|
||||
ui->imgSeqFormatEdit->setText(config.img_seq_formats);
|
||||
accurateSeekButton->setChecked(!config.fast_seeking);
|
||||
fastSeekButton->setChecked(config.fast_seeking);
|
||||
recordingComboBox->setCurrentIndex(config.recording_mode - 1);
|
||||
imgSeqFormatEdit->setText(config.img_seq_formats);
|
||||
}
|
||||
|
||||
PreferencesDialog::~PreferencesDialog() {
|
||||
delete ui;
|
||||
PreferencesDialog::~PreferencesDialog() {}
|
||||
|
||||
void PreferencesDialog::setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem* parent) {
|
||||
QList<QAction*> actions = menu->actions();
|
||||
for (int i=0;i<actions.size();i++) {
|
||||
QAction* a = actions.at(i);
|
||||
|
||||
if (!a->isSeparator()) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
item->setText(0, a->text().replace("&", ""));
|
||||
|
||||
parent->addChild(item);
|
||||
|
||||
if (a->menu() != NULL) {
|
||||
setup_kbd_shortcut_worker(a->menu(), item);
|
||||
} else {
|
||||
key_shortcut_items.append(item);
|
||||
key_shortcut_actions.append(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::setup_kbd_shortcuts(QMenuBar* menubar) {
|
||||
ui->treeWidget->clear();
|
||||
QList<QMenu*> menus = menubar->findChildren<QMenu*>();
|
||||
QList<QAction*> menus = menubar->actions();
|
||||
|
||||
// caching for parent-child pairing
|
||||
QVector<QTreeWidgetItem*> added_action_items;
|
||||
QVector<QAction*> added_actions;
|
||||
for (int i=0;i<menus.size();i++) {
|
||||
QMenu* menu = menus.at(i)->menu();
|
||||
|
||||
for (int i=0;i<menus.size();i++) {
|
||||
QMenu* menu = menus.at(i);
|
||||
QTreeWidgetItem* item = NULL;
|
||||
if (menu->parent() != menubar) {
|
||||
for (int j=0;j<added_actions.size();j++) {
|
||||
if (added_actions.at(j)->menu() == menu) {
|
||||
item = added_action_items.at(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (menu->parent() == menubar || item == NULL) {
|
||||
item = new QTreeWidgetItem();
|
||||
item->setText(0, menu->title().replace("&", ""));
|
||||
ui->treeWidget->addTopLevelItem(item);
|
||||
}
|
||||
for (int j=0;j<menu->actions().size();j++) {
|
||||
QAction* action = menu->actions().at(j);
|
||||
if (!action->isSeparator()) {
|
||||
QTreeWidgetItem* child = new QTreeWidgetItem();
|
||||
child->setText(0, action->text().replace("&", ""));
|
||||
item->addChild(child);
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem();
|
||||
item->setText(0, menu->title().replace("&", ""));
|
||||
|
||||
added_actions.append(action);
|
||||
added_action_items.append(child);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i=0;i<added_action_items.size();i++) {
|
||||
if (added_actions.at(i)->menu() == NULL) {
|
||||
KeySequenceEditor* editor = new KeySequenceEditor(added_actions.at(i));
|
||||
ui->treeWidget->setItemWidget(added_action_items.at(i), 1, editor);
|
||||
}
|
||||
}
|
||||
keyboard_tree->addTopLevelItem(item);
|
||||
|
||||
setup_kbd_shortcut_worker(menu, item);
|
||||
}
|
||||
|
||||
for (int i=0;i<key_shortcut_items.size();i++) {
|
||||
KeySequenceEditor* editor = new KeySequenceEditor(keyboard_tree, key_shortcut_actions.at(i));
|
||||
keyboard_tree->setItemWidget(key_shortcut_items.at(i), 1, editor);
|
||||
key_shortcut_fields.append(editor);
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::on_buttonBox_accepted() {
|
||||
config.recording_mode = ui->recordingComboBox->currentIndex() + 1;
|
||||
config.img_seq_formats = ui->imgSeqFormatEdit->text();
|
||||
config.fast_seeking = ui->fastSeekButton->isChecked();
|
||||
void PreferencesDialog::save() {
|
||||
config.recording_mode = recordingComboBox->currentIndex() + 1;
|
||||
config.img_seq_formats = imgSeqFormatEdit->text();
|
||||
config.fast_seeking = fastSeekButton->isChecked();
|
||||
|
||||
// save keyboard shortcuts
|
||||
for (int i=0;i<key_shortcut_fields.size();i++) {
|
||||
key_shortcut_fields.at(i)->set_action_shortcut();
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
void PreferencesDialog::setup_ui() {
|
||||
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
|
||||
QTabWidget* tabWidget = new QTabWidget(this);
|
||||
|
||||
QTabWidget* tab = new QTabWidget();
|
||||
QGridLayout* gridLayout_2 = new QGridLayout(tab);
|
||||
|
||||
gridLayout_2->addWidget(new QLabel("Image sequence formats:"), 0, 0, 1, 1);
|
||||
|
||||
imgSeqFormatEdit = new QLineEdit(tab);
|
||||
|
||||
gridLayout_2->addWidget(imgSeqFormatEdit, 0, 1, 1, 1);
|
||||
|
||||
gridLayout_2->addWidget(new QLabel("Audio Recording:"), 1, 0, 1, 1);
|
||||
|
||||
recordingComboBox = new QComboBox(tab);
|
||||
recordingComboBox->addItem("Mono");
|
||||
recordingComboBox->addItem("Stereo");
|
||||
|
||||
gridLayout_2->addWidget(recordingComboBox, 1, 1, 1, 1);
|
||||
|
||||
tabWidget->addTab(tab, "General");
|
||||
QWidget* tab_2 = new QWidget();
|
||||
tabWidget->addTab(tab_2, "Behavior");
|
||||
QWidget* tab_4 = new QWidget();
|
||||
QVBoxLayout* verticalLayout_2 = new QVBoxLayout(tab_4);
|
||||
QGroupBox* groupBox = new QGroupBox(tab_4);
|
||||
groupBox->setTitle("Seeking");
|
||||
QVBoxLayout* verticalLayout_3 = new QVBoxLayout(groupBox);
|
||||
accurateSeekButton = new QRadioButton(groupBox);
|
||||
accurateSeekButton->setText("Accurate Seeking\nAlways show the correct frame (visual may pause briefly as correct frame is retrieved)");
|
||||
|
||||
verticalLayout_3->addWidget(accurateSeekButton);
|
||||
|
||||
fastSeekButton = new QRadioButton(groupBox);
|
||||
fastSeekButton->setText("Fast Seeking\nSeek quickly (may briefly show inaccurate frames when seeking - doesn't affect playback/export)");
|
||||
|
||||
verticalLayout_3->addWidget(fastSeekButton);
|
||||
|
||||
verticalLayout_2->addWidget(groupBox);
|
||||
|
||||
tabWidget->addTab(tab_4, "Playback");
|
||||
QWidget* tab_3 = new QWidget();
|
||||
QHBoxLayout* horizontalLayout = new QHBoxLayout(tab_3);
|
||||
horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
keyboard_tree = new QTreeWidget();
|
||||
QTreeWidgetItem* tree_header = keyboard_tree->headerItem();
|
||||
tree_header->setText(0, "Action");
|
||||
tree_header->setText(1, "Shortcut");
|
||||
horizontalLayout->addWidget(keyboard_tree);
|
||||
|
||||
tabWidget->addTab(tab_3, "Keyboard");
|
||||
|
||||
verticalLayout->addWidget(tabWidget);
|
||||
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setOrientation(Qt::Horizontal);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
|
||||
verticalLayout->addWidget(buttonBox);
|
||||
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(save()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
tabWidget->setCurrentIndex(2);
|
||||
}
|
||||
|
||||
+30
-18
@@ -4,36 +4,48 @@
|
||||
#include <QDialog>
|
||||
#include <QKeySequenceEdit>
|
||||
class QMenuBar;
|
||||
class QLineEdit;
|
||||
class QComboBox;
|
||||
class QRadioButton;
|
||||
class QTreeWidget;
|
||||
class QTreeWidgetItem;
|
||||
class QMenu;
|
||||
|
||||
namespace Ui {
|
||||
class PreferencesDialog;
|
||||
}
|
||||
class KeySequenceEditor : public QKeySequenceEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
KeySequenceEditor(QWidget *parent, QAction* a);
|
||||
void set_action_shortcut();
|
||||
private:
|
||||
QAction* action;
|
||||
};
|
||||
|
||||
class PreferencesDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PreferencesDialog(QWidget *parent = 0);
|
||||
~PreferencesDialog();
|
||||
explicit PreferencesDialog(QWidget *parent = 0);
|
||||
~PreferencesDialog();
|
||||
|
||||
void setup_kbd_shortcuts(QMenuBar* menu);
|
||||
void setup_kbd_shortcuts(QMenuBar* menu);
|
||||
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
void save();
|
||||
|
||||
private:
|
||||
Ui::PreferencesDialog *ui;
|
||||
};
|
||||
void setup_ui();
|
||||
void setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem* parent);
|
||||
|
||||
class KeySequenceEditor : public QKeySequenceEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
KeySequenceEditor(QAction* a);
|
||||
private slots:
|
||||
void set_action_shortcut();
|
||||
private:
|
||||
QAction* action;
|
||||
QLineEdit* imgSeqFormatEdit;
|
||||
QComboBox* recordingComboBox;
|
||||
QRadioButton* accurateSeekButton;
|
||||
QRadioButton* fastSeekButton;
|
||||
QTreeWidget* keyboard_tree;
|
||||
|
||||
QVector<QAction*> key_shortcut_actions;
|
||||
QVector<QTreeWidgetItem*> key_shortcut_items;
|
||||
QVector<KeySequenceEditor*> key_shortcut_fields;
|
||||
};
|
||||
|
||||
#endif // PREFERENCESDIALOG_H
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PreferencesDialog</class>
|
||||
<widget class="QDialog" name="PreferencesDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>693</width>
|
||||
<height>491</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>General</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Image sequence formats:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="imgSeqFormatEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Audio Recording:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="recordingComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mono</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Stereo</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>Behavior</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Playback</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Seeking</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="accurateSeekButton">
|
||||
<property name="text">
|
||||
<string>Accurate Seeking
|
||||
Always show the correct frame (visual may pause briefly as correct frame is retrieved)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="fastSeekButton">
|
||||
<property name="text">
|
||||
<string>Fast Seeking
|
||||
Seek quickly (may briefly show inaccurate frames when seeking - doesn't affect playback/export)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Keyboard</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">Action</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Shortcut</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>PreferencesDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>PreferencesDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -19,9 +19,8 @@
|
||||
#include <QMessageBox>
|
||||
#include <QCheckBox>
|
||||
|
||||
ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, SourceTable *table, Media *old_media) :
|
||||
ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media *old_media) :
|
||||
QDialog(parent),
|
||||
source_table(table),
|
||||
media(old_media)
|
||||
{
|
||||
resize(300, 400);
|
||||
@@ -30,11 +29,11 @@ ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, SourceTable *tab
|
||||
|
||||
layout->addWidget(new QLabel("Select which media you want to replace this media's clips with:"));
|
||||
|
||||
tree = new QTreeView();
|
||||
tree = new QTreeView();
|
||||
|
||||
layout->addWidget(tree);
|
||||
|
||||
use_same_media_in_points = new QCheckBox("Keep the same media in-points");
|
||||
use_same_media_in_points = new QCheckBox("Keep the same media in-points");
|
||||
use_same_media_in_points->setChecked(true);
|
||||
layout->addWidget(use_same_media_in_points);
|
||||
|
||||
@@ -56,34 +55,34 @@ ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, SourceTable *tab
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
tree->setModel(&project_model);
|
||||
tree->setModel(&project_model);
|
||||
|
||||
//copy_tree(NULL, NULL);
|
||||
//copy_tree(NULL, NULL);
|
||||
}
|
||||
|
||||
void ReplaceClipMediaDialog::replace() {
|
||||
QModelIndexList selected_items = tree->selectionModel()->selectedRows();
|
||||
if (selected_items.size() != 1) {
|
||||
QModelIndexList selected_items = panel_project->get_current_selected();
|
||||
if (selected_items.size() != 1) {
|
||||
QMessageBox::critical(this, "No media selected", "Please select a media to replace with or click 'Cancel'.", QMessageBox::Ok);
|
||||
} else {
|
||||
Media* new_item = static_cast<Media*>(selected_items.at(0).internalPointer());
|
||||
Media* new_item = static_cast<Media*>(selected_items.at(0).internalPointer());
|
||||
if (media == new_item) {
|
||||
QMessageBox::critical(this, "Same media selected", "You selected the same media that you're replacing. Please select a different one or click 'Cancel'.", QMessageBox::Ok);
|
||||
} else if (new_item->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
} else if (new_item->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
QMessageBox::critical(this, "Folder selected", "You cannot replace footage with a folder.", QMessageBox::Ok);
|
||||
} else {
|
||||
if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && sequence == new_item->to_sequence()) {
|
||||
if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && sequence == new_item->to_sequence()) {
|
||||
QMessageBox::critical(this, "Active sequence selected", "You cannot insert a sequence into itself.", QMessageBox::Ok);
|
||||
} else {
|
||||
} else {
|
||||
ReplaceClipMediaCommand* rcmc = new ReplaceClipMediaCommand(
|
||||
media,
|
||||
new_item,
|
||||
media,
|
||||
new_item,
|
||||
use_same_media_in_points->isChecked()
|
||||
);
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && c->media == media) {
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && c->media == media) {
|
||||
rcmc->clips.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,14 +11,13 @@ class QCheckBox;
|
||||
class ReplaceClipMediaDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ReplaceClipMediaDialog(QWidget* parent, SourceTable* table, Media *old_media);
|
||||
ReplaceClipMediaDialog(QWidget* parent, Media *old_media);
|
||||
private slots:
|
||||
void replace();
|
||||
private:
|
||||
SourceTable* source_table;
|
||||
QTreeView* tree;
|
||||
Media* media;
|
||||
QCheckBox* use_same_media_in_points;
|
||||
Media* media;
|
||||
QTreeView* tree;
|
||||
QCheckBox* use_same_media_in_points;
|
||||
};
|
||||
|
||||
#endif // REPLACECLIPMEDIADIALOG_H
|
||||
|
||||
@@ -84,12 +84,12 @@ void SpeedDialog::run() {
|
||||
clip_percent = c->speed;
|
||||
if (c->track < 0) {
|
||||
bool process_video = true;
|
||||
if (c->media != NULL && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* m = c->media->to_footage();
|
||||
FootageStream* ms = m->get_stream_from_file_index(true, c->media_stream);
|
||||
if (ms != NULL && ms->infinite_length) {
|
||||
process_video = false;
|
||||
}
|
||||
if (c->media != NULL && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* m = c->media->to_footage();
|
||||
FootageStream* ms = m->get_stream_from_file_index(true, c->media_stream);
|
||||
if (ms != NULL && ms->infinite_length) {
|
||||
process_video = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (process_video) {
|
||||
@@ -313,7 +313,7 @@ void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, lo
|
||||
}
|
||||
ep = qMin(ep, c->timeline_out);
|
||||
lr = qMax(lr, proposed_out - c->timeline_out);
|
||||
move_clip(ca, c, c->timeline_in, proposed_out, c->clip_in * multiplier, c->track);
|
||||
move_clip(ca, c, c->timeline_in, proposed_out, c->clip_in * multiplier, c->track);
|
||||
|
||||
c->refactor_frame_rate(ca, multiplier, false);
|
||||
|
||||
@@ -345,7 +345,7 @@ void SpeedDialog::accept() {
|
||||
|
||||
if (reverse->checkState() != Qt::PartiallyChecked && c->reverse != reverse->isChecked()) {
|
||||
long new_clip_in = (c->getMaximumLength() - (c->getLength() + c->clip_in));
|
||||
move_clip(ca, c, c->timeline_in, c->timeline_out, new_clip_in, c->track);
|
||||
move_clip(ca, c, c->timeline_in, c->timeline_out, new_clip_in, c->track);
|
||||
c->clip_in = new_clip_in;
|
||||
ca->append(new SetBool(&c->reverse, reverse->isChecked()));
|
||||
}
|
||||
@@ -398,7 +398,7 @@ void SpeedDialog::accept() {
|
||||
}
|
||||
|
||||
if (ripple->isChecked()) {
|
||||
ca->append(new RippleCommand(clips.at(0)->sequence, earliest_point, longest_ripple));
|
||||
ripple_clips(ca, clips.at(0)->sequence, earliest_point, longest_ripple);
|
||||
}
|
||||
|
||||
sel_command->new_data = sequence->selections;
|
||||
|
||||
+12
-8
@@ -5,14 +5,18 @@
|
||||
|
||||
int clipboard_type = CLIPBOARD_TYPE_CLIP;
|
||||
QVector<void*> clipboard;
|
||||
QVector<Transition*> clipboard_transitions;
|
||||
|
||||
void clear_clipboard() {
|
||||
for (int i=0;i<clipboard.size();i++) {
|
||||
if (clipboard_type == CLIPBOARD_TYPE_CLIP) {
|
||||
delete static_cast<Clip*>(clipboard.at(i));
|
||||
} else if (clipboard_type == CLIPBOARD_TYPE_EFFECT) {
|
||||
delete static_cast<Effect*>(clipboard.at(i));
|
||||
}
|
||||
}
|
||||
clipboard.clear();
|
||||
for (int i=0;i<clipboard.size();i++) {
|
||||
if (clipboard_type == CLIPBOARD_TYPE_CLIP) {
|
||||
delete static_cast<Clip*>(clipboard.at(i));
|
||||
} else if (clipboard_type == CLIPBOARD_TYPE_EFFECT) {
|
||||
delete static_cast<Effect*>(clipboard.at(i));
|
||||
}
|
||||
}
|
||||
for (int i=0;clipboard_transitions.size();i++) {
|
||||
delete clipboard_transitions.at(i);
|
||||
}
|
||||
clipboard.clear();
|
||||
}
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
|
||||
#include <QVector>
|
||||
|
||||
class Transition;
|
||||
|
||||
#define CLIPBOARD_TYPE_CLIP 0
|
||||
#define CLIPBOARD_TYPE_EFFECT 1
|
||||
|
||||
extern int clipboard_type;
|
||||
extern QVector<Transition*> clipboard_transitions;
|
||||
extern QVector<void*> clipboard;
|
||||
void clear_clipboard();
|
||||
|
||||
|
||||
+803
-631
File diff suppressed because it is too large
Load Diff
+123
-175
@@ -8,219 +8,167 @@ class EffectControls;
|
||||
class Viewer;
|
||||
class Timeline;
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
void updateTitle(const QString &url);
|
||||
~MainWindow();
|
||||
void updateTitle(const QString &url);
|
||||
~MainWindow();
|
||||
|
||||
void make_new_menu(QMenu* parent);
|
||||
void make_inout_menu(QMenu* parent);
|
||||
|
||||
public slots:
|
||||
void undo();
|
||||
void redo();
|
||||
void openSpeedDialog();
|
||||
void open_speed_dialog();
|
||||
void cut();
|
||||
void copy();
|
||||
void paste();
|
||||
void new_project();
|
||||
void autorecover_interval();
|
||||
void on_actionNest_triggered();
|
||||
void on_actionClear_In_Out_triggered();
|
||||
void toggle_full_screen();
|
||||
void new_project();
|
||||
void autorecover_interval();
|
||||
void nest();
|
||||
void toggle_full_screen();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
private slots:
|
||||
void on_action_Import_triggered();
|
||||
void clear_undo_stack();
|
||||
|
||||
void on_actionExit_triggered();
|
||||
void show_about();
|
||||
void delete_slot();
|
||||
void select_all();
|
||||
|
||||
void on_actionAbout_triggered();
|
||||
void new_sequence();
|
||||
|
||||
void on_actionDelete_triggered();
|
||||
void zoom_in();
|
||||
void zoom_out();
|
||||
void export_dialog();
|
||||
void ripple_delete();
|
||||
|
||||
void on_actionSelect_All_triggered();
|
||||
void open_project();
|
||||
bool save_project_as();
|
||||
bool save_project();
|
||||
|
||||
void on_actionSequence_triggered();
|
||||
void go_to_start();
|
||||
void prev_frame();
|
||||
void playpause();
|
||||
void next_frame();
|
||||
void go_to_end();
|
||||
void prev_cut();
|
||||
void next_cut();
|
||||
|
||||
void on_actionZoom_In_triggered();
|
||||
void reset_layout();
|
||||
|
||||
void on_actionZoom_out_triggered();
|
||||
void preferences();
|
||||
|
||||
void on_actionExport_triggered();
|
||||
void zoom_in_tracks();
|
||||
|
||||
void on_actionProject_2_triggered();
|
||||
void zoom_out_tracks();
|
||||
|
||||
void on_actionEffect_Controls_triggered();
|
||||
void fileMenu_About_To_Be_Shown();
|
||||
void editMenu_About_To_Be_Shown();
|
||||
void windowMenu_About_To_Be_Shown();
|
||||
void viewMenu_About_To_Be_Shown();
|
||||
void toolMenu_About_To_Be_Shown();
|
||||
|
||||
void on_actionViewer_triggered();
|
||||
void duplicate();
|
||||
|
||||
void on_actionTimeline_triggered();
|
||||
void add_default_transition();
|
||||
|
||||
void on_actionRipple_Delete_triggered();
|
||||
void new_folder();
|
||||
|
||||
void on_actionSplit_at_Playhead_triggered();
|
||||
void load_recent_project();
|
||||
|
||||
void on_action_Save_Project_triggered();
|
||||
void ripple_to_in_point();
|
||||
void ripple_to_out_point();
|
||||
|
||||
void on_action_Open_Project_triggered();
|
||||
void set_in_point();
|
||||
void set_out_point();
|
||||
|
||||
void on_actionSave_Project_As_triggered();
|
||||
void clear_inout();
|
||||
void delete_inout();
|
||||
void ripple_delete_inout();
|
||||
|
||||
void on_actionDeselect_All_triggered();
|
||||
// title safe area functions
|
||||
void set_tsa_disable();
|
||||
void set_tsa_default();
|
||||
void set_tsa_43();
|
||||
void set_tsa_169();
|
||||
void set_tsa_custom();
|
||||
|
||||
void on_actionGo_to_start_triggered();
|
||||
void set_marker();
|
||||
|
||||
void on_actionReset_to_default_layout_triggered();
|
||||
|
||||
void on_actionPrevious_Frame_triggered();
|
||||
|
||||
void on_actionNext_Frame_triggered();
|
||||
|
||||
void on_actionGo_to_End_triggered();
|
||||
|
||||
void on_actionPlay_Pause_triggered();
|
||||
|
||||
void on_actionEdit_Tool_triggered();
|
||||
|
||||
void on_actionToggle_Snapping_triggered();
|
||||
|
||||
void on_actionPointer_Tool_triggered();
|
||||
|
||||
void on_actionRazor_Tool_triggered();
|
||||
|
||||
void on_actionRipple_Tool_triggered();
|
||||
|
||||
void on_actionRolling_Tool_triggered();
|
||||
|
||||
void on_actionSlip_Tool_triggered();
|
||||
|
||||
void on_actionGo_to_Previous_Cut_triggered();
|
||||
|
||||
void on_actionGo_to_Next_Cut_triggered();
|
||||
|
||||
void on_actionPreferences_triggered();
|
||||
|
||||
void on_actionIncrease_Track_Height_triggered();
|
||||
|
||||
void on_actionDecrease_Track_Height_triggered();
|
||||
|
||||
void windowMenu_About_To_Be_Shown();
|
||||
|
||||
void on_actionFrames_triggered();
|
||||
|
||||
void on_actionDrop_Frame_triggered();
|
||||
|
||||
void on_actionNon_Drop_Frame_triggered();
|
||||
|
||||
void viewMenu_About_To_Be_Shown();
|
||||
|
||||
void on_actionEdit_Tool_Selects_Links_triggered();
|
||||
|
||||
void on_actionEdit_Tool_Also_Seeks_triggered();
|
||||
|
||||
void toolMenu_About_To_Be_Shown();
|
||||
|
||||
void on_actionDuplicate_triggered();
|
||||
|
||||
void on_actionSelecting_Also_Seeks_triggered();
|
||||
|
||||
void on_actionSeek_to_the_End_of_Pastes_triggered();
|
||||
|
||||
void on_actionAdd_Default_Transition_triggered();
|
||||
|
||||
void on_actionSlide_Tool_triggered();
|
||||
|
||||
void on_actionFolder_triggered();
|
||||
|
||||
void editMenu_About_To_Be_Shown();
|
||||
|
||||
void fileMenu_About_To_Be_Shown();
|
||||
|
||||
void load_recent_project();
|
||||
|
||||
void on_actionScroll_Wheel_Zooms_triggered();
|
||||
|
||||
void on_actionLink_Unlink_triggered();
|
||||
|
||||
void on_actionRipple_To_In_Point_triggered();
|
||||
|
||||
void on_actionRipple_to_Out_Point_triggered();
|
||||
|
||||
void on_actionSet_In_Point_triggered();
|
||||
|
||||
void on_actionSet_Out_Point_triggered();
|
||||
|
||||
void on_actionDelete_In_Out_triggered();
|
||||
|
||||
void on_actionRipple_Delete_In_Out_triggered();
|
||||
|
||||
void on_actionTimeline_Track_Lines_triggered();
|
||||
|
||||
void on_actionRectified_Waveforms_triggered();
|
||||
|
||||
void on_actionDefault_triggered();
|
||||
|
||||
void on_actionOff_triggered();
|
||||
|
||||
void on_action4_3_triggered();
|
||||
|
||||
void on_action16_9_triggered();
|
||||
|
||||
void on_actionCustom_triggered();
|
||||
|
||||
void on_actionEnable_Drag_Files_to_Timeline_triggered();
|
||||
|
||||
void on_actionAuto_scale_by_Default_triggered();
|
||||
|
||||
void on_actionSet_Edit_Marker_triggered();
|
||||
|
||||
void on_actionEnable_Disable_Clip_triggered();
|
||||
|
||||
void on_actionEnable_Seek_to_Import_triggered();
|
||||
|
||||
void on_actionAudio_Scrubbing_triggered();
|
||||
|
||||
void on_actionTransition_Tool_triggered();
|
||||
|
||||
void on_actionEdit_to_In_Point_triggered();
|
||||
|
||||
void on_actionEdit_to_Out_Point_triggered();
|
||||
|
||||
void on_actionToggle_Show_All_triggered();
|
||||
|
||||
void on_actionEnable_Drop_on_Media_to_Replace_triggered();
|
||||
|
||||
void on_actionFootage_Viewer_triggered();
|
||||
|
||||
void on_actionPasteInsert_triggered();
|
||||
|
||||
void on_actionNo_autoscroll_triggered();
|
||||
|
||||
void on_actionPage_Autoscroll_triggered();
|
||||
|
||||
void on_actionSmooth_Auto_scroll_triggered();
|
||||
|
||||
void on_actionMilliseconds_triggered();
|
||||
|
||||
void on_actionEnable_Hover_Focus_triggered();
|
||||
|
||||
void on_actionHand_Tool_triggered();
|
||||
void toggle_enable_clips();
|
||||
void edit_to_in_point();
|
||||
void edit_to_out_point();
|
||||
void paste_insert();
|
||||
void toggle_bool_action();
|
||||
void set_autoscroll();
|
||||
void menu_click_button();
|
||||
void toggle_panel_visibility();
|
||||
void set_timecode_view();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
void setup_layout(bool reset);
|
||||
bool save_project_as();
|
||||
bool save_project();
|
||||
bool can_close_project();
|
||||
void setup_layout(bool reset);
|
||||
bool can_close_project();
|
||||
void setup_menus();
|
||||
|
||||
// menu bar menus
|
||||
QMenu* window_menu;
|
||||
|
||||
// file menu actions
|
||||
QMenu* open_recent;
|
||||
|
||||
// view menu actions
|
||||
QAction* track_lines;
|
||||
QAction* frames_action;
|
||||
QAction* drop_frame_action;
|
||||
QAction* nondrop_frame_action;
|
||||
QAction* milliseconds_action;
|
||||
QAction* no_autoscroll;
|
||||
QAction* page_autoscroll;
|
||||
QAction* smooth_autoscroll;
|
||||
QAction* title_safe_off;
|
||||
QAction* title_safe_default;
|
||||
QAction* title_safe_43;
|
||||
QAction* title_safe_169;
|
||||
QAction* title_safe_custom;
|
||||
QAction* full_screen;
|
||||
QAction* show_all;
|
||||
|
||||
// tool menu actions
|
||||
QAction* pointer_tool_action;
|
||||
QAction* edit_tool_action;
|
||||
QAction* ripple_tool_action;
|
||||
QAction* razor_tool_action;
|
||||
QAction* slip_tool_action;
|
||||
QAction* slide_tool_action;
|
||||
QAction* hand_tool_action;
|
||||
QAction* transition_tool_action;
|
||||
QAction* snap_toggle;
|
||||
QAction* selecting_also_seeks;
|
||||
QAction* edit_tool_also_seeks;
|
||||
QAction* edit_tool_selects_links;
|
||||
QAction* seek_to_end_of_pastes;
|
||||
QAction* scroll_wheel_zooms;
|
||||
QAction* rectified_waveforms;
|
||||
QAction* enable_drag_files_to_timeline;
|
||||
QAction* autoscale_by_default;
|
||||
QAction* enable_seek_to_import;
|
||||
QAction* enable_audio_scrubbing;
|
||||
QAction* enable_drop_on_media_to_replace;
|
||||
QAction* enable_hover_focus;
|
||||
|
||||
// edit menu actions
|
||||
QAction* undo_action;
|
||||
QAction* redo_action;
|
||||
|
||||
void set_bool_action_checked(QAction* a);
|
||||
void set_int_action_checked(QAction* a, const int& i);
|
||||
void set_button_action_checked(QAction* a);
|
||||
};
|
||||
|
||||
extern MainWindow* mainWindow;
|
||||
|
||||
-964
@@ -1,964 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>653</width>
|
||||
<height>394</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>653</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_File">
|
||||
<property name="title">
|
||||
<string>&File</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu_New">
|
||||
<property name="title">
|
||||
<string>&New</string>
|
||||
</property>
|
||||
<addaction name="actionProject"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSequence"/>
|
||||
<addaction name="actionFolder"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuOpen_Recent">
|
||||
<property name="title">
|
||||
<string>Open Recent</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menu_New"/>
|
||||
<addaction name="action_Open_Project"/>
|
||||
<addaction name="menuOpen_Recent"/>
|
||||
<addaction name="action_Save_Project"/>
|
||||
<addaction name="actionSave_Project_As"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="action_Import"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExport"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuEdit">
|
||||
<property name="title">
|
||||
<string>&Edit</string>
|
||||
</property>
|
||||
<addaction name="action_Undo"/>
|
||||
<addaction name="action_Redo"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionCu_t"/>
|
||||
<addaction name="actionCop_y"/>
|
||||
<addaction name="action_Paste"/>
|
||||
<addaction name="actionPasteInsert"/>
|
||||
<addaction name="actionDuplicate"/>
|
||||
<addaction name="actionDelete"/>
|
||||
<addaction name="actionRipple_Delete"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSelect_All"/>
|
||||
<addaction name="actionDeselect_All"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionAdd_Default_Transition"/>
|
||||
<addaction name="actionLink_Unlink"/>
|
||||
<addaction name="actionRipple_To_In_Point"/>
|
||||
<addaction name="actionRipple_to_Out_Point"/>
|
||||
<addaction name="actionEdit_to_In_Point"/>
|
||||
<addaction name="actionEdit_to_Out_Point"/>
|
||||
<addaction name="actionSplit_at_Playhead"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSet_In_Point"/>
|
||||
<addaction name="actionSet_Out_Point"/>
|
||||
<addaction name="actionClear_In_Out"/>
|
||||
<addaction name="actionDelete_In_Out"/>
|
||||
<addaction name="actionRipple_Delete_In_Out"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSet_Edit_Marker"/>
|
||||
<addaction name="actionEnable_Disable_Clip"/>
|
||||
<addaction name="actionNest"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuWindow">
|
||||
<property name="title">
|
||||
<string>&Window</string>
|
||||
</property>
|
||||
<addaction name="actionProject_2"/>
|
||||
<addaction name="actionEffect_Controls"/>
|
||||
<addaction name="actionFootage_Viewer"/>
|
||||
<addaction name="actionViewer"/>
|
||||
<addaction name="actionTimeline"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionReset_to_default_layout"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Help">
|
||||
<property name="title">
|
||||
<string>&Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_View">
|
||||
<property name="title">
|
||||
<string>&View</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuTitle_Action_Safe_Area">
|
||||
<property name="title">
|
||||
<string>Title/Action Safe Area</string>
|
||||
</property>
|
||||
<addaction name="actionOff"/>
|
||||
<addaction name="actionDefault"/>
|
||||
<addaction name="action4_3"/>
|
||||
<addaction name="action16_9"/>
|
||||
<addaction name="actionCustom"/>
|
||||
</widget>
|
||||
<addaction name="actionTimeline_Track_Lines"/>
|
||||
<addaction name="actionZoom_In"/>
|
||||
<addaction name="actionZoom_out"/>
|
||||
<addaction name="actionIncrease_Track_Height"/>
|
||||
<addaction name="actionDecrease_Track_Height"/>
|
||||
<addaction name="actionToggle_Show_All"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFrames"/>
|
||||
<addaction name="actionDrop_Frame"/>
|
||||
<addaction name="actionNon_Drop_Frame"/>
|
||||
<addaction name="actionMilliseconds"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="menuTitle_Action_Safe_Area"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionFull_Screen"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuPlayback">
|
||||
<property name="title">
|
||||
<string>&Playback</string>
|
||||
</property>
|
||||
<addaction name="actionGo_to_start"/>
|
||||
<addaction name="actionPrevious_Frame"/>
|
||||
<addaction name="actionPlay_Pause"/>
|
||||
<addaction name="actionNext_Frame"/>
|
||||
<addaction name="actionGo_to_End"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionGo_to_Previous_Cut"/>
|
||||
<addaction name="actionGo_to_Next_Cut"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Tools">
|
||||
<property name="title">
|
||||
<string>&Tools</string>
|
||||
</property>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPointer_Tool"/>
|
||||
<addaction name="actionEdit_Tool"/>
|
||||
<addaction name="actionRipple_Tool"/>
|
||||
<addaction name="actionRolling_Tool"/>
|
||||
<addaction name="actionRazor_Tool"/>
|
||||
<addaction name="actionSlip_Tool"/>
|
||||
<addaction name="actionSlide_Tool"/>
|
||||
<addaction name="actionHand_Tool"/>
|
||||
<addaction name="actionTransition_Tool"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionToggle_Snapping"/>
|
||||
<addaction name="actionSelecting_Also_Seeks"/>
|
||||
<addaction name="actionEdit_Tool_Also_Seeks"/>
|
||||
<addaction name="actionEdit_Tool_Selects_Links"/>
|
||||
<addaction name="actionSeek_to_the_End_of_Pastes"/>
|
||||
<addaction name="actionScroll_Wheel_Zooms"/>
|
||||
<addaction name="actionRectified_Waveforms"/>
|
||||
<addaction name="actionEnable_Drag_Files_to_Timeline"/>
|
||||
<addaction name="actionAuto_scale_by_Default"/>
|
||||
<addaction name="actionEnable_Seek_to_Import"/>
|
||||
<addaction name="actionAudio_Scrubbing"/>
|
||||
<addaction name="actionEnable_Drop_on_Media_to_Replace"/>
|
||||
<addaction name="actionEnable_Hover_Focus"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionNo_autoscroll"/>
|
||||
<addaction name="actionPage_Autoscroll"/>
|
||||
<addaction name="actionSmooth_Auto_scroll"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPreferences"/>
|
||||
<addaction name="actionCrash"/>
|
||||
<addaction name="separator"/>
|
||||
</widget>
|
||||
<addaction name="menu_File"/>
|
||||
<addaction name="menuEdit"/>
|
||||
<addaction name="menu_View"/>
|
||||
<addaction name="menuPlayback"/>
|
||||
<addaction name="menuWindow"/>
|
||||
<addaction name="menu_Tools"/>
|
||||
<addaction name="menu_Help"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="action_Open_Project">
|
||||
<property name="text">
|
||||
<string>&Open Project</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+O</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Save_Project">
|
||||
<property name="text">
|
||||
<string>&Save Project</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_Project_As">
|
||||
<property name="text">
|
||||
<string>Save Project &As</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Import">
|
||||
<property name="text">
|
||||
<string>&Import...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+I</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExport">
|
||||
<property name="text">
|
||||
<string>&Export...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+M</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
<string>E&xit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>About...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Undo">
|
||||
<property name="text">
|
||||
<string>&Undo</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Z</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Redo">
|
||||
<property name="text">
|
||||
<string>&Redo</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+Z</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCu_t">
|
||||
<property name="text">
|
||||
<string>Cu&t</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+X</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCop_y">
|
||||
<property name="text">
|
||||
<string>Cop&y</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+C</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Paste">
|
||||
<property name="text">
|
||||
<string>&Paste</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+V</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPasteInsert">
|
||||
<property name="text">
|
||||
<string>Paste Insert</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+V</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDelete">
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Del</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSelect_All">
|
||||
<property name="text">
|
||||
<string>Select &All</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+A</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTimeline_Track_Lines">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Track Lines</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionProject">
|
||||
<property name="text">
|
||||
<string>Project...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+N</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSequence">
|
||||
<property name="text">
|
||||
<string>Sequence...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+N</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionZoom_In">
|
||||
<property name="text">
|
||||
<string>Zoom In</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>=</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionZoom_out">
|
||||
<property name="text">
|
||||
<string>Zoom Out</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionProject_2">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Project</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEffect_Controls">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Effect Controls</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionViewer">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sequence Viewer</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTimeline">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Timeline</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRipple_Delete">
|
||||
<property name="text">
|
||||
<string>Ripple Delete</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Shift+Del</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSplit_at_Playhead">
|
||||
<property name="text">
|
||||
<string>Split at Playhead</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+K</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDeselect_All">
|
||||
<property name="text">
|
||||
<string>Deselect All</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGo_to_start">
|
||||
<property name="text">
|
||||
<string>Go to Start</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Home</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionReset_to_default_layout">
|
||||
<property name="text">
|
||||
<string>Reset to default layout</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPrevious_Frame">
|
||||
<property name="text">
|
||||
<string>Previous Frame</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Left</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPlay_Pause">
|
||||
<property name="text">
|
||||
<string>Play/Pause</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Space</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNext_Frame">
|
||||
<property name="text">
|
||||
<string>Next Frame</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Right</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGo_to_End">
|
||||
<property name="text">
|
||||
<string>Go to End</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>End</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCrash">
|
||||
<property name="text">
|
||||
<string>Crash</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPointer_Tool">
|
||||
<property name="text">
|
||||
<string>Pointer Tool</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>V</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_Tool">
|
||||
<property name="text">
|
||||
<string>Edit Tool</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>X</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRazor_Tool">
|
||||
<property name="text">
|
||||
<string>Razor Tool</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>C</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRipple_Tool">
|
||||
<property name="text">
|
||||
<string>Ripple Tool</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>B</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRolling_Tool">
|
||||
<property name="text">
|
||||
<string>Rolling Tool</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>N</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPreferences">
|
||||
<property name="text">
|
||||
<string>Preferences</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+.</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionToggle_Snapping">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Snapping</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Snapping</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSlip_Tool">
|
||||
<property name="text">
|
||||
<string>Slip Tool</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Y</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGo_to_Previous_Cut">
|
||||
<property name="text">
|
||||
<string>Go to Previous Cut</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Up</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionGo_to_Next_Cut">
|
||||
<property name="text">
|
||||
<string>Go to Next Cut</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Down</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_Tool_Also_Seeks">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit Tool Also Seeks</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionIncrease_Track_Height">
|
||||
<property name="text">
|
||||
<string>Increase Track Height</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+=</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDecrease_Track_Height">
|
||||
<property name="text">
|
||||
<string>Decrease Track Height</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+-</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFrames">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Frames</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDrop_Frame">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Drop-Frame</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNon_Drop_Frame">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Non-Drop Frame</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_Tool_Selects_Links">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit Tool Selects Links</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDuplicate">
|
||||
<property name="text">
|
||||
<string>Duplicate</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+D</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSelecting_Also_Seeks">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Selecting Also Seeks</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSeek_to_the_End_of_Pastes">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Seek to the End of Pastes</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAdd_Default_Transition">
|
||||
<property name="text">
|
||||
<string>Add Default Transition</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Shift+D</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSlide_Tool">
|
||||
<property name="text">
|
||||
<string>Slide Tool</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>U</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFolder">
|
||||
<property name="text">
|
||||
<string>Folder</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClear_Recent_List">
|
||||
<property name="text">
|
||||
<string>Clear Recent List</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionScroll_Wheel_Zooms">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Scroll Wheel Zooms</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLink_Unlink">
|
||||
<property name="text">
|
||||
<string>Link/Unlink</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+L</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRipple_To_In_Point">
|
||||
<property name="text">
|
||||
<string>Ripple to In Point</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Q</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRipple_to_Out_Point">
|
||||
<property name="text">
|
||||
<string>Ripple to Out Point</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>W</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSet_In_Point">
|
||||
<property name="text">
|
||||
<string>Set In Point</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>I</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSet_Out_Point">
|
||||
<property name="text">
|
||||
<string>Set Out Point</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>O</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClear_In_Out">
|
||||
<property name="text">
|
||||
<string>Clear In/Out</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>G</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDelete_In_Out">
|
||||
<property name="text">
|
||||
<string>Delete In/Out</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>;</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRipple_Delete_In_Out">
|
||||
<property name="text">
|
||||
<string>Ripple Delete In/Out</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>'</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRectified_Waveforms">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rectified Waveforms</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDefault">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOff">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Off</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action4_3">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>4:3</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action16_9">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>16:9</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionCustom">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnable_Drag_Files_to_Timeline">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Drag Files to Timeline</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAuto_scale_by_Default">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto-scale by Default</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSet_Edit_Marker">
|
||||
<property name="text">
|
||||
<string>Set/Edit Marker</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>M</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnable_Disable_Clip">
|
||||
<property name="text">
|
||||
<string>Enable/Disable Clip</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Shift+E</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnable_Seek_to_Import">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Seek to Import</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAudio_Scrubbing">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Audio Scrubbing</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTransition_Tool">
|
||||
<property name="text">
|
||||
<string>Transition Tool</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>T</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_to_In_Point">
|
||||
<property name="text">
|
||||
<string>Edit to In Point</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Alt+Q</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_to_Out_Point">
|
||||
<property name="text">
|
||||
<string>Edit to Out Point</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+Alt+W</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNest">
|
||||
<property name="text">
|
||||
<string>Nest</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionToggle_Show_All">
|
||||
<property name="text">
|
||||
<string>Toggle Show All</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>\</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnable_Drop_on_Media_to_Replace">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Drop File on Media to Replace</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFootage_Viewer">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Footage Viewer</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNo_autoscroll">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>No Auto-scroll</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPage_Autoscroll">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Page Auto-scroll</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSmooth_Auto_scroll">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Smooth Auto-scroll</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMilliseconds">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Milliseconds</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnable_Hover_Focus">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Hover Focus for Zooming</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFull_Screen">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Full Screen</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>F11</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionHand_Tool">
|
||||
<property name="text">
|
||||
<string>Hand Tool</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>H</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -187,16 +187,7 @@ HEADERS += \
|
||||
project/sourcescommon.h \
|
||||
ui/keyframenavigator.h
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui \
|
||||
panels/effectcontrols.ui \
|
||||
panels/viewer.ui \
|
||||
panels/timeline.ui \
|
||||
dialogs/aboutdialog.ui \
|
||||
dialogs/newsequencedialog.ui \
|
||||
dialogs/exportdialog.ui \
|
||||
dialogs/preferencesdialog.ui \
|
||||
dialogs/demonotice.ui
|
||||
FORMS +=
|
||||
|
||||
win32 {
|
||||
RC_FILE = icons/resources.rc
|
||||
@@ -226,8 +217,6 @@ unix:!mac:target.path = $$PREFIX/bin
|
||||
effects.files = $$PWD/effects/*.frag $$PWD/effects/*.xml $$PWD/effects/*.vert
|
||||
unix:!mac:effects.path = $$PREFIX/share/olive-editor/effects
|
||||
|
||||
INSTALLS += target effects
|
||||
|
||||
unix:!mac {
|
||||
metainfo.files = $$PWD/packaging/linux/org.olivevideoeditor.Olive.appdata.xml
|
||||
metainfo.path = $$PREFIX/share/metainfo
|
||||
@@ -251,5 +240,5 @@ unix:!mac {
|
||||
icon512.path = $$PREFIX/share/icons/hicolor/512x512/apps
|
||||
icon1024.files = $$PWD/packaging/linux/icons/1024x1024/org.olivevideoeditor.Olive.png
|
||||
icon1024.path = $$PREFIX/share/icons/hicolor/1024x1024/apps
|
||||
INSTALLS += metainfo desktop mime icon16 icon32 icon48 icon64 icon128 icon256 icon512 icon1024
|
||||
}
|
||||
INSTALLS += target effects metainfo desktop mime icon16 icon32 icon48 icon64 icon128 icon256 icon512 icon1024
|
||||
}
|
||||
|
||||
+411
-224
@@ -1,10 +1,16 @@
|
||||
#include "effectcontrols.h"
|
||||
#include "ui_effectcontrols.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QVBoxLayout>
|
||||
#include <QResizeEvent>
|
||||
#include <QScrollBar>
|
||||
#include <QSplitter>
|
||||
#include <QScrollArea>
|
||||
#include <QPushButton>
|
||||
#include <QSpacerItem>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
#include <QIcon>
|
||||
|
||||
#include "panels/panels.h"
|
||||
#include "project/effect.h"
|
||||
@@ -18,44 +24,44 @@
|
||||
#include "panels/viewer.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "io/clipboard.h"
|
||||
#include "ui/timelineheader.h"
|
||||
#include "ui/keyframeview.h"
|
||||
#include "ui/resizablescrollbar.h"
|
||||
#include "debug.h"
|
||||
|
||||
EffectControls::EffectControls(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
multiple(false),
|
||||
zoom(1),
|
||||
ui(new Ui::EffectControls),
|
||||
panel_name("Effects: "),
|
||||
mode(TA_NO_TRANSITION)
|
||||
zoom(1),
|
||||
panel_name("Effects: "),
|
||||
mode(TA_NO_TRANSITION)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setup_ui();
|
||||
|
||||
init_effects();
|
||||
clear_effects(false);
|
||||
ui->headers->viewer = panel_sequence_viewer;
|
||||
ui->headers->snapping = false;
|
||||
clear_effects(false);
|
||||
headers->viewer = panel_sequence_viewer;
|
||||
headers->snapping = false;
|
||||
|
||||
ui->effects_area->parent_widget = ui->scrollArea;
|
||||
ui->effects_area->keyframe_area = ui->keyframeView;
|
||||
ui->effects_area->header = ui->headers;
|
||||
ui->keyframeView->header = ui->headers;
|
||||
effects_area->parent_widget = scrollArea;
|
||||
effects_area->keyframe_area = keyframeView;
|
||||
effects_area->header = headers;
|
||||
keyframeView->header = headers;
|
||||
|
||||
ui->lblMultipleClipsSelected->setVisible(false);
|
||||
lblMultipleClipsSelected->setVisible(false);
|
||||
|
||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->headers, SLOT(set_scroll(int)));
|
||||
connect(ui->horizontalScrollBar, SIGNAL(resize_move(double)), ui->keyframeView, SLOT(resize_move(double)));
|
||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->keyframeView, SLOT(set_x_scroll(int)));
|
||||
connect(ui->verticalScrollBar, SIGNAL(valueChanged(int)), ui->keyframeView, SLOT(set_y_scroll(int)));
|
||||
connect(ui->verticalScrollBar, SIGNAL(valueChanged(int)), ui->scrollArea->verticalScrollBar(), SLOT(setValue(int)));
|
||||
connect(ui->scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)), ui->verticalScrollBar, SLOT(setValue(int)));
|
||||
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), headers, SLOT(set_scroll(int)));
|
||||
connect(horizontalScrollBar, SIGNAL(resize_move(double)), keyframeView, SLOT(resize_move(double)));
|
||||
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_x_scroll(int)));
|
||||
connect(verticalScrollBar, SIGNAL(valueChanged(int)), keyframeView, SLOT(set_y_scroll(int)));
|
||||
connect(verticalScrollBar, SIGNAL(valueChanged(int)), scrollArea->verticalScrollBar(), SLOT(setValue(int)));
|
||||
connect(scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)), verticalScrollBar, SLOT(setValue(int)));
|
||||
}
|
||||
|
||||
EffectControls::~EffectControls() {
|
||||
delete ui;
|
||||
}
|
||||
EffectControls::~EffectControls() {}
|
||||
|
||||
bool EffectControls::keyframe_focus() {
|
||||
return ui->headers->hasFocus() || ui->keyframeView->hasFocus();
|
||||
return headers->hasFocus() || keyframeView->hasFocus();
|
||||
}
|
||||
|
||||
void EffectControls::set_zoom(bool in) {
|
||||
@@ -64,292 +70,473 @@ void EffectControls::set_zoom(bool in) {
|
||||
}
|
||||
|
||||
void EffectControls::menu_select(QAction* q) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
if ((c->track < 0) == (effect_menu_subtype == EFFECT_TYPE_VIDEO)) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
if ((c->track < 0) == (effect_menu_subtype == EFFECT_TYPE_VIDEO)) {
|
||||
const EffectMeta* meta = reinterpret_cast<const EffectMeta*>(q->data().value<quintptr>());
|
||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||
if (c->get_opening_transition() == NULL) {
|
||||
ca->append(new AddTransitionCommand(c, NULL, NULL, meta, TA_OPENING_TRANSITION, 30));
|
||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||
if (c->get_opening_transition() == NULL) {
|
||||
ca->append(new AddTransitionCommand(c, NULL, NULL, meta, TA_OPENING_TRANSITION, 30));
|
||||
}
|
||||
if (c->get_closing_transition() == NULL) {
|
||||
ca->append(new AddTransitionCommand(c, NULL, NULL, meta, TA_CLOSING_TRANSITION, 30));
|
||||
if (c->get_closing_transition() == NULL) {
|
||||
ca->append(new AddTransitionCommand(c, NULL, NULL, meta, TA_CLOSING_TRANSITION, 30));
|
||||
}
|
||||
} else {
|
||||
ca->append(new AddEffectCommand(c, NULL, meta));
|
||||
ca->append(new AddEffectCommand(c, NULL, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
undo_stack.push(ca);
|
||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||
}
|
||||
}
|
||||
undo_stack.push(ca);
|
||||
if (effect_menu_type == EFFECT_TYPE_TRANSITION) {
|
||||
update_ui(true);
|
||||
} else {
|
||||
reload_clips();
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EffectControls::update_keyframes() {
|
||||
ui->headers->update_zoom(zoom);
|
||||
ui->keyframeView->update();
|
||||
headers->update_zoom(zoom);
|
||||
keyframeView->update();
|
||||
}
|
||||
|
||||
void EffectControls::delete_selected_keyframes() {
|
||||
ui->keyframeView->delete_selected_keyframes();
|
||||
keyframeView->delete_selected_keyframes();
|
||||
}
|
||||
|
||||
void EffectControls::copy(bool del) {
|
||||
if (mode == TA_NO_TRANSITION) {
|
||||
bool cleared = false;
|
||||
if (mode == TA_NO_TRANSITION) {
|
||||
bool cleared = false;
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : NULL;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* effect = c->effects.at(j);
|
||||
if (effect->container->selected) {
|
||||
if (!cleared) {
|
||||
clear_clipboard();
|
||||
cleared = true;
|
||||
ComboAction* ca = new ComboAction();
|
||||
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : NULL;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* effect = c->effects.at(j);
|
||||
if (effect->container->selected) {
|
||||
if (!cleared) {
|
||||
clear_clipboard();
|
||||
cleared = true;
|
||||
clipboard_type = CLIPBOARD_TYPE_EFFECT;
|
||||
}
|
||||
}
|
||||
|
||||
clipboard.append(effect->copy(NULL));
|
||||
clipboard.append(effect->copy(NULL));
|
||||
|
||||
if (del_com != NULL) {
|
||||
del_com->clips.append(c);
|
||||
del_com->fx.append(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (del_com != NULL) {
|
||||
if (del_com->clips.size() > 0) {
|
||||
ca->append(del_com);
|
||||
} else {
|
||||
delete del_com;
|
||||
}
|
||||
}
|
||||
undo_stack.push(ca);
|
||||
}
|
||||
if (del_com != NULL) {
|
||||
del_com->clips.append(c);
|
||||
del_com->fx.append(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (del_com != NULL) {
|
||||
if (del_com->clips.size() > 0) {
|
||||
ca->append(del_com);
|
||||
} else {
|
||||
delete del_com;
|
||||
}
|
||||
}
|
||||
undo_stack.push(ca);
|
||||
}
|
||||
}
|
||||
|
||||
void EffectControls::show_effect_menu(int type, int subtype) {
|
||||
effect_menu_type = type;
|
||||
effect_menu_subtype = subtype;
|
||||
effect_menu_type = type;
|
||||
effect_menu_subtype = subtype;
|
||||
|
||||
effects_loaded.lock();
|
||||
effects_loaded.lock();
|
||||
|
||||
QMenu effects_menu(this);
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
const EffectMeta& em = effects.at(i);
|
||||
QMenu effects_menu(this);
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
const EffectMeta& em = effects.at(i);
|
||||
|
||||
if (em.type == type && em.subtype == subtype) {
|
||||
QAction* action = new QAction(&effects_menu);
|
||||
action->setText(em.name);
|
||||
action->setData(reinterpret_cast<quintptr>(&em));
|
||||
if (em.type == type && em.subtype == subtype) {
|
||||
QAction* action = new QAction(&effects_menu);
|
||||
action->setText(em.name);
|
||||
action->setData(reinterpret_cast<quintptr>(&em));
|
||||
|
||||
QMenu* parent = &effects_menu;
|
||||
if (!em.category.isEmpty()) {
|
||||
bool found = false;
|
||||
for (int j=0;j<effects_menu.actions().size();j++) {
|
||||
QAction* action = effects_menu.actions().at(j);
|
||||
if (action->menu() != NULL) {
|
||||
if (action->menu()->title() == em.category) {
|
||||
parent = action->menu();
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
parent = new QMenu(&effects_menu);
|
||||
parent->setTitle(em.category);
|
||||
QMenu* parent = &effects_menu;
|
||||
if (!em.category.isEmpty()) {
|
||||
bool found = false;
|
||||
for (int j=0;j<effects_menu.actions().size();j++) {
|
||||
QAction* action = effects_menu.actions().at(j);
|
||||
if (action->menu() != NULL) {
|
||||
if (action->menu()->title() == em.category) {
|
||||
parent = action->menu();
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
parent = new QMenu(&effects_menu);
|
||||
parent->setTitle(em.category);
|
||||
|
||||
bool found = false;
|
||||
for (int i=0;i<effects_menu.actions().size();i++) {
|
||||
QAction* comp_action = effects_menu.actions().at(i);
|
||||
if (comp_action->text() > em.category) {
|
||||
effects_menu.insertMenu(comp_action, parent);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) effects_menu.addMenu(parent);
|
||||
}
|
||||
}
|
||||
bool found = false;
|
||||
for (int i=0;i<effects_menu.actions().size();i++) {
|
||||
QAction* comp_action = effects_menu.actions().at(i);
|
||||
if (comp_action->text() > em.category) {
|
||||
effects_menu.insertMenu(comp_action, parent);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) effects_menu.addMenu(parent);
|
||||
}
|
||||
}
|
||||
|
||||
bool found = false;
|
||||
for (int i=0;i<parent->actions().size();i++) {
|
||||
QAction* comp_action = parent->actions().at(i);
|
||||
if (comp_action->text() > action->text()) {
|
||||
parent->insertAction(comp_action, action);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) parent->addAction(action);
|
||||
}
|
||||
}
|
||||
bool found = false;
|
||||
for (int i=0;i<parent->actions().size();i++) {
|
||||
QAction* comp_action = parent->actions().at(i);
|
||||
if (comp_action->text() > action->text()) {
|
||||
parent->insertAction(comp_action, action);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) parent->addAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
effects_loaded.unlock();
|
||||
effects_loaded.unlock();
|
||||
|
||||
connect(&effects_menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_select(QAction*)));
|
||||
effects_menu.exec(QCursor::pos());
|
||||
connect(&effects_menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_select(QAction*)));
|
||||
effects_menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void EffectControls::clear_effects(bool clear_cache) {
|
||||
// clear existing clips
|
||||
deselect_all_effects(NULL);
|
||||
|
||||
QVBoxLayout* video_layout = static_cast<QVBoxLayout*>(ui->video_effect_area->layout());
|
||||
QVBoxLayout* audio_layout = static_cast<QVBoxLayout*>(ui->audio_effect_area->layout());
|
||||
QLayoutItem* item;
|
||||
while ((item = video_layout->takeAt(0))) {
|
||||
item->widget()->setParent(NULL);
|
||||
QVBoxLayout* video_layout = static_cast<QVBoxLayout*>(video_effect_area->layout());
|
||||
QVBoxLayout* audio_layout = static_cast<QVBoxLayout*>(audio_effect_area->layout());
|
||||
QLayoutItem* item;
|
||||
while ((item = video_layout->takeAt(0))) {
|
||||
item->widget()->setParent(NULL);
|
||||
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
}
|
||||
while ((item = audio_layout->takeAt(0))) {
|
||||
item->widget()->setParent(NULL);
|
||||
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
}
|
||||
ui->lblMultipleClipsSelected->setVisible(false);
|
||||
ui->vcontainer->setVisible(false);
|
||||
ui->acontainer->setVisible(false);
|
||||
ui->headers->setVisible(false);
|
||||
ui->keyframeView->setEnabled(false);
|
||||
if (clear_cache) selected_clips.clear();
|
||||
setWindowTitle(panel_name + "(none)");
|
||||
}
|
||||
while ((item = audio_layout->takeAt(0))) {
|
||||
item->widget()->setParent(NULL);
|
||||
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
}
|
||||
lblMultipleClipsSelected->setVisible(false);
|
||||
vcontainer->setVisible(false);
|
||||
acontainer->setVisible(false);
|
||||
headers->setVisible(false);
|
||||
keyframeView->setEnabled(false);
|
||||
if (clear_cache) selected_clips.clear();
|
||||
setWindowTitle(panel_name + "(none)");
|
||||
}
|
||||
|
||||
void EffectControls::deselect_all_effects(QWidget* sender) {
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
if (c->effects.at(j)->container != sender) {
|
||||
c->effects.at(j)->container->header_click(false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
if (c->effects.at(j)->container != sender) {
|
||||
c->effects.at(j)->container->header_click(false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
}
|
||||
|
||||
void EffectControls::open_effect(QVBoxLayout* layout, Effect* e) {
|
||||
CollapsibleWidget* container = e->container;
|
||||
layout->addWidget(container);
|
||||
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
CollapsibleWidget* container = e->container;
|
||||
layout->addWidget(container);
|
||||
connect(container, SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
}
|
||||
|
||||
void EffectControls::setup_ui() {
|
||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
|
||||
QWidget* contents = new QWidget();
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout(contents);
|
||||
layout->setSpacing(0);
|
||||
layout->setMargin(0);
|
||||
|
||||
QSplitter* splitter = new QSplitter(contents);
|
||||
splitter->setOrientation(Qt::Horizontal);
|
||||
splitter->setChildrenCollapsible(false);
|
||||
|
||||
scrollArea = new QScrollArea(splitter);
|
||||
scrollArea->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
||||
scrollArea->setFrameShape(QFrame::NoFrame);
|
||||
scrollArea->setFrameShadow(QFrame::Plain);
|
||||
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
|
||||
QWidget* scrollAreaWidgetContents = new QWidget();
|
||||
|
||||
QHBoxLayout* scrollAreaLayout = new QHBoxLayout(scrollAreaWidgetContents);
|
||||
scrollAreaLayout->setSpacing(0);
|
||||
scrollAreaLayout->setMargin(0);
|
||||
|
||||
effects_area = new EffectsArea(scrollAreaWidgetContents);
|
||||
|
||||
QVBoxLayout* effects_area_layout = new QVBoxLayout(effects_area);
|
||||
effects_area_layout->setSpacing(0);
|
||||
effects_area_layout->setMargin(0);
|
||||
|
||||
vcontainer = new QWidget(effects_area);
|
||||
QVBoxLayout* vcontainerLayout = new QVBoxLayout(vcontainer);
|
||||
vcontainerLayout->setSpacing(0);
|
||||
vcontainerLayout->setMargin(0);
|
||||
|
||||
QWidget* veHeader = new QWidget(vcontainer);
|
||||
veHeader->setObjectName(QStringLiteral("veHeader"));
|
||||
veHeader->setStyleSheet(QLatin1String("#veHeader { background: rgba(0, 0, 0, 0.25); }"));
|
||||
|
||||
QHBoxLayout* veHeaderLayout = new QHBoxLayout(veHeader);
|
||||
veHeaderLayout->setSpacing(0);
|
||||
veHeaderLayout->setMargin(0);
|
||||
|
||||
QPushButton* btnAddVideoEffect = new QPushButton(veHeader);
|
||||
btnAddVideoEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||
btnAddVideoEffect->setToolTip("Add Video Effect");
|
||||
veHeaderLayout->addWidget(btnAddVideoEffect);
|
||||
connect(btnAddVideoEffect, SIGNAL(clicked(bool)), this, SLOT(video_effect_click()));
|
||||
|
||||
veHeaderLayout->addStretch();
|
||||
|
||||
QLabel* lblVideoEffects = new QLabel(veHeader);
|
||||
QFont font;
|
||||
font.setPointSize(9);
|
||||
lblVideoEffects->setFont(font);
|
||||
lblVideoEffects->setAlignment(Qt::AlignCenter);
|
||||
lblVideoEffects->setText("VIDEO EFFECTS");
|
||||
veHeaderLayout->addWidget(lblVideoEffects);
|
||||
|
||||
veHeaderLayout->addStretch();
|
||||
|
||||
QPushButton* btnAddVideoTransition = new QPushButton(veHeader);
|
||||
btnAddVideoTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||
btnAddVideoTransition->setToolTip("Add Video Transition");
|
||||
connect(btnAddVideoTransition, SIGNAL(clicked(bool)), this, SLOT(video_transition_click()));
|
||||
|
||||
veHeaderLayout->addWidget(btnAddVideoTransition);
|
||||
|
||||
vcontainerLayout->addWidget(veHeader);
|
||||
|
||||
video_effect_area = new QWidget(vcontainer);
|
||||
QVBoxLayout* veAreaLayout = new QVBoxLayout(video_effect_area);
|
||||
veAreaLayout->setSpacing(0);
|
||||
veAreaLayout->setMargin(0);
|
||||
|
||||
vcontainerLayout->addWidget(video_effect_area);
|
||||
|
||||
effects_area_layout->addWidget(vcontainer);
|
||||
|
||||
acontainer = new QWidget(effects_area);
|
||||
QVBoxLayout* acontainerLayout = new QVBoxLayout(acontainer);
|
||||
acontainerLayout->setSpacing(0);
|
||||
acontainerLayout->setMargin(0);
|
||||
QWidget* aeHeader = new QWidget(acontainer);
|
||||
aeHeader->setObjectName(QStringLiteral("aeHeader"));
|
||||
aeHeader->setStyleSheet(QLatin1String("#aeHeader { background: rgba(0, 0, 0, 0.25); }"));
|
||||
|
||||
QHBoxLayout* aeHeaderLayout = new QHBoxLayout(aeHeader);
|
||||
aeHeaderLayout->setSpacing(0);
|
||||
aeHeaderLayout->setMargin(0);
|
||||
|
||||
QPushButton* btnAddAudioEffect = new QPushButton(aeHeader);
|
||||
btnAddAudioEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||
btnAddAudioEffect->setToolTip("Add Audio Effect");
|
||||
connect(btnAddAudioEffect, SIGNAL(clicked(bool)), this, SLOT(audio_effect_click()));
|
||||
aeHeaderLayout->addWidget(btnAddAudioEffect);
|
||||
|
||||
aeHeaderLayout->addStretch();
|
||||
|
||||
QLabel* lblAudioEffects = new QLabel(aeHeader);
|
||||
lblAudioEffects->setFont(font);
|
||||
lblAudioEffects->setAlignment(Qt::AlignCenter);
|
||||
lblAudioEffects->setText("AUDIO EFFECTS");
|
||||
aeHeaderLayout->addWidget(lblAudioEffects);
|
||||
|
||||
aeHeaderLayout->addStretch();
|
||||
|
||||
QPushButton* btnAddAudioTransition = new QPushButton(aeHeader);
|
||||
btnAddAudioTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||
btnAddAudioTransition->setToolTip("Add Audio Transition");
|
||||
connect(btnAddAudioTransition, SIGNAL(clicked(bool)), this, SLOT(audio_transition_click()));
|
||||
aeHeaderLayout->addWidget(btnAddAudioTransition);
|
||||
|
||||
acontainerLayout->addWidget(aeHeader);
|
||||
|
||||
audio_effect_area = new QWidget(acontainer);
|
||||
QVBoxLayout* aeAreaLayout = new QVBoxLayout(audio_effect_area);
|
||||
aeAreaLayout->setSpacing(0);
|
||||
aeAreaLayout->setMargin(0);
|
||||
|
||||
acontainerLayout->addWidget(audio_effect_area);
|
||||
|
||||
effects_area_layout->addWidget(acontainer);
|
||||
|
||||
lblMultipleClipsSelected = new QLabel(effects_area);
|
||||
lblMultipleClipsSelected->setAlignment(Qt::AlignCenter);
|
||||
lblMultipleClipsSelected->setText("(Multiple clips selected)");
|
||||
effects_area_layout->addWidget(lblMultipleClipsSelected);
|
||||
|
||||
effects_area_layout->addStretch();
|
||||
|
||||
scrollAreaLayout->addWidget(effects_area);
|
||||
|
||||
scrollArea->setWidget(scrollAreaWidgetContents);
|
||||
splitter->addWidget(scrollArea);
|
||||
QWidget* keyframeArea = new QWidget(splitter);
|
||||
QSizePolicy keyframe_sp;
|
||||
keyframe_sp.setHorizontalPolicy(QSizePolicy::Minimum);
|
||||
keyframe_sp.setVerticalPolicy(QSizePolicy::Preferred);
|
||||
keyframe_sp.setHorizontalStretch(1);
|
||||
keyframeArea->setSizePolicy(keyframe_sp);
|
||||
QVBoxLayout* keyframeAreaLayout = new QVBoxLayout(keyframeArea);
|
||||
keyframeAreaLayout->setSpacing(0);
|
||||
keyframeAreaLayout->setMargin(0);
|
||||
headers = new TimelineHeader(keyframeArea);
|
||||
|
||||
keyframeAreaLayout->addWidget(headers);
|
||||
|
||||
QWidget* keyframeCenterWidget = new QWidget(keyframeArea);
|
||||
|
||||
QHBoxLayout* keyframeCenterLayout = new QHBoxLayout(keyframeCenterWidget);
|
||||
keyframeCenterLayout->setSpacing(0);
|
||||
keyframeCenterLayout->setMargin(0);
|
||||
|
||||
keyframeView = new KeyframeView(keyframeCenterWidget);
|
||||
|
||||
keyframeCenterLayout->addWidget(keyframeView);
|
||||
|
||||
verticalScrollBar = new QScrollBar(keyframeCenterWidget);
|
||||
verticalScrollBar->setOrientation(Qt::Vertical);
|
||||
|
||||
keyframeCenterLayout->addWidget(verticalScrollBar);
|
||||
|
||||
|
||||
keyframeAreaLayout->addWidget(keyframeCenterWidget);
|
||||
|
||||
horizontalScrollBar = new ResizableScrollBar(keyframeArea);
|
||||
horizontalScrollBar->setOrientation(Qt::Horizontal);
|
||||
|
||||
keyframeAreaLayout->addWidget(horizontalScrollBar);
|
||||
|
||||
splitter->addWidget(keyframeArea);
|
||||
|
||||
layout->addWidget(splitter);
|
||||
|
||||
setWidget(contents);
|
||||
}
|
||||
|
||||
void EffectControls::load_effects() {
|
||||
ui->lblMultipleClipsSelected->setVisible(multiple);
|
||||
lblMultipleClipsSelected->setVisible(multiple);
|
||||
|
||||
if (!multiple) {
|
||||
if (!multiple) {
|
||||
// load in new clips
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
QVBoxLayout* layout;
|
||||
if (c->track < 0) {
|
||||
ui->vcontainer->setVisible(true);
|
||||
layout = static_cast<QVBoxLayout*>(ui->video_effect_area->layout());
|
||||
vcontainer->setVisible(true);
|
||||
layout = static_cast<QVBoxLayout*>(video_effect_area->layout());
|
||||
} else {
|
||||
ui->acontainer->setVisible(true);
|
||||
layout = static_cast<QVBoxLayout*>(ui->audio_effect_area->layout());
|
||||
acontainer->setVisible(true);
|
||||
layout = static_cast<QVBoxLayout*>(audio_effect_area->layout());
|
||||
}
|
||||
if (mode == TA_NO_TRANSITION) {
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
open_effect(layout, c->effects.at(j));
|
||||
}
|
||||
} else if (mode == TA_OPENING_TRANSITION && c->get_opening_transition() != NULL) {
|
||||
open_effect(layout, c->get_opening_transition());
|
||||
} else if (mode == TA_CLOSING_TRANSITION && c->get_closing_transition() != NULL) {
|
||||
open_effect(layout, c->get_closing_transition());
|
||||
}
|
||||
if (mode == TA_NO_TRANSITION) {
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
open_effect(layout, c->effects.at(j));
|
||||
}
|
||||
} else if (mode == TA_OPENING_TRANSITION && c->get_opening_transition() != NULL) {
|
||||
open_effect(layout, c->get_opening_transition());
|
||||
} else if (mode == TA_CLOSING_TRANSITION && c->get_closing_transition() != NULL) {
|
||||
open_effect(layout, c->get_closing_transition());
|
||||
}
|
||||
}
|
||||
if (selected_clips.size() > 0) {
|
||||
setWindowTitle(panel_name + sequence->clips.at(selected_clips.at(0))->name);
|
||||
ui->verticalScrollBar->setMaximum(qMax(0, ui->effects_area->sizeHint().height() - ui->headers->height() + ui->scrollArea->horizontalScrollBar()->height()/* - ui->keyframeView->height() - ui->headers->height()*/));
|
||||
ui->keyframeView->setEnabled(true);
|
||||
ui->headers->setVisible(true);
|
||||
ui->keyframeView->update();
|
||||
setWindowTitle(panel_name + sequence->clips.at(selected_clips.at(0))->name);
|
||||
verticalScrollBar->setMaximum(qMax(0, effects_area->sizeHint().height() - headers->height() + scrollArea->horizontalScrollBar()->height()/* - keyframeView->height() - headers->height()*/));
|
||||
keyframeView->setEnabled(true);
|
||||
headers->setVisible(true);
|
||||
keyframeView->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EffectControls::delete_effects() {
|
||||
// load in new clips
|
||||
if (mode == TA_NO_TRANSITION) {
|
||||
EffectDeleteCommand* command = new EffectDeleteCommand();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* effect = c->effects.at(j);
|
||||
if (effect->container->selected) {
|
||||
command->clips.append(c);
|
||||
command->fx.append(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (command->clips.size() > 0) {
|
||||
undo_stack.push(command);
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
} else {
|
||||
delete command;
|
||||
}
|
||||
}
|
||||
// load in new clips
|
||||
if (mode == TA_NO_TRANSITION) {
|
||||
EffectDeleteCommand* command = new EffectDeleteCommand();
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* effect = c->effects.at(j);
|
||||
if (effect->container->selected) {
|
||||
command->clips.append(c);
|
||||
command->fx.append(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (command->clips.size() > 0) {
|
||||
undo_stack.push(command);
|
||||
panel_sequence_viewer->viewer_widget->update();
|
||||
} else {
|
||||
delete command;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EffectControls::reload_clips() {
|
||||
clear_effects(false);
|
||||
load_effects();
|
||||
clear_effects(false);
|
||||
load_effects();
|
||||
}
|
||||
|
||||
void EffectControls::set_clips(QVector<int>& clips, int m) {
|
||||
clear_effects(true);
|
||||
clear_effects(true);
|
||||
|
||||
// replace clip vector
|
||||
selected_clips = clips;
|
||||
mode = m;
|
||||
// replace clip vector
|
||||
selected_clips = clips;
|
||||
mode = m;
|
||||
|
||||
load_effects();
|
||||
load_effects();
|
||||
}
|
||||
|
||||
void EffectControls::on_btnAddVideoEffect_clicked() {
|
||||
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_VIDEO);
|
||||
void EffectControls::video_effect_click() {
|
||||
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_VIDEO);
|
||||
}
|
||||
|
||||
void EffectControls::on_btnAddAudioEffect_clicked() {
|
||||
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_AUDIO);
|
||||
void EffectControls::audio_effect_click() {
|
||||
show_effect_menu(EFFECT_TYPE_EFFECT, EFFECT_TYPE_AUDIO);
|
||||
}
|
||||
|
||||
void EffectControls::on_btnAddVideoTransition_clicked() {
|
||||
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_VIDEO);
|
||||
void EffectControls::video_transition_click() {
|
||||
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_VIDEO);
|
||||
}
|
||||
|
||||
void EffectControls::on_btnAddAudioTransition_clicked() {
|
||||
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_AUDIO);
|
||||
void EffectControls::audio_transition_click() {
|
||||
show_effect_menu(EFFECT_TYPE_TRANSITION, EFFECT_TYPE_AUDIO);
|
||||
}
|
||||
|
||||
void EffectControls::resizeEvent(QResizeEvent*) {
|
||||
ui->verticalScrollBar->setMaximum(qMax(0, ui->effects_area->height() - ui->keyframeView->height() - ui->headers->height()));
|
||||
verticalScrollBar->setMaximum(qMax(0, effects_area->height() - keyframeView->height() - headers->height()));
|
||||
}
|
||||
|
||||
bool EffectControls::is_focused() {
|
||||
if (this->hasFocus()) return true;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
if (c != NULL) {
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
if (c->effects.at(j)->container->is_focused()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this->hasFocus()) return true;
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(selected_clips.at(i));
|
||||
if (c != NULL) {
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
if (c->effects.at(j)->container->is_focused()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dout << "[WARNING] Tried to check focus of a NULL clip";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
EffectsArea::EffectsArea(QWidget* parent) : QWidget(parent) {}
|
||||
|
||||
+37
-24
@@ -11,6 +11,10 @@ class TimelineHeader;
|
||||
class QScrollArea;
|
||||
class KeyframeView;
|
||||
class QVBoxLayout;
|
||||
class ResizableScrollBar;
|
||||
class QLabel;
|
||||
class KeyframeView;
|
||||
class QScrollBar;
|
||||
|
||||
class EffectsArea : public QWidget {
|
||||
public:
|
||||
@@ -21,10 +25,6 @@ public:
|
||||
TimelineHeader* header;
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class EffectControls;
|
||||
}
|
||||
|
||||
class EffectControls : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -32,45 +32,58 @@ class EffectControls : public QDockWidget
|
||||
public:
|
||||
explicit EffectControls(QWidget *parent = 0);
|
||||
~EffectControls();
|
||||
void set_clips(QVector<int>& clips, int mode);
|
||||
void clear_effects(bool clear_cache);
|
||||
void delete_effects();
|
||||
bool is_focused();
|
||||
void reload_clips();
|
||||
void set_clips(QVector<int>& clips, int mode);
|
||||
void clear_effects(bool clear_cache);
|
||||
void delete_effects();
|
||||
bool is_focused();
|
||||
void reload_clips();
|
||||
void set_zoom(bool in);
|
||||
bool keyframe_focus();
|
||||
void delete_selected_keyframes();
|
||||
void copy(bool del);
|
||||
void copy(bool del);
|
||||
bool multiple;
|
||||
|
||||
QVector<int> selected_clips;
|
||||
|
||||
double zoom;
|
||||
|
||||
Ui::EffectControls *ui;
|
||||
ResizableScrollBar* horizontalScrollBar;
|
||||
QScrollBar* verticalScrollBar;
|
||||
public slots:
|
||||
void update_keyframes();
|
||||
void update_keyframes();
|
||||
private slots:
|
||||
void menu_select(QAction* q);
|
||||
void menu_select(QAction* q);
|
||||
|
||||
void on_btnAddVideoEffect_clicked();
|
||||
void on_btnAddAudioEffect_clicked();
|
||||
void on_btnAddVideoTransition_clicked();
|
||||
void on_btnAddAudioTransition_clicked();
|
||||
void video_effect_click();
|
||||
void audio_effect_click();
|
||||
void video_transition_click();
|
||||
void audio_transition_click();
|
||||
|
||||
void deselect_all_effects(QWidget*);
|
||||
void deselect_all_effects(QWidget*);
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
private:
|
||||
void show_effect_menu(int type, int subtype);
|
||||
void show_effect_menu(int type, int subtype);
|
||||
void load_effects();
|
||||
void load_keyframes();
|
||||
void open_effect(QVBoxLayout* layout, Effect* e);
|
||||
void open_effect(QVBoxLayout* layout, Effect* e);
|
||||
|
||||
int effect_menu_type;
|
||||
int effect_menu_subtype;
|
||||
QString panel_name;
|
||||
int mode;
|
||||
void setup_ui();
|
||||
|
||||
int effect_menu_type;
|
||||
int effect_menu_subtype;
|
||||
QString panel_name;
|
||||
int mode;
|
||||
|
||||
TimelineHeader* headers;
|
||||
EffectsArea* effects_area;
|
||||
QScrollArea* scrollArea;
|
||||
QLabel* lblMultipleClipsSelected;
|
||||
KeyframeView* keyframeView;
|
||||
QWidget* video_effect_area;
|
||||
QWidget* audio_effect_area;
|
||||
QWidget* vcontainer;
|
||||
QWidget* acontainer;
|
||||
};
|
||||
|
||||
#endif // EFFECTCONTROLS_H
|
||||
|
||||
@@ -1,554 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EffectControls</class>
|
||||
<widget class="QDockWidget" name="EffectControls">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>621</width>
|
||||
<height>510</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::AllDockWidgetFeatures</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Effect Controls</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>189</width>
|
||||
<height>483</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="EffectsArea" name="effects_area" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="vcontainer" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="veHeader" native="true">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#veHeader {
|
||||
background: rgba(0, 0, 0, 0.25);
|
||||
}</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnAddVideoEffect">
|
||||
<property name="toolTip">
|
||||
<string>Add Video Effect</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/add-effect.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hsLeftVideoEffects">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblVideoEffects">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>VIDEO EFFECTS</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hsRightVideoEffects">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnAddVideoTransition">
|
||||
<property name="toolTip">
|
||||
<string>Add Video Transition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/add-transition.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="video_effect_area" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="acontainer" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="aeHeader" native="true">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#aeHeader {
|
||||
background: rgba(0, 0, 0, 0.25);
|
||||
}</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnAddAudioEffect">
|
||||
<property name="toolTip">
|
||||
<string>Add Audio Effect</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/add-effect.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hsLeftAudioEffects">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblAudioEffects">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AUDIO EFFECTS</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="hsRightAudioEffects">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnAddAudioTransition">
|
||||
<property name="toolTip">
|
||||
<string>Add Audio Transition</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/add-transition.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="audio_effect_area" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblMultipleClipsSelected">
|
||||
<property name="text">
|
||||
<string>(Multiple clips selected)</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="keyframeArea" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TimelineHeader" name="headers" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="keyframeCenterWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="KeyframeView" name="keyframeView" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollBar" name="verticalScrollBar">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1826</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ResizableScrollBar" name="horizontalScrollBar">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1826</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KeyframeView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui/keyframeview.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TimelineHeader</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui/timelineheader.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>EffectsArea</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>panels/effectcontrols.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ResizableScrollBar</class>
|
||||
<extends>QScrollBar</extends>
|
||||
<header>ui/resizablescrollbar.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+576
-578
File diff suppressed because it is too large
Load Diff
+46
-50
@@ -27,10 +27,6 @@ class SourcesCommon;
|
||||
#define LOAD_TYPE_VERSION 69
|
||||
#define LOAD_TYPE_URL 70
|
||||
|
||||
namespace Ui {
|
||||
class Project;
|
||||
}
|
||||
|
||||
extern QString autorecovery_filename;
|
||||
extern QString project_url;
|
||||
extern QStringList recent_projects;
|
||||
@@ -48,81 +44,81 @@ class Project : public QDockWidget {
|
||||
public:
|
||||
explicit Project(QWidget *parent = 0);
|
||||
~Project();
|
||||
bool is_focused();
|
||||
bool is_focused();
|
||||
void clear();
|
||||
Media* new_sequence(ComboAction *ca, Sequence* s, bool open, Media* parent);
|
||||
QString get_next_sequence_name(QString start = 0);
|
||||
void process_file_list(QStringList& files, bool recursive = false, Media* replace = NULL, Media *parent = NULL);
|
||||
void replace_media(Media* item, QString filename);
|
||||
Media *get_selected_folder();
|
||||
bool reveal_media(Media *media, QModelIndex parent = QModelIndex());
|
||||
void add_recent_project(QString url);
|
||||
Media* new_sequence(ComboAction *ca, Sequence* s, bool open, Media* parent);
|
||||
QString get_next_sequence_name(QString start = 0);
|
||||
void process_file_list(QStringList& files, bool recursive = false, Media* replace = NULL, Media *parent = NULL);
|
||||
void replace_media(Media* item, QString filename);
|
||||
Media *get_selected_folder();
|
||||
bool reveal_media(Media *media, QModelIndex parent = QModelIndex());
|
||||
void add_recent_project(QString url);
|
||||
|
||||
void new_project();
|
||||
void load_project(bool autorecovery);
|
||||
void save_project(bool autorecovery);
|
||||
void new_project();
|
||||
void load_project(bool autorecovery);
|
||||
void save_project(bool autorecovery);
|
||||
|
||||
Media* new_folder(QString name);
|
||||
Media* item_to_media(const QModelIndex& index);
|
||||
Media* new_folder(QString name);
|
||||
Media* item_to_media(const QModelIndex& index);
|
||||
|
||||
void save_recent_projects();
|
||||
void save_recent_projects();
|
||||
|
||||
QVector<Media*> list_all_project_sequences();
|
||||
QVector<Media*> list_all_project_sequences();
|
||||
|
||||
SourceTable* tree_view;
|
||||
SourceIconView* icon_view;
|
||||
SourcesCommon* sources_common;
|
||||
SourceTable* tree_view;
|
||||
SourceIconView* icon_view;
|
||||
SourcesCommon* sources_common;
|
||||
|
||||
QSortFilterProxyModel* sorter;
|
||||
QSortFilterProxyModel* sorter;
|
||||
|
||||
QVector<Media*> last_imported_media;
|
||||
QVector<Media*> last_imported_media;
|
||||
|
||||
//Media *new_item();
|
||||
QModelIndexList get_current_selected();
|
||||
|
||||
void start_preview_generator(Media* item, bool replacing);
|
||||
void get_all_media_from_table(QList<Media *> &items, QList<Media *> &list, int type = -1);
|
||||
public slots:
|
||||
void import_dialog();
|
||||
void delete_selected_media();
|
||||
void duplicate_selected();
|
||||
void delete_selected_media();
|
||||
void duplicate_selected();
|
||||
void delete_clips_using_selected_media();
|
||||
void replace_selected_file();
|
||||
void replace_clip_media();
|
||||
void open_properties();
|
||||
private:
|
||||
void save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex &parent = QModelIndex());
|
||||
int folder_id;
|
||||
int media_id;
|
||||
int sequence_id;
|
||||
void get_all_media_from_table(QList<Media *> items, QList<Media *> &list, int type);
|
||||
void list_all_sequences_worker(QVector<Media *> *list, Media* parent);
|
||||
void save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex &parent = QModelIndex());
|
||||
int folder_id;
|
||||
int media_id;
|
||||
int sequence_id;
|
||||
void list_all_sequences_worker(QVector<Media *> *list, Media* parent);
|
||||
QString get_file_name_from_path(const QString &path);
|
||||
QDir proj_dir;
|
||||
QWidget* icon_view_container;
|
||||
QPushButton* directory_up;
|
||||
QDir proj_dir;
|
||||
QWidget* icon_view_container;
|
||||
QPushButton* directory_up;
|
||||
private slots:
|
||||
void update_view_type();
|
||||
void set_icon_view();
|
||||
void set_tree_view();
|
||||
void update_view_type();
|
||||
void set_icon_view();
|
||||
void set_tree_view();
|
||||
void clear_recent_projects();
|
||||
void set_icon_view_size(int);
|
||||
void set_up_dir_enabled();
|
||||
void go_up_dir();
|
||||
void set_icon_view_size(int);
|
||||
void set_up_dir_enabled();
|
||||
void go_up_dir();
|
||||
};
|
||||
|
||||
class MediaThrobber : public QObject {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
MediaThrobber(Media*);
|
||||
MediaThrobber(Media*);
|
||||
public slots:
|
||||
void start();
|
||||
void start();
|
||||
void stop(int, bool replace);
|
||||
private slots:
|
||||
void animation_update();
|
||||
void animation_update();
|
||||
private:
|
||||
QPixmap pixmap;
|
||||
int animation;
|
||||
Media* item;
|
||||
QTimer* animator;
|
||||
QPixmap pixmap;
|
||||
int animation;
|
||||
Media* item;
|
||||
QTimer* animator;
|
||||
};
|
||||
|
||||
#endif // PROJECT_H
|
||||
|
||||
+1064
-866
File diff suppressed because it is too large
Load Diff
+116
-114
@@ -24,6 +24,11 @@ class ComboAction;
|
||||
class Effect;
|
||||
class Media;
|
||||
class Transition;
|
||||
class TimelineHeader;
|
||||
class TimelineWidget;
|
||||
class ResizableScrollBar;
|
||||
class AudioMonitor;
|
||||
class QScrollBar;
|
||||
struct EffectMeta;
|
||||
struct Sequence;
|
||||
struct Clip;
|
||||
@@ -35,10 +40,11 @@ int getScreenPointFromFrame(double zoom, long frame);
|
||||
long getFrameFromScreenPoint(double zoom, int x);
|
||||
void draw_selection_rectangle(QPainter& painter, const QRect& rect);
|
||||
bool selection_contains_transition(const Selection& s, Clip* c, int type);
|
||||
void move_clip(ComboAction *ca, Clip *c, long iin, long iout, long iclip_in, int itrack, bool verify_transitions = true);
|
||||
void move_clip(ComboAction *ca, Clip *c, long iin, long iout, long iclip_in, int itrack, bool verify_transitions = true, bool relative = false);
|
||||
void ripple_clips(ComboAction *ca, Sequence* s, long point, long length, const QVector<int>& ignore = QVector<int>());
|
||||
|
||||
struct Ghost {
|
||||
int clip;
|
||||
int clip;
|
||||
long in;
|
||||
long out;
|
||||
int track;
|
||||
@@ -50,23 +56,19 @@ struct Ghost {
|
||||
long old_clip_in;
|
||||
|
||||
// importing variables
|
||||
Media* media;
|
||||
int media_stream;
|
||||
Media* media;
|
||||
int media_stream;
|
||||
|
||||
// other variables
|
||||
long ghost_length;
|
||||
long media_length;
|
||||
bool trim_in;
|
||||
bool trimming;
|
||||
bool trim_in;
|
||||
bool trimming;
|
||||
|
||||
// transition trimming
|
||||
Transition* transition;
|
||||
Transition* transition;
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class Timeline;
|
||||
}
|
||||
|
||||
class Timeline : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -74,35 +76,31 @@ public:
|
||||
explicit Timeline(QWidget *parent = 0);
|
||||
~Timeline();
|
||||
|
||||
bool focused();
|
||||
void set_zoom(bool in);
|
||||
void copy(bool del);
|
||||
void paste(bool insert);
|
||||
void deselect();
|
||||
Clip* split_clip(ComboAction* ca, int p, long frame);
|
||||
Clip* split_clip(ComboAction* ca, int p, long frame, long post_in);
|
||||
bool split_selection(ComboAction* ca);
|
||||
void split_at_playhead();
|
||||
bool split_all_clips_at_point(ComboAction *ca, long point);
|
||||
bool split_clip_and_relink(ComboAction* ca, int clip, long frame, bool relink);
|
||||
void clean_up_selections(QVector<Selection>& areas);
|
||||
bool focused();
|
||||
void set_zoom(bool in);
|
||||
void copy(bool del);
|
||||
void paste(bool insert);
|
||||
Clip* split_clip(ComboAction* ca, int p, long frame);
|
||||
Clip* split_clip(ComboAction* ca, int p, long frame, long post_in);
|
||||
bool split_selection(ComboAction* ca);
|
||||
bool split_all_clips_at_point(ComboAction *ca, long point);
|
||||
bool split_clip_and_relink(ComboAction* ca, int clip, long frame, bool relink);
|
||||
void clean_up_selections(QVector<Selection>& areas);
|
||||
void deselect_area(long in, long out, int track);
|
||||
void delete_areas_and_relink(ComboAction *ca, QVector<Selection>& areas);
|
||||
void relink_clips_using_ids(QVector<int>& old_clips, QVector<Clip*>& new_clips);
|
||||
void update_sequence();
|
||||
void increase_track_height();
|
||||
void decrease_track_height();
|
||||
void add_transition();
|
||||
QVector<int> get_tracks_of_linked_clips(int i);
|
||||
bool has_clip_been_split(int c);
|
||||
void toggle_links();
|
||||
void delete_areas_and_relink(ComboAction *ca, QVector<Selection>& areas);
|
||||
void relink_clips_using_ids(QVector<int>& old_clips, QVector<Clip*>& new_clips);
|
||||
void update_sequence();
|
||||
void increase_track_height();
|
||||
void decrease_track_height();
|
||||
void add_transition();
|
||||
QVector<int> get_tracks_of_linked_clips(int i);
|
||||
bool has_clip_been_split(int c);
|
||||
void ripple_to_in_point(bool in, bool ripple);
|
||||
void delete_in_out(bool ripple);
|
||||
void delete_in_out(bool ripple);
|
||||
void previous_cut();
|
||||
void next_cut();
|
||||
void toggle_show_all();
|
||||
|
||||
void create_ghosts_from_media(Sequence *seq, long entry_point, QVector<Media *> &media_list);
|
||||
void create_ghosts_from_media(Sequence *seq, long entry_point, QVector<Media *> &media_list);
|
||||
void add_clips_from_ghosts(ComboAction *ca, Sequence *s);
|
||||
|
||||
int getTimelineScreenPointFromFrame(long frame);
|
||||
@@ -111,141 +109,145 @@ public:
|
||||
long getDisplayFrameFromScreenPoint(int x);
|
||||
|
||||
int get_snap_range();
|
||||
bool snap_to_point(long point, long* l);
|
||||
bool snap_to_point(long point, long* l);
|
||||
bool snap_to_timeline(long* l, bool use_playhead, bool use_markers, bool use_workarea);
|
||||
void set_marker();
|
||||
|
||||
// shared information
|
||||
// shared information
|
||||
int tool;
|
||||
long cursor_frame;
|
||||
int cursor_track;
|
||||
double zoom;
|
||||
bool zoom_just_changed;
|
||||
long cursor_frame;
|
||||
int cursor_track;
|
||||
double zoom;
|
||||
bool zoom_just_changed;
|
||||
long drag_frame_start;
|
||||
int drag_track_start;
|
||||
void update_effect_controls();
|
||||
bool showing_all;
|
||||
double old_zoom;
|
||||
|
||||
QVector<int> video_track_heights;
|
||||
QVector<int> audio_track_heights;
|
||||
int get_track_height_size(bool video);
|
||||
int calculate_track_height(int track, int height);
|
||||
QVector<int> video_track_heights;
|
||||
QVector<int> audio_track_heights;
|
||||
int get_track_height_size(bool video);
|
||||
int calculate_track_height(int track, int height);
|
||||
|
||||
// snapping
|
||||
bool snapping;
|
||||
bool snapped;
|
||||
long snap_point;
|
||||
// snapping
|
||||
bool snapping;
|
||||
bool snapped;
|
||||
long snap_point;
|
||||
|
||||
// selecting functions
|
||||
bool selecting;
|
||||
int selection_offset;
|
||||
bool is_clip_selected(Clip* clip, bool containing);
|
||||
int selection_offset;
|
||||
bool is_clip_selected(Clip* clip, bool containing);
|
||||
void delete_selection(QVector<Selection> &selections, bool ripple);
|
||||
void select_all();
|
||||
bool rect_select_init;
|
||||
bool rect_select_proc;
|
||||
int rect_select_x;
|
||||
int rect_select_y;
|
||||
int rect_select_w;
|
||||
int rect_select_h;
|
||||
bool rect_select_init;
|
||||
bool rect_select_proc;
|
||||
int rect_select_x;
|
||||
int rect_select_y;
|
||||
int rect_select_w;
|
||||
int rect_select_h;
|
||||
|
||||
// moving
|
||||
bool moving_init;
|
||||
bool moving_proc;
|
||||
QVector<Ghost> ghosts;
|
||||
bool video_ghosts;
|
||||
bool audio_ghosts;
|
||||
QVector<Ghost> ghosts;
|
||||
bool video_ghosts;
|
||||
bool audio_ghosts;
|
||||
bool move_insert;
|
||||
|
||||
// trimming
|
||||
int trim_target;
|
||||
bool trim_in_point;
|
||||
bool trim_in_point;
|
||||
int transition_select;
|
||||
|
||||
// splitting
|
||||
bool splitting;
|
||||
QVector<int> split_tracks;
|
||||
QVector<int> split_cache;
|
||||
QVector<int> split_tracks;
|
||||
QVector<int> split_cache;
|
||||
|
||||
// importing
|
||||
bool importing;
|
||||
bool importing;
|
||||
bool importing_files;
|
||||
|
||||
// creating variables
|
||||
bool creating;
|
||||
int creating_object;
|
||||
|
||||
// transition variables
|
||||
bool transition_tool_init;
|
||||
bool transition_tool_proc;
|
||||
int transition_tool_pre_clip;
|
||||
int transition_tool_post_clip;
|
||||
int transition_tool_type;
|
||||
// transition variables
|
||||
bool transition_tool_init;
|
||||
bool transition_tool_proc;
|
||||
int transition_tool_pre_clip;
|
||||
int transition_tool_post_clip;
|
||||
int transition_tool_type;
|
||||
const EffectMeta* transition_tool_meta;
|
||||
int transition_tool_side;
|
||||
|
||||
// hand tool variables
|
||||
bool hand_moving;
|
||||
int drag_x_start;
|
||||
int drag_y_start;
|
||||
// hand tool variables
|
||||
bool hand_moving;
|
||||
int drag_x_start;
|
||||
int drag_y_start;
|
||||
|
||||
bool block_repaints;
|
||||
bool block_repaints;
|
||||
|
||||
Ui::Timeline *ui;
|
||||
TimelineHeader* headers;
|
||||
AudioMonitor* audio_monitor;
|
||||
ResizableScrollBar* horizontalScrollBar;
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
QPushButton* toolArrowButton;
|
||||
QPushButton* toolEditButton;
|
||||
QPushButton* toolRippleButton;
|
||||
QPushButton* toolRazorButton;
|
||||
QPushButton* toolSlipButton;
|
||||
QPushButton* toolSlideButton;
|
||||
QPushButton* toolHandButton;
|
||||
QPushButton* toolTransitionButton;
|
||||
QPushButton* snappingButton;
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
public slots:
|
||||
void repaint_timeline();
|
||||
void toggle_show_all();
|
||||
void deselect();
|
||||
void toggle_links();
|
||||
void split_at_playhead();
|
||||
|
||||
private slots:
|
||||
|
||||
void on_pushButton_4_clicked();
|
||||
|
||||
void on_pushButton_5_clicked();
|
||||
|
||||
void on_snappingButton_toggled(bool checked);
|
||||
|
||||
void on_toolSlideButton_clicked();
|
||||
|
||||
void on_toolArrowButton_clicked();
|
||||
|
||||
void on_toolEditButton_clicked();
|
||||
|
||||
void on_toolRippleButton_clicked();
|
||||
|
||||
void on_toolRollingButton_clicked();
|
||||
|
||||
void on_toolRazorButton_clicked();
|
||||
|
||||
void on_toolSlipButton_clicked();
|
||||
|
||||
void on_addButton_clicked();
|
||||
|
||||
void addMenuItem(QAction*);
|
||||
|
||||
void zoom_in();
|
||||
void zoom_out();
|
||||
void snapping_clicked(bool checked);
|
||||
void add_btn_click();
|
||||
void add_menu_item(QAction*);
|
||||
void setScroll(int);
|
||||
|
||||
void on_recordButton_clicked();
|
||||
|
||||
void on_toolTransitionButton_clicked();
|
||||
|
||||
void record_btn_click();
|
||||
void transition_tool_click();
|
||||
void transition_menu_select(QAction*);
|
||||
|
||||
void resize_move(double d);
|
||||
|
||||
void on_toolHandButton_clicked();
|
||||
void resize_move(double d);
|
||||
void set_tool();
|
||||
|
||||
private:
|
||||
void set_zoom_value(double v);
|
||||
QVector<QPushButton*> tool_buttons;
|
||||
void decheck_tool_buttons(QObject* sender);
|
||||
void set_tool(int tool);
|
||||
void set_tool(int tool);
|
||||
long last_frame;
|
||||
int scroll;
|
||||
void set_sb_max();
|
||||
int scroll;
|
||||
void set_sb_max();
|
||||
|
||||
void setup_ui();
|
||||
|
||||
int default_track_height;
|
||||
|
||||
QWidget* timeline_area;
|
||||
TimelineWidget* video_area;
|
||||
TimelineWidget* audio_area;
|
||||
QWidget* editAreas;
|
||||
QScrollBar* videoScrollbar;
|
||||
QScrollBar* audioScrollbar;
|
||||
QPushButton* zoomInButton;
|
||||
QPushButton* zoomOutButton;
|
||||
QPushButton* recordButton;
|
||||
QPushButton* addButton;
|
||||
};
|
||||
|
||||
#endif // TIMELINE_H
|
||||
|
||||
@@ -1,538 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Timeline</class>
|
||||
<widget class="QDockWidget" name="Timeline">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>901</width>
|
||||
<height>592</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Timeline</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toolArrowButton">
|
||||
<property name="toolTip">
|
||||
<string>Pointer Tool (V)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons/icons.qrc">
|
||||
<normaloff>:/icons/arrow.png</normaloff>
|
||||
<disabledoff>:/icons/arrow-disabled.png</disabledoff>:/icons/arrow.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toolEditButton">
|
||||
<property name="toolTip">
|
||||
<string>Edit Tool (X)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons/icons.qrc">
|
||||
<normaloff>:/icons/beam.png</normaloff>
|
||||
<disabledoff>:/icons/beam-disabled.png</disabledoff>:/icons/beam.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toolRippleButton">
|
||||
<property name="toolTip">
|
||||
<string>Ripple Tool (B)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons/icons.qrc">
|
||||
<normaloff>:/icons/ripple.png</normaloff>
|
||||
<disabledoff>:/icons/ripple-disabled.png</disabledoff>:/icons/ripple.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toolRollingButton">
|
||||
<property name="toolTip">
|
||||
<string>Rolling Tool (N)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons/icons.qrc">
|
||||
<normaloff>:/icons/rolling.png</normaloff>
|
||||
<disabledoff>:/icons/rolling-disabled.png</disabledoff>:/icons/rolling.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toolRazorButton">
|
||||
<property name="toolTip">
|
||||
<string>Razor Tool (C)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons/icons.qrc">
|
||||
<normaloff>:/icons/razor.png</normaloff>
|
||||
<disabledoff>:/icons/razor-disabled.png</disabledoff>:/icons/razor.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toolSlipButton">
|
||||
<property name="toolTip">
|
||||
<string>Slip Tool (Y)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/slip.png</normalon>
|
||||
<disabledon>:/icons/slip-disabled.png</disabledon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toolSlideButton">
|
||||
<property name="toolTip">
|
||||
<string>Slide Tool (U)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/slide.png</normalon>
|
||||
<disabledon>:/icons/slide-disabled.png</disabledon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toolHandButton">
|
||||
<property name="toolTip">
|
||||
<string>Hand Tool (H)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/hand.png</normalon>
|
||||
<disabledon>:/icons/hand-disabled.png</disabledon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="toolTransitionButton">
|
||||
<property name="toolTip">
|
||||
<string>Transition Tool (T)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/transition-tool.png</normalon>
|
||||
<disabledon>:/icons/transition-tool-disabled.png</disabledon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="snappingButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/magnet.png</normalon>
|
||||
<disabledon>:/icons/magnet-disabled.png</disabledon>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="toolTip">
|
||||
<string>Zoom In (=)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/zoomin.png</normalon>
|
||||
<disabledon>:/icons/zoomin-disabled.png</disabledon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<property name="toolTip">
|
||||
<string>Zoom Out (-)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/zoomout.png</normalon>
|
||||
<disabledon>:/icons/zoomout-disabled.png</disabledon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="recordButton">
|
||||
<property name="toolTip">
|
||||
<string>Record audio</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/record.png</normalon>
|
||||
<disabledon>:/icons/record-disabled.png</disabledon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="toolTip">
|
||||
<string>Add title, solid, bars, etc.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/add-button.png</normalon>
|
||||
<disabledon>:/icons/add-button-disabled.png</disabledon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="timeline_area" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TimelineHeader" name="headers" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="editAreas" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="videoContainer" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TimelineWidget" name="video_area" native="true">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollBar" name="videoScrollbar">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1826</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="audioContainer" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TimelineWidget" name="audio_area" native="true">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::ClickFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollBar" name="audioScrollbar">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1826</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ResizableScrollBar" name="horizontalScrollBar">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1826</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="AudioMonitor" name="audio_monitor" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>TimelineHeader</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui/timelineheader.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>TimelineWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui/timelinewidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>AudioMonitor</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui/audiomonitor.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ResizableScrollBar</class>
|
||||
<extends>QScrollBar</extends>
|
||||
<header>ui/resizablescrollbar.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../icons/icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
+378
-275
@@ -1,5 +1,4 @@
|
||||
#include "viewer.h"
|
||||
#include "ui_viewer.h"
|
||||
|
||||
#include "playback/audio.h"
|
||||
#include "timeline.h"
|
||||
@@ -12,9 +11,12 @@
|
||||
#include "project/media.h"
|
||||
#include "project/undo.h"
|
||||
#include "ui/audiomonitor.h"
|
||||
#include "ui_timeline.h"
|
||||
#include "playback/playback.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "ui/viewercontainer.h"
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/timelineheader.h"
|
||||
#include "ui/resizablescrollbar.h"
|
||||
#include "debug.h"
|
||||
|
||||
#define FRAMES_IN_ONE_MINUTE 1798 // 1800 - 2
|
||||
@@ -30,64 +32,64 @@ extern "C" {
|
||||
#include <QPainter>
|
||||
#include <QStringList>
|
||||
#include <QTimer>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
Viewer::Viewer(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
QDockWidget(parent),
|
||||
playing(false),
|
||||
just_played(false),
|
||||
media(NULL),
|
||||
seq(NULL),
|
||||
ui(new Ui::Viewer),
|
||||
created_sequence(false),
|
||||
cue_recording_internal(false),
|
||||
panel_name("Viewer: "),
|
||||
minimum_zoom(1.0)
|
||||
just_played(false),
|
||||
media(NULL),
|
||||
seq(NULL),
|
||||
created_sequence(false),
|
||||
cue_recording_internal(false),
|
||||
panel_name("Viewer: "),
|
||||
minimum_zoom(1.0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->headers->viewer = this;
|
||||
ui->headers->snapping = false;
|
||||
ui->headers->show_text(false);
|
||||
ui->glViewerPane->viewer = this;
|
||||
viewer_widget = ui->glViewerPane->child;
|
||||
viewer_widget->viewer = this;
|
||||
set_media(NULL);
|
||||
setup_ui();
|
||||
|
||||
ui->currentTimecode->setEnabled(false);
|
||||
ui->currentTimecode->set_minimum_value(0);
|
||||
ui->currentTimecode->set_default_value(qSNaN());
|
||||
ui->currentTimecode->set_value(0, false);
|
||||
ui->currentTimecode->set_display_type(LABELSLIDER_FRAMENUMBER);
|
||||
connect(ui->currentTimecode, SIGNAL(valueChanged()), this, SLOT(update_playhead()));
|
||||
headers->viewer = this;
|
||||
headers->snapping = false;
|
||||
headers->show_text(false);
|
||||
glViewerPane->viewer = this;
|
||||
viewer_widget = glViewerPane->child;
|
||||
viewer_widget->viewer = this;
|
||||
set_media(NULL);
|
||||
|
||||
currentTimecode->setEnabled(false);
|
||||
currentTimecode->set_minimum_value(0);
|
||||
currentTimecode->set_default_value(qSNaN());
|
||||
currentTimecode->set_value(0, false);
|
||||
currentTimecode->set_display_type(LABELSLIDER_FRAMENUMBER);
|
||||
connect(currentTimecode, SIGNAL(valueChanged()), this, SLOT(update_playhead()));
|
||||
|
||||
recording_flasher.setInterval(500);
|
||||
|
||||
connect(&playback_updater, SIGNAL(timeout()), this, SLOT(timer_update()));
|
||||
connect(&recording_flasher, SIGNAL(timeout()), this, SLOT(recording_flasher_update()));
|
||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), ui->headers, SLOT(set_scroll(int)));
|
||||
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), viewer_widget, SLOT(set_waveform_scroll(int)));
|
||||
connect(ui->horizontalScrollBar, SIGNAL(resize_move(double)), this, SLOT(resize_move(double)));
|
||||
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), headers, SLOT(set_scroll(int)));
|
||||
connect(horizontalScrollBar, SIGNAL(valueChanged(int)), viewer_widget, SLOT(set_waveform_scroll(int)));
|
||||
connect(horizontalScrollBar, SIGNAL(resize_move(double)), this, SLOT(resize_move(double)));
|
||||
|
||||
update_playhead_timecode(0);
|
||||
update_end_timecode();
|
||||
update_playhead_timecode(0);
|
||||
update_end_timecode();
|
||||
}
|
||||
|
||||
Viewer::~Viewer() {
|
||||
delete ui;
|
||||
}
|
||||
Viewer::~Viewer() {}
|
||||
|
||||
bool Viewer::is_focused() {
|
||||
return ui->headers->hasFocus()
|
||||
|| viewer_widget->hasFocus()
|
||||
|| ui->btnSkipToStart->hasFocus()
|
||||
|| ui->btnRewind->hasFocus()
|
||||
|| ui->btnPlay->hasFocus()
|
||||
|| ui->btnFastForward->hasFocus()
|
||||
|| ui->btnSkipToEnd->hasFocus();
|
||||
return headers->hasFocus()
|
||||
|| viewer_widget->hasFocus()
|
||||
|| btnSkipToStart->hasFocus()
|
||||
|| btnRewind->hasFocus()
|
||||
|| btnPlay->hasFocus()
|
||||
|| btnFastForward->hasFocus()
|
||||
|| btnSkipToEnd->hasFocus();
|
||||
}
|
||||
|
||||
void Viewer::set_main_sequence() {
|
||||
clean_created_seq();
|
||||
set_sequence(true, sequence);
|
||||
set_sequence(true, sequence);
|
||||
}
|
||||
|
||||
void Viewer::reset_all_audio() {
|
||||
@@ -101,43 +103,43 @@ void Viewer::reset_all_audio() {
|
||||
if (c != NULL) c->reset_audio();
|
||||
}
|
||||
}
|
||||
clear_audio_ibuffer();
|
||||
clear_audio_ibuffer();
|
||||
}
|
||||
|
||||
long timecode_to_frame(const QString& s, int view, double frame_rate) {
|
||||
QList<QString> list = s.split(QRegExp("[:;]"));
|
||||
QList<QString> list = s.split(QRegExp("[:;]"));
|
||||
|
||||
if (view == TIMECODE_FRAMES || (list.size() == 1 && view != TIMECODE_MILLISECONDS)) {
|
||||
if (view == TIMECODE_FRAMES || (list.size() == 1 && view != TIMECODE_MILLISECONDS)) {
|
||||
return s.toLong();
|
||||
}
|
||||
|
||||
int frRound = qRound(frame_rate);
|
||||
int hours, minutes, seconds, frames;
|
||||
int hours, minutes, seconds, frames;
|
||||
|
||||
if (view == TIMECODE_MILLISECONDS) {
|
||||
long milliseconds = s.toLong();
|
||||
if (view == TIMECODE_MILLISECONDS) {
|
||||
long milliseconds = s.toLong();
|
||||
|
||||
hours = milliseconds/3600000;
|
||||
milliseconds -= (hours*3600000);
|
||||
minutes = milliseconds/60000;
|
||||
milliseconds -= (minutes*60000);
|
||||
seconds = milliseconds/1000;
|
||||
milliseconds -= (seconds*1000);
|
||||
frames = qRound64((milliseconds*0.001)*frame_rate);
|
||||
hours = milliseconds/3600000;
|
||||
milliseconds -= (hours*3600000);
|
||||
minutes = milliseconds/60000;
|
||||
milliseconds -= (minutes*60000);
|
||||
seconds = milliseconds/1000;
|
||||
milliseconds -= (seconds*1000);
|
||||
frames = qRound64((milliseconds*0.001)*frame_rate);
|
||||
|
||||
seconds = qRound64(seconds * frame_rate);
|
||||
minutes = qRound64(minutes * frame_rate * 60);
|
||||
hours = qRound64(hours * frame_rate * 3600);
|
||||
} else {
|
||||
hours = ((list.size() > 0) ? list.at(0).toInt() : 0) * frRound * 3600;
|
||||
minutes = ((list.size() > 1) ? list.at(1).toInt() : 0) * frRound * 60;
|
||||
seconds = ((list.size() > 2) ? list.at(2).toInt() : 0) * frRound;
|
||||
frames = (list.size() > 3) ? list.at(3).toInt() : 0;
|
||||
}
|
||||
seconds = qRound64(seconds * frame_rate);
|
||||
minutes = qRound64(minutes * frame_rate * 60);
|
||||
hours = qRound64(hours * frame_rate * 3600);
|
||||
} else {
|
||||
hours = ((list.size() > 0) ? list.at(0).toInt() : 0) * frRound * 3600;
|
||||
minutes = ((list.size() > 1) ? list.at(1).toInt() : 0) * frRound * 60;
|
||||
seconds = ((list.size() > 2) ? list.at(2).toInt() : 0) * frRound;
|
||||
frames = (list.size() > 3) ? list.at(3).toInt() : 0;
|
||||
}
|
||||
|
||||
int f = (frames + seconds + minutes + hours);
|
||||
|
||||
if ((view == TIMECODE_DROP || view == TIMECODE_MILLISECONDS) && frame_rate_is_droppable(frame_rate)) {
|
||||
if ((view == TIMECODE_DROP || view == TIMECODE_MILLISECONDS) && frame_rate_is_droppable(frame_rate)) {
|
||||
// return drop
|
||||
int d;
|
||||
int m;
|
||||
@@ -161,69 +163,69 @@ long timecode_to_frame(const QString& s, int view, double frame_rate) {
|
||||
}
|
||||
|
||||
QString frame_to_timecode(long f, int view, double frame_rate) {
|
||||
if (view == TIMECODE_FRAMES) {
|
||||
return QString::number(f);
|
||||
}
|
||||
if (view == TIMECODE_FRAMES) {
|
||||
return QString::number(f);
|
||||
}
|
||||
|
||||
// return timecode
|
||||
int hours = 0;
|
||||
int mins = 0;
|
||||
int secs = 0;
|
||||
int frames = 0;
|
||||
QString token = ":";
|
||||
// return timecode
|
||||
int hours = 0;
|
||||
int mins = 0;
|
||||
int secs = 0;
|
||||
int frames = 0;
|
||||
QString token = ":";
|
||||
|
||||
if ((view == TIMECODE_DROP || view == TIMECODE_MILLISECONDS) && frame_rate_is_droppable(frame_rate)) {
|
||||
//CONVERT A FRAME NUMBER TO DROP FRAME TIMECODE
|
||||
//Code by David Heidelberger, adapted from Andrew Duncan, further adapted for Olive by Olive Team
|
||||
//Given an int called framenumber and a double called framerate
|
||||
//Framerate should be 29.97, 59.94, or 23.976, otherwise the calculations will be off.
|
||||
if ((view == TIMECODE_DROP || view == TIMECODE_MILLISECONDS) && frame_rate_is_droppable(frame_rate)) {
|
||||
//CONVERT A FRAME NUMBER TO DROP FRAME TIMECODE
|
||||
//Code by David Heidelberger, adapted from Andrew Duncan, further adapted for Olive by Olive Team
|
||||
//Given an int called framenumber and a double called framerate
|
||||
//Framerate should be 29.97, 59.94, or 23.976, otherwise the calculations will be off.
|
||||
|
||||
int d;
|
||||
int m;
|
||||
int d;
|
||||
int m;
|
||||
|
||||
int dropFrames = round(frame_rate * .066666); //Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate
|
||||
int framesPerHour = round(frame_rate*60*60); //Number of frqRound64ames in an hour
|
||||
int framesPer24Hours = framesPerHour*24; //Number of frames in a day - timecode rolls over after 24 hours
|
||||
int framesPer10Minutes = round(frame_rate * 60 * 10); //Number of frames per ten minutes
|
||||
int framesPerMinute = (round(frame_rate)*60)- dropFrames; //Number of frames per minute is the round of the framerate * 60 minus the number of dropped frames
|
||||
int dropFrames = round(frame_rate * .066666); //Number of frames to drop on the minute marks is the nearest integer to 6% of the framerate
|
||||
int framesPerHour = round(frame_rate*60*60); //Number of frqRound64ames in an hour
|
||||
int framesPer24Hours = framesPerHour*24; //Number of frames in a day - timecode rolls over after 24 hours
|
||||
int framesPer10Minutes = round(frame_rate * 60 * 10); //Number of frames per ten minutes
|
||||
int framesPerMinute = (round(frame_rate)*60)- dropFrames; //Number of frames per minute is the round of the framerate * 60 minus the number of dropped frames
|
||||
|
||||
//If framenumber is greater than 24 hrs, next operation will rollover clock
|
||||
f = f % framesPer24Hours; //% is the modulus operator, which returns a remainder. a % b = the remainder of a/b
|
||||
//If framenumber is greater than 24 hrs, next operation will rollover clock
|
||||
f = f % framesPer24Hours; //% is the modulus operator, which returns a remainder. a % b = the remainder of a/b
|
||||
|
||||
d = f / framesPer10Minutes; // \ means integer division, which is a/b without a remainder. Some languages you could use floor(a/b)
|
||||
m = f % framesPer10Minutes;
|
||||
d = f / framesPer10Minutes; // \ means integer division, which is a/b without a remainder. Some languages you could use floor(a/b)
|
||||
m = f % framesPer10Minutes;
|
||||
|
||||
//In the original post, the next line read m>1, which only worked for 29.97. Jean-Baptiste Mardelle correctly pointed out that m should be compared to dropFrames.
|
||||
if (m > dropFrames) {
|
||||
f = f + (dropFrames*9*d) + dropFrames * ((m - dropFrames) / framesPerMinute);
|
||||
} else {
|
||||
f = f + dropFrames*9*d;
|
||||
}
|
||||
//In the original post, the next line read m>1, which only worked for 29.97. Jean-Baptiste Mardelle correctly pointed out that m should be compared to dropFrames.
|
||||
if (m > dropFrames) {
|
||||
f = f + (dropFrames*9*d) + dropFrames * ((m - dropFrames) / framesPerMinute);
|
||||
} else {
|
||||
f = f + dropFrames*9*d;
|
||||
}
|
||||
|
||||
int frRound = round(frame_rate);
|
||||
frames = f % frRound;
|
||||
secs = (f / frRound) % 60;
|
||||
mins = ((f / frRound) / 60) % 60;
|
||||
hours = (((f / frRound) / 60) / 60);
|
||||
int frRound = round(frame_rate);
|
||||
frames = f % frRound;
|
||||
secs = (f / frRound) % 60;
|
||||
mins = ((f / frRound) / 60) % 60;
|
||||
hours = (((f / frRound) / 60) / 60);
|
||||
|
||||
token = ";";
|
||||
} else {
|
||||
token = ";";
|
||||
} else {
|
||||
// non-drop timecode
|
||||
|
||||
int int_fps = qRound(frame_rate);
|
||||
int int_fps = qRound(frame_rate);
|
||||
hours = f / (3600 * int_fps);
|
||||
mins = f / (60*int_fps) % 60;
|
||||
secs = f/int_fps % 60;
|
||||
frames = f%int_fps;
|
||||
}
|
||||
if (view == TIMECODE_MILLISECONDS) {
|
||||
return QString::number((hours*3600000)+(mins*60000)+(secs*1000)+qCeil(frames*1000/frame_rate));
|
||||
}
|
||||
return QString(QString::number(hours).rightJustified(2, '0') +
|
||||
":" + QString::number(mins).rightJustified(2, '0') +
|
||||
":" + QString::number(secs).rightJustified(2, '0') +
|
||||
token + QString::number(frames).rightJustified(2, '0')
|
||||
);
|
||||
mins = f / (60*int_fps) % 60;
|
||||
secs = f/int_fps % 60;
|
||||
frames = f%int_fps;
|
||||
}
|
||||
if (view == TIMECODE_MILLISECONDS) {
|
||||
return QString::number((hours*3600000)+(mins*60000)+(secs*1000)+qCeil(frames*1000/frame_rate));
|
||||
}
|
||||
return QString(QString::number(hours).rightJustified(2, '0') +
|
||||
":" + QString::number(mins).rightJustified(2, '0') +
|
||||
":" + QString::number(secs).rightJustified(2, '0') +
|
||||
token + QString::number(frames).rightJustified(2, '0')
|
||||
);
|
||||
}
|
||||
|
||||
bool frame_rate_is_droppable(float rate) {
|
||||
@@ -234,8 +236,8 @@ void Viewer::seek(long p) {
|
||||
pause();
|
||||
seq->playhead = p;
|
||||
update_parents();
|
||||
reset_all_audio();
|
||||
audio_scrub = true;
|
||||
reset_all_audio();
|
||||
audio_scrub = true;
|
||||
}
|
||||
|
||||
void Viewer::go_to_start() {
|
||||
@@ -278,7 +280,7 @@ void Viewer::cue_recording(long start, long end, int track) {
|
||||
void Viewer::uncue_recording() {
|
||||
cue_recording_internal = false;
|
||||
recording_flasher.stop();
|
||||
ui->btnPlay->setStyleSheet(QString());
|
||||
btnPlay->setStyleSheet(QString());
|
||||
}
|
||||
|
||||
bool Viewer::is_recording_cued() {
|
||||
@@ -298,7 +300,7 @@ void Viewer::play() {
|
||||
if (panel_footage_viewer->playing) panel_footage_viewer->pause();
|
||||
|
||||
if (seq != NULL) {
|
||||
reset_all_audio();
|
||||
reset_all_audio();
|
||||
if (is_recording_cued() && !start_recording()) {
|
||||
dout << "[ERROR] Failed to record audio";
|
||||
return;
|
||||
@@ -316,7 +318,7 @@ void Viewer::play_wake() {
|
||||
if (just_played) {
|
||||
start_msecs = QDateTime::currentMSecsSinceEpoch();
|
||||
playback_updater.start();
|
||||
if (audio_thread != NULL) audio_thread->notifyReceiver();
|
||||
if (audio_thread != NULL) audio_thread->notifyReceiver();
|
||||
just_played = false;
|
||||
}
|
||||
}
|
||||
@@ -336,27 +338,27 @@ void Viewer::pause() {
|
||||
// import audio
|
||||
QStringList file_list;
|
||||
file_list.append(get_recorded_audio_filename());
|
||||
panel_project->process_file_list(file_list);
|
||||
panel_project->process_file_list(file_list);
|
||||
|
||||
// add it to the sequence
|
||||
Clip* c = new Clip(seq);
|
||||
Media* m = panel_project->last_imported_media.at(0);
|
||||
Footage* f = m->to_footage();
|
||||
Media* m = panel_project->last_imported_media.at(0);
|
||||
Footage* f = m->to_footage();
|
||||
|
||||
f->ready_lock.lock();
|
||||
f->ready_lock.lock();
|
||||
|
||||
c->media = m; // latest media
|
||||
c->media = m; // latest media
|
||||
c->media_stream = 0;
|
||||
c->timeline_in = recording_start;
|
||||
c->timeline_out = f->get_length_in_frames(seq->frame_rate);
|
||||
c->timeline_out = recording_start + f->get_length_in_frames(seq->frame_rate);
|
||||
c->clip_in = 0;
|
||||
c->track = recording_track;
|
||||
c->color_r = 128;
|
||||
c->color_g = 192;
|
||||
c->color_b = 128;
|
||||
c->name = m->get_name();
|
||||
c->name = m->get_name();
|
||||
|
||||
f->ready_lock.unlock();
|
||||
f->ready_lock.unlock();
|
||||
|
||||
QVector<Clip*> add_clips;
|
||||
add_clips.append(c);
|
||||
@@ -366,24 +368,24 @@ void Viewer::pause() {
|
||||
}
|
||||
|
||||
void Viewer::update_playhead_timecode(long p) {
|
||||
ui->currentTimecode->set_value(p, false);
|
||||
currentTimecode->set_value(p, false);
|
||||
}
|
||||
|
||||
void Viewer::update_end_timecode() {
|
||||
ui->endTimecode->setText((seq == NULL) ? frame_to_timecode(0, config.timecode_view, 30) : frame_to_timecode(seq->getEndFrame(), config.timecode_view, seq->frame_rate));
|
||||
endTimecode->setText((seq == NULL) ? frame_to_timecode(0, config.timecode_view, 30) : frame_to_timecode(seq->getEndFrame(), config.timecode_view, seq->frame_rate));
|
||||
}
|
||||
|
||||
void Viewer::update_header_zoom() {
|
||||
if (seq != NULL) {
|
||||
long sequenceEndFrame = seq->getEndFrame();
|
||||
if (cached_end_frame != sequenceEndFrame) {
|
||||
minimum_zoom = (sequenceEndFrame > 0) ? ((double) ui->headers->width() / (double) sequenceEndFrame) : 1;
|
||||
ui->headers->update_zoom(qMax(ui->headers->get_zoom(), minimum_zoom));
|
||||
set_sb_max();
|
||||
viewer_widget->waveform_zoom = ui->headers->get_zoom();
|
||||
} else {
|
||||
ui->headers->update();
|
||||
}
|
||||
if (cached_end_frame != sequenceEndFrame) {
|
||||
minimum_zoom = (sequenceEndFrame > 0) ? ((double) headers->width() / (double) sequenceEndFrame) : 1;
|
||||
headers->update_zoom(qMax(headers->get_zoom(), minimum_zoom));
|
||||
set_sb_max();
|
||||
viewer_widget->waveform_zoom = headers->get_zoom();
|
||||
} else {
|
||||
headers->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,137 +394,238 @@ void Viewer::update_parents() {
|
||||
update_ui(false);
|
||||
} else {
|
||||
update_viewer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::resizeEvent(QResizeEvent *event) {
|
||||
if (seq != NULL) {
|
||||
set_sb_max();
|
||||
}
|
||||
if (seq != NULL) {
|
||||
set_sb_max();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::update_viewer() {
|
||||
update_header_zoom();
|
||||
update_header_zoom();
|
||||
viewer_widget->update();
|
||||
if (seq != NULL) update_playhead_timecode(seq->playhead);
|
||||
update_end_timecode();
|
||||
update_end_timecode();
|
||||
}
|
||||
|
||||
void Viewer::clear_inout_point() {
|
||||
if (seq->using_workarea) {
|
||||
undo_stack.push(new SetTimelineInOutCommand(seq, false, 0, 0));
|
||||
update_parents();
|
||||
}
|
||||
if (seq->using_workarea) {
|
||||
undo_stack.push(new SetTimelineInOutCommand(seq, false, 0, 0));
|
||||
update_parents();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::set_in_point() {
|
||||
ui->headers->set_in_point(seq->playhead);
|
||||
headers->set_in_point(seq->playhead);
|
||||
}
|
||||
|
||||
void Viewer::set_out_point() {
|
||||
ui->headers->set_out_point(seq->playhead);
|
||||
headers->set_out_point(seq->playhead);
|
||||
}
|
||||
|
||||
void Viewer::set_zoom(bool in) {
|
||||
if (seq != NULL) {
|
||||
set_zoom_value(in ? ui->headers->get_zoom()*2 : qMax(minimum_zoom, ui->headers->get_zoom()*0.5));
|
||||
}
|
||||
if (seq != NULL) {
|
||||
set_zoom_value(in ? headers->get_zoom()*2 : qMax(minimum_zoom, headers->get_zoom()*0.5));
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::set_zoom_value(double d) {
|
||||
ui->headers->update_zoom(d);
|
||||
if (viewer_widget->waveform) {
|
||||
viewer_widget->waveform_zoom = d;
|
||||
viewer_widget->update();
|
||||
}
|
||||
if (seq != NULL) {
|
||||
set_sb_max();
|
||||
if (!ui->horizontalScrollBar->is_resizing())
|
||||
center_scroll_to_playhead(ui->horizontalScrollBar, ui->headers->get_zoom(), seq->playhead);
|
||||
}
|
||||
headers->update_zoom(d);
|
||||
if (viewer_widget->waveform) {
|
||||
viewer_widget->waveform_zoom = d;
|
||||
viewer_widget->update();
|
||||
}
|
||||
if (seq != NULL) {
|
||||
set_sb_max();
|
||||
if (!horizontalScrollBar->is_resizing())
|
||||
center_scroll_to_playhead(horizontalScrollBar, headers->get_zoom(), seq->playhead);
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::set_sb_max() {
|
||||
ui->headers->set_scrollbar_max(ui->horizontalScrollBar, seq->getEndFrame(), ui->headers->width());
|
||||
headers->set_scrollbar_max(horizontalScrollBar, seq->getEndFrame(), headers->width());
|
||||
}
|
||||
|
||||
void Viewer::setup_ui() {
|
||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
|
||||
QWidget* contents = new QWidget();
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(contents);
|
||||
layout->setSpacing(0);
|
||||
layout->setMargin(0);
|
||||
|
||||
glViewerPane = new ViewerContainer(contents);
|
||||
glViewerPane->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
layout->addWidget(glViewerPane);
|
||||
|
||||
headers = new TimelineHeader(contents);
|
||||
layout->addWidget(headers);
|
||||
|
||||
horizontalScrollBar = new ResizableScrollBar(contents);
|
||||
horizontalScrollBar->setSingleStep(20);
|
||||
horizontalScrollBar->setOrientation(Qt::Horizontal);
|
||||
layout->addWidget(horizontalScrollBar);
|
||||
|
||||
QWidget* lower_controls = new QWidget(contents);
|
||||
|
||||
QHBoxLayout* lower_control_layout = new QHBoxLayout(lower_controls);
|
||||
lower_control_layout->setMargin(0);
|
||||
|
||||
// current time code
|
||||
QWidget* current_timecode_container = new QWidget(lower_controls);
|
||||
QHBoxLayout* current_timecode_container_layout = new QHBoxLayout(current_timecode_container);
|
||||
current_timecode_container_layout->setSpacing(0);
|
||||
current_timecode_container_layout->setMargin(0);
|
||||
currentTimecode = new LabelSlider(current_timecode_container);
|
||||
current_timecode_container_layout->addWidget(currentTimecode);
|
||||
lower_control_layout->addWidget(current_timecode_container);
|
||||
|
||||
QWidget* playback_controls = new QWidget(lower_controls);
|
||||
|
||||
QHBoxLayout* playback_control_layout = new QHBoxLayout(playback_controls);
|
||||
playback_control_layout->setSpacing(0);
|
||||
playback_control_layout->setMargin(0);
|
||||
|
||||
btnSkipToStart = new QPushButton(playback_controls);
|
||||
QIcon goToStartIcon;
|
||||
goToStartIcon.addFile(QStringLiteral(":/icons/prev.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
goToStartIcon.addFile(QStringLiteral(":/icons/prev-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
btnSkipToStart->setIcon(goToStartIcon);
|
||||
connect(btnSkipToStart, SIGNAL(clicked(bool)), this, SLOT(go_to_start()));
|
||||
playback_control_layout->addWidget(btnSkipToStart);
|
||||
|
||||
btnRewind = new QPushButton(playback_controls);
|
||||
QIcon rewindIcon;
|
||||
rewindIcon.addFile(QStringLiteral(":/icons/rew.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
rewindIcon.addFile(QStringLiteral(":/icons/rew-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
btnRewind->setIcon(rewindIcon);
|
||||
connect(btnRewind, SIGNAL(clicked(bool)), this, SLOT(previous_frame()));
|
||||
playback_control_layout->addWidget(btnRewind);
|
||||
|
||||
btnPlay = new QPushButton(playback_controls);
|
||||
QIcon playIcon;
|
||||
playIcon.addFile(QStringLiteral(":/icons/play.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
playIcon.addFile(QStringLiteral(":/icons/play-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
btnPlay->setIcon(playIcon);
|
||||
connect(btnPlay, SIGNAL(clicked(bool)), this, SLOT(toggle_play()));
|
||||
playback_control_layout->addWidget(btnPlay);
|
||||
|
||||
btnFastForward = new QPushButton(playback_controls);
|
||||
QIcon ffIcon;
|
||||
ffIcon.addFile(QStringLiteral(":/icons/ff.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
ffIcon.addFile(QStringLiteral(":/icons/ff-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
btnFastForward->setIcon(ffIcon);
|
||||
connect(btnFastForward, SIGNAL(clicked(bool)), this, SLOT(next_frame()));
|
||||
playback_control_layout->addWidget(btnFastForward);
|
||||
|
||||
btnSkipToEnd = new QPushButton(playback_controls);
|
||||
QIcon nextIcon;
|
||||
nextIcon.addFile(QStringLiteral(":/icons/next.png"), QSize(), QIcon::Normal, QIcon::Off);
|
||||
nextIcon.addFile(QStringLiteral(":/icons/next-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
btnSkipToEnd->setIcon(nextIcon);
|
||||
connect(btnSkipToEnd, SIGNAL(clicked(bool)), this, SLOT(go_to_end()));
|
||||
playback_control_layout->addWidget(btnSkipToEnd);
|
||||
|
||||
lower_control_layout->addWidget(playback_controls);
|
||||
|
||||
QWidget* end_timecode_container = new QWidget(lower_controls);
|
||||
|
||||
QHBoxLayout* end_timecode_layout = new QHBoxLayout(end_timecode_container);
|
||||
end_timecode_layout->setSpacing(0);
|
||||
end_timecode_layout->setMargin(0);
|
||||
|
||||
endTimecode = new QLabel(end_timecode_container);
|
||||
endTimecode->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
||||
|
||||
end_timecode_layout->addWidget(endTimecode);
|
||||
|
||||
lower_control_layout->addWidget(end_timecode_container);
|
||||
|
||||
layout->addWidget(lower_controls);
|
||||
|
||||
setWidget(contents);
|
||||
}
|
||||
|
||||
void Viewer::set_media(Media* m) {
|
||||
main_sequence = false;
|
||||
media = m;
|
||||
clean_created_seq();
|
||||
if (media != NULL) {
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* footage = media->to_footage();
|
||||
media = m;
|
||||
clean_created_seq();
|
||||
if (media != NULL) {
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* footage = media->to_footage();
|
||||
|
||||
seq = new Sequence();
|
||||
created_sequence = true;
|
||||
seq->wrapper_sequence = true;
|
||||
seq->name = footage->name;
|
||||
seq = new Sequence();
|
||||
created_sequence = true;
|
||||
seq->wrapper_sequence = true;
|
||||
seq->name = footage->name;
|
||||
|
||||
seq->using_workarea = footage->using_inout;
|
||||
if (footage->using_inout) {
|
||||
seq->workarea_in = footage->in;
|
||||
seq->workarea_out = footage->out;
|
||||
}
|
||||
seq->using_workarea = footage->using_inout;
|
||||
if (footage->using_inout) {
|
||||
seq->workarea_in = footage->in;
|
||||
seq->workarea_out = footage->out;
|
||||
}
|
||||
|
||||
seq->frame_rate = 30;
|
||||
seq->frame_rate = 30;
|
||||
|
||||
if (footage->video_tracks.size() > 0) {
|
||||
FootageStream* video_stream = footage->video_tracks.at(0);
|
||||
seq->width = video_stream->video_width;
|
||||
seq->height = video_stream->video_height;
|
||||
if (video_stream->video_frame_rate > 0 && !video_stream->infinite_length) seq->frame_rate = video_stream->video_frame_rate;
|
||||
if (footage->video_tracks.size() > 0) {
|
||||
FootageStream* video_stream = footage->video_tracks.at(0);
|
||||
seq->width = video_stream->video_width;
|
||||
seq->height = video_stream->video_height;
|
||||
if (video_stream->video_frame_rate > 0 && !video_stream->infinite_length) seq->frame_rate = video_stream->video_frame_rate;
|
||||
|
||||
Clip* c = new Clip(seq);
|
||||
c->media = media;
|
||||
c->media_stream = video_stream->file_index;
|
||||
c->timeline_in = 0;
|
||||
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
|
||||
if (c->timeline_out <= 0) c->timeline_out = 150;
|
||||
c->track = -1;
|
||||
c->clip_in = 0;
|
||||
c->recalculateMaxLength();
|
||||
seq->clips.append(c);
|
||||
} else {
|
||||
seq->width = 1920;
|
||||
seq->height = 1080;
|
||||
}
|
||||
Clip* c = new Clip(seq);
|
||||
c->media = media;
|
||||
c->media_stream = video_stream->file_index;
|
||||
c->timeline_in = 0;
|
||||
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
|
||||
if (c->timeline_out <= 0) c->timeline_out = 150;
|
||||
c->track = -1;
|
||||
c->clip_in = 0;
|
||||
c->recalculateMaxLength();
|
||||
seq->clips.append(c);
|
||||
} else {
|
||||
seq->width = 1920;
|
||||
seq->height = 1080;
|
||||
}
|
||||
|
||||
if (footage->audio_tracks.size() > 0) {
|
||||
FootageStream* audio_stream = footage->audio_tracks.at(0);
|
||||
seq->audio_frequency = audio_stream->audio_frequency;
|
||||
if (footage->audio_tracks.size() > 0) {
|
||||
FootageStream* audio_stream = footage->audio_tracks.at(0);
|
||||
seq->audio_frequency = audio_stream->audio_frequency;
|
||||
|
||||
Clip* c = new Clip(seq);
|
||||
c->media = media;
|
||||
c->media_stream = audio_stream->file_index;
|
||||
c->timeline_in = 0;
|
||||
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
|
||||
c->track = 0;
|
||||
c->clip_in = 0;
|
||||
c->recalculateMaxLength();
|
||||
seq->clips.append(c);
|
||||
Clip* c = new Clip(seq);
|
||||
c->media = media;
|
||||
c->media_stream = audio_stream->file_index;
|
||||
c->timeline_in = 0;
|
||||
c->timeline_out = footage->get_length_in_frames(seq->frame_rate);
|
||||
c->track = 0;
|
||||
c->clip_in = 0;
|
||||
c->recalculateMaxLength();
|
||||
seq->clips.append(c);
|
||||
|
||||
if (footage->video_tracks.size() == 0) {
|
||||
viewer_widget->waveform = true;
|
||||
viewer_widget->waveform_clip = c;
|
||||
viewer_widget->waveform_ms = audio_stream;
|
||||
viewer_widget->update();
|
||||
}
|
||||
} else {
|
||||
seq->audio_frequency = 48000;
|
||||
}
|
||||
if (footage->video_tracks.size() == 0) {
|
||||
viewer_widget->waveform = true;
|
||||
viewer_widget->waveform_clip = c;
|
||||
viewer_widget->waveform_ms = audio_stream;
|
||||
viewer_widget->update();
|
||||
}
|
||||
} else {
|
||||
seq->audio_frequency = 48000;
|
||||
}
|
||||
|
||||
seq->audio_layout = AV_CH_LAYOUT_STEREO;
|
||||
}
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
seq = media->to_sequence();
|
||||
break;
|
||||
}
|
||||
}
|
||||
set_sequence(false, seq);
|
||||
seq->audio_layout = AV_CH_LAYOUT_STEREO;
|
||||
}
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
seq = media->to_sequence();
|
||||
break;
|
||||
}
|
||||
}
|
||||
set_sequence(false, seq);
|
||||
}
|
||||
|
||||
void Viewer::on_btnSkipToStart_clicked() {
|
||||
@@ -546,45 +649,45 @@ void Viewer::on_btnPlay_clicked() {
|
||||
}
|
||||
|
||||
void Viewer::update_playhead() {
|
||||
seek(ui->currentTimecode->value());
|
||||
seek(currentTimecode->value());
|
||||
}
|
||||
|
||||
void Viewer::timer_update() {
|
||||
long previous_playhead = seq->playhead;
|
||||
long previous_playhead = seq->playhead;
|
||||
|
||||
seq->playhead = qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate));
|
||||
seq->playhead = qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate));
|
||||
update_parents();
|
||||
|
||||
long end_frame = (seq->using_workarea && previous_playhead < seq->workarea_out) ? seq->workarea_out : seq->getEndFrame();
|
||||
if ((!recording
|
||||
&& playing
|
||||
&& seq->playhead >= end_frame
|
||||
&& previous_playhead < end_frame)
|
||||
|| (recording && recording_start != recording_end && seq->playhead >= recording_end)) {
|
||||
pause();
|
||||
}
|
||||
long end_frame = (seq->using_workarea && previous_playhead < seq->workarea_out) ? seq->workarea_out : seq->getEndFrame();
|
||||
if ((!recording
|
||||
&& playing
|
||||
&& seq->playhead >= end_frame
|
||||
&& previous_playhead < end_frame)
|
||||
|| (recording && recording_start != recording_end && seq->playhead >= recording_end)) {
|
||||
pause();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::recording_flasher_update() {
|
||||
if (ui->btnPlay->styleSheet().isEmpty()) {
|
||||
ui->btnPlay->setStyleSheet("background: red;");
|
||||
if (btnPlay->styleSheet().isEmpty()) {
|
||||
btnPlay->setStyleSheet("background: red;");
|
||||
} else {
|
||||
ui->btnPlay->setStyleSheet(QString());
|
||||
}
|
||||
btnPlay->setStyleSheet(QString());
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::resize_move(double d) {
|
||||
set_zoom_value(ui->headers->get_zoom()*d);
|
||||
set_zoom_value(headers->get_zoom()*d);
|
||||
}
|
||||
|
||||
void Viewer::clean_created_seq() {
|
||||
viewer_widget->waveform = false;
|
||||
|
||||
if (created_sequence) {
|
||||
// TODO delete undo commands referencing this sequence to avoid crashes
|
||||
/*for (int i=0;i<undo_stack.count();i++) {
|
||||
undo_stack.command(i)
|
||||
}*/
|
||||
// TODO delete undo commands referencing this sequence to avoid crashes
|
||||
/*for (int i=0;i<undo_stack.count();i++) {
|
||||
undo_stack.command(i)
|
||||
}*/
|
||||
|
||||
delete seq;
|
||||
seq = NULL;
|
||||
@@ -592,49 +695,49 @@ void Viewer::clean_created_seq() {
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::set_sequence(bool main, Sequence *s) {
|
||||
void Viewer::set_sequence(bool main, Sequence *s) {
|
||||
reset_all_audio();
|
||||
|
||||
main_sequence = main;
|
||||
main_sequence = main;
|
||||
seq = (main) ? sequence : s;
|
||||
|
||||
bool null_sequence = (seq == NULL);
|
||||
bool null_sequence = (seq == NULL);
|
||||
|
||||
ui->headers->setEnabled(!null_sequence);
|
||||
ui->currentTimecode->setEnabled(!null_sequence);
|
||||
viewer_widget->setEnabled(!null_sequence);
|
||||
viewer_widget->setVisible(!null_sequence);
|
||||
ui->btnSkipToStart->setEnabled(!null_sequence);
|
||||
ui->btnRewind->setEnabled(!null_sequence);
|
||||
ui->btnPlay->setEnabled(!null_sequence);
|
||||
ui->btnFastForward->setEnabled(!null_sequence);
|
||||
ui->btnSkipToEnd->setEnabled(!null_sequence);
|
||||
headers->setEnabled(!null_sequence);
|
||||
currentTimecode->setEnabled(!null_sequence);
|
||||
viewer_widget->setEnabled(!null_sequence);
|
||||
viewer_widget->setVisible(!null_sequence);
|
||||
btnSkipToStart->setEnabled(!null_sequence);
|
||||
btnRewind->setEnabled(!null_sequence);
|
||||
btnPlay->setEnabled(!null_sequence);
|
||||
btnFastForward->setEnabled(!null_sequence);
|
||||
btnSkipToEnd->setEnabled(!null_sequence);
|
||||
|
||||
if (!null_sequence) {
|
||||
ui->currentTimecode->set_frame_rate(seq->frame_rate);
|
||||
if (!null_sequence) {
|
||||
currentTimecode->set_frame_rate(seq->frame_rate);
|
||||
|
||||
playback_updater.setInterval(qFloor(1000 / seq->frame_rate));
|
||||
|
||||
update_playhead_timecode(seq->playhead);
|
||||
update_end_timecode();
|
||||
update_playhead_timecode(seq->playhead);
|
||||
update_end_timecode();
|
||||
|
||||
ui->glViewerPane->adjust();
|
||||
glViewerPane->adjust();
|
||||
|
||||
setWindowTitle(panel_name + seq->name);
|
||||
} else {
|
||||
update_playhead_timecode(0);
|
||||
update_end_timecode();
|
||||
setWindowTitle(panel_name + seq->name);
|
||||
} else {
|
||||
update_playhead_timecode(0);
|
||||
update_end_timecode();
|
||||
|
||||
setWindowTitle(panel_name + "(none)");
|
||||
}
|
||||
setWindowTitle(panel_name + "(none)");
|
||||
}
|
||||
|
||||
update_header_zoom();
|
||||
|
||||
viewer_widget->update();
|
||||
|
||||
update();
|
||||
update();
|
||||
}
|
||||
|
||||
void Viewer::set_playpause_icon(bool play) {
|
||||
ui->btnPlay->setIcon(QIcon((play) ? ":/icons/play.png" : ":/icons/pause.png"));
|
||||
btnPlay->setIcon(QIcon((play) ? ":/icons/play.png" : ":/icons/pause.png"));
|
||||
}
|
||||
|
||||
+50
-36
@@ -8,10 +8,12 @@ class Timeline;
|
||||
class ViewerWidget;
|
||||
class Media;
|
||||
struct Sequence;
|
||||
|
||||
namespace Ui {
|
||||
class Viewer;
|
||||
}
|
||||
class TimelineHeader;
|
||||
class ResizableScrollBar;
|
||||
class ViewerContainer;
|
||||
class LabelSlider;
|
||||
class QPushButton;
|
||||
class QLabel;
|
||||
|
||||
bool frame_rate_is_droppable(float rate);
|
||||
long timecode_to_frame(const QString& s, int view, double frame_rate);
|
||||
@@ -26,28 +28,23 @@ public:
|
||||
~Viewer();
|
||||
|
||||
bool is_focused();
|
||||
void set_main_sequence();
|
||||
void set_media(Media *m);
|
||||
void set_main_sequence();
|
||||
void set_media(Media *m);
|
||||
void compose();
|
||||
void set_playpause_icon(bool play);
|
||||
void update_playhead_timecode(long p);
|
||||
void update_end_timecode();
|
||||
void set_playpause_icon(bool play);
|
||||
void update_playhead_timecode(long p);
|
||||
void update_end_timecode();
|
||||
void update_header_zoom();
|
||||
void update_viewer();
|
||||
void clear_inout_point();
|
||||
void clear_inout_point();
|
||||
void set_in_point();
|
||||
void set_out_point();
|
||||
void set_zoom(bool in);
|
||||
void set_zoom(bool in);
|
||||
|
||||
// playback functions
|
||||
void go_to_start();
|
||||
void previous_frame();
|
||||
void next_frame();
|
||||
void seek(long p);
|
||||
void toggle_play();
|
||||
void play();
|
||||
void pause();
|
||||
void go_to_end();
|
||||
bool playing;
|
||||
long playhead_start;
|
||||
qint64 start_msecs;
|
||||
@@ -56,51 +53,68 @@ public:
|
||||
|
||||
void cue_recording(long start, long end, int track);
|
||||
void uncue_recording();
|
||||
bool is_recording_cued();
|
||||
bool is_recording_cued();
|
||||
long recording_start;
|
||||
long recording_end;
|
||||
int recording_track;
|
||||
int recording_track;
|
||||
|
||||
void reset_all_audio();
|
||||
void reset_all_audio();
|
||||
void update_parents();
|
||||
|
||||
ViewerWidget* viewer_widget;
|
||||
|
||||
Media* media;
|
||||
Media* media;
|
||||
Sequence* seq;
|
||||
|
||||
Ui::Viewer *ui;
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
public slots:
|
||||
void play_wake();
|
||||
void go_to_start();
|
||||
void previous_frame();
|
||||
void toggle_play();
|
||||
void next_frame();
|
||||
void go_to_end();
|
||||
|
||||
private slots:
|
||||
void on_btnSkipToStart_clicked();
|
||||
void on_btnRewind_clicked();
|
||||
void on_btnPlay_clicked();
|
||||
void on_btnFastForward_clicked();
|
||||
void on_btnSkipToEnd_clicked();
|
||||
void on_btnSkipToStart_clicked();
|
||||
void on_btnRewind_clicked();
|
||||
void on_btnPlay_clicked();
|
||||
void on_btnFastForward_clicked();
|
||||
void on_btnSkipToEnd_clicked();
|
||||
|
||||
void update_playhead();
|
||||
void timer_update();
|
||||
void recording_flasher_update();
|
||||
void resize_move(double d);
|
||||
void resize_move(double d);
|
||||
|
||||
private:
|
||||
void clean_created_seq();
|
||||
void set_sequence(bool main, Sequence* s);
|
||||
void set_sequence(bool main, Sequence* s);
|
||||
bool main_sequence;
|
||||
bool created_sequence;
|
||||
long cached_end_frame;
|
||||
QString panel_name;
|
||||
double minimum_zoom;
|
||||
void set_zoom_value(double d);
|
||||
void set_sb_max();
|
||||
long cached_end_frame;
|
||||
QString panel_name;
|
||||
double minimum_zoom;
|
||||
void set_zoom_value(double d);
|
||||
void set_sb_max();
|
||||
|
||||
void setup_ui();
|
||||
|
||||
TimelineHeader* headers;
|
||||
ResizableScrollBar* horizontalScrollBar;
|
||||
ViewerContainer* glViewerPane;
|
||||
LabelSlider* currentTimecode;
|
||||
QLabel* endTimecode;
|
||||
|
||||
QPushButton* btnSkipToStart;
|
||||
QPushButton* btnRewind;
|
||||
QPushButton* btnPlay;
|
||||
QPushButton* btnFastForward;
|
||||
QPushButton* btnSkipToEnd;
|
||||
|
||||
bool cue_recording_internal;
|
||||
QTimer recording_flasher;
|
||||
QTimer recording_flasher;
|
||||
};
|
||||
|
||||
#endif // VIEWER_H
|
||||
|
||||
@@ -1,259 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Viewer</class>
|
||||
<widget class="QDockWidget" name="Viewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>583</width>
|
||||
<height>396</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Viewer</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="ViewerContainer" name="glViewerPane" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="TimelineHeader" name="headers" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ResizableScrollBar" name="horizontalScrollBar">
|
||||
<property name="maximum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>20</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1826</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="playbackControls" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="LabelSlider" name="currentTimecode">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSkipToStart">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons/icons.qrc">
|
||||
<normaloff>:/icons/prev.png</normaloff>
|
||||
<disabledoff>:/icons/prev-disabled.png</disabledoff>:/icons/prev.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnRewind">
|
||||
<property name="icon">
|
||||
<iconset resource="../icons/icons.qrc">
|
||||
<normaloff>:/icons/rew.png</normaloff>
|
||||
<disabledoff>:/icons/rew-disabled.png</disabledoff>:/icons/rew.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnPlay">
|
||||
<property name="icon">
|
||||
<iconset resource="../icons/icons.qrc">
|
||||
<normaloff>:/icons/play.png</normaloff>
|
||||
<disabledoff>:/icons/play-disabled.png</disabledoff>:/icons/play.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnFastForward">
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/icons/ff.png</normalon>
|
||||
<disabledoff>:/icons/ff-disabled.png</disabledoff>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnSkipToEnd">
|
||||
<property name="icon">
|
||||
<iconset resource="../icons/icons.qrc">
|
||||
<normaloff>:/icons/next.png</normaloff>
|
||||
<disabledoff>:/icons/next-disabled.png</disabledoff>:/icons/next.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="endTimecode">
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>TimelineHeader</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui/timelineheader.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ResizableScrollBar</class>
|
||||
<extends>QScrollBar</extends>
|
||||
<header>ui/resizablescrollbar.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ViewerContainer</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>ui/viewercontainer.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LabelSlider</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>ui/labelslider.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../icons/icons.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
+55
-54
@@ -7,9 +7,10 @@
|
||||
#include "panels/panels.h"
|
||||
#include "panels/timeline.h"
|
||||
#include "panels/viewer.h"
|
||||
#include "ui_timeline.h"
|
||||
#include "ui/audiomonitor.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QAudioOutput>
|
||||
#include <QAudioInput>
|
||||
#include <QtMath>
|
||||
@@ -43,49 +44,49 @@ bool is_audio_device_set() {
|
||||
void init_audio() {
|
||||
stop_audio();
|
||||
|
||||
QAudioFormat audio_format;
|
||||
audio_format.setSampleRate(config.audio_rate);
|
||||
audio_format.setChannelCount(2);
|
||||
audio_format.setSampleSize(16);
|
||||
audio_format.setCodec("audio/pcm");
|
||||
audio_format.setByteOrder(QAudioFormat::LittleEndian);
|
||||
audio_format.setSampleType(QAudioFormat::SignedInt);
|
||||
QAudioFormat audio_format;
|
||||
audio_format.setSampleRate(config.audio_rate);
|
||||
audio_format.setChannelCount(2);
|
||||
audio_format.setSampleSize(16);
|
||||
audio_format.setCodec("audio/pcm");
|
||||
audio_format.setByteOrder(QAudioFormat::LittleEndian);
|
||||
audio_format.setSampleType(QAudioFormat::SignedInt);
|
||||
|
||||
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
|
||||
QList<QAudioDeviceInfo> devs = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
|
||||
dout << "[INFO] Found the following audio devices:";
|
||||
for (int i=0;i<devs.size();i++) {
|
||||
dout << " " << devs.at(i).deviceName();
|
||||
}
|
||||
if (info.isNull() && devs.size() > 0) {
|
||||
dout << "[WARNING] Default audio returned NULL, attempting to use first device found...";
|
||||
info = devs.at(0);
|
||||
}
|
||||
dout << "[INFO] Using audio device" << info.deviceName();
|
||||
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
|
||||
QList<QAudioDeviceInfo> devs = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
|
||||
dout << "[INFO] Found the following audio devices:";
|
||||
for (int i=0;i<devs.size();i++) {
|
||||
dout << " " << devs.at(i).deviceName();
|
||||
}
|
||||
if (info.isNull() && devs.size() > 0) {
|
||||
dout << "[WARNING] Default audio returned NULL, attempting to use first device found...";
|
||||
info = devs.at(0);
|
||||
}
|
||||
dout << "[INFO] Using audio device" << info.deviceName();
|
||||
|
||||
if (!info.isFormatSupported(audio_format)) {
|
||||
qWarning() << "[WARNING] Audio format is not supported by backend, using nearest";
|
||||
audio_format = info.nearestFormat(audio_format);
|
||||
}
|
||||
if (!info.isFormatSupported(audio_format)) {
|
||||
qWarning() << "[WARNING] Audio format is not supported by backend, using nearest";
|
||||
audio_format = info.nearestFormat(audio_format);
|
||||
}
|
||||
|
||||
audio_output = new QAudioOutput(info, audio_format);
|
||||
audio_output->moveToThread(QApplication::instance()->thread());
|
||||
audio_output->setNotifyInterval(5);
|
||||
audio_output = new QAudioOutput(info, audio_format);
|
||||
audio_output->moveToThread(QApplication::instance()->thread());
|
||||
audio_output->setNotifyInterval(5);
|
||||
|
||||
// connect
|
||||
audio_io_device = audio_output->start();
|
||||
if (audio_io_device == NULL) {
|
||||
dout << "[WARNING] Received NULL audio device. No compatible audio output was found.";
|
||||
} else {
|
||||
audio_device_set = true;
|
||||
// connect
|
||||
audio_io_device = audio_output->start();
|
||||
if (audio_io_device == NULL) {
|
||||
dout << "[WARNING] Received NULL audio device. No compatible audio output was found.";
|
||||
} else {
|
||||
audio_device_set = true;
|
||||
|
||||
// start sender thread
|
||||
audio_thread = new AudioSenderThread();
|
||||
QObject::connect(audio_output, SIGNAL(notify()), audio_thread, SLOT(notifyReceiver()));
|
||||
audio_thread->start(QThread::TimeCriticalPriority);
|
||||
// start sender thread
|
||||
audio_thread = new AudioSenderThread();
|
||||
QObject::connect(audio_output, SIGNAL(notify()), audio_thread, SLOT(notifyReceiver()));
|
||||
audio_thread->start(QThread::TimeCriticalPriority);
|
||||
|
||||
clear_audio_ibuffer();
|
||||
}
|
||||
clear_audio_ibuffer();
|
||||
}
|
||||
}
|
||||
|
||||
void stop_audio() {
|
||||
@@ -100,12 +101,12 @@ void stop_audio() {
|
||||
|
||||
void clear_audio_ibuffer() {
|
||||
memset(audio_ibuffer, 0, audio_ibuffer_size);
|
||||
audio_ibuffer_read = 0;
|
||||
audio_ibuffer_read = 0;
|
||||
}
|
||||
|
||||
int get_buffer_offset_from_frame(double framerate, long frame) {
|
||||
if (frame >= audio_ibuffer_frame) {
|
||||
return qFloor(((double) (frame - audio_ibuffer_frame)/framerate)*audio_output->format().sampleRate())*av_get_bytes_per_sample(AV_SAMPLE_FMT_S16)*av_get_channel_layout_nb_channels(AV_CH_LAYOUT_STEREO);
|
||||
return qFloor(((double) (frame - audio_ibuffer_frame)/framerate)*audio_output->format().sampleRate())*av_get_bytes_per_sample(AV_SAMPLE_FMT_S16)*av_get_channel_layout_nb_channels(AV_CH_LAYOUT_STEREO);
|
||||
} else {
|
||||
dout << "[WARNING] Invalid values passed to get_buffer_offset_from_frame";
|
||||
return 0;
|
||||
@@ -135,7 +136,7 @@ void AudioSenderThread::run() {
|
||||
cond.wait(&lock);
|
||||
if (close) {
|
||||
break;
|
||||
} else if (panel_sequence_viewer->playing || panel_footage_viewer->playing || audio_scrub) {
|
||||
} else if (panel_sequence_viewer->playing || panel_footage_viewer->playing || audio_scrub) {
|
||||
int written_bytes = 0;
|
||||
|
||||
int adjusted_read_index = audio_ibuffer_read%audio_ibuffer_size;
|
||||
@@ -147,7 +148,7 @@ void AudioSenderThread::run() {
|
||||
written_bytes += send_audio_to_output(0, audio_ibuffer_size);
|
||||
}
|
||||
|
||||
audio_scrub = false;
|
||||
audio_scrub = false;
|
||||
}
|
||||
}
|
||||
lock.unlock();
|
||||
@@ -163,26 +164,26 @@ int AudioSenderThread::send_audio_to_output(int offset, int max) {
|
||||
// TODO make this work for the footage viewer - currently, enabling it causes crash due to an ASSERT
|
||||
Sequence* s = NULL;
|
||||
/*if (panel_footage_viewer->playing) {
|
||||
s = panel_footage_viewer->seq;
|
||||
s = panel_footage_viewer->seq;
|
||||
}*/
|
||||
if (panel_sequence_viewer->playing) {
|
||||
s = panel_sequence_viewer->seq;
|
||||
}
|
||||
if (s != NULL) {
|
||||
if (panel_timeline->ui->audio_monitor->sample_cache_offset == -1) {
|
||||
panel_timeline->ui->audio_monitor->sample_cache_offset = s->playhead;
|
||||
if (panel_sequence_viewer->playing) {
|
||||
s = panel_sequence_viewer->seq;
|
||||
}
|
||||
if (s != NULL) {
|
||||
if (panel_timeline->audio_monitor->sample_cache_offset == -1) {
|
||||
panel_timeline->audio_monitor->sample_cache_offset = s->playhead;
|
||||
}
|
||||
int channel_count = av_get_channel_layout_nb_channels(s->audio_layout);
|
||||
long sample_cache_playhead = panel_timeline->ui->audio_monitor->sample_cache_offset + (panel_timeline->ui->audio_monitor->sample_cache.size()/channel_count);
|
||||
int channel_count = av_get_channel_layout_nb_channels(s->audio_layout);
|
||||
long sample_cache_playhead = panel_timeline->audio_monitor->sample_cache_offset + (panel_timeline->audio_monitor->sample_cache.size()/channel_count);
|
||||
int next_buffer_offset, buffer_offset_adjusted, i;
|
||||
int buffer_offset = get_buffer_offset_from_frame(s->frame_rate, sample_cache_playhead);
|
||||
int buffer_offset = get_buffer_offset_from_frame(s->frame_rate, sample_cache_playhead);
|
||||
if (samples.size() != channel_count) samples.resize(channel_count);
|
||||
samples.fill(0);
|
||||
|
||||
// TODO: I don't like this, but i'm not sure if there's a smarter way to do it
|
||||
while (buffer_offset < audio_ibuffer_limit) {
|
||||
sample_cache_playhead++;
|
||||
next_buffer_offset = qMin(get_buffer_offset_from_frame(s->frame_rate, sample_cache_playhead), audio_ibuffer_limit);
|
||||
next_buffer_offset = qMin(get_buffer_offset_from_frame(s->frame_rate, sample_cache_playhead), audio_ibuffer_limit);
|
||||
while (buffer_offset < next_buffer_offset) {
|
||||
for (i=0;i<samples.size();i++) {
|
||||
buffer_offset_adjusted = buffer_offset%audio_ibuffer_size;
|
||||
@@ -190,7 +191,7 @@ int AudioSenderThread::send_audio_to_output(int offset, int max) {
|
||||
buffer_offset += 2;
|
||||
}
|
||||
}
|
||||
panel_timeline->ui->audio_monitor->sample_cache.append(samples);
|
||||
panel_timeline->audio_monitor->sample_cache.append(samples);
|
||||
buffer_offset = next_buffer_offset;
|
||||
}
|
||||
}
|
||||
|
||||
+153
-143
@@ -10,6 +10,7 @@
|
||||
#include "project/sequence.h"
|
||||
#include "panels/timeline.h"
|
||||
#include "project/media.h"
|
||||
#include "io/clipboard.h"
|
||||
#include "undo.h"
|
||||
|
||||
extern "C" {
|
||||
@@ -17,69 +18,70 @@ extern "C" {
|
||||
}
|
||||
|
||||
Clip::Clip(Sequence* s) :
|
||||
sequence(s),
|
||||
enabled(true),
|
||||
clip_in(0),
|
||||
timeline_in(0),
|
||||
timeline_out(0),
|
||||
track(0),
|
||||
media(NULL),
|
||||
speed(1.0),
|
||||
reverse(false),
|
||||
maintain_audio_pitch(false),
|
||||
autoscale(config.autoscale_by_default),
|
||||
opening_transition(-1),
|
||||
closing_transition(-1),
|
||||
undeletable(false),
|
||||
replaced(false),
|
||||
ignore_reverse(false),
|
||||
use_existing_frame(false),
|
||||
sequence(s),
|
||||
enabled(true),
|
||||
clip_in(0),
|
||||
timeline_in(0),
|
||||
timeline_out(0),
|
||||
track(0),
|
||||
media(NULL),
|
||||
speed(1.0),
|
||||
reverse(false),
|
||||
maintain_audio_pitch(false),
|
||||
autoscale(config.autoscale_by_default),
|
||||
opening_transition(-1),
|
||||
closing_transition(-1),
|
||||
undeletable(false),
|
||||
replaced(false),
|
||||
ignore_reverse(false),
|
||||
use_existing_frame(false),
|
||||
filter_graph(NULL),
|
||||
fbo(NULL),
|
||||
opts(NULL)
|
||||
fbo(NULL),
|
||||
opts(NULL)
|
||||
{
|
||||
pkt = av_packet_alloc();
|
||||
reset();
|
||||
reset();
|
||||
}
|
||||
|
||||
Clip* Clip::copy(Sequence* s) {
|
||||
Clip* copy = new Clip(s);
|
||||
Clip* copy = new Clip(s);
|
||||
|
||||
copy->enabled = enabled;
|
||||
copy->name = QString(name);
|
||||
copy->clip_in = clip_in;
|
||||
copy->timeline_in = timeline_in;
|
||||
copy->timeline_out = timeline_out;
|
||||
copy->track = track;
|
||||
copy->color_r = color_r;
|
||||
copy->color_g = color_g;
|
||||
copy->enabled = enabled;
|
||||
copy->name = QString(name);
|
||||
copy->clip_in = clip_in;
|
||||
copy->timeline_in = timeline_in;
|
||||
copy->timeline_out = timeline_out;
|
||||
copy->track = track;
|
||||
copy->color_r = color_r;
|
||||
copy->color_g = color_g;
|
||||
copy->color_b = color_b;
|
||||
copy->media = media;
|
||||
copy->media_stream = media_stream;
|
||||
copy->autoscale = autoscale;
|
||||
copy->media = media;
|
||||
copy->media_stream = media_stream;
|
||||
copy->autoscale = autoscale;
|
||||
copy->speed = speed;
|
||||
copy->maintain_audio_pitch = maintain_audio_pitch;
|
||||
copy->reverse = reverse;
|
||||
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
copy->effects.append(effects.at(i)->copy(copy));
|
||||
}
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
copy->effects.append(effects.at(i)->copy(copy));
|
||||
}
|
||||
|
||||
// TODO make a replacemennt for this somehow
|
||||
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip == NULL) copy->opening_transition = get_opening_transition()->copy(copy, NULL);
|
||||
if (get_closing_transition() != NULL && get_closing_transition()->secondary_clip == NULL) copy->closing_transition = get_closing_transition()->copy(copy, NULL);
|
||||
copy->cached_fr = (this->sequence == NULL) ? cached_fr : this->sequence->frame_rate;
|
||||
|
||||
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip == NULL) copy->opening_transition = get_opening_transition()->copy(copy, NULL);
|
||||
if (get_closing_transition() != NULL && get_closing_transition()->secondary_clip == NULL) copy->closing_transition = get_closing_transition()->copy(copy, NULL);
|
||||
|
||||
copy->recalculateMaxLength();
|
||||
|
||||
return copy;
|
||||
return copy;
|
||||
}
|
||||
|
||||
void Clip::reset() {
|
||||
audio_just_reset = false;
|
||||
open = false;
|
||||
finished_opening = false;
|
||||
audio_just_reset = false;
|
||||
open = false;
|
||||
finished_opening = false;
|
||||
pkt_written = false;
|
||||
audio_reset = false;
|
||||
audio_reset = false;
|
||||
frame_sample_index = -1;
|
||||
audio_buffer_write = false;
|
||||
texture_frame = -1;
|
||||
@@ -88,42 +90,42 @@ void Clip::reset() {
|
||||
codec = NULL;
|
||||
codecCtx = NULL;
|
||||
texture = NULL;
|
||||
last_invalid_ts = -1;
|
||||
last_invalid_ts = -1;
|
||||
}
|
||||
|
||||
void Clip::reset_audio() {
|
||||
if (media == NULL || media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
audio_reset = true;
|
||||
frame_sample_index = -1;
|
||||
audio_buffer_write = 0;
|
||||
} else if (media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* nested_sequence = media->to_sequence();
|
||||
for (int i=0;i<nested_sequence->clips.size();i++) {
|
||||
Clip* c = nested_sequence->clips.at(i);
|
||||
if (c != NULL) c->reset_audio();
|
||||
}
|
||||
}
|
||||
if (media == NULL || media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
audio_reset = true;
|
||||
frame_sample_index = -1;
|
||||
audio_buffer_write = 0;
|
||||
} else if (media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* nested_sequence = media->to_sequence();
|
||||
for (int i=0;i<nested_sequence->clips.size();i++) {
|
||||
Clip* c = nested_sequence->clips.at(i);
|
||||
if (c != NULL) c->reset_audio();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Clip::refresh() {
|
||||
// validates media if it was replaced
|
||||
if (replaced && media != NULL && media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* m = media->to_footage();
|
||||
if (replaced && media != NULL && media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* m = media->to_footage();
|
||||
|
||||
if (track < 0 && m->video_tracks.size() > 0) {
|
||||
media_stream = m->video_tracks.at(0)->file_index;
|
||||
} else if (track >= 0 && m->audio_tracks.size() > 0) {
|
||||
media_stream = m->audio_tracks.at(0)->file_index;
|
||||
}
|
||||
if (track < 0 && m->video_tracks.size() > 0) {
|
||||
media_stream = m->video_tracks.at(0)->file_index;
|
||||
} else if (track >= 0 && m->audio_tracks.size() > 0) {
|
||||
media_stream = m->audio_tracks.at(0)->file_index;
|
||||
}
|
||||
}
|
||||
replaced = false;
|
||||
|
||||
// reinitializes all effects... just in case
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
// reinitializes all effects... just in case
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
effects.at(i)->refresh();
|
||||
}
|
||||
|
||||
recalculateMaxLength();
|
||||
recalculateMaxLength();
|
||||
}
|
||||
|
||||
void Clip::queue_clear() {
|
||||
@@ -142,79 +144,87 @@ void Clip::queue_remove_earliest() {
|
||||
}
|
||||
}
|
||||
av_frame_free(&queue[earliest_frame]);
|
||||
queue.removeAt(earliest_frame);
|
||||
queue.removeAt(earliest_frame);
|
||||
}
|
||||
|
||||
Transition* Clip::get_opening_transition() {
|
||||
if (opening_transition > -1) {
|
||||
return this->sequence->transitions.at(opening_transition);
|
||||
}
|
||||
return NULL;
|
||||
if (opening_transition > -1) {
|
||||
if (this->sequence == NULL) {
|
||||
return clipboard_transitions.at(opening_transition);
|
||||
} else {
|
||||
return this->sequence->transitions.at(opening_transition);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Transition* Clip::get_closing_transition() {
|
||||
if (closing_transition > -1) {
|
||||
return this->sequence->transitions.at(closing_transition);
|
||||
}
|
||||
return NULL;
|
||||
if (closing_transition > -1) {
|
||||
if (this->sequence == NULL) {
|
||||
return clipboard_transitions.at(closing_transition);
|
||||
} else {
|
||||
return this->sequence->transitions.at(closing_transition);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Clip::~Clip() {
|
||||
if (open) {
|
||||
if (open) {
|
||||
close_clip(this);
|
||||
|
||||
// make sure clip has closed before clip is destroyed
|
||||
if (multithreaded && media != NULL && media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
cacher->wait();
|
||||
}
|
||||
}
|
||||
// make sure clip has closed before clip is destroyed
|
||||
if (multithreaded && media != NULL && media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
cacher->wait();
|
||||
}
|
||||
}
|
||||
|
||||
if (opening_transition != -1) this->sequence->hard_delete_transition(this, TA_OPENING_TRANSITION);
|
||||
if (closing_transition != -1) this->sequence->hard_delete_transition(this, TA_CLOSING_TRANSITION);
|
||||
if (opening_transition != -1) this->sequence->hard_delete_transition(this, TA_OPENING_TRANSITION);
|
||||
if (closing_transition != -1) this->sequence->hard_delete_transition(this, TA_CLOSING_TRANSITION);
|
||||
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
delete effects.at(i);
|
||||
}
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
delete effects.at(i);
|
||||
}
|
||||
av_packet_free(&pkt);
|
||||
}
|
||||
|
||||
long Clip::get_clip_in_with_transition() {
|
||||
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip != NULL) {
|
||||
// we must be the secondary clip, so return (timeline in - length)
|
||||
return clip_in - get_opening_transition()->get_true_length();
|
||||
}
|
||||
return clip_in;
|
||||
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip != NULL) {
|
||||
// we must be the secondary clip, so return (timeline in - length)
|
||||
return clip_in - get_opening_transition()->get_true_length();
|
||||
}
|
||||
return clip_in;
|
||||
}
|
||||
|
||||
long Clip::get_timeline_in_with_transition() {
|
||||
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip != NULL) {
|
||||
// we must be the secondary clip, so return (timeline in - length)
|
||||
return timeline_in - get_opening_transition()->get_true_length();
|
||||
}
|
||||
return timeline_in;
|
||||
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip != NULL) {
|
||||
// we must be the secondary clip, so return (timeline in - length)
|
||||
return timeline_in - get_opening_transition()->get_true_length();
|
||||
}
|
||||
return timeline_in;
|
||||
}
|
||||
|
||||
long Clip::get_timeline_out_with_transition() {
|
||||
if (get_closing_transition() != NULL && get_closing_transition()->secondary_clip != NULL) {
|
||||
// we must be the primary clip, so return (timeline out + length2)
|
||||
return timeline_out + get_closing_transition()->get_true_length();
|
||||
} else {
|
||||
return timeline_out;
|
||||
}
|
||||
if (get_closing_transition() != NULL && get_closing_transition()->secondary_clip != NULL) {
|
||||
// we must be the primary clip, so return (timeline out + length2)
|
||||
return timeline_out + get_closing_transition()->get_true_length();
|
||||
} else {
|
||||
return timeline_out;
|
||||
}
|
||||
}
|
||||
|
||||
// timeline functions
|
||||
long Clip::getLength() {
|
||||
return timeline_out - timeline_in;
|
||||
return timeline_out - timeline_in;
|
||||
}
|
||||
|
||||
double Clip::getMediaFrameRate() {
|
||||
Q_ASSERT(track < 0);
|
||||
if (media != NULL) {
|
||||
double rate = media->get_frame_rate(media_stream);
|
||||
if (!qIsNaN(rate)) return rate;
|
||||
}
|
||||
if (sequence != NULL) return sequence->frame_rate;
|
||||
Q_ASSERT(track < 0);
|
||||
if (media != NULL) {
|
||||
double rate = media->get_frame_rate(media_stream);
|
||||
if (!qIsNaN(rate)) return rate;
|
||||
}
|
||||
if (sequence != NULL) return sequence->frame_rate;
|
||||
return qSNaN();
|
||||
}
|
||||
|
||||
@@ -224,29 +234,29 @@ void Clip::recalculateMaxLength() {
|
||||
|
||||
fr /= speed;
|
||||
|
||||
calculated_length = LONG_MAX;
|
||||
calculated_length = LONG_MAX;
|
||||
|
||||
if (media != NULL) {
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* m = media->to_footage();
|
||||
FootageStream* ms = m->get_stream_from_file_index(track < 0, media_stream);
|
||||
if (ms != NULL && ms->infinite_length) {
|
||||
calculated_length = LONG_MAX;
|
||||
} else {
|
||||
calculated_length = m->get_length_in_frames(fr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media->to_sequence();
|
||||
calculated_length = refactor_frame_number(s->getEndFrame(), s->frame_rate, fr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (media != NULL) {
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* m = media->to_footage();
|
||||
FootageStream* ms = m->get_stream_from_file_index(track < 0, media_stream);
|
||||
if (ms != NULL && ms->infinite_length) {
|
||||
calculated_length = LONG_MAX;
|
||||
} else {
|
||||
calculated_length = m->get_length_in_frames(fr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media->to_sequence();
|
||||
calculated_length = refactor_frame_number(s->getEndFrame(), s->frame_rate, fr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,16 +266,16 @@ long Clip::getMaximumLength() {
|
||||
|
||||
int Clip::getWidth() {
|
||||
if (media == NULL && sequence != NULL) return sequence->width;
|
||||
switch (media->get_type()) {
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
|
||||
FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
|
||||
if (ms != NULL) return ms->video_width;
|
||||
if (sequence != NULL) return sequence->width;
|
||||
if (sequence != NULL) return sequence->width;
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media->to_sequence();
|
||||
Sequence* s = media->to_sequence();
|
||||
return s->width;
|
||||
}
|
||||
}
|
||||
@@ -274,16 +284,16 @@ int Clip::getWidth() {
|
||||
|
||||
int Clip::getHeight() {
|
||||
if (media == NULL && sequence != NULL) return sequence->height;
|
||||
switch (media->get_type()) {
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
|
||||
FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
|
||||
if (ms != NULL) return ms->video_height;
|
||||
if (sequence != NULL) return sequence->height;
|
||||
if (sequence != NULL) return sequence->height;
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = media->to_sequence();
|
||||
Sequence* s = media->to_sequence();
|
||||
return s->height;
|
||||
}
|
||||
}
|
||||
@@ -292,11 +302,11 @@ int Clip::getHeight() {
|
||||
|
||||
void Clip::refactor_frame_rate(ComboAction* ca, double multiplier, bool change_timeline_points) {
|
||||
if (change_timeline_points) {
|
||||
move_clip(ca, this,
|
||||
qRound((double) timeline_in * multiplier),
|
||||
qRound((double) timeline_out * multiplier),
|
||||
qRound((double) clip_in * multiplier),
|
||||
track);
|
||||
move_clip(ca, this,
|
||||
qRound((double) timeline_in * multiplier),
|
||||
qRound((double) timeline_out * multiplier),
|
||||
qRound((double) clip_in * multiplier),
|
||||
track);
|
||||
}
|
||||
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
|
||||
+100
-96
@@ -7,172 +7,176 @@
|
||||
#include "debug.h"
|
||||
|
||||
ProjectModel::ProjectModel(QObject *parent) : QAbstractItemModel(parent), root_item(NULL) {
|
||||
root_item = new Media(0);
|
||||
root_item->root = true;
|
||||
root_item = new Media(0);
|
||||
root_item->root = true;
|
||||
}
|
||||
|
||||
ProjectModel::~ProjectModel() {
|
||||
destroy_root();
|
||||
ProjectModel::~ProjectModel() {
|
||||
destroy_root();
|
||||
}
|
||||
|
||||
void ProjectModel::destroy_root() {
|
||||
if (panel_sequence_viewer != NULL) panel_sequence_viewer->viewer_widget->delete_function();
|
||||
if (panel_footage_viewer != NULL) panel_footage_viewer->viewer_widget->delete_function();
|
||||
if (panel_sequence_viewer != NULL) panel_sequence_viewer->viewer_widget->delete_function();
|
||||
if (panel_footage_viewer != NULL) panel_footage_viewer->viewer_widget->delete_function();
|
||||
|
||||
if (root_item != NULL) {
|
||||
delete root_item;
|
||||
}
|
||||
if (root_item != NULL) {
|
||||
delete root_item;
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectModel::clear() {
|
||||
beginResetModel();
|
||||
destroy_root();
|
||||
root_item = new Media(0);
|
||||
root_item->root = true;
|
||||
endResetModel();
|
||||
beginResetModel();
|
||||
destroy_root();
|
||||
root_item = new Media(0);
|
||||
root_item->root = true;
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
Media *ProjectModel::get_root() {
|
||||
return root_item;
|
||||
return root_item;
|
||||
}
|
||||
|
||||
QVariant ProjectModel::data(const QModelIndex &index, int role) const {
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
return static_cast<Media*>(index.internalPointer())->data(index.column(), role);
|
||||
return static_cast<Media*>(index.internalPointer())->data(index.column(), role);
|
||||
}
|
||||
|
||||
Qt::ItemFlags ProjectModel::flags(const QModelIndex &index) const {
|
||||
if (!index.isValid())
|
||||
return Qt::ItemIsDropEnabled;
|
||||
if (!index.isValid())
|
||||
return Qt::ItemIsDropEnabled;
|
||||
|
||||
return QAbstractItemModel::flags(index) | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable;
|
||||
return QAbstractItemModel::flags(index) | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | Qt::ItemIsEditable;
|
||||
}
|
||||
|
||||
QVariant ProjectModel::headerData(int section, Qt::Orientation orientation, int role) const {
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
||||
return root_item->data(section, role);
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
||||
return root_item->data(section, role);
|
||||
|
||||
return QVariant();
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QModelIndex ProjectModel::index(int row, int column, const QModelIndex &parent) const {
|
||||
if (!hasIndex(row, column, parent))
|
||||
return QModelIndex();
|
||||
if (!hasIndex(row, column, parent))
|
||||
return QModelIndex();
|
||||
|
||||
Media *parentItem;
|
||||
Media *parentItem;
|
||||
|
||||
if (!parent.isValid())
|
||||
parentItem = root_item;
|
||||
else
|
||||
parentItem = static_cast<Media*>(parent.internalPointer());
|
||||
if (!parent.isValid())
|
||||
parentItem = root_item;
|
||||
else
|
||||
parentItem = static_cast<Media*>(parent.internalPointer());
|
||||
|
||||
Media *childItem = parentItem->child(row);
|
||||
if (childItem)
|
||||
return createIndex(row, column, childItem);
|
||||
else
|
||||
return QModelIndex();
|
||||
Media *childItem = parentItem->child(row);
|
||||
if (childItem)
|
||||
return createIndex(row, column, childItem);
|
||||
else
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QModelIndex ProjectModel::create_index(int arow, int acolumn, void* aid) {
|
||||
return createIndex(arow, acolumn, aid);
|
||||
}
|
||||
|
||||
QModelIndex ProjectModel::parent(const QModelIndex &index) const {
|
||||
if (!index.isValid())
|
||||
return QModelIndex();
|
||||
if (!index.isValid())
|
||||
return QModelIndex();
|
||||
|
||||
Media *childItem = static_cast<Media*>(index.internalPointer());
|
||||
Media *parentItem = childItem->parentItem();
|
||||
Media *childItem = static_cast<Media*>(index.internalPointer());
|
||||
Media *parentItem = childItem->parentItem();
|
||||
|
||||
if (parentItem == root_item)
|
||||
return QModelIndex();
|
||||
if (parentItem == root_item)
|
||||
return QModelIndex();
|
||||
|
||||
return createIndex(parentItem->row(), 0, parentItem);
|
||||
return createIndex(parentItem->row(), 0, parentItem);
|
||||
}
|
||||
|
||||
bool ProjectModel::setData(const QModelIndex &index, const QVariant &value, int role) {
|
||||
if (role != Qt::EditRole)
|
||||
return false;
|
||||
if (role != Qt::EditRole)
|
||||
return false;
|
||||
|
||||
Media *item = static_cast<Media*>(index.internalPointer());
|
||||
bool result = item->setData(index.column(), value);
|
||||
Media *item = static_cast<Media*>(index.internalPointer());
|
||||
bool result = item->setData(index.column(), value);
|
||||
|
||||
if (result)
|
||||
emit dataChanged(index, index);
|
||||
if (result)
|
||||
emit dataChanged(index, index);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
int ProjectModel::rowCount(const QModelIndex &parent) const {
|
||||
Media *parentItem;
|
||||
if (parent.column() > 0)
|
||||
return 0;
|
||||
Media *parentItem;
|
||||
if (parent.column() > 0)
|
||||
return 0;
|
||||
|
||||
if (!parent.isValid()) {
|
||||
parentItem = root_item;
|
||||
} else {
|
||||
parentItem = static_cast<Media*>(parent.internalPointer());
|
||||
}
|
||||
if (!parent.isValid()) {
|
||||
parentItem = root_item;
|
||||
} else {
|
||||
parentItem = static_cast<Media*>(parent.internalPointer());
|
||||
}
|
||||
|
||||
return parentItem->childCount();
|
||||
return parentItem->childCount();
|
||||
}
|
||||
|
||||
int ProjectModel::columnCount(const QModelIndex &parent) const {
|
||||
if (parent.isValid())
|
||||
return static_cast<Media*>(parent.internalPointer())->columnCount();
|
||||
else
|
||||
return root_item->columnCount();
|
||||
if (parent.isValid())
|
||||
return static_cast<Media*>(parent.internalPointer())->columnCount();
|
||||
else
|
||||
return root_item->columnCount();
|
||||
}
|
||||
|
||||
Media *ProjectModel::getItem(const QModelIndex &index) const {
|
||||
if (index.isValid()) {
|
||||
Media *item = static_cast<Media*>(index.internalPointer());
|
||||
if (item)
|
||||
return item;
|
||||
}
|
||||
return root_item;
|
||||
if (index.isValid()) {
|
||||
Media *item = static_cast<Media*>(index.internalPointer());
|
||||
if (item)
|
||||
return item;
|
||||
}
|
||||
return root_item;
|
||||
}
|
||||
|
||||
void ProjectModel::set_icon(Media* m, const QIcon &ico) {
|
||||
QModelIndex index = createIndex(m->row(), 0, m);
|
||||
m->set_icon(ico);
|
||||
emit dataChanged(index, index);
|
||||
QModelIndex index = createIndex(m->row(), 0, m);
|
||||
m->set_icon(ico);
|
||||
emit dataChanged(index, index);
|
||||
|
||||
}
|
||||
|
||||
void ProjectModel::appendChild(Media *parent, Media *child) {
|
||||
if (parent == NULL) parent = root_item;
|
||||
beginInsertRows(parent == root_item ? QModelIndex() : createIndex(parent->row(), 0, parent), parent->childCount(), parent->childCount());
|
||||
parent->appendChild(child);
|
||||
endInsertRows();
|
||||
if (parent == NULL) parent = root_item;
|
||||
beginInsertRows(parent == root_item ? QModelIndex() : createIndex(parent->row(), 0, parent), parent->childCount(), parent->childCount());
|
||||
parent->appendChild(child);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
void ProjectModel::moveChild(Media *child, Media *to) {
|
||||
if (to == NULL) to = root_item;
|
||||
Media* from = child->parentItem();
|
||||
beginMoveRows(
|
||||
from == root_item ? QModelIndex() : createIndex(from->row(), 0, from),
|
||||
child->row(),
|
||||
child->row(),
|
||||
to == root_item ? QModelIndex() : createIndex(to->row(), 0, to),
|
||||
to->childCount()
|
||||
);
|
||||
from->removeChild(child->row());
|
||||
to->appendChild(child);
|
||||
endMoveRows();
|
||||
if (to == NULL) to = root_item;
|
||||
Media* from = child->parentItem();
|
||||
beginMoveRows(
|
||||
from == root_item ? QModelIndex() : createIndex(from->row(), 0, from),
|
||||
child->row(),
|
||||
child->row(),
|
||||
to == root_item ? QModelIndex() : createIndex(to->row(), 0, to),
|
||||
to->childCount()
|
||||
);
|
||||
from->removeChild(child->row());
|
||||
to->appendChild(child);
|
||||
endMoveRows();
|
||||
}
|
||||
|
||||
void ProjectModel::removeChild(Media* parent, Media* m) {
|
||||
if (parent == NULL) parent = root_item;
|
||||
beginRemoveRows(parent == root_item ? QModelIndex() : createIndex(parent->row(), 0, parent), m->row(), m->row());
|
||||
parent->removeChild(m->row());
|
||||
endRemoveRows();
|
||||
if (parent == NULL) parent = root_item;
|
||||
beginRemoveRows(parent == root_item ? QModelIndex() : createIndex(parent->row(), 0, parent), m->row(), m->row());
|
||||
parent->removeChild(m->row());
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
Media* ProjectModel::child(int i, Media* parent) {
|
||||
if (parent == NULL) parent = root_item;
|
||||
return parent->child(i);
|
||||
if (parent == NULL) parent = root_item;
|
||||
return parent->child(i);
|
||||
}
|
||||
|
||||
int ProjectModel::childCount(Media *parent) {
|
||||
if (parent == NULL) parent = root_item;
|
||||
return parent->childCount();
|
||||
if (parent == NULL) parent = root_item;
|
||||
return parent->childCount();
|
||||
}
|
||||
|
||||
+25
-24
@@ -7,35 +7,36 @@ class Media;
|
||||
|
||||
class ProjectModel : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProjectModel(QObject* parent = 0);
|
||||
~ProjectModel() override;
|
||||
ProjectModel(QObject* parent = 0);
|
||||
~ProjectModel() override;
|
||||
|
||||
void destroy_root();
|
||||
void clear();
|
||||
Media* get_root();
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
Media *getItem(const QModelIndex &index) const;
|
||||
void destroy_root();
|
||||
void clear();
|
||||
Media* get_root();
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
QModelIndex index(int row, int column,
|
||||
const QModelIndex &parent = QModelIndex()) const override;
|
||||
QModelIndex create_index(int arow, int acolumn, void *aid);
|
||||
QModelIndex parent(const QModelIndex &index) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
Media *getItem(const QModelIndex &index) const;
|
||||
|
||||
void appendChild(Media* parent, Media* child);
|
||||
void moveChild(Media *child, Media *to);
|
||||
void removeChild(Media *parent, Media* m);
|
||||
Media *child(int i, Media* parent = NULL);
|
||||
int childCount(Media* parent = NULL);
|
||||
void set_icon(Media* m, const QIcon &ico);
|
||||
void appendChild(Media* parent, Media* child);
|
||||
void moveChild(Media *child, Media *to);
|
||||
void removeChild(Media *parent, Media* m);
|
||||
Media *child(int i, Media* parent = NULL);
|
||||
int childCount(Media* parent = NULL);
|
||||
void set_icon(Media* m, const QIcon &ico);
|
||||
|
||||
private:
|
||||
Media* root_item;
|
||||
Media* root_item;
|
||||
};
|
||||
|
||||
#endif // PROJECTMODEL_H
|
||||
|
||||
+76
-68
@@ -7,94 +7,102 @@
|
||||
|
||||
Sequence::Sequence() :
|
||||
playhead(0),
|
||||
using_workarea(false),
|
||||
workarea_in(0),
|
||||
workarea_out(0),
|
||||
wrapper_sequence(false)
|
||||
using_workarea(false),
|
||||
workarea_in(0),
|
||||
workarea_out(0),
|
||||
wrapper_sequence(false)
|
||||
{
|
||||
}
|
||||
|
||||
Sequence::~Sequence() {
|
||||
// dealloc all clips
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
delete clips.at(i);
|
||||
}
|
||||
// dealloc all clips
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
delete clips.at(i);
|
||||
}
|
||||
}
|
||||
|
||||
Sequence* Sequence::copy() {
|
||||
Sequence* s = new Sequence();
|
||||
s->name = name + " (copy)";
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
s->frame_rate = frame_rate;
|
||||
s->audio_frequency = audio_frequency;
|
||||
s->audio_layout = audio_layout;
|
||||
s->clips.resize(clips.size());
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
if (c == NULL) {
|
||||
s->clips[i] = NULL;
|
||||
} else {
|
||||
Clip* copy = c->copy(s);
|
||||
copy->linked = c->linked;
|
||||
s->clips[i] = copy;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
Sequence* s = new Sequence();
|
||||
s->name = name + " (copy)";
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
s->frame_rate = frame_rate;
|
||||
s->audio_frequency = audio_frequency;
|
||||
s->audio_layout = audio_layout;
|
||||
s->clips.resize(clips.size());
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* c = clips.at(i);
|
||||
if (c == NULL) {
|
||||
s->clips[i] = NULL;
|
||||
} else {
|
||||
Clip* copy = c->copy(s);
|
||||
copy->linked = c->linked;
|
||||
s->clips[i] = copy;
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
long Sequence::getEndFrame() {
|
||||
long end = 0;
|
||||
for (int j=0;j<clips.size();j++) {
|
||||
Clip* c = clips.at(j);
|
||||
if (c != NULL && c->timeline_out > end) {
|
||||
end = c->timeline_out;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
long end = 0;
|
||||
for (int j=0;j<clips.size();j++) {
|
||||
Clip* c = clips.at(j);
|
||||
if (c != NULL && c->timeline_out > end) {
|
||||
end = c->timeline_out;
|
||||
}
|
||||
}
|
||||
return end;
|
||||
}
|
||||
|
||||
void Sequence::hard_delete_transition(Clip *c, int type) {
|
||||
int transition_index = (type == TA_OPENING_TRANSITION) ? c->opening_transition : c->closing_transition;
|
||||
if (transition_index > -1) {
|
||||
bool del = true;
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* cc = clips.at(i);
|
||||
if (cc != NULL
|
||||
&& c != cc
|
||||
&& (cc->opening_transition == transition_index
|
||||
|| cc->closing_transition == transition_index)) {
|
||||
// another clip is using this, don't delete just yet
|
||||
del = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int transition_index = (type == TA_OPENING_TRANSITION) ? c->opening_transition : c->closing_transition;
|
||||
if (transition_index > -1) {
|
||||
bool del = true;
|
||||
|
||||
if (del) {
|
||||
delete transitions.at(transition_index);
|
||||
transitions[transition_index] = NULL;
|
||||
}
|
||||
Transition* t = transitions.at(transition_index);
|
||||
if (t->secondary_clip != NULL) {
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* comp = clips.at(i);
|
||||
if (comp != NULL
|
||||
&& c != comp
|
||||
&& (c->opening_transition == transition_index
|
||||
|| c->closing_transition == transition_index)) {
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
// convert to closing transition
|
||||
t->parent_clip = t->secondary_clip;
|
||||
}
|
||||
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
c->opening_transition = -1;
|
||||
} else {
|
||||
c->closing_transition = -1;
|
||||
}
|
||||
}
|
||||
del = false;
|
||||
t->secondary_clip = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (del) {
|
||||
delete transitions.at(transition_index);
|
||||
transitions[transition_index] = NULL;
|
||||
}
|
||||
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
c->opening_transition = -1;
|
||||
} else {
|
||||
c->closing_transition = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
|
||||
int vt = 0;
|
||||
int at = 0;
|
||||
for (int j=0;j<clips.size();j++) {
|
||||
Clip* c = clips.at(j);
|
||||
if (c != NULL) {
|
||||
if (c->track < 0 && c->track < vt) { // video clip
|
||||
vt = c->track;
|
||||
} else if (c->track > at) {
|
||||
at = c->track;
|
||||
}
|
||||
}
|
||||
for (int j=0;j<clips.size();j++) {
|
||||
Clip* c = clips.at(j);
|
||||
if (c != NULL) {
|
||||
if (c->track < 0 && c->track < vt) { // video clip
|
||||
vt = c->track;
|
||||
} else if (c->track > at) {
|
||||
at = c->track;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (video_tracks != NULL) *video_tracks = vt;
|
||||
if (audio_tracks != NULL) *audio_tracks = at;
|
||||
|
||||
+14
-13
@@ -8,35 +8,36 @@
|
||||
|
||||
struct Clip;
|
||||
class Transition;
|
||||
class Media;
|
||||
|
||||
struct Sequence {
|
||||
Sequence();
|
||||
~Sequence();
|
||||
Sequence* copy();
|
||||
QString name;
|
||||
void getTrackLimits(int* video_tracks, int* audio_tracks);
|
||||
Sequence* copy();
|
||||
QString name;
|
||||
void getTrackLimits(int* video_tracks, int* audio_tracks);
|
||||
long getEndFrame();
|
||||
void hard_delete_transition(Clip *c, int type);
|
||||
void hard_delete_transition(Clip *c, int type);
|
||||
int width;
|
||||
int height;
|
||||
double frame_rate;
|
||||
double frame_rate;
|
||||
int audio_frequency;
|
||||
int audio_layout;
|
||||
int audio_layout;
|
||||
|
||||
QVector<Selection> selections;
|
||||
long playhead;
|
||||
|
||||
bool using_workarea;
|
||||
long workarea_in;
|
||||
long workarea_out;
|
||||
bool using_workarea;
|
||||
long workarea_in;
|
||||
long workarea_out;
|
||||
|
||||
bool wrapper_sequence;
|
||||
bool wrapper_sequence;
|
||||
|
||||
int save_id;
|
||||
int save_id;
|
||||
|
||||
QVector<Marker> markers;
|
||||
QVector<Marker> markers;
|
||||
QVector<Clip*> clips;
|
||||
QVector<Transition*> transitions;
|
||||
QVector<Transition*> transitions;
|
||||
};
|
||||
|
||||
// static variable for the currently active sequence
|
||||
|
||||
+199
-199
@@ -18,263 +18,263 @@
|
||||
#include <QDesktopServices>
|
||||
|
||||
SourcesCommon::SourcesCommon(Project* parent) :
|
||||
project_parent(parent),
|
||||
editing_item(NULL)
|
||||
project_parent(parent),
|
||||
editing_item(NULL)
|
||||
{
|
||||
rename_timer.setInterval(1000);
|
||||
connect(&rename_timer, SIGNAL(timeout()), this, SLOT(rename_interval()));
|
||||
rename_timer.setInterval(1000);
|
||||
connect(&rename_timer, SIGNAL(timeout()), this, SLOT(rename_interval()));
|
||||
}
|
||||
|
||||
void SourcesCommon::create_seq_from_selected() {
|
||||
if (!selected_items.isEmpty()) {
|
||||
QVector<Media*> media_list;
|
||||
for (int i=0;i<selected_items.size();i++) {
|
||||
media_list.append(project_parent->item_to_media(selected_items.at(i)));
|
||||
}
|
||||
if (!selected_items.isEmpty()) {
|
||||
QVector<Media*> media_list;
|
||||
for (int i=0;i<selected_items.size();i++) {
|
||||
media_list.append(project_parent->item_to_media(selected_items.at(i)));
|
||||
}
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
Sequence* s = create_sequence_from_media(media_list);
|
||||
ComboAction* ca = new ComboAction();
|
||||
Sequence* s = create_sequence_from_media(media_list);
|
||||
|
||||
// add clips to it
|
||||
panel_timeline->create_ghosts_from_media(s, 0, media_list);
|
||||
panel_timeline->add_clips_from_ghosts(ca, s);
|
||||
// add clips to it
|
||||
panel_timeline->create_ghosts_from_media(s, 0, media_list);
|
||||
panel_timeline->add_clips_from_ghosts(ca, s);
|
||||
|
||||
project_parent->new_sequence(ca, s, true, NULL);
|
||||
undo_stack.push(ca);
|
||||
}
|
||||
project_parent->new_sequence(ca, s, true, NULL);
|
||||
undo_stack.push(ca);
|
||||
}
|
||||
}
|
||||
|
||||
void SourcesCommon::show_context_menu(QWidget* parent, const QModelIndexList& items) {
|
||||
QMenu menu(parent);
|
||||
QMenu menu(parent);
|
||||
|
||||
selected_items = items;
|
||||
selected_items = items;
|
||||
|
||||
QAction* import_action = menu.addAction("Import...");
|
||||
QObject::connect(import_action, SIGNAL(triggered(bool)), project_parent, SLOT(import_dialog()));
|
||||
QAction* import_action = menu.addAction("Import...");
|
||||
QObject::connect(import_action, SIGNAL(triggered(bool)), project_parent, SLOT(import_dialog()));
|
||||
|
||||
QAction* new_folder_action = menu.addAction("New Folder...");
|
||||
QObject::connect(new_folder_action, SIGNAL(triggered(bool)), mainWindow, SLOT(on_actionFolder_triggered()));
|
||||
QMenu* new_menu = menu.addMenu("New");
|
||||
mainWindow->make_new_menu(new_menu);
|
||||
|
||||
if (items.size() > 0) {
|
||||
Media* m = project_parent->item_to_media(items.at(0));
|
||||
if (items.size() > 0) {
|
||||
Media* m = project_parent->item_to_media(items.at(0));
|
||||
|
||||
if (items.size() == 1) {
|
||||
// replace footage
|
||||
int type = m->get_type();
|
||||
if (type == MEDIA_TYPE_FOOTAGE) {
|
||||
QAction* replace_action = menu.addAction("Replace/Relink Media");
|
||||
QObject::connect(replace_action, SIGNAL(triggered(bool)), project_parent, SLOT(replace_selected_file()));
|
||||
if (items.size() == 1) {
|
||||
// replace footage
|
||||
int type = m->get_type();
|
||||
if (type == MEDIA_TYPE_FOOTAGE) {
|
||||
QAction* replace_action = menu.addAction("Replace/Relink Media");
|
||||
QObject::connect(replace_action, SIGNAL(triggered(bool)), project_parent, SLOT(replace_selected_file()));
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
QAction* reveal_in_explorer = menu.addAction("Reveal in Explorer");
|
||||
QAction* reveal_in_explorer = menu.addAction("Reveal in Explorer");
|
||||
#elif defined(Q_OS_MAC)
|
||||
QAction* reveal_in_explorer = menu.addAction("Reveal in Finder");
|
||||
QAction* reveal_in_explorer = menu.addAction("Reveal in Finder");
|
||||
#else
|
||||
QAction* reveal_in_explorer = menu.addAction("Reveal in File Manager");
|
||||
QAction* reveal_in_explorer = menu.addAction("Reveal in File Manager");
|
||||
#endif
|
||||
QObject::connect(reveal_in_explorer, SIGNAL(triggered(bool)), this, SLOT(reveal_in_browser()));
|
||||
}
|
||||
if (type != MEDIA_TYPE_FOLDER) {
|
||||
QAction* replace_clip_media = menu.addAction("Replace Clips Using This Media");
|
||||
QObject::connect(replace_clip_media, SIGNAL(triggered(bool)), project_parent, SLOT(replace_clip_media()));
|
||||
}
|
||||
}
|
||||
QObject::connect(reveal_in_explorer, SIGNAL(triggered(bool)), this, SLOT(reveal_in_browser()));
|
||||
}
|
||||
if (type != MEDIA_TYPE_FOLDER) {
|
||||
QAction* replace_clip_media = menu.addAction("Replace Clips Using This Media");
|
||||
QObject::connect(replace_clip_media, SIGNAL(triggered(bool)), project_parent, SLOT(replace_clip_media()));
|
||||
}
|
||||
}
|
||||
|
||||
// duplicate item
|
||||
bool all_sequences = true;
|
||||
bool all_footage = true;
|
||||
for (int i=0;i<items.size();i++) {
|
||||
if (m->get_type() != MEDIA_TYPE_SEQUENCE) {
|
||||
all_sequences = false;
|
||||
}
|
||||
if (m->get_type() != MEDIA_TYPE_FOOTAGE) {
|
||||
all_footage = false;
|
||||
}
|
||||
}
|
||||
// duplicate item
|
||||
bool all_sequences = true;
|
||||
bool all_footage = true;
|
||||
for (int i=0;i<items.size();i++) {
|
||||
if (m->get_type() != MEDIA_TYPE_SEQUENCE) {
|
||||
all_sequences = false;
|
||||
}
|
||||
if (m->get_type() != MEDIA_TYPE_FOOTAGE) {
|
||||
all_footage = false;
|
||||
}
|
||||
}
|
||||
|
||||
// create sequence from
|
||||
QAction* create_seq_from = menu.addAction("Create Sequence With This Media");
|
||||
QObject::connect(create_seq_from, SIGNAL(triggered(bool)), this, SLOT(create_seq_from_selected()));
|
||||
// create sequence from
|
||||
QAction* create_seq_from = menu.addAction("Create Sequence With This Media");
|
||||
QObject::connect(create_seq_from, SIGNAL(triggered(bool)), this, SLOT(create_seq_from_selected()));
|
||||
|
||||
// ONLY sequences are selected
|
||||
if (all_sequences) {
|
||||
// ONLY sequences are selected
|
||||
QAction* duplicate_action = menu.addAction("Duplicate");
|
||||
QObject::connect(duplicate_action, SIGNAL(triggered(bool)), project_parent, SLOT(duplicate_selected()));
|
||||
}
|
||||
// ONLY sequences are selected
|
||||
if (all_sequences) {
|
||||
// ONLY sequences are selected
|
||||
QAction* duplicate_action = menu.addAction("Duplicate");
|
||||
QObject::connect(duplicate_action, SIGNAL(triggered(bool)), project_parent, SLOT(duplicate_selected()));
|
||||
}
|
||||
|
||||
// ONLY footage is selected
|
||||
if (all_footage) {
|
||||
QAction* delete_footage_from_sequences = menu.addAction("Delete All Clips Using This Media");
|
||||
QObject::connect(delete_footage_from_sequences, SIGNAL(triggered(bool)), project_parent, SLOT(delete_clips_using_selected_media()));
|
||||
}
|
||||
// ONLY footage is selected
|
||||
if (all_footage) {
|
||||
QAction* delete_footage_from_sequences = menu.addAction("Delete All Clips Using This Media");
|
||||
QObject::connect(delete_footage_from_sequences, SIGNAL(triggered(bool)), project_parent, SLOT(delete_clips_using_selected_media()));
|
||||
}
|
||||
|
||||
// delete media
|
||||
QAction* delete_action = menu.addAction("Delete");
|
||||
QObject::connect(delete_action, SIGNAL(triggered(bool)), project_parent, SLOT(delete_selected_media()));
|
||||
// delete media
|
||||
QAction* delete_action = menu.addAction("Delete");
|
||||
QObject::connect(delete_action, SIGNAL(triggered(bool)), project_parent, SLOT(delete_selected_media()));
|
||||
|
||||
if (items.size() == 1) {
|
||||
QAction* properties_action = menu.addAction("Properties...");
|
||||
QObject::connect(properties_action, SIGNAL(triggered(bool)), project_parent, SLOT(open_properties()));
|
||||
}
|
||||
}
|
||||
if (items.size() == 1) {
|
||||
QAction* properties_action = menu.addAction("Properties...");
|
||||
QObject::connect(properties_action, SIGNAL(triggered(bool)), project_parent, SLOT(open_properties()));
|
||||
}
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* tree_view_action = menu.addAction("Tree View");
|
||||
connect(tree_view_action, SIGNAL(triggered(bool)), project_parent, SLOT(set_tree_view()));
|
||||
QAction* tree_view_action = menu.addAction("Tree View");
|
||||
connect(tree_view_action, SIGNAL(triggered(bool)), project_parent, SLOT(set_tree_view()));
|
||||
|
||||
QAction* icon_view_action = menu.addAction("Icon View");
|
||||
connect(icon_view_action, SIGNAL(triggered(bool)), project_parent, SLOT(set_icon_view()));
|
||||
QAction* icon_view_action = menu.addAction("Icon View");
|
||||
connect(icon_view_action, SIGNAL(triggered(bool)), project_parent, SLOT(set_icon_view()));
|
||||
|
||||
menu.exec(QCursor::pos());
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void SourcesCommon::mousePressEvent(QMouseEvent *) {
|
||||
stop_rename_timer();
|
||||
stop_rename_timer();
|
||||
}
|
||||
|
||||
void SourcesCommon::item_click(Media *m, const QModelIndex& index) {
|
||||
if (editing_item == m) {
|
||||
rename_timer.start();
|
||||
} else {
|
||||
editing_item = m;
|
||||
editing_index = index;
|
||||
}
|
||||
if (editing_item == m) {
|
||||
rename_timer.start();
|
||||
} else {
|
||||
editing_item = m;
|
||||
editing_index = index;
|
||||
}
|
||||
}
|
||||
|
||||
void SourcesCommon::mouseDoubleClickEvent(QMouseEvent *e, const QModelIndexList& selected_items) {
|
||||
stop_rename_timer();
|
||||
if (selected_items.size() == 0) {
|
||||
project_parent->import_dialog();
|
||||
} else if (selected_items.size() == 1) {
|
||||
Media* item = project_parent->item_to_media(selected_items.at(0));
|
||||
switch (item->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
panel_footage_viewer->set_media(item);
|
||||
panel_footage_viewer->setFocus();
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
undo_stack.push(new ChangeSequenceAction(item->to_sequence()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
stop_rename_timer();
|
||||
if (selected_items.size() == 0) {
|
||||
project_parent->import_dialog();
|
||||
} else if (selected_items.size() == 1) {
|
||||
Media* item = project_parent->item_to_media(selected_items.at(0));
|
||||
switch (item->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
panel_footage_viewer->set_media(item);
|
||||
panel_footage_viewer->setFocus();
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
undo_stack.push(new ChangeSequenceAction(item->to_sequence()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SourcesCommon::dropEvent(QWidget* parent, QDropEvent *event, const QModelIndex& drop_item, const QModelIndexList& items) {
|
||||
const QMimeData* mimeData = event->mimeData();
|
||||
Media* m = project_parent->item_to_media(drop_item);
|
||||
if (mimeData->hasUrls()) {
|
||||
// drag files in from outside
|
||||
QList<QUrl> urls = mimeData->urls();
|
||||
if (!urls.isEmpty()) {
|
||||
QStringList paths;
|
||||
for (int i=0;i<urls.size();i++) {
|
||||
paths.append(urls.at(i).toLocalFile());
|
||||
}
|
||||
bool replace = false;
|
||||
if (urls.size() == 1
|
||||
&& drop_item.isValid()
|
||||
&& m->get_type() == MEDIA_TYPE_FOOTAGE
|
||||
&& !QFileInfo(paths.at(0)).isDir()
|
||||
&& config.drop_on_media_to_replace
|
||||
&& QMessageBox::question(parent, "Replace Media", "You dropped a file onto '" + m->get_name() + "'. Would you like to replace it with the dropped file?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) {
|
||||
replace = true;
|
||||
project_parent->replace_media(m, paths.at(0));
|
||||
}
|
||||
if (!replace) {
|
||||
QModelIndex parent;
|
||||
if (drop_item.isValid()) {
|
||||
if (m->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
parent = drop_item;
|
||||
} else {
|
||||
parent = drop_item.parent();
|
||||
}
|
||||
}
|
||||
project_parent->process_file_list(paths, false, NULL, panel_project->item_to_media(parent));
|
||||
}
|
||||
}
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
event->ignore();
|
||||
const QMimeData* mimeData = event->mimeData();
|
||||
Media* m = project_parent->item_to_media(drop_item);
|
||||
if (mimeData->hasUrls()) {
|
||||
// drag files in from outside
|
||||
QList<QUrl> urls = mimeData->urls();
|
||||
if (!urls.isEmpty()) {
|
||||
QStringList paths;
|
||||
for (int i=0;i<urls.size();i++) {
|
||||
paths.append(urls.at(i).toLocalFile());
|
||||
}
|
||||
bool replace = false;
|
||||
if (urls.size() == 1
|
||||
&& drop_item.isValid()
|
||||
&& m->get_type() == MEDIA_TYPE_FOOTAGE
|
||||
&& !QFileInfo(paths.at(0)).isDir()
|
||||
&& config.drop_on_media_to_replace
|
||||
&& QMessageBox::question(parent, "Replace Media", "You dropped a file onto '" + m->get_name() + "'. Would you like to replace it with the dropped file?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) {
|
||||
replace = true;
|
||||
project_parent->replace_media(m, paths.at(0));
|
||||
}
|
||||
if (!replace) {
|
||||
QModelIndex parent;
|
||||
if (drop_item.isValid()) {
|
||||
if (m->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
parent = drop_item;
|
||||
} else {
|
||||
parent = drop_item.parent();
|
||||
}
|
||||
}
|
||||
project_parent->process_file_list(paths, false, NULL, panel_project->item_to_media(parent));
|
||||
}
|
||||
}
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
event->ignore();
|
||||
|
||||
// dragging files within project
|
||||
// if we dragged to the root OR dragged to a folder
|
||||
if (!drop_item.isValid() || (drop_item.isValid() && m->get_type() == MEDIA_TYPE_FOLDER)) {
|
||||
QVector<Media*> move_items;
|
||||
for (int i=0;i<items.size();i++) {
|
||||
const QModelIndex& item = items.at(i);
|
||||
const QModelIndex& parent = item.parent();
|
||||
Media* s = project_parent->item_to_media(item);
|
||||
if (parent != drop_item && item != drop_item) {
|
||||
bool ignore = false;
|
||||
if (parent.isValid()) {
|
||||
// if child belongs to a selected parent, assume the user is just moving the parent and ignore the child
|
||||
QModelIndex par = parent;
|
||||
while (par.isValid() && !ignore) {
|
||||
for (int j=0;j<items.size();j++) {
|
||||
if (par == items.at(j)) {
|
||||
ignore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
par = par.parent();
|
||||
}
|
||||
}
|
||||
if (!ignore) {
|
||||
move_items.append(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (move_items.size() > 0) {
|
||||
MediaMove* mm = new MediaMove();
|
||||
mm->to = m;
|
||||
mm->items = move_items;
|
||||
undo_stack.push(mm);
|
||||
}
|
||||
}
|
||||
}
|
||||
// dragging files within project
|
||||
// if we dragged to the root OR dragged to a folder
|
||||
if (!drop_item.isValid() || (drop_item.isValid() && m->get_type() == MEDIA_TYPE_FOLDER)) {
|
||||
QVector<Media*> move_items;
|
||||
for (int i=0;i<items.size();i++) {
|
||||
const QModelIndex& item = items.at(i);
|
||||
const QModelIndex& parent = item.parent();
|
||||
Media* s = project_parent->item_to_media(item);
|
||||
if (parent != drop_item && item != drop_item) {
|
||||
bool ignore = false;
|
||||
if (parent.isValid()) {
|
||||
// if child belongs to a selected parent, assume the user is just moving the parent and ignore the child
|
||||
QModelIndex par = parent;
|
||||
while (par.isValid() && !ignore) {
|
||||
for (int j=0;j<items.size();j++) {
|
||||
if (par == items.at(j)) {
|
||||
ignore = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
par = par.parent();
|
||||
}
|
||||
}
|
||||
if (!ignore) {
|
||||
move_items.append(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (move_items.size() > 0) {
|
||||
MediaMove* mm = new MediaMove();
|
||||
mm->to = m;
|
||||
mm->items = move_items;
|
||||
undo_stack.push(mm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SourcesCommon::reveal_in_browser() {
|
||||
Media* media = project_parent->item_to_media(selected_items.at(0));
|
||||
Footage* m = media->to_footage();
|
||||
Media* media = project_parent->item_to_media(selected_items.at(0));
|
||||
Footage* m = media->to_footage();
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
QStringList args;
|
||||
args << "/select," << QDir::toNativeSeparators(m->url);
|
||||
QProcess::startDetached("explorer", args);
|
||||
QStringList args;
|
||||
args << "/select," << QDir::toNativeSeparators(m->url);
|
||||
QProcess::startDetached("explorer", args);
|
||||
#elif defined(Q_OS_MAC)
|
||||
QStringList args;
|
||||
args << "-e";
|
||||
args << "tell application \"Finder\"";
|
||||
args << "-e";
|
||||
args << "activate";
|
||||
args << "-e";
|
||||
args << "select POSIX file \""+m->url+"\"";
|
||||
args << "-e";
|
||||
args << "end tell";
|
||||
QProcess::startDetached("osascript", args);
|
||||
QStringList args;
|
||||
args << "-e";
|
||||
args << "tell application \"Finder\"";
|
||||
args << "-e";
|
||||
args << "activate";
|
||||
args << "-e";
|
||||
args << "select POSIX file \""+m->url+"\"";
|
||||
args << "-e";
|
||||
args << "end tell";
|
||||
QProcess::startDetached("osascript", args);
|
||||
#else
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(m->url.left(m->url.lastIndexOf('/'))));
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(m->url.left(m->url.lastIndexOf('/'))));
|
||||
#endif
|
||||
}
|
||||
|
||||
void SourcesCommon::stop_rename_timer() {
|
||||
rename_timer.stop();
|
||||
rename_timer.stop();
|
||||
}
|
||||
|
||||
void SourcesCommon::rename_interval() {
|
||||
stop_rename_timer();
|
||||
if (view->hasFocus() && editing_item != NULL) {
|
||||
view->edit(editing_index);
|
||||
}
|
||||
stop_rename_timer();
|
||||
if (view->hasFocus() && editing_item != NULL) {
|
||||
view->edit(editing_index);
|
||||
}
|
||||
}
|
||||
|
||||
void SourcesCommon::item_renamed(Media* item) {
|
||||
if (editing_item == item) {
|
||||
MediaRename* mr = new MediaRename(item, "idk");
|
||||
undo_stack.push(mr);
|
||||
editing_item = NULL;
|
||||
}
|
||||
if (editing_item == item) {
|
||||
MediaRename* mr = new MediaRename(item, "idk");
|
||||
undo_stack.push(mr);
|
||||
editing_item = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
+47
-45
@@ -5,6 +5,8 @@
|
||||
#include "sequence.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "io/clipboard.h"
|
||||
|
||||
#include "effects/internal/crossdissolvetransition.h"
|
||||
#include "effects/internal/linearfadetransition.h"
|
||||
#include "effects/internal/exponentialfadetransition.h"
|
||||
@@ -19,71 +21,71 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
Transition::Transition(Clip* c, Clip* s, const EffectMeta* em) :
|
||||
Effect(c, em), secondary_clip(s),
|
||||
length(30)
|
||||
Effect(c, em), secondary_clip(s),
|
||||
length(30)
|
||||
{
|
||||
length_field = add_row("Length:", false)->add_field(EFFECT_FIELD_DOUBLE, "length");
|
||||
connect(length_field, SIGNAL(changed()), this, SLOT(set_length_from_slider()));
|
||||
length_field->set_double_default_value(30);
|
||||
length_field->set_double_minimum_value(0);
|
||||
length_field = add_row("Length:", false)->add_field(EFFECT_FIELD_DOUBLE, "length");
|
||||
connect(length_field, SIGNAL(changed()), this, SLOT(set_length_from_slider()));
|
||||
length_field->set_double_default_value(30);
|
||||
length_field->set_double_minimum_value(0);
|
||||
|
||||
LabelSlider* length_ui_ele = static_cast<LabelSlider*>(length_field->ui_element);
|
||||
length_ui_ele->set_display_type(LABELSLIDER_FRAMENUMBER);
|
||||
length_ui_ele->set_frame_rate(parent_clip->sequence->frame_rate);
|
||||
LabelSlider* length_ui_ele = static_cast<LabelSlider*>(length_field->ui_element);
|
||||
length_ui_ele->set_display_type(LABELSLIDER_FRAMENUMBER);
|
||||
length_ui_ele->set_frame_rate(parent_clip->sequence == NULL ? parent_clip->cached_fr : parent_clip->sequence->frame_rate);
|
||||
}
|
||||
|
||||
int Transition::copy(Clip *c, Clip* s) {
|
||||
int copy_index = create_transition(c, s, meta);
|
||||
c->sequence->transitions.at(copy_index)->length = length;
|
||||
return copy_index;
|
||||
return create_transition(c, s, meta, length);
|
||||
}
|
||||
|
||||
void Transition::set_length(long l) {
|
||||
length = l;
|
||||
length_field->set_double_value(l);
|
||||
length = l;
|
||||
length_field->set_double_value(l);
|
||||
}
|
||||
|
||||
long Transition::get_true_length() {
|
||||
return length;
|
||||
return length;
|
||||
}
|
||||
|
||||
long Transition::get_length() {
|
||||
if (secondary_clip != NULL) {
|
||||
return length * 2;
|
||||
}
|
||||
return length;
|
||||
if (secondary_clip != NULL) {
|
||||
return length * 2;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
void Transition::set_length_from_slider() {
|
||||
set_length(length_field->get_double_value(0));
|
||||
update_ui(false);
|
||||
set_length(length_field->get_double_value(0));
|
||||
update_ui(false);
|
||||
}
|
||||
|
||||
Transition* get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* em) {
|
||||
if (!em->filename.isEmpty()) {
|
||||
// load effect from file
|
||||
return new Transition(c, s, em);
|
||||
} else if (em->internal >= 0 && em->internal < TRANSITION_INTERNAL_COUNT) {
|
||||
// must be an internal effect
|
||||
switch (em->internal) {
|
||||
case TRANSITION_INTERNAL_CROSSDISSOLVE: return new CrossDissolveTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_LINEARFADE: return new LinearFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_EXPONENTIALFADE: return new ExponentialFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_LOGARITHMICFADE: return new LogarithmicFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_CUBE: return new CubeTransition(c, s, em);
|
||||
}
|
||||
} else {
|
||||
dout << "[ERROR] Invalid transition data";
|
||||
QMessageBox::critical(mainWindow, "Invalid transition", "No candidate for transition '" + em->name + "'. This transition may be corrupt. Try reinstalling it or Olive.");
|
||||
}
|
||||
return NULL;
|
||||
if (!em->filename.isEmpty()) {
|
||||
// load effect from file
|
||||
return new Transition(c, s, em);
|
||||
} else if (em->internal >= 0 && em->internal < TRANSITION_INTERNAL_COUNT) {
|
||||
// must be an internal effect
|
||||
switch (em->internal) {
|
||||
case TRANSITION_INTERNAL_CROSSDISSOLVE: return new CrossDissolveTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_LINEARFADE: return new LinearFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_EXPONENTIALFADE: return new ExponentialFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_LOGARITHMICFADE: return new LogarithmicFadeTransition(c, s, em);
|
||||
case TRANSITION_INTERNAL_CUBE: return new CubeTransition(c, s, em);
|
||||
}
|
||||
} else {
|
||||
dout << "[ERROR] Invalid transition data";
|
||||
QMessageBox::critical(mainWindow, "Invalid transition", "No candidate for transition '" + em->name + "'. This transition may be corrupt. Try reinstalling it or Olive.");
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int create_transition(Clip* c, Clip* s, const EffectMeta* em) {
|
||||
Transition* t = get_transition_from_meta(c, s, em);
|
||||
if (t != NULL) {
|
||||
c->sequence->transitions.append(t);
|
||||
return c->sequence->transitions.size() - 1;
|
||||
}
|
||||
return -1;
|
||||
int create_transition(Clip* c, Clip* s, const EffectMeta* em, long length) {
|
||||
Transition* t = get_transition_from_meta(c, s, em);
|
||||
if (length >= 0) t->set_length(length);
|
||||
if (t != NULL) {
|
||||
QVector<Transition*>& transition_list = (c->sequence == NULL) ? clipboard_transitions : c->sequence->transitions;
|
||||
transition_list.append(t);
|
||||
return transition_list.size() - 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
+11
-11
@@ -14,22 +14,22 @@
|
||||
#define TRANSITION_INTERNAL_CUBE 4
|
||||
#define TRANSITION_INTERNAL_COUNT 5
|
||||
|
||||
int create_transition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
int create_transition(Clip* c, Clip* s, const EffectMeta* em, long length = -1);
|
||||
|
||||
class Transition : public Effect {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
Transition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
int copy(Clip* c, Clip* s);
|
||||
Clip* secondary_clip;
|
||||
void set_length(long l);
|
||||
long get_true_length();
|
||||
long get_length();
|
||||
Transition(Clip* c, Clip* s, const EffectMeta* em);
|
||||
int copy(Clip* c, Clip* s);
|
||||
Clip* secondary_clip;
|
||||
void set_length(long l);
|
||||
long get_true_length();
|
||||
long get_length();
|
||||
private slots:
|
||||
void set_length_from_slider();
|
||||
void set_length_from_slider();
|
||||
private:
|
||||
long length; // used only for transitions
|
||||
EffectField* length_field;
|
||||
long length; // used only for transitions
|
||||
EffectField* length_field;
|
||||
};
|
||||
|
||||
#endif // TRANSITION_H
|
||||
|
||||
+353
-321
File diff suppressed because it is too large
Load Diff
+181
-177
@@ -28,48 +28,66 @@ extern QUndoStack undo_stack;
|
||||
|
||||
class ComboAction : public QUndoCommand {
|
||||
public:
|
||||
ComboAction();
|
||||
~ComboAction();
|
||||
void undo();
|
||||
void redo();
|
||||
void append(QUndoCommand* u);
|
||||
ComboAction();
|
||||
~ComboAction();
|
||||
void undo();
|
||||
void redo();
|
||||
void append(QUndoCommand* u);
|
||||
void appendPost(QUndoCommand* u);
|
||||
private:
|
||||
QVector<QUndoCommand*> commands;
|
||||
QVector<QUndoCommand*> commands;
|
||||
QVector<QUndoCommand*> post_commands;
|
||||
};
|
||||
|
||||
class MoveClipAction : public QUndoCommand {
|
||||
public:
|
||||
MoveClipAction(Clip* c, long iin, long iout, long iclip_in, int itrack);
|
||||
void undo();
|
||||
void redo();
|
||||
MoveClipAction(Clip* c, long iin, long iout, long iclip_in, int itrack, bool irelative);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Clip* clip;
|
||||
Clip* clip;
|
||||
|
||||
long old_in;
|
||||
long old_out;
|
||||
long old_clip_in;
|
||||
int old_track;
|
||||
long old_in;
|
||||
long old_out;
|
||||
long old_clip_in;
|
||||
int old_track;
|
||||
|
||||
long new_in;
|
||||
long new_out;
|
||||
long new_clip_in;
|
||||
int new_track;
|
||||
long new_in;
|
||||
long new_out;
|
||||
long new_clip_in;
|
||||
int new_track;
|
||||
|
||||
bool relative;
|
||||
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class RippleAction : public QUndoCommand {
|
||||
public:
|
||||
RippleAction(Sequence *is, long ipoint, long ilength, const QVector<int>& iignore);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Sequence *s;
|
||||
long point;
|
||||
long length;
|
||||
QVector<int> ignore;
|
||||
ComboAction* ca;
|
||||
};
|
||||
|
||||
class DeleteClipAction : public QUndoCommand {
|
||||
public:
|
||||
DeleteClipAction(Sequence* s, int clip);
|
||||
~DeleteClipAction();
|
||||
void undo();
|
||||
void redo();
|
||||
DeleteClipAction(Sequence* s, int clip);
|
||||
~DeleteClipAction();
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Sequence* seq;
|
||||
Clip* ref;
|
||||
int index;
|
||||
Sequence* seq;
|
||||
Clip* ref;
|
||||
int index;
|
||||
|
||||
int opening_transition;
|
||||
int closing_transition;
|
||||
|
||||
QVector<int> linkClipIndex;
|
||||
QVector<int> linkLinkIndex;
|
||||
@@ -79,207 +97,193 @@ private:
|
||||
|
||||
class ChangeSequenceAction : public QUndoCommand {
|
||||
public:
|
||||
ChangeSequenceAction(Sequence* s);
|
||||
void undo();
|
||||
void redo();
|
||||
ChangeSequenceAction(Sequence* s);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Sequence* old_sequence;
|
||||
Sequence* new_sequence;
|
||||
Sequence* old_sequence;
|
||||
Sequence* new_sequence;
|
||||
};
|
||||
|
||||
class AddEffectCommand : public QUndoCommand {
|
||||
public:
|
||||
AddEffectCommand(Clip* c, Effect *e, const EffectMeta* m, int insert_pos = -1);
|
||||
~AddEffectCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
AddEffectCommand(Clip* c, Effect *e, const EffectMeta* m, int insert_pos = -1);
|
||||
~AddEffectCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Clip* clip;
|
||||
Clip* clip;
|
||||
const EffectMeta* meta;
|
||||
Effect* ref;
|
||||
int pos;
|
||||
bool done;
|
||||
Effect* ref;
|
||||
int pos;
|
||||
bool done;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class AddTransitionCommand : public QUndoCommand {
|
||||
public:
|
||||
AddTransitionCommand(Clip* c, Clip* s, Transition *copy, const EffectMeta* itransition, int itype, int ilength);
|
||||
void undo();
|
||||
void redo();
|
||||
AddTransitionCommand(Clip* c, Clip* s, Transition *copy, const EffectMeta* itransition, int itype, int ilength);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Clip* clip;
|
||||
Clip* secondary;
|
||||
Transition* transition_to_copy;
|
||||
Clip* clip;
|
||||
Clip* secondary;
|
||||
Transition* transition_to_copy;
|
||||
const EffectMeta* transition;
|
||||
int type;
|
||||
int length;
|
||||
int type;
|
||||
int length;
|
||||
bool old_project_changed;
|
||||
int old_ptransition;
|
||||
int old_stransition;
|
||||
int old_ptransition;
|
||||
int old_stransition;
|
||||
};
|
||||
|
||||
class ModifyTransitionCommand : public QUndoCommand {
|
||||
public:
|
||||
ModifyTransitionCommand(Clip* c, int itype, long ilength);
|
||||
void undo();
|
||||
void redo();
|
||||
ModifyTransitionCommand(Clip* c, int itype, long ilength);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Clip* clip;
|
||||
int type;
|
||||
long new_length;
|
||||
long old_length;
|
||||
Clip* clip;
|
||||
int type;
|
||||
long new_length;
|
||||
long old_length;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class DeleteTransitionCommand : public QUndoCommand {
|
||||
public:
|
||||
DeleteTransitionCommand(Sequence* s, int transition_index);
|
||||
~DeleteTransitionCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
DeleteTransitionCommand(Sequence* s, int transition_index);
|
||||
~DeleteTransitionCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Sequence* seq;
|
||||
int index;
|
||||
Transition* transition;
|
||||
Clip* otc;
|
||||
Clip* ctc;
|
||||
Sequence* seq;
|
||||
int index;
|
||||
Transition* transition;
|
||||
Clip* otc;
|
||||
Clip* ctc;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class SetTimelineInOutCommand : public QUndoCommand {
|
||||
public:
|
||||
SetTimelineInOutCommand(Sequence* s, bool enabled, long in, long out);
|
||||
void undo();
|
||||
void redo();
|
||||
SetTimelineInOutCommand(Sequence* s, bool enabled, long in, long out);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Sequence* seq;
|
||||
Sequence* seq;
|
||||
|
||||
bool old_enabled;
|
||||
long old_in;
|
||||
long old_out;
|
||||
bool old_enabled;
|
||||
long old_in;
|
||||
long old_out;
|
||||
|
||||
bool new_enabled;
|
||||
long new_in;
|
||||
long new_out;
|
||||
bool new_enabled;
|
||||
long new_in;
|
||||
long new_out;
|
||||
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class NewSequenceCommand : public QUndoCommand {
|
||||
public:
|
||||
NewSequenceCommand(Media *s, Media* iparent);
|
||||
~NewSequenceCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
NewSequenceCommand(Media *s, Media* iparent);
|
||||
~NewSequenceCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Media* seq;
|
||||
Media* parent;
|
||||
bool done;
|
||||
Media* seq;
|
||||
Media* parent;
|
||||
bool done;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class AddMediaCommand : public QUndoCommand {
|
||||
public:
|
||||
AddMediaCommand(Media* iitem, Media* iparent);
|
||||
~AddMediaCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
AddMediaCommand(Media* iitem, Media* iparent);
|
||||
~AddMediaCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Media* item;
|
||||
Media* parent;
|
||||
bool done;
|
||||
Media* item;
|
||||
Media* parent;
|
||||
bool done;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class DeleteMediaCommand : public QUndoCommand {
|
||||
public:
|
||||
DeleteMediaCommand(Media *i);
|
||||
~DeleteMediaCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
DeleteMediaCommand(Media *i);
|
||||
~DeleteMediaCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Media* item;
|
||||
Media* parent;
|
||||
Media* item;
|
||||
Media* parent;
|
||||
bool old_project_changed;
|
||||
bool done;
|
||||
};
|
||||
|
||||
class RippleCommand : public QUndoCommand {
|
||||
public:
|
||||
RippleCommand(Sequence* s, long ipoint, long ilength);
|
||||
QVector<Clip*> ignore;
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Sequence* seq;
|
||||
long point;
|
||||
long length;
|
||||
QVector<Clip*> rippled;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class AddClipCommand : public QUndoCommand {
|
||||
public:
|
||||
AddClipCommand(Sequence* s, QVector<Clip*>& add);
|
||||
~AddClipCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
AddClipCommand(Sequence* s, QVector<Clip*>& add);
|
||||
~AddClipCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Sequence* seq;
|
||||
QVector<Clip*> clips;
|
||||
Sequence* seq;
|
||||
QVector<Clip*> clips;
|
||||
QVector<Clip*> undone_clips;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class LinkCommand : public QUndoCommand {
|
||||
public:
|
||||
LinkCommand();
|
||||
void undo();
|
||||
LinkCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
Sequence* s;
|
||||
QVector<int> clips;
|
||||
bool link;
|
||||
bool link;
|
||||
private:
|
||||
QVector< QVector<int> > old_links;
|
||||
QVector< QVector<int> > old_links;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class CheckboxCommand : public QUndoCommand {
|
||||
public:
|
||||
CheckboxCommand(QCheckBox* b);
|
||||
~CheckboxCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
CheckboxCommand(QCheckBox* b);
|
||||
~CheckboxCommand();
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
QCheckBox* box;
|
||||
bool checked;
|
||||
bool done;
|
||||
QCheckBox* box;
|
||||
bool checked;
|
||||
bool done;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class ReplaceMediaCommand : public QUndoCommand {
|
||||
public:
|
||||
ReplaceMediaCommand(Media*, QString);
|
||||
ReplaceMediaCommand(Media*, QString);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Media *item;
|
||||
Media *item;
|
||||
QString old_filename;
|
||||
QString new_filename;
|
||||
bool old_project_changed;
|
||||
bool old_project_changed;
|
||||
void replace(QString& filename);
|
||||
};
|
||||
|
||||
class ReplaceClipMediaCommand : public QUndoCommand {
|
||||
public:
|
||||
ReplaceClipMediaCommand(Media *, Media *, bool);
|
||||
ReplaceClipMediaCommand(Media *, Media *, bool);
|
||||
void undo();
|
||||
void redo();
|
||||
QVector<Clip*> clips;
|
||||
private:
|
||||
Media* old_media;
|
||||
Media* new_media;
|
||||
Media* old_media;
|
||||
Media* new_media;
|
||||
bool preserve_clip_ins;
|
||||
bool old_project_changed;
|
||||
QVector<int> old_clip_ins;
|
||||
@@ -302,26 +306,26 @@ private:
|
||||
|
||||
class MediaMove : public QUndoCommand {
|
||||
public:
|
||||
MediaMove();
|
||||
QVector<Media*> items;
|
||||
Media* to;
|
||||
MediaMove();
|
||||
QVector<Media*> items;
|
||||
Media* to;
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
QVector<Media*> froms;
|
||||
QVector<Media*> froms;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class MediaRename : public QUndoCommand {
|
||||
public:
|
||||
MediaRename(Media* iitem, QString to);
|
||||
void undo();
|
||||
void redo();
|
||||
MediaRename(Media* iitem, QString to);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
bool old_project_changed;
|
||||
Media* item;
|
||||
QString from;
|
||||
QString to;
|
||||
bool old_project_changed;
|
||||
Media* item;
|
||||
QString from;
|
||||
QString to;
|
||||
};
|
||||
|
||||
class KeyframeMove : public QUndoCommand {
|
||||
@@ -386,9 +390,9 @@ private:
|
||||
class SetAutoscaleAction : public QUndoCommand {
|
||||
public:
|
||||
SetAutoscaleAction();
|
||||
void undo();
|
||||
void redo();
|
||||
QVector<Clip*> clips;
|
||||
void undo();
|
||||
void redo();
|
||||
QVector<Clip*> clips;
|
||||
private:
|
||||
bool old_project_changed;
|
||||
};
|
||||
@@ -458,14 +462,14 @@ private:
|
||||
|
||||
class SetSelectionsCommand : public QUndoCommand {
|
||||
public:
|
||||
SetSelectionsCommand(Sequence *s);
|
||||
void undo();
|
||||
void redo();
|
||||
QVector<Selection> old_data;
|
||||
QVector<Selection> new_data;
|
||||
SetSelectionsCommand(Sequence *s);
|
||||
void undo();
|
||||
void redo();
|
||||
QVector<Selection> old_data;
|
||||
QVector<Selection> new_data;
|
||||
private:
|
||||
Sequence* seq;
|
||||
bool done;
|
||||
Sequence* seq;
|
||||
bool done;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
@@ -483,7 +487,7 @@ private:
|
||||
|
||||
class EditSequenceCommand : public QUndoCommand {
|
||||
public:
|
||||
EditSequenceCommand(Media *i, Sequence* s);
|
||||
EditSequenceCommand(Media *i, Sequence* s);
|
||||
void undo();
|
||||
void redo();
|
||||
void update();
|
||||
@@ -495,7 +499,7 @@ public:
|
||||
int audio_frequency;
|
||||
int audio_layout;
|
||||
private:
|
||||
Media* item;
|
||||
Media* item;
|
||||
Sequence* seq;
|
||||
bool old_project_changed;
|
||||
|
||||
@@ -509,25 +513,25 @@ private:
|
||||
|
||||
class SetInt : public QUndoCommand {
|
||||
public:
|
||||
SetInt(int* pointer, int new_value);
|
||||
void undo();
|
||||
void redo();
|
||||
SetInt(int* pointer, int new_value);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
int* p;
|
||||
int oldval;
|
||||
int newval;
|
||||
int* p;
|
||||
int oldval;
|
||||
int newval;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
class SetString : public QUndoCommand {
|
||||
public:
|
||||
SetString(QString* pointer, QString new_value);
|
||||
void undo();
|
||||
void redo();
|
||||
SetString(QString* pointer, QString new_value);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
QString* p;
|
||||
QString oldval;
|
||||
QString newval;
|
||||
QString* p;
|
||||
QString oldval;
|
||||
QString newval;
|
||||
bool old_project_changed;
|
||||
};
|
||||
|
||||
@@ -539,11 +543,11 @@ public:
|
||||
|
||||
class UpdateFootageTooltip : public QUndoCommand {
|
||||
public:
|
||||
UpdateFootageTooltip(Media* i);
|
||||
UpdateFootageTooltip(Media* i);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
Media* item;
|
||||
Media* item;
|
||||
};
|
||||
|
||||
class MoveEffectCommand : public QUndoCommand {
|
||||
@@ -585,20 +589,20 @@ private:
|
||||
|
||||
class SetPointer : public QUndoCommand {
|
||||
public:
|
||||
SetPointer(void** pointer, void* data);
|
||||
void undo();
|
||||
void redo();
|
||||
SetPointer(void** pointer, void* data);
|
||||
void undo();
|
||||
void redo();
|
||||
private:
|
||||
bool old_changed;
|
||||
void** p;
|
||||
void* new_data;
|
||||
void* old_data;
|
||||
bool old_changed;
|
||||
void** p;
|
||||
void* new_data;
|
||||
void* old_data;
|
||||
};
|
||||
|
||||
class ReloadEffectsCommand : public QUndoCommand {
|
||||
public:
|
||||
void undo();
|
||||
void redo();
|
||||
void undo();
|
||||
void redo();
|
||||
};
|
||||
|
||||
#endif // UNDO_H
|
||||
|
||||
+109
-109
@@ -11,7 +11,7 @@
|
||||
#include "panels/viewer.h"
|
||||
#include "ui/viewerwidget.h"
|
||||
#include "project/sequence.h"
|
||||
#include "ui_effectcontrols.h"
|
||||
#include "ui/resizablescrollbar.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QMouseEvent>
|
||||
@@ -27,44 +27,44 @@ long KeyframeView::adjust_row_keyframe(EffectRow* row, long time) {
|
||||
|
||||
KeyframeView::KeyframeView(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
visible_in(0),
|
||||
visible_out(0),
|
||||
visible_in(0),
|
||||
visible_out(0),
|
||||
mousedown(false),
|
||||
dragging(false),
|
||||
keys_selected(false),
|
||||
select_rect(false),
|
||||
select_rect(false),
|
||||
x_scroll(0),
|
||||
y_scroll(0),
|
||||
scroll_drag(false)
|
||||
y_scroll(0),
|
||||
scroll_drag(false)
|
||||
{
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
setMouseTracking(true);
|
||||
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu(const QPoint&)));
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu(const QPoint&)));
|
||||
}
|
||||
|
||||
void KeyframeView::show_context_menu(const QPoint& pos) {
|
||||
if (selected_rows.size() > 0) {
|
||||
QMenu menu(this);
|
||||
QAction* linear = menu.addAction("Linear");
|
||||
linear->setData(KEYFRAME_TYPE_LINEAR);
|
||||
QAction* smooth = menu.addAction("Smooth");
|
||||
smooth->setData(KEYFRAME_TYPE_SMOOTH);
|
||||
/*QAction* bezier = menu.addAction("Bezier");
|
||||
bezier->setData(KEYFRAME_TYPE_BEZIER);*/
|
||||
connect(&menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_set_key_type(QAction*)));
|
||||
menu.exec(mapToGlobal(pos));
|
||||
}
|
||||
if (selected_rows.size() > 0) {
|
||||
QMenu menu(this);
|
||||
QAction* linear = menu.addAction("Linear");
|
||||
linear->setData(KEYFRAME_TYPE_LINEAR);
|
||||
QAction* smooth = menu.addAction("Smooth");
|
||||
smooth->setData(KEYFRAME_TYPE_SMOOTH);
|
||||
/*QAction* bezier = menu.addAction("Bezier");
|
||||
bezier->setData(KEYFRAME_TYPE_BEZIER);*/
|
||||
connect(&menu, SIGNAL(triggered(QAction*)), this, SLOT(menu_set_key_type(QAction*)));
|
||||
menu.exec(mapToGlobal(pos));
|
||||
}
|
||||
}
|
||||
|
||||
void KeyframeView::menu_set_key_type(QAction* a) {
|
||||
ComboAction* ca = new ComboAction();
|
||||
for (int i=0;i<selected_rows.size();i++) {
|
||||
ca->append(new SetInt(&selected_rows.at(i)->keyframe_types[selected_keyframes.at(i)], a->data().toInt()));
|
||||
}
|
||||
undo_stack.push(ca);
|
||||
update();
|
||||
ComboAction* ca = new ComboAction();
|
||||
for (int i=0;i<selected_rows.size();i++) {
|
||||
ca->append(new SetInt(&selected_rows.at(i)->keyframe_types[selected_keyframes.at(i)], a->data().toInt()));
|
||||
}
|
||||
undo_stack.push(ca);
|
||||
update();
|
||||
}
|
||||
|
||||
void KeyframeView::paintEvent(QPaintEvent*) {
|
||||
@@ -99,7 +99,7 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
||||
bool keyframe_selected = keyframeIsSelected(row, k);
|
||||
long keyframe_frame = adjust_row_keyframe(row, row->keyframe_times.at(k));
|
||||
if (dragging && keyframe_selected) keyframe_frame += frame_diff;
|
||||
draw_keyframe(p, row->keyframe_types.at(k), getScreenPointFromFrame(panel_effect_controls->zoom, keyframe_frame) - x_scroll, keyframe_y, keyframe_selected);
|
||||
draw_keyframe(p, row->keyframe_types.at(k), getScreenPointFromFrame(panel_effect_controls->zoom, keyframe_frame) - x_scroll, keyframe_y, keyframe_selected);
|
||||
}
|
||||
|
||||
rows.append(row);
|
||||
@@ -113,7 +113,7 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
||||
if (max_width < width()) {
|
||||
p.fillRect(QRect(max_width, 0, width(), height()), QColor(0, 0, 0, 64));
|
||||
}
|
||||
panel_effect_controls->ui->horizontalScrollBar->setMaximum(qMax(max_width - width(), 0));
|
||||
panel_effect_controls->horizontalScrollBar->setMaximum(qMax(max_width - width(), 0));
|
||||
header->set_visible_in(visible_in);
|
||||
|
||||
int playhead_x = getScreenPointFromFrame(panel_effect_controls->zoom, sequence->playhead-visible_in) - x_scroll;
|
||||
@@ -129,9 +129,9 @@ void KeyframeView::paintEvent(QPaintEvent*) {
|
||||
draw_selection_rectangle(p, QRect(rect_select_x, rect_select_y, rect_select_w, rect_select_h));
|
||||
}
|
||||
|
||||
/*if (mouseover && mouseover_row < rowY.size()) {
|
||||
/*if (mouseover && mouseover_row < rowY.size()) {
|
||||
draw_keyframe(p, getScreenPointFromFrame(panel_effect_controls->zoom, mouseover_frame - visible_in), rowY.at(mouseover_row), true);
|
||||
}*/
|
||||
}*/
|
||||
}
|
||||
|
||||
bool KeyframeView::keyframeIsSelected(EffectRow *row, int keyframe) {
|
||||
@@ -173,98 +173,98 @@ void KeyframeView::set_y_scroll(int s) {
|
||||
}
|
||||
|
||||
void KeyframeView::draw_keyframe(QPainter &p, int type, int x, int y, bool darker) {
|
||||
int color = (darker) ? 100 : 160;
|
||||
p.setPen(QColor(0, 0, 0));
|
||||
p.setBrush(QColor(color, color, color));
|
||||
int color = (darker) ? 100 : 160;
|
||||
p.setPen(QColor(0, 0, 0));
|
||||
p.setBrush(QColor(color, color, color));
|
||||
|
||||
switch (type) {
|
||||
case KEYFRAME_TYPE_LINEAR:
|
||||
{
|
||||
QPoint points[KEYFRAME_POINT_COUNT] = {QPoint(x-KEYFRAME_SIZE, y), QPoint(x, y-KEYFRAME_SIZE), QPoint(x+KEYFRAME_SIZE, y), QPoint(x, y+KEYFRAME_SIZE)};
|
||||
p.drawPolygon(points, KEYFRAME_POINT_COUNT);
|
||||
}
|
||||
break;
|
||||
case KEYFRAME_TYPE_SMOOTH:
|
||||
p.drawEllipse(QPoint(x, y), KEYFRAME_SIZE, KEYFRAME_SIZE);
|
||||
break;
|
||||
}
|
||||
switch (type) {
|
||||
case KEYFRAME_TYPE_LINEAR:
|
||||
{
|
||||
QPoint points[KEYFRAME_POINT_COUNT] = {QPoint(x-KEYFRAME_SIZE, y), QPoint(x, y-KEYFRAME_SIZE), QPoint(x+KEYFRAME_SIZE, y), QPoint(x, y+KEYFRAME_SIZE)};
|
||||
p.drawPolygon(points, KEYFRAME_POINT_COUNT);
|
||||
}
|
||||
break;
|
||||
case KEYFRAME_TYPE_SMOOTH:
|
||||
p.drawEllipse(QPoint(x, y), KEYFRAME_SIZE, KEYFRAME_SIZE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void KeyframeView::resize_move(double d) {
|
||||
header->update_zoom(header->get_zoom()*d);
|
||||
header->update_zoom(header->get_zoom()*d);
|
||||
}
|
||||
|
||||
void KeyframeView::mousePressEvent(QMouseEvent *event) {
|
||||
rect_select_x = event->x();
|
||||
rect_select_y = event->y();
|
||||
rect_select_x = event->x();
|
||||
rect_select_y = event->y();
|
||||
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_HAND || event->buttons() & Qt::MiddleButton) {
|
||||
scroll_drag = true;
|
||||
return;
|
||||
}
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_HAND || event->buttons() & Qt::MiddleButton) {
|
||||
scroll_drag = true;
|
||||
return;
|
||||
}
|
||||
|
||||
int mouse_x = event->x() + x_scroll;
|
||||
int mouse_y = event->y();
|
||||
int row_index = -1;
|
||||
int keyframe_index = -1;
|
||||
long frame_diff = 0;
|
||||
long frame_min = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x-KEYFRAME_SIZE);
|
||||
drag_frame_start = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x);
|
||||
long frame_max = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x+KEYFRAME_SIZE);
|
||||
for (int i=0;i<rowY.size();i++) {
|
||||
if (mouse_y > rowY.at(i)-KEYFRAME_SIZE-KEYFRAME_SIZE && mouse_y < rowY.at(i)+KEYFRAME_SIZE+KEYFRAME_SIZE) {
|
||||
EffectRow* row = rows.at(i);
|
||||
for (int j=0;j<row->keyframe_times.size();j++) {
|
||||
long eval_keyframe_time = row->keyframe_times.at(j)-row->parent_effect->parent_clip->clip_in+(row->parent_effect->parent_clip->timeline_in-visible_in);
|
||||
if (eval_keyframe_time >= frame_min && eval_keyframe_time <= frame_max) {
|
||||
long eval_frame_diff = qAbs(eval_keyframe_time - drag_frame_start);
|
||||
if (keyframe_index == -1 || eval_frame_diff < frame_diff) {
|
||||
row_index = i;
|
||||
keyframe_index = j;
|
||||
frame_diff = eval_frame_diff;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool already_selected = false;
|
||||
keys_selected = false;
|
||||
if (keyframe_index > -1) already_selected = keyframeIsSelected(rows.at(row_index), keyframe_index);
|
||||
if (!already_selected) {
|
||||
if (!(event->modifiers() & Qt::ShiftModifier)) {
|
||||
selected_rows.clear();
|
||||
selected_keyframes.clear();
|
||||
}
|
||||
if (keyframe_index > -1) {
|
||||
selected_rows.append(rows.at(row_index));
|
||||
selected_keyframes.append(keyframe_index);
|
||||
}
|
||||
}
|
||||
int mouse_x = event->x() + x_scroll;
|
||||
int mouse_y = event->y();
|
||||
int row_index = -1;
|
||||
int keyframe_index = -1;
|
||||
long frame_diff = 0;
|
||||
long frame_min = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x-KEYFRAME_SIZE);
|
||||
drag_frame_start = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x);
|
||||
long frame_max = getFrameFromScreenPoint(panel_effect_controls->zoom, mouse_x+KEYFRAME_SIZE);
|
||||
for (int i=0;i<rowY.size();i++) {
|
||||
if (mouse_y > rowY.at(i)-KEYFRAME_SIZE-KEYFRAME_SIZE && mouse_y < rowY.at(i)+KEYFRAME_SIZE+KEYFRAME_SIZE) {
|
||||
EffectRow* row = rows.at(i);
|
||||
for (int j=0;j<row->keyframe_times.size();j++) {
|
||||
long eval_keyframe_time = row->keyframe_times.at(j)-row->parent_effect->parent_clip->clip_in+(row->parent_effect->parent_clip->timeline_in-visible_in);
|
||||
if (eval_keyframe_time >= frame_min && eval_keyframe_time <= frame_max) {
|
||||
long eval_frame_diff = qAbs(eval_keyframe_time - drag_frame_start);
|
||||
if (keyframe_index == -1 || eval_frame_diff < frame_diff) {
|
||||
row_index = i;
|
||||
keyframe_index = j;
|
||||
frame_diff = eval_frame_diff;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
bool already_selected = false;
|
||||
keys_selected = false;
|
||||
if (keyframe_index > -1) already_selected = keyframeIsSelected(rows.at(row_index), keyframe_index);
|
||||
if (!already_selected) {
|
||||
if (!(event->modifiers() & Qt::ShiftModifier)) {
|
||||
selected_rows.clear();
|
||||
selected_keyframes.clear();
|
||||
}
|
||||
if (keyframe_index > -1) {
|
||||
selected_rows.append(rows.at(row_index));
|
||||
selected_keyframes.append(keyframe_index);
|
||||
}
|
||||
}
|
||||
|
||||
if (selected_rows.size() > 0) {
|
||||
keys_selected = true;
|
||||
}
|
||||
if (selected_rows.size() > 0) {
|
||||
keys_selected = true;
|
||||
}
|
||||
|
||||
update();
|
||||
update();
|
||||
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
mousedown = true;
|
||||
}
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
mousedown = true;
|
||||
}
|
||||
}
|
||||
|
||||
void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_HAND) {
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
} else {
|
||||
unsetCursor();
|
||||
}
|
||||
if (scroll_drag) {
|
||||
panel_effect_controls->ui->horizontalScrollBar->setValue(panel_effect_controls->ui->horizontalScrollBar->value() + rect_select_x - event->pos().x());
|
||||
panel_effect_controls->ui->verticalScrollBar->setValue(panel_effect_controls->ui->verticalScrollBar->value() + rect_select_y - event->pos().y());
|
||||
rect_select_x = event->pos().x();
|
||||
rect_select_y = event->pos().y();
|
||||
} else if (mousedown) {
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_HAND) {
|
||||
setCursor(Qt::OpenHandCursor);
|
||||
} else {
|
||||
unsetCursor();
|
||||
}
|
||||
if (scroll_drag) {
|
||||
panel_effect_controls->horizontalScrollBar->setValue(panel_effect_controls->horizontalScrollBar->value() + rect_select_x - event->pos().x());
|
||||
panel_effect_controls->verticalScrollBar->setValue(panel_effect_controls->verticalScrollBar->value() + rect_select_y - event->pos().y());
|
||||
rect_select_x = event->pos().x();
|
||||
rect_select_y = event->pos().y();
|
||||
} else if (mousedown) {
|
||||
int mouse_x = event->x() + x_scroll;
|
||||
if (keys_selected) {
|
||||
// move keyframes
|
||||
@@ -333,7 +333,7 @@ void KeyframeView::mouseMoveEvent(QMouseEvent* event) {
|
||||
select_rect = true;
|
||||
}
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KeyframeView::mouseReleaseEvent(QMouseEvent*) {
|
||||
@@ -347,8 +347,8 @@ void KeyframeView::mouseReleaseEvent(QMouseEvent*) {
|
||||
|
||||
select_rect = false;
|
||||
dragging = false;
|
||||
mousedown = false;
|
||||
scroll_drag = false;
|
||||
mousedown = false;
|
||||
scroll_drag = false;
|
||||
panel_timeline->snapped = false;
|
||||
update();
|
||||
}
|
||||
|
||||
+68
-66
@@ -9,96 +9,98 @@
|
||||
#define RESIZE_HANDLE_SIZE 10
|
||||
|
||||
ResizableScrollBar::ResizableScrollBar(QWidget *parent) :
|
||||
QScrollBar(parent),
|
||||
resize_init(false),
|
||||
resize_proc(false)
|
||||
QScrollBar(parent),
|
||||
resize_init(false),
|
||||
resize_proc(false)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
setSingleStep(20);
|
||||
setMaximum(0);
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
bool ResizableScrollBar::is_resizing() {
|
||||
return resize_proc;
|
||||
return resize_proc;
|
||||
}
|
||||
|
||||
void ResizableScrollBar::resizeEvent(QResizeEvent *event) {
|
||||
setPageStep(event->size().width());
|
||||
setPageStep(event->size().width());
|
||||
}
|
||||
|
||||
void ResizableScrollBar::mousePressEvent(QMouseEvent *e) {
|
||||
if (resize_init) {
|
||||
QStyleOptionSlider opt;
|
||||
initStyleOption(&opt);
|
||||
if (resize_init) {
|
||||
QStyleOptionSlider opt;
|
||||
initStyleOption(&opt);
|
||||
|
||||
QRect sr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
|
||||
QStyle::SC_ScrollBarSlider, this);
|
||||
QRect sr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
|
||||
QStyle::SC_ScrollBarSlider, this);
|
||||
|
||||
resize_proc = true;
|
||||
resize_start = e->pos().x();
|
||||
resize_proc = true;
|
||||
resize_start = e->pos().x();
|
||||
|
||||
resize_start_max = maximum();
|
||||
resize_start_width = sr.width();
|
||||
} else {
|
||||
QScrollBar::mousePressEvent(e);
|
||||
}
|
||||
resize_start_max = maximum();
|
||||
resize_start_width = sr.width();
|
||||
} else {
|
||||
QScrollBar::mousePressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void ResizableScrollBar::mouseMoveEvent(QMouseEvent *e) {
|
||||
QStyleOptionSlider opt;
|
||||
initStyleOption(&opt);
|
||||
QStyleOptionSlider opt;
|
||||
initStyleOption(&opt);
|
||||
|
||||
QRect sr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
|
||||
QStyle::SC_ScrollBarSlider, this);
|
||||
QRect gr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
|
||||
QStyle::SC_ScrollBarGroove, this);
|
||||
QRect sr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
|
||||
QStyle::SC_ScrollBarSlider, this);
|
||||
QRect gr = style()->subControlRect(QStyle::CC_ScrollBar, &opt,
|
||||
QStyle::SC_ScrollBarGroove, this);
|
||||
|
||||
if (resize_proc) {
|
||||
int diff = (e->pos().x() - resize_start);
|
||||
if (resize_top) diff = -diff;
|
||||
double scale = double(sr.width())/double(sr.width()+diff);
|
||||
if (!qIsInf(scale) && !qIsNull(scale)) {
|
||||
emit resize_move(scale);
|
||||
resize_start = e->pos().x();
|
||||
if (resize_proc) {
|
||||
int diff = (e->pos().x() - resize_start);
|
||||
if (resize_top) diff = -diff;
|
||||
double scale = double(sr.width())/double(sr.width()+diff);
|
||||
if (!qIsInf(scale) && !qIsNull(scale)) {
|
||||
emit resize_move(scale);
|
||||
resize_start = e->pos().x();
|
||||
|
||||
if (resize_top) {
|
||||
int slider_min = gr.x();
|
||||
int slider_max = gr.right() - (sr.width()+diff);
|
||||
int val = QStyle::sliderValueFromPosition(minimum(), maximum(), e->pos().x() - slider_min, slider_max - slider_min, opt.upsideDown);
|
||||
if (resize_top) {
|
||||
int slider_min = gr.x();
|
||||
int slider_max = gr.right() - (sr.width()+diff);
|
||||
int val = QStyle::sliderValueFromPosition(minimum(), maximum(), e->pos().x() - slider_min, slider_max - slider_min, opt.upsideDown);
|
||||
|
||||
setValue(val);
|
||||
} else {
|
||||
setValue(qRound(value() * scale));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bool new_resize_init = false;
|
||||
setValue(val);
|
||||
} else {
|
||||
setValue(qRound(value() * scale));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bool new_resize_init = false;
|
||||
|
||||
if ((orientation() == Qt::Horizontal && e->pos().x() > sr.left()-RESIZE_HANDLE_SIZE && e->pos().x() < sr.left()+RESIZE_HANDLE_SIZE)
|
||||
|| (orientation() == Qt::Vertical && e->pos().y() > sr.top()-RESIZE_HANDLE_SIZE && e->pos().y() < sr.top()+RESIZE_HANDLE_SIZE)) {
|
||||
new_resize_init = true;
|
||||
resize_top = true;
|
||||
} else if ((orientation() == Qt::Horizontal && e->pos().x() > sr.right()-RESIZE_HANDLE_SIZE && e->pos().x() < sr.right()+RESIZE_HANDLE_SIZE)
|
||||
|| (orientation() == Qt::Vertical && e->pos().y() > sr.bottom()-RESIZE_HANDLE_SIZE && e->pos().y() < sr.bottom()+RESIZE_HANDLE_SIZE)) {
|
||||
new_resize_init = true;
|
||||
resize_top = false;
|
||||
}
|
||||
if ((orientation() == Qt::Horizontal && e->pos().x() > sr.left()-RESIZE_HANDLE_SIZE && e->pos().x() < sr.left()+RESIZE_HANDLE_SIZE)
|
||||
|| (orientation() == Qt::Vertical && e->pos().y() > sr.top()-RESIZE_HANDLE_SIZE && e->pos().y() < sr.top()+RESIZE_HANDLE_SIZE)) {
|
||||
new_resize_init = true;
|
||||
resize_top = true;
|
||||
} else if ((orientation() == Qt::Horizontal && e->pos().x() > sr.right()-RESIZE_HANDLE_SIZE && e->pos().x() < sr.right()+RESIZE_HANDLE_SIZE)
|
||||
|| (orientation() == Qt::Vertical && e->pos().y() > sr.bottom()-RESIZE_HANDLE_SIZE && e->pos().y() < sr.bottom()+RESIZE_HANDLE_SIZE)) {
|
||||
new_resize_init = true;
|
||||
resize_top = false;
|
||||
}
|
||||
|
||||
if (resize_init != new_resize_init) {
|
||||
if (new_resize_init) {
|
||||
setCursor(Qt::SizeHorCursor);
|
||||
} else {
|
||||
unsetCursor();
|
||||
}
|
||||
resize_init = new_resize_init;
|
||||
}
|
||||
if (resize_init != new_resize_init) {
|
||||
if (new_resize_init) {
|
||||
setCursor(Qt::SizeHorCursor);
|
||||
} else {
|
||||
unsetCursor();
|
||||
}
|
||||
resize_init = new_resize_init;
|
||||
}
|
||||
|
||||
QScrollBar::mouseMoveEvent(e);
|
||||
}
|
||||
QScrollBar::mouseMoveEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void ResizableScrollBar::mouseReleaseEvent(QMouseEvent *e) {
|
||||
if (resize_proc) {
|
||||
resize_proc = false;
|
||||
} else {
|
||||
QScrollBar::mouseReleaseEvent(e);
|
||||
}
|
||||
if (resize_proc) {
|
||||
resize_proc = false;
|
||||
} else {
|
||||
QScrollBar::mouseReleaseEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
+37
-35
@@ -8,60 +8,62 @@
|
||||
#include "debug.h"
|
||||
|
||||
SourceIconView::SourceIconView(QWidget *parent) : QListView(parent) {
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
|
||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
setResizeMode(QListView::Adjust);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
|
||||
}
|
||||
|
||||
void SourceIconView::show_context_menu() {
|
||||
project_parent->sources_common->show_context_menu(this, selectedIndexes());
|
||||
project_parent->sources_common->show_context_menu(this, selectedIndexes());
|
||||
}
|
||||
|
||||
void SourceIconView::item_click(const QModelIndex& index) {
|
||||
if (selectionModel()->selectedRows().size() == 1 && index.column() == 0) {
|
||||
project_parent->sources_common->item_click(project_parent->item_to_media(index), index);
|
||||
}
|
||||
if (selectedIndexes().size() == 1 && index.column() == 0) {
|
||||
project_parent->sources_common->item_click(project_parent->item_to_media(index), index);
|
||||
}
|
||||
}
|
||||
|
||||
void SourceIconView::mousePressEvent(QMouseEvent* event) {
|
||||
project_parent->sources_common->mousePressEvent(event);
|
||||
if (!indexAt(event->pos()).isValid()) selectionModel()->clear();
|
||||
QListView::mousePressEvent(event);
|
||||
project_parent->sources_common->mousePressEvent(event);
|
||||
if (!indexAt(event->pos()).isValid()) selectionModel()->clear();
|
||||
QListView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void SourceIconView::dragEnterEvent(QDragEnterEvent *event) {
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QListView::dragEnterEvent(event);
|
||||
}
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QListView::dragEnterEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void SourceIconView::dragMoveEvent(QDragMoveEvent *event) {
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QListView::dragMoveEvent(event);
|
||||
}
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QListView::dragMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void SourceIconView::dropEvent(QDropEvent* event) {
|
||||
QModelIndex drop_item = indexAt(event->pos());
|
||||
if (!drop_item.isValid()) drop_item = rootIndex();
|
||||
project_parent->sources_common->dropEvent(this, event, drop_item, selectedIndexes());
|
||||
QModelIndex drop_item = indexAt(event->pos());
|
||||
if (!drop_item.isValid()) drop_item = rootIndex();
|
||||
project_parent->sources_common->dropEvent(this, event, drop_item, selectedIndexes());
|
||||
}
|
||||
|
||||
void SourceIconView::mouseDoubleClickEvent(QMouseEvent *event) {
|
||||
bool default_behavior = true;
|
||||
if (selectedIndexes().size() == 1) {
|
||||
Media* m = project_parent->item_to_media(selectedIndexes().at(0));
|
||||
if (m->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
default_behavior = false;
|
||||
setRootIndex(selectedIndexes().at(0));
|
||||
emit changed_root();
|
||||
}
|
||||
}
|
||||
if (default_behavior) {
|
||||
project_parent->sources_common->mouseDoubleClickEvent(event, selectedIndexes());
|
||||
}
|
||||
bool default_behavior = true;
|
||||
if (selectedIndexes().size() == 1) {
|
||||
Media* m = project_parent->item_to_media(selectedIndexes().at(0));
|
||||
if (m->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
default_behavior = false;
|
||||
setRootIndex(selectedIndexes().at(0));
|
||||
emit changed_root();
|
||||
}
|
||||
}
|
||||
if (default_behavior) {
|
||||
project_parent->sources_common->mouseDoubleClickEvent(event, selectedIndexes());
|
||||
}
|
||||
}
|
||||
|
||||
+25
-21
@@ -27,47 +27,51 @@
|
||||
|
||||
SourceTable::SourceTable(QWidget* parent) : QTreeView(parent) {
|
||||
setSortingEnabled(true);
|
||||
sortByColumn(0, Qt::AscendingOrder);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
|
||||
setAcceptDrops(true);
|
||||
sortByColumn(0, Qt::AscendingOrder);
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
setDragDropMode(QAbstractItemView::DragDrop);
|
||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||
connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(item_click(const QModelIndex&)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu()));
|
||||
}
|
||||
|
||||
void SourceTable::show_context_menu() {
|
||||
project_parent->sources_common->show_context_menu(this, selectionModel()->selectedRows());
|
||||
project_parent->sources_common->show_context_menu(this, selectionModel()->selectedRows());
|
||||
}
|
||||
|
||||
void SourceTable::item_click(const QModelIndex& index) {
|
||||
if (selectionModel()->selectedRows().size() == 1 && index.column() == 0) {
|
||||
project_parent->sources_common->item_click(project_parent->item_to_media(index), index);
|
||||
}
|
||||
if (selectionModel()->selectedRows().size() == 1 && index.column() == 0) {
|
||||
project_parent->sources_common->item_click(project_parent->item_to_media(index), index);
|
||||
}
|
||||
}
|
||||
|
||||
void SourceTable::mousePressEvent(QMouseEvent* event) {
|
||||
project_parent->sources_common->mousePressEvent(event);
|
||||
QTreeView::mousePressEvent(event);
|
||||
project_parent->sources_common->mousePressEvent(event);
|
||||
QTreeView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void SourceTable::mouseDoubleClickEvent(QMouseEvent* event) {
|
||||
project_parent->sources_common->mouseDoubleClickEvent(event, selectionModel()->selectedRows());
|
||||
project_parent->sources_common->mouseDoubleClickEvent(event, selectionModel()->selectedRows());
|
||||
}
|
||||
|
||||
void SourceTable::dragEnterEvent(QDragEnterEvent *event) {
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QTreeView::dragEnterEvent(event);
|
||||
}
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QTreeView::dragEnterEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void SourceTable::dragMoveEvent(QDragMoveEvent *event) {
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QTreeView::dragMoveEvent(event);
|
||||
}
|
||||
if (event->mimeData()->hasUrls()) {
|
||||
event->acceptProposedAction();
|
||||
} else {
|
||||
QTreeView::dragMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void SourceTable::dropEvent(QDropEvent* event) {
|
||||
project_parent->sources_common->dropEvent(this, event, indexAt(event->pos()), selectionModel()->selectedRows());
|
||||
project_parent->sources_common->dropEvent(this, event, indexAt(event->pos()), selectionModel()->selectedRows());
|
||||
}
|
||||
|
||||
+90
-81
@@ -23,34 +23,34 @@
|
||||
#define MARKER_SIZE 4
|
||||
|
||||
bool center_scroll_to_playhead(QScrollBar* bar, double zoom, long playhead) {
|
||||
// returns true is the scroll was changed, false if not
|
||||
int target_scroll = qMin(bar->maximum(), qMax(0, getScreenPointFromFrame(zoom, playhead)-(bar->width()>>1)));
|
||||
if (target_scroll == bar->value()) {
|
||||
return false;
|
||||
}
|
||||
bar->setValue(target_scroll);
|
||||
return true;
|
||||
// returns true is the scroll was changed, false if not
|
||||
int target_scroll = qMin(bar->maximum(), qMax(0, getScreenPointFromFrame(zoom, playhead)-(bar->width()>>1)));
|
||||
if (target_scroll == bar->value()) {
|
||||
return false;
|
||||
}
|
||||
bar->setValue(target_scroll);
|
||||
return true;
|
||||
}
|
||||
|
||||
TimelineHeader::TimelineHeader(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
snapping(true),
|
||||
snapping(true),
|
||||
dragging(false),
|
||||
resizing_workarea(false),
|
||||
zoom(1),
|
||||
in_visible(0),
|
||||
in_visible(0),
|
||||
fm(font()),
|
||||
dragging_markers(false),
|
||||
scroll(0)
|
||||
{
|
||||
height_actual = fm.height();
|
||||
setCursor(Qt::ArrowCursor);
|
||||
setMouseTracking(true);
|
||||
setCursor(Qt::ArrowCursor);
|
||||
setMouseTracking(true);
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
show_text(true);
|
||||
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(show_context_menu(const QPoint &)));
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(show_context_menu(const QPoint &)));
|
||||
}
|
||||
|
||||
void TimelineHeader::set_scroll(int s) {
|
||||
@@ -81,11 +81,11 @@ void TimelineHeader::set_visible_in(long i) {
|
||||
|
||||
void TimelineHeader::set_in_point(long new_in) {
|
||||
long new_out = viewer->seq->workarea_out;
|
||||
if (new_out == new_in) {
|
||||
new_in--;
|
||||
} else if (new_out < new_in) {
|
||||
if (new_out == new_in) {
|
||||
new_in--;
|
||||
} else if (new_out < new_in) {
|
||||
new_out = viewer->seq->getEndFrame();
|
||||
}
|
||||
}
|
||||
|
||||
undo_stack.push(new SetTimelineInOutCommand(viewer->seq, true, new_in, new_out));
|
||||
update_parents();
|
||||
@@ -93,18 +93,18 @@ void TimelineHeader::set_in_point(long new_in) {
|
||||
|
||||
void TimelineHeader::set_out_point(long new_out) {
|
||||
long new_in = viewer->seq->workarea_in;
|
||||
if (new_out == new_in) {
|
||||
new_out++;
|
||||
} else if (new_in > new_out || new_in < 0) {
|
||||
new_in = 0;
|
||||
}
|
||||
if (new_out == new_in) {
|
||||
new_out++;
|
||||
} else if (new_in > new_out || new_in < 0) {
|
||||
new_in = 0;
|
||||
}
|
||||
|
||||
undo_stack.push(new SetTimelineInOutCommand(viewer->seq, true, new_in, new_out));
|
||||
update_parents();
|
||||
}
|
||||
|
||||
void TimelineHeader::set_scrollbar_max(QScrollBar* bar, long sequence_end_frame, int offset) {
|
||||
bar->setMaximum(qMax(0, getScreenPointFromFrame(zoom, sequence_end_frame) - offset));
|
||||
bar->setMaximum(qMax(0, getScreenPointFromFrame(zoom, sequence_end_frame) - offset));
|
||||
}
|
||||
|
||||
void TimelineHeader::show_text(bool enable) {
|
||||
@@ -118,7 +118,7 @@ void TimelineHeader::show_text(bool enable) {
|
||||
}
|
||||
|
||||
void TimelineHeader::mousePressEvent(QMouseEvent* event) {
|
||||
if (viewer->seq != NULL) {
|
||||
if (viewer->seq != NULL && event->buttons() & Qt::LeftButton) {
|
||||
if (resizing_workarea) {
|
||||
sequence_end = viewer->seq->getEndFrame();
|
||||
} else {
|
||||
@@ -275,11 +275,11 @@ void TimelineHeader::update_parents() {
|
||||
|
||||
void TimelineHeader::update_zoom(double z) {
|
||||
zoom = z;
|
||||
update();
|
||||
update();
|
||||
}
|
||||
|
||||
double TimelineHeader::get_zoom() {
|
||||
return zoom;
|
||||
return zoom;
|
||||
}
|
||||
|
||||
void TimelineHeader::delete_markers() {
|
||||
@@ -295,72 +295,83 @@ void TimelineHeader::delete_markers() {
|
||||
|
||||
void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
if (viewer->seq != NULL && zoom > 0) {
|
||||
QPainter p(this);
|
||||
QPainter p(this);
|
||||
int yoff = (text_enabled) ? height()/2 : 0;
|
||||
|
||||
double interval = viewer->seq->frame_rate;
|
||||
int textWidth = 0;
|
||||
int textWidth = 0;
|
||||
int lastTextBoundary = INT_MIN;
|
||||
|
||||
int i = 0;
|
||||
int i = 0;
|
||||
int lastLineX = INT_MIN;
|
||||
|
||||
int sublineCount = 1;
|
||||
int sublineTest = qRound(interval*zoom);
|
||||
int sublineInterval = 1;
|
||||
int sublineCount = 1;
|
||||
int sublineTest = qRound(interval*zoom);
|
||||
int sublineInterval = 1;
|
||||
while (sublineTest > SUBLINE_MIN_PADDING
|
||||
&& sublineInterval >= 1) {
|
||||
sublineCount *= 2;
|
||||
sublineInterval = (interval/sublineCount);
|
||||
sublineTest = qRound(sublineInterval*zoom);
|
||||
}
|
||||
sublineCount = qMin(sublineCount, qRound(interval));
|
||||
&& sublineInterval >= 1) {
|
||||
sublineCount *= 2;
|
||||
sublineInterval = (interval/sublineCount);
|
||||
sublineTest = qRound(sublineInterval*zoom);
|
||||
}
|
||||
sublineCount = qMin(sublineCount, qRound(interval));
|
||||
|
||||
while (true) {
|
||||
long frame = qRound(interval*i);
|
||||
int text_x, fullTextWidth;
|
||||
QString timecode;
|
||||
|
||||
while (true) {
|
||||
long frame = qRound(interval*i);
|
||||
int lineX = qRound(frame*zoom) - scroll;
|
||||
int next_lineX = qRound(qRound(interval*(i+1))*zoom) - scroll;
|
||||
|
||||
if (lineX > width()) break;
|
||||
if (next_lineX > 0 && lineX > lastLineX+LINE_MIN_PADDING) {
|
||||
// draw text
|
||||
if (text_enabled && lineX-textWidth > lastTextBoundary) {
|
||||
if (lineX > width()) break;
|
||||
|
||||
// draw text
|
||||
bool draw_text = false;
|
||||
if (text_enabled && lineX-textWidth > lastTextBoundary) {
|
||||
timecode = frame_to_timecode(frame + in_visible, config.timecode_view, viewer->seq->frame_rate);
|
||||
fullTextWidth = fm.width(timecode);
|
||||
textWidth = fullTextWidth>>1;
|
||||
text_x = lineX-textWidth;
|
||||
lastTextBoundary = lineX+textWidth;
|
||||
if (lastTextBoundary >= 0) {
|
||||
draw_text = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (lineX > lastLineX+LINE_MIN_PADDING) {
|
||||
if (draw_text) {
|
||||
p.setPen(Qt::white);
|
||||
QString timecode = frame_to_timecode(frame + in_visible, config.timecode_view, viewer->seq->frame_rate);
|
||||
int fullTextWidth = fm.width(timecode);
|
||||
textWidth = fullTextWidth>>1;
|
||||
int text_x = lineX-textWidth;
|
||||
lastTextBoundary = lineX+textWidth;
|
||||
if (lastTextBoundary >= 0) {
|
||||
p.drawText(QRect(text_x, 0, fullTextWidth, yoff), timecode);
|
||||
}
|
||||
p.drawText(QRect(text_x, 0, fullTextWidth, yoff), timecode);
|
||||
}
|
||||
|
||||
// draw line markers
|
||||
p.setPen(Qt::gray);
|
||||
p.drawLine(lineX, yoff, lineX, height());
|
||||
|
||||
lastLineX = lineX;
|
||||
|
||||
// draw sub-line markers
|
||||
for (int j=1;j<sublineCount;j++) {
|
||||
int sublineX = lineX+(qRound(j*interval/sublineCount)*zoom);
|
||||
p.drawLine(sublineX, yoff, sublineX, yoff+(height()/4));
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
// draw in/out selection
|
||||
int in_x;
|
||||
lastLineX = lineX;
|
||||
}
|
||||
|
||||
// TODO wastes cycles here, could just bring it up to 0
|
||||
i++;
|
||||
}
|
||||
|
||||
// draw in/out selection
|
||||
int in_x;
|
||||
if (viewer->seq->using_workarea) {
|
||||
in_x = getHeaderScreenPointFromFrame((resizing_workarea ? temp_workarea_in : viewer->seq->workarea_in));
|
||||
int out_x = getHeaderScreenPointFromFrame((resizing_workarea ? temp_workarea_out : viewer->seq->workarea_out));
|
||||
p.fillRect(QRect(in_x, 0, out_x-in_x, height()), QColor(0, 192, 255, 128));
|
||||
p.setPen(Qt::white);
|
||||
p.drawLine(in_x, 0, in_x, height());
|
||||
p.drawLine(out_x, 0, out_x, height());
|
||||
}
|
||||
p.fillRect(QRect(in_x, 0, out_x-in_x, height()), QColor(0, 192, 255, 128));
|
||||
p.setPen(Qt::white);
|
||||
p.drawLine(in_x, 0, in_x, height());
|
||||
p.drawLine(out_x, 0, out_x, height());
|
||||
}
|
||||
|
||||
// draw markers
|
||||
for (int i=0;i<viewer->seq->markers.size();i++) {
|
||||
@@ -389,30 +400,28 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
p.drawPolygon(points, 5);
|
||||
}
|
||||
|
||||
// draw playhead triangle
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
// draw playhead triangle
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
in_x = getHeaderScreenPointFromFrame(viewer->seq->playhead);
|
||||
QPoint start(in_x, height()+2);
|
||||
QPainterPath path;
|
||||
path.moveTo(start + QPoint(1,0));
|
||||
path.lineTo(in_x-PLAYHEAD_SIZE, yoff);
|
||||
path.lineTo(in_x+PLAYHEAD_SIZE+1, yoff);
|
||||
path.lineTo(start);
|
||||
p.fillPath(path, Qt::red);
|
||||
in_x = getHeaderScreenPointFromFrame(viewer->seq->playhead);
|
||||
QPoint start(in_x, height()+2);
|
||||
QPainterPath path;
|
||||
path.moveTo(start + QPoint(1,0));
|
||||
path.lineTo(in_x-PLAYHEAD_SIZE, yoff);
|
||||
path.lineTo(in_x+PLAYHEAD_SIZE+1, yoff);
|
||||
path.lineTo(start);
|
||||
p.fillPath(path, Qt::red);
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineHeader::show_context_menu(const QPoint &pos) {
|
||||
QMenu contextMenu(tr("Context menu"), this);
|
||||
QMenu menu(this);
|
||||
|
||||
QAction clear_in_out("Clear In/Out Points", this);
|
||||
if (!viewer->seq->using_workarea) clear_in_out.setEnabled(false);
|
||||
connect(&clear_in_out, SIGNAL(triggered()), mainWindow, SLOT(on_actionClear_In_Out_triggered()));
|
||||
contextMenu.addAction(&clear_in_out);
|
||||
contextMenu.exec(mapToGlobal(pos));
|
||||
mainWindow->make_inout_menu(&menu);
|
||||
|
||||
menu.exec(mapToGlobal(pos));
|
||||
}
|
||||
|
||||
void TimelineHeader::resized_scroll_listener(double d) {
|
||||
update_zoom(zoom * d);
|
||||
update_zoom(zoom * d);
|
||||
}
|
||||
|
||||
+1275
-1269
File diff suppressed because it is too large
Load Diff
+22
-21
@@ -33,13 +33,13 @@ public:
|
||||
protected:
|
||||
void paintEvent(QPaintEvent*);
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
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 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);
|
||||
@@ -49,18 +49,18 @@ protected:
|
||||
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);
|
||||
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);
|
||||
|
||||
int track_resize_mouse_cache;
|
||||
int track_resize_old_value;
|
||||
bool track_resizing;
|
||||
int track_target;
|
||||
int track_resize_mouse_cache;
|
||||
int track_resize_old_value;
|
||||
bool track_resizing;
|
||||
int track_target;
|
||||
|
||||
QVector<Clip*> pre_clips;
|
||||
QVector<Clip*> pre_clips;
|
||||
QVector<Clip*> post_clips;
|
||||
|
||||
Sequence* self_created_sequence;
|
||||
@@ -68,10 +68,10 @@ private:
|
||||
// used for "right click ripple"
|
||||
long rc_ripple_min;
|
||||
long rc_ripple_max;
|
||||
Media* rc_reveal_media;
|
||||
Media* rc_reveal_media;
|
||||
|
||||
QTimer tooltip_timer;
|
||||
int tooltip_clip;
|
||||
QTimer tooltip_timer;
|
||||
int tooltip_clip;
|
||||
|
||||
int scroll;
|
||||
|
||||
@@ -84,11 +84,12 @@ public slots:
|
||||
private slots:
|
||||
void reveal_media();
|
||||
void right_click_ripple();
|
||||
void show_context_menu(const QPoint& pos);
|
||||
void toggle_autoscale();
|
||||
void tooltip_timer_timeout();
|
||||
void show_context_menu(const QPoint& pos);
|
||||
void toggle_autoscale();
|
||||
void tooltip_timer_timeout();
|
||||
void rename_clip();
|
||||
void show_stabilizer_diag();
|
||||
void show_stabilizer_diag();
|
||||
void open_sequence_properties();
|
||||
};
|
||||
|
||||
#endif // TIMELINEWIDGET_H
|
||||
|
||||
+534
-533
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user