Merge branch 'master' into project_icons
This commit is contained in:
@@ -3,30 +3,74 @@
|
||||
#include <QFile>
|
||||
#include <QDateTime>
|
||||
#include <QStandardPaths>
|
||||
#include <QDir>
|
||||
#include <QMutex>
|
||||
|
||||
#ifndef QT_DEBUG
|
||||
#include "dialogs/debugdialog.h"
|
||||
|
||||
QString debug_info;
|
||||
QMutex debug_mutex;
|
||||
QFile debug_file;
|
||||
QDebug debug_out(&debug_file);
|
||||
#endif
|
||||
QTextStream debug_stream;
|
||||
|
||||
void setup_debug() {
|
||||
#ifndef QT_DEBUG
|
||||
debug_file.setFileName(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/debug_log");
|
||||
if (debug_file.open(QFile::WriteOnly)) {
|
||||
QString debug_intro = "Olive Session " + QString::number(QDateTime::currentMSecsSinceEpoch());
|
||||
debug_file.write(debug_intro.toUtf8());
|
||||
} else {
|
||||
debug_out = QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).debug();
|
||||
void open_debug_file() {
|
||||
QDir debug_dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
|
||||
debug_dir.mkpath(".");
|
||||
if (debug_dir.exists()) {
|
||||
debug_file.setFileName(debug_dir.path() + "/debug_log");
|
||||
if (debug_file.open(QFile::WriteOnly)) {
|
||||
debug_stream.setDevice(&debug_file);
|
||||
} else {
|
||||
qWarning() << "Couldn't open debug log file, debug log will not be saved";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void close_debug() {
|
||||
#ifndef QT_DEBUG
|
||||
if (debug_file.isOpen()) {
|
||||
debug_file.putChar(10);
|
||||
debug_file.putChar(10);
|
||||
debug_file.close();
|
||||
void close_debug_file() {
|
||||
if (debug_file.isOpen()) debug_file.close();
|
||||
}
|
||||
|
||||
void debug_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg) {
|
||||
debug_mutex.lock();
|
||||
QByteArray localMsg = msg.toLocal8Bit();
|
||||
switch (type) {
|
||||
case QtDebugMsg:
|
||||
fprintf(stderr, "[DEBUG] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||
if (debug_file.isOpen()) debug_stream << QString("[DEBUG] %1 (%2:%3, %4)\n").arg(localMsg.constData(), context.file, QString::number(context.line), context.function);
|
||||
debug_info.prepend(QString("<b>[DEBUG]</b> %1 (%2:%3, %4)<br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function));
|
||||
fflush(stderr);
|
||||
break;
|
||||
case QtInfoMsg:
|
||||
fprintf(stderr, "[INFO] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||
if (debug_file.isOpen()) debug_stream << QString("[INFO] %1 (%2:%3, %4)\n").arg(localMsg.constData(), context.file, QString::number(context.line), context.function);
|
||||
debug_info.prepend(QString("<b>[INFO]</b> %1 (%2:%3, %4)<br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function));
|
||||
fflush(stderr);
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
fprintf(stderr, "[WARNING] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||
if (debug_file.isOpen()) debug_stream << QString("[WARNING] %1 (%2:%3, %4)\n").arg(localMsg.constData(), context.file, QString::number(context.line), context.function);
|
||||
debug_info.prepend(QString("<font color='yellow'><b>[WARNING]</b> %1 (%2:%3, %4)</font><br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function));
|
||||
fflush(stderr);
|
||||
break;
|
||||
case QtCriticalMsg:
|
||||
fprintf(stderr, "[ERROR] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||
if (debug_file.isOpen()) debug_stream << QString("[ERROR] %1 (%2:%3, %4)\n").arg(localMsg.constData(), context.file, QString::number(context.line), context.function);
|
||||
debug_info.prepend(QString("<font color='red'><b>[ERROR]</b> %1 (%2:%3, %4)</font><br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function));
|
||||
fflush(stderr);
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
fprintf(stderr, "[FATAL] %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, context.function);
|
||||
if (debug_file.isOpen()) debug_stream << QString("[FATAL] %1 (%2:%3, %4)\n").arg(localMsg.constData(), context.file, QString::number(context.line), context.function);
|
||||
debug_info.prepend(QString("<font color='red'><b>[FATAL]</b> %1 (%2:%3, %4)</font><br>").arg(localMsg.constData(), context.file, QString::number(context.line), context.function));
|
||||
fflush(stderr);
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
if (debug_dialog != nullptr && debug_dialog->isVisible()) {
|
||||
QMetaObject::invokeMethod(debug_dialog, "update_log", Qt::QueuedConnection);
|
||||
}
|
||||
debug_mutex.unlock();
|
||||
}
|
||||
|
||||
const QString &get_debug_str() {
|
||||
return debug_info;
|
||||
}
|
||||
|
||||
@@ -3,14 +3,11 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#ifndef QT_DEBUG
|
||||
#define dout debug_out << "\n"
|
||||
extern QDebug debug_out;
|
||||
#else
|
||||
#define dout qDebug()
|
||||
#endif
|
||||
void debug_message_handler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
|
||||
const QString& get_debug_str();
|
||||
void open_debug_file();
|
||||
void close_debug_file();
|
||||
|
||||
void setup_debug();
|
||||
void close_debug();
|
||||
#define dout qDebug()
|
||||
|
||||
#endif // DEBUG_H
|
||||
|
||||
+11
-1
@@ -14,7 +14,17 @@ AboutDialog::AboutDialog(QWidget *parent) :
|
||||
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>");
|
||||
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>"
|
||||
+ tr("Olive is a non-linear video editor. This software is free and protected by the GNU GPL.")
|
||||
+ "</p><p>"
|
||||
+ tr("Olive Team is obliged to inform users that Olive source code is available for download from its website.")
|
||||
+ "</p></body></html>");
|
||||
label->setAlignment(Qt::AlignCenter);
|
||||
label->setWordWrap(true);
|
||||
layout->addWidget(label);
|
||||
|
||||
+10
-10
@@ -21,9 +21,9 @@ ActionSearch::ActionSearch(QWidget *parent) :
|
||||
|
||||
ActionSearchEntry* entry_field = new ActionSearchEntry();
|
||||
QFont entry_field_font = entry_field->font();
|
||||
entry_field_font.setPointSize(entry_field_font.pointSize()*1.2);
|
||||
entry_field_font.setPointSize(qRound(entry_field_font.pointSize()*1.2));
|
||||
entry_field->setFont(entry_field_font);
|
||||
entry_field->setPlaceholderText("Search for action...");
|
||||
entry_field->setPlaceholderText(tr("Search for action..."));
|
||||
connect(entry_field, SIGNAL(textChanged(const QString&)), this, SLOT(search_update(const QString &)));
|
||||
connect(entry_field, SIGNAL(returnPressed()), this, SLOT(perform_action()));
|
||||
connect(entry_field, SIGNAL(moveSelectionUp()), this, SLOT(move_selection_up()));
|
||||
@@ -32,7 +32,7 @@ ActionSearch::ActionSearch(QWidget *parent) :
|
||||
|
||||
list_widget = new ActionSearchList();
|
||||
QFont list_widget_font = list_widget->font();
|
||||
list_widget_font.setPointSize(list_widget_font.pointSize()*1.2);
|
||||
list_widget_font.setPointSize(qRound(list_widget_font.pointSize()*1.2));
|
||||
list_widget->setFont(list_widget_font);
|
||||
layout->addWidget(list_widget);
|
||||
connect(list_widget, SIGNAL(dbl_click()), this, SLOT(perform_action()));
|
||||
@@ -43,7 +43,7 @@ ActionSearch::ActionSearch(QWidget *parent) :
|
||||
}
|
||||
|
||||
void ActionSearch::search_update(const QString &s, const QString &p, QMenu *parent) {
|
||||
if (parent == NULL) {
|
||||
if (parent == nullptr) {
|
||||
list_widget->clear();
|
||||
QList<QAction*> menus = mainWindow->menuBar()->actions();
|
||||
for (int i=0;i<menus.size();i++) {
|
||||
@@ -60,7 +60,7 @@ void ActionSearch::search_update(const QString &s, const QString &p, QMenu *pare
|
||||
for (int i=0;i<actions.size();i++) {
|
||||
QAction* a = actions.at(i);
|
||||
if (!a->isSeparator()) {
|
||||
if (a->menu() != NULL) {
|
||||
if (a->menu() != nullptr) {
|
||||
search_update(s, menu_text, a->menu());
|
||||
} else {
|
||||
QString comp = a->text().replace("&", "");
|
||||
@@ -88,9 +88,9 @@ void ActionSearch::perform_action() {
|
||||
void ActionSearch::move_selection_up() {
|
||||
int lim = list_widget->count();
|
||||
for (int i=1;i<lim;i++) {
|
||||
if (list_widget->item(i)->isSelected()) {
|
||||
if (list_widget->item(i)->isSelected()) {
|
||||
list_widget->item(i-1)->setSelected(true);
|
||||
list_widget->scrollToItem(list_widget->item(i-1));
|
||||
list_widget->scrollToItem(list_widget->item(i-1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -99,9 +99,9 @@ void ActionSearch::move_selection_up() {
|
||||
void ActionSearch::move_selection_down() {
|
||||
int lim = list_widget->count()-1;
|
||||
for (int i=0;i<lim;i++) {
|
||||
if (list_widget->item(i)->isSelected()) {
|
||||
if (list_widget->item(i)->isSelected()) {
|
||||
list_widget->item(i+1)->setSelected(true);
|
||||
list_widget->scrollToItem(list_widget->item(i+1));
|
||||
list_widget->scrollToItem(list_widget->item(i+1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -120,6 +120,6 @@ void ActionSearchEntry::keyPressEvent(QKeyEvent * event) {
|
||||
}
|
||||
}
|
||||
|
||||
void ActionSearchList::mouseDoubleClickEvent(QMouseEvent *event) {
|
||||
void ActionSearchList::mouseDoubleClickEvent(QMouseEvent *) {
|
||||
emit dbl_click();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class ActionSearch : public QDialog
|
||||
public:
|
||||
ActionSearch(QWidget* parent = 0);
|
||||
private slots:
|
||||
void search_update(const QString& s, const QString &p = 0, QMenu *parent = NULL);
|
||||
void search_update(const QString& s, const QString &p = 0, QMenu *parent = nullptr);
|
||||
void perform_action();
|
||||
void move_selection_up();
|
||||
void move_selection_down();
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#include "debugdialog.h"
|
||||
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
DebugDialog* debug_dialog = nullptr;
|
||||
|
||||
DebugDialog::DebugDialog(QWidget *parent) : QDialog(parent) {
|
||||
setWindowTitle(tr("Debug Log"));
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
setLayout(layout);
|
||||
|
||||
textEdit = new QTextEdit();
|
||||
textEdit->setWordWrapMode(QTextOption::NoWrap);
|
||||
layout->addWidget(textEdit);
|
||||
}
|
||||
|
||||
void DebugDialog::update_log() {
|
||||
textEdit->setHtml(get_debug_str());
|
||||
}
|
||||
|
||||
void DebugDialog::showEvent(QShowEvent *) {
|
||||
update_log();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef DEBUGDIALOG_H
|
||||
#define DEBUGDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
class QTextEdit;
|
||||
|
||||
class DebugDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DebugDialog(QWidget* parent = 0);
|
||||
public slots:
|
||||
void update_log();
|
||||
protected:
|
||||
void showEvent(QShowEvent* event);
|
||||
private:
|
||||
QTextEdit* textEdit;
|
||||
};
|
||||
|
||||
extern DebugDialog* debug_dialog;
|
||||
|
||||
#endif // DEBUGDIALOG_H
|
||||
+14
-3
@@ -7,7 +7,7 @@
|
||||
DemoNotice::DemoNotice(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
{
|
||||
setWindowTitle("Welcome to Olive!");
|
||||
setWindowTitle(tr("Welcome to Olive!"));
|
||||
setMaximumWidth(600);
|
||||
|
||||
QVBoxLayout* vlayout = new QVBoxLayout();
|
||||
@@ -17,10 +17,21 @@ DemoNotice::DemoNotice(QWidget *parent) :
|
||||
layout->setMargin(10);
|
||||
layout->setSpacing(20);
|
||||
|
||||
QLabel* icon = new QLabel("<html><head/><body><p><img src=\":/icons/olive-splash.png\"/></p></body></html>");
|
||||
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>");
|
||||
QLabel* text = new QLabel("<html><head/><body><p>"
|
||||
"<span style=\" font-size:14pt;\">"
|
||||
+ tr("Welcome to Olive!")
|
||||
+ "</span></p><p>"
|
||||
+ tr("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>"
|
||||
+ tr("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 %1").arg("<a href=\"https://olivevideoeditor.org/\"><span style=\" text-decoration: underline; color:#007af4;\">www.olivevideoeditor.org</span></a>")
|
||||
+ "</p><p>"
|
||||
+ tr("Thank you for trying Olive and we hope you enjoy it!")
|
||||
+ "</p></body></html>");
|
||||
text->setWordWrap(true);
|
||||
layout->addWidget(text);
|
||||
|
||||
|
||||
+66
-43
@@ -57,13 +57,13 @@ enum ExportFormats {
|
||||
ExportDialog::ExportDialog(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
{
|
||||
setWindowTitle("Export \"" + sequence->name + "\"");
|
||||
setWindowTitle(tr("Export \"%1\"").arg(sequence->name));
|
||||
setup_ui();
|
||||
|
||||
rangeCombobox->setCurrentIndex(0);
|
||||
if (sequence->using_workarea) {
|
||||
rangeCombobox->setEnabled(sequence->using_workarea);
|
||||
rangeCombobox->setCurrentIndex(1);
|
||||
rangeCombobox->setEnabled(true);
|
||||
if (sequence->enable_workarea) rangeCombobox->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
format_strings.resize(FORMAT_SIZE);
|
||||
@@ -286,22 +286,22 @@ void ExportDialog::format_changed(int index)
|
||||
default_acodec = 1;
|
||||
break;
|
||||
default:
|
||||
dout << "[ERROR] Invalid format selection - this is a bug, please inform the developers";
|
||||
qCritical() << "Invalid format selection - this is a bug, please inform the developers";
|
||||
}
|
||||
|
||||
AVCodec* codec_info;
|
||||
for (int i=0;i<format_vcodecs.size();i++) {
|
||||
codec_info = avcodec_find_encoder((enum AVCodecID) format_vcodecs.at(i));
|
||||
if (codec_info == NULL) {
|
||||
vcodecCombobox->addItem("NULL");
|
||||
if (codec_info == nullptr) {
|
||||
vcodecCombobox->addItem("nullptr");
|
||||
} else {
|
||||
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) {
|
||||
acodecCombobox->addItem("NULL");
|
||||
if (codec_info == nullptr) {
|
||||
acodecCombobox->addItem("nullptr");
|
||||
} else {
|
||||
acodecCombobox->addItem(codec_info->long_name);
|
||||
}
|
||||
@@ -320,7 +320,12 @@ void ExportDialog::format_changed(int index)
|
||||
|
||||
void ExportDialog::render_thread_finished() {
|
||||
if (progressBar->value() < 100 && !cancelled) {
|
||||
QMessageBox::critical(this, "Export Failed", "Export failed - " + export_error, QMessageBox::Ok);
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Export Failed"),
|
||||
tr("Export failed - %1").arg(export_error),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
}
|
||||
prep_ui_for_render(false);
|
||||
panel_sequence_viewer->viewer_widget->makeCurrent();
|
||||
@@ -337,7 +342,12 @@ void ExportDialog::prep_ui_for_render(bool r) {
|
||||
|
||||
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);
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Invalid dimensions"),
|
||||
tr("Export width and height must both be even numbers/divisible by 2."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -388,8 +398,13 @@ void ExportDialog::export_action() {
|
||||
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);
|
||||
qCritical() << "Invalid codec selection for an image sequence";
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Invalid codec"),
|
||||
tr("Couldn't determine output parameters for the selected codec. This is a bug, please contact the developers."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -453,11 +468,21 @@ void ExportDialog::export_action() {
|
||||
}
|
||||
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);
|
||||
qCritical() << "Invalid format - this is a bug, please inform the developers";
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Invalid format"),
|
||||
tr("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[formatCombobox->currentIndex()] + " (*." + ext + ")");
|
||||
QString filename = QFileDialog::getSaveFileName(
|
||||
this,
|
||||
tr("Export Media"),
|
||||
"",
|
||||
format_strings[formatCombobox->currentIndex()] + " (*." + ext + ")"
|
||||
);
|
||||
if (!filename.isEmpty()) {
|
||||
if (!filename.endsWith("." + ext, Qt::CaseInsensitive)) {
|
||||
filename += "." + ext;
|
||||
@@ -540,11 +565,11 @@ void ExportDialog::vcodec_changed(int index) {
|
||||
compressionTypeCombobox->clear();
|
||||
if ((format_vcodecs.size() > 0 && format_vcodecs.at(index) == AV_CODEC_ID_H264)) {
|
||||
compressionTypeCombobox->setEnabled(true);
|
||||
compressionTypeCombobox->addItem("Quality-based (Constant Rate Factor)", COMPRESSION_TYPE_CFR);
|
||||
compressionTypeCombobox->addItem(tr("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 {
|
||||
compressionTypeCombobox->addItem("Constant Bitrate", COMPRESSION_TYPE_CBR);
|
||||
compressionTypeCombobox->addItem(tr("Constant Bitrate"), COMPRESSION_TYPE_CBR);
|
||||
compressionTypeCombobox->setCurrentIndex(0);
|
||||
compressionTypeCombobox->setEnabled(false);
|
||||
}
|
||||
@@ -557,17 +582,17 @@ void ExportDialog::comp_type_changed(int) {
|
||||
switch (compressionTypeCombobox->currentData().toInt()) {
|
||||
case COMPRESSION_TYPE_CBR:
|
||||
case COMPRESSION_TYPE_TARGETBR:
|
||||
videoBitrateLabel->setText("Bitrate (Mbps):");
|
||||
videoBitrateLabel->setText(tr("Bitrate (Mbps):"));
|
||||
videobitrateSpinbox->setValue(qMax(0.5, (double) qRound((0.01528 * sequence->height) - 4.5)));
|
||||
break;
|
||||
case COMPRESSION_TYPE_CFR:
|
||||
videoBitrateLabel->setText("Quality (CRF):");
|
||||
videoBitrateLabel->setText(tr("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");
|
||||
videobitrateSpinbox->setToolTip(tr("Quality Factor:\n\n0 = lossless\n17-18 = visually lossless (compressed, but unnoticeable)\n23 = high quality\n51 = lowest quality possible"));
|
||||
break;
|
||||
case COMPRESSION_TYPE_TARGETSIZE:
|
||||
videoBitrateLabel->setText("Target File Size (MB):");
|
||||
videoBitrateLabel->setText(tr("Target File Size (MB):"));
|
||||
videobitrateSpinbox->setValue(100);
|
||||
break;
|
||||
}
|
||||
@@ -576,59 +601,57 @@ void ExportDialog::comp_type_changed(int) {
|
||||
void ExportDialog::setup_ui() {
|
||||
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
|
||||
|
||||
QHBoxLayout* horizontalLayout = new QHBoxLayout();
|
||||
QHBoxLayout* format_layout = new QHBoxLayout();
|
||||
|
||||
horizontalLayout->addWidget(new QLabel("Format:"));
|
||||
format_layout->addWidget(new QLabel(tr("Format:")));
|
||||
|
||||
formatCombobox = new QComboBox(this);
|
||||
|
||||
horizontalLayout->addWidget(formatCombobox);
|
||||
format_layout->addWidget(formatCombobox);
|
||||
|
||||
verticalLayout->addLayout(horizontalLayout);
|
||||
verticalLayout->addLayout(format_layout);
|
||||
|
||||
QHBoxLayout* horizontalLayout_4 = new QHBoxLayout();
|
||||
QHBoxLayout* range_layout = new QHBoxLayout();
|
||||
|
||||
horizontalLayout_4->addWidget(new QLabel("Range:"));
|
||||
range_layout->addWidget(new QLabel(tr("Range:")));
|
||||
|
||||
rangeCombobox = new QComboBox(this);
|
||||
rangeCombobox->addItem("Entire Sequence");
|
||||
rangeCombobox->addItem("In to Out");
|
||||
rangeCombobox->addItem(tr("Entire Sequence"));
|
||||
rangeCombobox->addItem(tr("In to Out"));
|
||||
|
||||
horizontalLayout_4->addWidget(rangeCombobox);
|
||||
range_layout->addWidget(rangeCombobox);
|
||||
|
||||
verticalLayout->addLayout(horizontalLayout_4);
|
||||
verticalLayout->addLayout(range_layout);
|
||||
|
||||
videoGroupbox = new QGroupBox(this);
|
||||
videoGroupbox->setTitle("Video");
|
||||
videoGroupbox->setTitle(tr("Video"));
|
||||
videoGroupbox->setFlat(false);
|
||||
videoGroupbox->setCheckable(true);
|
||||
|
||||
QGridLayout* videoGridLayout = new QGridLayout(videoGroupbox);
|
||||
|
||||
videoGridLayout->addWidget(new QLabel("Codec:"), 0, 0, 1, 1);
|
||||
videoGridLayout->addWidget(new QLabel(tr("Codec:")), 0, 0, 1, 1);
|
||||
vcodecCombobox = new QComboBox(videoGroupbox);
|
||||
videoGridLayout->addWidget(vcodecCombobox, 0, 1, 1, 1);
|
||||
|
||||
videoGridLayout->addWidget(new QLabel("Width:"), 1, 0, 1, 1);
|
||||
videoGridLayout->addWidget(new QLabel(tr("Width:")), 1, 0, 1, 1);
|
||||
widthSpinbox = new QSpinBox(videoGroupbox);
|
||||
widthSpinbox->setMaximum(16777216);
|
||||
videoGridLayout->addWidget(widthSpinbox, 1, 1, 1, 1);
|
||||
|
||||
videoGridLayout->addWidget(new QLabel("Height:"), 2, 0, 1, 1);
|
||||
videoGridLayout->addWidget(new QLabel(tr("Height:")), 2, 0, 1, 1);
|
||||
heightSpinbox = new QSpinBox(videoGroupbox);
|
||||
heightSpinbox->setMaximum(16777216);
|
||||
videoGridLayout->addWidget(heightSpinbox, 2, 1, 1, 1);
|
||||
|
||||
videoGridLayout->addWidget(new QLabel("Frame Rate:"), 3, 0, 1, 1);
|
||||
videoGridLayout->addWidget(new QLabel(tr("Frame Rate:")), 3, 0, 1, 1);
|
||||
framerateSpinbox = new QDoubleSpinBox(videoGroupbox);
|
||||
framerateSpinbox->setMaximum(60);
|
||||
framerateSpinbox->setValue(0);
|
||||
videoGridLayout->addWidget(framerateSpinbox, 3, 1, 1, 1);
|
||||
|
||||
videoGridLayout->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)");
|
||||
videoGridLayout->addWidget(new QLabel(tr("Compression Type:")), 4, 0, 1, 1);
|
||||
compressionTypeCombobox = new QComboBox(videoGroupbox);
|
||||
videoGridLayout->addWidget(compressionTypeCombobox, 4, 1, 1, 1);
|
||||
|
||||
videoBitrateLabel = new QLabel(videoGroupbox);
|
||||
@@ -646,17 +669,17 @@ void ExportDialog::setup_ui() {
|
||||
|
||||
QGridLayout* audioGridLayout = new QGridLayout(audioGroupbox);
|
||||
|
||||
audioGridLayout->addWidget(new QLabel("Codec:"), 0, 0, 1, 1);
|
||||
audioGridLayout->addWidget(new QLabel(tr("Codec:")), 0, 0, 1, 1);
|
||||
acodecCombobox = new QComboBox(audioGroupbox);
|
||||
audioGridLayout->addWidget(acodecCombobox, 0, 1, 1, 1);
|
||||
|
||||
audioGridLayout->addWidget(new QLabel("Sampling Rate:"), 1, 0, 1, 1);
|
||||
audioGridLayout->addWidget(new QLabel(tr("Sampling Rate:")), 1, 0, 1, 1);
|
||||
samplingRateSpinbox = new QSpinBox(audioGroupbox);
|
||||
samplingRateSpinbox->setMaximum(96000);
|
||||
samplingRateSpinbox->setValue(0);
|
||||
audioGridLayout->addWidget(samplingRateSpinbox, 1, 1, 1, 1);
|
||||
|
||||
audioGridLayout->addWidget(new QLabel("Bitrate (Kbps/CBR):"), 3, 0, 1, 1);
|
||||
audioGridLayout->addWidget(new QLabel(tr("Bitrate (Kbps/CBR):")), 3, 0, 1, 1);
|
||||
audiobitrateSpinbox = new QSpinBox(audioGroupbox);
|
||||
audiobitrateSpinbox->setMaximum(320);
|
||||
audiobitrateSpinbox->setValue(256);
|
||||
|
||||
@@ -14,19 +14,19 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
LoadDialog::LoadDialog(QWidget *parent, bool autorecovery) : QDialog(parent) {
|
||||
setWindowTitle("Loading...");
|
||||
setWindowTitle(tr("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(tr("Loading '%1'...").arg(project_url.mid(project_url.lastIndexOf('/')+1))));
|
||||
|
||||
bar = new QProgressBar();
|
||||
bar->setValue(0);
|
||||
layout->addWidget(bar);
|
||||
|
||||
cancel_button = new QPushButton("Cancel");
|
||||
cancel_button = new QPushButton(tr("Cancel"));
|
||||
connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(cancel()));
|
||||
|
||||
hboxLayout = new QHBoxLayout();
|
||||
|
||||
@@ -19,7 +19,7 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
QDialog(parent),
|
||||
item(i)
|
||||
{
|
||||
setWindowTitle("\"" + i->get_name() + "\" Properties");
|
||||
setWindowTitle(tr("\"%1\" Properties").arg(i->get_name()));
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
QGridLayout* grid = new QGridLayout();
|
||||
@@ -29,13 +29,21 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
|
||||
Footage* f = item->to_footage();
|
||||
|
||||
grid->addWidget(new QLabel("Tracks:"), row, 0, 1, 2);
|
||||
grid->addWidget(new QLabel(tr("Tracks:")), row, 0, 1, 2);
|
||||
row++;
|
||||
|
||||
track_list = new QListWidget();
|
||||
for (int i=0;i<f->video_tracks.size();i++) {
|
||||
const FootageStream& fs = f->video_tracks.at(i);
|
||||
QListWidgetItem* item = new QListWidgetItem("Video " + QString::number(fs.file_index) + ": " + QString::number(fs.video_width) + "x" + QString::number(fs.video_height) + " " + QString::number(fs.video_frame_rate) + "FPS");
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem(
|
||||
tr("Video %1: %2x%3 %4FPS").arg(
|
||||
QString::number(fs.file_index),
|
||||
QString::number(fs.video_width),
|
||||
QString::number(fs.video_height),
|
||||
QString::number(fs.video_frame_rate)
|
||||
)
|
||||
);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked);
|
||||
item->setData(Qt::UserRole+1, fs.file_index);
|
||||
@@ -43,7 +51,13 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
}
|
||||
for (int i=0;i<f->audio_tracks.size();i++) {
|
||||
const FootageStream& fs = f->audio_tracks.at(i);
|
||||
QListWidgetItem* item = new QListWidgetItem("Audio " + QString::number(fs.file_index) + ": " + QString::number(fs.audio_frequency) + "Hz " + QString::number(fs.audio_channels) + " channels");
|
||||
QListWidgetItem* item = new QListWidgetItem(
|
||||
tr("Audio %1: %2Hz %3 channels").arg(
|
||||
QString::number(fs.file_index),
|
||||
QString::number(fs.audio_frequency),
|
||||
QString::number(fs.audio_channels)
|
||||
)
|
||||
);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked);
|
||||
item->setData(Qt::UserRole+1, fs.file_index);
|
||||
@@ -55,7 +69,7 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
if (f->video_tracks.size() > 0) {
|
||||
// frame conforming
|
||||
if (!f->video_tracks.at(0).infinite_length) {
|
||||
grid->addWidget(new QLabel("Conform to Frame Rate:"), row, 0);
|
||||
grid->addWidget(new QLabel(tr("Conform to Frame Rate:")), row, 0);
|
||||
conform_fr = new QDoubleSpinBox();
|
||||
conform_fr->setMinimum(0.01);
|
||||
conform_fr->setValue(f->video_tracks.at(0).video_frame_rate * f->speed);
|
||||
@@ -65,22 +79,29 @@ MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
|
||||
row++;
|
||||
|
||||
// deinterlacing mode
|
||||
interlacing_box = new QComboBox();
|
||||
interlacing_box->addItem("Auto (" + get_interlacing_name(f->video_tracks.at(0).video_auto_interlacing) + ")");
|
||||
interlacing_box = new QComboBox();
|
||||
interlacing_box->addItem(
|
||||
tr("Auto (%1)").arg(
|
||||
get_interlacing_name(f->video_tracks.at(0).video_auto_interlacing)
|
||||
)
|
||||
);
|
||||
interlacing_box->addItem(get_interlacing_name(VIDEO_PROGRESSIVE));
|
||||
interlacing_box->addItem(get_interlacing_name(VIDEO_TOP_FIELD_FIRST));
|
||||
interlacing_box->addItem(get_interlacing_name(VIDEO_BOTTOM_FIELD_FIRST));
|
||||
|
||||
interlacing_box->setCurrentIndex((f->video_tracks.at(0).video_auto_interlacing == f->video_tracks.at(0).video_interlacing) ? 0 : f->video_tracks.at(0).video_interlacing + 1);
|
||||
interlacing_box->setCurrentIndex(
|
||||
(f->video_tracks.at(0).video_auto_interlacing == f->video_tracks.at(0).video_interlacing)
|
||||
? 0
|
||||
: f->video_tracks.at(0).video_interlacing + 1);
|
||||
|
||||
grid->addWidget(new QLabel("Interlacing:"), row, 0);
|
||||
grid->addWidget(new QLabel(tr("Interlacing:")), row, 0);
|
||||
grid->addWidget(interlacing_box, row, 1);
|
||||
|
||||
row++;
|
||||
}
|
||||
|
||||
name_box = new QLineEdit(item->get_name());
|
||||
grid->addWidget(new QLabel("Name:"), row, 0);
|
||||
grid->addWidget(new QLabel(tr("Name:")), row, 0);
|
||||
grid->addWidget(name_box, row, 1);
|
||||
row++;
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ NewSequenceDialog::NewSequenceDialog(QWidget *parent, Media *existing) :
|
||||
{
|
||||
setup_ui();
|
||||
|
||||
if (existing != NULL) {
|
||||
if (existing != nullptr) {
|
||||
existing_sequence = existing->to_sequence();
|
||||
setWindowTitle("Editing \"" + existing_sequence->name + "\"");
|
||||
setWindowTitle(tr("Editing \"%1\"").arg(existing_sequence->name));
|
||||
|
||||
width_numeric->setValue(existing_sequence->width);
|
||||
height_numeric->setValue(existing_sequence->height);
|
||||
@@ -42,7 +42,7 @@ NewSequenceDialog::NewSequenceDialog(QWidget *parent, Media *existing) :
|
||||
break;
|
||||
}
|
||||
}
|
||||
sequence_name_edit->setText(existing_sequence->name);
|
||||
sequence_name_edit->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);
|
||||
@@ -50,8 +50,8 @@ NewSequenceDialog::NewSequenceDialog(QWidget *parent, Media *existing) :
|
||||
}
|
||||
}
|
||||
} else {
|
||||
existing_sequence = NULL;
|
||||
setWindowTitle("New Sequence");
|
||||
existing_sequence = nullptr;
|
||||
setWindowTitle(tr("New Sequence"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,14 +59,14 @@ NewSequenceDialog::~NewSequenceDialog()
|
||||
{}
|
||||
|
||||
void NewSequenceDialog::set_sequence_name(const QString& s) {
|
||||
sequence_name_edit->setText(s);
|
||||
sequence_name_edit->setText(s);
|
||||
}
|
||||
|
||||
void NewSequenceDialog::create() {
|
||||
if (existing_sequence == NULL) {
|
||||
if (existing_sequence == nullptr) {
|
||||
Sequence* s = new Sequence();
|
||||
|
||||
s->name = sequence_name_edit->text();
|
||||
s->name = sequence_name_edit->text();
|
||||
s->width = width_numeric->value();
|
||||
s->height = height_numeric->value();
|
||||
s->frame_rate = frame_rate_combobox->currentData().toDouble();
|
||||
@@ -74,7 +74,7 @@ void NewSequenceDialog::create() {
|
||||
s->audio_layout = AV_CH_LAYOUT_STEREO;
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
panel_project->new_sequence(ca, s, true, NULL);
|
||||
panel_project->new_sequence(ca, s, true, nullptr);
|
||||
undo_stack.push(ca);
|
||||
} else {
|
||||
ComboAction* ca = new ComboAction();
|
||||
@@ -82,7 +82,7 @@ void NewSequenceDialog::create() {
|
||||
double multiplier = frame_rate_combobox->currentData().toDouble() / existing_sequence->frame_rate;
|
||||
|
||||
EditSequenceCommand* esc = new EditSequenceCommand(existing_item, existing_sequence);
|
||||
esc->name = sequence_name_edit->text();
|
||||
esc->name = sequence_name_edit->text();
|
||||
esc->width = width_numeric->value();
|
||||
esc->height = height_numeric->value();
|
||||
esc->frame_rate = frame_rate_combobox->currentData().toDouble();
|
||||
@@ -92,7 +92,7 @@ void NewSequenceDialog::create() {
|
||||
|
||||
for (int i=0;i<existing_sequence->clips.size();i++) {
|
||||
Clip* c = existing_sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
c->refactor_frame_rate(ca, multiplier, true);
|
||||
}
|
||||
}
|
||||
@@ -154,85 +154,85 @@ void NewSequenceDialog::setup_ui() {
|
||||
|
||||
QWidget* widget = new QWidget(this);
|
||||
|
||||
QHBoxLayout* preset_layout = new QHBoxLayout(widget);
|
||||
preset_layout->setContentsMargins(0, 0, 0, 0);
|
||||
QHBoxLayout* preset_layout = new QHBoxLayout(widget);
|
||||
preset_layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
preset_layout->addWidget(new QLabel("Preset:"));
|
||||
preset_layout->addWidget(new QLabel(tr("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->addItem(tr("Film 4K"));
|
||||
preset_combobox->addItem(tr("TV 4K (Ultra HD/2160p)"));
|
||||
preset_combobox->addItem(tr("1080p"));
|
||||
preset_combobox->addItem(tr("720p"));
|
||||
preset_combobox->addItem(tr("480p"));
|
||||
preset_combobox->addItem(tr("360p"));
|
||||
preset_combobox->addItem(tr("240p"));
|
||||
preset_combobox->addItem(tr("144p"));
|
||||
preset_combobox->addItem(tr("NTSC (480i)"));
|
||||
preset_combobox->addItem(tr("PAL (576i)"));
|
||||
preset_combobox->addItem(tr("Custom"));
|
||||
preset_combobox->setCurrentIndex(2);
|
||||
|
||||
preset_layout->addWidget(preset_combobox);
|
||||
preset_layout->addWidget(preset_combobox);
|
||||
|
||||
verticalLayout->addWidget(widget);
|
||||
|
||||
QGroupBox* videoGroupBox = new QGroupBox(this);
|
||||
videoGroupBox->setTitle("Video");
|
||||
QGroupBox* videoGroupBox = new QGroupBox(this);
|
||||
videoGroupBox->setTitle(tr("Video"));
|
||||
|
||||
QGridLayout* videoLayout = new QGridLayout(videoGroupBox);
|
||||
QGridLayout* videoLayout = new QGridLayout(videoGroupBox);
|
||||
|
||||
videoLayout->addWidget(new QLabel("Width:"), 0, 0, 1, 1);
|
||||
width_numeric = new QSpinBox(videoGroupBox);
|
||||
width_numeric->setMaximum(9999);
|
||||
width_numeric->setValue(1920);
|
||||
videoLayout->addWidget(width_numeric, 0, 2, 1, 2);
|
||||
videoLayout->addWidget(new QLabel(tr("Width:")), 0, 0, 1, 1);
|
||||
width_numeric = new QSpinBox(videoGroupBox);
|
||||
width_numeric->setMaximum(9999);
|
||||
width_numeric->setValue(1920);
|
||||
videoLayout->addWidget(width_numeric, 0, 2, 1, 2);
|
||||
|
||||
videoLayout->addWidget(new QLabel("Height:"), 1, 0, 1, 2);
|
||||
height_numeric = new QSpinBox(videoGroupBox);
|
||||
videoLayout->addWidget(new QLabel(tr("Height:")), 1, 0, 1, 2);
|
||||
height_numeric = new QSpinBox(videoGroupBox);
|
||||
height_numeric->setMaximum(9999);
|
||||
height_numeric->setValue(1080);
|
||||
videoLayout->addWidget(height_numeric, 1, 2, 1, 2);
|
||||
videoLayout->addWidget(height_numeric, 1, 2, 1, 2);
|
||||
|
||||
videoLayout->addWidget(new QLabel("Frame Rate:"), 2, 0, 1, 1);
|
||||
frame_rate_combobox = new QComboBox(videoGroupBox);
|
||||
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);
|
||||
videoLayout->addWidget(frame_rate_combobox, 2, 2, 1, 2);
|
||||
videoLayout->addWidget(new QLabel(tr("Frame Rate:")), 2, 0, 1, 1);
|
||||
frame_rate_combobox = new QComboBox(videoGroupBox);
|
||||
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);
|
||||
videoLayout->addWidget(frame_rate_combobox, 2, 2, 1, 2);
|
||||
|
||||
videoLayout->addWidget(new QLabel("Pixel Aspect Ratio:"), 4, 0, 1, 1);
|
||||
par_combobox = new QComboBox(videoGroupBox);
|
||||
par_combobox->addItem("Square Pixels (1.0)");
|
||||
videoLayout->addWidget(par_combobox, 4, 2, 1, 2);
|
||||
videoLayout->addWidget(new QLabel(tr("Pixel Aspect Ratio:")), 4, 0, 1, 1);
|
||||
par_combobox = new QComboBox(videoGroupBox);
|
||||
par_combobox->addItem(tr("Square Pixels (1.0)"));
|
||||
videoLayout->addWidget(par_combobox, 4, 2, 1, 2);
|
||||
|
||||
videoLayout->addWidget(new QLabel("Interlacing:"), 6, 0, 1, 1);
|
||||
interlacing_combobox = new QComboBox(videoGroupBox);
|
||||
interlacing_combobox->addItem("None (Progressive)");
|
||||
videoLayout->addWidget(new QLabel(tr("Interlacing:")), 6, 0, 1, 1);
|
||||
interlacing_combobox = new QComboBox(videoGroupBox);
|
||||
interlacing_combobox->addItem(tr("None (Progressive)"));
|
||||
// interlacing_combobox->addItem("Upper Field First");
|
||||
// interlacing_combobox->addItem("Lower Field First");
|
||||
videoLayout->addWidget(interlacing_combobox, 6, 2, 1, 2);
|
||||
videoLayout->addWidget(interlacing_combobox, 6, 2, 1, 2);
|
||||
|
||||
verticalLayout->addWidget(videoGroupBox);
|
||||
verticalLayout->addWidget(videoGroupBox);
|
||||
|
||||
QGroupBox* audioGroupBox = new QGroupBox(this);
|
||||
audioGroupBox->setTitle("Audio");
|
||||
QGroupBox* audioGroupBox = new QGroupBox(this);
|
||||
audioGroupBox->setTitle(tr("Audio"));
|
||||
|
||||
QGridLayout* audioLayout = new QGridLayout(audioGroupBox);
|
||||
QGridLayout* audioLayout = new QGridLayout(audioGroupBox);
|
||||
|
||||
audioLayout->addWidget(new QLabel("Sample Rate: "), 0, 0, 1, 1);
|
||||
audioLayout->addWidget(new QLabel(tr("Sample Rate: ")), 0, 0, 1, 1);
|
||||
|
||||
audio_frequency_combobox = new QComboBox(audioGroupBox);
|
||||
audio_frequency_combobox = new QComboBox(audioGroupBox);
|
||||
audio_frequency_combobox->addItem("22050 Hz", 22050);
|
||||
audio_frequency_combobox->addItem("24000 Hz", 24000);
|
||||
audio_frequency_combobox->addItem("32000 Hz", 32000);
|
||||
@@ -242,21 +242,21 @@ void NewSequenceDialog::setup_ui() {
|
||||
audio_frequency_combobox->addItem("96000 Hz", 96000);
|
||||
audio_frequency_combobox->setCurrentIndex(4);
|
||||
|
||||
audioLayout->addWidget(audio_frequency_combobox, 0, 1, 1, 1);
|
||||
audioLayout->addWidget(audio_frequency_combobox, 0, 1, 1, 1);
|
||||
|
||||
verticalLayout->addWidget(audioGroupBox);
|
||||
verticalLayout->addWidget(audioGroupBox);
|
||||
|
||||
QWidget* nameWidget = new QWidget(this);
|
||||
QHBoxLayout* nameLayout = new QHBoxLayout(nameWidget);
|
||||
nameLayout->setContentsMargins(0, 0, 0, 0);
|
||||
QWidget* nameWidget = new QWidget(this);
|
||||
QHBoxLayout* nameLayout = new QHBoxLayout(nameWidget);
|
||||
nameLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
nameLayout->addWidget(new QLabel("Name:"));
|
||||
nameLayout->addWidget(new QLabel("Name:"));
|
||||
|
||||
sequence_name_edit = new QLineEdit(nameWidget);
|
||||
sequence_name_edit = new QLineEdit(nameWidget);
|
||||
|
||||
nameLayout->addWidget(sequence_name_edit);
|
||||
nameLayout->addWidget(sequence_name_edit);
|
||||
|
||||
verticalLayout->addWidget(nameWidget);
|
||||
verticalLayout->addWidget(nameWidget);
|
||||
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setOrientation(Qt::Horizontal);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "preferencesdialog.h"
|
||||
|
||||
#include "io/config.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QMenuBar>
|
||||
#include <QAction>
|
||||
@@ -39,13 +40,13 @@ void KeySequenceEditor::reset_to_default() {
|
||||
}
|
||||
|
||||
QString KeySequenceEditor::action_name() {
|
||||
return action->text().replace("&", "");
|
||||
return action->property("id").toString();
|
||||
}
|
||||
|
||||
QString KeySequenceEditor::export_shortcut() {
|
||||
QString ks = keySequence().toString();
|
||||
if (ks != action->property("default")) {
|
||||
return action->text().replace("&", "") + "\t" + keySequence().toString();
|
||||
return action->property("id").toString() + "\t" + keySequence().toString();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -53,7 +54,7 @@ QString KeySequenceEditor::export_shortcut() {
|
||||
PreferencesDialog::PreferencesDialog(QWidget *parent) :
|
||||
QDialog(parent)
|
||||
{
|
||||
setWindowTitle("Preferences");
|
||||
setWindowTitle(tr("Preferences"));
|
||||
setup_ui();
|
||||
|
||||
accurateSeekButton->setChecked(!config.fast_seeking);
|
||||
@@ -75,7 +76,7 @@ void PreferencesDialog::setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem*
|
||||
|
||||
parent->addChild(item);
|
||||
|
||||
if (a->menu() != NULL) {
|
||||
if (a->menu() != nullptr) {
|
||||
item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
|
||||
setup_kbd_shortcut_worker(a->menu(), item);
|
||||
} else {
|
||||
@@ -101,13 +102,26 @@ void PreferencesDialog::setup_kbd_shortcuts(QMenuBar* menubar) {
|
||||
}
|
||||
|
||||
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);
|
||||
if (!key_shortcut_actions.at(i)->property("id").isNull()) {
|
||||
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::save() {
|
||||
if (!custom_css_fn->text().isEmpty() && !QFileInfo::exists(custom_css_fn->text())) {
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Invalid CSS File"),
|
||||
tr("CSS file '%1' does not exist.").arg(custom_css_fn->text())
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
config.css_path = custom_css_fn->text();
|
||||
mainWindow->load_css_from_file(config.css_path);
|
||||
config.recording_mode = recordingComboBox->currentIndex() + 1;
|
||||
config.img_seq_formats = imgSeqFormatEdit->text();
|
||||
config.fast_seeking = fastSeekButton->isChecked();
|
||||
@@ -134,7 +148,11 @@ void PreferencesDialog::reset_default_shortcut() {
|
||||
}
|
||||
|
||||
void PreferencesDialog::reset_all_shortcuts() {
|
||||
if (QMessageBox::question(this, "Confirm Reset All Shortcuts", "Are you sure you wish to reset all keyboard shortcuts to their defaults?", QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
if (QMessageBox::question(
|
||||
this,
|
||||
tr("Confirm Reset All Shortcuts"),
|
||||
tr("Are you sure you wish to reset all keyboard shortcuts to their defaults?"),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
for (int i=0;i<key_shortcut_fields.size();i++) {
|
||||
key_shortcut_fields.at(i)->reset_to_default();
|
||||
}
|
||||
@@ -142,7 +160,7 @@ void PreferencesDialog::reset_all_shortcuts() {
|
||||
}
|
||||
|
||||
bool PreferencesDialog::refine_shortcut_list(const QString &s, QTreeWidgetItem* parent) {
|
||||
if (parent == NULL) {
|
||||
if (parent == nullptr) {
|
||||
for (int i=0;i<keyboard_tree->topLevelItemCount();i++) {
|
||||
refine_shortcut_list(s, keyboard_tree->topLevelItem(i));
|
||||
}
|
||||
@@ -161,7 +179,7 @@ bool PreferencesDialog::refine_shortcut_list(const QString &s, QTreeWidgetItem*
|
||||
all_children_are_hidden = false;
|
||||
} else {
|
||||
QString shortcut;
|
||||
if (keyboard_tree->itemWidget(item, 1) != NULL) {
|
||||
if (keyboard_tree->itemWidget(item, 1) != nullptr) {
|
||||
shortcut = static_cast<QKeySequenceEdit*>(keyboard_tree->itemWidget(item, 1))->keySequence().toString();
|
||||
}
|
||||
if (item->text(0).contains(s, Qt::CaseInsensitive) || shortcut.contains(s, Qt::CaseInsensitive)) {
|
||||
@@ -183,7 +201,7 @@ bool PreferencesDialog::refine_shortcut_list(const QString &s, QTreeWidgetItem*
|
||||
}
|
||||
|
||||
void PreferencesDialog::load_shortcut_file() {
|
||||
QString fn = QFileDialog::getOpenFileName(this, "Import Keyboard Shortcuts");
|
||||
QString fn = QFileDialog::getOpenFileName(this, tr("Import Keyboard Shortcuts"));
|
||||
if (!fn.isEmpty()) {
|
||||
QFile f(fn);
|
||||
if (f.exists() && f.open(QFile::ReadOnly)) {
|
||||
@@ -199,20 +217,23 @@ void PreferencesDialog::load_shortcut_file() {
|
||||
ks.append(ba.at(index));
|
||||
index++;
|
||||
}
|
||||
dout << "set" << key_shortcut_fields.at(i)->action_name() << "to" << ks;
|
||||
key_shortcut_fields.at(i)->setKeySequence(ks);
|
||||
} else {
|
||||
key_shortcut_fields.at(i)->reset_to_default();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
QMessageBox::critical(this, "Error saving shortcuts", "Failed to open file for reading");
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Error saving shortcuts"),
|
||||
tr("Failed to open file for reading")
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::save_shortcut_file() {
|
||||
QString fn = QFileDialog::getSaveFileName(this, "Export Keyboard Shortcuts");
|
||||
QString fn = QFileDialog::getSaveFileName(this, tr("Export Keyboard Shortcuts"));
|
||||
if (!fn.isEmpty()) {
|
||||
QFile f(fn);
|
||||
if (f.open(QFile::WriteOnly)) {
|
||||
@@ -225,14 +246,21 @@ void PreferencesDialog::save_shortcut_file() {
|
||||
start = false;
|
||||
}
|
||||
}
|
||||
QMessageBox::information(this, "Export Shortcuts", "Shortcuts exported successfully");
|
||||
f.close();
|
||||
QMessageBox::information(this, tr("Export Shortcuts"), tr("Shortcuts exported successfully"));
|
||||
} else {
|
||||
QMessageBox::critical(this, "Error saving shortcuts", "Failed to open file for writing");
|
||||
QMessageBox::critical(this, tr("Error saving shortcuts"), tr("Failed to open file for writing"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::browse_css_file() {
|
||||
QString fn = QFileDialog::getOpenFileName(this, tr("Browse for CSS file"));
|
||||
if (!fn.isEmpty()) {
|
||||
custom_css_fn->setText(fn);
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::setup_ui() {
|
||||
QVBoxLayout* verticalLayout = new QVBoxLayout(this);
|
||||
QTabWidget* tabWidget = new QTabWidget(this);
|
||||
@@ -240,110 +268,120 @@ void PreferencesDialog::setup_ui() {
|
||||
QTabWidget* general_tab = new QTabWidget();
|
||||
QGridLayout* general_layout = new QGridLayout(general_tab);
|
||||
|
||||
general_layout->addWidget(new QLabel("Image sequence formats:"), 0, 0, 1, 1);
|
||||
general_layout->addWidget(new QLabel(tr("Custom CSS:")), 0, 0, 1, 1);
|
||||
|
||||
custom_css_fn = new QLineEdit(general_tab);
|
||||
custom_css_fn->setText(config.css_path);
|
||||
general_layout->addWidget(custom_css_fn, 0, 1, 1, 1);
|
||||
|
||||
QPushButton* custom_css_browse = new QPushButton(tr("Browse"), general_tab);
|
||||
connect(custom_css_browse, SIGNAL(clicked(bool)), this, SLOT(browse_css_file()));
|
||||
general_layout->addWidget(custom_css_browse, 0, 2, 1, 1);
|
||||
|
||||
general_layout->addWidget(new QLabel(tr("Image sequence formats:")), 1, 0, 1, 1);
|
||||
|
||||
imgSeqFormatEdit = new QLineEdit(general_tab);
|
||||
|
||||
general_layout->addWidget(imgSeqFormatEdit, 0, 1, 1, 1);
|
||||
general_layout->addWidget(imgSeqFormatEdit, 1, 1, 1, 2);
|
||||
|
||||
general_layout->addWidget(new QLabel("Audio Recording:"), 1, 0, 1, 1);
|
||||
general_layout->addWidget(new QLabel(tr("Audio Recording:")), 2, 0, 1, 1);
|
||||
|
||||
recordingComboBox = new QComboBox(general_tab);
|
||||
recordingComboBox->addItem("Mono");
|
||||
recordingComboBox->addItem("Stereo");
|
||||
recordingComboBox->addItem(tr("Mono"));
|
||||
recordingComboBox->addItem(tr("Stereo"));
|
||||
|
||||
general_layout->addWidget(recordingComboBox, 1, 1, 1, 1);
|
||||
general_layout->addWidget(recordingComboBox, 2, 1, 1, 2);
|
||||
|
||||
tabWidget->addTab(general_tab, "General");
|
||||
tabWidget->addTab(general_tab, tr("General"));
|
||||
QWidget* behavior_tab = new QWidget();
|
||||
tabWidget->addTab(behavior_tab, "Behavior");
|
||||
tabWidget->addTab(behavior_tab, tr("Behavior"));
|
||||
|
||||
// Playback
|
||||
QWidget* playback_tab = new QWidget();
|
||||
QVBoxLayout* playback_tab_layout = new QVBoxLayout(playback_tab);
|
||||
|
||||
// Playback -> Disable Multithreading on Images
|
||||
disable_img_multithread = new QCheckBox("Disable Multithreading on Images");
|
||||
disable_img_multithread = new QCheckBox(tr("Disable Multithreading on Images"));
|
||||
disable_img_multithread->setChecked(config.disable_multithreading_for_images);
|
||||
playback_tab_layout->addWidget(disable_img_multithread);
|
||||
|
||||
// Playback -> Seeking
|
||||
QGroupBox* seeking_group = new QGroupBox(playback_tab);
|
||||
seeking_group->setTitle("Seeking");
|
||||
seeking_group->setTitle(tr("Seeking"));
|
||||
QVBoxLayout* seeking_group_layout = new QVBoxLayout(seeking_group);
|
||||
accurateSeekButton = new QRadioButton(seeking_group);
|
||||
accurateSeekButton->setText("Accurate Seeking\nAlways show the correct frame (visual may pause briefly as correct frame is retrieved)");
|
||||
accurateSeekButton->setText(tr("Accurate Seeking\nAlways show the correct frame (visual may pause briefly as correct frame is retrieved)"));
|
||||
seeking_group_layout->addWidget(accurateSeekButton);
|
||||
fastSeekButton = new QRadioButton(seeking_group);
|
||||
fastSeekButton->setText("Fast Seeking\nSeek quickly (may briefly show inaccurate frames when seeking - doesn't affect playback/export)");
|
||||
fastSeekButton->setText(tr("Fast Seeking\nSeek quickly (may briefly show inaccurate frames when seeking - doesn't affect playback/export)"));
|
||||
seeking_group_layout->addWidget(fastSeekButton);
|
||||
playback_tab_layout->addWidget(seeking_group);
|
||||
|
||||
// Playback -> Memory Usage
|
||||
QGroupBox* memory_usage_group = new QGroupBox(playback_tab);
|
||||
memory_usage_group->setTitle("Memory Usage");
|
||||
memory_usage_group->setTitle(tr("Memory Usage"));
|
||||
QGridLayout* memory_usage_layout = new QGridLayout(memory_usage_group);
|
||||
memory_usage_layout->addWidget(new QLabel("Upcoming Frame Queue:"), 0, 0);
|
||||
memory_usage_layout->addWidget(new QLabel(tr("Upcoming Frame Queue:")), 0, 0);
|
||||
upcoming_queue_spinbox = new QDoubleSpinBox();
|
||||
upcoming_queue_spinbox->setValue(config.upcoming_queue_size);
|
||||
memory_usage_layout->addWidget(upcoming_queue_spinbox, 0, 1);
|
||||
upcoming_queue_type = new QComboBox();
|
||||
upcoming_queue_type->addItem("frames");
|
||||
upcoming_queue_type->addItem("seconds");
|
||||
upcoming_queue_type->addItem(tr("frames"));
|
||||
upcoming_queue_type->addItem(tr("seconds"));
|
||||
upcoming_queue_type->setCurrentIndex(config.upcoming_queue_type);
|
||||
memory_usage_layout->addWidget(upcoming_queue_type, 0, 2);
|
||||
memory_usage_layout->addWidget(new QLabel("Previous Frame Queue:"), 1, 0);
|
||||
memory_usage_layout->addWidget(new QLabel(tr("Previous Frame Queue:")), 1, 0);
|
||||
previous_queue_spinbox = new QDoubleSpinBox();
|
||||
previous_queue_spinbox->setValue(config.previous_queue_size);
|
||||
memory_usage_layout->addWidget(previous_queue_spinbox, 1, 1);
|
||||
previous_queue_type = new QComboBox();
|
||||
previous_queue_type->addItem("frames");
|
||||
previous_queue_type->addItem("seconds");
|
||||
previous_queue_type->addItem(tr("frames"));
|
||||
previous_queue_type->addItem(tr("seconds"));
|
||||
previous_queue_type->setCurrentIndex(config.previous_queue_type);
|
||||
memory_usage_layout->addWidget(previous_queue_type, 1, 2);
|
||||
playback_tab_layout->addWidget(memory_usage_group);
|
||||
|
||||
tabWidget->addTab(playback_tab, "Playback");
|
||||
tabWidget->addTab(playback_tab, tr("Playback"));
|
||||
|
||||
QWidget* shortcut_tab = new QWidget();
|
||||
|
||||
QVBoxLayout* shortcut_layout = new QVBoxLayout(shortcut_tab);
|
||||
|
||||
QLineEdit* key_search_line = new QLineEdit();
|
||||
key_search_line->setPlaceholderText("Search for action or shortcut");
|
||||
key_search_line->setPlaceholderText(tr("Search for action or shortcut"));
|
||||
connect(key_search_line, SIGNAL(textChanged(const QString &)), this, SLOT(refine_shortcut_list(const QString &)));
|
||||
|
||||
shortcut_layout->addWidget(key_search_line);
|
||||
|
||||
keyboard_tree = new QTreeWidget();
|
||||
QTreeWidgetItem* tree_header = keyboard_tree->headerItem();
|
||||
tree_header->setText(0, "Action");
|
||||
tree_header->setText(1, "Shortcut");
|
||||
tree_header->setText(0, tr("Action"));
|
||||
tree_header->setText(1, tr("Shortcut"));
|
||||
shortcut_layout->addWidget(keyboard_tree);
|
||||
|
||||
QHBoxLayout* reset_shortcut_layout = new QHBoxLayout();
|
||||
|
||||
QPushButton* import_shortcut_button = new QPushButton("Import");
|
||||
QPushButton* import_shortcut_button = new QPushButton(tr("Import"));
|
||||
reset_shortcut_layout->addWidget(import_shortcut_button);
|
||||
connect(import_shortcut_button, SIGNAL(clicked(bool)), this, SLOT(load_shortcut_file()));
|
||||
|
||||
QPushButton* export_shortcut_button = new QPushButton("Export");
|
||||
QPushButton* export_shortcut_button = new QPushButton(tr("Export"));
|
||||
reset_shortcut_layout->addWidget(export_shortcut_button);
|
||||
connect(export_shortcut_button, SIGNAL(clicked(bool)), this, SLOT(save_shortcut_file()));
|
||||
|
||||
reset_shortcut_layout->addStretch();
|
||||
|
||||
QPushButton* reset_selected_shortcut_button = new QPushButton("Reset Selected");
|
||||
QPushButton* reset_selected_shortcut_button = new QPushButton(tr("Reset Selected"));
|
||||
reset_shortcut_layout->addWidget(reset_selected_shortcut_button);
|
||||
connect(reset_selected_shortcut_button, SIGNAL(clicked(bool)), this, SLOT(reset_default_shortcut()));
|
||||
|
||||
QPushButton* reset_all_shortcut_button = new QPushButton("Reset All");
|
||||
QPushButton* reset_all_shortcut_button = new QPushButton(tr("Reset All"));
|
||||
reset_shortcut_layout->addWidget(reset_all_shortcut_button);
|
||||
connect(reset_all_shortcut_button, SIGNAL(clicked(bool)), this, SLOT(reset_all_shortcuts()));
|
||||
|
||||
shortcut_layout->addLayout(reset_shortcut_layout);
|
||||
|
||||
tabWidget->addTab(shortcut_tab, "Keyboard");
|
||||
tabWidget->addTab(shortcut_tab, tr("Keyboard"));
|
||||
|
||||
verticalLayout->addWidget(tabWidget);
|
||||
|
||||
|
||||
@@ -39,14 +39,16 @@ private slots:
|
||||
void save();
|
||||
void reset_default_shortcut();
|
||||
void reset_all_shortcuts();
|
||||
bool refine_shortcut_list(const QString &, QTreeWidgetItem* parent = NULL);
|
||||
bool refine_shortcut_list(const QString &, QTreeWidgetItem* parent = nullptr);
|
||||
void load_shortcut_file();
|
||||
void save_shortcut_file();
|
||||
void browse_css_file();
|
||||
|
||||
private:
|
||||
void setup_ui();
|
||||
void setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem* parent);
|
||||
|
||||
QLineEdit* custom_css_fn;
|
||||
QLineEdit* imgSeqFormatEdit;
|
||||
QComboBox* recordingComboBox;
|
||||
QRadioButton* accurateSeekButton;
|
||||
|
||||
@@ -23,19 +23,19 @@ ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media *old_media
|
||||
QDialog(parent),
|
||||
media(old_media)
|
||||
{
|
||||
setWindowTitle("Replace clips using \"" + old_media->get_name() + "\"");
|
||||
setWindowTitle(tr("Replace clips using \"%1\"").arg(old_media->get_name()));
|
||||
|
||||
resize(300, 400);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
|
||||
layout->addWidget(new QLabel("Select which media you want to replace this media's clips with:"));
|
||||
layout->addWidget(new QLabel(tr("Select which media you want to replace this media's clips with:")));
|
||||
|
||||
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(tr("Keep the same media in-points"));
|
||||
use_same_media_in_points->setChecked(true);
|
||||
layout->addWidget(use_same_media_in_points);
|
||||
|
||||
@@ -43,11 +43,11 @@ ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media *old_media
|
||||
|
||||
buttons->addStretch();
|
||||
|
||||
QPushButton* replace_button = new QPushButton("Replace");
|
||||
QPushButton* replace_button = new QPushButton(tr("Replace"));
|
||||
connect(replace_button, SIGNAL(clicked(bool)), this, SLOT(replace()));
|
||||
buttons->addWidget(replace_button);
|
||||
|
||||
QPushButton* cancel_button = new QPushButton("Cancel");
|
||||
QPushButton* cancel_button = new QPushButton(tr("Cancel"));
|
||||
connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(close()));
|
||||
buttons->addWidget(cancel_button);
|
||||
|
||||
@@ -63,16 +63,36 @@ ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media *old_media
|
||||
void ReplaceClipMediaDialog::replace() {
|
||||
QModelIndexList selected_items = tree->selectionModel()->selectedRows();
|
||||
if (selected_items.size() != 1) {
|
||||
QMessageBox::critical(this, "No media selected", "Please select a media to replace with or click 'Cancel'.", QMessageBox::Ok);
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("No media selected"),
|
||||
tr("Please select a media to replace with or click 'Cancel'."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else {
|
||||
Media* new_item = static_cast<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);
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Same media selected"),
|
||||
tr("You selected the same media that you're replacing. Please select a different one or click 'Cancel'."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else if (new_item->get_type() == MEDIA_TYPE_FOLDER) {
|
||||
QMessageBox::critical(this, "Folder selected", "You cannot replace footage with a folder.", QMessageBox::Ok);
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Folder selected"),
|
||||
tr("You cannot replace footage with a folder."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else {
|
||||
if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && sequence == new_item->to_sequence()) {
|
||||
QMessageBox::critical(this, "Active sequence selected", "You cannot insert a sequence into itself.", QMessageBox::Ok);
|
||||
QMessageBox::critical(
|
||||
this,
|
||||
tr("Active sequence selected"),
|
||||
tr("You cannot insert a sequence into itself."),
|
||||
QMessageBox::Ok
|
||||
);
|
||||
} else {
|
||||
ReplaceClipMediaCommand* rcmc = new ReplaceClipMediaCommand(
|
||||
media,
|
||||
@@ -82,7 +102,7 @@ void ReplaceClipMediaDialog::replace() {
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && c->media == media) {
|
||||
if (c != nullptr && c->media == media) {
|
||||
rcmc->clips.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
+11
-9
@@ -19,25 +19,27 @@
|
||||
#include "project/media.h"
|
||||
|
||||
SpeedDialog::SpeedDialog(QWidget *parent) : QDialog(parent) {
|
||||
setWindowTitle(tr("Speed/Duration"));
|
||||
|
||||
QVBoxLayout* main_layout = new QVBoxLayout();
|
||||
setLayout(main_layout);
|
||||
|
||||
QGridLayout* grid = new QGridLayout();
|
||||
grid->setSpacing(6);
|
||||
|
||||
grid->addWidget(new QLabel("Speed:"), 0, 0);
|
||||
grid->addWidget(new QLabel(tr("Speed:")), 0, 0);
|
||||
percent = new LabelSlider();
|
||||
percent->decimal_places = 2;
|
||||
percent->set_display_type(LABELSLIDER_PERCENT);
|
||||
percent->set_default_value(1);
|
||||
grid->addWidget(percent, 0, 1);
|
||||
|
||||
grid->addWidget(new QLabel("Frame Rate:"), 1, 0);
|
||||
grid->addWidget(new QLabel(tr("Frame Rate:")), 1, 0);
|
||||
frame_rate = new LabelSlider();
|
||||
frame_rate->decimal_places = 3;
|
||||
grid->addWidget(frame_rate, 1, 1);
|
||||
|
||||
grid->addWidget(new QLabel("Duration:"), 2, 0);
|
||||
grid->addWidget(new QLabel(tr("Duration:")), 2, 0);
|
||||
duration = new LabelSlider();
|
||||
duration->set_display_type(LABELSLIDER_FRAMENUMBER);
|
||||
duration->set_frame_rate(sequence->frame_rate);
|
||||
@@ -45,9 +47,9 @@ SpeedDialog::SpeedDialog(QWidget *parent) : QDialog(parent) {
|
||||
|
||||
main_layout->addLayout(grid);
|
||||
|
||||
reverse = new QCheckBox("Reverse");
|
||||
maintain_pitch = new QCheckBox("Maintain Audio Pitch");
|
||||
ripple = new QCheckBox("Ripple Changes");
|
||||
reverse = new QCheckBox(tr("Reverse"));
|
||||
maintain_pitch = new QCheckBox(tr("Maintain Audio Pitch"));
|
||||
ripple = new QCheckBox(tr("Ripple Changes"));
|
||||
|
||||
main_layout->addWidget(reverse);
|
||||
main_layout->addWidget(maintain_pitch);
|
||||
@@ -84,10 +86,10 @@ 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) {
|
||||
if (c->media != nullptr && 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) {
|
||||
if (ms != nullptr && ms->infinite_length) {
|
||||
process_video = false;
|
||||
}
|
||||
}
|
||||
@@ -304,7 +306,7 @@ void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, lo
|
||||
if (!ripple && proposed_out > c->timeline_out) {
|
||||
for (int i=0;i<c->sequence->clips.size();i++) {
|
||||
Clip* compare = c->sequence->clips.at(i);
|
||||
if (compare != NULL
|
||||
if (compare != nullptr
|
||||
&& compare->track == c->track
|
||||
&& compare->timeline_in >= c->timeline_out && compare->timeline_in < proposed_out) {
|
||||
proposed_out = compare->timeline_in;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
#include "texteditdialog.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QDialogButtonBox>
|
||||
|
||||
TextEditDialog::TextEditDialog(QWidget *parent, const QString &s) :
|
||||
QDialog(parent)
|
||||
{
|
||||
setWindowTitle(tr("Edit Text"));
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
setLayout(layout);
|
||||
|
||||
textEdit = new QPlainTextEdit();
|
||||
textEdit->setPlainText(s);
|
||||
layout->addWidget(textEdit);
|
||||
|
||||
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
layout->addWidget(buttons);
|
||||
connect(buttons, SIGNAL(accepted()), this, SLOT(save()));
|
||||
connect(buttons, SIGNAL(rejected()), this, SLOT(cancel()));
|
||||
}
|
||||
|
||||
const QString& TextEditDialog::get_string() {
|
||||
return result_str;
|
||||
}
|
||||
|
||||
void TextEditDialog::save() {
|
||||
result_str = textEdit->toPlainText();
|
||||
accept();
|
||||
}
|
||||
|
||||
void TextEditDialog::cancel() {
|
||||
reject();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef TEXTEDITDIALOG_H
|
||||
#define TEXTEDITDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QPlainTextEdit;
|
||||
|
||||
class TextEditDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
TextEditDialog(QWidget* parent = 0, const QString& s = 0);
|
||||
const QString& get_string();
|
||||
private slots:
|
||||
void save();
|
||||
void cancel();
|
||||
private:
|
||||
QString result_str;
|
||||
QPlainTextEdit* textEdit;
|
||||
};
|
||||
|
||||
#endif // TEXTEDITDIALOG_H
|
||||
@@ -4,12 +4,12 @@
|
||||
#include <QtMath>
|
||||
|
||||
AudioNoiseEffect::AudioNoiseEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
amount_val = add_row("Amount")->add_field(EFFECT_FIELD_DOUBLE, "amount");
|
||||
amount_val = add_row(tr("Amount"))->add_field(EFFECT_FIELD_DOUBLE, "amount");
|
||||
amount_val->set_double_minimum_value(0);
|
||||
amount_val->set_double_maximum_value(100);
|
||||
amount_val->set_double_default_value(20);
|
||||
|
||||
mix_val = add_row("Mix")->add_field(EFFECT_FIELD_BOOL, "mix");
|
||||
mix_val = add_row(tr("Mix"))->add_field(EFFECT_FIELD_BOOL, "mix");
|
||||
mix_val->set_bool_value(true);
|
||||
|
||||
srand(QDateTime::currentMSecsSinceEpoch());
|
||||
|
||||
@@ -8,23 +8,23 @@ CornerPinEffect::CornerPinEffect(Clip *c, const EffectMeta *em) : Effect(c, em)
|
||||
enable_coords = true;
|
||||
enable_shader = true;
|
||||
|
||||
EffectRow* top_left = add_row("Top Left");
|
||||
EffectRow* top_left = add_row(tr("Top Left"));
|
||||
top_left_x = top_left->add_field(EFFECT_FIELD_DOUBLE, "topleftx");
|
||||
top_left_y = top_left->add_field(EFFECT_FIELD_DOUBLE, "toplefty");
|
||||
|
||||
EffectRow* top_right = add_row("Top Right");
|
||||
EffectRow* top_right = add_row(tr("Top Right"));
|
||||
top_right_x = top_right->add_field(EFFECT_FIELD_DOUBLE, "toprightx");
|
||||
top_right_y = top_right->add_field(EFFECT_FIELD_DOUBLE, "toprighty");
|
||||
|
||||
EffectRow* bottom_left = add_row("Bottom Left");
|
||||
EffectRow* bottom_left = add_row(tr("Bottom Left"));
|
||||
bottom_left_x = bottom_left->add_field(EFFECT_FIELD_DOUBLE, "bottomleftx");
|
||||
bottom_left_y = bottom_left->add_field(EFFECT_FIELD_DOUBLE, "bottomlefty");
|
||||
|
||||
EffectRow* bottom_right = add_row("Bottom Right");
|
||||
EffectRow* bottom_right = add_row(tr("Bottom Right"));
|
||||
bottom_right_x = bottom_right->add_field(EFFECT_FIELD_DOUBLE, "bottomrightx");
|
||||
bottom_right_y = bottom_right->add_field(EFFECT_FIELD_DOUBLE, "bottomrighty");
|
||||
|
||||
perspective = add_row("Perspective")->add_field(EFFECT_FIELD_BOOL, "perspective");
|
||||
perspective = add_row(tr("Perspective"))->add_field(EFFECT_FIELD_BOOL, "perspective");
|
||||
perspective->set_bool_value(true);
|
||||
|
||||
top_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
@@ -47,7 +47,7 @@ CornerPinEffect::CornerPinEffect(Clip *c, const EffectMeta *em) : Effect(c, em)
|
||||
fragPath = "cornerpin.frag";
|
||||
}
|
||||
|
||||
void CornerPinEffect::process_coords(double timecode, GLTextureCoords &coords, int data) {
|
||||
void CornerPinEffect::process_coords(double timecode, GLTextureCoords &coords, int) {
|
||||
coords.vertexTopLeftX += top_left_x->get_double_value(timecode);
|
||||
coords.vertexTopLeftY += top_left_y->get_double_value(timecode);
|
||||
|
||||
@@ -69,7 +69,7 @@ void CornerPinEffect::process_shader(double timecode, GLTextureCoords &coords) {
|
||||
glslProgram->setUniformValue("perspective", perspective->get_bool_value(timecode));
|
||||
}
|
||||
|
||||
void CornerPinEffect::gizmo_draw(double timecode, GLTextureCoords &coords) {
|
||||
void CornerPinEffect::gizmo_draw(double, GLTextureCoords &coords) {
|
||||
top_left_gizmo->world_pos[0] = QPoint(coords.vertexTopLeftX, coords.vertexTopLeftY);
|
||||
top_right_gizmo->world_pos[0] = QPoint(coords.vertexTopRightX, coords.vertexTopRightY);
|
||||
bottom_right_gizmo->world_pos[0] = QPoint(coords.vertexBottomRightX, coords.vertexBottomRightY);
|
||||
|
||||
@@ -9,7 +9,7 @@ CrossDissolveTransition::CrossDissolveTransition(Clip* c, Clip* s, const EffectM
|
||||
}
|
||||
|
||||
void CrossDissolveTransition::process_coords(double progress, GLTextureCoords&, int data) {
|
||||
if (!(data == TA_CLOSING_TRANSITION && secondary_clip != NULL)) {
|
||||
if (!(data == TA_CLOSING_TRANSITION && secondary_clip != nullptr)) {
|
||||
float color[4];
|
||||
glGetFloatv(GL_CURRENT_COLOR, color);
|
||||
if (data == TA_CLOSING_TRANSITION) progress = 1.0 - progress;
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
#include "debug.h"
|
||||
|
||||
CubeTransition::CubeTransition(Clip* c, Clip* s, const EffectMeta* em) : Transition(c, s, em) {
|
||||
enable_coords = true;
|
||||
enable_coords = true;
|
||||
}
|
||||
|
||||
void CubeTransition::process_coords(double progress, GLTextureCoords& coords, int data) {
|
||||
void CubeTransition::process_coords(double, GLTextureCoords& coords, int) {
|
||||
|
||||
coords.vertexTopLeftZ = 1;
|
||||
coords.vertexBottomLeftZ = 1;
|
||||
coords.vertexTopLeftZ = 1;
|
||||
coords.vertexBottomLeftZ = 1;
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#define FILL_TYPE_RIGHT 1
|
||||
|
||||
FillLeftRightEffect::FillLeftRightEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
EffectRow* type_row = add_row("Type");
|
||||
EffectRow* type_row = add_row(tr("Type"));
|
||||
fill_type = type_row->add_field(EFFECT_FIELD_COMBO, "type");
|
||||
fill_type->add_combo_item("Fill Left with Right", FILL_TYPE_LEFT);
|
||||
fill_type->add_combo_item("Fill Right with Left", FILL_TYPE_RIGHT);
|
||||
fill_type->add_combo_item(tr("Fill Left with Right"), FILL_TYPE_LEFT);
|
||||
fill_type->add_combo_item(tr("Fill Right with Left"), FILL_TYPE_RIGHT);
|
||||
}
|
||||
|
||||
void FillLeftRightEffect::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int) {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "ui/collapsiblewidget.h"
|
||||
|
||||
PanEffect::PanEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
EffectRow* pan_row = add_row("Pan");
|
||||
EffectRow* pan_row = add_row(tr("Pan"));
|
||||
pan_val = pan_row->add_field(EFFECT_FIELD_DOUBLE, "pan");
|
||||
pan_val->set_double_minimum_value(-100);
|
||||
pan_val->set_double_maximum_value(100);
|
||||
|
||||
@@ -16,15 +16,15 @@
|
||||
ShakeEffect::ShakeEffect(Clip *c, const EffectMeta *em) : Effect(c, em) {
|
||||
enable_coords = true;
|
||||
|
||||
EffectRow* intensity_row = add_row("Intensity");
|
||||
EffectRow* intensity_row = add_row(tr("Intensity"));
|
||||
intensity_val = intensity_row->add_field(EFFECT_FIELD_DOUBLE, "intensity");
|
||||
intensity_val->set_double_minimum_value(0);
|
||||
|
||||
EffectRow* rotation_row = add_row("Rotation");
|
||||
EffectRow* rotation_row = add_row(tr("Rotation"));
|
||||
rotation_val = rotation_row->add_field(EFFECT_FIELD_DOUBLE, "rotation");
|
||||
rotation_val->set_double_minimum_value(0);
|
||||
|
||||
EffectRow* frequency_row = add_row("Frequency");
|
||||
EffectRow* frequency_row = add_row(tr("Frequency"));
|
||||
frequency_val = frequency_row->add_field(EFFECT_FIELD_DOUBLE, "frequency");
|
||||
frequency_val->set_double_minimum_value(0);
|
||||
|
||||
@@ -40,7 +40,7 @@ ShakeEffect::ShakeEffect(Clip *c, const EffectMeta *em) : Effect(c, em) {
|
||||
}
|
||||
}
|
||||
|
||||
void ShakeEffect::process_coords(double timecode, GLTextureCoords& coords, int data) {
|
||||
void ShakeEffect::process_coords(double timecode, GLTextureCoords& coords, int) {
|
||||
int lim = RANDOM_VAL_SIZE/6;
|
||||
|
||||
double multiplier = intensity_val->get_double_value(timecode)/lim;
|
||||
|
||||
@@ -21,20 +21,20 @@
|
||||
SolidEffect::SolidEffect(Clip* c, const EffectMeta* em) : Effect(c, em) {
|
||||
enable_superimpose = true;
|
||||
|
||||
solid_type = add_row("Type")->add_field(EFFECT_FIELD_COMBO, "type");
|
||||
solid_type->add_combo_item("Solid Color", SOLID_TYPE_COLOR);
|
||||
solid_type->add_combo_item("SMPTE Bars", SOLID_TYPE_BARS);
|
||||
solid_type->add_combo_item("Checkerboard", SOLID_TYPE_CHECKERBOARD);
|
||||
solid_type = add_row(tr("Type"))->add_field(EFFECT_FIELD_COMBO, "type");
|
||||
solid_type->add_combo_item(tr("Solid Color"), SOLID_TYPE_COLOR);
|
||||
solid_type->add_combo_item(tr("SMPTE Bars"), SOLID_TYPE_BARS);
|
||||
solid_type->add_combo_item(tr("Checkerboard"), SOLID_TYPE_CHECKERBOARD);
|
||||
|
||||
opacity_field = add_row("Opacity")->add_field(EFFECT_FIELD_DOUBLE, "opacity");
|
||||
opacity_field = add_row(tr("Opacity"))->add_field(EFFECT_FIELD_DOUBLE, "opacity");
|
||||
opacity_field->set_double_minimum_value(0);
|
||||
opacity_field->set_double_maximum_value(100);
|
||||
opacity_field->set_double_default_value(100);
|
||||
|
||||
solid_color_field = add_row("Color")->add_field(EFFECT_FIELD_COLOR, "color");
|
||||
solid_color_field = add_row(tr("Color"))->add_field(EFFECT_FIELD_COLOR, "color");
|
||||
solid_color_field->set_color_value(Qt::red);
|
||||
|
||||
checkerboard_size_field = add_row("Checkerboard Size")->add_field(EFFECT_FIELD_DOUBLE, "checker_size");
|
||||
checkerboard_size_field = add_row(tr("Checkerboard Size"))->add_field(EFFECT_FIELD_DOUBLE, "checker_size");
|
||||
checkerboard_size_field->set_double_minimum_value(1);
|
||||
checkerboard_size_field->set_double_default_value(10);
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <QComboBox>
|
||||
#include <QWidget>
|
||||
#include <QtMath>
|
||||
#include <QMenu>
|
||||
|
||||
#include "ui/labelslider.h"
|
||||
#include "ui/collapsiblewidget.h"
|
||||
@@ -19,6 +20,8 @@
|
||||
#include "ui/comboboxex.h"
|
||||
#include "ui/colorbutton.h"
|
||||
#include "ui/fontcombobox.h"
|
||||
#include "dialogs/texteditdialog.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
TextEffect::TextEffect(Clip *c, const EffectMeta* em) :
|
||||
Effect(c, em)
|
||||
@@ -26,46 +29,49 @@ TextEffect::TextEffect(Clip *c, const EffectMeta* em) :
|
||||
enable_superimpose = true;
|
||||
//enable_shader = true;
|
||||
|
||||
text_val = add_row("Text")->add_field(EFFECT_FIELD_STRING, "text", 2);
|
||||
text_val = add_row(tr("Text"))->add_field(EFFECT_FIELD_STRING, "text", 2);
|
||||
QTextEdit* text_widget = static_cast<QTextEdit*>(text_val->ui_element);
|
||||
text_widget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(text_widget, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(text_edit_menu()));
|
||||
|
||||
set_font_combobox = add_row("Font")->add_field(EFFECT_FIELD_FONT, "font", 2);
|
||||
set_font_combobox = add_row(tr("Font"))->add_field(EFFECT_FIELD_FONT, "font", 2);
|
||||
|
||||
size_val = add_row("Size")->add_field(EFFECT_FIELD_DOUBLE, "size", 2);
|
||||
size_val = add_row(tr("Size"))->add_field(EFFECT_FIELD_DOUBLE, "size", 2);
|
||||
size_val->set_double_minimum_value(0);
|
||||
|
||||
set_color_button = add_row("Color")->add_field(EFFECT_FIELD_COLOR, "color", 2);
|
||||
set_color_button = add_row(tr("Color"))->add_field(EFFECT_FIELD_COLOR, "color", 2);
|
||||
|
||||
EffectRow* alignment_row = add_row("Alignment");
|
||||
EffectRow* alignment_row = add_row(tr("Alignment"));
|
||||
halign_field = alignment_row->add_field(EFFECT_FIELD_COMBO, "halign");
|
||||
halign_field->add_combo_item("Left", Qt::AlignLeft);
|
||||
halign_field->add_combo_item("Center", Qt::AlignHCenter);
|
||||
halign_field->add_combo_item("Right", Qt::AlignRight);
|
||||
halign_field->add_combo_item("Justify", Qt::AlignJustify);
|
||||
halign_field->add_combo_item(tr("Left"), Qt::AlignLeft);
|
||||
halign_field->add_combo_item(tr("Center"), Qt::AlignHCenter);
|
||||
halign_field->add_combo_item(tr("Right"), Qt::AlignRight);
|
||||
halign_field->add_combo_item(tr("Justify"), Qt::AlignJustify);
|
||||
|
||||
valign_field = alignment_row->add_field(EFFECT_FIELD_COMBO, "valign");
|
||||
valign_field->add_combo_item("Top", Qt::AlignTop);
|
||||
valign_field->add_combo_item("Center", Qt::AlignVCenter);
|
||||
valign_field->add_combo_item("Bottom", Qt::AlignBottom);
|
||||
valign_field->add_combo_item(tr("Top"), Qt::AlignTop);
|
||||
valign_field->add_combo_item(tr("Center"), Qt::AlignVCenter);
|
||||
valign_field->add_combo_item(tr("Bottom"), Qt::AlignBottom);
|
||||
|
||||
word_wrap_field = add_row("Word Wrap")->add_field(EFFECT_FIELD_BOOL, "wordwrap", 2);
|
||||
word_wrap_field = add_row(tr("Word Wrap"))->add_field(EFFECT_FIELD_BOOL, "wordwrap", 2);
|
||||
|
||||
outline_bool = add_row("Outline")->add_field(EFFECT_FIELD_BOOL, "outline", 2);
|
||||
outline_color = add_row("Outline Color")->add_field(EFFECT_FIELD_COLOR, "outlinecolor", 2);
|
||||
outline_width = add_row("Outline Width")->add_field(EFFECT_FIELD_DOUBLE, "outlinewidth", 2);
|
||||
outline_bool = add_row(tr("Outline"))->add_field(EFFECT_FIELD_BOOL, "outline", 2);
|
||||
outline_color = add_row(tr("Outline Color"))->add_field(EFFECT_FIELD_COLOR, "outlinecolor", 2);
|
||||
outline_width = add_row(tr("Outline Width"))->add_field(EFFECT_FIELD_DOUBLE, "outlinewidth", 2);
|
||||
outline_width->set_double_minimum_value(0);
|
||||
|
||||
shadow_bool = add_row("Shadow")->add_field(EFFECT_FIELD_BOOL, "shadow", 2);
|
||||
shadow_color = add_row("Shadow Color")->add_field(EFFECT_FIELD_COLOR, "shadowcolor", 2);
|
||||
shadow_distance = add_row("Shadow Distance")->add_field(EFFECT_FIELD_DOUBLE, "shadowdistance", 2);
|
||||
shadow_bool = add_row(tr("Shadow"))->add_field(EFFECT_FIELD_BOOL, "shadow", 2);
|
||||
shadow_color = add_row(tr("Shadow Color"))->add_field(EFFECT_FIELD_COLOR, "shadowcolor", 2);
|
||||
shadow_distance = add_row(tr("Shadow Distance"))->add_field(EFFECT_FIELD_DOUBLE, "shadowdistance", 2);
|
||||
shadow_distance->set_double_minimum_value(0);
|
||||
shadow_softness = add_row("Shadow Softness")->add_field(EFFECT_FIELD_DOUBLE, "shadowsoftness", 2);
|
||||
shadow_softness = add_row(tr("Shadow Softness"))->add_field(EFFECT_FIELD_DOUBLE, "shadowsoftness", 2);
|
||||
shadow_softness->set_double_minimum_value(0);
|
||||
shadow_opacity = add_row("Shadow Opacity")->add_field(EFFECT_FIELD_DOUBLE, "shadowopacity", 2);
|
||||
shadow_opacity = add_row(tr("Shadow Opacity"))->add_field(EFFECT_FIELD_DOUBLE, "shadowopacity", 2);
|
||||
shadow_opacity->set_double_minimum_value(0);
|
||||
shadow_opacity->set_double_maximum_value(100);
|
||||
|
||||
size_val->set_double_default_value(48);
|
||||
text_val->set_string_value("Sample Text");
|
||||
text_val->set_string_value(tr("Sample Text"));
|
||||
halign_field->set_combo_index(1);
|
||||
valign_field->set_combo_index(1);
|
||||
word_wrap_field->set_bool_value(true);
|
||||
@@ -136,7 +142,6 @@ void TextEffect::redraw(double timecode) {
|
||||
|
||||
switch (halign_field->get_combo_data(timecode).toInt()) {
|
||||
case Qt::AlignLeft: text_x = 0; break;
|
||||
case Qt::AlignHCenter: text_x = (width/2) - (fm.width(lines.at(i))/2); break;
|
||||
case Qt::AlignRight: text_x = width - fm.width(lines.at(i)); break;
|
||||
case Qt::AlignJustify:
|
||||
// add spaces until the string is too big
|
||||
@@ -161,12 +166,23 @@ void TextEffect::redraw(double timecode) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Qt::AlignHCenter:
|
||||
default:
|
||||
text_x = (width/2) - (fm.width(lines.at(i))/2);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (valign_field->get_combo_data(timecode).toInt()) {
|
||||
case Qt::AlignTop: text_y = (fm.height()*i)+fm.ascent(); break;
|
||||
case Qt::AlignVCenter: text_y = ((height/2) - (text_height/2) - fm.descent()) + (fm.height()*(i+1)); break;
|
||||
case Qt::AlignBottom: text_y = (height - text_height - fm.descent()) + (fm.height()*(i+1)); break;
|
||||
case Qt::AlignTop:
|
||||
text_y = (fm.height()*i)+fm.ascent();
|
||||
break;
|
||||
case Qt::AlignBottom:
|
||||
text_y = (height - text_height - fm.descent()) + (fm.height()*(i+1));
|
||||
break;
|
||||
case Qt::AlignVCenter:
|
||||
default:
|
||||
text_y = ((height/2) - (text_height/2) - fm.descent()) + (fm.height()*(i+1));
|
||||
break;
|
||||
}
|
||||
|
||||
path.addText(text_x, text_y, font, lines.at(i));
|
||||
@@ -198,6 +214,24 @@ void TextEffect::shadow_enable(bool e) {
|
||||
shadow_opacity->set_enabled(e);
|
||||
}
|
||||
|
||||
void TextEffect::text_edit_menu() {
|
||||
QMenu menu;
|
||||
|
||||
menu.addAction(tr("&Edit Text"), this, SLOT(open_text_edit()));
|
||||
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void TextEffect::open_text_edit() {
|
||||
TextEditDialog ted(mainWindow, text_val->get_current_data().toString());
|
||||
ted.exec();
|
||||
QString result = ted.get_string();
|
||||
if (!result.isEmpty()) {
|
||||
text_val->set_current_data(result);
|
||||
text_val->ui_element_change();
|
||||
}
|
||||
}
|
||||
|
||||
void TextEffect::outline_enable(bool e) {
|
||||
outline_color->set_enabled(e);
|
||||
outline_width->set_enabled(e);
|
||||
|
||||
@@ -33,8 +33,10 @@ public:
|
||||
private slots:
|
||||
void outline_enable(bool);
|
||||
void shadow_enable(bool);
|
||||
void text_edit_menu();
|
||||
void open_text_edit();
|
||||
private:
|
||||
QFont font;
|
||||
QFont font;
|
||||
};
|
||||
|
||||
#endif // TEXTEFFECT_H
|
||||
|
||||
@@ -29,33 +29,33 @@ TimecodeEffect::TimecodeEffect(Clip *c, const EffectMeta* em) :
|
||||
enable_always_update = true;
|
||||
enable_superimpose = true;
|
||||
|
||||
EffectRow* tc_row = add_row("Timecode");
|
||||
EffectRow* tc_row = add_row(tr("Timecode"));
|
||||
tc_select = tc_row->add_field(EFFECT_FIELD_COMBO, "tc_selector");
|
||||
tc_select->add_combo_item("Sequence", true);
|
||||
tc_select->add_combo_item("Media", false);
|
||||
tc_select->add_combo_item(tr("Sequence"), true);
|
||||
tc_select->add_combo_item(tr("Media"), false);
|
||||
tc_select->set_combo_index(0);
|
||||
|
||||
scale_val = add_row("Scale")->add_field(EFFECT_FIELD_DOUBLE, "scale", 2);
|
||||
scale_val = add_row(tr("Scale"))->add_field(EFFECT_FIELD_DOUBLE, "scale", 2);
|
||||
scale_val->set_double_minimum_value(1);
|
||||
scale_val->set_double_default_value(100);
|
||||
scale_val->set_double_maximum_value(1000);
|
||||
|
||||
color_val = add_row("Color")->add_field(EFFECT_FIELD_COLOR, "color", 2);
|
||||
color_val = add_row(tr("Color"))->add_field(EFFECT_FIELD_COLOR, "color", 2);
|
||||
color_val->set_color_value(Qt::white);
|
||||
|
||||
color_bg_val = add_row("Background Color")->add_field(EFFECT_FIELD_COLOR, "bgcolor", 2);
|
||||
color_bg_val = add_row(tr("Background Color"))->add_field(EFFECT_FIELD_COLOR, "bgcolor", 2);
|
||||
color_bg_val->set_color_value(Qt::black);
|
||||
|
||||
bg_alpha = add_row("Background Opacity")->add_field(EFFECT_FIELD_DOUBLE, "bgalpha", 2);
|
||||
bg_alpha = add_row(tr("Background Opacity"))->add_field(EFFECT_FIELD_DOUBLE, "bgalpha", 2);
|
||||
bg_alpha->set_double_minimum_value(0);
|
||||
bg_alpha->set_double_maximum_value(100);
|
||||
bg_alpha->set_double_default_value(50);
|
||||
|
||||
EffectRow* offset = add_row("Offset");
|
||||
EffectRow* offset = add_row(tr("Offset"));
|
||||
offset_x_val = offset->add_field(EFFECT_FIELD_DOUBLE, "offsetx");
|
||||
offset_y_val = offset->add_field(EFFECT_FIELD_DOUBLE, "offsety");
|
||||
|
||||
prepend_text = add_row("Prepend")->add_field(EFFECT_FIELD_STRING, "prepend", 2);
|
||||
prepend_text = add_row(tr("Prepend"))->add_field(EFFECT_FIELD_STRING, "prepend", 2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,20 +9,20 @@
|
||||
#include "debug.h"
|
||||
|
||||
ToneEffect::ToneEffect(Clip* c, const EffectMeta *em) : Effect(c, em), sinX(INT_MIN) {
|
||||
type_val = add_row("Type")->add_field(EFFECT_FIELD_COMBO, "type");
|
||||
type_val = add_row(tr("Type"))->add_field(EFFECT_FIELD_COMBO, "type");
|
||||
type_val->add_combo_item("Sine", TONE_TYPE_SINE);
|
||||
|
||||
freq_val = add_row("Frequency")->add_field(EFFECT_FIELD_DOUBLE, "frequency");
|
||||
freq_val = add_row(tr("Frequency"))->add_field(EFFECT_FIELD_DOUBLE, "frequency");
|
||||
freq_val->set_double_minimum_value(20);
|
||||
freq_val->set_double_maximum_value(20000);
|
||||
freq_val->set_double_default_value(1000);
|
||||
|
||||
amount_val = add_row("Amount")->add_field(EFFECT_FIELD_DOUBLE, "amount");
|
||||
amount_val = add_row(tr("Amount"))->add_field(EFFECT_FIELD_DOUBLE, "amount");
|
||||
amount_val->set_double_minimum_value(0);
|
||||
amount_val->set_double_maximum_value(100);
|
||||
amount_val->set_double_default_value(25);
|
||||
|
||||
mix_val = add_row("Mix")->add_field(EFFECT_FIELD_BOOL, "mix");
|
||||
mix_val = add_row(tr("Mix"))->add_field(EFFECT_FIELD_BOOL, "mix");
|
||||
mix_val->set_bool_value(true);
|
||||
}
|
||||
|
||||
@@ -31,26 +31,22 @@ void ToneEffect::process_audio(double timecode_start, double timecode_end, quint
|
||||
for (int i=0;i<nb_bytes;i+=4) {
|
||||
double timecode = timecode_start+(interval*i);
|
||||
|
||||
qint16 left_tone_sample = qSin((2*M_PI*sinX*freq_val->get_double_value(timecode, true))/parent_clip->sequence->audio_frequency)*log_volume(amount_val->get_double_value(timecode, true)*0.01)*INT16_MAX;
|
||||
qint16 left_tone_sample = qint16(qRound(qSin((2*M_PI*sinX*freq_val->get_double_value(timecode, true))/parent_clip->sequence->audio_frequency)*log_volume(amount_val->get_double_value(timecode, true)*0.01)*INT16_MAX));
|
||||
qint16 right_tone_sample = left_tone_sample;
|
||||
|
||||
// mix with source audio
|
||||
if (mix_val->get_bool_value(timecode, true)) {
|
||||
qint16 left_sample = (qint16) (((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
||||
qint16 right_sample = (qint16) (((samples[i+3] & 0xFF) << 8) | (samples[i+2] & 0xFF));
|
||||
qint16 left_sample = qint16(((samples[i+1] & 0xFF) << 8) | (samples[i] & 0xFF));
|
||||
qint16 right_sample = qint16(((samples[i+3] & 0xFF) << 8) | (samples[i+2] & 0xFF));
|
||||
left_tone_sample = mix_audio_sample(left_tone_sample, left_sample);
|
||||
right_tone_sample = mix_audio_sample(right_tone_sample, right_sample);
|
||||
}
|
||||
|
||||
samples[i+3] = (quint8) (right_tone_sample >> 8);
|
||||
samples[i+2] = (quint8) right_tone_sample;
|
||||
samples[i+1] = (quint8) (left_tone_sample >> 8);
|
||||
samples[i] = (quint8) left_tone_sample;
|
||||
samples[i+3] = quint8(right_tone_sample >> 8);
|
||||
samples[i+2] = quint8(right_tone_sample);
|
||||
samples[i+1] = quint8(left_tone_sample >> 8);
|
||||
samples[i] = quint8(left_tone_sample);
|
||||
|
||||
int presin = sinX;
|
||||
sinX++;
|
||||
if (sinX < presin) {
|
||||
dout << "[WARNING] Tone effect overflowed";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@
|
||||
TransformEffect::TransformEffect(Clip* c, const EffectMeta* em) : Effect(c, em) {
|
||||
enable_coords = true;
|
||||
|
||||
EffectRow* position_row = add_row("Position");
|
||||
EffectRow* position_row = add_row(tr("Position"));
|
||||
position_x = position_row->add_field(EFFECT_FIELD_DOUBLE, "posx"); // position X
|
||||
position_y = position_row->add_field(EFFECT_FIELD_DOUBLE, "posy"); // position Y
|
||||
|
||||
EffectRow* scale_row = add_row("Scale");
|
||||
EffectRow* scale_row = add_row(tr("Scale"));
|
||||
scale_x = scale_row->add_field(EFFECT_FIELD_DOUBLE, "scalex"); // scale X (and Y is uniform scale is selected)
|
||||
scale_x->set_double_minimum_value(0);
|
||||
scale_x->set_double_maximum_value(3000);
|
||||
@@ -43,27 +43,27 @@ TransformEffect::TransformEffect(Clip* c, const EffectMeta* em) : Effect(c, em)
|
||||
scale_y->set_double_minimum_value(0);
|
||||
scale_y->set_double_maximum_value(3000);
|
||||
|
||||
EffectRow* uniform_scale_row = add_row("Uniform Scale");
|
||||
EffectRow* uniform_scale_row = add_row(tr("Uniform Scale"));
|
||||
uniform_scale_field = uniform_scale_row->add_field(EFFECT_FIELD_BOOL, "uniformscale"); // uniform scale option
|
||||
|
||||
EffectRow* rotation_row = add_row("Rotation");
|
||||
EffectRow* rotation_row = add_row(tr("Rotation"));
|
||||
rotation = rotation_row->add_field(EFFECT_FIELD_DOUBLE, "rotation");
|
||||
|
||||
EffectRow* anchor_point_row = add_row("Anchor Point");
|
||||
EffectRow* anchor_point_row = add_row(tr("Anchor Point"));
|
||||
anchor_x_box = anchor_point_row->add_field(EFFECT_FIELD_DOUBLE, "anchorx"); // anchor point X
|
||||
anchor_y_box = anchor_point_row->add_field(EFFECT_FIELD_DOUBLE, "anchory"); // anchor point Y
|
||||
|
||||
EffectRow* opacity_row = add_row("Opacity");
|
||||
EffectRow* opacity_row = add_row(tr("Opacity"));
|
||||
opacity = opacity_row->add_field(EFFECT_FIELD_DOUBLE, "opacity"); // opacity
|
||||
opacity->set_double_minimum_value(0);
|
||||
opacity->set_double_maximum_value(100);
|
||||
|
||||
EffectRow* blend_mode_row = add_row("Blend Mode");
|
||||
EffectRow* blend_mode_row = add_row(tr("Blend Mode"));
|
||||
blend_mode_box = blend_mode_row->add_field(EFFECT_FIELD_COMBO, "blendmode"); // blend mode
|
||||
blend_mode_box->add_combo_item("Normal", BLEND_MODE_NORMAL);
|
||||
blend_mode_box->add_combo_item("Overlay", BLEND_MODE_OVERLAY);
|
||||
blend_mode_box->add_combo_item("Screen", BLEND_MODE_SCREEN);
|
||||
blend_mode_box->add_combo_item("Multiply", BLEND_MODE_MULTIPLY);
|
||||
blend_mode_box->add_combo_item(tr("Normal"), BLEND_MODE_NORMAL);
|
||||
blend_mode_box->add_combo_item(tr("Overlay"), BLEND_MODE_OVERLAY);
|
||||
blend_mode_box->add_combo_item(tr("Screen"), BLEND_MODE_SCREEN);
|
||||
blend_mode_box->add_combo_item(tr("Multiply"), BLEND_MODE_MULTIPLY);
|
||||
|
||||
// set up gizmos
|
||||
top_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
@@ -134,7 +134,7 @@ void adjust_field(EffectField* field, double old_offset, double new_offset) {
|
||||
}
|
||||
|
||||
void TransformEffect::refresh() {
|
||||
if (parent_clip != NULL && parent_clip->sequence != NULL) {
|
||||
if (parent_clip != nullptr && parent_clip->sequence != nullptr) {
|
||||
double new_default_pos_x = parent_clip->sequence->width/2;
|
||||
double new_default_pos_y = parent_clip->sequence->height/2;
|
||||
|
||||
@@ -180,13 +180,13 @@ void TransformEffect::toggle_uniform_scale(bool enabled) {
|
||||
|
||||
top_center_gizmo->y_field1 = enabled ? scale_x : scale_y;
|
||||
bottom_center_gizmo->y_field1 = enabled ? scale_x : scale_y;
|
||||
top_left_gizmo->y_field1 = enabled ? NULL : scale_y;
|
||||
top_right_gizmo->y_field1 = enabled ? NULL : scale_y;
|
||||
bottom_left_gizmo->y_field1 = enabled ? NULL : scale_y;
|
||||
bottom_right_gizmo->y_field1 = enabled ? NULL : scale_y;
|
||||
top_left_gizmo->y_field1 = enabled ? nullptr : scale_y;
|
||||
top_right_gizmo->y_field1 = enabled ? nullptr : scale_y;
|
||||
bottom_left_gizmo->y_field1 = enabled ? nullptr : scale_y;
|
||||
bottom_right_gizmo->y_field1 = enabled ? nullptr : scale_y;
|
||||
}
|
||||
|
||||
void TransformEffect::process_coords(double timecode, GLTextureCoords& coords, int data) {
|
||||
void TransformEffect::process_coords(double timecode, GLTextureCoords& coords, int) {
|
||||
// position
|
||||
glTranslatef(position_x->get_double_value(timecode)-(parent_clip->sequence->width/2), position_y->get_double_value(timecode)-(parent_clip->sequence->height/2), 0);
|
||||
|
||||
@@ -225,7 +225,7 @@ void TransformEffect::process_coords(double timecode, GLTextureCoords& coords, i
|
||||
glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA);
|
||||
break;
|
||||
default:
|
||||
dout << "[ERROR] Invalid blend mode. This is a bug - please contact developers";
|
||||
qCritical() << "Invalid blend mode. This is a bug - please contact developers";
|
||||
}
|
||||
|
||||
// opacity
|
||||
@@ -234,7 +234,7 @@ void TransformEffect::process_coords(double timecode, GLTextureCoords& coords, i
|
||||
glColor4f(1.0, 1.0, 1.0, color[3]*(opacity->get_double_value(timecode)*0.01));
|
||||
}
|
||||
|
||||
void TransformEffect::gizmo_draw(double timecode, GLTextureCoords& coords) {
|
||||
void TransformEffect::gizmo_draw(double, GLTextureCoords& coords) {
|
||||
top_left_gizmo->world_pos[0] = QPoint(coords.vertexTopLeftX, coords.vertexTopLeftY);
|
||||
top_center_gizmo->world_pos[0] = QPoint(lerp(coords.vertexTopLeftX, coords.vertexTopRightX, 0.5), lerp(coords.vertexTopLeftY, coords.vertexTopRightY, 0.5));
|
||||
top_right_gizmo->world_pos[0] = QPoint(coords.vertexTopRightX, coords.vertexTopRightY);
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
#include "ui/collapsiblewidget.h"
|
||||
#include "debug.h"
|
||||
|
||||
VoidEffect::VoidEffect(Clip *c, const QString& n) : Effect(c, NULL) {
|
||||
VoidEffect::VoidEffect(Clip *c, const QString& n) : Effect(c, nullptr) {
|
||||
name = n;
|
||||
QString display_name;
|
||||
if (n.isEmpty()) {
|
||||
display_name = "(unknown)";
|
||||
display_name = tr("(unknown)");
|
||||
} else {
|
||||
display_name = n;
|
||||
}
|
||||
EffectRow* row = add_row("Missing Effect", false, false);
|
||||
EffectRow* row = add_row(tr("Missing Effect"), false, false);
|
||||
row->add_widget(new QLabel(display_name));
|
||||
container->setText(display_name);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "ui/collapsiblewidget.h"
|
||||
|
||||
VolumeEffect::VolumeEffect(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
EffectRow* volume_row = add_row("Volume");
|
||||
EffectRow* volume_row = add_row(tr("Volume"));
|
||||
volume_val = volume_row->add_field(EFFECT_FIELD_DOUBLE, "volume");
|
||||
volume_val->set_double_minimum_value(0);
|
||||
|
||||
|
||||
@@ -20,15 +20,13 @@
|
||||
// C callbacks
|
||||
extern "C" {
|
||||
// Main host callback
|
||||
VstIntPtr VSTCALLBACK hostCallback(AEffect *effect, int opcode, int index, long long value, void *ptr, float opt) {
|
||||
VstIntPtr VSTCALLBACK hostCallback(AEffect *effect, int opcode, int, long long, void *, float) {
|
||||
switch(opcode) {
|
||||
case audioMasterVersion:
|
||||
return 2400;
|
||||
case audioMasterIdle:
|
||||
effect->dispatcher(effect, effEditIdle, 0, 0, 0, 0);
|
||||
effect->dispatcher(effect, effEditIdle, 0, 0, nullptr, 0);
|
||||
break;
|
||||
case 6: // audioMasterWantMidi
|
||||
return 0;
|
||||
case audioMasterGetCurrentProcessLevel:
|
||||
return 0;
|
||||
// Handle other opcodes here... there will be lots of them
|
||||
@@ -36,9 +34,10 @@ extern "C" {
|
||||
mainWindow->setWindowModified(true);
|
||||
break;
|
||||
default:
|
||||
dout << "[INFO] Plugin requested unhandled opcode" << opcode;
|
||||
qInfo() << "Plugin requested unhandled opcode" << opcode;
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,32 +57,32 @@ void VSTHostWin::loadPlugin() {
|
||||
LPCWSTR dll_fn_w = reinterpret_cast<const wchar_t*>(dll_fn.utf16());
|
||||
|
||||
modulePtr = LoadLibrary(dll_fn_w);
|
||||
if(modulePtr == NULL) {
|
||||
if(modulePtr == nullptr) {
|
||||
DWORD dll_err = GetLastError();
|
||||
dout << "[ERROR] Failed to load VST" << dll_fn_w << "-" << dll_err;
|
||||
QString msg_err = "Failed to load VST plugin \"" + dll_fn + "\": " + QString::number(dll_err);
|
||||
qCritical() << "Failed to load VST" << dll_fn_w << "-" << dll_err;
|
||||
QString msg_err = tr("Failed to load VST plugin \"%1\": %2").arg(dll_fn, QString::number(dll_err));
|
||||
if (dll_err == 193) {
|
||||
#ifdef _WIN64
|
||||
msg_err += "\n\nNOTE: You can't load 32-bit VST plugins into a 64-bit build of Olive. Please find a 64-bit version of this plugin or switch to a 32-bit build of Olive.";
|
||||
msg_err += "\n\n" + tr("NOTE: You can't load 32-bit VST plugins into a 64-bit build of Olive. Please find a 64-bit version of this plugin or switch to a 32-bit build of Olive.");
|
||||
#elif _WIN32
|
||||
msg_err += "\n\nNOTE: You can't load 64-bit VST plugins into a 32-bit build of Olive. Please find a 32-bit version of this plugin or switch to a 64-bit build of Olive.";
|
||||
msg_err += "\n\n" + tr("NOTE: You can't load 64-bit VST plugins into a 32-bit build of Olive. Please find a 32-bit version of this plugin or switch to a 64-bit build of Olive.");
|
||||
#endif
|
||||
}
|
||||
QMessageBox::critical(mainWindow, "Error loading VST plugin", msg_err);
|
||||
QMessageBox::critical(mainWindow, tr("Error loading VST plugin"), msg_err);
|
||||
return;
|
||||
}
|
||||
|
||||
vstPluginFuncPtr mainEntryPoint =
|
||||
(vstPluginFuncPtr)GetProcAddress(modulePtr, "VSTPluginMain");
|
||||
reinterpret_cast<vstPluginFuncPtr>(GetProcAddress(modulePtr, "VSTPluginMain"));
|
||||
// Instantiate the plugin
|
||||
plugin = mainEntryPoint(hostCallback);
|
||||
}
|
||||
|
||||
void VSTHostWin::freePlugin() {
|
||||
if (plugin != NULL) {
|
||||
if (plugin != nullptr) {
|
||||
stopPlugin();
|
||||
FreeLibrary(modulePtr);
|
||||
plugin = NULL;
|
||||
plugin = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,28 +91,28 @@ bool VSTHostWin::configurePluginCallbacks() {
|
||||
// If incorrect, then the file either was not loaded properly, is not a
|
||||
// real VST plugin, or is otherwise corrupt.
|
||||
if(plugin->magic != kEffectMagic) {
|
||||
dout << "[ERROR] Plugin's magic number is bad";
|
||||
QMessageBox::critical(mainWindow, "VST Error", "Plugin's magic number is invalid");
|
||||
qCritical() << "Plugin's magic number is bad";
|
||||
QMessageBox::critical(mainWindow, tr("VST Error"), tr("Plugin's magic number is invalid"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Create dispatcher handle
|
||||
dispatcher = (dispatcherFuncPtr)(plugin->dispatcher);
|
||||
dispatcher = reinterpret_cast<dispatcherFuncPtr>(plugin->dispatcher);
|
||||
|
||||
// Set up plugin callback functions
|
||||
plugin->getParameter = (getParameterFuncPtr)plugin->getParameter;
|
||||
plugin->processReplacing = (processFuncPtr)plugin->processReplacing;
|
||||
plugin->setParameter = (setParameterFuncPtr)plugin->setParameter;
|
||||
plugin->getParameter = reinterpret_cast<getParameterFuncPtr>(plugin->getParameter);
|
||||
plugin->processReplacing = reinterpret_cast<processFuncPtr>(plugin->processReplacing);
|
||||
plugin->setParameter = reinterpret_cast<setParameterFuncPtr>(plugin->setParameter);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void VSTHostWin::startPlugin() {
|
||||
dispatcher(plugin, effOpen, 0, 0, NULL, 0.0f);
|
||||
dispatcher(plugin, effOpen, 0, 0, nullptr, 0.0f);
|
||||
|
||||
// Set some default properties
|
||||
dispatcher(plugin, effSetSampleRate, 0, 0, NULL, current_audio_freq());
|
||||
dispatcher(plugin, effSetBlockSize, 0, BLOCK_SIZE, NULL, 0.0f);
|
||||
dispatcher(plugin, effSetSampleRate, 0, 0, nullptr, current_audio_freq());
|
||||
dispatcher(plugin, effSetBlockSize, 0, BLOCK_SIZE, nullptr, 0.0f);
|
||||
|
||||
resumePlugin();
|
||||
}
|
||||
@@ -121,19 +120,19 @@ void VSTHostWin::startPlugin() {
|
||||
void VSTHostWin::stopPlugin() {
|
||||
suspendPlugin();
|
||||
|
||||
dispatcher(plugin, effClose, 0, 0, NULL, 0);
|
||||
dispatcher(plugin, effClose, 0, 0, nullptr, 0);
|
||||
}
|
||||
|
||||
void VSTHostWin::resumePlugin() {
|
||||
dispatcher(plugin, effMainsChanged, 0, 1, NULL, 0.0f);
|
||||
dispatcher(plugin, effMainsChanged, 0, 1, nullptr, 0.0f);
|
||||
}
|
||||
|
||||
void VSTHostWin::suspendPlugin() {
|
||||
dispatcher(plugin, effMainsChanged, 0, 0, NULL, 0.0f);
|
||||
dispatcher(plugin, effMainsChanged, 0, 0, nullptr, 0.0f);
|
||||
}
|
||||
|
||||
bool VSTHostWin::canPluginDo(char *canDoString) {
|
||||
return (dispatcher(plugin, effCanDo, 0, 0, (void*)canDoString, 0.0f) > 0);
|
||||
return (dispatcher(plugin, effCanDo, 0, 0, static_cast<void*>(canDoString), 0.0f) > 0);
|
||||
}
|
||||
|
||||
void VSTHostWin::initializeIO() {
|
||||
@@ -158,22 +157,22 @@ void VSTHostWin::processAudio(long numFrames) {
|
||||
}
|
||||
|
||||
VSTHostWin::VSTHostWin(Clip* c, const EffectMeta *em) : Effect(c, em) {
|
||||
plugin = NULL;
|
||||
plugin = nullptr;
|
||||
|
||||
initializeIO();
|
||||
|
||||
file_field = add_row("Plugin", true, false)->add_field(EFFECT_FIELD_FILE, "filename");
|
||||
file_field = add_row(tr("Plugin"), true, false)->add_field(EFFECT_FIELD_FILE, "filename");
|
||||
connect(file_field, SIGNAL(changed()), this, SLOT(change_plugin()));
|
||||
|
||||
EffectRow* interface_row = add_row("Interface", false, false);
|
||||
show_interface_btn = new QPushButton("Show");
|
||||
EffectRow* interface_row = add_row(tr("Interface"), false, false);
|
||||
show_interface_btn = new QPushButton(tr("Show"));
|
||||
show_interface_btn->setCheckable(true);
|
||||
show_interface_btn->setEnabled(false);
|
||||
connect(show_interface_btn, SIGNAL(toggled(bool)), this, SLOT(show_interface(bool)));
|
||||
interface_row->add_widget(show_interface_btn);
|
||||
|
||||
dialog = new QDialog(mainWindow);
|
||||
dialog->setWindowTitle("VST Plugin");
|
||||
dialog->setWindowTitle(tr("VST Plugin"));
|
||||
dialog->setAttribute(Qt::WA_NativeWindow, true);
|
||||
dialog->setWindowFlags(dialog->windowFlags() | Qt::MSWindowsFixedSizeDialogHint);
|
||||
connect(dialog, SIGNAL(finished(int)), this, SLOT(uncheck_show_button()));
|
||||
@@ -183,8 +182,8 @@ VSTHostWin::~VSTHostWin() {
|
||||
freePlugin();
|
||||
}
|
||||
|
||||
void VSTHostWin::process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int) {
|
||||
if (plugin != NULL) {
|
||||
void VSTHostWin::process_audio(double, double, quint8* samples, int nb_bytes, int) {
|
||||
if (plugin != nullptr) {
|
||||
int interval = BLOCK_SIZE*4;
|
||||
for (int i=0;i<nb_bytes;i+=interval) {
|
||||
int process_size = qMin(interval, nb_bytes - i);
|
||||
@@ -192,8 +191,8 @@ void VSTHostWin::process_audio(double timecode_start, double timecode_end, quint
|
||||
|
||||
// convert to float
|
||||
for (int j=i;j<lim;j+=4) {
|
||||
qint16 left_sample = (qint16) (((samples[j+1] & 0xFF) << 8) | (samples[j] & 0xFF));
|
||||
qint16 right_sample = (qint16) (((samples[j+3] & 0xFF) << 8) | (samples[j+2] & 0xFF));
|
||||
qint16 left_sample = qint16(((samples[j+1] & 0xFF) << 8) | (samples[j] & 0xFF));
|
||||
qint16 right_sample = qint16(((samples[j+3] & 0xFF) << 8) | (samples[j+2] & 0xFF));
|
||||
|
||||
int index = (j-i)>>2;
|
||||
inputs[0][index] = float(left_sample) / float(INT16_MAX);
|
||||
@@ -207,13 +206,13 @@ void VSTHostWin::process_audio(double timecode_start, double timecode_end, quint
|
||||
for (int j=i;j<lim;j+=4) {
|
||||
int index = (j-i)>>2;
|
||||
|
||||
qint16 left_sample = qRound(outputs[0][index] * INT16_MAX);
|
||||
qint16 right_sample = qRound(outputs[1][index] * INT16_MAX);
|
||||
qint16 left_sample = qint16(qRound(outputs[0][index] * INT16_MAX));
|
||||
qint16 right_sample = qint16(qRound(outputs[1][index] * INT16_MAX));
|
||||
|
||||
samples[j+3] = (quint8) (right_sample >> 8);
|
||||
samples[j+2] = (quint8) right_sample;
|
||||
samples[j+1] = (quint8) (left_sample >> 8);
|
||||
samples[j] = (quint8) left_sample;
|
||||
samples[j+3] = quint8(right_sample >> 8);
|
||||
samples[j+2] = quint8(right_sample);
|
||||
samples[j+1] = quint8(left_sample >> 8);
|
||||
samples[j] = quint8(left_sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,18 +222,17 @@ void VSTHostWin::custom_load(QXmlStreamReader &stream) {
|
||||
if (stream.name() == "plugindata") {
|
||||
stream.readNext();
|
||||
QByteArray b = QByteArray::fromBase64(stream.text().toUtf8());
|
||||
const char* data = b.constData();
|
||||
if (plugin != NULL) {
|
||||
dispatcher(plugin, effSetChunk, 0, (VstInt32) b.size(), (void*) b.constData(), 0);
|
||||
if (plugin != nullptr) {
|
||||
dispatcher(plugin, effSetChunk, 0, VstInt32(b.size()), static_cast<void*>(b.data()), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VSTHostWin::save(QXmlStreamWriter &stream) {
|
||||
Effect::save(stream);
|
||||
if (plugin != NULL) {
|
||||
char* p = NULL;
|
||||
VstInt32 length = dispatcher(plugin, effGetChunk, 0, 0, &p, 0);
|
||||
if (plugin != nullptr) {
|
||||
char* p = nullptr;
|
||||
VstInt32 length = VstInt32(dispatcher(plugin, effGetChunk, 0, 0, &p, 0));
|
||||
QByteArray b(p, length);
|
||||
stream.writeTextElement("plugindata", b.toBase64());
|
||||
}
|
||||
@@ -251,18 +249,18 @@ void VSTHostWin::uncheck_show_button() {
|
||||
void VSTHostWin::change_plugin() {
|
||||
freePlugin();
|
||||
loadPlugin();
|
||||
if (plugin != NULL) {
|
||||
if (plugin != nullptr) {
|
||||
if (configurePluginCallbacks()) {
|
||||
startPlugin();
|
||||
dispatcher(plugin, effEditOpen, 0, 0, reinterpret_cast<HWND>(dialog->winId()), 0);
|
||||
ERect* eRect = NULL;
|
||||
ERect* eRect = nullptr;
|
||||
plugin->dispatcher(plugin, effEditGetRect, 0, 0, &eRect, 0);
|
||||
dialog->setFixedWidth(eRect->right);
|
||||
dialog->setFixedHeight(eRect->bottom);
|
||||
} else {
|
||||
FreeLibrary(modulePtr);
|
||||
plugin = NULL;
|
||||
plugin = nullptr;
|
||||
}
|
||||
}
|
||||
show_interface_btn->setEnabled(plugin != NULL);
|
||||
show_interface_btn->setEnabled(plugin != nullptr);
|
||||
}
|
||||
|
||||
+75
-74
@@ -1,74 +1,75 @@
|
||||
<RCC>
|
||||
<qresource prefix="/icons">
|
||||
<file>play.png</file>
|
||||
<file>ff.png</file>
|
||||
<file>next.png</file>
|
||||
<file>pause.png</file>
|
||||
<file>prev.png</file>
|
||||
<file>rew.png</file>
|
||||
<file>arrow.png</file>
|
||||
<file>beam.png</file>
|
||||
<file>razor.png</file>
|
||||
<file>audiosource.png</file>
|
||||
<file>videosource.png</file>
|
||||
<file>imagesource.png</file>
|
||||
<file>ripple.png</file>
|
||||
<file>rolling.png</file>
|
||||
<file>slip.png</file>
|
||||
<file>ff-disabled.png</file>
|
||||
<file>next-disabled.png</file>
|
||||
<file>pause-disabled.png</file>
|
||||
<file>play-disabled.png</file>
|
||||
<file>prev-disabled.png</file>
|
||||
<file>rew-disabled.png</file>
|
||||
<file>arrow-disabled.png</file>
|
||||
<file>beam-disabled.png</file>
|
||||
<file>razor-disabled.png</file>
|
||||
<file>ripple-disabled.png</file>
|
||||
<file>rolling-disabled.png</file>
|
||||
<file>slip-disabled.png</file>
|
||||
<file>slide.png</file>
|
||||
<file>slide-disabled.png</file>
|
||||
<file>throbber.png</file>
|
||||
<file>magnet.png</file>
|
||||
<file>magnet-disabled.png</file>
|
||||
<file>zoomin.png</file>
|
||||
<file>zoomin-disabled.png</file>
|
||||
<file>zoomout.png</file>
|
||||
<file>zoomout-disabled.png</file>
|
||||
<file>add-transition.png</file>
|
||||
<file>add-effect.png</file>
|
||||
<file>olive-splash.png</file>
|
||||
<file>add-button.png</file>
|
||||
<file>add-button-disabled.png</file>
|
||||
<file>clock.png</file>
|
||||
<file>sequence.png</file>
|
||||
<file>folder.png</file>
|
||||
<file>record.png</file>
|
||||
<file>record-disabled.png</file>
|
||||
<file>transition-tool.png</file>
|
||||
<file>transition-tool-disabled.png</file>
|
||||
<file>error.png</file>
|
||||
<file>dirup.png</file>
|
||||
<file>dirup-disabled.png</file>
|
||||
<file>diamond.png</file>
|
||||
<file>tri-down.png</file>
|
||||
<file>tri-left.png</file>
|
||||
<file>tri-right.png</file>
|
||||
<file>tri-up.png</file>
|
||||
<file>hand.png</file>
|
||||
<file>hand-disabled.png</file>
|
||||
<file>treeview.png</file>
|
||||
<file>treeview-disabled.png</file>
|
||||
<file>iconview.png</file>
|
||||
<file>iconview-disabled.png</file>
|
||||
<file>open.png</file>
|
||||
<file>open-disabled.png</file>
|
||||
<file>save.png</file>
|
||||
<file>save-disabled.png</file>
|
||||
<file>undo.png</file>
|
||||
<file>undo-disabled.png</file>
|
||||
<file>redo.png</file>
|
||||
<file>redo-disabled.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
<RCC>
|
||||
<qresource prefix="/icons">
|
||||
<file>play.png</file>
|
||||
<file>ff.png</file>
|
||||
<file>next.png</file>
|
||||
<file>pause.png</file>
|
||||
<file>prev.png</file>
|
||||
<file>rew.png</file>
|
||||
<file>arrow.png</file>
|
||||
<file>beam.png</file>
|
||||
<file>razor.png</file>
|
||||
<file>audiosource.png</file>
|
||||
<file>videosource.png</file>
|
||||
<file>imagesource.png</file>
|
||||
<file>ripple.png</file>
|
||||
<file>rolling.png</file>
|
||||
<file>slip.png</file>
|
||||
<file>ff-disabled.png</file>
|
||||
<file>next-disabled.png</file>
|
||||
<file>pause-disabled.png</file>
|
||||
<file>play-disabled.png</file>
|
||||
<file>prev-disabled.png</file>
|
||||
<file>rew-disabled.png</file>
|
||||
<file>arrow-disabled.png</file>
|
||||
<file>beam-disabled.png</file>
|
||||
<file>razor-disabled.png</file>
|
||||
<file>ripple-disabled.png</file>
|
||||
<file>rolling-disabled.png</file>
|
||||
<file>slip-disabled.png</file>
|
||||
<file>slide.png</file>
|
||||
<file>slide-disabled.png</file>
|
||||
<file>throbber.png</file>
|
||||
<file>magnet.png</file>
|
||||
<file>magnet-disabled.png</file>
|
||||
<file>zoomin.png</file>
|
||||
<file>zoomin-disabled.png</file>
|
||||
<file>zoomout.png</file>
|
||||
<file>zoomout-disabled.png</file>
|
||||
<file>add-transition.png</file>
|
||||
<file>add-effect.png</file>
|
||||
<file>olive-splash.png</file>
|
||||
<file>add-button.png</file>
|
||||
<file>add-button-disabled.png</file>
|
||||
<file>clock.png</file>
|
||||
<file>sequence.png</file>
|
||||
<file>folder.png</file>
|
||||
<file>record.png</file>
|
||||
<file>record-disabled.png</file>
|
||||
<file>transition-tool.png</file>
|
||||
<file>transition-tool-disabled.png</file>
|
||||
<file>error.png</file>
|
||||
<file>dirup.png</file>
|
||||
<file>dirup-disabled.png</file>
|
||||
<file>diamond.png</file>
|
||||
<file>tri-down.png</file>
|
||||
<file>tri-left.png</file>
|
||||
<file>tri-right.png</file>
|
||||
<file>tri-up.png</file>
|
||||
<file>hand.png</file>
|
||||
<file>hand-disabled.png</file>
|
||||
<file>treeview.png</file>
|
||||
<file>treeview-disabled.png</file>
|
||||
<file>iconview.png</file>
|
||||
<file>iconview-disabled.png</file>
|
||||
<file>open.png</file>
|
||||
<file>open-disabled.png</file>
|
||||
<file>save.png</file>
|
||||
<file>save-disabled.png</file>
|
||||
<file>undo.png</file>
|
||||
<file>undo-disabled.png</file>
|
||||
<file>redo.png</file>
|
||||
<file>redo-disabled.png</file>
|
||||
<file>olive64.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.2 KiB |
+5
-2
@@ -2,20 +2,23 @@
|
||||
|
||||
#include "project/clip.h"
|
||||
#include "project/effect.h"
|
||||
#include "project/transition.h"
|
||||
|
||||
int clipboard_type = CLIPBOARD_TYPE_CLIP;
|
||||
QVector<void*> clipboard;
|
||||
QVector<Transition*> clipboard_transitions;
|
||||
|
||||
void clear_clipboard() {
|
||||
for (int i=0;i<clipboard.size();i++) {
|
||||
int clipboard_size = clipboard.size();
|
||||
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++) {
|
||||
clipboard_size = clipboard_transitions.size();
|
||||
for (int i=0;i<clipboard_size;i++) {
|
||||
delete clipboard_transitions.at(i);
|
||||
}
|
||||
clipboard.clear();
|
||||
|
||||
+21
-12
@@ -43,9 +43,10 @@ Config::Config()
|
||||
previous_queue_size(3),
|
||||
previous_queue_type(FRAME_QUEUE_TYPE_FRAMES),
|
||||
upcoming_queue_size(0.5),
|
||||
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS),
|
||||
loop(true),
|
||||
pause_at_out_point(true)
|
||||
upcoming_queue_type(FRAME_QUEUE_TYPE_SECONDS),
|
||||
loop(true),
|
||||
pause_at_out_point(true),
|
||||
seek_also_selects(false)
|
||||
{}
|
||||
|
||||
void Config::load(QString path) {
|
||||
@@ -152,17 +153,23 @@ void Config::load(QString path) {
|
||||
} else if (stream.name() == "UpcomingFrameQueueType") {
|
||||
stream.readNext();
|
||||
upcoming_queue_type = stream.text().toInt();
|
||||
} else if (stream.name() == "Loop") {
|
||||
} else if (stream.name() == "Loop") {
|
||||
stream.readNext();
|
||||
loop = (stream.text() == "1");
|
||||
} else if (stream.name() == "PauseAtOutPoint") {
|
||||
stream.readNext();
|
||||
pause_at_out_point = (stream.text() == "1");
|
||||
} else if (stream.name() == "SeekAlsoSelects") {
|
||||
stream.readNext();
|
||||
seek_also_selects = (stream.text() == "1");
|
||||
} else if (stream.name() == "CSSPath") {
|
||||
stream.readNext();
|
||||
loop = (stream.text() == "1");
|
||||
} else if (stream.name() == "PauseAtOutPoint") {
|
||||
stream.readNext();
|
||||
pause_at_out_point = (stream.text() == "1");
|
||||
css_path = stream.text().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stream.hasError()) {
|
||||
dout << "[ERROR] Error parsing config XML." << stream.errorString();
|
||||
qCritical() << "Error parsing config XML." << stream.errorString();
|
||||
}
|
||||
|
||||
f.close();
|
||||
@@ -172,7 +179,7 @@ void Config::load(QString path) {
|
||||
void Config::save(QString path) {
|
||||
QFile f(path);
|
||||
if (!f.open(QIODevice::WriteOnly)) {
|
||||
dout << "[ERROR] Could not save configuration";
|
||||
qCritical() << "Could not save configuration";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -214,8 +221,10 @@ void Config::save(QString path) {
|
||||
stream.writeTextElement("PreviousFrameQueueType", QString::number(previous_queue_type));
|
||||
stream.writeTextElement("UpcomingFrameQueueSize", QString::number(upcoming_queue_size));
|
||||
stream.writeTextElement("UpcomingFrameQueueType", QString::number(upcoming_queue_type));
|
||||
stream.writeTextElement("Loop", QString::number(loop));
|
||||
stream.writeTextElement("PauseAtOutPoint", QString::number(pause_at_out_point));
|
||||
stream.writeTextElement("Loop", QString::number(loop));
|
||||
stream.writeTextElement("PauseAtOutPoint", QString::number(pause_at_out_point));
|
||||
stream.writeTextElement("SeekAlsoSelects", QString::number(seek_also_selects));
|
||||
stream.writeTextElement("CSSPath", css_path);
|
||||
|
||||
stream.writeEndElement(); // configuration
|
||||
stream.writeEndDocument(); // doc
|
||||
|
||||
@@ -60,6 +60,8 @@ struct Config {
|
||||
int upcoming_queue_type;
|
||||
bool loop;
|
||||
bool pause_at_out_point;
|
||||
bool seek_also_selects;
|
||||
QString css_path;
|
||||
|
||||
void load(QString path);
|
||||
void save(QString path);
|
||||
|
||||
+88
-85
@@ -27,29 +27,29 @@ extern "C" {
|
||||
ExportThread::ExportThread() : continueEncode(true) {
|
||||
surface.create();
|
||||
|
||||
fmt_ctx = NULL;
|
||||
video_stream = NULL;
|
||||
vcodec = NULL;
|
||||
vcodec_ctx = NULL;
|
||||
video_frame = NULL;
|
||||
sws_frame = NULL;
|
||||
sws_ctx = NULL;
|
||||
audio_stream = NULL;
|
||||
acodec = NULL;
|
||||
audio_frame = NULL;
|
||||
swr_frame = NULL;
|
||||
acodec_ctx = NULL;
|
||||
swr_ctx = NULL;
|
||||
fmt_ctx = nullptr;
|
||||
video_stream = nullptr;
|
||||
vcodec = nullptr;
|
||||
vcodec_ctx = nullptr;
|
||||
video_frame = nullptr;
|
||||
sws_frame = nullptr;
|
||||
sws_ctx = nullptr;
|
||||
audio_stream = nullptr;
|
||||
acodec = nullptr;
|
||||
audio_frame = nullptr;
|
||||
swr_frame = nullptr;
|
||||
acodec_ctx = nullptr;
|
||||
swr_ctx = nullptr;
|
||||
|
||||
vpkt_alloc = false;
|
||||
apkt_alloc = false;
|
||||
vpkt_alloc = false;
|
||||
apkt_alloc = false;
|
||||
}
|
||||
|
||||
bool ExportThread::encode(AVFormatContext* ofmt_ctx, AVCodecContext* codec_ctx, AVFrame* frame, AVPacket* packet, AVStream* stream, bool rescale) {
|
||||
ret = avcodec_send_frame(codec_ctx, frame);
|
||||
if (ret < 0) {
|
||||
dout << "[ERROR] Failed to send frame to encoder." << ret;
|
||||
ed->export_error = "failed to send frame to encoder (" + QString::number(ret) + ")";
|
||||
qCritical() << "Failed to send frame to encoder." << ret;
|
||||
ed->export_error = tr("failed to send frame to encoder (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ bool ExportThread::encode(AVFormatContext* ofmt_ctx, AVCodecContext* codec_ctx,
|
||||
return true;
|
||||
} else if (ret < 0) {
|
||||
if (ret != AVERROR_EOF) {
|
||||
dout << "[ERROR] Failed to receive packet from encoder." << ret;
|
||||
ed->export_error = "failed to receive packet from encoder (" + QString::number(ret) + ")";
|
||||
qCritical() << "Failed to receive packet from encoder." << ret;
|
||||
ed->export_error = tr("failed to receive packet from encoder (%1)").arg(QString::number(ret));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -80,8 +80,8 @@ bool ExportThread::setupVideo() {
|
||||
// find video encoder
|
||||
vcodec = avcodec_find_encoder((enum AVCodecID) video_codec);
|
||||
if (!vcodec) {
|
||||
dout << "[ERROR] Could not find video encoder";
|
||||
ed->export_error = "could not video encoder for " + QString::number(video_codec);
|
||||
qCritical() << "Could not find video encoder";
|
||||
ed->export_error = tr("could not video encoder for %1").arg(QString::number(video_codec));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ bool ExportThread::setupVideo() {
|
||||
video_stream = avformat_new_stream(fmt_ctx, vcodec);
|
||||
video_stream->id = 0;
|
||||
if (!video_stream) {
|
||||
dout << "[ERROR] Could not allocate video stream";
|
||||
ed->export_error = "could not allocate video stream";
|
||||
qCritical() << "Could not allocate video stream";
|
||||
ed->export_error = tr("could not allocate video stream");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -98,8 +98,8 @@ bool ExportThread::setupVideo() {
|
||||
// vcodec_ctx = video_stream->codec;
|
||||
vcodec_ctx = avcodec_alloc_context3(vcodec);
|
||||
if (!vcodec_ctx) {
|
||||
dout << "[ERROR] Could not allocate video encoding context";
|
||||
ed->export_error = "could not allocate video encoding context";
|
||||
qCritical() << "Could not allocate video encoding context";
|
||||
ed->export_error = tr("could not allocate video encoding context");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -133,18 +133,21 @@ bool ExportThread::setupVideo() {
|
||||
}
|
||||
}
|
||||
|
||||
ret = avcodec_open2(vcodec_ctx, vcodec, NULL);
|
||||
AVDictionary* opts = nullptr;
|
||||
av_dict_set(&opts, "threads", "auto", 0);
|
||||
|
||||
ret = avcodec_open2(vcodec_ctx, vcodec, &opts);
|
||||
if (ret < 0) {
|
||||
dout << "[ERROR] Could not open output video encoder." << ret;
|
||||
ed->export_error = "could not open output video encoder (" + QString::number(ret) + ")";
|
||||
qCritical() << "Could not open output video encoder." << ret;
|
||||
ed->export_error = tr("could not open output video encoder (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
// copy video encoder parameters to output stream
|
||||
ret = avcodec_parameters_from_context(video_stream->codecpar, vcodec_ctx);
|
||||
if (ret < 0) {
|
||||
dout << "[ERROR] Could not copy video encoder parameters to output stream." << ret;
|
||||
ed->export_error = "could not copy video encoder parameters to output stream (" + QString::number(ret) + ")";
|
||||
qCritical() << "Could not copy video encoder parameters to output stream." << ret;
|
||||
ed->export_error = tr("could not copy video encoder parameters to output stream (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -166,9 +169,9 @@ bool ExportThread::setupVideo() {
|
||||
video_height,
|
||||
vcodec_ctx->pix_fmt,
|
||||
SWS_FAST_BILINEAR,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
);
|
||||
|
||||
sws_frame = av_frame_alloc();
|
||||
@@ -187,8 +190,8 @@ bool ExportThread::setupAudio() {
|
||||
// find encoder
|
||||
acodec = avcodec_find_encoder(static_cast<AVCodecID>(audio_codec));
|
||||
if (!acodec) {
|
||||
dout << "[ERROR] Could not find audio encoder";
|
||||
ed->export_error = "could not audio encoder for " + QString::number(audio_codec);
|
||||
qCritical() << "Could not find audio encoder";
|
||||
ed->export_error = tr("could not audio encoder for %1").arg(QString::number(audio_codec));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -196,8 +199,8 @@ bool ExportThread::setupAudio() {
|
||||
audio_stream = avformat_new_stream(fmt_ctx, acodec);
|
||||
audio_stream->id = 1;
|
||||
if (!audio_stream) {
|
||||
dout << "[ERROR] Could not allocate audio stream";
|
||||
ed->export_error = "could not allocate audio stream";
|
||||
qCritical() << "Could not allocate audio stream";
|
||||
ed->export_error = tr("could not allocate audio stream");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -205,8 +208,8 @@ bool ExportThread::setupAudio() {
|
||||
// acodec_ctx = audio_stream->codec;
|
||||
acodec_ctx = avcodec_alloc_context3(acodec);
|
||||
if (!acodec_ctx) {
|
||||
dout << "[ERROR] Could not find allocate audio encoding context";
|
||||
ed->export_error = "could not allocate audio encoding context";
|
||||
qCritical() << "Could not find allocate audio encoding context";
|
||||
ed->export_error = tr("could not allocate audio encoding context");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -228,24 +231,24 @@ bool ExportThread::setupAudio() {
|
||||
}
|
||||
|
||||
// open encoder
|
||||
ret = avcodec_open2(acodec_ctx, acodec, NULL);
|
||||
ret = avcodec_open2(acodec_ctx, acodec, nullptr);
|
||||
if (ret < 0) {
|
||||
dout << "[ERROR] Could not open output audio encoder." << ret;
|
||||
ed->export_error = "could not open output audio encoder (" + QString::number(ret) + ")";
|
||||
qCritical() << "Could not open output audio encoder." << ret;
|
||||
ed->export_error = tr("could not open output audio encoder (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
// copy params to output stream
|
||||
ret = avcodec_parameters_from_context(audio_stream->codecpar, acodec_ctx);
|
||||
if (ret < 0) {
|
||||
dout << "[ERROR] Could not copy audio encoder parameters to output stream." << ret;
|
||||
ed->export_error = "could not copy audio encoder parameters to output stream (" + QString::number(ret) + ")";
|
||||
qCritical() << "Could not copy audio encoder parameters to output stream." << ret;
|
||||
ed->export_error = tr("could not copy audio encoder parameters to output stream (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
// init audio resampler context
|
||||
swr_ctx = swr_alloc_set_opts(
|
||||
NULL,
|
||||
nullptr,
|
||||
acodec_ctx->channel_layout,
|
||||
acodec_ctx->sample_fmt,
|
||||
acodec_ctx->sample_rate,
|
||||
@@ -253,7 +256,7 @@ bool ExportThread::setupAudio() {
|
||||
AV_SAMPLE_FMT_S16,
|
||||
sequence->audio_frequency,
|
||||
0,
|
||||
NULL
|
||||
nullptr
|
||||
);
|
||||
swr_init(swr_ctx);
|
||||
|
||||
@@ -268,11 +271,11 @@ bool ExportThread::setupAudio() {
|
||||
av_frame_make_writable(audio_frame);
|
||||
ret = av_frame_get_buffer(audio_frame, 0);
|
||||
if (ret < 0) {
|
||||
dout << "[ERROR] Could not allocate audio buffer." << ret;
|
||||
ed->export_error = "could not allocate audio buffer (" + QString::number(ret) + ")";
|
||||
qCritical() << "Could not allocate audio buffer." << ret;
|
||||
ed->export_error = tr("could not allocate audio buffer (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
aframe_bytes = av_samples_get_buffer_size(NULL, audio_frame->channels, audio_frame->nb_samples, static_cast<AVSampleFormat>(audio_frame->format), 0);
|
||||
aframe_bytes = av_samples_get_buffer_size(nullptr, audio_frame->channels, audio_frame->nb_samples, static_cast<AVSampleFormat>(audio_frame->format), 0);
|
||||
|
||||
// init converted audio frame
|
||||
swr_frame = av_frame_alloc();
|
||||
@@ -288,10 +291,10 @@ bool ExportThread::setupAudio() {
|
||||
}
|
||||
|
||||
bool ExportThread::setupContainer() {
|
||||
avformat_alloc_output_context2(&fmt_ctx, NULL, NULL, c_filename);
|
||||
avformat_alloc_output_context2(&fmt_ctx, nullptr, nullptr, c_filename);
|
||||
if (!fmt_ctx) {
|
||||
dout << "[ERROR] Could not create output context";
|
||||
ed->export_error = "could not create output format context";
|
||||
qCritical() << "Could not create output context";
|
||||
ed->export_error = tr("could not create output format context");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -299,8 +302,8 @@ bool ExportThread::setupContainer() {
|
||||
|
||||
ret = avio_open(&fmt_ctx->pb, c_filename, AVIO_FLAG_WRITE);
|
||||
if (ret < 0) {
|
||||
dout << "[ERROR] Could not open output file." << ret;
|
||||
ed->export_error = "could not open output file (" + QString::number(ret) + ")";
|
||||
qCritical() << "Could not open output file." << ret;
|
||||
ed->export_error = tr("could not open output file (%1)").arg(QString::number(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -311,8 +314,8 @@ void ExportThread::run() {
|
||||
panel_sequence_viewer->pause();
|
||||
|
||||
if (!panel_sequence_viewer->viewer_widget->context()->makeCurrent(&surface)) {
|
||||
dout << "[ERROR] Make current failed";
|
||||
ed->export_error = "could not make OpenGL context current";
|
||||
qCritical() << "Make current failed";
|
||||
ed->export_error = tr("could not make OpenGL context current");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -328,10 +331,10 @@ void ExportThread::run() {
|
||||
if (audio_enabled && continueEncode) continueEncode = setupAudio();
|
||||
|
||||
if (continueEncode) {
|
||||
ret = avformat_write_header(fmt_ctx, NULL);
|
||||
ret = avformat_write_header(fmt_ctx, nullptr);
|
||||
if (ret < 0) {
|
||||
dout << "[ERROR] Could not write output file header." << ret;
|
||||
ed->export_error = "could not write output file header (" + QString::number(ret) + ")";
|
||||
qCritical() << "Could not write output file header." << ret;
|
||||
ed->export_error = tr("could not write output file header (%1)").arg(QString::number(ret));
|
||||
continueEncode = false;
|
||||
}
|
||||
}
|
||||
@@ -400,27 +403,27 @@ void ExportThread::run() {
|
||||
avg_time = (total_time/frame_count);
|
||||
eta = (remaining_frames*avg_time);
|
||||
|
||||
// dout << "[INFO] Encoded frame" << sequence->playhead << "- took" << frame_time << "ms (avg:" << avg_time << "ms, remaining:" << remaining_frames << ", ETA:" << eta << ")";
|
||||
// qInfo() << "Encoded frame" << sequence->playhead << "- took" << frame_time << "ms (avg:" << avg_time << "ms, remaining:" << remaining_frames << ", ETA:" << eta << ")";
|
||||
|
||||
emit progress_changed(qRound(((double) (sequence->playhead-start_frame) / (double) (end_frame-start_frame)) * 100), eta);
|
||||
sequence->playhead++;
|
||||
frame_count++;
|
||||
}
|
||||
|
||||
if (continueEncode) {
|
||||
if (video_enabled) vpkt_alloc = true;
|
||||
if (audio_enabled) apkt_alloc = true;
|
||||
}
|
||||
if (continueEncode) {
|
||||
if (video_enabled) vpkt_alloc = true;
|
||||
if (audio_enabled) apkt_alloc = true;
|
||||
}
|
||||
|
||||
panel_sequence_viewer->viewer_widget->default_fbo = NULL;
|
||||
panel_sequence_viewer->viewer_widget->default_fbo = nullptr;
|
||||
rendering = false;
|
||||
|
||||
fbo.release();
|
||||
|
||||
if (audio_enabled && continueEncode) {
|
||||
if (audio_enabled && continueEncode) {
|
||||
// flush swresample
|
||||
do {
|
||||
swr_convert_frame(swr_ctx, swr_frame, NULL);
|
||||
swr_convert_frame(swr_ctx, swr_frame, nullptr);
|
||||
if (swr_frame->nb_samples == 0) break;
|
||||
swr_frame->pts = file_audio_samples;
|
||||
if (!encode(fmt_ctx, acodec_ctx, swr_frame, &audio_pkt, audio_stream, true)) continueEncode = false;
|
||||
@@ -433,14 +436,14 @@ void ExportThread::run() {
|
||||
if (continueEncode) {
|
||||
// flush remaining packets
|
||||
while (continueVideo && continueAudio) {
|
||||
if (continueVideo && video_enabled) continueVideo = encode(fmt_ctx, vcodec_ctx, NULL, &video_pkt, video_stream, false);
|
||||
if (continueAudio && audio_enabled) continueAudio = encode(fmt_ctx, acodec_ctx, NULL, &audio_pkt, audio_stream, true);
|
||||
if (continueVideo && video_enabled) continueVideo = encode(fmt_ctx, vcodec_ctx, nullptr, &video_pkt, video_stream, false);
|
||||
if (continueAudio && audio_enabled) continueAudio = encode(fmt_ctx, acodec_ctx, nullptr, &audio_pkt, audio_stream, true);
|
||||
}
|
||||
|
||||
ret = av_write_trailer(fmt_ctx);
|
||||
if (ret < 0) {
|
||||
dout << "[ERROR] Could not write output file trailer." << ret;
|
||||
ed->export_error = "could not write output file trailer (" + QString::number(ret) + ")";
|
||||
qCritical() << "Could not write output file trailer." << ret;
|
||||
ed->export_error = tr("could not write output file trailer (%1)").arg(QString::number(ret));
|
||||
continueEncode = false;
|
||||
}
|
||||
|
||||
@@ -449,27 +452,27 @@ void ExportThread::run() {
|
||||
|
||||
avio_closep(&fmt_ctx->pb);
|
||||
|
||||
if (vpkt_alloc) av_packet_unref(&video_pkt);
|
||||
if (video_frame != NULL) av_frame_free(&video_frame);
|
||||
if (vcodec_ctx != NULL) {
|
||||
avcodec_close(vcodec_ctx);
|
||||
avcodec_free_context(&vcodec_ctx);
|
||||
}
|
||||
if (vpkt_alloc) av_packet_unref(&video_pkt);
|
||||
if (video_frame != nullptr) av_frame_free(&video_frame);
|
||||
if (vcodec_ctx != nullptr) {
|
||||
avcodec_close(vcodec_ctx);
|
||||
avcodec_free_context(&vcodec_ctx);
|
||||
}
|
||||
|
||||
if (apkt_alloc) av_packet_unref(&audio_pkt);
|
||||
if (audio_frame != NULL) av_frame_free(&audio_frame);
|
||||
if (acodec_ctx != NULL) {
|
||||
avcodec_close(acodec_ctx);
|
||||
avcodec_free_context(&acodec_ctx);
|
||||
}
|
||||
if (apkt_alloc) av_packet_unref(&audio_pkt);
|
||||
if (audio_frame != nullptr) av_frame_free(&audio_frame);
|
||||
if (acodec_ctx != nullptr) {
|
||||
avcodec_close(acodec_ctx);
|
||||
avcodec_free_context(&acodec_ctx);
|
||||
}
|
||||
|
||||
avformat_free_context(fmt_ctx);
|
||||
|
||||
if (sws_ctx != NULL) {
|
||||
if (sws_ctx != nullptr) {
|
||||
sws_freeContext(sws_ctx);
|
||||
av_frame_free(&sws_frame);
|
||||
}
|
||||
if (swr_ctx != NULL) {
|
||||
if (swr_ctx != nullptr) {
|
||||
swr_free(&swr_ctx);
|
||||
av_frame_free(&swr_frame);
|
||||
}
|
||||
|
||||
+64
-39
@@ -43,7 +43,7 @@ const EffectMeta* get_meta_from_name(const QString& name) {
|
||||
return &effects.at(j);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void LoadThread::load_effect(QXmlStreamReader& stream, Clip* c) {
|
||||
@@ -67,7 +67,7 @@ void LoadThread::load_effect(QXmlStreamReader& stream, Clip* c) {
|
||||
// wait for effects to be loaded
|
||||
panel_effect_controls->effects_loaded.lock();
|
||||
|
||||
const EffectMeta* meta = NULL;
|
||||
const EffectMeta* meta = nullptr;
|
||||
|
||||
// find effect with this name
|
||||
if (!effect_name.isEmpty()) {
|
||||
@@ -153,7 +153,12 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
if (type == LOAD_TYPE_VERSION) {
|
||||
int proj_version = stream.readElementText().toInt();
|
||||
if (proj_version < MIN_SAVE_VERSION && proj_version > SAVE_VERSION) {
|
||||
if (QMessageBox::warning(mainWindow, "Version Mismatch", "This project was saved in a different version of Olive and may not be fully compatible with this version. Would you like to attempt loading it anyway?", QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) {
|
||||
if (QMessageBox::warning(
|
||||
mainWindow,
|
||||
tr("Version Mismatch"),
|
||||
tr("This project was saved in a different version of Olive and may not be fully compatible with this version. Would you like to attempt loading it anyway?"),
|
||||
QMessageBox::Yes,
|
||||
QMessageBox::No) == QMessageBox::No) {
|
||||
show_err = false;
|
||||
return false;
|
||||
}
|
||||
@@ -168,7 +173,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
switch (type) {
|
||||
case MEDIA_TYPE_FOLDER:
|
||||
{
|
||||
Media* folder = panel_project->new_folder(0);
|
||||
Media* folder = panel_project->new_folder(nullptr);
|
||||
folder->temp_id2 = 0;
|
||||
for (int j=0;j<stream.attributes().size();j++) {
|
||||
const QXmlStreamAttribute& attr = stream.attributes().at(j);
|
||||
@@ -209,19 +214,19 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
|
||||
if (QFileInfo::exists(proj_dir_test)) { // if path is relative to the project's current dir
|
||||
m->url = proj_dir_test;
|
||||
dout << "[INFO] Matched" << attr.value().toString() << "relative to project's current directory";
|
||||
qInfo() << "Matched" << attr.value().toString() << "relative to project's current directory";
|
||||
} else if (QFileInfo::exists(internal_proj_dir_test)) { // if path is relative to the last directory the project was saved in
|
||||
m->url = internal_proj_dir_test;
|
||||
dout << "[INFO] Matched" << attr.value().toString() << "relative to project's internal directory";
|
||||
qInfo() << "Matched" << attr.value().toString() << "relative to project's internal directory";
|
||||
} else if (m->url.contains('%')) {
|
||||
// hack for image sequences (qt won't be able to find the URL with %, but ffmpeg may)
|
||||
m->url = internal_proj_dir_test;
|
||||
dout << "[INFO] Guess image sequence" << attr.value().toString() << "path to project's internal directory";
|
||||
qInfo() << "Guess image sequence" << attr.value().toString() << "path to project's internal directory";
|
||||
} else {
|
||||
dout << "[INFO] Failed to match" << attr.value().toString() << "to file";
|
||||
qInfo() << "Failed to match" << attr.value().toString() << "to file";
|
||||
}
|
||||
} else {
|
||||
dout << "[INFO] Matched" << attr.value().toString() << "with absolute path";
|
||||
qInfo() << "Matched" << attr.value().toString() << "with absolute path";
|
||||
}
|
||||
} else if (attr.name() == "duration") {
|
||||
m->length = attr.value().toLongLong();
|
||||
@@ -238,7 +243,11 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
|
||||
item->set_footage(m);
|
||||
|
||||
project_model.appendChild(find_loaded_folder_by_id(folder), item);
|
||||
if (folder == 0) {
|
||||
project_model.appendChild(nullptr, item);
|
||||
} else {
|
||||
find_loaded_folder_by_id(folder)->appendChild(item);
|
||||
}
|
||||
|
||||
// analyze media to see if it's the same
|
||||
loaded_media_items.append(item);
|
||||
@@ -246,7 +255,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
break;
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Media* parent = NULL;
|
||||
Media* parent = nullptr;
|
||||
Sequence* s = new Sequence();
|
||||
|
||||
// load attributes about sequence
|
||||
@@ -273,6 +282,8 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
open_seq = s;
|
||||
} else if (attr.name() == "workarea") {
|
||||
s->using_workarea = (attr.value() == "1");
|
||||
} else if (attr.name() == "workareaEnabled") {
|
||||
s->enable_workarea = (attr.value() == "1");
|
||||
} else if (attr.name() == "workareaIn") {
|
||||
s->workarea_in = attr.value().toLong();
|
||||
} else if (attr.name() == "workareaOut") {
|
||||
@@ -298,8 +309,8 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
s->markers.append(m);
|
||||
} else if (stream.name() == "transition" && stream.isStartElement()) {
|
||||
TransitionData td;
|
||||
td.otc = NULL;
|
||||
td.ctc = NULL;
|
||||
td.otc = nullptr;
|
||||
td.ctc = nullptr;
|
||||
for (int j=0;j<stream.attributes().size();j++) {
|
||||
const QXmlStreamAttribute& attr = stream.attributes().at(j);
|
||||
if (attr.name() == "id") {
|
||||
@@ -319,7 +330,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
// backwards compatibility code
|
||||
c->autoscale = false;
|
||||
|
||||
c->media = NULL;
|
||||
c->media = nullptr;
|
||||
|
||||
for (int j=0;j<stream.attributes().size();j++) {
|
||||
const QXmlStreamAttribute& attr = stream.attributes().at(j);
|
||||
@@ -364,7 +375,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
media_type = MEDIA_TYPE_SEQUENCE;
|
||||
|
||||
// since we haven't finished loading sequences, we defer linking this until later
|
||||
c->media = NULL;
|
||||
c->media = nullptr;
|
||||
c->media_stream = attr.value().toInt();
|
||||
loaded_clips.append(c);
|
||||
}
|
||||
@@ -433,7 +444,11 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
if (!found) {
|
||||
correct_clip->linked.removeAt(j);
|
||||
j--;
|
||||
if (QMessageBox::warning(mainWindow, "Invalid Clip Link", "This project contains an invalid clip link. It may be corrupt. Would you like to continue loading it?", QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) {
|
||||
if (QMessageBox::warning(mainWindow,
|
||||
tr("Invalid Clip Link"),
|
||||
tr("This project contains an invalid clip link. It may be corrupt. Would you like to continue loading it?"),
|
||||
QMessageBox::Yes,
|
||||
QMessageBox::No) == QMessageBox::No) {
|
||||
delete s;
|
||||
return false;
|
||||
}
|
||||
@@ -462,16 +477,16 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
const TransitionData& td = transition_data.at(i);
|
||||
Clip* primary = td.otc;
|
||||
Clip* secondary = td.ctc;
|
||||
if (primary != NULL || secondary != NULL) {
|
||||
if (primary == NULL) {
|
||||
if (primary != nullptr || secondary != nullptr) {
|
||||
if (primary == nullptr) {
|
||||
primary = secondary;
|
||||
secondary = NULL;
|
||||
secondary = nullptr;
|
||||
}
|
||||
const EffectMeta* meta = get_meta_from_name(td.name);
|
||||
if (meta == NULL) {
|
||||
dout << "[WARNING] Failed to link transition with name:" << td.name;
|
||||
if (td.otc != NULL) td.otc->opening_transition = -1;
|
||||
if (td.ctc != NULL) td.ctc->closing_transition = -1;
|
||||
if (meta == nullptr) {
|
||||
qWarning() << "Failed to link transition with name:" << td.name;
|
||||
if (td.otc != nullptr) td.otc->opening_transition = -1;
|
||||
if (td.ctc != nullptr) td.ctc->closing_transition = -1;
|
||||
} else {
|
||||
emit start_create_dual_transition(&td, primary, secondary, meta);
|
||||
|
||||
@@ -480,7 +495,7 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
}
|
||||
}
|
||||
|
||||
Media* m = panel_project->new_sequence(NULL, s, false, parent);
|
||||
Media* m = panel_project->new_sequence(nullptr, s, false, parent);
|
||||
|
||||
loaded_sequences.append(m);
|
||||
}
|
||||
@@ -497,14 +512,14 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
|
||||
}
|
||||
|
||||
Media* LoadThread::find_loaded_folder_by_id(int id) {
|
||||
if (id == 0) return NULL;
|
||||
if (id == 0) return nullptr;
|
||||
for (int j=0;j<loaded_folders.size();j++) {
|
||||
Media* parent_item = loaded_folders.at(j);
|
||||
if (parent_item->temp_id == id) {
|
||||
return parent_item;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void LoadThread::run() {
|
||||
@@ -512,7 +527,7 @@ void LoadThread::run() {
|
||||
|
||||
QFile file(project_url);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
dout << "[ERROR] Could not open file";
|
||||
qCritical() << "Could not open file";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -532,7 +547,7 @@ void LoadThread::run() {
|
||||
show_err = true;
|
||||
|
||||
// temp variables for loading (unnecessary?)
|
||||
open_seq = NULL;
|
||||
open_seq = nullptr;
|
||||
loaded_folders.clear();
|
||||
loaded_media_items.clear();
|
||||
loaded_clips.clear();
|
||||
@@ -566,7 +581,11 @@ void LoadThread::run() {
|
||||
for (int i=0;i<loaded_folders.size();i++) {
|
||||
Media* folder = loaded_folders.at(i);
|
||||
int parent = folder->temp_id2;
|
||||
project_model.appendChild(find_loaded_folder_by_id(parent), folder);
|
||||
if (folder->temp_id2 == 0) {
|
||||
project_model.appendChild(nullptr, folder);
|
||||
} else {
|
||||
find_loaded_folder_by_id(parent)->appendChild(folder);
|
||||
}
|
||||
}
|
||||
|
||||
cont = load_worker(file, stream, MEDIA_TYPE_FOOTAGE);
|
||||
@@ -582,7 +601,7 @@ void LoadThread::run() {
|
||||
xml_error = false;
|
||||
if (show_err) emit error();
|
||||
} else if (stream.hasError()) {
|
||||
error_str = stream.errorString() + " - Line: " + QString::number(stream.lineNumber()) + " Col:" + QString::number(stream.columnNumber());
|
||||
error_str = tr("%1 - Line: %2 Col: %3").arg(stream.errorString(), QString::number(stream.lineNumber()), QString::number(stream.columnNumber()));
|
||||
xml_error = true;
|
||||
emit error();
|
||||
cont = false;
|
||||
@@ -591,7 +610,7 @@ void LoadThread::run() {
|
||||
// attach nested sequence clips to their sequences
|
||||
for (int i=0;i<loaded_clips.size();i++) {
|
||||
for (int j=0;j<loaded_sequences.size();j++) {
|
||||
if (loaded_clips.at(i)->media == NULL && loaded_clips.at(i)->media_stream == loaded_sequences.at(j)->to_sequence()->save_id) {
|
||||
if (loaded_clips.at(i)->media == nullptr && loaded_clips.at(i)->media_stream == loaded_sequences.at(j)->to_sequence()->save_id) {
|
||||
loaded_clips.at(i)->media = loaded_sequences.at(j);
|
||||
loaded_clips.at(i)->refresh();
|
||||
break;
|
||||
@@ -621,10 +640,16 @@ void LoadThread::cancel() {
|
||||
|
||||
void LoadThread::error_func() {
|
||||
if (xml_error) {
|
||||
dout << "[ERROR] Error parsing XML." << error_str;
|
||||
QMessageBox::critical(mainWindow, "XML Parsing Error", "Couldn't load '" + project_url + "'. " + error_str, QMessageBox::Ok);
|
||||
qCritical() << "Error parsing XML." << error_str;
|
||||
QMessageBox::critical(mainWindow,
|
||||
tr("XML Parsing Error"),
|
||||
tr("Couldn't load '%1'. %2").arg(project_url, error_str),
|
||||
QMessageBox::Ok);
|
||||
} else {
|
||||
QMessageBox::critical(mainWindow, "Project Load Error", "Error loading project: " + error_str, QMessageBox::Ok);
|
||||
QMessageBox::critical(mainWindow,
|
||||
tr("Project Load Error"),
|
||||
tr("Error loading project: %1").arg(error_str),
|
||||
QMessageBox::Ok);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -649,7 +674,7 @@ void LoadThread::success_func() {
|
||||
}
|
||||
|
||||
mainWindow->setWindowModified(autorecovery);
|
||||
if (open_seq != NULL) set_sequence(open_seq);
|
||||
if (open_seq != nullptr) set_sequence(open_seq);
|
||||
update_ui(false);
|
||||
}
|
||||
|
||||
@@ -685,7 +710,7 @@ void LoadThread::create_effect_ui(
|
||||
|
||||
if (cancelled) return;
|
||||
if (type == TA_NO_TRANSITION) {
|
||||
if (meta == NULL) {
|
||||
if (meta == nullptr) {
|
||||
// create void effect
|
||||
VoidEffect* ve = new VoidEffect(c, *effect_name);
|
||||
ve->set_enabled(effect_enabled);
|
||||
@@ -699,7 +724,7 @@ void LoadThread::create_effect_ui(
|
||||
c->effects.append(e);
|
||||
}
|
||||
} else {
|
||||
int transition_index = create_transition(c, NULL, meta);
|
||||
int transition_index = create_transition(c, nullptr, meta);
|
||||
Transition* t = c->sequence->transitions.at(transition_index);
|
||||
if (effect_length > -1) t->set_length(effect_length);
|
||||
t->set_enabled(effect_enabled);
|
||||
@@ -718,7 +743,7 @@ void LoadThread::create_effect_ui(
|
||||
void LoadThread::create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta) {
|
||||
int transition_index = create_transition(primary, secondary, meta);
|
||||
primary->sequence->transitions.at(transition_index)->set_length(td->length);
|
||||
if (td->otc != NULL) td->otc->opening_transition = transition_index;
|
||||
if (td->ctc != NULL) td->ctc->closing_transition = transition_index;
|
||||
if (td->otc != nullptr) td->otc->opening_transition = transition_index;
|
||||
if (td->ctc != nullptr) td->ctc->closing_transition = transition_index;
|
||||
waitCond.wakeAll();
|
||||
}
|
||||
|
||||
+34
-34
@@ -12,60 +12,60 @@ struct Footage;
|
||||
struct Clip;
|
||||
struct Sequence;
|
||||
class LoadDialog;
|
||||
class TransitionData;
|
||||
struct TransitionData;
|
||||
struct EffectMeta;
|
||||
|
||||
class LoadThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
LoadThread(LoadDialog* l, bool a);
|
||||
void run();
|
||||
void cancel();
|
||||
LoadThread(LoadDialog* l, bool a);
|
||||
void run();
|
||||
void cancel();
|
||||
signals:
|
||||
void success();
|
||||
void success();
|
||||
void error();
|
||||
void start_create_effect_ui(QXmlStreamReader* stream, Clip* c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
void start_create_effect_ui(QXmlStreamReader* stream, Clip* c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
void start_create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta);
|
||||
void report_progress(int p);
|
||||
void report_progress(int p);
|
||||
private slots:
|
||||
void error_func();
|
||||
void success_func();
|
||||
void create_effect_ui(QXmlStreamReader* stream, Clip* c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
void success_func();
|
||||
void create_effect_ui(QXmlStreamReader* stream, Clip* c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled);
|
||||
void create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta);
|
||||
private:
|
||||
LoadDialog* ld;
|
||||
bool autorecovery;
|
||||
LoadDialog* ld;
|
||||
bool autorecovery;
|
||||
|
||||
bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
|
||||
void load_effect(QXmlStreamReader& stream, Clip* c);
|
||||
bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
|
||||
void load_effect(QXmlStreamReader& stream, Clip* c);
|
||||
|
||||
void read_next(QXmlStreamReader& stream);
|
||||
void read_next_start_element(QXmlStreamReader& stream);
|
||||
void update_current_element_count(QXmlStreamReader& stream);
|
||||
void read_next(QXmlStreamReader& stream);
|
||||
void read_next_start_element(QXmlStreamReader& stream);
|
||||
void update_current_element_count(QXmlStreamReader& stream);
|
||||
|
||||
Sequence* open_seq;
|
||||
QVector<Media*> loaded_media_items;
|
||||
QDir proj_dir;
|
||||
QDir internal_proj_dir;
|
||||
QString internal_proj_url;
|
||||
bool show_err;
|
||||
QString error_str;
|
||||
Sequence* open_seq;
|
||||
QVector<Media*> loaded_media_items;
|
||||
QDir proj_dir;
|
||||
QDir internal_proj_dir;
|
||||
QString internal_proj_url;
|
||||
bool show_err;
|
||||
QString error_str;
|
||||
|
||||
bool is_element(QXmlStreamReader& stream);
|
||||
bool is_element(QXmlStreamReader& stream);
|
||||
|
||||
QVector<Media*> loaded_folders;
|
||||
QVector<Clip*> loaded_clips;
|
||||
QVector<Media*> loaded_sequences;
|
||||
Media* find_loaded_folder_by_id(int id);
|
||||
QVector<Media*> loaded_folders;
|
||||
QVector<Clip*> loaded_clips;
|
||||
QVector<Media*> loaded_sequences;
|
||||
Media* find_loaded_folder_by_id(int id);
|
||||
|
||||
int current_element_count;
|
||||
int total_element_count;
|
||||
int current_element_count;
|
||||
int total_element_count;
|
||||
|
||||
QMutex mutex;
|
||||
QWaitCondition waitCond;
|
||||
QMutex mutex;
|
||||
QWaitCondition waitCond;
|
||||
|
||||
bool cancelled;
|
||||
bool cancelled;
|
||||
bool xml_error;
|
||||
};
|
||||
|
||||
|
||||
+26
-26
@@ -31,7 +31,7 @@ QSemaphore sem(5); // only 5 preview generators can run at one time
|
||||
|
||||
PreviewGenerator::PreviewGenerator(Media* i, Footage* m, bool r) :
|
||||
QThread(0),
|
||||
fmt_ctx(NULL),
|
||||
fmt_ctx(nullptr),
|
||||
media(i),
|
||||
footage(m),
|
||||
retrieve_duration(false),
|
||||
@@ -52,8 +52,8 @@ void PreviewGenerator::parse_media() {
|
||||
// detect video/audio streams in file
|
||||
for (int i=0;i<(int)fmt_ctx->nb_streams;i++) {
|
||||
// Find the decoder for the video stream
|
||||
if (avcodec_find_decoder(fmt_ctx->streams[i]->codecpar->codec_id) == NULL) {
|
||||
dout << "[ERROR] Unsupported codec in stream" << i << "of file" << footage->name;
|
||||
if (avcodec_find_decoder(fmt_ctx->streams[i]->codecpar->codec_id) == nullptr) {
|
||||
qCritical() << "Unsupported codec in stream" << i << "of file" << footage->name;
|
||||
} else {
|
||||
FootageStream ms;
|
||||
ms.preview_done = false;
|
||||
@@ -219,13 +219,13 @@ void PreviewGenerator::generate_waveform() {
|
||||
AVCodecContext** codec_ctx = new AVCodecContext* [fmt_ctx->nb_streams];
|
||||
int64_t* media_lengths = new int64_t[fmt_ctx->nb_streams]{0};
|
||||
for (unsigned int i=0;i<fmt_ctx->nb_streams;i++) {
|
||||
codec_ctx[i] = NULL;
|
||||
codec_ctx[i] = nullptr;
|
||||
if (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
AVCodec* codec = avcodec_find_decoder(fmt_ctx->streams[i]->codecpar->codec_id);
|
||||
if (codec != NULL) {
|
||||
if (codec != nullptr) {
|
||||
codec_ctx[i] = avcodec_alloc_context3(codec);
|
||||
avcodec_parameters_to_context(codec_ctx[i], fmt_ctx->streams[i]->codecpar);
|
||||
avcodec_open2(codec_ctx[i], codec, NULL);
|
||||
avcodec_open2(codec_ctx[i], codec, nullptr);
|
||||
if (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && codec_ctx[i]->channel_layout == 0) {
|
||||
codec_ctx[i]->channel_layout = av_get_default_channel_layout(fmt_ctx->streams[i]->codecpar->channels);
|
||||
}
|
||||
@@ -241,11 +241,11 @@ void PreviewGenerator::generate_waveform() {
|
||||
// get the ball rolling
|
||||
do {
|
||||
av_read_frame(fmt_ctx, packet);
|
||||
} while (codec_ctx[packet->stream_index] == NULL);
|
||||
} while (codec_ctx[packet->stream_index] == nullptr);
|
||||
avcodec_send_packet(codec_ctx[packet->stream_index], packet);
|
||||
|
||||
while (!end_of_file) {
|
||||
while (codec_ctx[packet->stream_index] == NULL || avcodec_receive_frame(codec_ctx[packet->stream_index], temp_frame) == AVERROR(EAGAIN)) {
|
||||
while (codec_ctx[packet->stream_index] == nullptr || avcodec_receive_frame(codec_ctx[packet->stream_index], temp_frame) == AVERROR(EAGAIN)) {
|
||||
av_packet_unref(packet);
|
||||
int read_ret = av_read_frame(fmt_ctx, packet);
|
||||
|
||||
@@ -253,13 +253,13 @@ void PreviewGenerator::generate_waveform() {
|
||||
|
||||
if (read_ret < 0) {
|
||||
end_of_file = true;
|
||||
if (read_ret != AVERROR_EOF) dout << "[ERROR] Failed to read packet for preview generation" << read_ret;
|
||||
if (read_ret != AVERROR_EOF) qCritical() << "Failed to read packet for preview generation" << read_ret;
|
||||
break;
|
||||
}
|
||||
if (codec_ctx[packet->stream_index] != NULL) {
|
||||
if (codec_ctx[packet->stream_index] != nullptr) {
|
||||
int send_ret = avcodec_send_packet(codec_ctx[packet->stream_index], packet);
|
||||
if (send_ret < 0 && send_ret != AVERROR(EAGAIN)) {
|
||||
dout << "[ERROR] Failed to send packet for preview generation - aborting" << send_ret;
|
||||
qCritical() << "Failed to send packet for preview generation - aborting" << send_ret;
|
||||
end_of_file = true;
|
||||
break;
|
||||
}
|
||||
@@ -267,7 +267,7 @@ void PreviewGenerator::generate_waveform() {
|
||||
}
|
||||
if (!end_of_file) {
|
||||
FootageStream* s = footage->get_stream_from_file_index(fmt_ctx->streams[packet->stream_index]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO, packet->stream_index);
|
||||
if (s != NULL) {
|
||||
if (s != nullptr) {
|
||||
if (fmt_ctx->streams[packet->stream_index]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||
if (!s->preview_done) {
|
||||
int dstH = 120;
|
||||
@@ -282,9 +282,9 @@ void PreviewGenerator::generate_waveform() {
|
||||
dstH,
|
||||
static_cast<AVPixelFormat>(AV_PIX_FMT_RGBA),
|
||||
SWS_FAST_BILINEAR,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr
|
||||
);
|
||||
|
||||
int linesize[AV_NUM_DATA_POINTERS];
|
||||
@@ -304,7 +304,7 @@ void PreviewGenerator::generate_waveform() {
|
||||
|
||||
if (!retrieve_duration) {
|
||||
avcodec_close(codec_ctx[packet->stream_index]);
|
||||
codec_ctx[packet->stream_index] = NULL;
|
||||
codec_ctx[packet->stream_index] = nullptr;
|
||||
}
|
||||
}
|
||||
media_lengths[packet->stream_index]++;
|
||||
@@ -317,7 +317,7 @@ void PreviewGenerator::generate_waveform() {
|
||||
swr_frame->format = AV_SAMPLE_FMT_S16P;
|
||||
|
||||
swr_ctx = swr_alloc_set_opts(
|
||||
NULL,
|
||||
nullptr,
|
||||
temp_frame->channel_layout,
|
||||
static_cast<AVSampleFormat>(swr_frame->format),
|
||||
temp_frame->sample_rate,
|
||||
@@ -325,7 +325,7 @@ void PreviewGenerator::generate_waveform() {
|
||||
static_cast<AVSampleFormat>(temp_frame->format),
|
||||
temp_frame->sample_rate,
|
||||
0,
|
||||
NULL
|
||||
nullptr
|
||||
);
|
||||
|
||||
swr_init(swr_ctx);
|
||||
@@ -394,7 +394,7 @@ void PreviewGenerator::generate_waveform() {
|
||||
av_frame_free(&temp_frame);
|
||||
av_packet_free(&packet);
|
||||
for (unsigned int i=0;i<fmt_ctx->nb_streams;i++) {
|
||||
if (codec_ctx[i] != NULL) {
|
||||
if (codec_ctx[i] != nullptr) {
|
||||
avcodec_close(codec_ctx[i]);
|
||||
}
|
||||
}
|
||||
@@ -422,8 +422,8 @@ QString PreviewGenerator::get_waveform_path(const QString& hash, const FootageSt
|
||||
}
|
||||
|
||||
void PreviewGenerator::run() {
|
||||
Q_ASSERT(footage != NULL);
|
||||
Q_ASSERT(media != NULL);
|
||||
Q_ASSERT(footage != nullptr);
|
||||
Q_ASSERT(media != nullptr);
|
||||
|
||||
QByteArray ba = footage->url.toUtf8();
|
||||
char* filename = new char[ba.size()+1];
|
||||
@@ -431,18 +431,18 @@ void PreviewGenerator::run() {
|
||||
|
||||
QString errorStr;
|
||||
bool error = false;
|
||||
int errCode = avformat_open_input(&fmt_ctx, filename, NULL, NULL);
|
||||
int errCode = avformat_open_input(&fmt_ctx, filename, nullptr, nullptr);
|
||||
if(errCode != 0) {
|
||||
char err[1024];
|
||||
av_strerror(errCode, err, 1024);
|
||||
errorStr = "Could not open file - " + QString(err);
|
||||
errorStr = tr("Could not open file - %1").arg(err);
|
||||
error = true;
|
||||
} else {
|
||||
errCode = avformat_find_stream_info(fmt_ctx, NULL);
|
||||
errCode = avformat_find_stream_info(fmt_ctx, nullptr);
|
||||
if (errCode < 0) {
|
||||
char err[1024];
|
||||
av_strerror(errCode, err, 1024);
|
||||
errorStr = "Could not find stream information - " + QString(err);
|
||||
errorStr = tr("Could not find stream information - %1").arg(err);
|
||||
error = true;
|
||||
} else {
|
||||
av_dump_format(fmt_ctx, 0, filename, 0);
|
||||
@@ -490,7 +490,7 @@ void PreviewGenerator::run() {
|
||||
}
|
||||
|
||||
delete [] filename;
|
||||
footage->preview_gen = NULL;
|
||||
footage->preview_gen = nullptr;
|
||||
}
|
||||
|
||||
void PreviewGenerator::cancel() {
|
||||
|
||||
@@ -15,7 +15,7 @@ QColor get_color_from_string(const QString& s) {
|
||||
// workaround for alpha
|
||||
if (s.at(0) == '#' && s.length() == 9) {
|
||||
QColor color(s.left(7));
|
||||
color.setAlpha(s.mid(7).toInt(NULL, 16));
|
||||
color.setAlpha(s.mid(7).toInt(nullptr, 16));
|
||||
return color;
|
||||
} else {
|
||||
return QColor(s);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
|
||||
#include "debug.h"
|
||||
#include "project/effect.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
@@ -14,24 +16,29 @@ int main(int argc, char *argv[]) {
|
||||
appName += GITHASH;
|
||||
#endif
|
||||
appName += ")";
|
||||
|
||||
|
||||
bool launch_fullscreen = false;
|
||||
QString load_proj;
|
||||
|
||||
|
||||
qInstallMessageHandler(debug_message_handler);
|
||||
|
||||
if (argc > 1) {
|
||||
for (int i=1;i<argc;i++) {
|
||||
if (argv[i][0] == '-') {
|
||||
if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) {
|
||||
if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-v")) {
|
||||
#ifndef GITHASH
|
||||
printf("[WARNING] No Git commit information found\n");
|
||||
qWarning() << "No Git commit information found";
|
||||
#endif
|
||||
printf("%s\n", appName.toUtf8().constData());
|
||||
return 0;
|
||||
} else if (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) {
|
||||
} else if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
|
||||
printf("Usage: %s [options] [filename]\n\n[filename] is the file to open on startup.\n\nOptions:\n\t-v, --version\tShow version information\n\t-h, --help\tShow this help\n\t-f, --fullscreen\tStart in full screen mode\n\n", argv[0]);
|
||||
return 0;
|
||||
} else if (!strcmp(argv[1], "--fullscreen") || !strcmp(argv[1], "-f")) {
|
||||
} else if (!strcmp(argv[i], "--fullscreen") || !strcmp(argv[i], "-f")) {
|
||||
launch_fullscreen = true;
|
||||
} else if (!strcmp(argv[i], "--disable-shaders")) {
|
||||
shaders_are_enabled = false;
|
||||
|
||||
} else {
|
||||
printf("[ERROR] Unknown argument '%s'\n", argv[1]);
|
||||
return 1;
|
||||
@@ -39,7 +46,7 @@ int main(int argc, char *argv[]) {
|
||||
} else if (load_proj.isEmpty()) {
|
||||
load_proj = argv[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// init ffmpeg subsystem
|
||||
@@ -47,9 +54,9 @@ int main(int argc, char *argv[]) {
|
||||
avfilter_register_all();
|
||||
|
||||
QApplication a(argc, argv);
|
||||
a.setWindowIcon(QIcon(":/icons/olive64.png"));
|
||||
|
||||
MainWindow w;
|
||||
w.appName = appName;
|
||||
MainWindow w(nullptr, appName);
|
||||
w.updateTitle("");
|
||||
|
||||
if (!load_proj.isEmpty()) {
|
||||
|
||||
+337
-230
File diff suppressed because it is too large
Load Diff
+9
-2
@@ -11,7 +11,7 @@ class Timeline;
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
explicit MainWindow(QWidget *parent, const QString& an);
|
||||
void updateTitle(const QString &url);
|
||||
~MainWindow();
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
void load_shortcuts(const QString &fn, bool first = false);
|
||||
void save_shortcuts(const QString &fn);
|
||||
|
||||
QString appName;
|
||||
void load_css_from_file(const QString& fn);
|
||||
|
||||
public slots:
|
||||
void undo();
|
||||
@@ -45,6 +45,7 @@ private slots:
|
||||
void clear_undo_stack();
|
||||
|
||||
void show_about();
|
||||
void show_debug_log();
|
||||
void delete_slot();
|
||||
void select_all();
|
||||
|
||||
@@ -98,9 +99,12 @@ private slots:
|
||||
void set_in_point();
|
||||
void set_out_point();
|
||||
|
||||
void clear_in();
|
||||
void clear_out();
|
||||
void clear_inout();
|
||||
void delete_inout();
|
||||
void ripple_delete_inout();
|
||||
void enable_inout();
|
||||
|
||||
// title safe area functions
|
||||
void set_tsa_disable();
|
||||
@@ -180,6 +184,7 @@ private:
|
||||
QAction* set_name_and_marker;
|
||||
QAction* loop_action;
|
||||
QAction* pause_at_out_point_action;
|
||||
QAction* seek_also_selects;
|
||||
|
||||
// edit menu actions
|
||||
QAction* undo_action;
|
||||
@@ -190,6 +195,8 @@ private:
|
||||
void set_button_action_checked(QAction* a);
|
||||
|
||||
bool enable_launch_with_project;
|
||||
|
||||
QString appName;
|
||||
};
|
||||
|
||||
extern MainWindow* mainWindow;
|
||||
|
||||
@@ -33,6 +33,8 @@ system("which git") {
|
||||
DEFINES += GITHASH=\\"\"$$GITHASHVAR\\"\"
|
||||
}
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
@@ -120,7 +122,9 @@ SOURCES += \
|
||||
dialogs/actionsearch.cpp \
|
||||
ui/embeddedfilechooser.cpp \
|
||||
effects/internal/fillleftrighteffect.cpp \
|
||||
effects/internal/voideffect.cpp
|
||||
effects/internal/voideffect.cpp \
|
||||
dialogs/texteditdialog.cpp \
|
||||
dialogs/debugdialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
mainwindow.h \
|
||||
@@ -210,16 +214,18 @@ HEADERS += \
|
||||
dialogs/actionsearch.h \
|
||||
ui/embeddedfilechooser.h \
|
||||
effects/internal/fillleftrighteffect.h \
|
||||
effects/internal/voideffect.h
|
||||
effects/internal/voideffect.h \
|
||||
dialogs/texteditdialog.h \
|
||||
dialogs/debugdialog.h
|
||||
|
||||
FORMS +=
|
||||
|
||||
win32 {
|
||||
RC_FILE = packaging/windows/resources.rc
|
||||
LIBS += -lavutil -lavformat -lavcodec -lavfilter -lswscale -lswresample -lopengl32 -luser32
|
||||
|
||||
SOURCES += effects/internal/vsthostwin.cpp
|
||||
HEADERS += effects/internal/vsthostwin.h
|
||||
|
||||
SOURCES += effects/internal/vsthostwin.cpp
|
||||
HEADERS += effects/internal/vsthostwin.h
|
||||
}
|
||||
|
||||
mac {
|
||||
|
||||
+36
-32
@@ -34,7 +34,7 @@ EffectControls::EffectControls(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
multiple(false),
|
||||
zoom(1),
|
||||
panel_name("Effects: "),
|
||||
panel_name(tr("Effects: ")),
|
||||
mode(TA_NO_TRANSITION)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
@@ -78,14 +78,14 @@ void EffectControls::menu_select(QAction* q) {
|
||||
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 (c->get_opening_transition() == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, 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() == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, meta, TA_CLOSING_TRANSITION, 30));
|
||||
}
|
||||
} else {
|
||||
ca->append(new AddEffectCommand(c, NULL, meta));
|
||||
ca->append(new AddEffectCommand(c, nullptr, meta));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ void EffectControls::copy(bool del) {
|
||||
bool cleared = false;
|
||||
|
||||
ComboAction* ca = new ComboAction();
|
||||
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : NULL;
|
||||
EffectDeleteCommand* del_com = (del) ? new EffectDeleteCommand() : nullptr;
|
||||
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++) {
|
||||
@@ -124,16 +124,16 @@ void EffectControls::copy(bool del) {
|
||||
clipboard_type = CLIPBOARD_TYPE_EFFECT;
|
||||
}
|
||||
|
||||
clipboard.append(effect->copy(NULL));
|
||||
clipboard.append(effect->copy(nullptr));
|
||||
|
||||
if (del_com != NULL) {
|
||||
if (del_com != nullptr) {
|
||||
del_com->clips.append(c);
|
||||
del_com->fx.append(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (del_com != NULL) {
|
||||
if (del_com != nullptr) {
|
||||
if (del_com->clips.size() > 0) {
|
||||
ca->append(del_com);
|
||||
} else {
|
||||
@@ -168,7 +168,7 @@ void EffectControls::show_effect_menu(int type, int subtype) {
|
||||
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() != nullptr) {
|
||||
if (action->menu()->title() == em.category) {
|
||||
parent = action->menu();
|
||||
found = true;
|
||||
@@ -214,20 +214,20 @@ void EffectControls::show_effect_menu(int type, int subtype) {
|
||||
|
||||
void EffectControls::clear_effects(bool clear_cache) {
|
||||
// clear existing clips
|
||||
deselect_all_effects(NULL);
|
||||
deselect_all_effects(nullptr);
|
||||
|
||||
// clear graph editor
|
||||
if (panel_graph_editor != NULL) panel_graph_editor->set_row(NULL);
|
||||
if (panel_graph_editor != nullptr) panel_graph_editor->set_row(nullptr);
|
||||
|
||||
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);
|
||||
item->widget()->setParent(nullptr);
|
||||
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);
|
||||
item->widget()->setParent(nullptr);
|
||||
disconnect(static_cast<CollapsibleWidget*>(item->widget()), SIGNAL(deselect_others(QWidget*)), this, SLOT(deselect_all_effects(QWidget*)));
|
||||
}
|
||||
lblMultipleClipsSelected->setVisible(false);
|
||||
@@ -260,9 +260,9 @@ void EffectControls::open_effect(QVBoxLayout* layout, Effect* e) {
|
||||
void EffectControls::setup_ui() {
|
||||
QWidget* contents = new QWidget();
|
||||
|
||||
QHBoxLayout* layout = new QHBoxLayout(contents);
|
||||
layout->setSpacing(0);
|
||||
layout->setMargin(0);
|
||||
QHBoxLayout* hlayout = new QHBoxLayout(contents);
|
||||
hlayout->setSpacing(0);
|
||||
hlayout->setMargin(0);
|
||||
|
||||
QSplitter* splitter = new QSplitter(contents);
|
||||
splitter->setOrientation(Qt::Horizontal);
|
||||
@@ -303,7 +303,7 @@ void EffectControls::setup_ui() {
|
||||
|
||||
QPushButton* btnAddVideoEffect = new QPushButton(veHeader);
|
||||
btnAddVideoEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||
btnAddVideoEffect->setToolTip("Add Video Effect");
|
||||
btnAddVideoEffect->setToolTip(tr("Add Video Effect"));
|
||||
veHeaderLayout->addWidget(btnAddVideoEffect);
|
||||
connect(btnAddVideoEffect, SIGNAL(clicked(bool)), this, SLOT(video_effect_click()));
|
||||
|
||||
@@ -314,14 +314,14 @@ void EffectControls::setup_ui() {
|
||||
font.setPointSize(9);
|
||||
lblVideoEffects->setFont(font);
|
||||
lblVideoEffects->setAlignment(Qt::AlignCenter);
|
||||
lblVideoEffects->setText("VIDEO EFFECTS");
|
||||
lblVideoEffects->setText(tr("VIDEO EFFECTS"));
|
||||
veHeaderLayout->addWidget(lblVideoEffects);
|
||||
|
||||
veHeaderLayout->addStretch();
|
||||
|
||||
QPushButton* btnAddVideoTransition = new QPushButton(veHeader);
|
||||
btnAddVideoTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||
btnAddVideoTransition->setToolTip("Add Video Transition");
|
||||
btnAddVideoTransition->setToolTip(tr("Add Video Transition"));
|
||||
connect(btnAddVideoTransition, SIGNAL(clicked(bool)), this, SLOT(video_transition_click()));
|
||||
|
||||
veHeaderLayout->addWidget(btnAddVideoTransition);
|
||||
@@ -351,7 +351,7 @@ void EffectControls::setup_ui() {
|
||||
|
||||
QPushButton* btnAddAudioEffect = new QPushButton(aeHeader);
|
||||
btnAddAudioEffect->setIcon(QIcon(":/icons/add-effect.png"));
|
||||
btnAddAudioEffect->setToolTip("Add Audio Effect");
|
||||
btnAddAudioEffect->setToolTip(tr("Add Audio Effect"));
|
||||
connect(btnAddAudioEffect, SIGNAL(clicked(bool)), this, SLOT(audio_effect_click()));
|
||||
aeHeaderLayout->addWidget(btnAddAudioEffect);
|
||||
|
||||
@@ -360,14 +360,14 @@ void EffectControls::setup_ui() {
|
||||
QLabel* lblAudioEffects = new QLabel(aeHeader);
|
||||
lblAudioEffects->setFont(font);
|
||||
lblAudioEffects->setAlignment(Qt::AlignCenter);
|
||||
lblAudioEffects->setText("AUDIO EFFECTS");
|
||||
lblAudioEffects->setText(tr("AUDIO EFFECTS"));
|
||||
aeHeaderLayout->addWidget(lblAudioEffects);
|
||||
|
||||
aeHeaderLayout->addStretch();
|
||||
|
||||
QPushButton* btnAddAudioTransition = new QPushButton(aeHeader);
|
||||
btnAddAudioTransition->setIcon(QIcon(":/icons/add-transition.png"));
|
||||
btnAddAudioTransition->setToolTip("Add Audio Transition");
|
||||
btnAddAudioTransition->setToolTip(tr("Add Audio Transition"));
|
||||
connect(btnAddAudioTransition, SIGNAL(clicked(bool)), this, SLOT(audio_transition_click()));
|
||||
aeHeaderLayout->addWidget(btnAddAudioTransition);
|
||||
|
||||
@@ -384,7 +384,7 @@ void EffectControls::setup_ui() {
|
||||
|
||||
lblMultipleClipsSelected = new QLabel(effects_area);
|
||||
lblMultipleClipsSelected->setAlignment(Qt::AlignCenter);
|
||||
lblMultipleClipsSelected->setText("(Multiple clips selected)");
|
||||
lblMultipleClipsSelected->setText(tr("(Multiple clips selected)"));
|
||||
effects_area_layout->addWidget(lblMultipleClipsSelected);
|
||||
|
||||
effects_area_layout->addStretch();
|
||||
@@ -431,7 +431,7 @@ void EffectControls::setup_ui() {
|
||||
|
||||
splitter->addWidget(keyframeArea);
|
||||
|
||||
layout->addWidget(splitter);
|
||||
hlayout->addWidget(splitter);
|
||||
|
||||
setWidget(contents);
|
||||
}
|
||||
@@ -455,9 +455,9 @@ void EffectControls::load_effects() {
|
||||
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) {
|
||||
} else if (mode == TA_OPENING_TRANSITION && c->get_opening_transition() != nullptr) {
|
||||
open_effect(layout, c->get_opening_transition());
|
||||
} else if (mode == TA_CLOSING_TRANSITION && c->get_closing_transition() != NULL) {
|
||||
} else if (mode == TA_CLOSING_TRANSITION && c->get_closing_transition() != nullptr) {
|
||||
open_effect(layout, c->get_closing_transition());
|
||||
}
|
||||
}
|
||||
@@ -533,21 +533,25 @@ 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) {
|
||||
if (c != nullptr) {
|
||||
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";
|
||||
qWarning() << "Tried to check focus of a nullptr clip";
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
EffectsArea::EffectsArea(QWidget* parent) : QWidget(parent) {}
|
||||
EffectsArea::EffectsArea(QWidget* parent) :
|
||||
QWidget(parent)
|
||||
{}
|
||||
|
||||
void EffectsArea::resizeEvent(QResizeEvent*) {
|
||||
parent_widget->setMinimumWidth(sizeHint().width());
|
||||
// parent_widget->setMinimumWidth(sizeHint().width());
|
||||
// parent_widget->resize(sizeHint().width(), parent_widget->height());
|
||||
// parent_widget->updateGeometry();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ class ResizableScrollBar;
|
||||
class QLabel;
|
||||
class KeyframeView;
|
||||
class QScrollBar;
|
||||
class QHBoxLayout;
|
||||
|
||||
class EffectsArea : public QWidget {
|
||||
public:
|
||||
@@ -53,6 +54,8 @@ public:
|
||||
QScrollBar* verticalScrollBar;
|
||||
|
||||
QMutex effects_loaded;
|
||||
|
||||
|
||||
public slots:
|
||||
void update_keyframes();
|
||||
private slots:
|
||||
@@ -70,7 +73,7 @@ private:
|
||||
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* hlayout, Effect* e);
|
||||
|
||||
void setup_ui();
|
||||
|
||||
|
||||
+14
-10
@@ -17,10 +17,10 @@
|
||||
#include "panels.h"
|
||||
#include "debug.h"
|
||||
|
||||
GraphEditor::GraphEditor(QWidget* parent) : QDockWidget(parent), row(NULL) {
|
||||
GraphEditor::GraphEditor(QWidget* parent) : QDockWidget(parent), row(nullptr) {
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
setWindowTitle("Graph Editor");
|
||||
setWindowTitle(tr("Graph Editor"));
|
||||
resize(720, 480);
|
||||
|
||||
QWidget* main_widget = new QWidget();
|
||||
@@ -58,13 +58,13 @@ GraphEditor::GraphEditor(QWidget* parent) : QDockWidget(parent), row(NULL) {
|
||||
left_tool_layout->addWidget(keyframe_nav);
|
||||
left_tool_layout->addStretch();
|
||||
|
||||
linear_button = new QPushButton("Linear");
|
||||
linear_button = new QPushButton(tr("Linear"));
|
||||
linear_button->setProperty("type", KEYFRAME_TYPE_LINEAR);
|
||||
linear_button->setCheckable(true);
|
||||
bezier_button = new QPushButton("Bezier");
|
||||
bezier_button = new QPushButton(tr("Bezier"));
|
||||
bezier_button->setProperty("type", KEYFRAME_TYPE_BEZIER);
|
||||
bezier_button->setCheckable(true);
|
||||
hold_button = new QPushButton("Hold");
|
||||
hold_button = new QPushButton(tr("Hold"));
|
||||
hold_button->setProperty("type", KEYFRAME_TYPE_HOLD);
|
||||
hold_button->setCheckable(true);
|
||||
|
||||
@@ -120,7 +120,7 @@ GraphEditor::GraphEditor(QWidget* parent) : QDockWidget(parent), row(NULL) {
|
||||
|
||||
void GraphEditor::update_panel() {
|
||||
if (isVisible()) {
|
||||
if (row != NULL) {
|
||||
if (row != nullptr) {
|
||||
int slider_index = 0;
|
||||
for (int i=0;i<row->fieldCount();i++) {
|
||||
EffectField* field = row->field(i);
|
||||
@@ -145,7 +145,7 @@ void GraphEditor::set_row(EffectRow *r) {
|
||||
slider_proxy_buttons.clear();
|
||||
slider_proxy_sources.clear();
|
||||
|
||||
if (row != NULL) {
|
||||
if (row != nullptr) {
|
||||
// clear old row connections
|
||||
disconnect(keyframe_nav, SIGNAL(goto_previous_key()), row, SLOT(goto_previous_key()));
|
||||
disconnect(keyframe_nav, SIGNAL(toggle_key()), row, SLOT(toggle_key()));
|
||||
@@ -154,7 +154,7 @@ void GraphEditor::set_row(EffectRow *r) {
|
||||
|
||||
bool found_vals = false;
|
||||
|
||||
if (r != NULL && r->isKeyframing()) {
|
||||
if (r != nullptr && r->isKeyframing()) {
|
||||
for (int i=0;i<r->fieldCount();i++) {
|
||||
EffectField* field = r->field(i);
|
||||
if (field->type == EFFECT_FIELD_DOUBLE) {
|
||||
@@ -191,7 +191,7 @@ void GraphEditor::set_row(EffectRow *r) {
|
||||
connect(keyframe_nav, SIGNAL(toggle_key()), row, SLOT(toggle_key()));
|
||||
connect(keyframe_nav, SIGNAL(goto_next_key()), row, SLOT(goto_next_key()));
|
||||
} else {
|
||||
row = NULL;
|
||||
row = nullptr;
|
||||
current_row_desc->setText(0);
|
||||
}
|
||||
view->set_row(row);
|
||||
@@ -199,7 +199,11 @@ void GraphEditor::set_row(EffectRow *r) {
|
||||
}
|
||||
|
||||
bool GraphEditor::view_is_focused() {
|
||||
return view->hasFocus() || header->hasFocus();
|
||||
return view->hasFocus() || header->hasFocus();
|
||||
}
|
||||
|
||||
bool GraphEditor::view_is_under_mouse() {
|
||||
return view->underMouse() || header->underMouse();
|
||||
}
|
||||
|
||||
void GraphEditor::delete_selected_keys() {
|
||||
|
||||
@@ -19,6 +19,7 @@ public:
|
||||
void update_panel();
|
||||
void set_row(EffectRow* r);
|
||||
bool view_is_focused();
|
||||
bool view_is_under_mouse();
|
||||
void delete_selected_keys();
|
||||
void select_all();
|
||||
private:
|
||||
|
||||
+15
-11
@@ -30,10 +30,10 @@ void update_effect_controls() {
|
||||
int aclip = -1;
|
||||
QVector<int> selected_clips;
|
||||
int mode = TA_NO_TRANSITION;
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* clip = sequence->clips.at(i);
|
||||
if (clip != NULL) {
|
||||
if (clip != nullptr) {
|
||||
for (int j=0;j<sequence->selections.size();j++) {
|
||||
const Selection& s = sequence->selections.at(j);
|
||||
bool add = true;
|
||||
@@ -113,7 +113,7 @@ void update_ui(bool modified) {
|
||||
}
|
||||
|
||||
QDockWidget *get_focused_panel() {
|
||||
QDockWidget* w = NULL;
|
||||
QDockWidget* w = nullptr;
|
||||
if (config.hover_focus) {
|
||||
if (panel_project->underMouse()) {
|
||||
w = panel_project;
|
||||
@@ -125,9 +125,11 @@ QDockWidget *get_focused_panel() {
|
||||
w = panel_footage_viewer;
|
||||
} else if (panel_timeline->underMouse()) {
|
||||
w = panel_timeline;
|
||||
}
|
||||
} else if (panel_graph_editor->view_is_under_mouse()) {
|
||||
w = panel_graph_editor;
|
||||
}
|
||||
}
|
||||
if (w == NULL) {
|
||||
if (w == nullptr) {
|
||||
if (panel_project->is_focused()) {
|
||||
w = panel_project;
|
||||
} else if (panel_effect_controls->keyframe_focus() || panel_effect_controls->is_focused()) {
|
||||
@@ -138,7 +140,9 @@ QDockWidget *get_focused_panel() {
|
||||
w = panel_footage_viewer;
|
||||
} else if (panel_timeline->focused()) {
|
||||
w = panel_timeline;
|
||||
}
|
||||
} else if (panel_graph_editor->view_is_focused()) {
|
||||
w = panel_graph_editor;
|
||||
}
|
||||
}
|
||||
return w;
|
||||
}
|
||||
@@ -162,15 +166,15 @@ void alloc_panels(QWidget* parent) {
|
||||
|
||||
void free_panels() {
|
||||
delete panel_sequence_viewer;
|
||||
panel_sequence_viewer = NULL;
|
||||
panel_sequence_viewer = nullptr;
|
||||
delete panel_footage_viewer;
|
||||
panel_footage_viewer = NULL;
|
||||
panel_footage_viewer = nullptr;
|
||||
delete panel_project;
|
||||
panel_project = NULL;
|
||||
panel_project = nullptr;
|
||||
delete panel_effect_controls;
|
||||
panel_effect_controls = NULL;
|
||||
panel_effect_controls = nullptr;
|
||||
delete panel_timeline;
|
||||
panel_timeline = NULL;
|
||||
panel_timeline = nullptr;
|
||||
}
|
||||
|
||||
void scroll_to_frame_internal(QScrollBar* bar, long frame, double zoom, int area_width) {
|
||||
|
||||
+89
-66
@@ -203,7 +203,7 @@ Project::Project(QWidget *parent) :
|
||||
connect(icon_view, SIGNAL(changed_root()), this, SLOT(set_up_dir_enabled()));
|
||||
|
||||
//retranslateUi(Project);
|
||||
setWindowTitle(QApplication::translate("Project", "Project", nullptr));
|
||||
setWindowTitle(tr("Project"));
|
||||
|
||||
update_view_type();
|
||||
}
|
||||
@@ -213,7 +213,7 @@ Project::~Project() {
|
||||
}
|
||||
|
||||
QString Project::get_next_sequence_name(QString start) {
|
||||
if (start.isEmpty()) start = "Sequence";
|
||||
if (start.isEmpty()) start = tr("Sequence");
|
||||
|
||||
int n = 1;
|
||||
bool found = true;
|
||||
@@ -262,7 +262,7 @@ Sequence* create_sequence_from_media(QVector<Media*>& media_list) {
|
||||
const FootageStream& ms = m->video_tracks.at(j);
|
||||
s->width = ms.video_width;
|
||||
s->height = ms.video_height;
|
||||
if (ms.video_frame_rate != 0) {
|
||||
if (!qFuzzyCompare(ms.video_frame_rate, 0.0)) {
|
||||
s->frame_rate = ms.video_frame_rate * m->speed;
|
||||
|
||||
if (ms.video_interlacing != VIDEO_PROGRESSIVE) s->frame_rate *= 2;
|
||||
@@ -273,13 +273,10 @@ Sequence* create_sequence_from_media(QVector<Media*>& media_list) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!got_audio_values) {
|
||||
for (int j=0;j<m->audio_tracks.size();j++) {
|
||||
const FootageStream& ms = m->audio_tracks.at(j);
|
||||
s->audio_frequency = ms.audio_frequency;
|
||||
got_audio_values = true;
|
||||
break;
|
||||
}
|
||||
if (!got_audio_values && m->audio_tracks.size() > 0) {
|
||||
const FootageStream& ms = m->audio_tracks.at(0);
|
||||
s->audio_frequency = ms.audio_frequency;
|
||||
got_audio_values = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,7 +306,6 @@ void Project::duplicate_selected() {
|
||||
bool duped = false;
|
||||
ComboAction* ca = new ComboAction();
|
||||
for (int j=0;j<items.size();j++) {
|
||||
dout << "duplicate called";
|
||||
Media* i = item_to_media(items.at(j));
|
||||
if (i->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
new_sequence(ca, i->to_sequence()->copy(), false, item_to_media(items.at(j).parent()));
|
||||
@@ -328,14 +324,18 @@ void Project::replace_selected_file() {
|
||||
if (selected_items.size() == 1) {
|
||||
Media* item = item_to_media(selected_items.at(0));
|
||||
if (item->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
replace_media(item, 0);
|
||||
replace_media(item, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Project::replace_media(Media* item, QString filename) {
|
||||
if (filename.isEmpty()) {
|
||||
filename = QFileDialog::getOpenFileName(this, "Replace '" + item->get_name() + "'", "", "All Files (*)");
|
||||
filename = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
tr("Replace '%1'").arg(item->get_name()),
|
||||
"",
|
||||
tr("All Files") + " (*)");
|
||||
}
|
||||
if (!filename.isEmpty()) {
|
||||
ReplaceMediaCommand* rmc = new ReplaceMediaCommand(item, filename);
|
||||
@@ -344,14 +344,20 @@ void Project::replace_media(Media* item, QString filename) {
|
||||
}
|
||||
|
||||
void Project::replace_clip_media() {
|
||||
if (sequence == NULL) {
|
||||
QMessageBox::critical(this, "No active sequence", "No sequence is active, please open the sequence you want to replace clips from.", QMessageBox::Ok);
|
||||
if (sequence == nullptr) {
|
||||
QMessageBox::critical(this,
|
||||
tr("No active sequence"),
|
||||
tr("No sequence is active, please open the sequence you want to replace clips from."),
|
||||
QMessageBox::Ok);
|
||||
} else {
|
||||
QModelIndexList selected_items = get_current_selected();
|
||||
if (selected_items.size() == 1) {
|
||||
Media* item = item_to_media(selected_items.at(0));
|
||||
if (item->get_type() == MEDIA_TYPE_SEQUENCE && sequence == item->to_sequence()) {
|
||||
QMessageBox::critical(this, "Active sequence selected", "You cannot insert a sequence into itself, so no clips of this media would be in this sequence.", QMessageBox::Ok);
|
||||
QMessageBox::critical(this,
|
||||
tr("Active sequence selected"),
|
||||
tr("You cannot insert a sequence into itself, so no clips of this media would be in this sequence."),
|
||||
QMessageBox::Ok);
|
||||
} else {
|
||||
ReplaceClipMediaDialog dialog(this, item);
|
||||
dialog.exec();
|
||||
@@ -380,7 +386,11 @@ void Project::open_properties() {
|
||||
default:
|
||||
{
|
||||
// fall back to renaming
|
||||
QString new_name = QInputDialog::getText(this, "Rename '" + item->get_name() + "'", "Enter new name:", QLineEdit::Normal, item->get_name());
|
||||
QString new_name = QInputDialog::getText(this,
|
||||
tr("Rename '%1'").arg(item->get_name()),
|
||||
tr("Enter new name:"),
|
||||
QLineEdit::Normal,
|
||||
item->get_name());
|
||||
if (!new_name.isEmpty()) {
|
||||
MediaRename* mr = new MediaRename(item, new_name);
|
||||
undo_stack.push(mr);
|
||||
@@ -391,15 +401,19 @@ void Project::open_properties() {
|
||||
}
|
||||
|
||||
Media* Project::new_sequence(ComboAction *ca, Sequence *s, bool open, Media* parent) {
|
||||
if (parent == NULL) parent = project_model.get_root();
|
||||
if (parent == nullptr) parent = project_model.get_root();
|
||||
Media* item = new Media(parent);
|
||||
item->set_sequence(s);
|
||||
|
||||
if (ca != NULL) {
|
||||
if (ca != nullptr) {
|
||||
ca->append(new NewSequenceCommand(item, parent));
|
||||
if (open) ca->append(new ChangeSequenceAction(s));
|
||||
} else {
|
||||
project_model.appendChild(NULL, item);
|
||||
if (parent == project_model.get_root()) {
|
||||
project_model.appendChild(parent, item);
|
||||
} else {
|
||||
parent->appendChild(item);
|
||||
}
|
||||
if (open) set_sequence(s);
|
||||
}
|
||||
return item;
|
||||
@@ -420,8 +434,9 @@ bool Project::is_focused() {
|
||||
}
|
||||
|
||||
Media* Project::new_folder(QString name) {
|
||||
Media* item = new Media(0);
|
||||
Media* item = new Media(nullptr);
|
||||
item->set_folder();
|
||||
item->set_name(name);
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -488,15 +503,15 @@ void Project::delete_selected_media() {
|
||||
Sequence* s = sequence_items.at(j)->to_sequence();
|
||||
for (int k=0;k<s->clips.size();k++) {
|
||||
Clip* c = s->clips.at(k);
|
||||
if (c != NULL && c->media == item) {
|
||||
if (c != nullptr && c->media == item) {
|
||||
if (!confirm_delete) {
|
||||
// we found a reference, so we know we'll need to ask if the user wants to delete it
|
||||
QMessageBox confirm(this);
|
||||
confirm.setWindowTitle("Delete media in use?");
|
||||
confirm.setText("The media '" + media->name + "' is currently used in '" + s->name + "'. Deleting it will remove all instances in the sequence. Are you sure you want to do this?");
|
||||
confirm.setWindowTitle(tr("Delete media in use?"));
|
||||
confirm.setText(tr("The media '%1' is currently used in '%2'. Deleting it will remove all instances in the sequence. Are you sure you want to do this?").arg(media->name, s->name));
|
||||
QAbstractButton* yes_button = confirm.addButton(QMessageBox::Yes);
|
||||
QAbstractButton* skip_button = NULL;
|
||||
if (items.size() > 1) skip_button = confirm.addButton("Skip", QMessageBox::NoRole);
|
||||
QAbstractButton* skip_button = nullptr;
|
||||
if (items.size() > 1) skip_button = confirm.addButton(tr("Skip"), QMessageBox::NoRole);
|
||||
QAbstractButton* abort_button = confirm.addButton(QMessageBox::Cancel);
|
||||
confirm.exec();
|
||||
if (confirm.clickedButton() == yes_button) {
|
||||
@@ -506,7 +521,7 @@ void Project::delete_selected_media() {
|
||||
} else if (confirm.clickedButton() == skip_button) {
|
||||
// remove media item and any folders containing it from the remove list
|
||||
Media* parent = item;
|
||||
while (parent != NULL) {
|
||||
while (parent != nullptr) {
|
||||
parents.append(parent);
|
||||
|
||||
// re-add item's siblings
|
||||
@@ -553,7 +568,7 @@ void Project::delete_selected_media() {
|
||||
// remove
|
||||
if (remove) {
|
||||
panel_effect_controls->clear_effects(true);
|
||||
if (sequence != NULL) sequence->selections.clear();
|
||||
if (sequence != nullptr) sequence->selections.clear();
|
||||
|
||||
// remove media and parents
|
||||
for (int m=0;m<parents.size();m++) {
|
||||
@@ -574,20 +589,18 @@ void Project::delete_selected_media() {
|
||||
Sequence* s = items.at(i)->to_sequence();
|
||||
|
||||
if (s == sequence) {
|
||||
ca->append(new ChangeSequenceAction(NULL));
|
||||
ca->append(new ChangeSequenceAction(nullptr));
|
||||
}
|
||||
|
||||
if (s == panel_footage_viewer->seq) {
|
||||
panel_footage_viewer->set_media(NULL);
|
||||
panel_footage_viewer->set_media(nullptr);
|
||||
}
|
||||
} else if (items.at(i)->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
if (panel_footage_viewer->seq != NULL) {
|
||||
if (panel_footage_viewer->seq != nullptr) {
|
||||
for (int j=0;j<panel_footage_viewer->seq->clips.size();j++) {
|
||||
Clip* c = panel_footage_viewer->seq->clips.at(j);
|
||||
if (c != NULL) {
|
||||
if (c->media == items.at(i)->to_object()) {
|
||||
panel_footage_viewer->set_media(NULL);
|
||||
}
|
||||
if (c != nullptr && c->media == items.at(i)) {
|
||||
panel_footage_viewer->set_media(nullptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -627,8 +640,8 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
|
||||
if (!recursive) last_imported_media.clear();
|
||||
|
||||
bool create_undo_action = (!recursive && replace == NULL);
|
||||
ComboAction* ca;
|
||||
bool create_undo_action = (!recursive && replace == nullptr);
|
||||
ComboAction* ca = nullptr;
|
||||
if (create_undo_action) ca = new ComboAction();
|
||||
|
||||
for (int i=0;i<files.size();i++) {
|
||||
@@ -646,7 +659,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
subdir_filenames.append(subdir_files.at(j).filePath());
|
||||
}
|
||||
|
||||
process_file_list(subdir_filenames, true, NULL, folder);
|
||||
process_file_list(subdir_filenames, true, nullptr, folder);
|
||||
|
||||
if (create_undo_action) {
|
||||
ca->append(new AddMediaCommand(folder, parent));
|
||||
@@ -721,7 +734,11 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
}
|
||||
if (!found) {
|
||||
image_sequence_urls.append(new_filename);
|
||||
if (QMessageBox::question(this, "Image sequence detected", "The file '" + file + "' appears to be part of an image sequence. Would you like to import it as such?", QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) {
|
||||
if (QMessageBox::question(this,
|
||||
tr("Image sequence detected"),
|
||||
tr("The file '%1' appears to be part of an image sequence. Would you like to import it as such?").arg(file),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::Yes) == QMessageBox::Yes) {
|
||||
file = new_filename;
|
||||
image_sequence_importassequence.append(true);
|
||||
} else {
|
||||
@@ -735,7 +752,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
Media* item;
|
||||
Footage* m;
|
||||
|
||||
if (replace != NULL) {
|
||||
if (replace != nullptr) {
|
||||
item = replace;
|
||||
m = replace->to_footage();
|
||||
m->reset();
|
||||
@@ -750,16 +767,14 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
|
||||
item->set_footage(m);
|
||||
|
||||
// generate waveform/thumbnail in another thread
|
||||
start_preview_generator(item, replace != NULL);
|
||||
|
||||
last_imported_media.append(item);
|
||||
|
||||
if (replace == NULL) {
|
||||
if (replace == nullptr) {
|
||||
if (create_undo_action) {
|
||||
ca->append(new AddMediaCommand(item, parent));
|
||||
} else {
|
||||
project_model.appendChild(parent, item);
|
||||
parent->appendChild(item);
|
||||
// project_model.appendChild(parent, item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -770,6 +785,11 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla
|
||||
if (create_undo_action) {
|
||||
if (imported) {
|
||||
undo_stack.push(ca);
|
||||
|
||||
for (int i=0;i<last_imported_media.size();i++) {
|
||||
// generate waveform/thumbnail in another thread
|
||||
start_preview_generator(last_imported_media.at(i), replace != nullptr);
|
||||
}
|
||||
} else {
|
||||
delete ca;
|
||||
}
|
||||
@@ -783,7 +803,7 @@ Media* Project::get_selected_folder() {
|
||||
Media* m = item_to_media(selected_items.at(0));
|
||||
if (m->get_type() == MEDIA_TYPE_FOLDER) return m;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Project::reveal_media(Media *media, QModelIndex parent) {
|
||||
@@ -821,25 +841,28 @@ bool Project::reveal_media(Media *media, QModelIndex parent) {
|
||||
}
|
||||
|
||||
void Project::import_dialog() {
|
||||
QFileDialog fd(this, "Import media...", "", "All Files (*)");
|
||||
QFileDialog fd(this, tr("Import media..."), "", tr("All Files") + " (*)");
|
||||
fd.setFileMode(QFileDialog::ExistingFiles);
|
||||
|
||||
if (fd.exec()) {
|
||||
QStringList files = fd.selectedFiles();
|
||||
process_file_list(files, false, NULL, get_selected_folder());
|
||||
process_file_list(files, false, nullptr, get_selected_folder());
|
||||
}
|
||||
}
|
||||
|
||||
void Project::delete_clips_using_selected_media() {
|
||||
if (sequence == NULL) {
|
||||
QMessageBox::critical(this, "No active sequence", "No sequence is active, please open the sequence you want to delete clips from.", QMessageBox::Ok);
|
||||
if (sequence == nullptr) {
|
||||
QMessageBox::critical(this,
|
||||
tr("No active sequence"),
|
||||
tr("No sequence is active, please open the sequence you want to delete clips from."),
|
||||
QMessageBox::Ok);
|
||||
} else {
|
||||
ComboAction* ca = new ComboAction();
|
||||
bool deleted = false;
|
||||
QModelIndexList items = get_current_selected();
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<items.size();j++) {
|
||||
Media* m = item_to_media(items.at(j));
|
||||
if (c->media == m) {
|
||||
@@ -870,7 +893,7 @@ void Project::clear() {
|
||||
QVector<Media*> sequences = list_all_project_sequences();
|
||||
for (int i=0;i<sequences.size();i++) {
|
||||
delete sequences.at(i)->to_sequence();
|
||||
sequences.at(i)->set_sequence(NULL);
|
||||
sequences.at(i)->set_sequence(nullptr);
|
||||
}
|
||||
|
||||
// delete everything else
|
||||
@@ -879,8 +902,8 @@ void Project::clear() {
|
||||
|
||||
void Project::new_project() {
|
||||
// clear existing project
|
||||
set_sequence(NULL);
|
||||
panel_footage_viewer->set_media(NULL);
|
||||
set_sequence(nullptr);
|
||||
panel_footage_viewer->set_media(nullptr);
|
||||
clear();
|
||||
mainWindow->setWindowModified(false);
|
||||
}
|
||||
@@ -893,7 +916,6 @@ void Project::load_project(bool autorecovery) {
|
||||
}
|
||||
|
||||
void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only, const QModelIndex& parent) {
|
||||
bool root = (!parent.parent().isValid());
|
||||
for (int i=0;i<project_model.rowCount(parent);i++) {
|
||||
const QModelIndex& item = project_model.index(i, 0, parent);
|
||||
Media* m = project_model.getItem(item);
|
||||
@@ -917,7 +939,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
}
|
||||
// save_folder(stream, item, type, set_ids_only);
|
||||
} else {
|
||||
int folder = root ? 0 : project_model.getItem(parent)->temp_id;
|
||||
int folder = (m->parentItem() != nullptr) ? m->parentItem()->temp_id : 0;
|
||||
if (type == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = m->to_footage();
|
||||
f->save_id = media_id;
|
||||
@@ -971,12 +993,13 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
stream.writeAttribute("open", "1");
|
||||
}
|
||||
stream.writeAttribute("workarea", QString::number(s->using_workarea));
|
||||
stream.writeAttribute("workareaEnabled", QString::number(s->enable_workarea));
|
||||
stream.writeAttribute("workareaIn", QString::number(s->workarea_in));
|
||||
stream.writeAttribute("workareaOut", QString::number(s->workarea_out));
|
||||
|
||||
for (int j=0;j<s->transitions.size();j++) {
|
||||
Transition* t = s->transitions.at(j);
|
||||
if (t != NULL) {
|
||||
if (t != nullptr) {
|
||||
stream.writeStartElement("transition");
|
||||
stream.writeAttribute("id", QString::number(j));
|
||||
stream.writeAttribute("length", QString::number(t->get_true_length()));
|
||||
@@ -987,7 +1010,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
Clip* c = s->clips.at(j);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
stream.writeStartElement("clip"); // clip
|
||||
stream.writeAttribute("id", QString::number(j));
|
||||
stream.writeAttribute("enabled", QString::number(c->enabled));
|
||||
@@ -1008,7 +1031,7 @@ void Project::save_folder(QXmlStreamWriter& stream, int type, bool set_ids_only,
|
||||
stream.writeAttribute("maintainpitch", QString::number(c->maintain_audio_pitch));
|
||||
stream.writeAttribute("reverse", QString::number(c->reverse));
|
||||
|
||||
if (c->media != NULL) {
|
||||
if (c->media != nullptr) {
|
||||
stream.writeAttribute("type", QString::number(c->media->get_type()));
|
||||
switch (c->media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
@@ -1063,7 +1086,7 @@ void Project::save_project(bool autorecovery) {
|
||||
|
||||
QFile file(autorecovery ? autorecovery_filename : project_url);
|
||||
if (!file.open(QIODevice::WriteOnly/* | QIODevice::Text*/)) {
|
||||
dout << "[ERROR] Could not open file";
|
||||
qCritical() << "Could not open file";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1143,7 +1166,7 @@ void Project::save_recent_projects() {
|
||||
}
|
||||
f.close();
|
||||
} else {
|
||||
dout << "[WARNING] Could not save recent projects";
|
||||
qWarning() << "Could not save recent projects";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1205,7 +1228,7 @@ void Project::list_all_sequences_worker(QVector<Media*>* list, Media* parent) {
|
||||
|
||||
QVector<Media*> Project::list_all_project_sequences() {
|
||||
QVector<Media*> list;
|
||||
list_all_sequences_worker(&list, NULL);
|
||||
list_all_sequences_worker(&list, nullptr);
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -1219,7 +1242,7 @@ QModelIndexList Project::get_current_selected() {
|
||||
#define THROBBER_LIMIT 20
|
||||
#define THROBBER_SIZE 50
|
||||
|
||||
MediaThrobber::MediaThrobber(Media *i) : pixmap(":/icons/throbber.png"), animation(0), item(i), animator(NULL) {}
|
||||
MediaThrobber::MediaThrobber(Media *i) : pixmap(":/icons/throbber.png"), animation(0), item(i), animator(nullptr) {}
|
||||
|
||||
void MediaThrobber::start() {
|
||||
// set up throbber
|
||||
@@ -1239,7 +1262,7 @@ void MediaThrobber::animation_update() {
|
||||
}
|
||||
|
||||
void MediaThrobber::stop(int icon_type, bool replace) {
|
||||
if (animator != NULL) {
|
||||
if (animator != nullptr) {
|
||||
animator->stop();
|
||||
delete animator;
|
||||
}
|
||||
@@ -1257,7 +1280,7 @@ void MediaThrobber::stop(int icon_type, bool replace) {
|
||||
Sequence* s = sequences.at(i)->to_sequence();
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
Clip* c = s->clips.at(j);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
c->refresh();
|
||||
}
|
||||
}
|
||||
@@ -1267,6 +1290,6 @@ void MediaThrobber::stop(int icon_type, bool replace) {
|
||||
update_ui(replace);
|
||||
|
||||
panel_project->tree_view->viewport()->update();
|
||||
item->throbber = NULL;
|
||||
item->throbber = nullptr;
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public:
|
||||
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 process_file_list(QStringList& files, bool recursive = false, Media* replace = nullptr, Media *parent = nullptr);
|
||||
void replace_media(Media* item, QString filename);
|
||||
Media *get_selected_folder();
|
||||
bool reveal_media(Media *media, QModelIndex parent = QModelIndex());
|
||||
|
||||
+127
-108
@@ -40,7 +40,7 @@
|
||||
#include <QStatusBar>
|
||||
|
||||
long refactor_frame_number(long framenumber, double source_frame_rate, double target_frame_rate) {
|
||||
return qRound(((double)framenumber/source_frame_rate)*target_frame_rate);
|
||||
return qRound((double(framenumber)/source_frame_rate)*target_frame_rate);
|
||||
}
|
||||
|
||||
Timeline::Timeline(QWidget *parent) :
|
||||
@@ -78,7 +78,7 @@ Timeline::Timeline(QWidget *parent) :
|
||||
|
||||
setup_ui();
|
||||
|
||||
default_track_height = (QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96) * TRACK_DEFAULT_HEIGHT;
|
||||
default_track_height = qRound((QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96) * TRACK_DEFAULT_HEIGHT);
|
||||
|
||||
headers->viewer = panel_sequence_viewer;
|
||||
|
||||
@@ -112,7 +112,7 @@ void Timeline::previous_cut() {
|
||||
long p_cut = 0;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
if (c->timeline_out > p_cut && c->timeline_out < sequence->playhead) {
|
||||
p_cut = c->timeline_out;
|
||||
} else if (c->timeline_in > p_cut && c->timeline_in < sequence->playhead) {
|
||||
@@ -129,7 +129,7 @@ void Timeline::next_cut() {
|
||||
long n_cut = LONG_MAX;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
if (c->timeline_in < n_cut && c->timeline_in > sequence->playhead) {
|
||||
n_cut = c->timeline_in;
|
||||
seek_enabled = true;
|
||||
@@ -150,7 +150,7 @@ void Timeline::toggle_show_all() {
|
||||
showing_all = !showing_all;
|
||||
if (showing_all) {
|
||||
old_zoom = zoom;
|
||||
set_zoom_value((double) (timeline_area->width() - 200) / (double) sequence->getEndFrame());
|
||||
set_zoom_value(double(timeline_area->width() - 200) / double(sequence->getEndFrame()));
|
||||
} else {
|
||||
set_zoom_value(old_zoom);
|
||||
}
|
||||
@@ -164,17 +164,15 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
||||
bool can_import = true;
|
||||
|
||||
Media* medium = media_list.at(i);
|
||||
Footage* m = NULL;
|
||||
Sequence* s = NULL;
|
||||
void* media = NULL;
|
||||
long sequence_length;
|
||||
Footage* m = nullptr;
|
||||
Sequence* s = nullptr;
|
||||
long sequence_length = 0;
|
||||
long default_clip_in = 0;
|
||||
long default_clip_out = 0;
|
||||
|
||||
switch (medium->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
m = medium->to_footage();
|
||||
media = m;
|
||||
can_import = m->ready;
|
||||
if (m->using_inout) {
|
||||
double source_fr = 30;
|
||||
@@ -186,8 +184,7 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
s = medium->to_sequence();
|
||||
sequence_length = s->getEndFrame();
|
||||
if (seq != NULL) sequence_length = refactor_frame_number(sequence_length, s->frame_rate, seq->frame_rate);
|
||||
media = s;
|
||||
if (seq != nullptr) sequence_length = refactor_frame_number(sequence_length, s->frame_rate, seq->frame_rate);
|
||||
can_import = (s != seq && sequence_length != 0);
|
||||
if (s->using_workarea) {
|
||||
default_clip_in = refactor_frame_number(s->workarea_in, s->frame_rate, seq->frame_rate);
|
||||
@@ -205,7 +202,7 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
||||
g.old_clip_in = g.clip_in = default_clip_in;
|
||||
g.media = medium;
|
||||
g.in = entry_point;
|
||||
g.transition = NULL;
|
||||
g.transition = nullptr;
|
||||
|
||||
switch (medium->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
@@ -240,7 +237,7 @@ void Timeline::create_ghosts_from_media(Sequence* seq, long entry_point, QVector
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
g.out = entry_point + sequence_length - default_clip_in;
|
||||
|
||||
if (s->using_workarea) {
|
||||
if (s->using_workarea && s->enable_workarea) {
|
||||
g.out -= (sequence_length - default_clip_out);
|
||||
}
|
||||
|
||||
@@ -354,13 +351,13 @@ void Timeline::add_transition() {
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && is_clip_selected(c, true)) {
|
||||
if (c->get_opening_transition() == NULL) {
|
||||
ca->append(new AddTransitionCommand(c, NULL, NULL, get_internal_meta(TRANSITION_INTERNAL_LINEARFADE, EFFECT_TYPE_TRANSITION), TA_OPENING_TRANSITION, 30));
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
if (c->get_opening_transition() == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, get_internal_meta(TRANSITION_INTERNAL_LINEARFADE, EFFECT_TYPE_TRANSITION), TA_OPENING_TRANSITION, 30));
|
||||
adding = true;
|
||||
}
|
||||
if (c->get_closing_transition() == NULL) {
|
||||
ca->append(new AddTransitionCommand(c, NULL, NULL, get_internal_meta(TRANSITION_INTERNAL_LINEARFADE, EFFECT_TYPE_TRANSITION), TA_OPENING_TRANSITION, 30));
|
||||
if (c->get_closing_transition() == nullptr) {
|
||||
ca->append(new AddTransitionCommand(c, nullptr, nullptr, get_internal_meta(TRANSITION_INTERNAL_LINEARFADE, EFFECT_TYPE_TRANSITION), TA_OPENING_TRANSITION, 30));
|
||||
adding = true;
|
||||
}
|
||||
}
|
||||
@@ -388,7 +385,7 @@ int Timeline::calculate_track_height(int track, int value) {
|
||||
}
|
||||
|
||||
void Timeline::update_sequence() {
|
||||
bool null_sequence = (sequence == NULL);
|
||||
bool null_sequence = (sequence == nullptr);
|
||||
|
||||
for (int i=0;i<tool_buttons.count();i++) {
|
||||
tool_buttons[i]->setEnabled(!null_sequence);
|
||||
@@ -400,10 +397,11 @@ void Timeline::update_sequence() {
|
||||
addButton->setEnabled(!null_sequence);
|
||||
headers->setEnabled(!null_sequence);
|
||||
|
||||
QString title = tr("Timeline: ");
|
||||
if (null_sequence) {
|
||||
setWindowTitle("Timeline: <none>");
|
||||
setWindowTitle(title + tr("<none>"));
|
||||
} else {
|
||||
setWindowTitle("Timeline: " + sequence->name);
|
||||
setWindowTitle(title + sequence->name);
|
||||
update_ui(false);
|
||||
}
|
||||
}
|
||||
@@ -413,14 +411,14 @@ int Timeline::get_snap_range() {
|
||||
}
|
||||
|
||||
bool Timeline::focused() {
|
||||
return (sequence != NULL && (headers->hasFocus() || video_area->hasFocus() || audio_area->hasFocus()));
|
||||
return (sequence != nullptr && (headers->hasFocus() || video_area->hasFocus() || audio_area->hasFocus()));
|
||||
}
|
||||
|
||||
void Timeline::repaint_timeline() {
|
||||
if (!block_repaints) {
|
||||
bool draw = true;
|
||||
|
||||
if (sequence != NULL
|
||||
if (sequence != nullptr
|
||||
&& !horizontalScrollBar->isSliderDown()
|
||||
&& !horizontalScrollBar->is_resizing()
|
||||
&& panel_sequence_viewer->playing
|
||||
@@ -446,7 +444,7 @@ void Timeline::repaint_timeline() {
|
||||
video_area->update();
|
||||
audio_area->update();
|
||||
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
set_sb_max();
|
||||
|
||||
if (last_frame != sequence->playhead) {
|
||||
@@ -459,11 +457,11 @@ void Timeline::repaint_timeline() {
|
||||
}
|
||||
|
||||
void Timeline::select_all() {
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
sequence->selections.clear();
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
Selection s;
|
||||
s.in = c->timeline_in;
|
||||
s.out = c->timeline_out;
|
||||
@@ -479,12 +477,28 @@ void Timeline::scroll_to_frame(long frame) {
|
||||
scroll_to_frame_internal(horizontalScrollBar, frame, zoom, timeline_area->width());
|
||||
}
|
||||
|
||||
void Timeline::resizeEvent(QResizeEvent *event) {
|
||||
if (sequence != NULL) set_sb_max();
|
||||
void Timeline::select_from_playhead() {
|
||||
sequence->selections.clear();
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != nullptr
|
||||
&& c->timeline_in <= sequence->playhead
|
||||
&& c->timeline_out > sequence->playhead) {
|
||||
Selection s;
|
||||
s.in = c->timeline_in;
|
||||
s.out = c->timeline_out;
|
||||
s.track = c->track;
|
||||
sequence->selections.append(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Timeline::resizeEvent(QResizeEvent *) {
|
||||
if (sequence != nullptr) set_sb_max();
|
||||
}
|
||||
|
||||
void Timeline::delete_in_out(bool ripple) {
|
||||
if (sequence != NULL && sequence->using_workarea) {
|
||||
if (sequence != nullptr && sequence->using_workarea) {
|
||||
QVector<Selection> areas;
|
||||
int video_tracks = 0, audio_tracks = 0;
|
||||
sequence->getTrackLimits(&video_tracks, &audio_tracks);
|
||||
@@ -529,7 +543,7 @@ void Timeline::delete_selection(QVector<Selection>& selections, bool ripple_dele
|
||||
bool can_ripple = true;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && c->timeline_in < ripple_point && c->timeline_out > ripple_point) {
|
||||
if (c != nullptr && c->timeline_in < ripple_point && c->timeline_out > ripple_point) {
|
||||
// conflict detected, but this clip may be getting deleted so let's check
|
||||
bool deleted = false;
|
||||
for (int j=0;j<selections.size();j++) {
|
||||
@@ -544,7 +558,7 @@ void Timeline::delete_selection(QVector<Selection>& selections, bool ripple_dele
|
||||
if (!deleted) {
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* cc = sequence->clips.at(j);
|
||||
if (cc != NULL
|
||||
if (cc != nullptr
|
||||
&& cc->track == c->track
|
||||
&& cc->timeline_in > c->timeline_out
|
||||
&& cc->timeline_in < c->timeline_out + ripple_length) {
|
||||
@@ -630,7 +644,7 @@ Clip* Timeline::split_clip(ComboAction* ca, int p, long frame) {
|
||||
|
||||
Clip* Timeline::split_clip(ComboAction* ca, int p, long frame, long post_in) {
|
||||
Clip* pre = sequence->clips.at(p);
|
||||
if (pre != NULL && pre->timeline_in < frame && pre->timeline_out > frame) { // guard against attempts to split at in/out points
|
||||
if (pre != nullptr && pre->timeline_in < frame && pre->timeline_out > frame) { // guard against attempts to split at in/out points
|
||||
Clip* post = pre->copy(sequence);
|
||||
|
||||
long new_clip_length = frame - pre->timeline_in;
|
||||
@@ -640,11 +654,11 @@ Clip* Timeline::split_clip(ComboAction* ca, int p, long frame, long post_in) {
|
||||
|
||||
move_clip(ca, pre, pre->timeline_in, frame, pre->clip_in, pre->track);
|
||||
|
||||
if (pre->get_opening_transition() != NULL) {
|
||||
/*if (frame < pre->timeline_in + pre->get_opening_transition()->length && pre->get_opening_transition()->secondary_clip != NULL) {
|
||||
if (pre->get_opening_transition() != nullptr) {
|
||||
/*if (frame < pre->timeline_in + pre->get_opening_transition()->length && pre->get_opening_transition()->secondary_clip != nullptr) {
|
||||
// separate shared transition
|
||||
ca->append(new SetPointer((void**) &pre->get_opening_transition()->secondary_clip, NULL));
|
||||
pre->get_opening_transition()->secondary_clip->closing_transition = pre->get_opening_transition()->copy(pre->get_opening_transition()->secondary_clip, NULL);
|
||||
ca->append(new SetPointer((void**) &pre->get_opening_transition()->secondary_clip, nullptr));
|
||||
pre->get_opening_transition()->secondary_clip->closing_transition = pre->get_opening_transition()->copy(pre->get_opening_transition()->secondary_clip, nullptr);
|
||||
}*/
|
||||
|
||||
if (pre->get_opening_transition()->get_true_length() > new_clip_length) {
|
||||
@@ -653,14 +667,14 @@ Clip* Timeline::split_clip(ComboAction* ca, int p, long frame, long post_in) {
|
||||
|
||||
post->sequence->hard_delete_transition(post, TA_OPENING_TRANSITION);
|
||||
}
|
||||
if (pre->get_closing_transition() != NULL) {
|
||||
if (pre->get_closing_transition() != nullptr) {
|
||||
ca->append(new DeleteTransitionCommand(pre->sequence, pre->closing_transition));
|
||||
if (pre->get_closing_transition()->secondary_clip == NULL) post->get_closing_transition()->set_length(qMin((long) post->get_closing_transition()->get_true_length(), post->getLength()));
|
||||
if (pre->get_closing_transition()->secondary_clip == nullptr) post->get_closing_transition()->set_length(qMin(long(post->get_closing_transition()->get_true_length()), post->getLength()));
|
||||
}
|
||||
|
||||
return post;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool Timeline::has_clip_been_split(int c) {
|
||||
@@ -681,14 +695,14 @@ bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool
|
||||
split_cache.append(clip);
|
||||
|
||||
Clip* c = sequence->clips.at(clip);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
QVector<int> pre_clips;
|
||||
QVector<Clip*> post_clips;
|
||||
|
||||
Clip* post = split_clip(ca, clip, frame);
|
||||
|
||||
// if alt is not down, split clips links too
|
||||
if (post == NULL) {
|
||||
if (post == nullptr) {
|
||||
return false;
|
||||
} else {
|
||||
post_clips.append(post);
|
||||
@@ -705,7 +719,7 @@ bool Timeline::split_clip_and_relink(ComboAction *ca, int clip, long frame, bool
|
||||
if ((original_clip_is_selected && is_clip_selected(link, true)) || !original_clip_is_selected) {
|
||||
split_cache.append(l);
|
||||
Clip* s = split_clip(ca, l, frame);
|
||||
if (s != NULL) {
|
||||
if (s != nullptr) {
|
||||
pre_clips.append(l);
|
||||
post_clips.append(s);
|
||||
}
|
||||
@@ -754,15 +768,15 @@ void Timeline::clean_up_selections(QVector<Selection>& areas) {
|
||||
|
||||
bool selection_contains_transition(const Selection& s, Clip* c, int type) {
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
return c->get_opening_transition() != NULL
|
||||
return c->get_opening_transition() != nullptr
|
||||
&& s.out == c->timeline_in + c->get_opening_transition()->get_true_length()
|
||||
&& ((c->get_opening_transition()->secondary_clip == NULL && s.in == c->timeline_in)
|
||||
|| (c->get_opening_transition()->secondary_clip != NULL && s.in == c->timeline_in - c->get_opening_transition()->get_true_length()));
|
||||
&& ((c->get_opening_transition()->secondary_clip == nullptr && s.in == c->timeline_in)
|
||||
|| (c->get_opening_transition()->secondary_clip != nullptr && s.in == c->timeline_in - c->get_opening_transition()->get_true_length()));
|
||||
} else {
|
||||
return c->get_closing_transition() != NULL
|
||||
return c->get_closing_transition() != nullptr
|
||||
&& s.in == c->timeline_out - c->get_closing_transition()->get_true_length()
|
||||
&& ((c->get_closing_transition()->secondary_clip == NULL && s.out == c->timeline_out)
|
||||
|| (c->get_closing_transition()->secondary_clip != NULL && s.out == c->timeline_out + c->get_closing_transition()->get_true_length()));
|
||||
&& ((c->get_closing_transition()->secondary_clip == nullptr && s.out == c->timeline_out)
|
||||
|| (c->get_closing_transition()->secondary_clip != nullptr && s.out == c->timeline_out + c->get_closing_transition()->get_true_length()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -776,7 +790,7 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
const Selection& s = areas.at(i);
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* c = sequence->clips.at(j);
|
||||
if (c != NULL && c->track == s.track && !c->undeletable) {
|
||||
if (c != nullptr && c->track == s.track && !c->undeletable) {
|
||||
if (selection_contains_transition(s, c, TA_OPENING_TRANSITION)) {
|
||||
// delete opening transition
|
||||
ca->append(new DeleteTransitionCommand(c->sequence, c->opening_transition));
|
||||
@@ -798,7 +812,7 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
// only out point is in deletion area
|
||||
move_clip(ca, c, c->timeline_in, s.in, c->clip_in, c->track);
|
||||
|
||||
if (c->get_closing_transition() != NULL) {
|
||||
if (c->get_closing_transition() != nullptr) {
|
||||
if (s.in < c->timeline_out - c->get_closing_transition()->get_true_length()) {
|
||||
ca->append(new DeleteTransitionCommand(c->sequence, c->closing_transition));
|
||||
} else {
|
||||
@@ -809,7 +823,7 @@ void Timeline::delete_areas_and_relink(ComboAction* ca, QVector<Selection>& area
|
||||
// only in point is in deletion area
|
||||
move_clip(ca, c, s.out, c->timeline_out, c->clip_in + (s.out - c->timeline_in), c->track);
|
||||
|
||||
if (c->get_opening_transition() != NULL) {
|
||||
if (c->get_opening_transition() != nullptr) {
|
||||
if (s.out > c->timeline_in + c->get_opening_transition()->get_true_length()) {
|
||||
ca->append(new DeleteTransitionCommand(c->sequence, c->opening_transition));
|
||||
} else {
|
||||
@@ -832,7 +846,7 @@ void Timeline::copy(bool del) {
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<sequence->selections.size();j++) {
|
||||
const Selection& s = sequence->selections.at(j);
|
||||
if (s.track == c->track && !((c->timeline_in <= s.in && c->timeline_out <= s.in) || (c->timeline_in >= s.out && c->timeline_out >= s.out))) {
|
||||
@@ -842,7 +856,7 @@ void Timeline::copy(bool del) {
|
||||
clipboard_type = CLIPBOARD_TYPE_CLIP;
|
||||
}
|
||||
|
||||
Clip* copied_clip = c->copy(NULL);
|
||||
Clip* copied_clip = c->copy(nullptr);
|
||||
|
||||
// copy linked IDs (we correct these later in paste())
|
||||
copied_clip->linked = c->linked;
|
||||
@@ -977,7 +991,7 @@ void Timeline::paste(bool insert) {
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && is_clip_selected(c, true)) {
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
for (int j=0;j<clipboard.size();j++) {
|
||||
Effect* e = static_cast<Effect*>(clipboard.at(j));
|
||||
if ((c->track < 0) == (e->meta->subtype == EFFECT_TYPE_VIDEO)) {
|
||||
@@ -994,15 +1008,15 @@ void Timeline::paste(bool insert) {
|
||||
}
|
||||
if (found >= 0 && ask_conflict) {
|
||||
QMessageBox box(this);
|
||||
box.setWindowTitle("Effect already exists");
|
||||
box.setText("Clip '" + c->name + "' already contains a '" + e->meta->name + "' effect. Would you like to replace it with the pasted one or add it as a separate effect?");
|
||||
box.setWindowTitle(tr("Effect already exists"));
|
||||
box.setText(tr("Clip '%1' already contains a '%2' effect. Would you like to replace it with the pasted one or add it as a separate effect?").arg(c->name, e->meta->name));
|
||||
box.setIcon(QMessageBox::Icon::Question);
|
||||
|
||||
box.addButton("Add", QMessageBox::YesRole);
|
||||
QPushButton* replace_button = box.addButton("Replace", QMessageBox::NoRole);
|
||||
QPushButton* skip_button = box.addButton("Skip", QMessageBox::RejectRole);
|
||||
box.addButton(tr("Add"), QMessageBox::YesRole);
|
||||
QPushButton* replace_button = box.addButton(tr("Replace"), QMessageBox::NoRole);
|
||||
QPushButton* skip_button = box.addButton(tr("Skip"), QMessageBox::RejectRole);
|
||||
|
||||
QCheckBox* future_box = new QCheckBox("Do this for all conflicts found");
|
||||
QCheckBox* future_box = new QCheckBox(tr("Do this for all conflicts found"));
|
||||
box.setCheckBox(future_box);
|
||||
|
||||
box.exec();
|
||||
@@ -1023,10 +1037,10 @@ void Timeline::paste(bool insert) {
|
||||
delcom->fx.append(found);
|
||||
ca->append(delcom);
|
||||
|
||||
ca->append(new AddEffectCommand(c, e->copy(c), NULL, found));
|
||||
ca->append(new AddEffectCommand(c, e->copy(c), nullptr, found));
|
||||
push = true;
|
||||
} else {
|
||||
ca->append(new AddEffectCommand(c, e->copy(c), NULL));
|
||||
ca->append(new AddEffectCommand(c, e->copy(c), nullptr));
|
||||
push = true;
|
||||
}
|
||||
}
|
||||
@@ -1045,7 +1059,7 @@ void Timeline::paste(bool insert) {
|
||||
}
|
||||
|
||||
void Timeline::ripple_to_in_point(bool in, bool ripple) {
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
if (sequence->clips.size() > 0) {
|
||||
// get track count
|
||||
int track_min = INT_MAX;
|
||||
@@ -1060,7 +1074,7 @@ void Timeline::ripple_to_in_point(bool in, bool ripple) {
|
||||
// find closest in point to playhead
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
track_min = qMin(track_min, c->track);
|
||||
track_max = qMax(track_max, c->track);
|
||||
|
||||
@@ -1164,7 +1178,7 @@ bool Timeline::split_selection(ComboAction* ca) {
|
||||
// find clips within selection and split
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* clip = sequence->clips.at(j);
|
||||
if (clip != NULL) {
|
||||
if (clip != nullptr) {
|
||||
for (int i=0;i<sequence->selections.size();i++) {
|
||||
const Selection& s = sequence->selections.at(i);
|
||||
if (s.track == clip->track) {
|
||||
@@ -1181,12 +1195,12 @@ bool Timeline::split_selection(ComboAction* ca) {
|
||||
split_B->timeline_in = s.out;
|
||||
secondary_post_splits.append(split_B);
|
||||
|
||||
if (clip->get_opening_transition() != NULL) {
|
||||
if (clip->get_opening_transition() != nullptr) {
|
||||
split_B->sequence->hard_delete_transition(split_B, TA_OPENING_TRANSITION);
|
||||
split_A->sequence->hard_delete_transition(split_A, TA_OPENING_TRANSITION);
|
||||
}
|
||||
|
||||
if (clip->get_closing_transition() != NULL) {
|
||||
if (clip->get_closing_transition() != nullptr) {
|
||||
ca->append(new DeleteTransitionCommand(clip->sequence, clip->closing_transition));
|
||||
|
||||
split_A->sequence->hard_delete_transition(split_A, TA_CLOSING_TRANSITION);
|
||||
@@ -1197,13 +1211,13 @@ bool Timeline::split_selection(ComboAction* ca) {
|
||||
} else {
|
||||
Clip* post_a = split_clip(ca, j, s.in);
|
||||
Clip* post_b = split_clip(ca, j, s.out);
|
||||
if (post_a != NULL) {
|
||||
if (post_a != nullptr) {
|
||||
pre_splits.append(j);
|
||||
post_splits.append(post_a);
|
||||
split = true;
|
||||
}
|
||||
if (post_b != NULL) {
|
||||
if (post_a != NULL) {
|
||||
if (post_b != nullptr) {
|
||||
if (post_a != nullptr) {
|
||||
pre_splits.append(j);
|
||||
post_splits.append(post_b);
|
||||
} else {
|
||||
@@ -1233,7 +1247,7 @@ bool Timeline::split_all_clips_at_point(ComboAction* ca, long point) {
|
||||
bool split = false;
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* c = sequence->clips.at(j);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
// always relinks
|
||||
if (split_clip_and_relink(ca, j, point, true)) {
|
||||
split = true;
|
||||
@@ -1254,9 +1268,9 @@ void Timeline::split_at_playhead() {
|
||||
QVector<Clip*> post_clips;
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* clip = sequence->clips.at(j);
|
||||
if (clip != NULL && is_clip_selected(clip, true)) {
|
||||
if (clip != nullptr && is_clip_selected(clip, true)) {
|
||||
Clip* s = split_clip(ca, j, sequence->playhead);
|
||||
if (s != NULL) {
|
||||
if (s != nullptr) {
|
||||
pre_clips.append(j);
|
||||
post_clips.append(s);
|
||||
split_selected = true;
|
||||
@@ -1352,15 +1366,15 @@ bool Timeline::snap_to_timeline(long* l, bool use_playhead, bool use_markers, bo
|
||||
// snap to clip/transition
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
if (snap_to_point(c->timeline_in, l)) {
|
||||
return true;
|
||||
} else if (snap_to_point(c->timeline_out, l)) {
|
||||
return true;
|
||||
} else if (c->get_opening_transition() != NULL
|
||||
} else if (c->get_opening_transition() != nullptr
|
||||
&& snap_to_point(c->timeline_in + c->get_opening_transition()->get_true_length(), l)) {
|
||||
return true;
|
||||
} else if (c->get_closing_transition() != NULL
|
||||
} else if (c->get_closing_transition() != nullptr
|
||||
&& snap_to_point(c->timeline_out - c->get_closing_transition()->get_true_length(), l)) {
|
||||
return true;
|
||||
}
|
||||
@@ -1376,8 +1390,8 @@ void Timeline::set_marker() {
|
||||
|
||||
if (!add_marker) {
|
||||
QInputDialog d(this);
|
||||
d.setWindowTitle("Set Marker");
|
||||
d.setLabelText("Set marker name:");
|
||||
d.setWindowTitle(tr("Set Marker"));
|
||||
d.setLabelText(tr("Set marker name:"));
|
||||
d.setInputMode(QInputDialog::TextInput);
|
||||
add_marker = (d.exec() == QDialog::Accepted);
|
||||
marker_name = d.textValue();
|
||||
@@ -1394,7 +1408,7 @@ void Timeline::toggle_links() {
|
||||
command->s = sequence;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && is_clip_selected(c, true)) {
|
||||
if (c != nullptr && is_clip_selected(c, true)) {
|
||||
if (!command->clips.contains(i)) command->clips.append(i);
|
||||
|
||||
if (c->linked.size() > 0) {
|
||||
@@ -1442,7 +1456,7 @@ void Timeline::deselect() {
|
||||
}
|
||||
|
||||
long getFrameFromScreenPoint(double zoom, int x) {
|
||||
long f = qCeil((float) x / zoom);
|
||||
long f = qCeil(double(x) / zoom);
|
||||
if (f < 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1450,7 +1464,7 @@ long getFrameFromScreenPoint(double zoom, int x) {
|
||||
}
|
||||
|
||||
int getScreenPointFromFrame(double zoom, long frame) {
|
||||
return (int) qFloor(frame*zoom);
|
||||
return qFloor(double(frame)*zoom);
|
||||
}
|
||||
|
||||
long Timeline::getTimelineFrameFromScreenPoint(int x) {
|
||||
@@ -1465,29 +1479,29 @@ void Timeline::add_btn_click() {
|
||||
QMenu add_menu(this);
|
||||
|
||||
QAction* titleMenuItem = new QAction(&add_menu);
|
||||
titleMenuItem->setText("Title...");
|
||||
titleMenuItem->setText(tr("Title..."));
|
||||
titleMenuItem->setData(ADD_OBJ_TITLE);
|
||||
add_menu.addAction(titleMenuItem);
|
||||
|
||||
QAction* solidMenuItem = new QAction(&add_menu);
|
||||
solidMenuItem->setText("Solid Color...");
|
||||
solidMenuItem->setText(tr("Solid Color..."));
|
||||
solidMenuItem->setData(ADD_OBJ_SOLID);
|
||||
add_menu.addAction(solidMenuItem);
|
||||
|
||||
QAction* barsMenuItem = new QAction(&add_menu);
|
||||
barsMenuItem->setText("Bars...");
|
||||
barsMenuItem->setText(tr("Bars..."));
|
||||
barsMenuItem->setData(ADD_OBJ_BARS);
|
||||
add_menu.addAction(barsMenuItem);
|
||||
|
||||
add_menu.addSeparator();
|
||||
|
||||
QAction* toneMenuItem = new QAction(&add_menu);
|
||||
toneMenuItem->setText("Tone...");
|
||||
toneMenuItem->setText(tr("Tone..."));
|
||||
toneMenuItem->setData(ADD_OBJ_TONE);
|
||||
add_menu.addAction(toneMenuItem);
|
||||
|
||||
QAction* noiseMenuItem = new QAction(&add_menu);
|
||||
noiseMenuItem->setText("Noise...");
|
||||
noiseMenuItem->setText(tr("Noise..."));
|
||||
noiseMenuItem->setData(ADD_OBJ_NOISE);
|
||||
add_menu.addAction(noiseMenuItem);
|
||||
|
||||
@@ -1509,11 +1523,16 @@ void Timeline::setScroll(int s) {
|
||||
|
||||
void Timeline::record_btn_click() {
|
||||
if (project_url.isEmpty()) {
|
||||
QMessageBox::critical(this, "Unsaved Project", "You must save this project before you can record audio in it.", QMessageBox::Ok);
|
||||
QMessageBox::critical(this,
|
||||
tr("Unsaved Project"),
|
||||
tr("You must save this project before you can record audio in it."),
|
||||
QMessageBox::Ok);
|
||||
} else {
|
||||
creating = true;
|
||||
creating_object = ADD_OBJ_AUDIO;
|
||||
mainWindow->statusBar()->showMessage("Click on the timeline where you want to start recording (drag to limit the recording to a certain timeframe)", 10000);
|
||||
mainWindow->statusBar()->showMessage(
|
||||
tr("Click on the timeline where you want to start recording (drag to limit the recording to a certain timeframe)"),
|
||||
10000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1592,7 +1611,7 @@ void Timeline::setup_ui() {
|
||||
arrow_icon.addFile(QStringLiteral(":/icons/arrow-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
toolArrowButton->setIcon(arrow_icon);
|
||||
toolArrowButton->setCheckable(true);
|
||||
toolArrowButton->setToolTip("Pointer Tool (V)");
|
||||
toolArrowButton->setToolTip(tr("Pointer Tool") + " (V)");
|
||||
toolArrowButton->setProperty("tool", TIMELINE_TOOL_POINTER);
|
||||
connect(toolArrowButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolArrowButton);
|
||||
@@ -1603,7 +1622,7 @@ void Timeline::setup_ui() {
|
||||
icon1.addFile(QStringLiteral(":/icons/beam-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
toolEditButton->setIcon(icon1);
|
||||
toolEditButton->setCheckable(true);
|
||||
toolEditButton->setToolTip("Edit Tool (X)");
|
||||
toolEditButton->setToolTip(tr("Edit Tool") + " (X)");
|
||||
toolEditButton->setProperty("tool", TIMELINE_TOOL_EDIT);
|
||||
connect(toolEditButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolEditButton);
|
||||
@@ -1614,7 +1633,7 @@ void Timeline::setup_ui() {
|
||||
icon2.addFile(QStringLiteral(":/icons/ripple-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
toolRippleButton->setIcon(icon2);
|
||||
toolRippleButton->setCheckable(true);
|
||||
toolRippleButton->setToolTip("Ripple Tool (B)");
|
||||
toolRippleButton->setToolTip(tr("Ripple Tool") + " (B)");
|
||||
toolRippleButton->setProperty("tool", TIMELINE_TOOL_RIPPLE);
|
||||
connect(toolRippleButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolRippleButton);
|
||||
@@ -1625,7 +1644,7 @@ void Timeline::setup_ui() {
|
||||
icon4.addFile(QStringLiteral(":/icons/razor-disabled.png"), QSize(), QIcon::Disabled, QIcon::Off);
|
||||
toolRazorButton->setIcon(icon4);
|
||||
toolRazorButton->setCheckable(true);
|
||||
toolRazorButton->setToolTip("Razor Tool (C)");
|
||||
toolRazorButton->setToolTip(tr("Razor Tool") + " (C)");
|
||||
toolRazorButton->setProperty("tool", TIMELINE_TOOL_RAZOR);
|
||||
connect(toolRazorButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolRazorButton);
|
||||
@@ -1636,7 +1655,7 @@ void Timeline::setup_ui() {
|
||||
icon5.addFile(QStringLiteral(":/icons/slip-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
toolSlipButton->setIcon(icon5);
|
||||
toolSlipButton->setCheckable(true);
|
||||
toolSlipButton->setToolTip("Slip Tool (Y)");
|
||||
toolSlipButton->setToolTip(tr("Slip Tool") + " (Y)");
|
||||
toolSlipButton->setProperty("tool", TIMELINE_TOOL_SLIP);
|
||||
connect(toolSlipButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolSlipButton);
|
||||
@@ -1647,7 +1666,7 @@ void Timeline::setup_ui() {
|
||||
icon6.addFile(QStringLiteral(":/icons/slide-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
toolSlideButton->setIcon(icon6);
|
||||
toolSlideButton->setCheckable(true);
|
||||
toolSlideButton->setToolTip("Slide Tool (U)");
|
||||
toolSlideButton->setToolTip(tr("Slide Tool") + " (U)");
|
||||
toolSlideButton->setProperty("tool", TIMELINE_TOOL_SLIDE);
|
||||
connect(toolSlideButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolSlideButton);
|
||||
@@ -1658,7 +1677,7 @@ void Timeline::setup_ui() {
|
||||
icon7.addFile(QStringLiteral(":/icons/hand-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
toolHandButton->setIcon(icon7);
|
||||
toolHandButton->setCheckable(true);
|
||||
toolHandButton->setToolTip("Hand Tool (H)");
|
||||
toolHandButton->setToolTip(tr("Hand Tool") + " (H)");
|
||||
toolHandButton->setProperty("tool", TIMELINE_TOOL_HAND);
|
||||
connect(toolHandButton, SIGNAL(clicked(bool)), this, SLOT(set_tool()));
|
||||
tool_buttons_layout->addWidget(toolHandButton);
|
||||
@@ -1669,7 +1688,7 @@ void Timeline::setup_ui() {
|
||||
icon8.addFile(QStringLiteral(":/icons/transition-tool-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
toolTransitionButton->setIcon(icon8);
|
||||
toolTransitionButton->setCheckable(true);
|
||||
toolTransitionButton->setToolTip("Transition Tool (T)");
|
||||
toolTransitionButton->setToolTip(tr("Transition Tool") + " (T)");
|
||||
connect(toolTransitionButton, SIGNAL(clicked(bool)), this, SLOT(transition_tool_click()));
|
||||
tool_buttons_layout->addWidget(toolTransitionButton);
|
||||
|
||||
@@ -1680,7 +1699,7 @@ void Timeline::setup_ui() {
|
||||
snappingButton->setIcon(icon9);
|
||||
snappingButton->setCheckable(true);
|
||||
snappingButton->setChecked(true);
|
||||
snappingButton->setToolTip("Snapping (S)");
|
||||
snappingButton->setToolTip(tr("Snapping") + " (S)");
|
||||
connect(snappingButton, SIGNAL(toggled(bool)), this, SLOT(snapping_clicked(bool)));
|
||||
tool_buttons_layout->addWidget(snappingButton);
|
||||
|
||||
@@ -1689,7 +1708,7 @@ void Timeline::setup_ui() {
|
||||
icon10.addFile(QStringLiteral(":/icons/zoomin.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
icon10.addFile(QStringLiteral(":/icons/zoomin-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
zoomInButton->setIcon(icon10);
|
||||
zoomInButton->setToolTip("Zoom In (=)");
|
||||
zoomInButton->setToolTip(tr("Zoom In") + " (=)");
|
||||
connect(zoomInButton, SIGNAL(clicked(bool)), this, SLOT(zoom_in()));
|
||||
tool_buttons_layout->addWidget(zoomInButton);
|
||||
|
||||
@@ -1698,7 +1717,7 @@ void Timeline::setup_ui() {
|
||||
icon11.addFile(QStringLiteral(":/icons/zoomout.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
icon11.addFile(QStringLiteral(":/icons/zoomout-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
zoomOutButton->setIcon(icon11);
|
||||
zoomOutButton->setToolTip("Zoom Out (-)");
|
||||
zoomOutButton->setToolTip(tr("Zoom Out") + " (-)");
|
||||
connect(zoomOutButton, SIGNAL(clicked(bool)), this, SLOT(zoom_out()));
|
||||
tool_buttons_layout->addWidget(zoomOutButton);
|
||||
|
||||
@@ -1707,7 +1726,7 @@ void Timeline::setup_ui() {
|
||||
icon12.addFile(QStringLiteral(":/icons/record.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
icon12.addFile(QStringLiteral(":/icons/record-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
recordButton->setIcon(icon12);
|
||||
recordButton->setToolTip("Record audio");
|
||||
recordButton->setToolTip(tr("Record audio"));
|
||||
connect(recordButton, SIGNAL(clicked(bool)), this, SLOT(record_btn_click()));
|
||||
|
||||
tool_buttons_layout->addWidget(recordButton);
|
||||
@@ -1717,7 +1736,7 @@ void Timeline::setup_ui() {
|
||||
icon13.addFile(QStringLiteral(":/icons/add-button.png"), QSize(), QIcon::Normal, QIcon::On);
|
||||
icon13.addFile(QStringLiteral(":/icons/add-button-disabled.png"), QSize(), QIcon::Disabled, QIcon::On);
|
||||
addButton->setIcon(icon13);
|
||||
addButton->setToolTip("Add title, solid, bars, etc.");
|
||||
addButton->setToolTip(tr("Add title, solid, bars, etc."));
|
||||
connect(addButton, SIGNAL(clicked()), this, SLOT(add_btn_click()));
|
||||
tool_buttons_layout->addWidget(addButton);
|
||||
|
||||
@@ -1806,16 +1825,16 @@ void move_clip(ComboAction* ca, Clip *c, long iin, long iout, long iclip_in, int
|
||||
ca->append(new MoveClipAction(c, iin, iout, iclip_in, itrack, relative));
|
||||
|
||||
if (verify_transitions) {
|
||||
if (c->get_opening_transition() != NULL && c->get_opening_transition()->secondary_clip != NULL && c->get_opening_transition()->secondary_clip->timeline_out != iin) {
|
||||
if (c->get_opening_transition() != nullptr && c->get_opening_transition()->secondary_clip != nullptr && c->get_opening_transition()->secondary_clip->timeline_out != iin) {
|
||||
// separate transition
|
||||
ca->append(new SetPointer((void**) &c->get_opening_transition()->secondary_clip, NULL));
|
||||
ca->append(new AddTransitionCommand(c->get_opening_transition()->secondary_clip, NULL, c->get_opening_transition(), NULL, TA_CLOSING_TRANSITION, 0));
|
||||
ca->append(new SetPointer(reinterpret_cast<void**>(&c->get_opening_transition()->secondary_clip), nullptr));
|
||||
ca->append(new AddTransitionCommand(c->get_opening_transition()->secondary_clip, nullptr, c->get_opening_transition(), nullptr, TA_CLOSING_TRANSITION, 0));
|
||||
}
|
||||
|
||||
if (c->get_closing_transition() != NULL && c->get_closing_transition()->secondary_clip != NULL && c->get_closing_transition()->parent_clip->timeline_in != iout) {
|
||||
if (c->get_closing_transition() != nullptr && c->get_closing_transition()->secondary_clip != nullptr && c->get_closing_transition()->parent_clip->timeline_in != iout) {
|
||||
// separate transition
|
||||
ca->append(new SetPointer((void**) &c->get_closing_transition()->secondary_clip, NULL));
|
||||
ca->append(new AddTransitionCommand(c, NULL, c->get_closing_transition(), NULL, TA_CLOSING_TRANSITION, 0));
|
||||
ca->append(new SetPointer(reinterpret_cast<void**>(&c->get_closing_transition()->secondary_clip), nullptr));
|
||||
ca->append(new AddTransitionCommand(c, nullptr, c->get_closing_transition(), nullptr, TA_CLOSING_TRANSITION, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,6 +204,7 @@ public:
|
||||
QPushButton* snappingButton;
|
||||
|
||||
void scroll_to_frame(long frame);
|
||||
void select_from_playhead();
|
||||
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
public slots:
|
||||
|
||||
+70
-35
@@ -40,11 +40,11 @@ Viewer::Viewer(QWidget *parent) :
|
||||
QDockWidget(parent),
|
||||
playing(false),
|
||||
just_played(false),
|
||||
media(NULL),
|
||||
seq(NULL),
|
||||
media(nullptr),
|
||||
seq(nullptr),
|
||||
created_sequence(false),
|
||||
cue_recording_internal(false),
|
||||
panel_name("Viewer: "),
|
||||
panel_name(tr("Viewer: ")),
|
||||
minimum_zoom(1.0)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
@@ -57,7 +57,7 @@ Viewer::Viewer(QWidget *parent) :
|
||||
viewer_container->viewer = this;
|
||||
viewer_widget = viewer_container->child;
|
||||
viewer_widget->viewer = this;
|
||||
set_media(NULL);
|
||||
set_media(nullptr);
|
||||
|
||||
currentTimecode->setEnabled(false);
|
||||
currentTimecode->set_minimum_value(0);
|
||||
@@ -90,6 +90,10 @@ bool Viewer::is_focused() {
|
||||
|| btnSkipToEnd->hasFocus();
|
||||
}
|
||||
|
||||
bool Viewer::is_main_sequence() {
|
||||
return main_sequence;
|
||||
}
|
||||
|
||||
void Viewer::set_main_sequence() {
|
||||
clean_created_seq();
|
||||
set_sequence(true, sequence);
|
||||
@@ -97,13 +101,13 @@ void Viewer::set_main_sequence() {
|
||||
|
||||
void Viewer::reset_all_audio() {
|
||||
// reset all clip audio
|
||||
if (seq != NULL) {
|
||||
if (seq != nullptr) {
|
||||
audio_ibuffer_frame = seq->playhead;
|
||||
audio_ibuffer_timecode = (double) audio_ibuffer_frame / seq->frame_rate;
|
||||
|
||||
for (int i=0;i<seq->clips.size();i++) {
|
||||
Clip* c = seq->clips.at(i);
|
||||
if (c != NULL) c->reset_audio();
|
||||
if (c != nullptr) c->reset_audio();
|
||||
}
|
||||
}
|
||||
clear_audio_ibuffer();
|
||||
@@ -238,26 +242,35 @@ bool frame_rate_is_droppable(float rate) {
|
||||
void Viewer::seek(long p) {
|
||||
pause();
|
||||
seq->playhead = p;
|
||||
bool update_fx = false;
|
||||
if (main_sequence) {
|
||||
panel_timeline->scroll_to_frame(p);
|
||||
panel_effect_controls->scroll_to_frame(p);
|
||||
if (config.seek_also_selects) {
|
||||
panel_timeline->select_from_playhead();
|
||||
update_fx = true;
|
||||
}
|
||||
}
|
||||
update_parents();
|
||||
update_parents(update_fx);
|
||||
reset_all_audio();
|
||||
audio_scrub = true;
|
||||
}
|
||||
|
||||
void Viewer::go_to_start() {
|
||||
if (seq != NULL) seek(0);
|
||||
if (seq != nullptr) seek(0);
|
||||
}
|
||||
|
||||
void Viewer::go_to_end() {
|
||||
if (seq != NULL) seek(seq->getEndFrame());
|
||||
if (seq != nullptr) seek(seq->getEndFrame());
|
||||
}
|
||||
|
||||
void Viewer::close_media() {
|
||||
set_media(nullptr);
|
||||
}
|
||||
|
||||
void Viewer::go_to_in() {
|
||||
if (seq != NULL) {
|
||||
if (seq->using_workarea) {
|
||||
if (seq != nullptr) {
|
||||
if (seq->using_workarea && seq->enable_workarea) {
|
||||
seek(seq->workarea_in);
|
||||
} else {
|
||||
go_to_start();
|
||||
@@ -266,16 +279,16 @@ void Viewer::go_to_in() {
|
||||
}
|
||||
|
||||
void Viewer::previous_frame() {
|
||||
if (seq != NULL && seq->playhead > 0) seek(seq->playhead-1);
|
||||
if (seq != nullptr && seq->playhead > 0) seek(seq->playhead-1);
|
||||
}
|
||||
|
||||
void Viewer::next_frame() {
|
||||
if (seq != NULL) seek(seq->playhead+1);
|
||||
if (seq != nullptr) seek(seq->playhead+1);
|
||||
}
|
||||
|
||||
void Viewer::go_to_out() {
|
||||
if (seq != NULL) {
|
||||
if (seq->using_workarea) {
|
||||
if (seq != nullptr) {
|
||||
if (seq->using_workarea && seq->enable_workarea) {
|
||||
seek(seq->workarea_out);
|
||||
} else {
|
||||
go_to_end();
|
||||
@@ -314,7 +327,7 @@ void Viewer::play() {
|
||||
if (panel_sequence_viewer->playing) panel_sequence_viewer->pause();
|
||||
if (panel_footage_viewer->playing) panel_footage_viewer->pause();
|
||||
|
||||
if (seq != NULL) {
|
||||
if (seq != nullptr) {
|
||||
if (!is_recording_cued()
|
||||
&& seq->playhead >= get_seq_out()
|
||||
&& (config.loop || !main_sequence)) {
|
||||
@@ -323,7 +336,7 @@ void Viewer::play() {
|
||||
|
||||
reset_all_audio();
|
||||
if (is_recording_cued() && !start_recording()) {
|
||||
dout << "[ERROR] Failed to record audio";
|
||||
qCritical() << "Failed to record audio";
|
||||
return;
|
||||
}
|
||||
playhead_start = seq->playhead;
|
||||
@@ -339,7 +352,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 != nullptr) audio_thread->notifyReceiver();
|
||||
just_played = false;
|
||||
}
|
||||
}
|
||||
@@ -393,11 +406,11 @@ void Viewer::update_playhead_timecode(long p) {
|
||||
}
|
||||
|
||||
void Viewer::update_end_timecode() {
|
||||
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 == nullptr) ? 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) {
|
||||
if (seq != nullptr) {
|
||||
long sequenceEndFrame = seq->getEndFrame();
|
||||
if (cached_end_frame != sequenceEndFrame) {
|
||||
minimum_zoom = (sequenceEndFrame > 0) ? ((double) headers->width() / (double) sequenceEndFrame) : 1;
|
||||
@@ -410,16 +423,16 @@ void Viewer::update_header_zoom() {
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::update_parents() {
|
||||
void Viewer::update_parents(bool reload_fx) {
|
||||
if (main_sequence) {
|
||||
update_ui(false);
|
||||
update_ui(reload_fx);
|
||||
} else {
|
||||
update_viewer();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::resizeEvent(QResizeEvent *event) {
|
||||
if (seq != NULL) {
|
||||
void Viewer::resizeEvent(QResizeEvent *) {
|
||||
if (seq != nullptr) {
|
||||
set_sb_max();
|
||||
}
|
||||
}
|
||||
@@ -427,10 +440,24 @@ void Viewer::resizeEvent(QResizeEvent *event) {
|
||||
void Viewer::update_viewer() {
|
||||
update_header_zoom();
|
||||
viewer_widget->update();
|
||||
if (seq != NULL) update_playhead_timecode(seq->playhead);
|
||||
if (seq != nullptr) update_playhead_timecode(seq->playhead);
|
||||
update_end_timecode();
|
||||
}
|
||||
|
||||
void Viewer::clear_in() {
|
||||
if (seq->using_workarea) {
|
||||
undo_stack.push(new SetTimelineInOutCommand(seq, true, 0, seq->workarea_out));
|
||||
update_parents();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::clear_out() {
|
||||
if (seq->using_workarea) {
|
||||
undo_stack.push(new SetTimelineInOutCommand(seq, true, seq->workarea_in, seq->getEndFrame()));
|
||||
update_parents();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::clear_inout_point() {
|
||||
if (seq->using_workarea) {
|
||||
undo_stack.push(new SetTimelineInOutCommand(seq, false, 0, 0));
|
||||
@@ -438,6 +465,13 @@ void Viewer::clear_inout_point() {
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::toggle_enable_inout() {
|
||||
if (seq != nullptr && seq->using_workarea) {
|
||||
undo_stack.push(new SetBool(&seq->enable_workarea, !seq->enable_workarea));
|
||||
update_parents();
|
||||
}
|
||||
}
|
||||
|
||||
void Viewer::set_in_point() {
|
||||
headers->set_in_point(seq->playhead);
|
||||
}
|
||||
@@ -447,7 +481,7 @@ void Viewer::set_out_point() {
|
||||
}
|
||||
|
||||
void Viewer::set_zoom(bool in) {
|
||||
if (seq != NULL) {
|
||||
if (seq != nullptr) {
|
||||
set_zoom_value(in ? headers->get_zoom()*2 : qMax(minimum_zoom, headers->get_zoom()*0.5));
|
||||
}
|
||||
}
|
||||
@@ -458,7 +492,7 @@ void Viewer::set_zoom_value(double d) {
|
||||
viewer_widget->waveform_zoom = d;
|
||||
viewer_widget->update();
|
||||
}
|
||||
if (seq != NULL) {
|
||||
if (seq != nullptr) {
|
||||
set_sb_max();
|
||||
if (!horizontal_bar->is_resizing())
|
||||
center_scroll_to_playhead(horizontal_bar, headers->get_zoom(), seq->playhead);
|
||||
@@ -470,13 +504,13 @@ void Viewer::set_sb_max() {
|
||||
}
|
||||
|
||||
long Viewer::get_seq_in() {
|
||||
return (seq->using_workarea)
|
||||
return (seq->using_workarea && seq->enable_workarea)
|
||||
? seq->workarea_in
|
||||
: 0;
|
||||
}
|
||||
|
||||
long Viewer::get_seq_out() {
|
||||
return (seq->using_workarea && previous_playhead < seq->workarea_out)
|
||||
return (seq->using_workarea && seq->enable_workarea && previous_playhead < seq->workarea_out)
|
||||
? seq->workarea_out
|
||||
: seq->getEndFrame();
|
||||
}
|
||||
@@ -583,7 +617,7 @@ void Viewer::set_media(Media* m) {
|
||||
main_sequence = false;
|
||||
media = m;
|
||||
clean_created_seq();
|
||||
if (media != NULL) {
|
||||
if (media != nullptr) {
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
@@ -666,7 +700,8 @@ void Viewer::timer_update() {
|
||||
previous_playhead = seq->playhead;
|
||||
|
||||
seq->playhead = qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate));
|
||||
update_parents();
|
||||
if (config.seek_also_selects) panel_timeline->select_from_playhead();
|
||||
update_parents(config.seek_also_selects);
|
||||
|
||||
long end_frame = get_seq_out();
|
||||
if (!recording
|
||||
@@ -706,7 +741,7 @@ void Viewer::clean_created_seq() {
|
||||
}*/
|
||||
|
||||
delete seq;
|
||||
seq = NULL;
|
||||
seq = nullptr;
|
||||
created_sequence = false;
|
||||
}
|
||||
}
|
||||
@@ -716,14 +751,14 @@ void Viewer::set_sequence(bool main, Sequence *s) {
|
||||
|
||||
reset_all_audio();
|
||||
|
||||
if (seq != NULL) {
|
||||
if (seq != nullptr) {
|
||||
closeActiveClips(seq);
|
||||
}
|
||||
|
||||
main_sequence = main;
|
||||
seq = (main) ? sequence : s;
|
||||
|
||||
bool null_sequence = (seq == NULL);
|
||||
bool null_sequence = (seq == nullptr);
|
||||
|
||||
headers->setEnabled(!null_sequence);
|
||||
currentTimecode->setEnabled(!null_sequence);
|
||||
@@ -750,7 +785,7 @@ void Viewer::set_sequence(bool main, Sequence *s) {
|
||||
update_playhead_timecode(0);
|
||||
update_end_timecode();
|
||||
|
||||
setWindowTitle(panel_name + "(none)");
|
||||
setWindowTitle(panel_name + tr("(none)"));
|
||||
}
|
||||
|
||||
update_header_zoom();
|
||||
|
||||
+6
-1
@@ -29,6 +29,7 @@ public:
|
||||
~Viewer();
|
||||
|
||||
bool is_focused();
|
||||
bool is_main_sequence();
|
||||
void set_main_sequence();
|
||||
void set_media(Media *m);
|
||||
void compose();
|
||||
@@ -37,7 +38,10 @@ public:
|
||||
void update_end_timecode();
|
||||
void update_header_zoom();
|
||||
void update_viewer();
|
||||
void clear_in();
|
||||
void clear_out();
|
||||
void clear_inout_point();
|
||||
void toggle_enable_inout();
|
||||
void set_in_point();
|
||||
void set_out_point();
|
||||
void set_zoom(bool in);
|
||||
@@ -60,7 +64,7 @@ public:
|
||||
int recording_track;
|
||||
|
||||
void reset_all_audio();
|
||||
void update_parents();
|
||||
void update_parents(bool reload_fx = false);
|
||||
|
||||
ViewerWidget* viewer_widget;
|
||||
|
||||
@@ -78,6 +82,7 @@ public slots:
|
||||
void next_frame();
|
||||
void go_to_out();
|
||||
void go_to_end();
|
||||
void close_media();
|
||||
|
||||
private slots:
|
||||
void update_playhead();
|
||||
|
||||
+21
-21
@@ -27,7 +27,7 @@ QIODevice* audio_io_device;
|
||||
bool audio_device_set = false;
|
||||
bool audio_scrub = false;
|
||||
QMutex audio_write_lock;
|
||||
QAudioInput* audio_input = NULL;
|
||||
QAudioInput* audio_input = nullptr;
|
||||
QFile output_recording;
|
||||
bool recording = false;
|
||||
|
||||
@@ -36,7 +36,7 @@ int audio_ibuffer_read = 0;
|
||||
long audio_ibuffer_frame = 0;
|
||||
double audio_ibuffer_timecode = 0;
|
||||
|
||||
AudioSenderThread* audio_thread = NULL;
|
||||
AudioSenderThread* audio_thread = nullptr;
|
||||
|
||||
bool is_audio_device_set() {
|
||||
return audio_device_set;
|
||||
@@ -55,18 +55,18 @@ void init_audio() {
|
||||
|
||||
QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice());
|
||||
QList<QAudioDeviceInfo> devs = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
|
||||
dout << "[INFO] Found the following audio devices:";
|
||||
qInfo() << "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...";
|
||||
qWarning() << "Default audio returned nullptr, attempting to use first device found...";
|
||||
info = devs.at(0);
|
||||
}
|
||||
dout << "[INFO] Using audio device" << info.deviceName();
|
||||
qInfo() << "Using audio device" << info.deviceName();
|
||||
|
||||
if (!info.isFormatSupported(audio_format)) {
|
||||
qWarning() << "[WARNING] Audio format is not supported by backend, using nearest";
|
||||
qWarning() << "Audio format is not supported by backend, using nearest";
|
||||
audio_format = info.nearestFormat(audio_format);
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ void init_audio() {
|
||||
|
||||
// connect
|
||||
audio_io_device = audio_output->start();
|
||||
if (audio_io_device == NULL) {
|
||||
dout << "[WARNING] Received NULL audio device. No compatible audio output was found.";
|
||||
if (audio_io_device == nullptr) {
|
||||
qWarning() << "Received nullptr audio device. No compatible audio output was found.";
|
||||
} else {
|
||||
audio_device_set = true;
|
||||
|
||||
@@ -101,10 +101,10 @@ void stop_audio() {
|
||||
}
|
||||
|
||||
void clear_audio_ibuffer() {
|
||||
if (audio_thread != NULL) audio_thread->lock.lock();
|
||||
if (audio_thread != nullptr) audio_thread->lock.lock();
|
||||
memset(audio_ibuffer, 0, audio_ibuffer_size);
|
||||
audio_ibuffer_read = 0;
|
||||
if (audio_thread != NULL) audio_thread->lock.unlock();
|
||||
if (audio_thread != nullptr) audio_thread->lock.unlock();
|
||||
}
|
||||
|
||||
int current_audio_freq() {
|
||||
@@ -115,7 +115,7 @@ int get_buffer_offset_from_frame(double framerate, long frame) {
|
||||
if (frame >= audio_ibuffer_frame) {
|
||||
return qFloor(((double) (frame - audio_ibuffer_frame)/framerate)*current_audio_freq())*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";
|
||||
qWarning() << "Invalid values passed to get_buffer_offset_from_frame";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -169,14 +169,14 @@ int AudioSenderThread::send_audio_to_output(int offset, int max) {
|
||||
|
||||
// send samples to audio monitor cache
|
||||
// TODO make this work for the footage viewer - currently, enabling it causes crash due to an ASSERT
|
||||
Sequence* s = NULL;
|
||||
Sequence* s = nullptr;
|
||||
/*if (panel_footage_viewer->playing) {
|
||||
s = panel_footage_viewer->seq;
|
||||
}*/
|
||||
if (panel_sequence_viewer->playing) {
|
||||
s = panel_sequence_viewer->seq;
|
||||
}
|
||||
if (s != NULL) {
|
||||
if (s != nullptr) {
|
||||
if (panel_timeline->audio_monitor->sample_cache_offset == -1) {
|
||||
panel_timeline->audio_monitor->sample_cache_offset = s->playhead;
|
||||
}
|
||||
@@ -287,15 +287,15 @@ void write_wave_trailer(QFile& f) {
|
||||
}
|
||||
|
||||
bool start_recording() {
|
||||
if (sequence == NULL) {
|
||||
dout << "[ERROR] No active sequence to record into";
|
||||
if (sequence == nullptr) {
|
||||
qCritical() << "No active sequence to record into";
|
||||
return false;
|
||||
}
|
||||
|
||||
QString audio_path = project_url + " Audio";
|
||||
QString audio_path = project_url + " " + QCoreApplication::translate("Audio", "Audio");
|
||||
QDir audio_dir(audio_path);
|
||||
if (!audio_dir.exists() && !audio_dir.mkpath(".")) {
|
||||
dout << "[ERROR] Failed to create audio directory";
|
||||
qCritical() << "Failed to create audio directory";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -303,12 +303,12 @@ bool start_recording() {
|
||||
int file_number = 0;
|
||||
do {
|
||||
file_number++;
|
||||
audio_filename = audio_path + "/Recording " + QString::number(file_number) + ".wav";
|
||||
audio_filename = audio_path + "/" + QCoreApplication::translate("Audio", "Recording") + " " + QString::number(file_number) + ".wav";
|
||||
} while (QFile(audio_filename).exists());
|
||||
|
||||
output_recording.setFileName(audio_filename);
|
||||
if (!output_recording.open(QFile::WriteOnly)) {
|
||||
dout << "[ERROR] Failed to open output file. Does Olive have permission to write to this directory?";
|
||||
qCritical() << "Failed to open output file. Does Olive have permission to write to this directory?";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ bool start_recording() {
|
||||
}
|
||||
QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice();
|
||||
if (!info.isFormatSupported(audio_format)) {
|
||||
dout << "[WARNING] Default format not supported, using nearest";
|
||||
qWarning() << "Default format not supported, using nearest";
|
||||
audio_format = info.nearestFormat(audio_format);
|
||||
}
|
||||
write_wave_header(output_recording, audio_format);
|
||||
@@ -338,7 +338,7 @@ void stop_recording() {
|
||||
output_recording.close();
|
||||
|
||||
delete audio_input;
|
||||
audio_input = NULL;
|
||||
audio_input = nullptr;
|
||||
recording = false;
|
||||
}
|
||||
}
|
||||
|
||||
+50
-49
@@ -51,8 +51,8 @@ void apply_audio_effects(Clip* c, double timecode_start, AVFrame* frame, int nb_
|
||||
Effect* e = c->effects.at(j);
|
||||
if (e->is_enabled()) e->process_audio(timecode_start, timecode_end, frame->data[0], nb_bytes, 2);
|
||||
}
|
||||
if (c->get_opening_transition() != NULL) {
|
||||
if (c->media != NULL && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
if (c->get_opening_transition() != nullptr) {
|
||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
double transition_start = (c->get_clip_in_with_transition() / c->sequence->frame_rate);
|
||||
double transition_end = (c->get_clip_in_with_transition() + c->get_opening_transition()->get_length()) / c->sequence->frame_rate;
|
||||
if (timecode_end < transition_end) {
|
||||
@@ -63,8 +63,8 @@ void apply_audio_effects(Clip* c, double timecode_start, AVFrame* frame, int nb_
|
||||
}
|
||||
}
|
||||
}
|
||||
if (c->get_closing_transition() != NULL) {
|
||||
if (c->media != NULL && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
if (c->get_closing_transition() != nullptr) {
|
||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
long length_with_transitions = c->get_timeline_out_with_transition() - c->get_timeline_in_with_transition();
|
||||
double transition_start = (c->get_clip_in_with_transition() + length_with_transitions - c->get_closing_transition()->get_length()) / c->sequence->frame_rate;
|
||||
double transition_end = (c->get_clip_in_with_transition() + length_with_transitions) / c->sequence->frame_rate;
|
||||
@@ -117,7 +117,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests) {
|
||||
AVFrame* frame;
|
||||
int nb_bytes = INT_MAX;
|
||||
|
||||
if (c->media == NULL) {
|
||||
if (c->media == nullptr) {
|
||||
frame = c->frame;
|
||||
nb_bytes = frame->nb_samples * av_get_bytes_per_sample(static_cast<AVSampleFormat>(frame->format)) * frame->channels;
|
||||
while ((c->frame_sample_index == -1 || c->frame_sample_index >= nb_bytes) && nb_bytes > 0) {
|
||||
@@ -168,7 +168,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests) {
|
||||
ret = retrieve_next_frame(c, c->frame);
|
||||
if (ret >= 0) {
|
||||
if ((ret = av_buffersrc_add_frame_flags(c->buffersrc_ctx, c->frame, AV_BUFFERSRC_FLAG_KEEP_REF)) < 0) {
|
||||
dout << "[ERROR] Could not feed filtergraph -" << ret;
|
||||
qCritical() << "Could not feed filtergraph -" << ret;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -182,7 +182,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests) {
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
dout << "[WARNING] Raw audio frame data could not be retrieved." << ret;
|
||||
qWarning() << "Raw audio frame data could not be retrieved." << ret;
|
||||
c->reached_end = true;
|
||||
}
|
||||
break;
|
||||
@@ -191,7 +191,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests) {
|
||||
|
||||
if (ret < 0) {
|
||||
if (ret != AVERROR_EOF) {
|
||||
dout << "[ERROR] Could not pull from filtergraph";
|
||||
qCritical() << "Could not pull from filtergraph";
|
||||
c->reached_end = true;
|
||||
break;
|
||||
} else {
|
||||
@@ -356,7 +356,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests) {
|
||||
}
|
||||
} else {
|
||||
// shouldn't ever get here
|
||||
dout << "[ERROR] Tried to cache a non-footage/tone clip";
|
||||
qCritical() << "Tried to cache a non-footage/tone clip";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -390,7 +390,7 @@ void cache_audio_worker(Clip* c, bool scrubbing, QVector<Clip*>& nests) {
|
||||
audio_write_lock.unlock();
|
||||
|
||||
if (scrubbing) {
|
||||
if (audio_thread != NULL) audio_thread->notifyReceiver();
|
||||
if (audio_thread != nullptr) audio_thread->notifyReceiver();
|
||||
}
|
||||
|
||||
if (c->frame_sample_index == nb_bytes) {
|
||||
@@ -478,7 +478,7 @@ void cache_video_worker(Clip* c, long playhead) {
|
||||
|
||||
if (send_it) {
|
||||
if ((send_ret = av_buffersrc_add_frame_flags(c->buffersrc_ctx, send_frame, AV_BUFFERSRC_FLAG_KEEP_REF)) < 0) {
|
||||
dout << "[ERROR] Failed to add frame to buffer source." << send_ret;
|
||||
qCritical() << "Failed to add frame to buffer source." << send_ret;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -488,7 +488,7 @@ void cache_video_worker(Clip* c, long playhead) {
|
||||
if (read_ret == AVERROR_EOF) {
|
||||
c->reached_end = true;
|
||||
} else {
|
||||
dout << "[ERROR] Failed to read frame." << read_ret;
|
||||
qCritical() << "Failed to read frame." << read_ret;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -498,7 +498,7 @@ void cache_video_worker(Clip* c, long playhead) {
|
||||
if (retr_ret == AVERROR_EOF) {
|
||||
c->reached_end = true;
|
||||
} else {
|
||||
dout << "[ERROR] Failed to retrieve frame from buffersink." << retr_ret;
|
||||
qCritical() << "Failed to retrieve frame from buffersink." << retr_ret;
|
||||
}
|
||||
av_frame_free(&frame);
|
||||
break;
|
||||
@@ -541,7 +541,7 @@ void cache_video_worker(Clip* c, long playhead) {
|
||||
|
||||
void reset_cache(Clip* c, long target_frame) {
|
||||
// if we seek to a whole other place in the timeline, we'll need to reset the cache with new values
|
||||
if (c->media == NULL) {
|
||||
if (c->media == nullptr) {
|
||||
if (c->track >= 0) {
|
||||
// tone clip
|
||||
c->reached_end = false;
|
||||
@@ -577,7 +577,7 @@ void reset_cache(Clip* c, long target_frame) {
|
||||
av_frame_unref(c->frame);
|
||||
int ret = retrieve_next_frame(c, c->frame);
|
||||
if (ret < 0) {
|
||||
dout << "[WARNING] Seeking terminated prematurely";
|
||||
qWarning() << "Seeking terminated prematurely";
|
||||
break;
|
||||
}
|
||||
if (c->frame->pts <= target_ts) {
|
||||
@@ -625,7 +625,7 @@ Cacher::Cacher(Clip* c) : clip(c) {}
|
||||
AVSampleFormat sample_format = AV_SAMPLE_FMT_S16;
|
||||
|
||||
void open_clip_worker(Clip* clip) {
|
||||
if (clip->media == NULL) {
|
||||
if (clip->media == nullptr) {
|
||||
if (clip->track >= 0) {
|
||||
clip->frame = av_frame_alloc();
|
||||
clip->frame->format = sample_format;
|
||||
@@ -635,7 +635,7 @@ void open_clip_worker(Clip* clip) {
|
||||
clip->frame->nb_samples = 2048;
|
||||
av_frame_make_writable(clip->frame);
|
||||
if (av_frame_get_buffer(clip->frame, 0)) {
|
||||
dout << "[ERROR] Could not allocate buffer for tone clip";
|
||||
qCritical() << "Could not allocate buffer for tone clip";
|
||||
}
|
||||
clip->audio_reset = true;
|
||||
}
|
||||
@@ -649,21 +649,21 @@ void open_clip_worker(Clip* clip) {
|
||||
int errCode = avformat_open_input(
|
||||
&clip->formatCtx,
|
||||
filename,
|
||||
NULL,
|
||||
NULL
|
||||
nullptr,
|
||||
nullptr
|
||||
);
|
||||
if (errCode != 0) {
|
||||
char err[1024];
|
||||
av_strerror(errCode, err, 1024);
|
||||
dout << "[ERROR] Could not open" << filename << "-" << err;
|
||||
qCritical() << "Could not open" << filename << "-" << err;
|
||||
return;
|
||||
}
|
||||
|
||||
errCode = avformat_find_stream_info(clip->formatCtx, NULL);
|
||||
errCode = avformat_find_stream_info(clip->formatCtx, nullptr);
|
||||
if (errCode < 0) {
|
||||
char err[1024];
|
||||
av_strerror(errCode, err, 1024);
|
||||
dout << "[ERROR] Could not open" << filename << "-" << err;
|
||||
qCritical() << "Could not open" << filename << "-" << err;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -692,7 +692,7 @@ void open_clip_worker(Clip* clip) {
|
||||
|
||||
if (ms->video_interlacing != VIDEO_PROGRESSIVE) clip->max_queue_size *= 2;
|
||||
|
||||
clip->opts = NULL;
|
||||
clip->opts = nullptr;
|
||||
|
||||
// optimized decoding settings
|
||||
if ((clip->stream->codecpar->codec_id != AV_CODEC_ID_PNG &&
|
||||
@@ -709,13 +709,13 @@ void open_clip_worker(Clip* clip) {
|
||||
|
||||
// Open codec
|
||||
if (avcodec_open2(clip->codecCtx, clip->codec, &clip->opts) < 0) {
|
||||
dout << "[ERROR] Could not open codec";
|
||||
qCritical() << "Could not open codec";
|
||||
}
|
||||
|
||||
// allocate filtergraph
|
||||
clip->filter_graph = avfilter_graph_alloc();
|
||||
if (clip->filter_graph == NULL) {
|
||||
dout << "[ERROR] Could not create filtergraph";
|
||||
if (clip->filter_graph == nullptr) {
|
||||
qCritical() << "Could not create filtergraph";
|
||||
}
|
||||
char filter_args[512];
|
||||
|
||||
@@ -730,8 +730,8 @@ void open_clip_worker(Clip* clip) {
|
||||
clip->stream->codecpar->sample_aspect_ratio.den
|
||||
);
|
||||
|
||||
avfilter_graph_create_filter(&clip->buffersrc_ctx, avfilter_get_by_name("buffer"), "in", filter_args, NULL, clip->filter_graph);
|
||||
avfilter_graph_create_filter(&clip->buffersink_ctx, avfilter_get_by_name("buffersink"), "out", NULL, NULL, clip->filter_graph);
|
||||
avfilter_graph_create_filter(&clip->buffersrc_ctx, avfilter_get_by_name("buffer"), "in", filter_args, nullptr, clip->filter_graph);
|
||||
avfilter_graph_create_filter(&clip->buffersink_ctx, avfilter_get_by_name("buffersink"), "out", nullptr, nullptr, clip->filter_graph);
|
||||
|
||||
AVFilterContext* last_filter = clip->buffersrc_ctx;
|
||||
|
||||
@@ -739,17 +739,18 @@ void open_clip_worker(Clip* clip) {
|
||||
AVFilterContext* yadif_filter;
|
||||
char yadif_args[100];
|
||||
snprintf(yadif_args, sizeof(yadif_args), "mode=3:parity=%d", ((ms->video_interlacing == VIDEO_TOP_FIELD_FIRST) ? 0 : 1)); // there's a CUDA version if we start using nvdec/nvenc
|
||||
avfilter_graph_create_filter(&yadif_filter, avfilter_get_by_name("yadif"), "yadif", yadif_args, NULL, clip->filter_graph);
|
||||
avfilter_graph_create_filter(&yadif_filter, avfilter_get_by_name("yadif"), "yadif", yadif_args, nullptr, clip->filter_graph);
|
||||
|
||||
avfilter_link(last_filter, 0, yadif_filter, 0);
|
||||
last_filter = yadif_filter;
|
||||
}
|
||||
|
||||
/* stabilization code */
|
||||
bool stabilize = false;
|
||||
/*bool stabilize = false;
|
||||
if (stabilize) {
|
||||
AVFilterContext* stab_filter;
|
||||
int stab_ret = avfilter_graph_create_filter(&stab_filter, avfilter_get_by_name("vidstabtransform"), "vidstab", "input=/media/matt/Home/samples/transforms.trf", NULL, clip->filter_graph);
|
||||
int stab_ret = avfilter_graph_create_filter(&stab_filter, avfilter_get_by_name("vidstabtransform"), "vidstab", "input=/media/matt/Home/samples/transforms.trf", nullptr, clip->filter_graph);
|
||||
|
||||
if (stab_ret < 0) {
|
||||
char err[100];
|
||||
av_strerror(stab_ret, err, sizeof(err));
|
||||
@@ -757,7 +758,7 @@ void open_clip_worker(Clip* clip) {
|
||||
avfilter_link(last_filter, 0, stab_filter, 0);
|
||||
last_filter = stab_filter;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
enum AVPixelFormat valid_pix_fmts[] = {
|
||||
AV_PIX_FMT_RGB24,
|
||||
@@ -765,18 +766,18 @@ void open_clip_worker(Clip* clip) {
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
|
||||
clip->pix_fmt = avcodec_find_best_pix_fmt_of_list(valid_pix_fmts, static_cast<enum AVPixelFormat>(clip->stream->codecpar->format), 1, NULL);
|
||||
clip->pix_fmt = avcodec_find_best_pix_fmt_of_list(valid_pix_fmts, static_cast<enum AVPixelFormat>(clip->stream->codecpar->format), 1, nullptr);
|
||||
const char* chosen_format = av_get_pix_fmt_name(static_cast<enum AVPixelFormat>(clip->pix_fmt));
|
||||
char format_args[100];
|
||||
snprintf(format_args, sizeof(format_args), "pix_fmts=%s", chosen_format);
|
||||
|
||||
AVFilterContext* format_conv;
|
||||
avfilter_graph_create_filter(&format_conv, avfilter_get_by_name("format"), "fmt", format_args, NULL, clip->filter_graph);
|
||||
avfilter_graph_create_filter(&format_conv, avfilter_get_by_name("format"), "fmt", format_args, nullptr, clip->filter_graph);
|
||||
avfilter_link(last_filter, 0, format_conv, 0);
|
||||
|
||||
avfilter_link(format_conv, 0, clip->buffersink_ctx, 0);
|
||||
|
||||
avfilter_graph_config(clip->filter_graph, NULL);
|
||||
avfilter_graph_config(clip->filter_graph, nullptr);
|
||||
} else if (clip->stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
if (clip->codecCtx->channel_layout == 0) clip->codecCtx->channel_layout = av_get_default_channel_layout(clip->stream->codecpar->channels);
|
||||
|
||||
@@ -802,17 +803,17 @@ void open_clip_worker(Clip* clip) {
|
||||
clip->codecCtx->channel_layout
|
||||
);
|
||||
|
||||
avfilter_graph_create_filter(&clip->buffersrc_ctx, avfilter_get_by_name("abuffer"), "in", filter_args, NULL, clip->filter_graph);
|
||||
avfilter_graph_create_filter(&clip->buffersink_ctx, avfilter_get_by_name("abuffersink"), "out", NULL, NULL, clip->filter_graph);
|
||||
avfilter_graph_create_filter(&clip->buffersrc_ctx, avfilter_get_by_name("abuffer"), "in", filter_args, nullptr, clip->filter_graph);
|
||||
avfilter_graph_create_filter(&clip->buffersink_ctx, avfilter_get_by_name("abuffersink"), "out", nullptr, nullptr, clip->filter_graph);
|
||||
|
||||
enum AVSampleFormat sample_fmts[] = { sample_format, static_cast<AVSampleFormat>(-1) };
|
||||
if (av_opt_set_int_list(clip->buffersink_ctx, "sample_fmts", sample_fmts, -1, AV_OPT_SEARCH_CHILDREN) < 0) {
|
||||
dout << "[ERROR] Could not set output sample format";
|
||||
qCritical() << "Could not set output sample format";
|
||||
}
|
||||
|
||||
int64_t channel_layouts[] = { AV_CH_LAYOUT_STEREO, static_cast<AVSampleFormat>(-1) };
|
||||
if (av_opt_set_int_list(clip->buffersink_ctx, "channel_layouts", channel_layouts, -1, AV_OPT_SEARCH_CHILDREN) < 0) {
|
||||
dout << "[ERROR] Could not set output sample format";
|
||||
qCritical() << "Could not set output sample format";
|
||||
}
|
||||
|
||||
int target_sample_rate = current_audio_freq();
|
||||
@@ -837,16 +838,16 @@ void open_clip_worker(Clip* clip) {
|
||||
if (whole2 > 0) {
|
||||
snprintf(speed_param, sizeof(speed_param), "%f", base);
|
||||
for (int i=0;i<whole2;i++) {
|
||||
AVFilterContext* tempo_filter = NULL;
|
||||
avfilter_graph_create_filter(&tempo_filter, avfilter_get_by_name("atempo"), "atempo", speed_param, NULL, clip->filter_graph);
|
||||
AVFilterContext* tempo_filter = nullptr;
|
||||
avfilter_graph_create_filter(&tempo_filter, avfilter_get_by_name("atempo"), "atempo", speed_param, nullptr, clip->filter_graph);
|
||||
avfilter_link(previous_filter, 0, tempo_filter, 0);
|
||||
previous_filter = tempo_filter;
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(speed_param, sizeof(speed_param), "%f", qPow(base, speedlog));
|
||||
last_filter = NULL;
|
||||
avfilter_graph_create_filter(&last_filter, avfilter_get_by_name("atempo"), "atempo", speed_param, NULL, clip->filter_graph);
|
||||
last_filter = nullptr;
|
||||
avfilter_graph_create_filter(&last_filter, avfilter_get_by_name("atempo"), "atempo", speed_param, nullptr, clip->filter_graph);
|
||||
avfilter_link(previous_filter, 0, last_filter, 0);
|
||||
// }
|
||||
|
||||
@@ -858,10 +859,10 @@ void open_clip_worker(Clip* clip) {
|
||||
|
||||
int sample_rates[] = { target_sample_rate, 0 };
|
||||
if (av_opt_set_int_list(clip->buffersink_ctx, "sample_rates", sample_rates, 0, AV_OPT_SEARCH_CHILDREN) < 0) {
|
||||
dout << "[ERROR] Could not set output sample rates";
|
||||
qCritical() << "Could not set output sample rates";
|
||||
}
|
||||
|
||||
avfilter_graph_config(clip->filter_graph, NULL);
|
||||
avfilter_graph_config(clip->filter_graph, nullptr);
|
||||
|
||||
clip->audio_reset = true;
|
||||
}
|
||||
@@ -875,7 +876,7 @@ void open_clip_worker(Clip* clip) {
|
||||
|
||||
clip->finished_opening = true;
|
||||
|
||||
dout << "[INFO] Clip opened on track" << clip->track;
|
||||
qInfo() << "Clip opened on track" << clip->track;
|
||||
}
|
||||
|
||||
void cache_clip_worker(Clip* clip, long playhead, bool reset, bool scrubbing, QVector<Clip*> nests) {
|
||||
@@ -885,7 +886,7 @@ void cache_clip_worker(Clip* clip, long playhead, bool reset, bool scrubbing, QV
|
||||
clip->audio_reset = false;
|
||||
}
|
||||
|
||||
if (clip->media == NULL) {
|
||||
if (clip->media == nullptr) {
|
||||
if (clip->track >= 0) {
|
||||
cache_audio_worker(clip, scrubbing, nests);
|
||||
}
|
||||
@@ -901,7 +902,7 @@ void cache_clip_worker(Clip* clip, long playhead, bool reset, bool scrubbing, QV
|
||||
void close_clip_worker(Clip* clip) {
|
||||
clip->finished_opening = false;
|
||||
|
||||
if (clip->media != NULL && clip->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
if (clip->media != nullptr && clip->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
clip->queue_clear();
|
||||
|
||||
avfilter_graph_free(&clip->filter_graph);
|
||||
@@ -918,7 +919,7 @@ void close_clip_worker(Clip* clip) {
|
||||
|
||||
clip->reset();
|
||||
|
||||
dout << "[INFO] Clip closed on track" << clip->track;
|
||||
qInfo() << "Clip closed on track" << clip->track;
|
||||
}
|
||||
|
||||
void Cacher::run() {
|
||||
|
||||
+21
-21
@@ -37,7 +37,7 @@ bool texture_failed = false;
|
||||
bool rendering = false;
|
||||
|
||||
bool clip_uses_cacher(Clip* clip) {
|
||||
return (clip->media == NULL && clip->track >= 0) || (clip->media != NULL && clip->media->get_type() == MEDIA_TYPE_FOOTAGE);
|
||||
return (clip->media == nullptr && clip->track >= 0) || (clip->media != nullptr && clip->media->get_type() == MEDIA_TYPE_FOOTAGE);
|
||||
}
|
||||
|
||||
void open_clip(Clip* clip, bool multithreaded) {
|
||||
@@ -63,20 +63,20 @@ void open_clip(Clip* clip, bool multithreaded) {
|
||||
|
||||
void close_clip(Clip* clip, bool wait) {
|
||||
// destroy opengl texture in main thread
|
||||
if (clip->texture != NULL) {
|
||||
if (clip->texture != nullptr) {
|
||||
delete clip->texture;
|
||||
clip->texture = NULL;
|
||||
clip->texture = nullptr;
|
||||
}
|
||||
|
||||
for (int i=0;i<clip->effects.size();i++) {
|
||||
if (clip->effects.at(i)->is_open()) clip->effects.at(i)->close();
|
||||
}
|
||||
|
||||
if (clip->fbo != NULL) {
|
||||
if (clip->fbo != nullptr) {
|
||||
delete clip->fbo[0];
|
||||
delete clip->fbo[1];
|
||||
delete [] clip->fbo;
|
||||
clip->fbo = NULL;
|
||||
clip->fbo = nullptr;
|
||||
}
|
||||
|
||||
if (clip_uses_cacher(clip)) {
|
||||
@@ -91,7 +91,7 @@ void close_clip(Clip* clip, bool wait) {
|
||||
close_clip_worker(clip);
|
||||
}
|
||||
} else {
|
||||
if (clip->media != NULL && clip->media->get_type() == MEDIA_TYPE_SEQUENCE)
|
||||
if (clip->media != nullptr && clip->media->get_type() == MEDIA_TYPE_SEQUENCE)
|
||||
closeActiveClips(clip->media->to_sequence());
|
||||
|
||||
clip->open = false;
|
||||
@@ -129,7 +129,7 @@ void get_clip_frame(Clip* c, long playhead) {
|
||||
second_pts *= 2;
|
||||
}
|
||||
|
||||
AVFrame* target_frame = NULL;
|
||||
AVFrame* target_frame = nullptr;
|
||||
|
||||
bool reset = false;
|
||||
bool cache = true;
|
||||
@@ -222,7 +222,7 @@ void get_clip_frame(Clip* c, long playhead) {
|
||||
#ifdef GCF_DEBUG
|
||||
dout << "GCF ==> RESET" << target_pts << "(" << target_frame->pts << "-" << target_frame->pts+target_frame->pkt_duration << ")";
|
||||
#endif
|
||||
if (!config.fast_seeking) target_frame = NULL;
|
||||
if (!config.fast_seeking) target_frame = nullptr;
|
||||
reset = true;
|
||||
c->last_invalid_ts = target_pts;
|
||||
} else {
|
||||
@@ -231,7 +231,7 @@ void get_clip_frame(Clip* c, long playhead) {
|
||||
#endif
|
||||
if (c->queue.size() >= c->max_queue_size) c->queue_remove_earliest();
|
||||
c->ignore_reverse = true;
|
||||
target_frame = NULL;
|
||||
target_frame = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -240,13 +240,13 @@ void get_clip_frame(Clip* c, long playhead) {
|
||||
reset = true;
|
||||
}
|
||||
|
||||
if (target_frame == NULL || reset) {
|
||||
if (target_frame == nullptr || reset) {
|
||||
// reset cache
|
||||
texture_failed = true;
|
||||
dout << "[INFO] Frame queue couldn't keep up - either the user seeked or the system is overloaded (queue size:" << c->queue.size() << ")";
|
||||
qInfo() << "Frame queue couldn't keep up - either the user seeked or the system is overloaded (queue size:" << c->queue.size() << ")";
|
||||
}
|
||||
|
||||
if (target_frame != NULL) {
|
||||
if (target_frame != nullptr) {
|
||||
int nb_components = av_pix_fmt_desc_get(static_cast<enum AVPixelFormat>(c->pix_fmt))->nb_components;
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, target_frame->linesize[0]/nb_components);
|
||||
|
||||
@@ -291,7 +291,7 @@ double playhead_to_clip_seconds(Clip* c, long playhead) {
|
||||
long clip_frame = playhead_to_clip_frame(c, playhead);
|
||||
if (c->reverse) clip_frame = c->getMaximumLength() - clip_frame - 1;
|
||||
double secs = ((double) clip_frame/c->sequence->frame_rate)*c->speed;
|
||||
if (c->media != NULL && c->media->get_type() == MEDIA_TYPE_FOOTAGE) secs *= c->media->to_footage()->speed;
|
||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE) secs *= c->media->to_footage()->speed;
|
||||
return secs;
|
||||
}
|
||||
|
||||
@@ -325,24 +325,24 @@ int retrieve_next_frame(Clip* c, AVFrame* f) {
|
||||
if (read_ret >= 0) {
|
||||
int send_ret = avcodec_send_packet(c->codecCtx, c->pkt);
|
||||
if (send_ret < 0) {
|
||||
dout << "[ERROR] Failed to send packet to decoder." << send_ret;
|
||||
qCritical() << "Failed to send packet to decoder." << send_ret;
|
||||
return send_ret;
|
||||
}
|
||||
} else {
|
||||
if (read_ret == AVERROR_EOF) {
|
||||
int send_ret = avcodec_send_packet(c->codecCtx, NULL);
|
||||
int send_ret = avcodec_send_packet(c->codecCtx, nullptr);
|
||||
if (send_ret < 0) {
|
||||
dout << "[ERROR] Failed to send packet to decoder." << send_ret;
|
||||
qCritical() << "Failed to send packet to decoder." << send_ret;
|
||||
return send_ret;
|
||||
}
|
||||
} else {
|
||||
dout << "[ERROR] Could not read frame." << read_ret;
|
||||
qCritical() << "Could not read frame." << read_ret;
|
||||
return read_ret; // skips trying to find a frame at all
|
||||
}
|
||||
}
|
||||
}
|
||||
if (receive_ret < 0) {
|
||||
if (receive_ret != AVERROR_EOF) dout << "[ERROR] Failed to receive packet from decoder." << receive_ret;
|
||||
if (receive_ret != AVERROR_EOF) qCritical() << "Failed to receive packet from decoder." << receive_ret;
|
||||
result = receive_ret;
|
||||
}
|
||||
|
||||
@@ -365,11 +365,11 @@ void set_sequence(Sequence* s) {
|
||||
}
|
||||
|
||||
void closeActiveClips(Sequence *s) {
|
||||
if (s != NULL) {
|
||||
if (s != nullptr) {
|
||||
for (int i=0;i<s->clips.size();i++) {
|
||||
Clip* c = s->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c->media != NULL && c->media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
if (c != nullptr) {
|
||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
closeActiveClips(c->media->to_sequence());
|
||||
if (c->open) close_clip(c, true);
|
||||
} else if (c->open) {
|
||||
|
||||
+33
-33
@@ -25,7 +25,7 @@ Clip::Clip(Sequence* s) :
|
||||
timeline_in(0),
|
||||
timeline_out(0),
|
||||
track(0),
|
||||
media(NULL),
|
||||
media(nullptr),
|
||||
speed(1.0),
|
||||
reverse(false),
|
||||
maintain_audio_pitch(false),
|
||||
@@ -36,9 +36,9 @@ Clip::Clip(Sequence* s) :
|
||||
replaced(false),
|
||||
ignore_reverse(false),
|
||||
use_existing_frame(false),
|
||||
filter_graph(NULL),
|
||||
fbo(NULL),
|
||||
opts(NULL)
|
||||
filter_graph(nullptr),
|
||||
fbo(nullptr),
|
||||
opts(nullptr)
|
||||
{
|
||||
pkt = av_packet_alloc();
|
||||
reset();
|
||||
@@ -67,10 +67,10 @@ Clip* Clip::copy(Sequence* s) {
|
||||
copy->effects.append(effects.at(i)->copy(copy));
|
||||
}
|
||||
|
||||
copy->cached_fr = (this->sequence == NULL) ? cached_fr : this->sequence->frame_rate;
|
||||
copy->cached_fr = (this->sequence == nullptr) ? 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);
|
||||
if (get_opening_transition() != nullptr && get_opening_transition()->secondary_clip == nullptr) copy->opening_transition = get_opening_transition()->copy(copy, nullptr);
|
||||
if (get_closing_transition() != nullptr && get_closing_transition()->secondary_clip == nullptr) copy->closing_transition = get_closing_transition()->copy(copy, nullptr);
|
||||
|
||||
copy->recalculateMaxLength();
|
||||
|
||||
@@ -86,16 +86,16 @@ void Clip::reset() {
|
||||
frame_sample_index = -1;
|
||||
audio_buffer_write = false;
|
||||
texture_frame = -1;
|
||||
formatCtx = NULL;
|
||||
stream = NULL;
|
||||
codec = NULL;
|
||||
codecCtx = NULL;
|
||||
texture = NULL;
|
||||
formatCtx = nullptr;
|
||||
stream = nullptr;
|
||||
codec = nullptr;
|
||||
codecCtx = nullptr;
|
||||
texture = nullptr;
|
||||
last_invalid_ts = -1;
|
||||
}
|
||||
|
||||
void Clip::reset_audio() {
|
||||
if (media == NULL || media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
if (media == nullptr || media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
audio_reset = true;
|
||||
frame_sample_index = -1;
|
||||
audio_buffer_write = 0;
|
||||
@@ -103,14 +103,14 @@ void Clip::reset_audio() {
|
||||
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 (c != nullptr) c->reset_audio();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Clip::refresh() {
|
||||
// validates media if it was replaced
|
||||
if (replaced && media != NULL && media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
if (replaced && media != nullptr && media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* m = media->to_footage();
|
||||
|
||||
if (track < 0 && m->video_tracks.size() > 0) {
|
||||
@@ -150,24 +150,24 @@ void Clip::queue_remove_earliest() {
|
||||
|
||||
Transition* Clip::get_opening_transition() {
|
||||
if (opening_transition > -1) {
|
||||
if (this->sequence == NULL) {
|
||||
if (this->sequence == nullptr) {
|
||||
return clipboard_transitions.at(opening_transition);
|
||||
} else {
|
||||
return this->sequence->transitions.at(opening_transition);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Transition* Clip::get_closing_transition() {
|
||||
if (closing_transition > -1) {
|
||||
if (this->sequence == NULL) {
|
||||
if (this->sequence == nullptr) {
|
||||
return clipboard_transitions.at(closing_transition);
|
||||
} else {
|
||||
return this->sequence->transitions.at(closing_transition);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Clip::~Clip() {
|
||||
@@ -185,7 +185,7 @@ Clip::~Clip() {
|
||||
}
|
||||
|
||||
long Clip::get_clip_in_with_transition() {
|
||||
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip != NULL) {
|
||||
if (get_opening_transition() != nullptr && get_opening_transition()->secondary_clip != nullptr) {
|
||||
// we must be the secondary clip, so return (timeline in - length)
|
||||
return clip_in - get_opening_transition()->get_true_length();
|
||||
}
|
||||
@@ -193,7 +193,7 @@ long Clip::get_clip_in_with_transition() {
|
||||
}
|
||||
|
||||
long Clip::get_timeline_in_with_transition() {
|
||||
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip != NULL) {
|
||||
if (get_opening_transition() != nullptr && get_opening_transition()->secondary_clip != nullptr) {
|
||||
// we must be the secondary clip, so return (timeline in - length)
|
||||
return timeline_in - get_opening_transition()->get_true_length();
|
||||
}
|
||||
@@ -201,7 +201,7 @@ long Clip::get_timeline_in_with_transition() {
|
||||
}
|
||||
|
||||
long Clip::get_timeline_out_with_transition() {
|
||||
if (get_closing_transition() != NULL && get_closing_transition()->secondary_clip != NULL) {
|
||||
if (get_closing_transition() != nullptr && get_closing_transition()->secondary_clip != nullptr) {
|
||||
// we must be the primary clip, so return (timeline out + length2)
|
||||
return timeline_out + get_closing_transition()->get_true_length();
|
||||
} else {
|
||||
@@ -216,29 +216,29 @@ long Clip::getLength() {
|
||||
|
||||
double Clip::getMediaFrameRate() {
|
||||
Q_ASSERT(track < 0);
|
||||
if (media != NULL) {
|
||||
if (media != nullptr) {
|
||||
double rate = media->get_frame_rate(media_stream);
|
||||
if (!qIsNaN(rate)) return rate;
|
||||
}
|
||||
if (sequence != NULL) return sequence->frame_rate;
|
||||
if (sequence != nullptr) return sequence->frame_rate;
|
||||
return qSNaN();
|
||||
}
|
||||
|
||||
void Clip::recalculateMaxLength() {
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
double fr = this->sequence->frame_rate;
|
||||
|
||||
fr /= speed;
|
||||
|
||||
calculated_length = LONG_MAX;
|
||||
|
||||
if (media != NULL) {
|
||||
if (media != nullptr) {
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* m = media->to_footage();
|
||||
const FootageStream* ms = m->get_stream_from_file_index(track < 0, media_stream);
|
||||
if (ms != NULL && ms->infinite_length) {
|
||||
if (ms != nullptr && ms->infinite_length) {
|
||||
calculated_length = LONG_MAX;
|
||||
} else {
|
||||
calculated_length = m->get_length_in_frames(fr);
|
||||
@@ -261,13 +261,13 @@ long Clip::getMaximumLength() {
|
||||
}
|
||||
|
||||
int Clip::getWidth() {
|
||||
if (media == NULL && sequence != NULL) return sequence->width;
|
||||
if (media == nullptr && sequence != nullptr) return sequence->width;
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
const 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 (ms != nullptr) return ms->video_width;
|
||||
if (sequence != nullptr) return sequence->width;
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
@@ -279,13 +279,13 @@ int Clip::getWidth() {
|
||||
}
|
||||
|
||||
int Clip::getHeight() {
|
||||
if (media == NULL && sequence != NULL) return sequence->height;
|
||||
if (media == nullptr && sequence != nullptr) return sequence->height;
|
||||
switch (media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
const 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 (ms != nullptr) return ms->video_height;
|
||||
if (sequence != nullptr) return sequence->height;
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
|
||||
+71
-58
@@ -43,7 +43,9 @@
|
||||
#include <QPainter>
|
||||
#include <QtMath>
|
||||
#include <QMenu>
|
||||
#include <QApplication>
|
||||
|
||||
bool shaders_are_enabled = true;
|
||||
QVector<EffectMeta> effects;
|
||||
|
||||
Effect* create_effect(Clip* c, const EffectMeta* em) {
|
||||
@@ -69,10 +71,12 @@ Effect* create_effect(Clip* c, const EffectMeta* em) {
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
dout << "[ERROR] Invalid effect data";
|
||||
QMessageBox::critical(mainWindow, "Invalid effect", "No candidate for effect '" + em->name + "'. This effect may be corrupt. Try reinstalling it or Olive.");
|
||||
qCritical() << "Invalid effect data";
|
||||
QMessageBox::critical(mainWindow,
|
||||
QCoreApplication::translate("Effect", "Invalid effect"),
|
||||
QCoreApplication::translate("Effect", "No candidate for effect '%1'. This effect may be corrupt. Try reinstalling it or Olive.").arg(em->name));
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const EffectMeta* get_internal_meta(int internal_id, int type) {
|
||||
@@ -81,10 +85,12 @@ const EffectMeta* get_internal_meta(int internal_id, int type) {
|
||||
return &effects.at(i);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void load_internal_effects() {
|
||||
if (!shaders_are_enabled) qWarning() << "Shaders are disabled, some effects may be nonfunctional";
|
||||
|
||||
EffectMeta em;
|
||||
|
||||
// internal effects
|
||||
@@ -192,7 +198,7 @@ void load_shader_effects() {
|
||||
for (int i=0;i<entries.size();i++) {
|
||||
QFile file(effects_path + "/" + entries.at(i));
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
dout << "[ERROR] Could not open" << entries.at(i);
|
||||
qCritical() << "Could not open" << entries.at(i);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -220,7 +226,7 @@ void load_shader_effects() {
|
||||
em.internal = -1;
|
||||
effects.append(em);
|
||||
} else {
|
||||
dout << "[ERROR] Invalid effect found in" << entries.at(i);
|
||||
qCritical() << "Invalid effect found in" << entries.at(i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -248,12 +254,12 @@ EffectInit::EffectInit() {
|
||||
}
|
||||
|
||||
void EffectInit::run() {
|
||||
dout << "[INFO] Initializing effects...";
|
||||
qInfo() << "Initializing effects...";
|
||||
load_internal_effects();
|
||||
load_shader_effects();
|
||||
load_vst_effects();
|
||||
panel_effect_controls->effects_loaded.unlock();
|
||||
dout << "[INFO] Finished initializing effects";
|
||||
qInfo() << "Finished initializing effects";
|
||||
}
|
||||
|
||||
Effect::Effect(Clip* c, const EffectMeta *em) :
|
||||
@@ -263,11 +269,11 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
|
||||
enable_coords(false),
|
||||
enable_superimpose(false),
|
||||
enable_image(false),
|
||||
glslProgram(NULL),
|
||||
texture(NULL),
|
||||
glslProgram(nullptr),
|
||||
texture(nullptr),
|
||||
enable_always_update(false),
|
||||
isOpen(false),
|
||||
bound(false),
|
||||
enable_always_update(false)
|
||||
bound(false)
|
||||
{
|
||||
// set up base UI
|
||||
container = new CollapsibleWidget();
|
||||
@@ -280,7 +286,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
|
||||
|
||||
connect(container->title_bar, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu(const QPoint&)));
|
||||
|
||||
if (em != NULL) {
|
||||
if (em != nullptr) {
|
||||
// set up UI from effect file
|
||||
container->setText(em->name);
|
||||
|
||||
@@ -334,7 +340,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
|
||||
}
|
||||
|
||||
if (id.isEmpty()) {
|
||||
dout << "[ERROR] Couldn't load field from" << em->filename << "- ID cannot be empty.";
|
||||
qCritical() << "Couldn't load field from" << em->filename << "- ID cannot be empty.";
|
||||
} else if (type > -1) {
|
||||
EffectField* field = row->add_field(type, id);
|
||||
connect(field, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||
@@ -363,11 +369,11 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
|
||||
} else if (attr.name() == "b") {
|
||||
color.setBlue(attr.value().toInt());
|
||||
} else if (attr.name() == "rf") {
|
||||
color.setRedF(attr.value().toFloat());
|
||||
color.setRedF(attr.value().toDouble());
|
||||
} else if (attr.name() == "gf") {
|
||||
color.setGreenF(attr.value().toFloat());
|
||||
color.setGreenF(attr.value().toDouble());
|
||||
} else if (attr.name() == "bf") {
|
||||
color.setBlueF(attr.value().toFloat());
|
||||
color.setBlueF(attr.value().toDouble());
|
||||
} else if (attr.name() == "hex") {
|
||||
color.setNamedColor(attr.value().toString());
|
||||
}
|
||||
@@ -453,7 +459,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
|
||||
if (script_file.open(QFile::ReadOnly)) {
|
||||
script = script_file.readAll();
|
||||
} else {
|
||||
dout << "[ERROR] Failed to open superimpose script file for" << em->filename;
|
||||
qCritical() << "Failed to open superimpose script file for" << em->filename;
|
||||
enable_superimpose = false;
|
||||
}
|
||||
break;
|
||||
@@ -465,7 +471,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
|
||||
|
||||
effect_file.close();
|
||||
} else {
|
||||
dout << "[ERROR] Failed to open effect file" << em->filename;
|
||||
qCritical() << "Failed to open effect file" << em->filename;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -501,7 +507,7 @@ void Effect::copy_field_keyframes(Effect* e) {
|
||||
}
|
||||
|
||||
EffectRow* Effect::add_row(const QString& name, bool savable, bool keyframable) {
|
||||
EffectRow* row = new EffectRow(this, savable, ui_layout, name, rows.size());
|
||||
EffectRow* row = new EffectRow(this, savable, ui_layout, name, rows.size(), keyframable);
|
||||
rows.append(row);
|
||||
return row;
|
||||
}
|
||||
@@ -542,18 +548,18 @@ void Effect::show_context_menu(const QPoint& pos) {
|
||||
int index = get_index_in_clip();
|
||||
|
||||
if (index > 0) {
|
||||
QAction* move_up = menu.addAction("Move &Up");
|
||||
QAction* move_up = menu.addAction(tr("Move &Up"));
|
||||
connect(move_up, SIGNAL(triggered(bool)), this, SLOT(move_up()));
|
||||
}
|
||||
|
||||
if (index < parent_clip->effects.size() - 1) {
|
||||
QAction* move_down = menu.addAction("Move &Down");
|
||||
QAction* move_down = menu.addAction(tr("Move &Down"));
|
||||
connect(move_down, SIGNAL(triggered(bool)), this, SLOT(move_down()));
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* del_action = menu.addAction("D&elete");
|
||||
QAction* del_action = menu.addAction(tr("D&elete"));
|
||||
connect(del_action, SIGNAL(triggered(bool)), this, SLOT(delete_self()));
|
||||
|
||||
menu.exec(container->title_bar->mapToGlobal(pos));
|
||||
@@ -587,7 +593,7 @@ void Effect::move_down() {
|
||||
}
|
||||
|
||||
int Effect::get_index_in_clip() {
|
||||
if (parent_clip != NULL) {
|
||||
if (parent_clip != nullptr) {
|
||||
for (int i=0;i<parent_clip->effects.size();i++) {
|
||||
if (parent_clip->effects.at(i) == this) {
|
||||
return i;
|
||||
@@ -652,7 +658,6 @@ void Effect::load(QXmlStreamReader& stream) {
|
||||
if (stream.name() == "field" && stream.isStartElement()) {
|
||||
if (field_count < row->fieldCount()) {
|
||||
// match field using ID
|
||||
bool found_field_by_id = false;
|
||||
int field_number = field_count;
|
||||
for (int k=0;k<stream.attributes().size();k++) {
|
||||
const QXmlStreamAttribute& attr = stream.attributes().at(k);
|
||||
@@ -660,8 +665,7 @@ void Effect::load(QXmlStreamReader& stream) {
|
||||
for (int l=0;l<row->fieldCount();l++) {
|
||||
if (row->field(l)->id == attr.value()) {
|
||||
field_number = l;
|
||||
found_field_by_id = true;
|
||||
dout << "[INFO] Found field by ID";
|
||||
qInfo() << "Found field by ID";
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -710,14 +714,14 @@ void Effect::load(QXmlStreamReader& stream) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dout << "[ERROR] Too many fields for effect" << id << "row" << row_count << ". Project might be corrupt. (Got" << field_count << ", expected <" << row->fieldCount()-1 << ")";
|
||||
qCritical() << "Too many fields for effect" << id << "row" << row_count << ". Project might be corrupt. (Got" << field_count << ", expected <" << row->fieldCount()-1 << ")";
|
||||
}
|
||||
field_count++;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
dout << "[ERROR] Too many rows for effect" << id << ". Project might be corrupt. (Got" << row_count << ", expected <" << rows.size()-1 << ")";
|
||||
qCritical() << "Too many rows for effect" << id << ". Project might be corrupt. (Got" << row_count << ", expected <" << rows.size()-1 << ")";
|
||||
}
|
||||
row_count++;
|
||||
} else if (stream.isStartElement()) {
|
||||
@@ -726,7 +730,7 @@ void Effect::load(QXmlStreamReader& stream) {
|
||||
}
|
||||
}
|
||||
|
||||
void Effect::custom_load(QXmlStreamReader &stream) {}
|
||||
void Effect::custom_load(QXmlStreamReader &) {}
|
||||
|
||||
void Effect::save(QXmlStreamWriter& stream) {
|
||||
stream.writeAttribute("name", meta->name);
|
||||
@@ -783,37 +787,37 @@ void Effect::validate_meta_path() {
|
||||
|
||||
void Effect::open() {
|
||||
if (isOpen) {
|
||||
dout << "[WARNING] Tried to open an effect that was already open";
|
||||
qWarning() << "Tried to open an effect that was already open";
|
||||
close();
|
||||
}
|
||||
if (enable_shader) {
|
||||
if (QOpenGLContext::currentContext() == NULL) {
|
||||
dout << "[WARNING] No current context to create a shader program for - will retry next repaint";
|
||||
if (shaders_are_enabled && enable_shader) {
|
||||
if (QOpenGLContext::currentContext() == nullptr) {
|
||||
qWarning() << "No current context to create a shader program for - will retry next repaint";
|
||||
} else {
|
||||
glslProgram = new QOpenGLShaderProgram();
|
||||
validate_meta_path();
|
||||
bool glsl_compiled = true;
|
||||
if (!vertPath.isEmpty()) {
|
||||
if (glslProgram->addShaderFromSourceFile(QOpenGLShader::Vertex, meta->path + "/" + vertPath)) {
|
||||
dout << "[INFO] Vertex shader added successfully";
|
||||
qInfo() << "Vertex shader added successfully";
|
||||
} else {
|
||||
glsl_compiled = false;
|
||||
dout << "[WARNING] Vertex shader could not be added";
|
||||
qWarning() << "Vertex shader could not be added";
|
||||
}
|
||||
}
|
||||
if (!fragPath.isEmpty()) {
|
||||
if (glslProgram->addShaderFromSourceFile(QOpenGLShader::Fragment, meta->path + "/" + fragPath)) {
|
||||
dout << "[INFO] Fragment shader added successfully";
|
||||
qInfo() << "Fragment shader added successfully";
|
||||
} else {
|
||||
glsl_compiled = false;
|
||||
dout << "[WARNING] Fragment shader could not be added";
|
||||
qWarning() << "Fragment shader could not be added";
|
||||
}
|
||||
}
|
||||
if (glsl_compiled) {
|
||||
if (glslProgram->link()) {
|
||||
dout << "[INFO] Shader program linked successfully";
|
||||
qInfo() << "Shader program linked successfully";
|
||||
} else {
|
||||
dout << "[WARNING] Shader program failed to link";
|
||||
qWarning() << "Shader program failed to link";
|
||||
}
|
||||
}
|
||||
isOpen = true;
|
||||
@@ -829,26 +833,30 @@ void Effect::open() {
|
||||
|
||||
void Effect::close() {
|
||||
if (!isOpen) {
|
||||
dout << "[WARNING] Tried to close an effect that was already closed";
|
||||
qWarning() << "Tried to close an effect that was already closed";
|
||||
}
|
||||
delete_texture();
|
||||
if (glslProgram != NULL) {
|
||||
if (glslProgram != nullptr) {
|
||||
delete glslProgram;
|
||||
glslProgram = NULL;
|
||||
glslProgram = nullptr;
|
||||
}
|
||||
isOpen = false;
|
||||
}
|
||||
|
||||
bool Effect::is_glsl_linked() {
|
||||
return glslProgram != NULL && glslProgram->isLinked();
|
||||
return glslProgram != nullptr && glslProgram->isLinked();
|
||||
}
|
||||
|
||||
void Effect::startEffect() {
|
||||
if (!isOpen) {
|
||||
open();
|
||||
dout << "[WARNING] Tried to start a closed effect - opening";
|
||||
qWarning() << "Tried to start a closed effect - opening";
|
||||
}
|
||||
if (shaders_are_enabled
|
||||
&& enable_shader
|
||||
&& glslProgram->isLinked()) {
|
||||
bound = glslProgram->bind();
|
||||
}
|
||||
if (enable_shader && glslProgram->isLinked()) bound = glslProgram->bind();
|
||||
}
|
||||
|
||||
void Effect::endEffect() {
|
||||
@@ -867,7 +875,7 @@ Effect* Effect::copy(Clip* c) {
|
||||
|
||||
void Effect::process_shader(double timecode, GLTextureCoords&) {
|
||||
glslProgram->setUniformValue("resolution", parent_clip->getWidth(), parent_clip->getHeight());
|
||||
glslProgram->setUniformValue("time", (GLfloat) timecode);
|
||||
glslProgram->setUniformValue("time", GLfloat(timecode));
|
||||
|
||||
for (int i=0;i<rows.size();i++) {
|
||||
EffectRow* row = rows.at(i);
|
||||
@@ -876,10 +884,15 @@ void Effect::process_shader(double timecode, GLTextureCoords&) {
|
||||
if (!field->id.isEmpty()) {
|
||||
switch (field->type) {
|
||||
case EFFECT_FIELD_DOUBLE:
|
||||
glslProgram->setUniformValue(field->id.toUtf8().constData(), (GLfloat) field->get_double_value(timecode));
|
||||
glslProgram->setUniformValue(field->id.toUtf8().constData(), GLfloat(field->get_double_value(timecode)));
|
||||
break;
|
||||
case EFFECT_FIELD_COLOR:
|
||||
glslProgram->setUniformValue(field->id.toUtf8().constData(), field->get_color_value(timecode).redF(), field->get_color_value(timecode).greenF(), field->get_color_value(timecode).blueF());
|
||||
glslProgram->setUniformValue(
|
||||
field->id.toUtf8().constData(),
|
||||
GLfloat(field->get_color_value(timecode).redF()),
|
||||
GLfloat(field->get_color_value(timecode).greenF()),
|
||||
GLfloat(field->get_color_value(timecode).blueF())
|
||||
);
|
||||
break;
|
||||
case EFFECT_FIELD_STRING: break; // can you even send a string to a uniform value?
|
||||
case EFFECT_FIELD_BOOL:
|
||||
@@ -896,7 +909,7 @@ void Effect::process_shader(double timecode, GLTextureCoords&) {
|
||||
}
|
||||
}
|
||||
|
||||
void Effect::process_coords(double, GLTextureCoords&, int data) {}
|
||||
void Effect::process_coords(double, GLTextureCoords&, int) {}
|
||||
|
||||
GLuint Effect::process_superimpose(double timecode) {
|
||||
bool recreate_texture = false;
|
||||
@@ -912,7 +925,7 @@ GLuint Effect::process_superimpose(double timecode) {
|
||||
redraw(timecode);
|
||||
}
|
||||
|
||||
if (texture != NULL) {
|
||||
if (texture != nullptr) {
|
||||
if (recreate_texture || texture->width() != img.width() || texture->height() != img.height()) {
|
||||
delete_texture();
|
||||
texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
|
||||
@@ -932,21 +945,21 @@ void Effect::gizmo_draw(double, GLTextureCoords &) {}
|
||||
void Effect::gizmo_move(EffectGizmo* gizmo, int x_movement, int y_movement, double timecode, bool done) {
|
||||
for (int i=0;i<gizmos.size();i++) {
|
||||
if (gizmos.at(i) == gizmo) {
|
||||
ComboAction* ca = NULL;
|
||||
ComboAction* ca = nullptr;
|
||||
if (done) ca = new ComboAction();
|
||||
if (gizmo->x_field1 != NULL) {
|
||||
if (gizmo->x_field1 != nullptr) {
|
||||
gizmo->x_field1->set_double_value(gizmo->x_field1->get_double_value(timecode) + x_movement*gizmo->x_field_multi1);
|
||||
gizmo->x_field1->make_key_from_change(ca);
|
||||
}
|
||||
if (gizmo->y_field1 != NULL) {
|
||||
if (gizmo->y_field1 != nullptr) {
|
||||
gizmo->y_field1->set_double_value(gizmo->y_field1->get_double_value(timecode) + y_movement*gizmo->y_field_multi1);
|
||||
gizmo->y_field1->make_key_from_change(ca);
|
||||
}
|
||||
if (gizmo->x_field2 != NULL) {
|
||||
if (gizmo->x_field2 != nullptr) {
|
||||
gizmo->x_field2->set_double_value(gizmo->x_field2->get_double_value(timecode) + x_movement*gizmo->x_field_multi2);
|
||||
gizmo->x_field2->make_key_from_change(ca);
|
||||
}
|
||||
if (gizmo->y_field2 != NULL) {
|
||||
if (gizmo->y_field2 != nullptr) {
|
||||
gizmo->y_field2->set_double_value(gizmo->y_field2->get_double_value(timecode) + y_movement*gizmo->y_field_multi2);
|
||||
gizmo->y_field2->make_key_from_change(ca);
|
||||
}
|
||||
@@ -1056,9 +1069,9 @@ bool Effect::valueHasChanged(double timecode) {
|
||||
}
|
||||
|
||||
void Effect::delete_texture() {
|
||||
if (texture != NULL) {
|
||||
if (texture != nullptr) {
|
||||
delete texture;
|
||||
texture = NULL;
|
||||
texture = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ struct EffectMeta {
|
||||
int subtype;
|
||||
};
|
||||
|
||||
extern bool shaders_are_enabled;
|
||||
extern QVector<EffectMeta> effects;
|
||||
|
||||
double log_volume(double linear);
|
||||
|
||||
@@ -270,7 +270,7 @@ QVariant EffectField::validate_keyframe_data(double timecode, bool async) {
|
||||
|
||||
void EffectField::ui_element_change() {
|
||||
bool dragging_double = (type == EFFECT_FIELD_DOUBLE && static_cast<LabelSlider*>(ui_element)->is_dragging());
|
||||
ComboAction* ca = NULL;
|
||||
ComboAction* ca = nullptr;
|
||||
if (!dragging_double) ca = new ComboAction();
|
||||
make_key_from_change(ca);
|
||||
if (!dragging_double) undo_stack.push(ca);
|
||||
@@ -280,7 +280,7 @@ void EffectField::ui_element_change() {
|
||||
void EffectField::make_key_from_change(ComboAction* ca) {
|
||||
if (parent_row->isKeyframing()) {
|
||||
parent_row->set_keyframe_now(ca);
|
||||
} else if (ca != NULL) {
|
||||
} else if (ca != nullptr) {
|
||||
// set undo
|
||||
ca->append(new EffectFieldUndo(this));
|
||||
}
|
||||
|
||||
@@ -68,10 +68,10 @@ public:
|
||||
QWidget* ui_element;
|
||||
|
||||
void make_key_from_change(ComboAction* ca);
|
||||
public slots:
|
||||
void ui_element_change();
|
||||
private:
|
||||
bool hasKeyframes();
|
||||
private slots:
|
||||
void ui_element_change();
|
||||
signals:
|
||||
void changed();
|
||||
void toggled(bool);
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
#include "effectfield.h"
|
||||
|
||||
EffectGizmo::EffectGizmo(int type) :
|
||||
x_field1(NULL),
|
||||
x_field1(nullptr),
|
||||
x_field_multi1(1.0),
|
||||
y_field1(NULL),
|
||||
y_field1(nullptr),
|
||||
y_field_multi1(1.0),
|
||||
x_field2(NULL),
|
||||
x_field2(nullptr),
|
||||
x_field_multi2(1.0),
|
||||
y_field2(NULL),
|
||||
y_field2(nullptr),
|
||||
y_field_multi2(1.0),
|
||||
type(type),
|
||||
cursor(-1)
|
||||
@@ -23,10 +23,10 @@ EffectGizmo::EffectGizmo(int type) :
|
||||
}
|
||||
|
||||
void EffectGizmo::set_previous_value() {
|
||||
if (x_field1 != NULL) static_cast<LabelSlider*>(x_field1->ui_element)->set_previous_value();
|
||||
if (y_field1 != NULL) static_cast<LabelSlider*>(y_field1->ui_element)->set_previous_value();
|
||||
if (x_field2 != NULL) static_cast<LabelSlider*>(x_field2->ui_element)->set_previous_value();
|
||||
if (y_field2 != NULL) static_cast<LabelSlider*>(y_field2->ui_element)->set_previous_value();
|
||||
if (x_field1 != nullptr) static_cast<LabelSlider*>(x_field1->ui_element)->set_previous_value();
|
||||
if (y_field1 != nullptr) static_cast<LabelSlider*>(y_field1->ui_element)->set_previous_value();
|
||||
if (x_field2 != nullptr) static_cast<LabelSlider*>(x_field2->ui_element)->set_previous_value();
|
||||
if (y_field2 != nullptr) static_cast<LabelSlider*>(y_field2->ui_element)->set_previous_value();
|
||||
}
|
||||
|
||||
int EffectGizmo::get_point_count() {
|
||||
|
||||
+21
-21
@@ -5,8 +5,8 @@
|
||||
#define GIZMO_TYPE_POLY 1
|
||||
#define GIZMO_TYPE_TARGET 2
|
||||
|
||||
#define GIZMO_DOT_SIZE 2.5F
|
||||
#define GIZMO_TARGET_SIZE 5.0F
|
||||
#define GIZMO_DOT_SIZE 2.5
|
||||
#define GIZMO_TARGET_SIZE 5.0
|
||||
|
||||
#include <QString>
|
||||
#include <QRect>
|
||||
@@ -19,32 +19,32 @@ class EffectField;
|
||||
class EffectGizmo
|
||||
{
|
||||
public:
|
||||
EffectGizmo(int type);
|
||||
EffectGizmo(int type);
|
||||
|
||||
QVector<QPoint> world_pos;
|
||||
QVector<QPoint> screen_pos;
|
||||
QVector<QPoint> world_pos;
|
||||
QVector<QPoint> screen_pos;
|
||||
|
||||
EffectField* x_field1;
|
||||
double x_field_multi1;
|
||||
EffectField* y_field1;
|
||||
double y_field_multi1;
|
||||
EffectField* x_field2;
|
||||
double x_field_multi2;
|
||||
EffectField* y_field2;
|
||||
double y_field_multi2;
|
||||
EffectField* x_field1;
|
||||
double x_field_multi1;
|
||||
EffectField* y_field1;
|
||||
double y_field_multi1;
|
||||
EffectField* x_field2;
|
||||
double x_field_multi2;
|
||||
EffectField* y_field2;
|
||||
double y_field_multi2;
|
||||
|
||||
void set_previous_value();
|
||||
void set_previous_value();
|
||||
|
||||
QColor color;
|
||||
int get_point_count();
|
||||
QColor color;
|
||||
int get_point_count();
|
||||
|
||||
int get_type();
|
||||
int get_type();
|
||||
|
||||
int get_cursor();
|
||||
void set_cursor(int c);
|
||||
int get_cursor();
|
||||
void set_cursor(int c);
|
||||
private:
|
||||
int type;
|
||||
int cursor;
|
||||
int type;
|
||||
int cursor;
|
||||
};
|
||||
|
||||
#endif // EFFECTGIZMO_H
|
||||
|
||||
@@ -31,7 +31,7 @@ EffectRow::EffectRow(Effect *parent, bool save, QGridLayout *uilayout, const QSt
|
||||
|
||||
column_count = 1;
|
||||
|
||||
if (parent_effect->meta != NULL
|
||||
if (parent_effect->meta != nullptr
|
||||
&& parent_effect->meta->type != EFFECT_TYPE_TRANSITION
|
||||
&& keyframable) {
|
||||
connect(label, SIGNAL(clicked()), this, SLOT(focus_row()));
|
||||
@@ -64,7 +64,10 @@ void EffectRow::set_keyframe_enabled(bool enabled) {
|
||||
set_keyframe_now(ca);
|
||||
undo_stack.push(ca);
|
||||
} else {
|
||||
if (QMessageBox::question(panel_effect_controls, "Disable Keyframes", "Disabling keyframes will delete all current keyframes. Are you sure you want to do this?", QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
|
||||
if (QMessageBox::question(panel_effect_controls,
|
||||
tr("Disable Keyframes"),
|
||||
tr("Disabling keyframes will delete all current keyframes. Are you sure you want to do this?"),
|
||||
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
|
||||
// clear
|
||||
ComboAction* ca = new ComboAction();
|
||||
for (int i=0;i<fieldCount();i++) {
|
||||
@@ -209,7 +212,7 @@ void EffectRow::set_keyframe_now(ComboAction* ca) {
|
||||
field(i)->keyframes[unsafe_keys.at(i)].data = field(i)->get_current_data();
|
||||
}
|
||||
|
||||
if (ca != NULL) {
|
||||
if (ca != nullptr) {
|
||||
for (int i=0;i<fieldCount();i++) {
|
||||
if (key_is_new.at(i)) ca->append(new KeyframeFieldSet(field(i), unsafe_keys.at(i)));
|
||||
ca->append(new SetQVariant(&field(i)->keyframes[unsafe_keys.at(i)].data, unsafe_old_data.at(i), field(i)->get_current_data()));
|
||||
@@ -225,7 +228,7 @@ void EffectRow::set_keyframe_now(ComboAction* ca) {
|
||||
|
||||
|
||||
|
||||
/*if (ca != NULL) {
|
||||
/*if (ca != nullptr) {
|
||||
just_made_unsafe_keyframe = false;
|
||||
} else {
|
||||
if (!just_made_unsafe_keyframe) {
|
||||
@@ -248,7 +251,7 @@ void EffectRow::set_keyframe_now(ComboAction* ca) {
|
||||
|
||||
KeyframeSet* ks = new KeyframeSet(this, index, time, just_made_unsafe_keyframe);
|
||||
|
||||
if (ca != NULL) {
|
||||
if (ca != nullptr) {
|
||||
just_made_unsafe_keyframe = false;
|
||||
ca->append(ks);
|
||||
} else {
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ extern "C" {
|
||||
|
||||
#include "project/clip.h"
|
||||
|
||||
Footage::Footage() : ready(false), preview_gen(NULL), invalid(false), in(0), out(0), speed(1.0) {
|
||||
Footage::Footage() : ready(false), preview_gen(nullptr), invalid(false), in(0), out(0), speed(1.0) {
|
||||
ready_lock.lock();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ Footage::~Footage() {
|
||||
}
|
||||
|
||||
void Footage::reset() {
|
||||
if (preview_gen != NULL) {
|
||||
if (preview_gen != nullptr) {
|
||||
preview_gen->cancel();
|
||||
preview_gen->wait();
|
||||
}
|
||||
@@ -48,7 +48,7 @@ FootageStream* Footage::get_stream_from_file_index(bool video, int index) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void FootageStream::make_square_thumb() {
|
||||
|
||||
+41
-30
@@ -9,6 +9,7 @@
|
||||
#include "projectmodel.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
@@ -19,18 +20,18 @@ extern "C" {
|
||||
|
||||
QString get_interlacing_name(int interlacing) {
|
||||
switch (interlacing) {
|
||||
case VIDEO_PROGRESSIVE: return "None (Progressive)";
|
||||
case VIDEO_TOP_FIELD_FIRST: return "Top Field First";
|
||||
case VIDEO_BOTTOM_FIELD_FIRST: return "Bottom Field First";
|
||||
default: return "Invalid";
|
||||
case VIDEO_PROGRESSIVE: return QCoreApplication::translate("InterlacingName", "None (Progressive)");
|
||||
case VIDEO_TOP_FIELD_FIRST: return QCoreApplication::translate("InterlacingName", "Top Field First");
|
||||
case VIDEO_BOTTOM_FIELD_FIRST: return QCoreApplication::translate("InterlacingName", "Bottom Field First");
|
||||
default: return QCoreApplication::translate("InterlacingName", "Invalid");
|
||||
}
|
||||
}
|
||||
|
||||
QString get_channel_layout_name(int channels, uint64_t layout) {
|
||||
switch (channels) {
|
||||
case 0: return "Invalid"; break;
|
||||
case 1: return "Mono"; break;
|
||||
case 2: return "Stereo"; break;
|
||||
case 0: return QCoreApplication::translate("ChannelLayoutName", "Invalid");
|
||||
case 1: return QCoreApplication::translate("ChannelLayoutName", "Mono");
|
||||
case 2: return QCoreApplication::translate("ChannelLayoutName", "Stereo");
|
||||
default: {
|
||||
char buf[50];
|
||||
av_get_channel_layout_string(buf, sizeof(buf), channels, layout);
|
||||
@@ -41,7 +42,7 @@ QString get_channel_layout_name(int channels, uint64_t layout) {
|
||||
|
||||
Media::Media(Media* iparent) :
|
||||
parent(iparent),
|
||||
throbber(NULL),
|
||||
throbber(nullptr),
|
||||
root(false),
|
||||
type(-1)
|
||||
{}
|
||||
@@ -49,9 +50,9 @@ Media::Media(Media* iparent) :
|
||||
Media::~Media() {
|
||||
switch (get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE: delete to_footage(); break;
|
||||
case MEDIA_TYPE_SEQUENCE: if (object != NULL) delete to_sequence(); break;
|
||||
case MEDIA_TYPE_SEQUENCE: if (object != nullptr) delete to_sequence(); break;
|
||||
}
|
||||
if (throbber != NULL) delete throbber;
|
||||
if (throbber != nullptr) delete throbber;
|
||||
qDeleteAll(children);
|
||||
}
|
||||
|
||||
@@ -72,14 +73,14 @@ void Media::set_sequence(Sequence *s) {
|
||||
set_icon(QIcon(":/icons/sequence.png"));
|
||||
type = MEDIA_TYPE_SEQUENCE;
|
||||
object = s;
|
||||
if (s != NULL) update_tooltip();
|
||||
if (s != nullptr) update_tooltip();
|
||||
}
|
||||
|
||||
void Media::set_folder() {
|
||||
if (folder_name.isEmpty()) folder_name = "New Folder";
|
||||
if (folder_name.isEmpty()) folder_name = QCoreApplication::translate("Media", "New Folder");
|
||||
set_icon(QIcon(":/icons/folder.png"));
|
||||
type = MEDIA_TYPE_FOLDER;
|
||||
object = NULL;
|
||||
object = nullptr;
|
||||
}
|
||||
|
||||
void Media::set_icon(const QIcon &ico) {
|
||||
@@ -95,11 +96,11 @@ void Media::update_tooltip(const QString& error) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
{
|
||||
Footage* f = to_footage();
|
||||
tooltip = "Name: " + f->name + "\nFilename: " + f->url + "\n";
|
||||
tooltip = QCoreApplication::translate("Media", "Name:") + " " + f->name + "\n" + QCoreApplication::translate("Media", "Filename:") + " " + f->url + "\n";
|
||||
|
||||
if (error.isEmpty()) {
|
||||
if (f->video_tracks.size() > 0) {
|
||||
tooltip += "Video Dimensions: ";
|
||||
tooltip += QCoreApplication::translate("Media", "Video Dimensions:") + " ";
|
||||
for (int i=0;i<f->video_tracks.size();i++) {
|
||||
if (i > 0) {
|
||||
tooltip += ", ";
|
||||
@@ -109,7 +110,7 @@ void Media::update_tooltip(const QString& error) {
|
||||
tooltip += "\n";
|
||||
|
||||
if (!f->video_tracks.at(0).infinite_length) {
|
||||
tooltip += "Frame Rate: ";
|
||||
tooltip += QCoreApplication::translate("Media", "Frame Rate:") + " ";
|
||||
for (int i=0;i<f->video_tracks.size();i++) {
|
||||
if (i > 0) {
|
||||
tooltip += ", ";
|
||||
@@ -117,14 +118,16 @@ void Media::update_tooltip(const QString& error) {
|
||||
if (f->video_tracks.at(i).video_interlacing == VIDEO_PROGRESSIVE) {
|
||||
tooltip += QString::number(f->video_tracks.at(i).video_frame_rate * f->speed);
|
||||
} else {
|
||||
tooltip += QString::number(f->video_tracks.at(i).video_frame_rate * f->speed * 2);
|
||||
tooltip += " fields (" + QString::number(f->video_tracks.at(i).video_frame_rate * f->speed) + " frames)";
|
||||
tooltip += QCoreApplication::translate("Media", "%1 fields (%2 frames)").arg(
|
||||
QString::number(f->video_tracks.at(i).video_frame_rate * f->speed * 2),
|
||||
QString::number(f->video_tracks.at(i).video_frame_rate * f->speed)
|
||||
);
|
||||
}
|
||||
}
|
||||
tooltip += "\n";
|
||||
}
|
||||
|
||||
tooltip += "Interlacing: ";
|
||||
tooltip += QCoreApplication::translate("Media", "Interlacing:") + " ";
|
||||
for (int i=0;i<f->video_tracks.size();i++) {
|
||||
if (i > 0) {
|
||||
tooltip += ", ";
|
||||
@@ -136,7 +139,7 @@ void Media::update_tooltip(const QString& error) {
|
||||
if (f->audio_tracks.size() > 0) {
|
||||
tooltip += "\n";
|
||||
|
||||
tooltip += "Audio Frequency: ";
|
||||
tooltip += QCoreApplication::translate("Media", "Audio Frequency:") + " ";
|
||||
for (int i=0;i<f->audio_tracks.size();i++) {
|
||||
if (i > 0) {
|
||||
tooltip += ", ";
|
||||
@@ -145,7 +148,7 @@ void Media::update_tooltip(const QString& error) {
|
||||
}
|
||||
tooltip += "\n";
|
||||
|
||||
tooltip += "Audio Channels: ";
|
||||
tooltip += QCoreApplication::translate("Media", "Audio Channels:") + " ";
|
||||
for (int i=0;i<f->audio_tracks.size();i++) {
|
||||
if (i > 0) {
|
||||
tooltip += ", ";
|
||||
@@ -162,11 +165,19 @@ void Media::update_tooltip(const QString& error) {
|
||||
case MEDIA_TYPE_SEQUENCE:
|
||||
{
|
||||
Sequence* s = to_sequence();
|
||||
tooltip = "Name: " + s->name
|
||||
+ "\nVideo Dimensions: " + QString::number(s->width) + "x" + QString::number(s->height)
|
||||
+ "\nFrame Rate: " + QString::number(s->frame_rate)
|
||||
+ "\nAudio Frequency: " + QString::number(s->audio_frequency)
|
||||
+ "\nAudio Layout: " + get_channel_layout_name(av_get_channel_layout_nb_channels(s->audio_layout), s->audio_layout);
|
||||
|
||||
tooltip = QCoreApplication::translate("Media", "Name: %1"
|
||||
"\nVideo Dimensions: %2x%3"
|
||||
"\nFrame Rate: %4"
|
||||
"\nAudio Frequency: %5"
|
||||
"\nAudio Layout: %6").arg(
|
||||
s->name,
|
||||
QString::number(s->width),
|
||||
QString::number(s->height),
|
||||
QString::number(s->frame_rate),
|
||||
QString::number(s->audio_frequency),
|
||||
get_channel_layout_name(av_get_channel_layout_nb_channels(s->audio_layout), s->audio_layout)
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -207,7 +218,7 @@ double Media::get_frame_rate(int stream) {
|
||||
}
|
||||
case MEDIA_TYPE_SEQUENCE: return to_sequence()->frame_rate;
|
||||
}
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Media::get_sampling_rate(int stream) {
|
||||
@@ -268,9 +279,9 @@ QVariant Media::data(int column, int role) {
|
||||
break;
|
||||
case Qt::DisplayRole:
|
||||
switch (column) {
|
||||
case 0: return (root) ? "Name" : get_name();
|
||||
case 0: return (root) ? QCoreApplication::translate("Media", "Name") : get_name();
|
||||
case 1:
|
||||
if (root) return "Duration";
|
||||
if (root) return QCoreApplication::translate("Media", "Duration");
|
||||
if (get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
Sequence* s = to_sequence();
|
||||
return frame_to_timecode(s->getEndFrame(), config.timecode_view, s->frame_rate);
|
||||
@@ -287,7 +298,7 @@ QVariant Media::data(int column, int role) {
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (root) return "Rate";
|
||||
if (root) return QCoreApplication::translate("Media", "Rate");
|
||||
if (get_type() == MEDIA_TYPE_SEQUENCE) return QString::number(get_frame_rate()) + " FPS";
|
||||
if (get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* f = to_footage();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "project/media.h"
|
||||
#include "debug.h"
|
||||
|
||||
ProjectModel::ProjectModel(QObject *parent) : QAbstractItemModel(parent), root_item(NULL) {
|
||||
ProjectModel::ProjectModel(QObject *parent) : QAbstractItemModel(parent), root_item(nullptr) {
|
||||
root_item = new Media(0);
|
||||
root_item->root = true;
|
||||
}
|
||||
@@ -16,10 +16,10 @@ ProjectModel::~ProjectModel() {
|
||||
}
|
||||
|
||||
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 != nullptr) panel_sequence_viewer->viewer_widget->delete_function();
|
||||
if (panel_footage_viewer != nullptr) panel_footage_viewer->viewer_widget->delete_function();
|
||||
|
||||
if (root_item != NULL) {
|
||||
if (root_item != nullptr) {
|
||||
delete root_item;
|
||||
}
|
||||
}
|
||||
@@ -143,14 +143,14 @@ void ProjectModel::set_icon(Media* m, const QIcon &ico) {
|
||||
}
|
||||
|
||||
void ProjectModel::appendChild(Media *parent, Media *child) {
|
||||
if (parent == NULL) parent = root_item;
|
||||
if (parent == nullptr) 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;
|
||||
if (to == nullptr) to = root_item;
|
||||
Media* from = child->parentItem();
|
||||
beginMoveRows(
|
||||
from == root_item ? QModelIndex() : createIndex(from->row(), 0, from),
|
||||
@@ -165,18 +165,18 @@ void ProjectModel::moveChild(Media *child, Media *to) {
|
||||
}
|
||||
|
||||
void ProjectModel::removeChild(Media* parent, Media* m) {
|
||||
if (parent == NULL) parent = root_item;
|
||||
if (parent == nullptr) 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;
|
||||
if (parent == nullptr) parent = root_item;
|
||||
return parent->child(i);
|
||||
}
|
||||
|
||||
int ProjectModel::childCount(Media *parent) {
|
||||
if (parent == NULL) parent = root_item;
|
||||
if (parent == nullptr) parent = root_item;
|
||||
return parent->childCount();
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ public:
|
||||
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);
|
||||
Media *child(int i, Media* parent = nullptr);
|
||||
int childCount(Media* parent = nullptr);
|
||||
void set_icon(Media* m, const QIcon &ico);
|
||||
|
||||
private:
|
||||
|
||||
+15
-12
@@ -3,11 +3,14 @@
|
||||
#include "clip.h"
|
||||
#include "transition.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
Sequence::Sequence() :
|
||||
playhead(0),
|
||||
using_workarea(false),
|
||||
enable_workarea(true),
|
||||
workarea_in(0),
|
||||
workarea_out(0),
|
||||
wrapper_sequence(false)
|
||||
@@ -23,7 +26,7 @@ Sequence::~Sequence() {
|
||||
|
||||
Sequence* Sequence::copy() {
|
||||
Sequence* s = new Sequence();
|
||||
s->name = name + " (copy)";
|
||||
s->name = QCoreApplication::translate("Sequence", "%1 (copy)").arg(name);
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
s->frame_rate = frame_rate;
|
||||
@@ -32,8 +35,8 @@ Sequence* Sequence::copy() {
|
||||
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;
|
||||
if (c == nullptr) {
|
||||
s->clips[i] = nullptr;
|
||||
} else {
|
||||
Clip* copy = c->copy(s);
|
||||
copy->linked = c->linked;
|
||||
@@ -47,7 +50,7 @@ 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) {
|
||||
if (c != nullptr && c->timeline_out > end) {
|
||||
end = c->timeline_out;
|
||||
}
|
||||
}
|
||||
@@ -60,10 +63,10 @@ void Sequence::hard_delete_transition(Clip *c, int type) {
|
||||
bool del = true;
|
||||
|
||||
Transition* t = transitions.at(transition_index);
|
||||
if (t->secondary_clip != NULL) {
|
||||
if (t->secondary_clip != nullptr) {
|
||||
for (int i=0;i<clips.size();i++) {
|
||||
Clip* comp = clips.at(i);
|
||||
if (comp != NULL
|
||||
if (comp != nullptr
|
||||
&& c != comp
|
||||
&& (c->opening_transition == transition_index
|
||||
|| c->closing_transition == transition_index)) {
|
||||
@@ -73,14 +76,14 @@ void Sequence::hard_delete_transition(Clip *c, int type) {
|
||||
}
|
||||
|
||||
del = false;
|
||||
t->secondary_clip = NULL;
|
||||
t->secondary_clip = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (del) {
|
||||
delete transitions.at(transition_index);
|
||||
transitions[transition_index] = NULL;
|
||||
transitions[transition_index] = nullptr;
|
||||
}
|
||||
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
@@ -96,7 +99,7 @@ void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
|
||||
int at = 0;
|
||||
for (int j=0;j<clips.size();j++) {
|
||||
Clip* c = clips.at(j);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
if (c->track < 0 && c->track < vt) { // video clip
|
||||
vt = c->track;
|
||||
} else if (c->track > at) {
|
||||
@@ -104,9 +107,9 @@ void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (video_tracks != NULL) *video_tracks = vt;
|
||||
if (audio_tracks != NULL) *audio_tracks = at;
|
||||
if (video_tracks != nullptr) *video_tracks = vt;
|
||||
if (audio_tracks != nullptr) *audio_tracks = at;
|
||||
}
|
||||
|
||||
// static variable for the currently active sequence
|
||||
Sequence* sequence = NULL;
|
||||
Sequence* sequence = nullptr;
|
||||
|
||||
@@ -28,6 +28,7 @@ struct Sequence {
|
||||
long playhead;
|
||||
|
||||
bool using_workarea;
|
||||
bool enable_workarea;
|
||||
long workarea_in;
|
||||
long workarea_out;
|
||||
|
||||
|
||||
+28
-24
@@ -18,8 +18,8 @@
|
||||
#include <QDesktopServices>
|
||||
|
||||
SourcesCommon::SourcesCommon(Project* parent) :
|
||||
project_parent(parent),
|
||||
editing_item(NULL)
|
||||
editing_item(nullptr),
|
||||
project_parent(parent)
|
||||
{
|
||||
rename_timer.setInterval(1000);
|
||||
connect(&rename_timer, SIGNAL(timeout()), this, SLOT(rename_interval()));
|
||||
@@ -39,7 +39,7 @@ void SourcesCommon::create_seq_from_selected() {
|
||||
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);
|
||||
project_parent->new_sequence(ca, s, true, nullptr);
|
||||
undo_stack.push(ca);
|
||||
}
|
||||
}
|
||||
@@ -49,10 +49,10 @@ void SourcesCommon::show_context_menu(QWidget* parent, const QModelIndexList& it
|
||||
|
||||
selected_items = items;
|
||||
|
||||
QAction* import_action = menu.addAction("Import...");
|
||||
QAction* import_action = menu.addAction(tr("Import..."));
|
||||
QObject::connect(import_action, SIGNAL(triggered(bool)), project_parent, SLOT(import_dialog()));
|
||||
|
||||
QMenu* new_menu = menu.addMenu("New");
|
||||
QMenu* new_menu = menu.addMenu(tr("New"));
|
||||
mainWindow->make_new_menu(new_menu);
|
||||
|
||||
if (items.size() > 0) {
|
||||
@@ -62,20 +62,20 @@ void SourcesCommon::show_context_menu(QWidget* parent, const QModelIndexList& it
|
||||
// replace footage
|
||||
int type = m->get_type();
|
||||
if (type == MEDIA_TYPE_FOOTAGE) {
|
||||
QAction* replace_action = menu.addAction("Replace/Relink Media");
|
||||
QAction* replace_action = menu.addAction(tr("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(tr("Reveal in Explorer"));
|
||||
#elif defined(Q_OS_MAC)
|
||||
QAction* reveal_in_explorer = menu.addAction("Reveal in Finder");
|
||||
QAction* reveal_in_explorer = menu.addAction(tr("Reveal in Finder"));
|
||||
#else
|
||||
QAction* reveal_in_explorer = menu.addAction("Reveal in File Manager");
|
||||
QAction* reveal_in_explorer = menu.addAction(tr("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");
|
||||
QAction* replace_clip_media = menu.addAction(tr("Replace Clips Using This Media"));
|
||||
QObject::connect(replace_clip_media, SIGNAL(triggered(bool)), project_parent, SLOT(replace_clip_media()));
|
||||
}
|
||||
}
|
||||
@@ -93,41 +93,41 @@ void SourcesCommon::show_context_menu(QWidget* parent, const QModelIndexList& it
|
||||
}
|
||||
|
||||
// create sequence from
|
||||
QAction* create_seq_from = menu.addAction("Create Sequence With This Media");
|
||||
QAction* create_seq_from = menu.addAction(tr("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");
|
||||
QAction* duplicate_action = menu.addAction(tr("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");
|
||||
QAction* delete_footage_from_sequences = menu.addAction(tr("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");
|
||||
QAction* delete_action = menu.addAction(tr("Delete"));
|
||||
QObject::connect(delete_action, SIGNAL(triggered(bool)), project_parent, SLOT(delete_selected_media()));
|
||||
|
||||
if (items.size() == 1) {
|
||||
QAction* properties_action = menu.addAction("Properties...");
|
||||
QAction* properties_action = menu.addAction(tr("Properties..."));
|
||||
QObject::connect(properties_action, SIGNAL(triggered(bool)), project_parent, SLOT(open_properties()));
|
||||
}
|
||||
}
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* tree_view_action = menu.addAction("Tree View");
|
||||
QAction* tree_view_action = menu.addAction(tr("Tree View"));
|
||||
connect(tree_view_action, SIGNAL(triggered(bool)), project_parent, SLOT(set_tree_view()));
|
||||
|
||||
QAction* icon_view_action = menu.addAction("Icon View");
|
||||
QAction* icon_view_action = menu.addAction(tr("Icon View"));
|
||||
connect(icon_view_action, SIGNAL(triggered(bool)), project_parent, SLOT(set_icon_view()));
|
||||
|
||||
QAction* toolbar_action = menu.addAction("Show Toolbar");
|
||||
QAction* toolbar_action = menu.addAction(tr("Show Toolbar"));
|
||||
toolbar_action->setCheckable(true);
|
||||
toolbar_action->setChecked(project_parent->toolbar_widget->isVisible());
|
||||
connect(toolbar_action, SIGNAL(triggered(bool)), project_parent->toolbar_widget, SLOT(setVisible(bool)));
|
||||
@@ -148,7 +148,7 @@ void SourcesCommon::item_click(Media *m, const QModelIndex& index) {
|
||||
}
|
||||
}
|
||||
|
||||
void SourcesCommon::mouseDoubleClickEvent(QMouseEvent *e, const QModelIndexList& selected_items) {
|
||||
void SourcesCommon::mouseDoubleClickEvent(QMouseEvent *, const QModelIndexList& selected_items) {
|
||||
stop_rename_timer();
|
||||
if (selected_items.size() == 0) {
|
||||
project_parent->import_dialog();
|
||||
@@ -183,7 +183,11 @@ void SourcesCommon::dropEvent(QWidget* parent, QDropEvent *event, const QModelIn
|
||||
&& 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) {
|
||||
&& QMessageBox::question(
|
||||
parent,
|
||||
tr("Replace Media"),
|
||||
tr("You dropped a file onto '%1'. Would you like to replace it with the dropped file?").arg(m->get_name()),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) {
|
||||
replace = true;
|
||||
project_parent->replace_media(m, paths.at(0));
|
||||
}
|
||||
@@ -196,7 +200,7 @@ void SourcesCommon::dropEvent(QWidget* parent, QDropEvent *event, const QModelIn
|
||||
parent = drop_item.parent();
|
||||
}
|
||||
}
|
||||
project_parent->process_file_list(paths, false, NULL, panel_project->item_to_media(parent));
|
||||
project_parent->process_file_list(paths, false, nullptr, panel_project->item_to_media(parent));
|
||||
}
|
||||
}
|
||||
event->acceptProposedAction();
|
||||
@@ -205,7 +209,7 @@ void SourcesCommon::dropEvent(QWidget* parent, QDropEvent *event, const QModelIn
|
||||
|
||||
// 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)) {
|
||||
if (!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);
|
||||
@@ -271,7 +275,7 @@ void SourcesCommon::stop_rename_timer() {
|
||||
|
||||
void SourcesCommon::rename_interval() {
|
||||
stop_rename_timer();
|
||||
if (view->hasFocus() && editing_item != NULL) {
|
||||
if (view->hasFocus() && editing_item != nullptr) {
|
||||
view->edit(editing_index);
|
||||
}
|
||||
}
|
||||
@@ -280,6 +284,6 @@ void SourcesCommon::item_renamed(Media* item) {
|
||||
if (editing_item == item) {
|
||||
MediaRename* mr = new MediaRename(item, "idk");
|
||||
undo_stack.push(mr);
|
||||
editing_item = NULL;
|
||||
editing_item = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-9
@@ -19,19 +19,20 @@
|
||||
#include "panels/timeline.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QCoreApplication>
|
||||
|
||||
Transition::Transition(Clip* c, Clip* s, const EffectMeta* em) :
|
||||
Effect(c, em), secondary_clip(s),
|
||||
length(30)
|
||||
{
|
||||
length_field = add_row("Length:", false)->add_field(EFFECT_FIELD_DOUBLE, "length");
|
||||
length_field = add_row(tr("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 == NULL ? parent_clip->cached_fr : parent_clip->sequence->frame_rate);
|
||||
length_ui_ele->set_frame_rate(parent_clip->sequence == nullptr ? parent_clip->cached_fr : parent_clip->sequence->frame_rate);
|
||||
}
|
||||
|
||||
int Transition::copy(Clip *c, Clip* s) {
|
||||
@@ -48,7 +49,7 @@ long Transition::get_true_length() {
|
||||
}
|
||||
|
||||
long Transition::get_length() {
|
||||
if (secondary_clip != NULL) {
|
||||
if (secondary_clip != nullptr) {
|
||||
return length * 2;
|
||||
}
|
||||
return length;
|
||||
@@ -73,17 +74,20 @@ Transition* get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* 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.");
|
||||
qCritical() << "Invalid transition data";
|
||||
QMessageBox::critical(mainWindow,
|
||||
QCoreApplication::translate("transition", "Invalid transition"),
|
||||
QCoreApplication::translate("transition", "No candidate for transition '%1'. This transition may be corrupt. Try reinstalling it or Olive.").arg(em->name)
|
||||
);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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;
|
||||
if (t != nullptr) {
|
||||
if (length >= 0) t->set_length(length);
|
||||
QVector<Transition*>& transition_list = (c->sequence == nullptr) ? clipboard_transitions : c->sequence->transitions;
|
||||
transition_list.append(t);
|
||||
return transition_list.size() - 1;
|
||||
}
|
||||
|
||||
+38
-35
@@ -116,7 +116,7 @@ DeleteClipAction::DeleteClipAction(Sequence* s, int clip) :
|
||||
{}
|
||||
|
||||
DeleteClipAction::~DeleteClipAction() {
|
||||
if (ref != NULL) delete ref;
|
||||
if (ref != nullptr) delete ref;
|
||||
}
|
||||
|
||||
void DeleteClipAction::undo() {
|
||||
@@ -141,7 +141,7 @@ void DeleteClipAction::undo() {
|
||||
seq->clips.at(linkClipIndex.at(i))->linked.insert(linkLinkIndex.at(i), index);
|
||||
}
|
||||
|
||||
ref = NULL;
|
||||
ref = nullptr;
|
||||
|
||||
mainWindow->setWindowModified(old_project_changed);
|
||||
}
|
||||
@@ -152,18 +152,18 @@ void DeleteClipAction::redo() {
|
||||
if (ref->open) {
|
||||
close_clip(ref, true);
|
||||
}
|
||||
seq->clips[index] = NULL;
|
||||
seq->clips[index] = nullptr;
|
||||
|
||||
// save shared transitions
|
||||
if (ref->opening_transition > -1 && ref->get_opening_transition()->secondary_clip != NULL) {
|
||||
if (ref->opening_transition > -1 && ref->get_opening_transition()->secondary_clip != nullptr) {
|
||||
opening_transition = ref->opening_transition;
|
||||
ref->get_opening_transition()->parent_clip = ref->get_opening_transition()->secondary_clip;
|
||||
ref->get_opening_transition()->secondary_clip = NULL;
|
||||
ref->get_opening_transition()->secondary_clip = nullptr;
|
||||
ref->opening_transition = -1;
|
||||
}
|
||||
if (ref->closing_transition > -1 && ref->get_closing_transition()->secondary_clip != NULL) {
|
||||
if (ref->closing_transition > -1 && ref->get_closing_transition()->secondary_clip != nullptr) {
|
||||
closing_transition = ref->closing_transition;
|
||||
ref->get_closing_transition()->secondary_clip = NULL;
|
||||
ref->get_closing_transition()->secondary_clip = nullptr;
|
||||
ref->closing_transition = -1;
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ void DeleteClipAction::redo() {
|
||||
linkLinkIndex.clear();
|
||||
for (int i=0;i<seq->clips.size();i++) {
|
||||
Clip* c = seq->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
for (int j=0;j<c->linked.size();j++) {
|
||||
if (c->linked.at(j) == index) {
|
||||
linkClipIndex.append(i);
|
||||
@@ -209,6 +209,7 @@ SetTimelineInOutCommand::SetTimelineInOutCommand(Sequence *s, bool enabled, long
|
||||
|
||||
void SetTimelineInOutCommand::undo() {
|
||||
seq->using_workarea = old_enabled;
|
||||
seq->enable_workarea = old_workarea_enabled;
|
||||
seq->workarea_in = old_in;
|
||||
seq->workarea_out = old_out;
|
||||
|
||||
@@ -225,9 +226,11 @@ void SetTimelineInOutCommand::undo() {
|
||||
|
||||
void SetTimelineInOutCommand::redo() {
|
||||
old_enabled = seq->using_workarea;
|
||||
old_workarea_enabled = seq->enable_workarea;
|
||||
old_in = seq->workarea_in;
|
||||
old_out = seq->workarea_out;
|
||||
|
||||
if (!seq->using_workarea) seq->enable_workarea = true;
|
||||
seq->using_workarea = new_enabled;
|
||||
seq->workarea_in = new_in;
|
||||
seq->workarea_out = new_out;
|
||||
@@ -253,7 +256,7 @@ AddEffectCommand::AddEffectCommand(Clip* c, Effect* e, const EffectMeta *m, int
|
||||
{}
|
||||
|
||||
AddEffectCommand::~AddEffectCommand() {
|
||||
if (!done && ref != NULL) delete ref;
|
||||
if (!done && ref != nullptr) delete ref;
|
||||
}
|
||||
|
||||
void AddEffectCommand::undo() {
|
||||
@@ -268,7 +271,7 @@ void AddEffectCommand::undo() {
|
||||
}
|
||||
|
||||
void AddEffectCommand::redo() {
|
||||
if (ref == NULL) {
|
||||
if (ref == nullptr) {
|
||||
ref = create_effect(clip, meta);
|
||||
}
|
||||
if (pos < 0) {
|
||||
@@ -292,14 +295,14 @@ AddTransitionCommand::AddTransitionCommand(Clip* c, Clip *s, Transition* copy, c
|
||||
|
||||
void AddTransitionCommand::undo() {
|
||||
clip->sequence->hard_delete_transition(clip, type);
|
||||
if (secondary != NULL) secondary->sequence->hard_delete_transition(secondary, (type == TA_OPENING_TRANSITION) ? TA_CLOSING_TRANSITION : TA_OPENING_TRANSITION);
|
||||
if (secondary != nullptr) secondary->sequence->hard_delete_transition(secondary, (type == TA_OPENING_TRANSITION) ? TA_CLOSING_TRANSITION : TA_OPENING_TRANSITION);
|
||||
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
clip->opening_transition = old_ptransition;
|
||||
if (secondary != NULL) secondary->closing_transition = old_stransition;
|
||||
if (secondary != nullptr) secondary->closing_transition = old_stransition;
|
||||
} else {
|
||||
clip->closing_transition = old_ptransition;
|
||||
if (secondary != NULL) secondary->opening_transition = old_stransition;
|
||||
if (secondary != nullptr) secondary->opening_transition = old_stransition;
|
||||
}
|
||||
|
||||
mainWindow->setWindowModified(old_project_changed);
|
||||
@@ -308,8 +311,8 @@ void AddTransitionCommand::undo() {
|
||||
void AddTransitionCommand::redo() {
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
old_ptransition = clip->opening_transition;
|
||||
clip->opening_transition = (transition_to_copy == NULL) ? create_transition(clip, secondary, transition) : transition_to_copy->copy(clip, NULL);
|
||||
if (secondary != NULL) {
|
||||
clip->opening_transition = (transition_to_copy == nullptr) ? create_transition(clip, secondary, transition) : transition_to_copy->copy(clip, nullptr);
|
||||
if (secondary != nullptr) {
|
||||
old_stransition = secondary->closing_transition;
|
||||
secondary->closing_transition = clip->opening_transition;
|
||||
}
|
||||
@@ -318,8 +321,8 @@ void AddTransitionCommand::redo() {
|
||||
}
|
||||
} else {
|
||||
old_ptransition = clip->closing_transition;
|
||||
clip->closing_transition = (transition_to_copy == NULL) ? create_transition(clip, secondary, transition) : transition_to_copy->copy(clip, NULL);
|
||||
if (secondary != NULL) {
|
||||
clip->closing_transition = (transition_to_copy == nullptr) ? create_transition(clip, secondary, transition) : transition_to_copy->copy(clip, nullptr);
|
||||
if (secondary != nullptr) {
|
||||
old_stransition = secondary->opening_transition;
|
||||
secondary->opening_transition = clip->closing_transition;
|
||||
}
|
||||
@@ -353,30 +356,30 @@ void ModifyTransitionCommand::redo() {
|
||||
DeleteTransitionCommand::DeleteTransitionCommand(Sequence* s, int transition_index) :
|
||||
seq(s),
|
||||
index(transition_index),
|
||||
transition(NULL),
|
||||
otc(NULL),
|
||||
ctc(NULL),
|
||||
transition(nullptr),
|
||||
otc(nullptr),
|
||||
ctc(nullptr),
|
||||
old_project_changed(mainWindow->isWindowModified())
|
||||
{}
|
||||
|
||||
DeleteTransitionCommand::~DeleteTransitionCommand() {
|
||||
if (transition != NULL) delete transition;
|
||||
if (transition != nullptr) delete transition;
|
||||
}
|
||||
|
||||
void DeleteTransitionCommand::undo() {
|
||||
seq->transitions[index] = transition;
|
||||
|
||||
if (otc != NULL) otc->opening_transition = index;
|
||||
if (ctc != NULL) ctc->closing_transition = index;
|
||||
if (otc != nullptr) otc->opening_transition = index;
|
||||
if (ctc != nullptr) ctc->closing_transition = index;
|
||||
|
||||
transition = NULL;
|
||||
transition = nullptr;
|
||||
mainWindow->setWindowModified(old_project_changed);
|
||||
}
|
||||
|
||||
void DeleteTransitionCommand::redo() {
|
||||
for (int i=0;i<seq->clips.size();i++) {
|
||||
Clip* c = seq->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
if (c->opening_transition == index) {
|
||||
otc = c;
|
||||
c->opening_transition = -1;
|
||||
@@ -389,7 +392,7 @@ void DeleteTransitionCommand::redo() {
|
||||
}
|
||||
|
||||
transition = seq->transitions.at(index);
|
||||
seq->transitions[index] = NULL;
|
||||
seq->transitions[index] = nullptr;
|
||||
|
||||
mainWindow->setWindowModified(true);
|
||||
}
|
||||
@@ -400,7 +403,7 @@ NewSequenceCommand::NewSequenceCommand(Media *s, Media* iparent) :
|
||||
done(false),
|
||||
old_project_changed(mainWindow->isWindowModified())
|
||||
{
|
||||
if (parent == NULL) parent = project_model.get_root();
|
||||
if (parent == nullptr) parent = project_model.get_root();
|
||||
}
|
||||
|
||||
NewSequenceCommand::~NewSequenceCommand() {
|
||||
@@ -515,8 +518,8 @@ void AddClipCommand::redo() {
|
||||
for (int j=0;j<original->linked.size();j++) {
|
||||
copy->linked[j] = original->linked.at(j) + linkOffset;
|
||||
}
|
||||
if (original->opening_transition > -1) copy->opening_transition = original->get_opening_transition()->copy(copy, NULL);
|
||||
if (original->closing_transition > -1) copy->closing_transition = original->get_closing_transition()->copy(copy, NULL);
|
||||
if (original->opening_transition > -1) copy->opening_transition = original->get_opening_transition()->copy(copy, nullptr);
|
||||
if (original->closing_transition > -1) copy->closing_transition = original->get_closing_transition()->copy(copy, nullptr);
|
||||
seq->clips.append(copy);
|
||||
}
|
||||
}
|
||||
@@ -588,7 +591,7 @@ void ReplaceMediaCommand::replace(QString& filename) {
|
||||
Sequence* s = all_sequences.at(i)->to_sequence();
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
Clip* c = s->clips.at(j);
|
||||
if (c != NULL && c->media == item && c->open) {
|
||||
if (c != nullptr && c->media == item && c->open) {
|
||||
close_clip(c, true);
|
||||
c->replaced = true;
|
||||
}
|
||||
@@ -599,7 +602,7 @@ void ReplaceMediaCommand::replace(QString& filename) {
|
||||
QStringList files;
|
||||
files.append(filename);
|
||||
item->to_footage()->ready_lock.lock();
|
||||
panel_project->process_file_list(files, false, item, NULL);
|
||||
panel_project->process_file_list(files, false, item, nullptr);
|
||||
}
|
||||
|
||||
void ReplaceMediaCommand::undo() {
|
||||
@@ -710,7 +713,7 @@ void MediaMove::undo() {
|
||||
}
|
||||
|
||||
void MediaMove::redo() {
|
||||
if (to == NULL) to = project_model.get_root();
|
||||
if (to == nullptr) to = project_model.get_root();
|
||||
froms.resize(items.size());
|
||||
for (int i=0;i<items.size();i++) {
|
||||
Media* parent = items.at(i)->parentItem();
|
||||
@@ -995,7 +998,7 @@ void EditSequenceCommand::update() {
|
||||
item->set_sequence(seq);
|
||||
|
||||
for (int i=0;i<seq->clips.size();i++) {
|
||||
if (seq->clips.at(i) != NULL) seq->clips.at(i)->refresh();
|
||||
if (seq->clips.at(i) != nullptr) seq->clips.at(i)->refresh();
|
||||
}
|
||||
|
||||
if (sequence == seq) {
|
||||
@@ -1154,7 +1157,7 @@ void RippleAction::redo() {
|
||||
for (int i=0;i<s->clips.size();i++) {
|
||||
if (!ignore.contains(i)) {
|
||||
Clip* c = s->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
if (c->timeline_in >= point) {
|
||||
move_clip(ca, c, length, length, 0, 0, true, true);
|
||||
}
|
||||
@@ -1262,7 +1265,7 @@ void RefreshClips::redo() {
|
||||
Sequence* s = all_sequences.at(i)->to_sequence();
|
||||
for (int j=0;j<s->clips.size();j++) {
|
||||
Clip* c = s->clips.at(j);
|
||||
if (c != NULL && c->media == media) {
|
||||
if (c != nullptr && c->media == media) {
|
||||
c->replaced = true;
|
||||
c->refresh();
|
||||
}
|
||||
|
||||
@@ -174,6 +174,8 @@ public:
|
||||
private:
|
||||
Sequence* seq;
|
||||
|
||||
bool old_workarea_enabled;
|
||||
|
||||
bool old_enabled;
|
||||
long old_in;
|
||||
long old_out;
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ void AudioMonitor::resizeEvent(QResizeEvent *e) {
|
||||
}
|
||||
|
||||
void AudioMonitor::paintEvent(QPaintEvent *) {
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
QPainter p(this);
|
||||
int channel_x = AUDIO_MONITOR_GAP;
|
||||
int channel_count = av_get_channel_layout_nb_channels(sequence->audio_layout);
|
||||
|
||||
@@ -33,7 +33,7 @@ CollapsibleWidget::CollapsibleWidget(QWidget* parent) : QWidget(parent) {
|
||||
collapse_button = new QPushButton();
|
||||
collapse_button->setIconSize(QSize(8, 8));
|
||||
collapse_button->setStyleSheet("QPushButton { border: none; }");
|
||||
setText("<untitled>");
|
||||
setText(tr("<untitled>"));
|
||||
title_bar_layout->addWidget(collapse_button);
|
||||
title_bar_layout->addWidget(enabled_check);
|
||||
title_bar_layout->addWidget(header);
|
||||
@@ -44,7 +44,7 @@ CollapsibleWidget::CollapsibleWidget(QWidget* parent) : QWidget(parent) {
|
||||
|
||||
set_button_icon(true);
|
||||
|
||||
contents = NULL;
|
||||
contents = nullptr;
|
||||
}
|
||||
|
||||
void CollapsibleWidget::header_click(bool s, bool deselect) {
|
||||
@@ -74,7 +74,7 @@ void CollapsibleWidget::set_button_icon(bool open) {
|
||||
}
|
||||
|
||||
void CollapsibleWidget::setContents(QWidget* c) {
|
||||
bool existing = (contents != NULL);
|
||||
bool existing = (contents != nullptr);
|
||||
contents = c;
|
||||
if (!existing) {
|
||||
layout->addWidget(contents);
|
||||
|
||||
+14
-14
@@ -5,18 +5,18 @@
|
||||
#include <QColorDialog>
|
||||
|
||||
ColorButton::ColorButton(QWidget *parent)
|
||||
: QPushButton(parent), color(Qt::white) {
|
||||
set_button_color();
|
||||
connect(this, SIGNAL(clicked(bool)), this, SLOT(open_dialog()));
|
||||
: QPushButton(parent), color(Qt::white) {
|
||||
set_button_color();
|
||||
connect(this, SIGNAL(clicked(bool)), this, SLOT(open_dialog()));
|
||||
}
|
||||
|
||||
QColor ColorButton::get_color() {
|
||||
return color;
|
||||
return color;
|
||||
}
|
||||
|
||||
void ColorButton::set_color(QColor c) {
|
||||
previousColor = color;
|
||||
color = c;
|
||||
color = c;
|
||||
set_button_color();
|
||||
}
|
||||
|
||||
@@ -25,27 +25,27 @@ const QColor &ColorButton::getPreviousValue() {
|
||||
}
|
||||
|
||||
void ColorButton::set_button_color() {
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::Button, color);
|
||||
setPalette(pal);
|
||||
QPalette pal = palette();
|
||||
pal.setColor(QPalette::Button, color);
|
||||
setPalette(pal);
|
||||
}
|
||||
|
||||
void ColorButton::open_dialog() {
|
||||
QColor new_color = QColorDialog::getColor(color, NULL, "Set Color");
|
||||
QColor new_color = QColorDialog::getColor(color, nullptr, tr("Set Color"));
|
||||
if (new_color.isValid() && color != new_color) {
|
||||
set_color(new_color);
|
||||
set_button_color();
|
||||
set_button_color();
|
||||
emit color_changed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColorCommand::ColorCommand(ColorButton* s, QColor o, QColor n)
|
||||
: sender(s), old_color(o), new_color(n) {}
|
||||
: sender(s), old_color(o), new_color(n) {}
|
||||
|
||||
void ColorCommand::undo() {
|
||||
sender->set_color(old_color);
|
||||
sender->set_color(old_color);
|
||||
}
|
||||
|
||||
void ColorCommand::redo() {
|
||||
sender->set_color(new_color);
|
||||
sender->set_color(new_color);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ void EmbeddedFileChooser::setFilename(const QString &s) {
|
||||
}
|
||||
|
||||
void EmbeddedFileChooser::update_label() {
|
||||
QString l = "<html>File: ";
|
||||
QString l = "<html>" + tr("File:") + " ";
|
||||
if (filename.isEmpty()) {
|
||||
l += "(none)";
|
||||
} else {
|
||||
|
||||
+19
-18
@@ -42,7 +42,7 @@ GraphView::GraphView(QWidget* parent) :
|
||||
y_scroll(0),
|
||||
mousedown(false),
|
||||
zoom(1.0),
|
||||
row(NULL),
|
||||
row(nullptr),
|
||||
moved_keys(false),
|
||||
current_handle(BEZIER_HANDLE_NONE),
|
||||
rect_select(false),
|
||||
@@ -58,15 +58,15 @@ GraphView::GraphView(QWidget* parent) :
|
||||
void GraphView::show_context_menu(const QPoint& pos) {
|
||||
QMenu menu(this);
|
||||
|
||||
QAction* zoom_to_selection = menu.addAction("Zoom to Selection");
|
||||
if (selected_keys.size() == 0 || row == NULL) {
|
||||
QAction* zoom_to_selection = menu.addAction(tr("Zoom to Selection"));
|
||||
if (selected_keys.size() == 0 || row == nullptr) {
|
||||
zoom_to_selection->setEnabled(false);
|
||||
} else {
|
||||
connect(zoom_to_selection, SIGNAL(triggered(bool)), this, SLOT(set_view_to_selection()));
|
||||
}
|
||||
|
||||
QAction* zoom_to_all = menu.addAction("Zoom to Show All");
|
||||
if (row == NULL) {
|
||||
QAction* zoom_to_all = menu.addAction(tr("Zoom to Show All"));
|
||||
if (row == nullptr) {
|
||||
zoom_to_all->setEnabled(false);
|
||||
} else {
|
||||
connect(zoom_to_all, SIGNAL(triggered(bool)), this, SLOT(set_view_to_all()));
|
||||
@@ -74,8 +74,8 @@ void GraphView::show_context_menu(const QPoint& pos) {
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* reset_action = menu.addAction("Reset View");
|
||||
if (row == NULL) {
|
||||
QAction* reset_action = menu.addAction(tr("Reset View"));
|
||||
if (row == nullptr) {
|
||||
reset_action->setEnabled(false);
|
||||
} else {
|
||||
connect(reset_action, SIGNAL(triggered(bool)), this, SLOT(reset_view()));
|
||||
@@ -93,7 +93,7 @@ void GraphView::reset_view() {
|
||||
}
|
||||
|
||||
void GraphView::set_view_to_selection() {
|
||||
if (row != NULL && selected_keys.size() > 0) {
|
||||
if (row != nullptr && selected_keys.size() > 0) {
|
||||
long min_time = LONG_MAX;
|
||||
long max_time = LONG_MIN;
|
||||
double min_dbl = DBL_MAX;
|
||||
@@ -110,7 +110,7 @@ void GraphView::set_view_to_selection() {
|
||||
}
|
||||
|
||||
void GraphView::set_view_to_all() {
|
||||
if (row != NULL) {
|
||||
if (row != nullptr) {
|
||||
bool can_set = false;
|
||||
|
||||
long min_time = LONG_MAX;
|
||||
@@ -201,7 +201,7 @@ QVector<int> sort_keys_from_field(EffectField* field) {
|
||||
void GraphView::paintEvent(QPaintEvent *) {
|
||||
QPainter p(this);
|
||||
|
||||
if (panel_sequence_viewer->seq != NULL) {
|
||||
if (panel_sequence_viewer->seq != nullptr) {
|
||||
// draw grid lines
|
||||
|
||||
p.setPen(Qt::gray);
|
||||
@@ -210,7 +210,7 @@ void GraphView::paintEvent(QPaintEvent *) {
|
||||
draw_lines(p, false);
|
||||
|
||||
// draw keyframes
|
||||
if (row != NULL) {
|
||||
if (row != nullptr) {
|
||||
QPen line_pen;
|
||||
line_pen.setWidth(BEZIER_LINE_SIZE);
|
||||
|
||||
@@ -221,7 +221,8 @@ void GraphView::paintEvent(QPaintEvent *) {
|
||||
// sort keyframes by time
|
||||
QVector<int> sorted_keys = sort_keys_from_field(field);
|
||||
|
||||
int last_key_x, last_key_y;
|
||||
int last_key_x = 0;
|
||||
int last_key_y = 0;
|
||||
|
||||
// draw lines
|
||||
for (int j=0;j<sorted_keys.size();j++) {
|
||||
@@ -329,7 +330,7 @@ void GraphView::paintEvent(QPaintEvent *) {
|
||||
}
|
||||
|
||||
void GraphView::mousePressEvent(QMouseEvent *event) {
|
||||
if (row != NULL) {
|
||||
if (row != nullptr) {
|
||||
mousedown = true;
|
||||
start_x = event->pos().x();
|
||||
start_y = event->pos().y();
|
||||
@@ -530,7 +531,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (row != NULL) {
|
||||
} else if (row != nullptr) {
|
||||
// clicking on the curve
|
||||
click_add = false;
|
||||
|
||||
@@ -665,7 +666,7 @@ void GraphView::mouseMoveEvent(QMouseEvent *event) {
|
||||
}
|
||||
}
|
||||
|
||||
void GraphView::mouseReleaseEvent(QMouseEvent *e) {
|
||||
void GraphView::mouseReleaseEvent(QMouseEvent *) {
|
||||
if (click_add_proc) {
|
||||
undo_stack.push(new KeyframeFieldSet(click_add_field, click_add_key));
|
||||
} else if (moved_keys && selected_keys.size() > 0) {
|
||||
@@ -742,7 +743,7 @@ void GraphView::set_row(EffectRow *r) {
|
||||
selected_keys_old_doubles.clear();
|
||||
emit selection_changed(false, -1);
|
||||
row = r;
|
||||
if (row != NULL) {
|
||||
if (row != nullptr) {
|
||||
field_visibility.resize(row->fieldCount());
|
||||
field_visibility.fill(true);
|
||||
visible_in = row->parent_effect->parent_clip->timeline_in;
|
||||
@@ -771,7 +772,7 @@ void GraphView::set_field_visibility(int field, bool b) {
|
||||
}
|
||||
|
||||
void GraphView::delete_selected_keys() {
|
||||
if (row != NULL) {
|
||||
if (row != nullptr) {
|
||||
QVector<EffectField*> fields;
|
||||
for (int i=0;i<selected_keys_fields.size();i++) {
|
||||
fields.append(row->field(selected_keys_fields.at(i)));
|
||||
@@ -781,7 +782,7 @@ void GraphView::delete_selected_keys() {
|
||||
}
|
||||
|
||||
void GraphView::select_all() {
|
||||
if (row != NULL) {
|
||||
if (row != nullptr) {
|
||||
selected_keys.clear();
|
||||
selected_keys_fields.clear();
|
||||
for (int i=0;i<row->fieldCount();i++) {
|
||||
|
||||
@@ -53,7 +53,7 @@ KeyframeNavigator::KeyframeNavigator(QWidget *parent) : QWidget(parent) {
|
||||
keyframe_enable->setMaximumSize(button_size);
|
||||
keyframe_enable->setIconSize(clock_size);
|
||||
keyframe_enable->setCheckable(true);
|
||||
keyframe_enable->setToolTip("Enable Keyframes");
|
||||
keyframe_enable->setToolTip(tr("Enable Keyframes"));
|
||||
connect(keyframe_enable, SIGNAL(clicked(bool)), this, SIGNAL(keyframe_enabled_changed(bool)));
|
||||
connect(keyframe_enable, SIGNAL(toggled(bool)), this, SLOT(keyframe_ui_enabled(bool)));
|
||||
connect(keyframe_enable, SIGNAL(clicked(bool)), this, SIGNAL(clicked()));
|
||||
|
||||
+3
-3
@@ -50,11 +50,11 @@ void KeyframeView::show_context_menu(const QPoint& pos) {
|
||||
if (selected_fields.size() > 0) {
|
||||
QMenu menu(this);
|
||||
|
||||
QAction* linear = menu.addAction("Linear");
|
||||
QAction* linear = menu.addAction(tr("Linear"));
|
||||
linear->setData(KEYFRAME_TYPE_LINEAR);
|
||||
QAction* bezier = menu.addAction("Bezier");
|
||||
QAction* bezier = menu.addAction(tr("Bezier"));
|
||||
bezier->setData(KEYFRAME_TYPE_BEZIER);
|
||||
QAction* hold = menu.addAction("Hold");
|
||||
QAction* hold = menu.addAction(tr("Hold"));
|
||||
hold->setData(KEYFRAME_TYPE_HOLD);
|
||||
menu.addSeparator();
|
||||
menu.addAction("Graph Editor");
|
||||
|
||||
+4
-4
@@ -147,8 +147,8 @@ void LabelSlider::mouseReleaseEvent(QMouseEvent*) {
|
||||
if (display_type == LABELSLIDER_FRAMENUMBER) {
|
||||
QString s = QInputDialog::getText(
|
||||
this,
|
||||
"Set Value",
|
||||
"New value:",
|
||||
tr("Set Value"),
|
||||
tr("New value:"),
|
||||
QLineEdit::Normal,
|
||||
valueToString(internal_value)
|
||||
);
|
||||
@@ -158,8 +158,8 @@ void LabelSlider::mouseReleaseEvent(QMouseEvent*) {
|
||||
bool ok;
|
||||
d = QInputDialog::getDouble(
|
||||
this,
|
||||
"Set Value",
|
||||
"New value:",
|
||||
tr("Set Value"),
|
||||
tr("New value:"),
|
||||
(display_type == LABELSLIDER_PERCENT) ? internal_value * 100 : internal_value,
|
||||
(min_enabled) ? min_value : INT_MIN,
|
||||
(max_enabled) ? max_value : INT_MAX,
|
||||
|
||||
@@ -118,7 +118,7 @@ void TimelineHeader::show_text(bool enable) {
|
||||
}
|
||||
|
||||
void TimelineHeader::mousePressEvent(QMouseEvent* event) {
|
||||
if (viewer->seq != NULL && event->buttons() & Qt::LeftButton) {
|
||||
if (viewer->seq != nullptr && event->buttons() & Qt::LeftButton) {
|
||||
if (resizing_workarea) {
|
||||
sequence_end = viewer->seq->getEndFrame();
|
||||
} else {
|
||||
@@ -168,7 +168,7 @@ void TimelineHeader::mousePressEvent(QMouseEvent* event) {
|
||||
}
|
||||
|
||||
void TimelineHeader::mouseMoveEvent(QMouseEvent* event) {
|
||||
if (viewer->seq != NULL) {
|
||||
if (viewer->seq != nullptr) {
|
||||
if (dragging) {
|
||||
if (resizing_workarea) {
|
||||
long frame = getHeaderFrameFromScreenPoint(event->pos().x());
|
||||
@@ -214,7 +214,7 @@ void TimelineHeader::mouseMoveEvent(QMouseEvent* event) {
|
||||
} else {
|
||||
resizing_workarea = false;
|
||||
unsetCursor();
|
||||
if (viewer->seq != NULL && viewer->seq->using_workarea) {
|
||||
if (viewer->seq != nullptr && viewer->seq->using_workarea) {
|
||||
long min_frame = getHeaderFrameFromScreenPoint(event->pos().x() - CLICK_RANGE) - 1;
|
||||
long max_frame = getHeaderFrameFromScreenPoint(event->pos().x() + CLICK_RANGE) + 1;
|
||||
if (viewer->seq->workarea_in > min_frame && viewer->seq->workarea_in < max_frame) {
|
||||
@@ -235,7 +235,7 @@ void TimelineHeader::mouseMoveEvent(QMouseEvent* event) {
|
||||
}
|
||||
|
||||
void TimelineHeader::mouseReleaseEvent(QMouseEvent*) {
|
||||
if (viewer->seq != NULL) {
|
||||
if (viewer->seq != nullptr) {
|
||||
dragging = false;
|
||||
if (resizing_workarea) {
|
||||
undo_stack.push(new SetTimelineInOutCommand(viewer->seq, true, temp_workarea_in, temp_workarea_out));
|
||||
@@ -294,7 +294,7 @@ void TimelineHeader::delete_markers() {
|
||||
}
|
||||
|
||||
void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
if (viewer->seq != NULL && zoom > 0) {
|
||||
if (viewer->seq != nullptr && zoom > 0) {
|
||||
QPainter p(this);
|
||||
int yoff = (text_enabled) ? height()/2 : 0;
|
||||
|
||||
@@ -321,8 +321,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
|
||||
while (true) {
|
||||
long frame = qRound(interval*i);
|
||||
int lineX = qRound(frame*zoom) - scroll;
|
||||
int next_lineX = qRound(qRound(interval*(i+1))*zoom) - scroll;
|
||||
int lineX = qRound(frame*zoom) - scroll;
|
||||
|
||||
if (lineX > width()) break;
|
||||
|
||||
@@ -367,7 +366,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) {
|
||||
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.fillRect(QRect(in_x, 0, out_x-in_x, height()), viewer->seq->enable_workarea ? QColor(0, 192, 255, 128) : QColor(255, 255, 255, 64));
|
||||
p.setPen(Qt::white);
|
||||
p.drawLine(in_x, 0, in_x, height());
|
||||
p.drawLine(out_x, 0, out_x, height());
|
||||
|
||||
+115
-113
@@ -48,8 +48,8 @@
|
||||
#define TRANSITION_BETWEEN_RANGE 40
|
||||
|
||||
TimelineWidget::TimelineWidget(QWidget *parent) : QWidget(parent) {
|
||||
selection_command = NULL;
|
||||
self_created_sequence = NULL;
|
||||
selection_command = nullptr;
|
||||
self_created_sequence = nullptr;
|
||||
scroll = 0;
|
||||
|
||||
bottom_align = false;
|
||||
@@ -79,7 +79,7 @@ void TimelineWidget::right_click_ripple() {
|
||||
}
|
||||
|
||||
void TimelineWidget::show_context_menu(const QPoint& pos) {
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
// hack because sometimes right clicking doesn't trigger mouse release event
|
||||
panel_timeline->rect_select_init = false;
|
||||
panel_timeline->rect_select_proc = false;
|
||||
@@ -98,7 +98,7 @@ void TimelineWidget::show_context_menu(const QPoint& pos) {
|
||||
QVector<Clip*> selected_clips;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && panel_timeline->is_clip_selected(c, true)) {
|
||||
if (c != nullptr && panel_timeline->is_clip_selected(c, true)) {
|
||||
selected_clips.append(c);
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ void TimelineWidget::show_context_menu(const QPoint& pos) {
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
if (c->timeline_in > panel_timeline->cursor_frame || c->timeline_out > panel_timeline->cursor_frame) {
|
||||
at_end_of_sequence = false;
|
||||
}
|
||||
@@ -163,7 +163,7 @@ void TimelineWidget::show_context_menu(const QPoint& pos) {
|
||||
for (int i=0;i<selected_clips.size();i++) {
|
||||
if (selected_clips.at(i)->track < 0) {
|
||||
video_clip_count++;
|
||||
if (selected_clips.at(i)->media == NULL
|
||||
if (selected_clips.at(i)->media == nullptr
|
||||
|| selected_clips.at(i)->media->get_type() != MEDIA_TYPE_FOOTAGE) {
|
||||
all_video_is_footage = false;
|
||||
}
|
||||
@@ -204,7 +204,7 @@ void TimelineWidget::toggle_autoscale() {
|
||||
SetAutoscaleAction* action = new SetAutoscaleAction();
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && panel_timeline->is_clip_selected(c, true)) {
|
||||
if (c != nullptr && panel_timeline->is_clip_selected(c, true)) {
|
||||
action->clips.append(c);
|
||||
}
|
||||
}
|
||||
@@ -216,15 +216,17 @@ void TimelineWidget::toggle_autoscale() {
|
||||
}
|
||||
|
||||
void TimelineWidget::tooltip_timer_timeout() {
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
if (tooltip_clip < sequence->clips.size()) {
|
||||
Clip* c = sequence->clips.at(tooltip_clip);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
QToolTip::showText(QCursor::pos(),
|
||||
c->name
|
||||
+ "\nStart: " + frame_to_timecode(c->timeline_in, config.timecode_view, sequence->frame_rate)
|
||||
+ "\nEnd: " + frame_to_timecode(c->timeline_out, config.timecode_view, sequence->frame_rate)
|
||||
+ "\nDuration: " + frame_to_timecode(c->getLength(), config.timecode_view, sequence->frame_rate));
|
||||
tr("%1\nStart: %2\nEnd: %3\nDuration: %4").arg(
|
||||
c->name,
|
||||
frame_to_timecode(c->timeline_in, config.timecode_view, sequence->frame_rate),
|
||||
frame_to_timecode(c->timeline_out, config.timecode_view, sequence->frame_rate),
|
||||
frame_to_timecode(c->getLength(), config.timecode_view, sequence->frame_rate)
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,14 +237,14 @@ void TimelineWidget::rename_clip() {
|
||||
QVector<Clip*> selected_clips;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && panel_timeline->is_clip_selected(c, true)) {
|
||||
if (c != nullptr && panel_timeline->is_clip_selected(c, true)) {
|
||||
selected_clips.append(c);
|
||||
}
|
||||
}
|
||||
if (selected_clips.size() > 0) {
|
||||
QString s = QInputDialog::getText(this,
|
||||
(selected_clips.size() == 1) ? "Rename '" + selected_clips.at(0)->name + "'" : "Rename multiple clips",
|
||||
"Enter a new name for this clip:",
|
||||
(selected_clips.size() == 1) ? tr("Rename '%1'").arg(selected_clips.at(0)->name) : tr("Rename multiple clips"),
|
||||
tr("Enter a new name for this clip:"),
|
||||
QLineEdit::Normal,
|
||||
selected_clips.at(0)->name
|
||||
);
|
||||
@@ -275,7 +277,7 @@ void TimelineWidget::open_sequence_properties() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
QMessageBox::critical(this, "Error", "Couldn't locate media wrapper for sequence.");
|
||||
QMessageBox::critical(this, tr("Error"), tr("Couldn't locate media wrapper for sequence."));
|
||||
}
|
||||
|
||||
bool same_sign(int a, int b) {
|
||||
@@ -343,7 +345,7 @@ void TimelineWidget::dragEnterEvent(QDragEnterEvent *event) {
|
||||
long entry_point;
|
||||
Sequence* seq = sequence;
|
||||
|
||||
if (seq == NULL) {
|
||||
if (seq == nullptr) {
|
||||
// if no sequence, we're going to create a new one using the clips as a reference
|
||||
entry_point = 0;
|
||||
|
||||
@@ -365,7 +367,7 @@ void TimelineWidget::dragMoveEvent(QDragMoveEvent *event) {
|
||||
if (panel_timeline->importing) {
|
||||
event->acceptProposedAction();
|
||||
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
QPoint pos = event->pos();
|
||||
update_ghosts(pos, event->keyboardModifiers() & Qt::ShiftModifier);
|
||||
panel_timeline->move_insert = ((event->keyboardModifiers() & Qt::ControlModifier) && (panel_timeline->tool == TIMELINE_TOOL_POINTER || panel_timeline->importing));
|
||||
@@ -403,9 +405,9 @@ void TimelineWidget::dragLeaveEvent(QDragLeaveEvent* event) {
|
||||
panel_timeline->importing = false;
|
||||
update_ui(false);
|
||||
}
|
||||
if (self_created_sequence != NULL) {
|
||||
if (self_created_sequence != nullptr) {
|
||||
delete self_created_sequence;
|
||||
self_created_sequence = NULL;
|
||||
self_created_sequence = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,7 +455,7 @@ void insert_clips(ComboAction* ca) {
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
// don't split any clips that are moving
|
||||
bool found = false;
|
||||
for (int j=0;j<panel_timeline->ghosts.size();j++) {
|
||||
@@ -511,10 +513,10 @@ void TimelineWidget::dropEvent(QDropEvent* event) {
|
||||
Sequence* s = sequence;
|
||||
|
||||
// if we're dropping into nothing, create a new sequences based on the clip being dragged
|
||||
if (s == NULL) {
|
||||
if (s == nullptr) {
|
||||
s = self_created_sequence;
|
||||
panel_project->new_sequence(ca, self_created_sequence, true, NULL);
|
||||
self_created_sequence = NULL;
|
||||
panel_project->new_sequence(ca, self_created_sequence, true, nullptr);
|
||||
self_created_sequence = nullptr;
|
||||
} else if (event->keyboardModifiers() & Qt::ControlModifier) {
|
||||
insert_clips(ca);
|
||||
} else {
|
||||
@@ -552,12 +554,12 @@ bool isLiveEditing() {
|
||||
}
|
||||
|
||||
void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
int tool = panel_timeline->tool;
|
||||
if (event->button() == Qt::MiddleButton) {
|
||||
tool = TIMELINE_TOOL_HAND;
|
||||
panel_timeline->creating = false;
|
||||
} else if (event->button() == Qt::RightButton) {
|
||||
if (event->button() == Qt::MiddleButton) {
|
||||
tool = TIMELINE_TOOL_HAND;
|
||||
panel_timeline->creating = false;
|
||||
} else if (event->button() == Qt::RightButton) {
|
||||
tool = TIMELINE_TOOL_MENU;
|
||||
panel_timeline->creating = false;
|
||||
}
|
||||
@@ -602,7 +604,7 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
||||
Ghost g;
|
||||
g.in = g.old_in = g.out = g.old_out = panel_timeline->drag_frame_start;
|
||||
g.track = g.old_track = panel_timeline->drag_track_start;
|
||||
g.transition = NULL;
|
||||
g.transition = nullptr;
|
||||
g.clip = -1;
|
||||
g.trimming = true;
|
||||
g.trim_in = false;
|
||||
@@ -626,7 +628,7 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
||||
} else {
|
||||
if (clip_index >= 0) {
|
||||
Clip* clip = sequence->clips.at(clip_index);
|
||||
if (clip != NULL) {
|
||||
if (clip != nullptr) {
|
||||
if (panel_timeline->is_clip_selected(clip, true)) {
|
||||
if (shift) {
|
||||
panel_timeline->deselect_area(clip->timeline_in, clip->timeline_out, clip->track);
|
||||
@@ -648,14 +650,14 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
||||
Selection s;
|
||||
s.track = clip->track;
|
||||
|
||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION && clip->get_opening_transition() != NULL) {
|
||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION && clip->get_opening_transition() != nullptr) {
|
||||
s.in = clip->timeline_in;
|
||||
if (clip->get_opening_transition()->secondary_clip != NULL) s.in -= clip->get_opening_transition()->get_true_length();
|
||||
if (clip->get_opening_transition()->secondary_clip != nullptr) s.in -= clip->get_opening_transition()->get_true_length();
|
||||
s.out = clip->timeline_in + clip->get_opening_transition()->get_true_length();
|
||||
} else if (panel_timeline->transition_select == TA_CLOSING_TRANSITION && clip->get_closing_transition() != NULL) {
|
||||
} else if (panel_timeline->transition_select == TA_CLOSING_TRANSITION && clip->get_closing_transition() != nullptr) {
|
||||
s.in = clip->timeline_out - clip->get_closing_transition()->get_true_length();
|
||||
s.out = clip->timeline_out;
|
||||
if (clip->get_closing_transition()->secondary_clip != NULL) s.out += clip->get_closing_transition()->get_true_length();
|
||||
if (clip->get_closing_transition()->secondary_clip != nullptr) s.out += clip->get_closing_transition()->get_true_length();
|
||||
}
|
||||
sequence->selections.append(s);
|
||||
}
|
||||
@@ -673,12 +675,12 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_POINTER) {
|
||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION) {
|
||||
s.out = clip->timeline_in + clip->get_opening_transition()->get_true_length();
|
||||
if (clip->get_opening_transition()->secondary_clip != NULL) s.in -= clip->get_opening_transition()->get_true_length();
|
||||
if (clip->get_opening_transition()->secondary_clip != nullptr) s.in -= clip->get_opening_transition()->get_true_length();
|
||||
}
|
||||
|
||||
if (panel_timeline->transition_select == TA_CLOSING_TRANSITION) {
|
||||
s.in = clip->timeline_out - clip->get_closing_transition()->get_true_length();
|
||||
if (clip->get_closing_transition()->secondary_clip != NULL) s.out += clip->get_closing_transition()->get_true_length();
|
||||
if (clip->get_closing_transition()->secondary_clip != nullptr) s.out += clip->get_closing_transition()->get_true_length();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -749,10 +751,10 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
||||
void make_room_for_transition(ComboAction* ca, Clip* c, int type, long transition_start, long transition_end, bool delete_old_transitions) {
|
||||
// make room for transition
|
||||
if (type == TA_OPENING_TRANSITION) {
|
||||
if (delete_old_transitions && c->get_opening_transition() != NULL) {
|
||||
if (delete_old_transitions && c->get_opening_transition() != nullptr) {
|
||||
ca->append(new DeleteTransitionCommand(c->sequence, c->opening_transition));
|
||||
}
|
||||
if (c->get_closing_transition() != NULL) {
|
||||
if (c->get_closing_transition() != nullptr) {
|
||||
if (transition_end >= c->timeline_out) {
|
||||
ca->append(new DeleteTransitionCommand(c->sequence, c->closing_transition));
|
||||
} else if (transition_end > c->timeline_out - c->get_closing_transition()->get_true_length()) {
|
||||
@@ -760,10 +762,10 @@ void make_room_for_transition(ComboAction* ca, Clip* c, int type, long transitio
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (delete_old_transitions && c->get_closing_transition() != NULL) {
|
||||
if (delete_old_transitions && c->get_closing_transition() != nullptr) {
|
||||
ca->append(new DeleteTransitionCommand(c->sequence, c->closing_transition));
|
||||
}
|
||||
if (c->get_opening_transition() != NULL) {
|
||||
if (c->get_opening_transition() != nullptr) {
|
||||
if (transition_start <= c->timeline_in) {
|
||||
ca->append(new DeleteTransitionCommand(c->sequence, c->opening_transition));
|
||||
} else if (transition_start < c->timeline_in + c->get_opening_transition()->get_true_length()) {
|
||||
@@ -775,7 +777,7 @@ void make_room_for_transition(ComboAction* ca, Clip* c, int type, long transitio
|
||||
|
||||
void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
QToolTip::hideText();
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
bool alt = (event->modifiers() & Qt::AltModifier);
|
||||
bool shift = (event->modifiers() & Qt::ShiftModifier);
|
||||
bool ctrl = (event->modifiers() & Qt::ControlModifier);
|
||||
@@ -794,7 +796,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
panel_timeline->creating = false;
|
||||
} else if (g.in != g.out) {
|
||||
Clip* c = new Clip(sequence);
|
||||
c->media = NULL;
|
||||
c->media = nullptr;
|
||||
c->timeline_in = qMin(g.in, g.out);
|
||||
c->timeline_out = qMax(g.in, g.out);
|
||||
c->clip_in = 0;
|
||||
@@ -827,27 +829,27 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
|
||||
switch (panel_timeline->creating_object) {
|
||||
case ADD_OBJ_TITLE:
|
||||
c->name = "Title";
|
||||
c->name = tr("Title");
|
||||
c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_TEXT, EFFECT_TYPE_EFFECT)));
|
||||
break;
|
||||
case ADD_OBJ_SOLID:
|
||||
c->name = "Solid Color";
|
||||
c->name = tr("Solid Color");
|
||||
c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_SOLID, EFFECT_TYPE_EFFECT)));
|
||||
break;
|
||||
case ADD_OBJ_BARS:
|
||||
{
|
||||
c->name = "Bars";
|
||||
c->name = tr("Bars");
|
||||
Effect* e = create_effect(c, get_internal_meta(EFFECT_INTERNAL_SOLID, EFFECT_TYPE_EFFECT));
|
||||
e->row(0)->field(0)->set_combo_index(1);
|
||||
c->effects.append(e);
|
||||
}
|
||||
break;
|
||||
case ADD_OBJ_TONE:
|
||||
c->name = "Tone";
|
||||
c->name = tr("Tone");
|
||||
c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_TONE, EFFECT_TYPE_EFFECT)));
|
||||
break;
|
||||
case ADD_OBJ_NOISE:
|
||||
c->name = "Noise";
|
||||
c->name = tr("Noise");
|
||||
c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_NOISE, EFFECT_TYPE_EFFECT)));
|
||||
break;
|
||||
}
|
||||
@@ -955,9 +957,9 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
const Ghost& g = panel_timeline->ghosts.at(i);
|
||||
|
||||
sequence->clips.at(g.clip)->undeletable = true;
|
||||
if (g.transition != NULL) {
|
||||
if (g.transition != nullptr) {
|
||||
g.transition->parent_clip->undeletable = true;
|
||||
if (g.transition->secondary_clip != NULL) g.transition->secondary_clip->undeletable = true;
|
||||
if (g.transition->secondary_clip != nullptr) g.transition->secondary_clip->undeletable = true;
|
||||
}
|
||||
|
||||
Selection s;
|
||||
@@ -970,9 +972,9 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
for (int i=0;i<panel_timeline->ghosts.size();i++) {
|
||||
const Ghost& g = panel_timeline->ghosts.at(i);
|
||||
sequence->clips.at(g.clip)->undeletable = false;
|
||||
if (g.transition != NULL) {
|
||||
if (g.transition != nullptr) {
|
||||
g.transition->parent_clip->undeletable = false;
|
||||
if (g.transition->secondary_clip != NULL) g.transition->secondary_clip->undeletable = false;
|
||||
if (g.transition->secondary_clip != nullptr) g.transition->secondary_clip->undeletable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -981,14 +983,14 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
|
||||
// step 3 - move clips
|
||||
Clip* c = sequence->clips.at(g.clip);
|
||||
if (g.transition == NULL) {
|
||||
if (g.transition == nullptr) {
|
||||
move_clip(ca, c, (g.in - g.old_in), (g.out - g.old_out), (g.clip_in - g.old_clip_in), (g.track - g.old_track), true, true);
|
||||
|
||||
// adjust transitions if we need to
|
||||
long new_clip_length = (g.out - g.in);
|
||||
if (c->get_opening_transition() != NULL) {
|
||||
if (c->get_opening_transition() != nullptr) {
|
||||
long max_open_length = new_clip_length;
|
||||
if (c->get_closing_transition() != NULL && !panel_timeline->trim_in_point) {
|
||||
if (c->get_closing_transition() != nullptr && !panel_timeline->trim_in_point) {
|
||||
max_open_length -= c->get_closing_transition()->get_true_length();
|
||||
}
|
||||
if (max_open_length <= 0) {
|
||||
@@ -997,9 +999,9 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
ca->append(new ModifyTransitionCommand(c, TA_OPENING_TRANSITION, max_open_length));
|
||||
}
|
||||
}
|
||||
if (c->get_closing_transition() != NULL) {
|
||||
if (c->get_closing_transition() != nullptr) {
|
||||
long max_open_length = new_clip_length;
|
||||
if (c->get_opening_transition() != NULL && panel_timeline->trim_in_point) {
|
||||
if (c->get_opening_transition() != nullptr && panel_timeline->trim_in_point) {
|
||||
max_open_length -= c->get_opening_transition()->get_true_length();
|
||||
}
|
||||
if (max_open_length <= 0) {
|
||||
@@ -1011,12 +1013,12 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
} else {
|
||||
bool is_opening_transition = (g.transition == c->get_opening_transition());
|
||||
long new_transition_length = g.out - g.in;
|
||||
if (g.transition->secondary_clip != NULL) new_transition_length >>= 1;
|
||||
if (g.transition->secondary_clip != nullptr) new_transition_length >>= 1;
|
||||
ca->append(new ModifyTransitionCommand(c, is_opening_transition ? TA_OPENING_TRANSITION : TA_CLOSING_TRANSITION, new_transition_length));
|
||||
|
||||
long clip_length = c->getLength();
|
||||
|
||||
if (g.transition->secondary_clip != NULL) {
|
||||
if (g.transition->secondary_clip != nullptr) {
|
||||
if (g.in != g.old_in && !g.trimming) {
|
||||
long movement = g.in - g.old_in;
|
||||
move_clip(ca, g.transition->parent_clip, movement, 0, movement, 0, false, true);
|
||||
@@ -1106,9 +1108,9 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
}
|
||||
|
||||
if (panel_timeline->transition_tool_post_clip > -1) {
|
||||
ca->append(new AddTransitionCommand(pre, post, NULL, panel_timeline->transition_tool_meta, TA_OPENING_TRANSITION, transition_end - pre->timeline_in));
|
||||
ca->append(new AddTransitionCommand(pre, post, nullptr, panel_timeline->transition_tool_meta, TA_OPENING_TRANSITION, transition_end - pre->timeline_in));
|
||||
} else {
|
||||
ca->append(new AddTransitionCommand(pre, NULL, NULL, panel_timeline->transition_tool_meta, panel_timeline->transition_tool_type, transition_end - transition_start));
|
||||
ca->append(new AddTransitionCommand(pre, nullptr, nullptr, panel_timeline->transition_tool_meta, panel_timeline->transition_tool_type, transition_end - transition_start));
|
||||
}
|
||||
|
||||
push_undo = true;
|
||||
@@ -1130,10 +1132,10 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
// remove duplicate selections
|
||||
panel_timeline->clean_up_selections(sequence->selections);
|
||||
|
||||
if (selection_command != NULL) {
|
||||
if (selection_command != nullptr) {
|
||||
selection_command->new_data = sequence->selections;
|
||||
ca->append(selection_command);
|
||||
selection_command = NULL;
|
||||
selection_command = nullptr;
|
||||
push_undo = true;
|
||||
}
|
||||
|
||||
@@ -1163,7 +1165,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
|
||||
update_ui(true);
|
||||
}
|
||||
panel_timeline->hand_moving = false;
|
||||
panel_timeline->hand_moving = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1180,7 +1182,7 @@ void TimelineWidget::init_ghosts() {
|
||||
g.in = g.old_in = c->get_timeline_in_with_transition();
|
||||
g.out = g.old_out = c->get_timeline_out_with_transition();
|
||||
g.ghost_length = g.old_out - g.old_in;
|
||||
} else if (g.transition == NULL) {
|
||||
} else if (g.transition == nullptr) {
|
||||
// this ghost is for a clip
|
||||
g.in = g.old_in = c->timeline_in;
|
||||
g.out = g.old_out = c->timeline_out;
|
||||
@@ -1277,11 +1279,11 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
long temp_frame_diff = frame_diff; // cache to see if we change it (thus cancelling any snap)
|
||||
for (int i=0;i<panel_timeline->ghosts.size();i++) {
|
||||
const Ghost& g = panel_timeline->ghosts.at(i);
|
||||
Clip* c = NULL;
|
||||
Clip* c = nullptr;
|
||||
if (g.clip != -1) c = sequence->clips.at(g.clip);
|
||||
|
||||
const FootageStream* ms = NULL;
|
||||
if (g.clip != -1 && c->media != NULL && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
const FootageStream* ms = nullptr;
|
||||
if (g.clip != -1 && c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
ms = c->media->to_footage()->get_stream_from_file_index(c->track < 0, c->media_stream);
|
||||
}
|
||||
|
||||
@@ -1289,8 +1291,8 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
if (panel_timeline->creating) {
|
||||
// i feel like we might need something here but we haven't so far?
|
||||
} else if (effective_tool == TIMELINE_TOOL_SLIP) {
|
||||
if ((c->media != NULL && c->media->get_type() == MEDIA_TYPE_SEQUENCE)
|
||||
|| (ms != NULL && !ms->infinite_length)) {
|
||||
if ((c->media != nullptr && c->media->get_type() == MEDIA_TYPE_SEQUENCE)
|
||||
|| (ms != nullptr && !ms->infinite_length)) {
|
||||
// prevent slip moving a clip below 0 clip_in
|
||||
validator = g.old_clip_in - frame_diff;
|
||||
if (validator < 0) frame_diff += validator;
|
||||
@@ -1312,8 +1314,8 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
}
|
||||
|
||||
// prevent clip_in from going below 0
|
||||
if ((c->media != NULL && c->media->get_type() == MEDIA_TYPE_SEQUENCE)
|
||||
|| (ms != NULL && !ms->infinite_length)) {
|
||||
if ((c->media != nullptr && c->media->get_type() == MEDIA_TYPE_SEQUENCE)
|
||||
|| (ms != nullptr && !ms->infinite_length)) {
|
||||
validator = g.old_clip_in + frame_diff;
|
||||
if (validator < 0) frame_diff -= validator;
|
||||
}
|
||||
@@ -1323,15 +1325,15 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
if (validator < 1) frame_diff += (1 - validator);
|
||||
|
||||
// prevent clip length exceeding media length
|
||||
if ((c->media != NULL && c->media->get_type() == MEDIA_TYPE_SEQUENCE)
|
||||
|| (ms != NULL && !ms->infinite_length)) {
|
||||
if ((c->media != nullptr && c->media->get_type() == MEDIA_TYPE_SEQUENCE)
|
||||
|| (ms != nullptr && !ms->infinite_length)) {
|
||||
validator = g.old_clip_in + g.ghost_length + frame_diff;
|
||||
if (validator > g.media_length) frame_diff -= validator - g.media_length;
|
||||
}
|
||||
}
|
||||
|
||||
// prevent dual transition from going below 0 on the primary or media length on the secondary
|
||||
if (g.transition != NULL && g.transition->secondary_clip != NULL) {
|
||||
if (g.transition != nullptr && g.transition->secondary_clip != nullptr) {
|
||||
Clip* otc = g.transition->parent_clip;
|
||||
Clip* ctc = g.transition->secondary_clip;
|
||||
|
||||
@@ -1387,8 +1389,8 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
validator = g.old_in + frame_diff;
|
||||
if (validator < 0) frame_diff -= validator;
|
||||
|
||||
if (g.transition != NULL) {
|
||||
if (g.transition->secondary_clip != NULL) {
|
||||
if (g.transition != nullptr) {
|
||||
if (g.transition->secondary_clip != nullptr) {
|
||||
// prevent dual transitions from going below 0 on the primary or above media length on the secondary
|
||||
|
||||
validator = g.transition->parent_clip->get_clip_in_with_transition() + frame_diff;
|
||||
@@ -1405,14 +1407,14 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
} else {
|
||||
// prevent clip_in from going below 0
|
||||
if (c->media->get_type() == MEDIA_TYPE_SEQUENCE
|
||||
|| (ms != NULL && !ms->infinite_length)) {
|
||||
|| (ms != nullptr && !ms->infinite_length)) {
|
||||
validator = g.old_clip_in + frame_diff;
|
||||
if (validator < 0) frame_diff -= validator;
|
||||
}
|
||||
|
||||
// prevent clip length exceeding media length
|
||||
if (c->media->get_type() == MEDIA_TYPE_SEQUENCE
|
||||
|| (ms != NULL && !ms->infinite_length)) {
|
||||
|| (ms != nullptr && !ms->infinite_length)) {
|
||||
validator = g.old_clip_in + g.ghost_length + frame_diff;
|
||||
if (validator > g.media_length) frame_diff -= validator - g.media_length;
|
||||
}
|
||||
@@ -1482,7 +1484,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
}
|
||||
|
||||
// apply changes
|
||||
if (g.transition != NULL && g.transition->secondary_clip != NULL) {
|
||||
if (g.transition != nullptr && g.transition->secondary_clip != nullptr) {
|
||||
if (g.trim_in) ghost_diff = -ghost_diff;
|
||||
g.in = g.old_in - ghost_diff;
|
||||
g.out = g.old_out + ghost_diff;
|
||||
@@ -1497,7 +1499,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
g.in = g.old_in + frame_diff;
|
||||
g.out = g.old_out + frame_diff;
|
||||
|
||||
if (g.transition != NULL && g.transition == sequence->clips.at(g.clip)->get_opening_transition()) {
|
||||
if (g.transition != nullptr && g.transition == sequence->clips.at(g.clip)->get_opening_transition()) {
|
||||
g.clip_in = g.old_clip_in + frame_diff;
|
||||
}
|
||||
|
||||
@@ -1566,7 +1568,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
QString tip = ((frame_diff < 0) ? "-" : "+") + frame_to_timecode(qAbs(frame_diff), config.timecode_view, sequence->frame_rate);
|
||||
if (panel_timeline->trim_target > -1) {
|
||||
// find which clip is being moved
|
||||
const Ghost* g = NULL;
|
||||
const Ghost* g = nullptr;
|
||||
for (int i=0;i<panel_timeline->ghosts.size();i++) {
|
||||
if (panel_timeline->ghosts.at(i).clip == panel_timeline->trim_target) {
|
||||
g = &panel_timeline->ghosts.at(i);
|
||||
@@ -1574,8 +1576,8 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
}
|
||||
}
|
||||
|
||||
if (g != NULL) {
|
||||
tip += " Duration: ";
|
||||
if (g != nullptr) {
|
||||
tip += " " + tr("Duration:") + " ";
|
||||
long len = (g->old_out-g->old_in);
|
||||
if (panel_timeline->trim_in_point) {
|
||||
len -= frame_diff;
|
||||
@@ -1591,7 +1593,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
|
||||
void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
tooltip_timer.stop();
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
bool alt = (event->modifiers() & Qt::AltModifier);
|
||||
|
||||
panel_timeline->cursor_frame = panel_timeline->getTimelineFrameFromScreenPoint(event->pos().x());
|
||||
@@ -1690,14 +1692,14 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
// create ghosts
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
Ghost g;
|
||||
g.transition = NULL;
|
||||
g.transition = nullptr;
|
||||
|
||||
bool add = panel_timeline->is_clip_selected(c, true);
|
||||
|
||||
// if a whole clip is not selected, maybe just a transition is
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_POINTER && (c->get_opening_transition() != NULL || c->get_closing_transition() != NULL)) {
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_POINTER && (c->get_opening_transition() != nullptr || c->get_closing_transition() != nullptr)) {
|
||||
// check if any selections contain the whole clip or transition
|
||||
for (int j=0;j<sequence->selections.size();j++) {
|
||||
const Selection& s = sequence->selections.at(j);
|
||||
@@ -1715,7 +1717,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
}
|
||||
}
|
||||
|
||||
if (add && g.transition != NULL) {
|
||||
if (add && g.transition != nullptr) {
|
||||
// check for duplicate transitions
|
||||
for (int j=0;j<panel_timeline->ghosts.size();j++) {
|
||||
if (panel_timeline->ghosts.at(j).transition == g.transition) {
|
||||
@@ -1771,7 +1773,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
if (!found) {
|
||||
// add ghost for this clip with opposite trim_in
|
||||
Ghost gh;
|
||||
gh.transition = NULL;
|
||||
gh.transition = nullptr;
|
||||
gh.clip = j;
|
||||
gh.trimming = (panel_timeline->trim_target > -1);
|
||||
gh.trim_in = !panel_timeline->trim_in_point;
|
||||
@@ -1795,7 +1797,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
panel_timeline->ghosts[i].trimming = false;
|
||||
for (int j=0;j<sequence->clips.size();j++) {
|
||||
Clip* c = sequence->clips.at(j);
|
||||
if (c != NULL && c->track == ghost_clip->track) {
|
||||
if (c != nullptr && c->track == ghost_clip->track) {
|
||||
bool found = false;
|
||||
for (int k=0;k<size;k++) {
|
||||
if (panel_timeline->ghosts.at(k).clip == j) {
|
||||
@@ -1807,7 +1809,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
bool is_in = (c->timeline_in == ghost_clip->timeline_out);
|
||||
if (is_in || c->timeline_out == ghost_clip->timeline_in) {
|
||||
Ghost gh;
|
||||
gh.transition = NULL;
|
||||
gh.transition = nullptr;
|
||||
gh.clip = j;
|
||||
gh.trimming = true;
|
||||
gh.trim_in = is_in;
|
||||
@@ -1836,7 +1838,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && !panel_timeline->is_clip_selected(c, true)) {
|
||||
if (c != nullptr && !panel_timeline->is_clip_selected(c, true)) {
|
||||
bool clip_is_post = (c->timeline_in >= axis);
|
||||
|
||||
// see if this a clip on this track is already in the list, and if it's closer
|
||||
@@ -1912,7 +1914,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
QVector<Clip*> selected_clips;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* clip = sequence->clips.at(i);
|
||||
if (clip != NULL &&
|
||||
if (clip != nullptr &&
|
||||
clip->track >= track_min &&
|
||||
clip->track <= track_max &&
|
||||
!(clip->timeline_in < frame_min && clip->timeline_out < frame_min) &&
|
||||
@@ -1983,7 +1985,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
panel_timeline->transition_select = TA_NO_TRANSITION;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
min_track = qMin(min_track, c->track);
|
||||
max_track = qMax(max_track, c->track);
|
||||
if (c->track == mouse_track) {
|
||||
@@ -1994,9 +1996,9 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
tooltip_timer.start();
|
||||
tooltip_clip = i;
|
||||
|
||||
if (c->get_opening_transition() != NULL && panel_timeline->cursor_frame <= c->timeline_in + c->get_opening_transition()->get_true_length()) {
|
||||
if (c->get_opening_transition() != nullptr && panel_timeline->cursor_frame <= c->timeline_in + c->get_opening_transition()->get_true_length()) {
|
||||
panel_timeline->transition_select = TA_OPENING_TRANSITION;
|
||||
} else if (c->get_closing_transition() != NULL && panel_timeline->cursor_frame >= c->timeline_out - c->get_closing_transition()->get_true_length()) {
|
||||
} else if (c->get_closing_transition() != nullptr && panel_timeline->cursor_frame >= c->timeline_out - c->get_closing_transition()->get_true_length()) {
|
||||
panel_timeline->transition_select = TA_CLOSING_TRANSITION;
|
||||
}
|
||||
}
|
||||
@@ -2019,7 +2021,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
}
|
||||
}
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_POINTER) {
|
||||
if (c->get_opening_transition() != NULL) {
|
||||
if (c->get_opening_transition() != nullptr) {
|
||||
long transition_point = c->timeline_in + c->get_opening_transition()->get_true_length();
|
||||
|
||||
if (transition_point > mouse_frame_lower && transition_point < mouse_frame_upper) {
|
||||
@@ -2033,7 +2035,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (c->get_closing_transition() != NULL) {
|
||||
if (c->get_closing_transition() != nullptr) {
|
||||
long transition_point = c->timeline_out - c->get_closing_transition()->get_true_length();
|
||||
if (transition_point > mouse_frame_lower && transition_point < mouse_frame_upper) {
|
||||
int nc = qAbs(transition_point + 1 - panel_timeline->cursor_frame);
|
||||
@@ -2150,7 +2152,7 @@ void TimelineWidget::leaveEvent(QEvent*) {
|
||||
}
|
||||
|
||||
int color_brightness(int r, int g, int b) {
|
||||
return (0.2126*r + 0.7152*g + 0.0722*b);
|
||||
return qRound(0.2126*r + 0.7152*g + 0.0722*b);
|
||||
}
|
||||
|
||||
void draw_waveform(Clip* clip, const FootageStream* ms, long media_length, QPainter *p, const QRect& clip_rect, int waveform_start, int waveform_limit, double zoom) {
|
||||
@@ -2178,7 +2180,7 @@ void draw_waveform(Clip* clip, const FootageStream* ms, long media_length, QPain
|
||||
p->drawLine(clip_rect.left()+i, mid+min, clip_rect.left()+i, mid+max);
|
||||
}
|
||||
}/* else {
|
||||
dout << "[WARNING] Tried to reach" << offset + 1 << ", limit:" << ms->audio_preview.size();
|
||||
qWarning() << "Tried to reach" << offset + 1 << ", limit:" << ms->audio_preview.size();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
@@ -2186,7 +2188,7 @@ void draw_waveform(Clip* clip, const FootageStream* ms, long media_length, QPain
|
||||
|
||||
void draw_transition(QPainter& p, Clip* c, const QRect& clip_rect, QRect& text_rect, int transition_type) {
|
||||
Transition* t = (transition_type == TA_OPENING_TRANSITION) ? c->get_opening_transition() : c->get_closing_transition();
|
||||
if (t != NULL) {
|
||||
if (t != nullptr) {
|
||||
QColor transition_color(255, 0, 0, 16);
|
||||
int transition_width = getScreenPointFromFrame(panel_timeline->zoom, t->get_true_length());
|
||||
int transition_height = clip_rect.height();
|
||||
@@ -2206,7 +2208,7 @@ void draw_transition(QPainter& p, Clip* c, const QRect& clip_rect, QRect& text_r
|
||||
bool draw_text = true;
|
||||
|
||||
p.setPen(QColor(0, 0, 0, 96));
|
||||
if (t->secondary_clip == NULL) {
|
||||
if (t->secondary_clip == nullptr) {
|
||||
if (transition_type == TA_OPENING_TRANSITION) {
|
||||
p.drawLine(transition_rect.bottomLeft(), transition_rect.topRight());
|
||||
} else {
|
||||
@@ -2236,7 +2238,7 @@ void draw_transition(QPainter& p, Clip* c, const QRect& clip_rect, QRect& text_r
|
||||
|
||||
void TimelineWidget::paintEvent(QPaintEvent*) {
|
||||
// Draw clips
|
||||
if (sequence != NULL) {
|
||||
if (sequence != nullptr) {
|
||||
QPainter p(this);
|
||||
|
||||
// get widget width and height
|
||||
@@ -2244,7 +2246,7 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
||||
int audio_track_limit = 0;
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* clip = sequence->clips.at(i);
|
||||
if (clip != NULL) {
|
||||
if (clip != nullptr) {
|
||||
video_track_limit = qMin(video_track_limit, clip->track);
|
||||
audio_track_limit = qMax(audio_track_limit, clip->track);
|
||||
}
|
||||
@@ -2268,7 +2270,7 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
||||
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* clip = sequence->clips.at(i);
|
||||
if (clip != NULL && is_track_visible(clip->track)) {
|
||||
if (clip != nullptr && is_track_visible(clip->track)) {
|
||||
QRect clip_rect(panel_timeline->getTimelineScreenPointFromFrame(clip->timeline_in), getScreenPointFromTrack(clip->track), getScreenPointFromFrame(panel_timeline->zoom, clip->getLength()), panel_timeline->calculate_track_height(clip->track, -1));
|
||||
QRect text_rect(clip_rect.left() + CLIP_TEXT_PADDING, clip_rect.top() + CLIP_TEXT_PADDING, clip_rect.width() - CLIP_TEXT_PADDING - 1, clip_rect.height() - CLIP_TEXT_PADDING - 1);
|
||||
if (clip_rect.left() < width() && clip_rect.right() >= 0 && clip_rect.top() < height() && clip_rect.bottom() >= 0) {
|
||||
@@ -2281,12 +2283,12 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
||||
|
||||
int thumb_x = clip_rect.x() + 1;
|
||||
|
||||
if (clip->media != NULL && clip->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
if (clip->media != nullptr && clip->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
bool draw_checkerboard = false;
|
||||
QRect checkerboard_rect(clip_rect);
|
||||
Footage* m = clip->media->to_footage();
|
||||
FootageStream* ms = m->get_stream_from_file_index(clip->track < 0, clip->media_stream);
|
||||
if (ms == NULL) {
|
||||
if (ms == nullptr) {
|
||||
draw_checkerboard = true;
|
||||
} else if (ms->preview_done) {
|
||||
// draw top and tail triangles
|
||||
@@ -2332,12 +2334,12 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
||||
int thumb_y = p.fontMetrics().height()+CLIP_TEXT_PADDING+CLIP_TEXT_PADDING;
|
||||
if (thumb_x < width() && thumb_y < height()) {
|
||||
int space_for_thumb = clip_rect.width()-1;
|
||||
if (clip->get_opening_transition() != NULL) {
|
||||
if (clip->get_opening_transition() != nullptr) {
|
||||
int ot_width = getScreenPointFromFrame(panel_timeline->zoom, clip->get_opening_transition()->get_true_length());
|
||||
thumb_x += ot_width;
|
||||
space_for_thumb -= ot_width;
|
||||
}
|
||||
if (clip->get_closing_transition() != NULL) {
|
||||
if (clip->get_closing_transition() != nullptr) {
|
||||
space_for_thumb -= getScreenPointFromFrame(panel_timeline->zoom, clip->get_closing_transition()->get_true_length());
|
||||
}
|
||||
int thumb_height = clip_rect.height()-thumb_y;
|
||||
@@ -2642,7 +2644,7 @@ void TimelineWidget::paintEvent(QPaintEvent*) {
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidget::resizeEvent(QResizeEvent *event) {
|
||||
void TimelineWidget::resizeEvent(QResizeEvent *) {
|
||||
scrollBar->setPageStep(height());
|
||||
}
|
||||
|
||||
@@ -2692,7 +2694,7 @@ int TimelineWidget::getScreenPointFromTrack(int track) {
|
||||
int TimelineWidget::getClipIndexFromCoords(long frame, int track) {
|
||||
for (int i=0;i<sequence->clips.size();i++) {
|
||||
Clip* c = sequence->clips.at(i);
|
||||
if (c != NULL && c->track == track && frame >= c->timeline_in && frame < c->timeline_out) {
|
||||
if (c != nullptr && c->track == track && frame >= c->timeline_in && frame < c->timeline_out) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
ViewerContainer::ViewerContainer(QWidget *parent) :
|
||||
QScrollArea(parent),
|
||||
fit(true),
|
||||
child(NULL)
|
||||
child(nullptr)
|
||||
{
|
||||
setFrameShadow(QFrame::Plain);
|
||||
setFrameShape(QFrame::NoFrame);
|
||||
@@ -50,7 +50,7 @@ void ViewerContainer::dragScrollMove(const QPoint &p) {
|
||||
}
|
||||
|
||||
void ViewerContainer::adjust() {
|
||||
if (viewer->seq != NULL) {
|
||||
if (viewer->seq != nullptr) {
|
||||
if (child->waveform) {
|
||||
child->move(0, 0);
|
||||
child->resize(size());
|
||||
|
||||
+62
-55
@@ -46,12 +46,12 @@ extern "C" {
|
||||
|
||||
ViewerWidget::ViewerWidget(QWidget *parent) :
|
||||
QOpenGLWidget(parent),
|
||||
default_fbo(NULL),
|
||||
default_fbo(nullptr),
|
||||
waveform(false),
|
||||
dragging(false),
|
||||
selected_gizmo(NULL),
|
||||
waveform_zoom(1.0),
|
||||
waveform_scroll(0)
|
||||
waveform_scroll(0),
|
||||
dragging(false),
|
||||
selected_gizmo(nullptr)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
@@ -70,7 +70,7 @@ ViewerWidget::ViewerWidget(QWidget *parent) :
|
||||
|
||||
void ViewerWidget::delete_function() {
|
||||
// destroy all textures as well
|
||||
if (viewer->seq != NULL) {
|
||||
if (viewer->seq != nullptr) {
|
||||
makeCurrent();
|
||||
closeActiveClips(viewer->seq);
|
||||
doneCurrent();
|
||||
@@ -87,14 +87,14 @@ void ViewerWidget::set_waveform_scroll(int s) {
|
||||
void ViewerWidget::show_context_menu() {
|
||||
QMenu menu(this);
|
||||
|
||||
QAction* save_frame_as_image = menu.addAction("Save Frame as Image...");
|
||||
QAction* save_frame_as_image = menu.addAction(tr("Save Frame as Image..."));
|
||||
connect(save_frame_as_image, SIGNAL(triggered(bool)), this, SLOT(save_frame()));
|
||||
|
||||
QAction* show_fullscreen_action = menu.addAction("Show Fullscreen");
|
||||
QAction* show_fullscreen_action = menu.addAction(tr("Show Fullscreen"));
|
||||
connect(show_fullscreen_action, SIGNAL(triggered()), this, SLOT(show_fullscreen()));
|
||||
|
||||
QMenu zoom_menu("Zoom");
|
||||
QAction* fit_zoom = zoom_menu.addAction("Fit");
|
||||
QMenu zoom_menu(tr("Zoom"));
|
||||
QAction* fit_zoom = zoom_menu.addAction(tr("Fit"));
|
||||
connect(fit_zoom, SIGNAL(triggered(bool)), this, SLOT(set_fit_zoom()));
|
||||
zoom_menu.addAction("10%")->setData(0.1);
|
||||
zoom_menu.addAction("25%")->setData(0.25);
|
||||
@@ -104,11 +104,15 @@ void ViewerWidget::show_context_menu() {
|
||||
zoom_menu.addAction("150%")->setData(1.5);
|
||||
zoom_menu.addAction("200%")->setData(2.0);
|
||||
zoom_menu.addAction("400%")->setData(4.0);
|
||||
QAction* custom_zoom = zoom_menu.addAction("Custom");
|
||||
QAction* custom_zoom = zoom_menu.addAction(tr("Custom"));
|
||||
connect(custom_zoom, SIGNAL(triggered(bool)), this, SLOT(set_custom_zoom()));
|
||||
connect(&zoom_menu, SIGNAL(triggered(QAction*)), this, SLOT(set_menu_zoom(QAction*)));
|
||||
menu.addMenu(&zoom_menu);
|
||||
|
||||
if (!viewer->is_main_sequence()) {
|
||||
menu.addAction(tr("Close Media"), viewer, SLOT(close_media()));
|
||||
}
|
||||
|
||||
menu.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
@@ -116,7 +120,7 @@ void ViewerWidget::save_frame() {
|
||||
QFileDialog fd(this);
|
||||
fd.setAcceptMode(QFileDialog::AcceptSave);
|
||||
fd.setFileMode(QFileDialog::AnyFile);
|
||||
fd.setWindowTitle("Save Frame");
|
||||
fd.setWindowTitle(tr("Save Frame"));
|
||||
fd.setNameFilter("Portable Network Graphic (*.png);;JPEG (*.jpg);;Windows Bitmap (*.bmp);;Portable Pixmap (*.ppm);;X11 Bitmap (*.xbm);;X11 Pixmap (*.xpm)");
|
||||
|
||||
if (fd.exec()) {
|
||||
@@ -139,7 +143,7 @@ void ViewerWidget::save_frame() {
|
||||
img.save(fn);
|
||||
|
||||
fbo.release();
|
||||
default_fbo = NULL;
|
||||
default_fbo = nullptr;
|
||||
rendering = false;
|
||||
}
|
||||
}
|
||||
@@ -155,7 +159,10 @@ void ViewerWidget::set_fit_zoom() {
|
||||
|
||||
void ViewerWidget::set_custom_zoom() {
|
||||
bool ok;
|
||||
double d = QInputDialog::getDouble(this, "Viewer Zoom", "Set Custom Zoom Value:", container->zoom*100, 0, 2147483647, 2, &ok);
|
||||
double d = QInputDialog::getDouble(this,
|
||||
tr("Viewer Zoom"),
|
||||
tr("Set Custom Zoom Value:"),
|
||||
container->zoom*100, 0, 2147483647, 2, &ok);
|
||||
if (ok) {
|
||||
container->fit = false;
|
||||
container->zoom = d*0.01;
|
||||
@@ -200,8 +207,8 @@ void ViewerWidget::seek_from_click(int x) {
|
||||
}
|
||||
|
||||
EffectGizmo* ViewerWidget::get_gizmo_from_mouse(int x, int y) {
|
||||
if (gizmos != NULL) {
|
||||
double multiplier = (double) viewer->seq->width / (double) width();
|
||||
if (gizmos != nullptr) {
|
||||
double multiplier = double(viewer->seq->width) / double(width());
|
||||
QPoint mouse_pos(qRound(x*multiplier), qRound(y*multiplier));
|
||||
int dot_size = 2 * qRound(GIZMO_DOT_SIZE * multiplier);
|
||||
int target_size = 2 * qRound(GIZMO_TARGET_SIZE * multiplier);
|
||||
@@ -234,12 +241,12 @@ EffectGizmo* ViewerWidget::get_gizmo_from_mouse(int x, int y) {
|
||||
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ViewerWidget::move_gizmos(QMouseEvent *event, bool done) {
|
||||
if (selected_gizmo != NULL) {
|
||||
double multiplier = (double) viewer->seq->width / (double) width();
|
||||
if (selected_gizmo != nullptr) {
|
||||
double multiplier = double(viewer->seq->width) / double(width());
|
||||
|
||||
int x_movement = (event->pos().x() - drag_start_x)*multiplier;
|
||||
int y_movement = (event->pos().y() - drag_start_y)*multiplier;
|
||||
@@ -270,7 +277,7 @@ void ViewerWidget::mousePressEvent(QMouseEvent* event) {
|
||||
|
||||
selected_gizmo = get_gizmo_from_mouse(event->pos().x(), event->pos().y());
|
||||
|
||||
if (selected_gizmo != NULL) {
|
||||
if (selected_gizmo != nullptr) {
|
||||
selected_gizmo->set_previous_value();
|
||||
}
|
||||
}
|
||||
@@ -287,7 +294,7 @@ void ViewerWidget::mouseMoveEvent(QMouseEvent* event) {
|
||||
seek_from_click(event->x());
|
||||
} else if (event->buttons() & Qt::MiddleButton || panel_timeline->tool == TIMELINE_TOOL_HAND) {
|
||||
container->dragScrollMove(event->pos());
|
||||
} else if (gizmos == NULL) {
|
||||
} else if (gizmos == nullptr) {
|
||||
QDrag* drag = new QDrag(this);
|
||||
QMimeData* mimeData = new QMimeData;
|
||||
mimeData->setText("h"); // QMimeData will fail without some kind of data
|
||||
@@ -299,7 +306,7 @@ void ViewerWidget::mouseMoveEvent(QMouseEvent* event) {
|
||||
}
|
||||
} else {
|
||||
EffectGizmo* g = get_gizmo_from_mouse(event->pos().x(), event->pos().y());
|
||||
if (g != NULL) {
|
||||
if (g != nullptr) {
|
||||
if (g->get_cursor() > -1) {
|
||||
setCursor(static_cast<enum Qt::CursorShape>(g->get_cursor()));
|
||||
}
|
||||
@@ -416,7 +423,7 @@ GLuint ViewerWidget::draw_clip(QOpenGLFramebufferObject* fbo, GLuint texture, bo
|
||||
// restore previous blendFunc
|
||||
glBlendFuncSeparate(src_rgb, dst_rgb, src_alpha, dst_alpha);
|
||||
|
||||
if (default_fbo != NULL) default_fbo->bind();
|
||||
if (default_fbo != nullptr) default_fbo->bind();
|
||||
|
||||
glPopMatrix();
|
||||
return fbo->texture();
|
||||
@@ -427,9 +434,9 @@ void ViewerWidget::process_effect(Clip* c, Effect* e, double timecode, GLTexture
|
||||
if (e->enable_coords) {
|
||||
e->process_coords(timecode, coords, data);
|
||||
}
|
||||
if (e->enable_shader || e->enable_superimpose) {
|
||||
if ((e->enable_shader && shaders_are_enabled) || e->enable_superimpose) {
|
||||
e->startEffect();
|
||||
if (e->enable_shader && e->is_glsl_linked()) {
|
||||
if ((e->enable_shader && shaders_are_enabled) && e->is_glsl_linked()) {
|
||||
e->process_shader(timecode, coords);
|
||||
composite_texture = draw_clip(c->fbo[fbo_switcher], composite_texture, true);
|
||||
fbo_switcher = !fbo_switcher;
|
||||
@@ -437,7 +444,7 @@ void ViewerWidget::process_effect(Clip* c, Effect* e, double timecode, GLTexture
|
||||
if (e->enable_superimpose) {
|
||||
GLuint superimpose_texture = e->process_superimpose(timecode);
|
||||
if (superimpose_texture == 0) {
|
||||
dout << "[WARNING] Superimpose texture was NULL, retrying...";
|
||||
qWarning() << "Superimpose texture was nullptr, retrying...";
|
||||
texture_failed = true;
|
||||
} else {
|
||||
composite_texture = draw_clip(c->fbo[!fbo_switcher], superimpose_texture, false);
|
||||
@@ -462,7 +469,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
playhead = refactor_frame_number(playhead, nests.at(i)->sequence->frame_rate, s->frame_rate);
|
||||
}
|
||||
|
||||
if (nests.last()->fbo != NULL) {
|
||||
if (nests.last()->fbo != nullptr) {
|
||||
nests.last()->fbo[0]->bind();
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
nests.last()->fbo[0]->release();
|
||||
@@ -477,16 +484,16 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
Clip* c = s->clips.at(i);
|
||||
|
||||
// if clip starts within one second and/or hasn't finished yet
|
||||
if (c != NULL) {
|
||||
if (c != nullptr) {
|
||||
if (!(!nests.isEmpty() && !same_sign(c->track, nests.last()->track))) {
|
||||
bool clip_is_active = false;
|
||||
|
||||
if (c->media != NULL && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE) {
|
||||
Footage* m = c->media->to_footage();
|
||||
if (!m->invalid && !(c->track >= 0 && !is_audio_device_set())) {
|
||||
if (m->ready) {
|
||||
const FootageStream* ms = m->get_stream_from_file_index(c->track < 0, c->media_stream);
|
||||
if (ms != NULL && is_clip_active(c, playhead)) {
|
||||
if (ms != nullptr && is_clip_active(c, playhead)) {
|
||||
// if thread is already working, we don't want to touch this,
|
||||
// but we also don't want to hang the UI thread
|
||||
if (!c->open) {
|
||||
@@ -498,7 +505,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
close_clip(c, false);
|
||||
}
|
||||
} else {
|
||||
//dout << "[WARNING] Media '" + m->name + "' was not ready, retrying...";
|
||||
//qWarning() << "Media '" + m->name + "' was not ready, retrying...";
|
||||
texture_failed = true;
|
||||
}
|
||||
}
|
||||
@@ -541,8 +548,8 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
|
||||
Clip* c = current_clips.at(i);
|
||||
|
||||
if (c->media != NULL && c->media->get_type() == MEDIA_TYPE_FOOTAGE && !c->finished_opening) {
|
||||
dout << "[WARNING] Tried to display clip" << i << "but it's closed";
|
||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_FOOTAGE && !c->finished_opening) {
|
||||
qWarning() << "Tried to display clip" << i << "but it's closed";
|
||||
texture_failed = true;
|
||||
} else {
|
||||
if (c->track < 0) {
|
||||
@@ -550,11 +557,11 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
int video_width = c->getWidth();
|
||||
int video_height = c->getHeight();
|
||||
|
||||
if (c->media != NULL) {
|
||||
if (c->media != nullptr) {
|
||||
switch (c->media->get_type()) {
|
||||
case MEDIA_TYPE_FOOTAGE:
|
||||
// set up opengl texture
|
||||
if (c->texture == NULL) {
|
||||
if (c->texture == nullptr) {
|
||||
c->texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
|
||||
c->texture->setSize(c->stream->codecpar->width, c->stream->codecpar->height);
|
||||
c->texture->setFormat(get_gl_tex_fmt_from_av(c->pix_fmt));
|
||||
@@ -571,14 +578,14 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
}
|
||||
}
|
||||
|
||||
if (textureID == 0 && c->media != NULL) {
|
||||
dout << "[WARNING] Texture hasn't been created yet";
|
||||
if (textureID == 0 && c->media != nullptr) {
|
||||
qWarning() << "Texture hasn't been created yet";
|
||||
texture_failed = true;
|
||||
} else if (playhead >= c->get_timeline_in_with_transition()) {
|
||||
glPushMatrix();
|
||||
|
||||
// start preparing cache
|
||||
if (c->fbo == NULL) {
|
||||
if (c->fbo == nullptr) {
|
||||
c->fbo = new QOpenGLFramebufferObject* [2];
|
||||
c->fbo[0] = new QOpenGLFramebufferObject(video_width, video_height);
|
||||
c->fbo[1] = new QOpenGLFramebufferObject(video_width, video_height);
|
||||
@@ -598,7 +605,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
|
||||
GLuint composite_texture;
|
||||
|
||||
if (c->media == NULL) {
|
||||
if (c->media == nullptr) {
|
||||
c->fbo[fbo_switcher]->bind();
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
c->fbo[fbo_switcher]->release();
|
||||
@@ -631,8 +638,8 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
|
||||
// set up autoscale
|
||||
if (c->autoscale && (video_width != s->width && video_height != s->height)) {
|
||||
float width_multiplier = (float) s->width / (float) video_width;
|
||||
float height_multiplier = (float) s->height / (float) video_height;
|
||||
float width_multiplier = float(s->width) / float(video_width);
|
||||
float height_multiplier = float(s->height) / float(video_height);
|
||||
float scale_multiplier = qMin(width_multiplier, height_multiplier);
|
||||
glScalef(scale_multiplier, scale_multiplier, 1);
|
||||
}
|
||||
@@ -640,35 +647,35 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
// EFFECT CODE START
|
||||
double timecode = get_timecode(c, playhead);
|
||||
|
||||
Effect* first_gizmo_effect = NULL;
|
||||
Effect* selected_effect = NULL;
|
||||
Effect* first_gizmo_effect = nullptr;
|
||||
Effect* selected_effect = nullptr;
|
||||
|
||||
for (int j=0;j<c->effects.size();j++) {
|
||||
Effect* e = c->effects.at(j);
|
||||
process_effect(c, e, timecode, coords, composite_texture, fbo_switcher, TA_NO_TRANSITION);
|
||||
|
||||
if (e->are_gizmos_enabled()) {
|
||||
if (first_gizmo_effect == NULL) first_gizmo_effect = e;
|
||||
if (first_gizmo_effect == nullptr) first_gizmo_effect = e;
|
||||
if (e->container->selected) selected_effect = e;
|
||||
}
|
||||
}
|
||||
|
||||
if (!rendering) {
|
||||
if (selected_effect != NULL) {
|
||||
if (selected_effect != nullptr) {
|
||||
gizmos = selected_effect;
|
||||
} else if (panel_timeline->is_clip_selected(c, true)) {
|
||||
gizmos = first_gizmo_effect;
|
||||
}
|
||||
}
|
||||
|
||||
if (c->get_opening_transition() != NULL) {
|
||||
if (c->get_opening_transition() != nullptr) {
|
||||
int transition_progress = playhead - c->get_timeline_in_with_transition();
|
||||
if (transition_progress < c->get_opening_transition()->get_length()) {
|
||||
process_effect(c, c->get_opening_transition(), (double)transition_progress/(double)c->get_opening_transition()->get_length(), coords, composite_texture, fbo_switcher, TA_OPENING_TRANSITION);
|
||||
}
|
||||
}
|
||||
|
||||
if (c->get_closing_transition() != NULL) {
|
||||
if (c->get_closing_transition() != nullptr) {
|
||||
int transition_progress = playhead - (c->get_timeline_out_with_transition() - c->get_closing_transition()->get_length());
|
||||
if (transition_progress >= 0 && transition_progress < c->get_closing_transition()->get_length()) {
|
||||
process_effect(c, c->get_closing_transition(), (double)transition_progress/(double)c->get_closing_transition()->get_length(), coords, composite_texture, fbo_switcher, TA_CLOSING_TRANSITION);
|
||||
@@ -746,7 +753,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0); // unbind texture
|
||||
|
||||
if (gizmos != NULL && !drawn_gizmos) {
|
||||
if (gizmos != nullptr && !drawn_gizmos) {
|
||||
gizmos->gizmo_draw(timecode, coords); // set correct gizmo coords
|
||||
gizmos->gizmo_world_to_screen();
|
||||
|
||||
@@ -755,7 +762,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
|
||||
if (!nests.isEmpty()) {
|
||||
nests.last()->fbo[0]->release();
|
||||
if (default_fbo != NULL) default_fbo->bind();
|
||||
if (default_fbo != nullptr) default_fbo->bind();
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
@@ -770,7 +777,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
}
|
||||
} else {
|
||||
if (render_audio || (config.enable_audio_scrubbing && audio_scrub)) {
|
||||
if (c->media != NULL && c->media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
if (c->media != nullptr && c->media->get_type() == MEDIA_TYPE_SEQUENCE) {
|
||||
nests.append(c);
|
||||
compose_sequence(nests, render_audio);
|
||||
nests.removeLast();
|
||||
@@ -806,7 +813,7 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
if (!nests.isEmpty() && nests.last()->fbo != NULL) {
|
||||
if (!nests.isEmpty() && nests.last()->fbo != nullptr) {
|
||||
// returns nested clip's texture
|
||||
return nests.last()->fbo[0]->texture();
|
||||
}
|
||||
@@ -817,8 +824,8 @@ GLuint ViewerWidget::compose_sequence(QVector<Clip*>& nests, bool render_audio)
|
||||
void ViewerWidget::paintGL() {
|
||||
drawn_gizmos = false;
|
||||
force_quit = false;
|
||||
if (viewer->seq != NULL) {
|
||||
gizmos = NULL;
|
||||
if (viewer->seq != nullptr) {
|
||||
gizmos = nullptr;
|
||||
|
||||
bool render_audio = (viewer->playing || rendering);
|
||||
bool loop = false;
|
||||
@@ -868,9 +875,9 @@ void ViewerWidget::paintGL() {
|
||||
if (force_quit) break;
|
||||
if (texture_failed) {
|
||||
if (rendering) {
|
||||
dout << "[INFO] Texture failed - looping";
|
||||
qInfo() << "Texture failed - looping";
|
||||
loop = true;
|
||||
} else {
|
||||
} else if (!viewer->playing) {
|
||||
retry_timer.start();
|
||||
}
|
||||
}
|
||||
@@ -879,7 +886,7 @@ void ViewerWidget::paintGL() {
|
||||
drawTitleSafeArea();
|
||||
}
|
||||
|
||||
if (gizmos != NULL && drawn_gizmos) {
|
||||
if (gizmos != nullptr && drawn_gizmos) {
|
||||
float color[4];
|
||||
glGetFloatv(GL_CURRENT_COLOR, color);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user