-#include
-#include
-
-DemoNotice::DemoNotice(QWidget *parent) :
- QDialog(parent)
-{
- setWindowTitle(tr("Welcome to Olive!"));
-
- QVBoxLayout* vlayout = new QVBoxLayout(this);
-
- QHBoxLayout* layout = new QHBoxLayout();
- layout->setMargin(10);
- layout->setSpacing(20);
-
- QLabel* icon = new QLabel(""
- "
"
- "", this);
- layout->addWidget(icon);
-
- QLabel* text = new QLabel(""
- ""
- + tr("Welcome to Olive!")
- + "
"
- + 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.")
- + "
"
- + 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("www.olivevideoeditor.org")
- + "
"
- + tr("Thank you for trying Olive and we hope you enjoy it!")
- + "
", this);
- text->setWordWrap(true);
- layout->addWidget(text);
-
- vlayout->addLayout(layout);
-
- QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok, this);
- buttons->setCenterButtons(true);
- connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
- vlayout->addWidget(buttons);
-}
diff --git a/dialogs/demonotice.h b/dialogs/demonotice.h
deleted file mode 100644
index a716da84c..000000000
--- a/dialogs/demonotice.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#ifndef DEMONOTICE_H
-#define DEMONOTICE_H
-
-#include
-
-/**
- * @brief The DemoNotice class
- *
- * Simple dialog shown on startup to introduce Olive as alpha software (in release builds). Can be run from anywhere,
- * but there should be no reason to create it outside of the application launch.
- *
- * To be phased out as Olive gains maturity.
- */
-class DemoNotice : public QDialog
-{
- Q_OBJECT
-public:
- /**
- * @brief DemoNotice Constructor
- * @param parent
- *
- * QWidget parent. Usually MainWindow.
- */
- explicit DemoNotice(QWidget *parent = nullptr);
-};
-
-#endif // DEMONOTICE_H
diff --git a/dialogs/exportdialog.cpp b/dialogs/exportdialog.cpp
deleted file mode 100644
index afd8b9321..000000000
--- a/dialogs/exportdialog.cpp
+++ /dev/null
@@ -1,807 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#include "exportdialog.h"
-
-extern "C" {
-#include
-}
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "global/global.h"
-#include "dialogs/advancedvideodialog.h"
-#include "panels/panels.h"
-#include "ui/viewerwidget.h"
-#include "rendering/renderfunctions.h"
-#include "rendering/audio.h"
-#include "rendering/exportthread.h"
-#include "ui/mainwindow.h"
-
-enum ExportFormats {
- FORMAT_3GPP,
- FORMAT_AIFF,
- FORMAT_APNG,
- FORMAT_AVI,
- FORMAT_DNXHD,
- FORMAT_AC3,
- FORMAT_FLV,
- FORMAT_GIF,
- FORMAT_IMG,
- FORMAT_MP2,
- FORMAT_MP3,
- FORMAT_MPEG1,
- FORMAT_MPEG2,
- FORMAT_MPEG4,
- FORMAT_MPEGTS,
- FORMAT_MKV,
- FORMAT_OGG,
- FORMAT_MOV,
- FORMAT_WAV,
- FORMAT_WEBM,
- FORMAT_WMV,
- FORMAT_SIZE
-};
-
-ExportDialog::ExportDialog(QWidget *parent, Sequence* sequence) :
- QDialog(parent),
- sequence_(sequence)
-{
- setWindowTitle(tr("Export \"%1\"").arg(sequence->name()));
- setup_ui();
-
- rangeCombobox->setCurrentIndex(0);
- if (sequence->using_workarea) {
- rangeCombobox->setEnabled(true);
- rangeCombobox->setCurrentIndex(1);
- }
-
- format_strings.resize(FORMAT_SIZE);
- format_strings[FORMAT_3GPP] = "3GPP";
- format_strings[FORMAT_AIFF] = "AIFF";
- format_strings[FORMAT_APNG] = "Animated PNG";
- format_strings[FORMAT_AVI] = "AVI";
- format_strings[FORMAT_DNXHD] = "DNxHD";
- format_strings[FORMAT_AC3] = "Dolby Digital (AC3)";
- format_strings[FORMAT_FLV] = "FLV";
- format_strings[FORMAT_GIF] = "GIF";
- format_strings[FORMAT_IMG] = "Image Sequence";
- format_strings[FORMAT_MP2] = "MP2 Audio";
- format_strings[FORMAT_MP3] = "MP3 Audio";
- format_strings[FORMAT_MPEG1] = "MPEG-1 Video";
- format_strings[FORMAT_MPEG2] = "MPEG-2 Video";
- format_strings[FORMAT_MPEG4] = "MPEG-4 Video";
- format_strings[FORMAT_MPEGTS] = "MPEG-TS";
- format_strings[FORMAT_MKV] = "Matroska MKV";
- format_strings[FORMAT_OGG] = "Ogg";
- format_strings[FORMAT_MOV] = "QuickTime MOV";
- format_strings[FORMAT_WAV] = "WAVE Audio";
- format_strings[FORMAT_WEBM] = "WebM";
- format_strings[FORMAT_WMV] = "Windows Media";
-
- for (int i=0;iaddItem(format_strings[i]);
- }
- formatCombobox->setCurrentIndex(FORMAT_MPEG4);
-
- // default to sequence's native dimensions
- widthSpinbox->setValue(sequence->width());
- heightSpinbox->setValue(sequence->height());
- samplingRateSpinbox->setValue(sequence->audio_frequency());
- framerateSpinbox->setValue(sequence->frame_rate());
-
- // set some advanced defaults
- vcodec_params.threads = 0;
-}
-
-void ExportDialog::add_codec_to_combobox(QComboBox* box, enum AVCodecID codec) {
- QString codec_name;
-
- AVCodec* codec_info = avcodec_find_encoder(codec);
-
- if (codec_info == nullptr) {
- codec_name = tr("Unknown codec name %1").arg(static_cast(codec));
- } else {
- codec_name = codec_info->long_name;
- }
-
- box->addItem(codec_name, codec);
-}
-
-void ExportDialog::format_changed(int index) {
- vcodecCombobox->clear();
- acodecCombobox->clear();
-
- int default_vcodec = 0;
- int default_acodec = 0;
-
- switch (index) {
- case FORMAT_3GPP:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_MPEG4);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_H264);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_H265);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AAC);
-
- default_vcodec = 1;
- break;
- case FORMAT_AIFF:
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_PCM_S16LE);
- break;
- case FORMAT_APNG:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_APNG);
- break;
- case FORMAT_AVI:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_H264);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_MPEG4);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_MJPEG);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_MSVIDEO1);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_RAWVIDEO);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_HUFFYUV);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_DVVIDEO);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AAC);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AC3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_FLAC);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP2);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_PCM_S16LE);
-
- default_vcodec = 3;
- default_acodec = 5;
- break;
- case FORMAT_DNXHD:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_DNXHD);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_PCM_S16LE);
- break;
- case FORMAT_AC3:
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AC3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_EAC3);
- break;
- case FORMAT_FLV:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_FLV1);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP3);
- break;
- case FORMAT_GIF:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_GIF);
- break;
- case FORMAT_IMG:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_BMP);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_MJPEG);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_JPEG2000);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_PSD);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_PNG);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_TIFF);
-
- default_vcodec = 4;
- break;
- case FORMAT_MP2:
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP2);
- break;
- case FORMAT_MP3:
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP3);
- break;
- case FORMAT_MPEG1:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_MPEG1VIDEO);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AC3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP2);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_PCM_S16LE);
-
- default_acodec = 1;
- break;
- case FORMAT_MPEG2:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_MPEG2VIDEO);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AC3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP2);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_PCM_S16LE);
-
- default_acodec = 1;
- break;
- case FORMAT_MPEG4:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_MPEG4);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_H264);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_H265);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AAC);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AC3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP2);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP3);
-
- default_vcodec = 1;
- break;
- case FORMAT_MPEGTS:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_MPEG2VIDEO);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AAC);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AC3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP2);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP3);
-
- default_acodec = 2;
- break;
- case FORMAT_MKV:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_MPEG4);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_H264);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_H265);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AAC);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AC3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_EAC3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_FLAC);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP2);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_OPUS);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_PCM_S16LE);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_VORBIS);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_WAVPACK);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_WMAV1);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_WMAV2);
-
- default_vcodec = 1;
- break;
- case FORMAT_OGG:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_THEORA);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_OPUS);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_VORBIS);
-
- default_acodec = 1;
- break;
- case FORMAT_MOV:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_QTRLE);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_MPEG4);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_H264);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_H265);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_MJPEG);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_PRORES);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AAC);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_AC3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP2);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_MP3);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_PCM_S16LE);
-
- default_vcodec = 2;
- break;
- case FORMAT_WAV:
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_PCM_S16LE);
- break;
- case FORMAT_WEBM:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_VP8);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_VP9);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_OPUS);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_VORBIS);
-
- default_vcodec = 1;
- break;
- case FORMAT_WMV:
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_WMV1);
- add_codec_to_combobox(vcodecCombobox, AV_CODEC_ID_WMV2);
-
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_WMAV1);
- add_codec_to_combobox(acodecCombobox, AV_CODEC_ID_WMAV2);
-
- default_vcodec = 1;
- default_acodec = 1;
- break;
- default:
- qCritical() << "Invalid format selection - this is a bug, please inform the developers";
- }
-
- vcodecCombobox->setCurrentIndex(default_vcodec);
- acodecCombobox->setCurrentIndex(default_acodec);
-
- bool video_enabled = vcodecCombobox->count() != 0;
- bool audio_enabled = acodecCombobox->count() != 0;
- videoGroupbox->setChecked(video_enabled);
- audioGroupbox->setChecked(audio_enabled);
- videoGroupbox->setEnabled(video_enabled);
- audioGroupbox->setEnabled(audio_enabled);
-}
-
-void ExportDialog::export_thread_finished() {
- // Determine if the export succeeded
- bool succeeded = (progressBar->value() == 100);
-
- // If it failed and we didn't cancel it, it must have errored out. Show an error message.
- if (!succeeded && !export_thread_->WasInterrupted()) {
- QMessageBox::critical(
- this,
- tr("Export Failed"),
- tr("Export failed - %1").arg(export_thread_->GetError()),
- QMessageBox::Ok
- );
- }
-
- // Clear audio buffer
- clear_audio_ibuffer();
-
- // Re-enable/disable UI widgets based on the rendering state
- prep_ui_for_render(false);
-
- // Move OpenGL context back to the sequence viewer
- panel_sequence_viewer->viewer_widget()->makeCurrent();
- panel_sequence_viewer->viewer_widget()->initializeGL();
-
- // Update the application UI
- update_ui(false);
-
- // Disconnect cancel button from export thread
- disconnect(renderCancel, SIGNAL(clicked(bool)), export_thread_, SLOT(Interrupt()));
-
- // Free the export thread
- export_thread_->deleteLater();
-
- // If the export succeeded, close the dialog
- if (succeeded) {
- accept();
- }
-}
-
-void ExportDialog::prep_ui_for_render(bool r) {
- export_button->setEnabled(!r);
- cancel_button->setEnabled(!r);
- videoGroupbox->setEnabled(!r);
- audioGroupbox->setEnabled(!r);
- renderCancel->setEnabled(r);
-}
-
-void ExportDialog::StartExport() {
- if (widthSpinbox->value()%2 == 1 || heightSpinbox->value()%2 == 1) {
- QMessageBox::critical(
- this,
- tr("Invalid dimensions"),
- tr("Export width and height must both be even numbers/divisible by 2."),
- QMessageBox::Ok
- );
- return;
- }
-
- QString ext;
- switch (formatCombobox->currentIndex()) {
- case FORMAT_3GPP:
- ext = "3gp";
- break;
- case FORMAT_AIFF:
- ext = "aiff";
- break;
- case FORMAT_APNG:
- ext = "apng";
- break;
- case FORMAT_AVI:
- ext = "avi";
- break;
- case FORMAT_DNXHD:
- ext = "mxf";
- break;
- case FORMAT_AC3:
- ext = "ac3";
- break;
- case FORMAT_FLV:
- ext = "flv";
- break;
- case FORMAT_GIF:
- ext = "gif";
- break;
- case FORMAT_IMG:
- switch (vcodecCombobox->currentData().toInt()) {
- case AV_CODEC_ID_BMP:
- ext = "bmp";
- break;
- case AV_CODEC_ID_MJPEG:
- ext = "jpg";
- break;
- case AV_CODEC_ID_JPEG2000:
- ext = "jp2";
- break;
- case AV_CODEC_ID_PSD:
- ext = "psd";
- break;
- case AV_CODEC_ID_PNG:
- ext = "png";
- break;
- case AV_CODEC_ID_TIFF:
- ext = "tif";
- break;
- default:
- 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;
- case FORMAT_MP3:
- ext = "mp3";
- break;
- case FORMAT_MPEG1:
- if (videoGroupbox->isChecked() && !audioGroupbox->isChecked()) {
- ext = "m1v";
- } else if (!videoGroupbox->isChecked() && audioGroupbox->isChecked()) {
- ext = "m1a";
- } else {
- ext = "mpg";
- }
- break;
- case FORMAT_MPEG2:
- if (videoGroupbox->isChecked() && !audioGroupbox->isChecked()) {
- ext = "m2v";
- } else if (!videoGroupbox->isChecked() && audioGroupbox->isChecked()) {
- ext = "m2a";
- } else {
- ext = "mpg";
- }
- break;
- case FORMAT_MPEG4:
- if (videoGroupbox->isChecked() && !audioGroupbox->isChecked()) {
- ext = "m4v";
- } else if (!videoGroupbox->isChecked() && audioGroupbox->isChecked()) {
- ext = "m4a";
- } else {
- ext = "mp4";
- }
- break;
- case FORMAT_MPEGTS:
- ext = "ts";
- break;
- case FORMAT_MKV:
- if (!videoGroupbox->isChecked()) {
- ext = "mka";
- } else {
- ext = "mkv";
- }
- break;
- case FORMAT_OGG:
- ext = "ogg";
- break;
- case FORMAT_MOV:
- ext = "mov";
- break;
- case FORMAT_WAV:
- ext = "wav";
- break;
- case FORMAT_WEBM:
- ext = "webm";
- break;
- case FORMAT_WMV:
- if (videoGroupbox->isChecked()) {
- ext = "wmv";
- } else {
- ext = "wma";
- }
- break;
- default:
- 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,
- tr("Export Media"),
- "",
- format_strings[formatCombobox->currentIndex()] + " (*." + ext + ")"
- );
- if (!filename.isEmpty()) {
- if (!filename.endsWith("." + ext, Qt::CaseInsensitive)) {
- filename += "." + ext;
- }
-
- if (formatCombobox->currentIndex() == FORMAT_IMG) {
- int ext_location = filename.lastIndexOf('.');
- if (ext_location > filename.lastIndexOf('/')) {
- filename.insert(ext_location, 'd');
- filename.insert(ext_location, '5');
- filename.insert(ext_location, '0');
- filename.insert(ext_location, '%');
- }
- }
-
- // Set up export parameters to send to the ExportThread
- ExportParams params;
- params.sequence = sequence_;
- params.filename = filename;
- params.video_enabled = videoGroupbox->isChecked();
- if (params.video_enabled) {
- params.video_codec = vcodecCombobox->currentData().toInt();
- params.video_width = widthSpinbox->value();
- params.video_height = heightSpinbox->value();
- params.video_frame_rate = framerateSpinbox->value();
- params.video_compression_type = compressionTypeCombobox->currentData().toInt();
- params.video_bitrate = videobitrateSpinbox->value();
- }
- params.audio_enabled = audioGroupbox->isChecked();
- if (params.audio_enabled) {
- params.audio_codec = acodecCombobox->currentData().toInt();
- params.audio_sampling_rate = samplingRateSpinbox->value();
- params.audio_bitrate = audiobitrateSpinbox->value();
- }
-
- params.start_frame = 0;
- params.end_frame = sequence_->GetEndFrame(); // entire sequence
- if (rangeCombobox->currentIndex() == 1) {
- params.start_frame = qMax(sequence_->workarea_in, params.start_frame);
- params.end_frame = qMin(sequence_->workarea_out, params.end_frame);
- }
-
- // Create export thread
- export_thread_ = new ExportThread(params, vcodec_params, this);
-
- // Connect export thread signals/slots
- connect(export_thread_, SIGNAL(finished()), this, SLOT(export_thread_finished()));
- connect(export_thread_, SIGNAL(ProgressChanged(int, qint64)), this, SLOT(update_progress_bar(int, qint64)));
- connect(renderCancel, SIGNAL(clicked(bool)), export_thread_, SLOT(Interrupt()));
-
- // Close all effects in effect controls (prevents UI threading issues)
- panel_effect_controls->Clear();
-
- // Close all currently open clips
- sequence_->Close();
-
- olive::Global->set_export_state(true);
-
- olive::Global->save_autorecovery_file();
-
- prep_ui_for_render(true);
-
- total_export_time_start = QDateTime::currentMSecsSinceEpoch();
-
- export_thread_->start();
- }
-}
-
-void ExportDialog::update_progress_bar(int value, qint64 remaining_ms) {
- if (value == 100) {
- // if value is 100%, show total render time rather than remaining
- remaining_ms = QDateTime::currentMSecsSinceEpoch() - total_export_time_start;
- }
-
- // convert ms to H:MM:SS
- int seconds = qFloor(remaining_ms*0.001)%60;
- int minutes = qFloor(remaining_ms/60000)%60;
- int hours = qFloor(remaining_ms/3600000);
-
- if (value == 100) {
- // show value as "total"
- progressBar->setFormat(tr("%p% (Total: %1:%2:%3)").arg(QString::number(hours),
- QString::number(minutes).rightJustified(2, '0'),
- QString::number(seconds).rightJustified(2, '0')));
- } else {
- // show value as "remaining"
- progressBar->setFormat(tr("%p% (ETA: %1:%2:%3)").arg(QString::number(hours),
- QString::number(minutes).rightJustified(2, '0'),
- QString::number(seconds).rightJustified(2, '0')));
- }
-
- progressBar->setValue(value);
-}
-
-void ExportDialog::vcodec_changed(int index) {
- compressionTypeCombobox->clear();
-
- if (vcodecCombobox->count() > 0) {
- if (vcodecCombobox->itemData(index) == AV_CODEC_ID_H264
- || vcodecCombobox->itemData(index) == AV_CODEC_ID_H265) {
- compressionTypeCombobox->setEnabled(true);
- 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(tr("Constant Bitrate"), COMPRESSION_TYPE_CBR);
- compressionTypeCombobox->setCurrentIndex(0);
- compressionTypeCombobox->setEnabled(false);
- }
-
- // set default pix_fmt for this codec
- AVCodec* codec_info = avcodec_find_encoder(static_cast(vcodecCombobox->itemData(index).toInt()));
- if (codec_info == nullptr) {
- QMessageBox::critical(this,
- tr("Invalid Codec"),
- tr("Failed to find a suitable encoder for this codec. Export will likely fail."));
- } else {
- vcodec_params.pix_fmt = codec_info->pix_fmts[0];
- if (vcodec_params.pix_fmt == -1) {
- QMessageBox::critical(this,
- tr("Invalid Codec"),
- tr("Failed to find pixel format for this encoder. Export will likely fail."));
- }
- }
- }
-}
-
-void ExportDialog::comp_type_changed(int) {
- videobitrateSpinbox->setToolTip("");
- videobitrateSpinbox->setMinimum(0);
- videobitrateSpinbox->setMaximum(99.99);
- switch (compressionTypeCombobox->currentData().toInt()) {
- case COMPRESSION_TYPE_CBR:
- case COMPRESSION_TYPE_TARGETBR:
- 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(tr("Quality (CRF):"));
- videobitrateSpinbox->setValue(23);
- videobitrateSpinbox->setMaximum(51);
- 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(tr("Target File Size (MB):"));
- videobitrateSpinbox->setValue(100);
- break;
- }
-}
-
-void ExportDialog::open_advanced_video_dialog() {
- AdvancedVideoDialog avd(this, static_cast(vcodecCombobox->currentData().toInt()), vcodec_params);
- avd.exec();
-}
-
-void ExportDialog::setup_ui() {
- QVBoxLayout* verticalLayout = new QVBoxLayout(this);
-
- QHBoxLayout* format_layout = new QHBoxLayout();
-
- format_layout->addWidget(new QLabel(tr("Format:"), this));
-
- formatCombobox = new QComboBox();
- format_layout->addWidget(formatCombobox);
-
- verticalLayout->addLayout(format_layout);
-
- QHBoxLayout* range_layout = new QHBoxLayout();
-
- range_layout->addWidget(new QLabel(tr("Range:"), this));
-
- rangeCombobox = new QComboBox(this);
- rangeCombobox->addItem(tr("Entire Sequence"));
- rangeCombobox->addItem(tr("In to Out"));
-
- range_layout->addWidget(rangeCombobox);
-
- verticalLayout->addLayout(range_layout);
-
- videoGroupbox = new QGroupBox(this);
- videoGroupbox->setTitle(tr("Video"));
- videoGroupbox->setFlat(false);
- videoGroupbox->setCheckable(true);
-
- QGridLayout* videoGridLayout = new QGridLayout(videoGroupbox);
-
- videoGridLayout->addWidget(new QLabel(tr("Codec:"), this), 0, 0, 1, 1);
- vcodecCombobox = new QComboBox(videoGroupbox);
- videoGridLayout->addWidget(vcodecCombobox, 0, 1, 1, 1);
-
- videoGridLayout->addWidget(new QLabel(tr("Width:"), this), 1, 0, 1, 1);
- widthSpinbox = new QSpinBox(videoGroupbox);
- widthSpinbox->setMaximum(16777216);
- videoGridLayout->addWidget(widthSpinbox, 1, 1, 1, 1);
-
- videoGridLayout->addWidget(new QLabel(tr("Height:"), this), 2, 0, 1, 1);
- heightSpinbox = new QSpinBox(videoGroupbox);
- heightSpinbox->setMaximum(16777216);
- videoGridLayout->addWidget(heightSpinbox, 2, 1, 1, 1);
-
- videoGridLayout->addWidget(new QLabel(tr("Frame Rate:"), this), 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(tr("Compression Type:"), this), 4, 0, 1, 1);
- compressionTypeCombobox = new QComboBox(videoGroupbox);
- videoGridLayout->addWidget(compressionTypeCombobox, 4, 1, 1, 1);
-
- videoBitrateLabel = new QLabel(videoGroupbox);
- videoGridLayout->addWidget(videoBitrateLabel, 5, 0, 1, 1);
- videobitrateSpinbox = new QDoubleSpinBox(videoGroupbox);
- videobitrateSpinbox->setMaximum(100);
- videobitrateSpinbox->setValue(2);
- videoGridLayout->addWidget(videobitrateSpinbox, 5, 1, 1, 1);
-
- QPushButton* advanced_video_button = new QPushButton(tr("Advanced"));
- connect(advanced_video_button, SIGNAL(clicked(bool)), this, SLOT(open_advanced_video_dialog()));
- videoGridLayout->addWidget(advanced_video_button, 6, 1);
-
- verticalLayout->addWidget(videoGroupbox);
-
- audioGroupbox = new QGroupBox(this);
- audioGroupbox->setTitle(tr("Audio"));
- audioGroupbox->setCheckable(true);
-
- QGridLayout* audioGridLayout = new QGridLayout(audioGroupbox);
-
- audioGridLayout->addWidget(new QLabel(tr("Codec:"), this), 0, 0, 1, 1);
- acodecCombobox = new QComboBox(audioGroupbox);
- audioGridLayout->addWidget(acodecCombobox, 0, 1, 1, 1);
-
- audioGridLayout->addWidget(new QLabel(tr("Sampling Rate:"), this), 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(tr("Bitrate (Kbps/CBR):"), this), 3, 0, 1, 1);
- audiobitrateSpinbox = new QSpinBox(audioGroupbox);
- audiobitrateSpinbox->setMaximum(320);
- audiobitrateSpinbox->setValue(256);
- audioGridLayout->addWidget(audiobitrateSpinbox, 3, 1, 1, 1);
-
- verticalLayout->addWidget(audioGroupbox);
-
- QHBoxLayout* progressLayout = new QHBoxLayout();
- progressBar = new QProgressBar(this);
- progressBar->setFormat("%p% (ETA: 0:00:00)");
- progressBar->setEnabled(false);
- progressBar->setValue(0);
- progressLayout->addWidget(progressBar);
-
- renderCancel = new QPushButton(this);
- renderCancel->setIcon(QIcon(":/icons/error.svg"));
- renderCancel->setEnabled(false);
- progressLayout->addWidget(renderCancel);
-
- verticalLayout->addLayout(progressLayout);
-
- QHBoxLayout* buttonLayout = new QHBoxLayout();
- buttonLayout->addStretch();
-
- export_button = new QPushButton(this);
- export_button->setText("Export");
- connect(export_button, SIGNAL(clicked(bool)), this, SLOT(StartExport()));
-
- buttonLayout->addWidget(export_button);
-
- cancel_button = new QPushButton(this);
- cancel_button->setText("Cancel");
- connect(cancel_button, SIGNAL(clicked(bool)), this, SLOT(reject()));
-
- buttonLayout->addWidget(cancel_button);
-
- buttonLayout->addStretch();
-
- verticalLayout->addLayout(buttonLayout);
-
- connect(formatCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(format_changed(int)));
- connect(compressionTypeCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(comp_type_changed(int)));
- connect(vcodecCombobox, SIGNAL(currentIndexChanged(int)), this, SLOT(vcodec_changed(int)));
-}
diff --git a/dialogs/exportdialog.h b/dialogs/exportdialog.h
deleted file mode 100644
index d24e57e18..000000000
--- a/dialogs/exportdialog.h
+++ /dev/null
@@ -1,277 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#ifndef EXPORTDIALOG_H
-#define EXPORTDIALOG_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "timeline/sequence.h"
-#include "rendering/exportthread.h"
-
-/**
- * @brief The ExportDialog class
- *
- * The dialog to initiate an export. Requires a valid Sequence to be set in olive::ActiveSequence or the result is
- * defined (most likely a crash), so you should always do a `nullptr` check on olive::ActiveSequence before constructing
- * this dialog.
- */
-class ExportDialog : public QDialog
-{
- Q_OBJECT
-public:
- /**
- * @brief ExportDialog Constructor
- *
- * @param parent
- *
- * QWidget parent. Usually MainWindow.
- */
- explicit ExportDialog(QWidget *parent, Sequence *sequence);
-
-private slots:
- /**
- * @brief Slot for when the user changes the format
- *
- * Used to populate the available codecs list for this format.
- *
- * @param index
- *
- * Current format index (corresponding to enum ExportFormats)
- */
- void format_changed(int index);
-
- /**
- * @brief Slot for when the user clicks the Export button
- *
- * Asks the user for the file to save to.
- */
- void StartExport();
-
- /**
- * @brief Slot for the export thread to update the progress bar's value
- *
- * @param value
- *
- * An value between 0 - 100. A percentage of the Sequence that has been exported so far.
- *
- * @param remaining_ms
- *
- * The estimated time in milliseconds that it will take to complete the rest of the Sequence.
- */
- void update_progress_bar(int value, qint64 remaining_ms);
-
- /**
- * @brief Slot for the export thread completing (both succeeding and failing)
- *
- * Runs whenever the thread has finished. Determines whether the thread succeeded or not (and shows an error message
- * if not), cleans up the ExportThread object, sets the UI state back to normal.
- *
- * Connect to ExportThread::finished().
- */
- void export_thread_finished();
-
- /**
- * @brief Slot for when the video codec changes
- *
- * Some video codecs require different settings. In the case of that, this function sorts through those.
- *
- * @param index
- *
- * Current vcodecCombobox index - its item data contains the AVCodecID.
- */
- void vcodec_changed(int index);
-
- /**
- * @brief Slot for when the compression type changes
- *
- * Different UI objects should be displayed for different compression types.
- *
- * @param index
- *
- * Unused.
- */
- void comp_type_changed(int index);
-
- /**
- * @brief Slot to open the Advanced Video Dialog
- *
- * Opens a dialog for setting more advanced video settings and passes a reference to vcodec_params to it.
- */
- void open_advanced_video_dialog();
-
-private:
- /**
- * @brief Function to create UI objects.
- */
- void setup_ui();
-
- /**
- * @brief Enables/disables certain UI objects based on the exporting state.
- *
- * Some UI controls don't need to be set while exporting. This function enables/disables them appropriately.
- *
- * @param r
- *
- * TRUE if we're exporting, FALSE if we finished.
- */
- void prep_ui_for_render(bool r);
-
- /**
- * @brief Retrieves the human-readable name of an AVCodecID and adds it to a QComboBox
- *
- * Also sets that item's data to the AVCodecID so it can be retrieved directly from the QComboBox.
- *
- * @param box
- *
- * The QComboBox to add the item to.
- *
- * @param codec
- *
- * The codec to add to the QComboBox.
- */
- void add_codec_to_combobox(QComboBox* box, enum AVCodecID codec);
-
- /**
- * @brief Internal array of human-readable names corresponding to enum ExportFormats
- */
- QVector format_strings;
-
- /**
- * @brief Pointer to an ExportThread
- *
- * Set when exporting starts, and deleted by export_thread_finished() when the thread is complete.
- */
- ExportThread* export_thread_;
-
- /**
- * @brief Struct for advanced video codec parameters.
- *
- * More advanced video encoding parameters to be sent to the ExportThread. These variables are not directly editable
- * in this dialog, instead calling open_advanced_video_dialog() will open an AdvancedVideoDialog for setting these
- * values directly. vcodec_changed() should also set these to the defaults for that codec where appropriate.
- */
- VideoCodecParams vcodec_params;
-
- /**
- * @brief ComboBox for selecting the time range of the Sequence to export
- */
- QComboBox* rangeCombobox;
-
- /**
- * @brief SpinBox for the exported video's width
- */
- QSpinBox* widthSpinbox;
-
- /**
- * @brief SpinBox for the exported video's bitrate
- */
- QDoubleSpinBox* videobitrateSpinbox;
-
- /**
- * @brief Label for the exported video's bitrate - changes depending on the compression type
- */
- QLabel* videoBitrateLabel;
-
- /**
- * @brief SpinBox for the exported video's frame rate
- */
- QDoubleSpinBox* framerateSpinbox;
-
- /**
- * @brief ComboBox for the exported video codec
- */
- QComboBox* vcodecCombobox;
-
- /**
- * @brief ComboBox for the exported audio's codec
- */
- QComboBox* acodecCombobox;
-
- /**
- * @brief SpinBox for the exported audio's sample rate
- */
- QSpinBox* samplingRateSpinbox;
-
- /**
- * @brief SpinBox for the exported audio's bitrate
- */
- QSpinBox* audiobitrateSpinbox;
-
- /**
- * @brief Progress bar for visually showing the export progress
- */
- QProgressBar* progressBar;
-
- /**
- * @brief ComboBox for the exported video's format
- */
- QComboBox* formatCombobox;
-
- /**
- * @brief SpinBox for the exported video's height
- */
- QSpinBox* heightSpinbox;
-
- /**
- * @brief Export button to trigger the start of an export
- */
- QPushButton* export_button;
-
- /**
- * @brief Dialog cancel button to close this dialog
- */
- QPushButton* cancel_button;
-
- /**
- * @brief Cancel button to abort the export before completion
- */
- QPushButton* renderCancel;
-
- /**
- * @brief GroupBox containing all video-related UI objects
- */
- QGroupBox* videoGroupbox;
-
- /**
- * @brief GroupBox containing all audio-related UI objects
- */
- QGroupBox* audioGroupbox;
-
- /**
- * @brief ComboBox for the exported video compression type
- */
- QComboBox* compressionTypeCombobox;
-
- /**
- * @brief Time value set when exporting begins to determine the total duration of the export
- */
- qint64 total_export_time_start;
-
- Sequence* sequence_;
-};
-
-#endif // EXPORTDIALOG_H
diff --git a/dialogs/loaddialog.cpp b/dialogs/loaddialog.cpp
deleted file mode 100644
index cee5d64e4..000000000
--- a/dialogs/loaddialog.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#include "loaddialog.h"
-
-#include
-#include
-#include
-
-#include "global/global.h"
-
-#include "panels/panels.h"
-
-#include "ui/sourcetable.h"
-#include "ui/mainwindow.h"
-
-LoadDialog::LoadDialog(QWidget *parent) :
- QDialog(parent)
-{
- setWindowTitle(tr("Loading..."));
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
-
- QVBoxLayout* layout = new QVBoxLayout(this);
-
- layout->addWidget(new QLabel(tr("Loading '%1'...").arg(olive::ActiveProjectFilename.mid(olive::ActiveProjectFilename.lastIndexOf('/')+1)), this));
-
- bar = new QProgressBar(this);
- bar->setValue(0);
- layout->addWidget(bar);
-
- QPushButton* cancel_button = new QPushButton(tr("Cancel"), this);
- connect(cancel_button, SIGNAL(clicked(bool)), this, SIGNAL(cancel()));
-
- // Wrap cancel button in a horizontal layout so it can be centered
- QHBoxLayout* hboxLayout = new QHBoxLayout();
- hboxLayout->addStretch();
- hboxLayout->addWidget(cancel_button);
- hboxLayout->addStretch();
-
- layout->addLayout(hboxLayout);
-}
-
-void LoadDialog::setValue(int i)
-{
- bar->setValue(i);
-}
diff --git a/dialogs/loaddialog.h b/dialogs/loaddialog.h
deleted file mode 100644
index f9b10676c..000000000
--- a/dialogs/loaddialog.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#ifndef LOADDIALOG_H
-#define LOADDIALOG_H
-
-#include
-#include
-#include
-
-#include "project/projectelements.h"
-#include "project/loadthread.h"
-
-/**
- * @brief The LoadDialog class
- *
- * Shows a modal dialog for loading a project. Designed to be connected to a LoadThread object. This dialog should
- * generally not be created directly, use OliveGlobal::LoadProject (or its variants) to correctly set up a LoadDialog
- * and LoadThread and connect them to each other.
- */
-class LoadDialog : public QDialog
-{
- Q_OBJECT
-public:
- /**
- * @brief LoadDialog Constructor
- *
- * @param parent
- *
- * QWidget parent. Usually MainWindow.
- */
- LoadDialog(QWidget* parent);
-
-public slots:
- /**
- * @brief Set the progress bar value
- *
- * Ideally, connect this to LoadThread::report_progress().
- *
- * @param i
- *
- * Should be a value between 0-100.
- */
- void setValue(int i);
-signals:
- /**
- * @brief Signal emitted when the cancel button is clicked.
- *
- * Ideally, connect this to LoadThread::cancel();
- */
- void cancel();
-private:
- /**
- * @brief Progress bar widget
- */
- QProgressBar* bar;
-};
-
-#endif // LOADDIALOG_H
diff --git a/dialogs/mediapropertiesdialog.cpp b/dialogs/mediapropertiesdialog.cpp
deleted file mode 100644
index 060d9192b..000000000
--- a/dialogs/mediapropertiesdialog.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#include "mediapropertiesdialog.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-namespace OCIO = OCIO_NAMESPACE::v1;
-
-#include "project/footage.h"
-#include "project/media.h"
-#include "panels/project.h"
-#include "undo/undo.h"
-#include "undo/undostack.h"
-
-MediaPropertiesDialog::MediaPropertiesDialog(QWidget *parent, Media *i) :
- QDialog(parent),
- item(i)
-{
- setWindowTitle(tr("\"%1\" Properties").arg(i->get_name()));
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-
- QGridLayout* grid = new QGridLayout(this);
-
- int row = 0;
-
- Footage* f = item->to_footage();
-
- grid->addWidget(new QLabel(tr("Tracks:"), this), row, 0, 1, 2);
- row++;
-
- track_list = new QListWidget(this);
- for (int i=0;ivideo_tracks.size();i++) {
- const FootageStream& fs = f->video_tracks.at(i);
-
- 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)
- ),
- track_list
- );
- item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
- item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked);
- item->setData(Qt::UserRole+1, fs.file_index);
- track_list->addItem(item);
- }
- for (int i=0;iaudio_tracks.size();i++) {
- const FootageStream& fs = f->audio_tracks.at(i);
- QListWidgetItem* item = new QListWidgetItem(
- tr("Audio %1: %2Hz %3").arg(
- QString::number(fs.file_index),
- QString::number(fs.audio_frequency),
- tr("%n channel(s)", "", fs.audio_channels)
- ),
- track_list
- );
- item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
- item->setCheckState(fs.enabled ? Qt::Checked : Qt::Unchecked);
- item->setData(Qt::UserRole+1, fs.file_index);
- track_list->addItem(item);
- }
- grid->addWidget(track_list, row, 0, 1, 2);
- row++;
-
- if (f->video_tracks.size() > 0) {
- // frame conforming
- if (!f->video_tracks.at(0).infinite_length) {
- grid->addWidget(new QLabel(tr("Conform to Frame Rate:"), this), row, 0);
- conform_fr = new QDoubleSpinBox(this);
- conform_fr->setMinimum(0.01);
- conform_fr->setValue(f->video_tracks.at(0).video_frame_rate * f->speed);
- grid->addWidget(conform_fr, row, 1);
- }
-
- row++;
-
- // premultiplied alpha mode
- premultiply_alpha_setting = new QCheckBox(tr("Alpha is Premultiplied"), this);
- premultiply_alpha_setting->setChecked(f->alpha_is_associated);
- grid->addWidget(premultiply_alpha_setting, row, 0);
-
- row++;
-
- // deinterlacing mode
- interlacing_box = new QComboBox(this);
- interlacing_box->addItem(
- tr("Auto (%1)").arg(
- Footage::get_interlacing_name(f->video_tracks.at(0).video_auto_interlacing)
- )
- );
- interlacing_box->addItem(Footage::get_interlacing_name(VIDEO_PROGRESSIVE));
- interlacing_box->addItem(Footage::get_interlacing_name(VIDEO_TOP_FIELD_FIRST));
- interlacing_box->addItem(Footage::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);
-
- grid->addWidget(new QLabel(tr("Interlacing:"), this), row, 0);
- grid->addWidget(interlacing_box, row, 1);
-
- row++;
-
- input_color_space = new QComboBox(this);
-
- OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
-
- QString footage_colorspace = f->Colorspace();
-
- for (int i=0;igetNumColorSpaces();i++) {
- QString colorspace = config->getColorSpaceNameByIndex(i);
-
- input_color_space->addItem(colorspace);
-
- if (colorspace == footage_colorspace) {
- input_color_space->setCurrentIndex(i);
- }
- }
-
- grid->addWidget(new QLabel(tr("Color Space:")), row, 0);
- grid->addWidget(input_color_space, row, 1);
-
- row++;
-
- }
-
- name_box = new QLineEdit(item->get_name(), this);
- grid->addWidget(new QLabel(tr("Name:"), this), row, 0);
- grid->addWidget(name_box, row, 1);
- row++;
-
- QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
- buttons->setCenterButtons(true);
- grid->addWidget(buttons, row, 0, 1, 2);
-
- connect(buttons, SIGNAL(accepted()), this, SLOT(accept()));
- connect(buttons, SIGNAL(rejected()), this, SLOT(reject()));
-}
-
-void MediaPropertiesDialog::accept() {
- Footage* f = item->to_footage();
-
- ComboAction* ca = new ComboAction();
-
- // set track enable
- for (int i=0;icount();i++) {
- QListWidgetItem* item = track_list->item(i);
- const QVariant& data = item->data(Qt::UserRole+1);
- if (!data.isNull()) {
- int index = data.toInt();
- bool found = false;
- for (int j=0;jvideo_tracks.size();j++) {
- if (f->video_tracks.at(j).file_index == index) {
- f->video_tracks[j].enabled = (item->checkState() == Qt::Checked);
- found = true;
- break;
- }
- }
- if (!found) {
- for (int j=0;jaudio_tracks.size();j++) {
- if (f->audio_tracks.at(j).file_index == index) {
- f->audio_tracks[j].enabled = (item->checkState() == Qt::Checked);
- break;
- }
- }
- }
- }
- }
-
- bool refresh_clips = false;
-
- // set interlacing
- if (f->video_tracks.size() > 0) {
- if (interlacing_box->currentIndex() > 0) {
- ca->append(new SetInt(&f->video_tracks[0].video_interlacing, interlacing_box->currentIndex() - 1));
- } else {
- ca->append(new SetInt(&f->video_tracks[0].video_interlacing, f->video_tracks.at(0).video_auto_interlacing));
- }
-
- // set frame rate conform
- if (!f->video_tracks.at(0).infinite_length) {
- if (!qFuzzyCompare(conform_fr->value(), f->video_tracks.at(0).video_frame_rate)) {
- ca->append(new SetDouble(&f->speed, f->speed, conform_fr->value()/f->video_tracks.at(0).video_frame_rate));
- refresh_clips = true;
- }
- }
-
- // set premultiplied alpha
- f->alpha_is_associated = premultiply_alpha_setting->isChecked();
- }
-
- f->SetColorspace(input_color_space->currentText());
-
- // set name
- MediaRename* mr = new MediaRename(item, name_box->text());
-
- ca->append(mr);
- ca->appendPost(new CloseAllClipsCommand());
- ca->appendPost(new UpdateFootageTooltip(item));
- if (refresh_clips) {
- ca->appendPost(new RefreshClips(item));
- }
- ca->appendPost(new UpdateViewer());
-
- olive::undo_stack.push(ca);
-
- QDialog::accept();
-}
diff --git a/dialogs/mediapropertiesdialog.h b/dialogs/mediapropertiesdialog.h
deleted file mode 100644
index 5e86b5832..000000000
--- a/dialogs/mediapropertiesdialog.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#ifndef MEDIAPROPERTIESDIALOG_H
-#define MEDIAPROPERTIESDIALOG_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "project/footage.h"
-#include "project/media.h"
-
-/**
- * @brief The MediaPropertiesDialog class
- *
- * A dialog for setting properties on Media. This can be loaded from any part of the application provided it's given
- * a valid Media object.
- */
-class MediaPropertiesDialog : public QDialog {
- Q_OBJECT
-public:
- /**
- * @brief MediaPropertiesDialog Constructor
- *
- * @param parent
- *
- * QWidget parent. Usually MainWindow or Project panel.
- *
- * @param i
- *
- * Media object to set properties for.
- */
- MediaPropertiesDialog(QWidget *parent, Media* i);
-private:
- /**
- * @brief ComboBox for interlacing setting
- */
- QComboBox* interlacing_box;
-
- /**
- * @brief Media name text field
- */
- QLineEdit* name_box;
-
- /**
- * @brief Internal pointer to Media object (set in constructor)
- */
- Media* item;
-
- /**
- * @brief A list widget for listing the tracks in Media
- */
- QListWidget* track_list;
-
- /**
- * @brief Frame rate to conform to
- */
- QDoubleSpinBox* conform_fr;
-
- /**
- * @brief Setting for associated/premultiplied alpha
- */
- QCheckBox* premultiply_alpha_setting;
-
- /**
- * @brief Setting for this media's color space
- */
- QComboBox* input_color_space;
-private slots:
- /**
- * @brief Overridden accept function for saving the properties back to the Media class
- */
- void accept();
-};
-
-#endif // MEDIAPROPERTIESDIALOG_H
diff --git a/dialogs/newsequencedialog.cpp b/dialogs/newsequencedialog.cpp
deleted file mode 100644
index 8d9150862..000000000
--- a/dialogs/newsequencedialog.cpp
+++ /dev/null
@@ -1,323 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#include "newsequencedialog.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "panels/panels.h"
-#include "panels/project.h"
-#include "timeline/sequence.h"
-#include "undo/undostack.h"
-#include "undo/undo.h"
-#include "timeline/clip.h"
-#include "panels/timeline.h"
-#include "project/media.h"
-#include "rendering/audio.h"
-#include "global/config.h"
-
-// FIXME: TEST CODE
-#include "nodes/nodes/nodemedia.h"
-// END TEST CODE
-
-extern "C" {
-#include
-}
-
-NewSequenceDialog::NewSequenceDialog(QWidget *parent, Media *existing, Sequence* iexisting_sequence) :
- QDialog(parent),
- existing_item(existing),
- existing_sequence(iexisting_sequence)
-{
- Q_ASSERT(!(existing != nullptr && iexisting_sequence != nullptr));
-
- setup_ui();
-
- if (existing != nullptr) {
- existing_sequence = existing->to_sequence().get();
- }
-
- if (existing_sequence != nullptr) {
- setWindowTitle(tr("Editing \"%1\"").arg(existing_sequence->name()));
-
- width_numeric->setValue(existing_sequence->width());
- height_numeric->setValue(existing_sequence->height());
- int comp_rate = qRound(existing_sequence->frame_rate()*100);
- for (int i=0;icount();i++) {
- if (qRound(frame_rate_combobox->itemData(i).toDouble()*100) == comp_rate) {
- frame_rate_combobox->setCurrentIndex(i);
- break;
- }
- }
- sequence_name_edit->setText(existing_sequence->name());
- for (int i=0;icount();i++) {
- if (audio_frequency_combobox->itemData(i) == existing_sequence->audio_frequency()) {
- audio_frequency_combobox->setCurrentIndex(i);
- break;
- }
- }
- } else {
- existing_sequence = nullptr;
- setWindowTitle(tr("New Sequence"));
- }
-}
-
-void NewSequenceDialog::set_sequence_name(const QString& s) {
- sequence_name_edit->setText(s);
-}
-
-void NewSequenceDialog::SetNameEditable(bool enabled)
-{
- sequence_name_edit->setVisible(enabled);
- sequence_name_label->setVisible(enabled);
-}
-
-void NewSequenceDialog::accept() {
- if (existing_sequence == nullptr) {
-
- // The dialog wasn't given an existing Sequence object, so we'll make a new one
-
- SequencePtr s = std::make_shared();
-
- s->set_name(sequence_name_edit->text());
- s->set_width(width_numeric->value());
- s->set_height(height_numeric->value());
- s->set_frame_rate(frame_rate_combobox->currentData().toDouble());
- s->set_audio_frequency(audio_frequency_combobox->currentData().toInt());
- s->set_audio_layout(AV_CH_LAYOUT_STEREO);
-
- ComboAction* ca = new ComboAction();
- olive::project_model.CreateSequence(ca, s, true, nullptr);
- olive::undo_stack.push(ca);
-
- } else if (existing_item != nullptr) {
-
- // The dialog was given an existing Sequence object, so we'll apply the changes to it
-
- ComboAction* ca = new ComboAction();
-
- double multiplier = frame_rate_combobox->currentData().toDouble() / existing_sequence->frame_rate();
-
- EditSequenceCommand* esc = new EditSequenceCommand(existing_item, existing_item->to_sequence());
- esc->name = sequence_name_edit->text();
- esc->width = width_numeric->value();
- esc->height = height_numeric->value();
- esc->frame_rate = frame_rate_combobox->currentData().toDouble();
- esc->audio_frequency = audio_frequency_combobox->currentData().toInt();
- esc->audio_layout = AV_CH_LAYOUT_STEREO;
- ca->append(esc);
-
- QVector existing_sequence_clips = existing_sequence->GetAllClips();
- for (int i=0;irefactor_frame_rate(ca, multiplier, true);
- }
-
- olive::undo_stack.push(ca);
-
- } else if (existing_sequence != nullptr) {
-
- // This dialog was given an existing Sequence without a Media wrapper - therefore just directly apply the settings
-
- existing_sequence->set_name(sequence_name_edit->text());
- existing_sequence->set_width(width_numeric->value());
- existing_sequence->set_height(height_numeric->value());
- existing_sequence->set_frame_rate(frame_rate_combobox->currentData().toDouble());
- existing_sequence->set_audio_frequency(audio_frequency_combobox->currentData().toInt());
- existing_sequence->set_audio_layout(AV_CH_LAYOUT_STEREO);
-
- }
-
- QDialog::accept();
-}
-
-void NewSequenceDialog::preset_changed(int index) {
- switch (index) {
- case 0: // FILM 4K
- width_numeric->setValue(4096);
- height_numeric->setValue(2160);
- break;
- case 1: // TV 4K
- width_numeric->setValue(3840);
- height_numeric->setValue(2160);
- break;
- case 2: // 1080p
- width_numeric->setValue(1920);
- height_numeric->setValue(1080);
- break;
- case 3: // 720p
- width_numeric->setValue(1280);
- height_numeric->setValue(720);
- break;
- case 4: // 480p
- width_numeric->setValue(640);
- height_numeric->setValue(480);
- break;
- case 5: // 360p
- width_numeric->setValue(640);
- height_numeric->setValue(360);
- break;
- case 6: // 240p
- width_numeric->setValue(320);
- height_numeric->setValue(240);
- break;
- case 7: // 144p
- width_numeric->setValue(192);
- height_numeric->setValue(144);
- break;
- case 8: // NTSC (480i)
- width_numeric->setValue(720);
- height_numeric->setValue(480);
- break;
- case 9: // PAL (576i)
- width_numeric->setValue(720);
- height_numeric->setValue(576);
- break;
- }
-}
-
-void NewSequenceDialog::setup_ui() {
- QVBoxLayout* verticalLayout = new QVBoxLayout(this);
-
- QWidget* widget = new QWidget(this);
-
- QHBoxLayout* preset_layout = new QHBoxLayout(widget);
- preset_layout->setContentsMargins(0, 0, 0, 0);
-
- preset_layout->addWidget(new QLabel(tr("Preset:"), this));
-
- preset_combobox = new QComboBox(widget);
-
- 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);
-
- verticalLayout->addWidget(widget);
-
- QGroupBox* videoGroupBox = new QGroupBox(this);
- videoGroupBox->setTitle(tr("Video"));
-
- QGridLayout* videoLayout = new QGridLayout(videoGroupBox);
-
- videoLayout->addWidget(new QLabel(tr("Width:"), this), 0, 0, 1, 1);
- width_numeric = new QSpinBox(videoGroupBox);
- width_numeric->setMaximum(9999);
- width_numeric->setValue(olive::config.default_sequence_width);
- videoLayout->addWidget(width_numeric, 0, 2, 1, 2);
-
- videoLayout->addWidget(new QLabel(tr("Height:"), this), 1, 0, 1, 2);
- height_numeric = new QSpinBox(videoGroupBox);
- height_numeric->setMaximum(9999);
- height_numeric->setValue(olive::config.default_sequence_height);
- videoLayout->addWidget(height_numeric, 1, 2, 1, 2);
-
- videoLayout->addWidget(new QLabel(tr("Frame Rate:"), this), 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);
- for (int i=0;icount();i++) {
- if (qFuzzyCompare(frame_rate_combobox->itemData(i).toDouble(), olive::config.default_sequence_framerate)) {
- frame_rate_combobox->setCurrentIndex(i);
- }
- }
- videoLayout->addWidget(frame_rate_combobox, 2, 2, 1, 2);
-
- videoLayout->addWidget(new QLabel(tr("Pixel Aspect Ratio:"), this), 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(tr("Interlacing:"), this), 6, 0, 1, 1);
- interlacing_combobox = new QComboBox(videoGroupBox);
- interlacing_combobox->addItem(tr("None (Progressive)"));
- videoLayout->addWidget(interlacing_combobox, 6, 2, 1, 2);
-
- verticalLayout->addWidget(videoGroupBox);
-
- QGroupBox* audioGroupBox = new QGroupBox(this);
- audioGroupBox->setTitle(tr("Audio"));
-
- QGridLayout* audioLayout = new QGridLayout(audioGroupBox);
-
- audioLayout->addWidget(new QLabel(tr("Sample Rate: "), this), 0, 0, 1, 1);
-
- audio_frequency_combobox = new QComboBox(audioGroupBox);
- combobox_audio_sample_rates(audio_frequency_combobox);
- for (int i=0;icount();i++) {
- if (audio_frequency_combobox->itemData(i) == olive::config.default_sequence_audio_frequency) {
- audio_frequency_combobox->setCurrentIndex(i);
- }
- }
-
- audioLayout->addWidget(audio_frequency_combobox, 0, 1, 1, 1);
-
- verticalLayout->addWidget(audioGroupBox);
-
- QWidget* nameWidget = new QWidget(this);
- QHBoxLayout* nameLayout = new QHBoxLayout(nameWidget);
- nameLayout->setContentsMargins(0, 0, 0, 0);
-
- sequence_name_label = new QLabel(tr("Name:"));
- nameLayout->addWidget(sequence_name_label);
-
- sequence_name_edit = new QLineEdit(nameWidget);
-
- nameLayout->addWidget(sequence_name_edit);
-
- verticalLayout->addWidget(nameWidget);
-
- QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
- buttonBox->setOrientation(Qt::Horizontal);
- buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
- buttonBox->setCenterButtons(true);
-
- verticalLayout->addWidget(buttonBox);
-
- connect(preset_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(preset_changed(int)));
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
-}
diff --git a/dialogs/newsequencedialog.h b/dialogs/newsequencedialog.h
deleted file mode 100644
index 661dabb20..000000000
--- a/dialogs/newsequencedialog.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#ifndef NEWSEQUENCEDIALOG_H
-#define NEWSEQUENCEDIALOG_H
-
-#include
-#include
-#include
-#include
-
-#include "panels/project.h"
-#include "project/media.h"
-#include "timeline/sequence.h"
-
-/**
- * @brief The NewSequenceDialog class
- *
- * A dialog that creates a new (or edits an existing) Sequence object. Can be run from any part of the application.
- */
-class NewSequenceDialog : public QDialog
-{
- Q_OBJECT
-public:
- /**
- * @brief NewSequenceDialog constructor
- *
- * @param parent
- *
- * QWidget parent. Usually MainWindow.
- *
- * @param existing
- *
- * Set this to a Sequence object (wrapped in a Media object) to edit an existing Sequence,
- * or leave as nullptr to create a new one.
- *
- * @param existing_sequence
- *
- * If your Sequence object is not wrapped in a Media object, use this to reference a raw Sequence pointer. You must
- * not use both existing_sequence AND existing - one must be nullptr.
- */
- explicit NewSequenceDialog(QWidget *parent = nullptr, Media* existing = nullptr, Sequence* iexisting_sequence = nullptr);
-
- /**
- * @brief Set the name for the new Sequence
- *
- * If creating a new Sequence, use this function before calling exec() to set what the new Sequence's
- * name will be.
- *
- * The primary use of this is to set a unique default name (i.e. one that doesn't exist
- * in the Sequence already) which is done by Project panel. This is usually "Sequence" followed by a number.
- *
- * @param s
- *
- * The name to set the new Sequence.
- */
- void set_sequence_name(const QString& s);
-
- /**
- * @brief Set whether the Sequence's name can be edited
- *
- * This defaults to TRUE.
- *
- * @param enabled
- *
- * TRUE to allow the user to edit the Sequence's name. FALSE if not.
- */
- void SetNameEditable(bool enabled);
-
-private slots:
- /**
- * @brief Override accept function to create/edit a Sequence
- */
- virtual void accept() override;
-
- /**
- * @brief Slot when the user changes the preset
- *
- * Sets all values according to the preset chosen.
- *
- * @param index
- *
- * Currently selected index of preset_combobox;
- */
- void preset_changed(int index);
-
-private:
- /**
- * @brief Internal reference to an existing Media wrapper (if one was provided to the constructor)
- */
- Media* existing_item;
-
- /**
- * @brief Internal reference to an existing Sequence (if one was provided to the constructor)
- */
- Sequence* existing_sequence;
-
- /**
- * @brief Internal function to create the dialog's UI
- */
- void setup_ui();
-
- /**
- * @brief ComboBox to set the preset
- */
- QComboBox* preset_combobox;
-
- /**
- * @brief SpinBox to set the Sequence height
- */
- QSpinBox* height_numeric;
-
- /**
- * @brief SpinBox to set the Sequence width
- */
- QSpinBox* width_numeric;
-
- /**
- * @brief ComboBox to set the pixel aspect ratio
- */
- QComboBox* par_combobox;
-
- /**
- * @brief ComboBox to set the interlacing mode
- */
- QComboBox* interlacing_combobox;
-
- /**
- * @brief ComboBox to set the frame rate
- */
- QComboBox* frame_rate_combobox;
-
- /**
- * @brief ComboBox to set the audio frequence
- */
- QComboBox* audio_frequency_combobox;
-
- /**
- * @brief Label marker for setting the Sequence's name
- *
- * Primarily a persistent class reference so it can be hidden with SetNameEditable() alongside sequence_name_edit.
- */
- QLabel* sequence_name_label;
-
- /**
- * @brief Line edit to set the Sequence's name
- */
- QLineEdit* sequence_name_edit;
-};
-
-#endif // NEWSEQUENCEDIALOG_H
diff --git a/dialogs/preferencesdialog.cpp b/dialogs/preferencesdialog.cpp
deleted file mode 100644
index ed9ac7dea..000000000
--- a/dialogs/preferencesdialog.cpp
+++ /dev/null
@@ -1,1197 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#include "preferencesdialog.h"
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "global/global.h"
-#include "global/config.h"
-#include "global/path.h"
-#include "rendering/audio.h"
-#include "rendering/pixelformats.h"
-#include "panels/panels.h"
-#include "ui/columnedgridlayout.h"
-#include "ui/mainwindow.h"
-#include "dialogs/newsequencedialog.h"
-
-KeySequenceEditor::KeySequenceEditor(QWidget* parent, QAction* a)
- : QKeySequenceEdit(parent), action(a) {
- setKeySequence(action->shortcut());
-}
-
-void KeySequenceEditor::set_action_shortcut() {
- action->setShortcut(keySequence());
-}
-
-void KeySequenceEditor::reset_to_default() {
- setKeySequence(action->property("default").toString());
-}
-
-QString KeySequenceEditor::action_name() {
- return action->property("id").toString();
-}
-
-QString KeySequenceEditor::export_shortcut() {
- QString ks = keySequence().toString();
- if (ks != action->property("default")) {
- return action->property("id").toString() + "\t" + ks;
- }
- return nullptr;
-}
-
-PreferencesDialog::PreferencesDialog(QWidget *parent) :
- QDialog(parent)
-{
- setWindowTitle(tr("Preferences"));
-
- setup_ui();
-
- setup_kbd_shortcuts(olive::MainWindow->menuBar());
-
- // set up default sequence
- default_sequence.set_name(tr("Default Sequence"));
- default_sequence.set_width(olive::config.default_sequence_width);
- default_sequence.set_height(olive::config.default_sequence_height);
- default_sequence.set_frame_rate(olive::config.default_sequence_framerate);
- default_sequence.set_audio_frequency(olive::config.default_sequence_audio_frequency);
- default_sequence.set_audio_layout(olive::config.default_sequence_audio_channel_layout);
-}
-
-void PreferencesDialog::setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem* parent) {
- QList actions = menu->actions();
- for (int i=0;iisSeparator() && a->property("keyignore").isNull()) {
- QTreeWidgetItem* item = new QTreeWidgetItem(parent);
- item->setText(0, a->text().replace("&", ""));
-
- parent->addChild(item);
-
- if (a->menu() != nullptr) {
- item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
- setup_kbd_shortcut_worker(a->menu(), item);
- } else {
- key_shortcut_items.append(item);
- key_shortcut_actions.append(a);
- }
- }
- }
-}
-
-void PreferencesDialog::delete_previews(PreviewDeleteTypes type) {
- char delete_char = 0;
-
- switch (type) {
- case DELETE_WAVEFORMS:
- delete_char = 'w';
- break;
- case DELETE_THUMBNAILS:
- delete_char = 't';
- break;
- case DELETE_BOTH:
- delete_char = 1;
- break;
- case DELETE_NONE:
- break;
- }
-
- if (delete_char != 't' && delete_char != 'w' && delete_char != 1) return;
-
- QDir preview_path(get_data_path() + "/previews");
-
- if (delete_char == 1) {
- // indiscriminately delete everything
- preview_path.removeRecursively();
- } else {
- QStringList preview_file_list = preview_path.entryList(QDir::Files | QDir::NoDotAndDotDot);
- for (int i=0;i= 0
- && preview_file_str.at(identifier_char_index) >= 48
- && preview_file_str.at(identifier_char_index) <= 57) {
- identifier_char_index--;
- }
-
- // thumbnails will have a 't' towards the end of the filenames, waveforms will have a 'w'
- // if they match the type of preview we're deleting, remove them
- if (preview_file_str.at(identifier_char_index) == delete_char) {
- QFile::remove(preview_path.filePath(preview_file_str));
- }
- }
- }
-}
-
-void PreferencesDialog::populate_ocio_menus(OCIO::ConstConfigRcPtr config)
-{
- if (!config) {
-
- // Just clear everything
- ocio_display->clear();
- ocio_default_input->clear();
- ocio_view->clear();
- ocio_look->clear();
-
- } else {
-
- // Get input color spaces for setting the default input color space
- ocio_default_input->clear();
- for (int i=0;igetNumColorSpaces();i++) {
- QString colorspace = config->getColorSpaceNameByIndex(i);
-
- ocio_default_input->addItem(colorspace);
-
- if (colorspace == olive::config.ocio_default_input_colorspace) {
- ocio_default_input->setCurrentIndex(i);
- }
- }
-
- // Get current display name (if the config is empty, get the current default display)
- QString current_display = olive::config.ocio_display;
- if (current_display.isEmpty()) {
- current_display = config->getDefaultDisplay();
- }
-
- // Populate the display menu
- ocio_display->clear();
- for (int i=0;igetNumDisplays();i++) {
- ocio_display->addItem(config->getDisplay(i));
-
- // Check if this index is the currently selected
- if (config->getDisplay(i) == current_display) {
- ocio_display->setCurrentIndex(i);
- }
- }
-
- update_ocio_view_menu(config);
-
- // Populate the look menu
- ocio_look->clear();
- ocio_look->addItem(tr("(None)"), QString());
- for (int i=0;igetNumLooks();i++) {
- const char* look = config->getLookNameByIndex(i);
-
- ocio_look->addItem(look, look);
-
- if (look == olive::config.ocio_look) {
- ocio_look->setCurrentIndex(i+1);
- }
- }
-
- }
-}
-
-OCIO::ConstConfigRcPtr PreferencesDialog::TestOCIOConfig(const QString &url)
-{
- // Check whether OCIO can load it
- OCIO::ConstConfigRcPtr config;
- try {
- config = OCIO::Config::CreateFromFile(url.toUtf8());
- } catch (OCIO::Exception& e) {
- QMessageBox::critical(this,
- tr("OpenColorIO Config Error"),
- tr("Failed to set OpenColorIO configuration: %1").arg(e.what()),
- QMessageBox::Ok);
- }
- return config;
-}
-
-void PreferencesDialog::update_ocio_view_menu(OCIO::ConstConfigRcPtr config)
-{
-
- // Get views for the current display set in `ocio_display`
- QString display = ocio_display->currentText();
-
- // Get current view
- QString current_view = olive::config.ocio_view;
- if (current_view.isEmpty()) {
- current_view = config->getDefaultView(display.toUtf8());
- }
-
- // Populate the view menu
- int ocio_view_count = config->getNumViews(display.toUtf8());
- ocio_view->clear();
- for (int i=0;igetView(display.toUtf8(), i);
-
- ocio_view->addItem(view);
-
- if (current_view == view) {
- ocio_view->setCurrentIndex(i);
- }
- }
-}
-
-void PreferencesDialog::update_ocio_config(const QString &s)
-{
- OCIO::ConstConfigRcPtr file_config;
-
- if (!s.isEmpty() && QFileInfo::exists(s)) {
- file_config = TestOCIOConfig(s);
- }
-
- populate_ocio_menus(file_config);
-}
-
-void PreferencesDialog::AddBoolPair(QCheckBox *ui, bool *value, bool restart_required)
-{
- bool_ui.append(ui);
- bool_value.append(value);
- bool_restart_required.append(restart_required);
-
- ui->setChecked(*value);
-}
-
-void PreferencesDialog::setup_kbd_shortcuts(QMenuBar* menubar) {
- QList menus = menubar->actions();
-
- for (int i=0;imenu();
-
- QTreeWidgetItem* item = new QTreeWidgetItem(keyboard_tree);
- item->setText(0, menu->title().replace("&", ""));
-
- keyboard_tree->addTopLevelItem(item);
-
- setup_kbd_shortcut_worker(menu, item);
- }
-
- for (int i=0;iproperty("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::accept() {
- bool restart_after_saving = false;
- bool reinit_audio = false;
- bool reload_language = false;
- bool reload_effects = false;
- bool reset_ocio_shaders = false;
- bool reset_render_threads = false;
-
- // Validate whether the specified CSS file exists
- 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;
- }
-
- // Validate whether the chosen OCIO configuration file
- if (enable_color_management->isChecked()) {
-
- // Check whether the file exists
- if (!QFileInfo::exists(ocio_config_file->text())) {
-
- QString msg_title = tr("Invalid OpenColorIO Configuration File");
- QString msg_body;
-
- if (ocio_config_file->text().isEmpty()) {
- msg_body = tr("You must specify an OpenColorIO configuration file if color management is enabled.");
- } else {
- msg_body = tr("OpenColorIO configuration file '%1' does not exist.").arg(ocio_config_file->text());
- }
-
- QMessageBox::critical(
- this,
- msg_title,
- msg_body
- );
- return;
-
- } else if (olive::config.ocio_config_path != ocio_config_file->text()) {
-
- // Check whether OCIO can load it
- OCIO::ConstConfigRcPtr file_config = TestOCIOConfig(ocio_config_file->text().toUtf8());
-
- if (!file_config) {
- return;
- }
-
- }
- }
-
- // Validate whether one of the bool options requires a restart
- bool bool_requires_restart = false;
- for (int i=0;iisChecked() != *bool_value.at(i)) {
- bool_requires_restart = true;
- break;
- }
- }
-
- // Check if any settings will require a restart of Olive (including the bool options determined above)
- if (bool_requires_restart
- || olive::config.thumbnail_resolution != thumbnail_res_spinbox->value()
- || olive::config.waveform_resolution != waveform_res_spinbox->value()
- || olive::config.css_path != custom_css_fn->text()
- || olive::config.style != static_cast(ui_style->currentData().toInt())) {
-
- // any changes to these settings will require a restart - ask the user if we should do one now or later
-
- int ret = QMessageBox::question(this,
- "Restart Required",
- "Some of the changed settings will require a restart of Olive. Would you like "
- "to restart now?",
- QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
-
- if (ret == QMessageBox::Cancel) {
- // Return to Preferences dialog without saving any settings
- return;
- } else if (ret == QMessageBox::Yes) {
-
- // Check if we can close the current project. If not, we'll treat it as if the user clicked "Cancel".
- if (olive::Global->can_close_project()) {
- restart_after_saving = true;
- } else {
- return;
- }
- }
- // Selecting "No" will save the settings and not restart. They will become active next time Olive opens.
-
- }
-
-
- // Everything checks out, start saving settings from the UI to the backend
- olive::config.css_path = custom_css_fn->text();
- olive::config.recording_mode = recordingComboBox->currentIndex() + 1;
- olive::config.img_seq_formats = imgSeqFormatEdit->text();
- olive::config.upcoming_queue_size = upcoming_queue_spinbox->value();
- olive::config.upcoming_queue_type = upcoming_queue_type->currentIndex();
- olive::config.previous_queue_size = previous_queue_spinbox->value();
- olive::config.previous_queue_type = previous_queue_type->currentIndex();
-
- // Audio settings may require the audio device to be re-initiated.
- if (olive::config.preferred_audio_output != audio_output_devices->currentData().toString()
- || olive::config.preferred_audio_input != audio_input_devices->currentData().toString()
- || olive::config.audio_rate != audio_sample_rate->currentData().toInt()) {
- reinit_audio = true;
- }
- olive::config.preferred_audio_output = audio_output_devices->currentData().toString();
- olive::config.preferred_audio_input = audio_input_devices->currentData().toString();
- olive::config.audio_rate = audio_sample_rate->currentData().toInt();
-
- olive::config.effect_textbox_lines = effect_textbox_lines_field->value();
-
- // see if the language file should be reloaded (not necessary if the app is restarting anyway)
- if (!restart_after_saving
- && olive::config.language_file != language_combobox->currentData().toString()) {
- reload_language = true;
- }
- olive::config.language_file = language_combobox->currentData().toString();
-
- // Check whether OCIO settings will require a reset of the render threads
- if (olive::config.playback_bit_depth != playback_bit_depth->currentIndex()
- || olive::config.export_bit_depth != export_bit_depth->currentIndex()) {
- reset_render_threads = true;
- }
- if (olive::config.ocio_config_path != ocio_config_file->text()
- || olive::config.ocio_display != ocio_display->currentText()
- || olive::config.ocio_view != ocio_view->currentText()
- || olive::config.ocio_look != ocio_look->currentData().toString()) {
- reset_ocio_shaders = true;
- }
- if (olive::config.ocio_config_path != ocio_config_file->text()) {
- OCIO::SetCurrentConfig(OCIO::Config::CreateFromFile(ocio_config_file->text().toUtf8()));
- olive::config.ocio_config_path = ocio_config_file->text();
- }
- olive::config.enable_color_management = enable_color_management->isChecked();
- olive::config.playback_bit_depth = static_cast(playback_bit_depth->currentIndex());
- olive::config.export_bit_depth = static_cast(export_bit_depth->currentIndex());
- olive::config.ocio_display = ocio_display->currentText();
- olive::config.ocio_default_input_colorspace = ocio_default_input->currentText();
- olive::config.ocio_view = ocio_view->currentText();
-
- // We use data here instead of text because there's a "(None)" option with an empty string
- olive::config.ocio_look = ocio_look->currentData().toString();
-
-
- // Set default sequence options
- olive::config.default_sequence_width = default_sequence.width();
- olive::config.default_sequence_height = default_sequence.height();
- olive::config.default_sequence_framerate = default_sequence.frame_rate();
- olive::config.default_sequence_audio_frequency = default_sequence.audio_frequency();
- olive::config.default_sequence_audio_channel_layout = default_sequence.audio_layout();
-
- // Set all bool options
- for (int i=0;iisChecked();
- }
-
- // Set new style
- olive::config.style = static_cast(ui_style->currentData().toInt());
-
- // Check if the thumbnail or waveform icon fields have changed, we may need to recreate the previews if so
- if (olive::config.thumbnail_resolution != thumbnail_res_spinbox->value()
- || olive::config.waveform_resolution != waveform_res_spinbox->value()) {
- // we're changing the size of thumbnails and waveforms, so let's delete them and regenerate them next start
-
- // delete nothing
- PreviewDeleteTypes delete_type = DELETE_NONE;
-
- if (olive::config.thumbnail_resolution != thumbnail_res_spinbox->value()) {
- // delete existing thumbnails
- olive::config.thumbnail_resolution = thumbnail_res_spinbox->value();
-
- // delete only thumbnails
- delete_type = DELETE_THUMBNAILS;
- }
-
- if (olive::config.waveform_resolution != waveform_res_spinbox->value()) {
- // delete existing waveforms
- olive::config.waveform_resolution = waveform_res_spinbox->value();
-
- // if we're already deleting thumbnails
- if (delete_type == DELETE_THUMBNAILS) {
- // delete all
- delete_type = DELETE_BOTH;
- } else {
- // just delete waveforms
- delete_type = DELETE_WAVEFORMS;
- }
- }
-
- delete_previews(delete_type);
- }
-
- // Save keyboard shortcuts
- for (int i=0;iset_action_shortcut();
- }
-
- QDialog::accept();
-
- if (restart_after_saving) {
-
- // since we already ran can_close_project(), bypass checking again by running set_modified(false)
- olive::Global->set_modified(false);
-
- olive::MainWindow->close();
-
- QProcess::startDetached(QApplication::applicationFilePath(), { olive::ActiveProjectFilename });
- } else {
-
- // Audio settings may require the audio device to be re-initiated.
- if (reinit_audio) {
- init_audio();
- }
-
- if (reload_effects) {
- panel_effect_controls->Reload();
- }
-
- // reload language file if it changed
- if (reload_language) {
- olive::Global->load_translation_from_config();
- }
-
- if (reset_render_threads) {
- if (panel_footage_viewer->seq != nullptr) {
- panel_footage_viewer->seq->Close();
- }
- panel_footage_viewer->viewer_widget()->get_renderer()->delete_ctx();
- if (panel_sequence_viewer->seq != nullptr) {
- panel_sequence_viewer->seq->Close();
- }
- panel_sequence_viewer->viewer_widget()->get_renderer()->delete_ctx();
- } else if (reset_ocio_shaders) {
- panel_footage_viewer->viewer_widget()->get_renderer()->destroy_ocio();
- panel_sequence_viewer->viewer_widget()->get_renderer()->destroy_ocio();
- }
-
- }
-}
-
-void PreferencesDialog::reset_default_shortcut() {
- QList items = keyboard_tree->selectedItems();
- for (int i=0;iselectedItems().at(i);
- static_cast(keyboard_tree->itemWidget(item, 1))->reset_to_default();
- }
-}
-
-void PreferencesDialog::reset_all_shortcuts() {
- 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;ireset_to_default();
- }
- }
-}
-
-bool PreferencesDialog::refine_shortcut_list(const QString &s, QTreeWidgetItem* parent) {
- if (parent == nullptr) {
- for (int i=0;itopLevelItemCount();i++) {
- refine_shortcut_list(s, keyboard_tree->topLevelItem(i));
- }
- } else {
- parent->setExpanded(!s.isEmpty());
-
- bool all_children_are_hidden = !s.isEmpty();
-
- for (int i=0;ichildCount();i++) {
- QTreeWidgetItem* item = parent->child(i);
- if (item->childCount() > 0) {
- all_children_are_hidden = refine_shortcut_list(s, item);
- } else {
- item->setHidden(false);
- if (s.isEmpty()) {
- all_children_are_hidden = false;
- } else {
- QString shortcut;
- if (keyboard_tree->itemWidget(item, 1) != nullptr) {
- shortcut = static_cast(keyboard_tree->itemWidget(item, 1))->keySequence().toString();
- }
- if (item->text(0).contains(s, Qt::CaseInsensitive) || shortcut.contains(s, Qt::CaseInsensitive)) {
- all_children_are_hidden = false;
- } else {
- item->setHidden(true);
- }
- }
- }
- }
-
- if (parent->text(0).contains(s, Qt::CaseInsensitive)) all_children_are_hidden = false;
-
- parent->setHidden(all_children_are_hidden);
-
- return all_children_are_hidden;
- }
- return true;
-}
-
-void PreferencesDialog::load_shortcut_file() {
- QString fn = QFileDialog::getOpenFileName(this, tr("Import Keyboard Shortcuts"));
- if (!fn.isEmpty()) {
- QFile f(fn);
- if (f.exists() && f.open(QFile::ReadOnly)) {
- QByteArray ba = f.readAll();
- f.close();
- for (int i=0;iaction_name());
- if (index == 0 || (index > 0 && ba.at(index-1) == '\n')) {
- while (index < ba.size() && ba.at(index) != '\t') index++;
- QString ks;
- index++;
- while (index < ba.size() && ba.at(index) != '\n') {
- ks.append(ba.at(index));
- index++;
- }
- key_shortcut_fields.at(i)->setKeySequence(ks);
- } else {
- key_shortcut_fields.at(i)->reset_to_default();
- }
- }
- } else {
- QMessageBox::critical(
- this,
- tr("Error saving shortcuts"),
- tr("Failed to open file for reading")
- );
- }
- }
-}
-
-void PreferencesDialog::save_shortcut_file() {
- QString fn = QFileDialog::getSaveFileName(this, tr("Export Keyboard Shortcuts"));
- if (!fn.isEmpty()) {
- QFile f(fn);
- if (f.open(QFile::WriteOnly)) {
- bool start = true;
- for (int i=0;iexport_shortcut();
- if (!s.isEmpty()) {
- if (!start) f.write("\n");
- f.write(s.toUtf8());
- start = false;
- }
- }
- f.close();
- QMessageBox::information(this, tr("Export Shortcuts"), tr("Shortcuts exported successfully"));
- } else {
- 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::browse_ocio_config()
-{
- QString fn = QFileDialog::getOpenFileName(this, tr("Browse for OpenColorIO configuration"));
- if (!fn.isEmpty()) {
- ocio_config_file->setText(fn);
- enable_color_management->setChecked(true);
- }
-}
-
-void PreferencesDialog::update_ocio_view_menu()
-{
- update_ocio_view_menu(OCIO::GetCurrentConfig());
-}
-
-void PreferencesDialog::delete_all_previews() {
- if (QMessageBox::question(this,
- tr("Delete All Previews"),
- tr("Are you sure you want to delete all previews?"),
- QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
- delete_previews(DELETE_BOTH);
- QMessageBox::information(this,
- tr("Previews Deleted"),
- tr("All previews deleted successfully. You may have to re-open your current project for "
- "changes to take effect."),
- QMessageBox::Ok);
- }
-}
-
-void PreferencesDialog::edit_default_sequence_settings()
-{
- NewSequenceDialog nsd(this, nullptr, &default_sequence);
- nsd.SetNameEditable(false);
- nsd.exec();
-}
-
-void PreferencesDialog::setup_ui() {
- QVBoxLayout* verticalLayout = new QVBoxLayout(this);
- QTabWidget* tabWidget = new QTabWidget(this);
-
- // row counter used to ease adding new rows
- int row = 0;
-
- // General
- QWidget* general_tab = new QWidget(this);
- QGridLayout* general_layout = new QGridLayout(general_tab);
-
- // General -> Language
- general_layout->addWidget(new QLabel(tr("Language:")), row, 0);
-
- language_combobox = new QComboBox();
-
- // add default language (en-US)
- language_combobox->addItem(QLocale::languageToString(QLocale("en-US").language()));
-
- // add languages from file
- QList translation_paths = get_language_paths();
-
- // iterate through all language search paths
- for (int j=0;jaddItem(QLocale(locale_str).nativeLanguageName(), locale_relative_path);
-
- if (olive::config.language_file == locale_relative_path) {
- language_combobox->setCurrentIndex(language_combobox->count() - 1);
- }
- }
- }
- }
-
- general_layout->addWidget(language_combobox, row, 1, 1, 4);
-
- row++;
-
- // General -> Image Sequence Formats
- general_layout->addWidget(new QLabel(tr("Image sequence formats:"), this), row, 0);
-
- imgSeqFormatEdit = new QLineEdit(general_tab);
- imgSeqFormatEdit->setText(olive::config.img_seq_formats);
- general_layout->addWidget(imgSeqFormatEdit, row, 1, 1, 4);
-
- row++;
-
- // General -> Thumbnail and Waveform Resolution
- general_layout->addWidget(new QLabel(tr("Thumbnail Resolution:"), this), row, 0);
-
- thumbnail_res_spinbox = new QSpinBox(this);
- thumbnail_res_spinbox->setMinimum(0);
- thumbnail_res_spinbox->setMaximum(INT_MAX);
- thumbnail_res_spinbox->setValue(olive::config.thumbnail_resolution);
- general_layout->addWidget(thumbnail_res_spinbox, row, 1);
-
- general_layout->addWidget(new QLabel(tr("Waveform Resolution:"), this), row, 2);
-
- waveform_res_spinbox = new QSpinBox(this);
- waveform_res_spinbox->setMinimum(0);
- waveform_res_spinbox->setMaximum(INT_MAX);
- waveform_res_spinbox->setValue(olive::config.waveform_resolution);
- general_layout->addWidget(waveform_res_spinbox, row, 3);
-
- QPushButton* delete_preview_btn = new QPushButton(tr("Delete Previews"));
- general_layout->addWidget(delete_preview_btn, row, 4);
- connect(delete_preview_btn, SIGNAL(clicked(bool)), this, SLOT(delete_all_previews()));
-
- row++;
-
- QHBoxLayout* misc_general = new QHBoxLayout();
-
- // General -> Use Software Fallbacks When Possible
- QCheckBox* use_software_fallbacks_checkbox = new QCheckBox(tr("Use Software Fallbacks When Possible"));
- AddBoolPair(use_software_fallbacks_checkbox, &olive::config.use_software_fallback, true);
- misc_general->addWidget(use_software_fallbacks_checkbox);
-
- // General -> Don't Use Proxies When Exporting
- QCheckBox* dont_use_proxies_when_exporting = new QCheckBox(tr("Don't Use Proxies When Exporting"));
- dont_use_proxies_when_exporting->setToolTip(tr("Use originals instead of proxies when exporting"));
- AddBoolPair(dont_use_proxies_when_exporting, &olive::config.dont_use_proxies_on_export);
- misc_general->addWidget(dont_use_proxies_when_exporting);
-
- // General -> Default Sequence Settings
- QPushButton* default_sequence_settings = new QPushButton(tr("Default Sequence Settings"));
- connect(default_sequence_settings, SIGNAL(clicked(bool)), this, SLOT(edit_default_sequence_settings()));
- misc_general->addWidget(default_sequence_settings);
-
- general_layout->addLayout(misc_general, row, 0, 1, 5);
-
- row++;
-
- tabWidget->addTab(general_tab, tr("General"));
-
- // Behavior
- QWidget* behavior_tab = new QWidget(this);
- tabWidget->addTab(behavior_tab, tr("Behavior"));
-
- ColumnedGridLayout* behavior_tab_layout = new ColumnedGridLayout(behavior_tab, 2);
-
- QCheckBox* add_default_effects_to_clips = new QCheckBox(tr("Add Default Effects to New Clips"));
- AddBoolPair(add_default_effects_to_clips, &olive::config.add_default_effects_to_clips);
- behavior_tab_layout->Add(add_default_effects_to_clips);
-
- QCheckBox* auto_seek_to_beginning = new QCheckBox(tr("Automatically Seek to the Beginning When Playing at the End of a Sequence"));
- AddBoolPair(auto_seek_to_beginning, &olive::config.auto_seek_to_beginning);
- behavior_tab_layout->Add(auto_seek_to_beginning);
-
- QCheckBox* selecting_also_seeks = new QCheckBox(tr("Selecting Also Seeks"));
- AddBoolPair(selecting_also_seeks, &olive::config.select_also_seeks);
- behavior_tab_layout->Add(selecting_also_seeks);
-
- QCheckBox* edit_tool_also_seeks = new QCheckBox(tr("Edit Tool Also Seeks"));
- AddBoolPair(edit_tool_also_seeks, &olive::config.edit_tool_also_seeks);
- behavior_tab_layout->Add(edit_tool_also_seeks);
-
- QCheckBox* edit_tool_selects_links = new QCheckBox(tr("Edit Tool Selects Links"));
- AddBoolPair(edit_tool_selects_links, &olive::config.edit_tool_selects_links);
- behavior_tab_layout->Add(edit_tool_selects_links);
-
- QCheckBox* seek_also_selects = new QCheckBox(tr("Seek Also Selects"));
- AddBoolPair(seek_also_selects, &olive::config.seek_also_selects);
- behavior_tab_layout->Add(seek_also_selects);
-
- QCheckBox* seek_to_end_of_pastes = new QCheckBox(tr("Seek to the End of Pastes"));
- AddBoolPair(seek_to_end_of_pastes, &olive::config.paste_seeks);
- behavior_tab_layout->Add(seek_to_end_of_pastes);
-
- QCheckBox* scroll_wheel_zooms = new QCheckBox(tr("Scroll Wheel Zooms"));
- scroll_wheel_zooms->setToolTip(tr("Hold CTRL to toggle this setting"));
- AddBoolPair(scroll_wheel_zooms, &olive::config.scroll_zooms);
- behavior_tab_layout->Add(scroll_wheel_zooms);
-
- QCheckBox* invert_timeline_scroll_axes = new QCheckBox(tr("Invert Timeline Scroll Axes"));
- AddBoolPair(invert_timeline_scroll_axes, &olive::config.invert_timeline_scroll_axes);
- behavior_tab_layout->Add(invert_timeline_scroll_axes);
-
- QCheckBox* enable_drag_files_to_timeline = new QCheckBox(tr("Enable Drag Files to Timeline"));
- AddBoolPair(enable_drag_files_to_timeline, &olive::config.enable_drag_files_to_timeline);
- behavior_tab_layout->Add(enable_drag_files_to_timeline);
-
- QCheckBox* autoscale_by_default = new QCheckBox(tr("Auto-Scale By Default"));
- AddBoolPair(autoscale_by_default, &olive::config.autoscale_by_default);
- behavior_tab_layout->Add(autoscale_by_default);
-
- QCheckBox* enable_seek_to_import = new QCheckBox(tr("Auto-Seek to Imported Clips"));
- AddBoolPair(enable_seek_to_import, &olive::config.enable_seek_to_import);
- behavior_tab_layout->Add(enable_seek_to_import);
-
- QCheckBox* enable_audio_scrubbing = new QCheckBox(tr("Audio Scrubbing"));
- AddBoolPair(enable_audio_scrubbing, &olive::config.enable_audio_scrubbing);
- behavior_tab_layout->Add(enable_audio_scrubbing);
-
- QCheckBox* enable_drop_on_media_to_replace = new QCheckBox(tr("Drop Files on Media to Replace"));
- AddBoolPair(enable_drop_on_media_to_replace, &olive::config.drop_on_media_to_replace);
- behavior_tab_layout->Add(enable_drop_on_media_to_replace);
-
- QCheckBox* enable_hover_focus = new QCheckBox(tr("Enable Hover Focus"));
- AddBoolPair(enable_hover_focus, &olive::config.hover_focus);
- behavior_tab_layout->Add(enable_hover_focus);
-
- QCheckBox* set_name_and_marker = new QCheckBox(tr("Ask For Name When Setting Marker"));
- AddBoolPair(set_name_and_marker, &olive::config.set_name_with_marker);
- behavior_tab_layout->Add(set_name_and_marker);
-
- // Appearance
- QWidget* appearance_tab = new QWidget(this);
- tabWidget->addTab(appearance_tab, tr("Appearance"));
-
- row = 0;
-
- QGridLayout* appearance_layout = new QGridLayout(appearance_tab);
-
- // Appearance -> Theme
- appearance_layout->addWidget(new QLabel(tr("Theme")), row, 0);
-
- ui_style = new QComboBox();
- ui_style->addItem(tr("Olive Dark (Default)"), olive::styling::kOliveDefaultDark);
- ui_style->addItem(tr("Olive Light"), olive::styling::kOliveDefaultLight);
- ui_style->addItem(tr("Native"), olive::styling::kNativeDarkIcons);
- ui_style->addItem(tr("Native (Light Icons)"), olive::styling::kNativeLightIcons);
- ui_style->setCurrentIndex(olive::config.style);
- appearance_layout->addWidget(ui_style, row, 1, 1, 2);
-
- row++;
-
-#ifdef Q_OS_WIN
- // Native menu styling is only available on Windows. Environments like Ubuntu and Mac use the native menu system by
- // default
- QCheckBox* native_menus = new QCheckBox(tr("Use Native Menu Styling"));
- AddBoolPair(native_menus, &olive::config.use_native_menu_styling, true);
- appearance_layout->addWidget(native_menus, row, 0, 1, 3);
-
- row++;
-#endif
-
- // Appearance -> Custom CSS
- appearance_layout->addWidget(new QLabel(tr("Custom CSS:"), this), row, 0);
-
- custom_css_fn = new QLineEdit(general_tab);
- custom_css_fn->setText(olive::config.css_path);
- appearance_layout->addWidget(custom_css_fn, row, 1);
-
- QPushButton* custom_css_browse = new QPushButton(tr("Browse"), general_tab);
- connect(custom_css_browse, SIGNAL(clicked(bool)), this, SLOT(browse_css_file()));
- appearance_layout->addWidget(custom_css_browse, row, 2);
-
- row++;
-
- // Appearance -> Effect Textbox Lines
- appearance_layout->addWidget(new QLabel(tr("Effect Textbox Lines:"), this), row, 0);
-
- effect_textbox_lines_field = new QSpinBox(general_tab);
- effect_textbox_lines_field->setMinimum(1);
- effect_textbox_lines_field->setValue(olive::config.effect_textbox_lines);
- appearance_layout->addWidget(effect_textbox_lines_field, row, 1, 1, 2);
-
- row++;
-
- // Playback
- QWidget* playback_tab = new QWidget(this);
- QVBoxLayout* playback_tab_layout = new QVBoxLayout(playback_tab);
-
- // Playback -> Memory Usage
- QGroupBox* memory_usage_group = new QGroupBox(playback_tab);
- memory_usage_group->setTitle(tr("Memory Usage"));
- QGridLayout* memory_usage_layout = new QGridLayout(memory_usage_group);
- memory_usage_layout->addWidget(new QLabel(tr("Upcoming Frame Queue:"), playback_tab), 0, 0);
- upcoming_queue_spinbox = new QDoubleSpinBox(playback_tab);
- upcoming_queue_spinbox->setValue(olive::config.upcoming_queue_size);
- memory_usage_layout->addWidget(upcoming_queue_spinbox, 0, 1);
- upcoming_queue_type = new QComboBox(playback_tab);
- upcoming_queue_type->addItem(tr("frames"));
- upcoming_queue_type->addItem(tr("seconds"));
- upcoming_queue_type->setCurrentIndex(olive::config.upcoming_queue_type);
- memory_usage_layout->addWidget(upcoming_queue_type, 0, 2);
- memory_usage_layout->addWidget(new QLabel(tr("Previous Frame Queue:"), playback_tab), 1, 0);
- previous_queue_spinbox = new QDoubleSpinBox(playback_tab);
- previous_queue_spinbox->setValue(olive::config.previous_queue_size);
- memory_usage_layout->addWidget(previous_queue_spinbox, 1, 1);
- previous_queue_type = new QComboBox(playback_tab);
- previous_queue_type->addItem(tr("frames"));
- previous_queue_type->addItem(tr("seconds"));
- previous_queue_type->setCurrentIndex(olive::config.previous_queue_type);
- memory_usage_layout->addWidget(previous_queue_type, 1, 2);
- playback_tab_layout->addWidget(memory_usage_group);
-
- tabWidget->addTab(playback_tab, tr("Playback"));
-
- // Audio
- QWidget* audio_tab = new QWidget(this);
-
- QGridLayout* audio_tab_layout = new QGridLayout(audio_tab);
-
- row = 0;
-
- // Audio -> Output Device
-
- audio_tab_layout->addWidget(new QLabel(tr("Output Device:")), row, 0);
-
- audio_output_devices = new QComboBox();
- audio_output_devices->addItem(tr("Default"), "");
-
- // list all available audio output devices
- QList devs = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
- bool found_preferred_device = false;
- for (int i=0;iaddItem(devs.at(i).deviceName(), devs.at(i).deviceName());
- if (!found_preferred_device
- && devs.at(i).deviceName() == olive::config.preferred_audio_output) {
- audio_output_devices->setCurrentIndex(audio_output_devices->count()-1);
- found_preferred_device = true;
- }
- }
-
- audio_tab_layout->addWidget(audio_output_devices, row, 1);
-
- row++;
-
- // Audio -> Input Device
-
- audio_tab_layout->addWidget(new QLabel(tr("Input Device:")), row, 0);
-
- audio_input_devices = new QComboBox();
- audio_input_devices->addItem(tr("Default"), "");
-
- // list all available audio input devices
- devs = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
- found_preferred_device = false;
- for (int i=0;iaddItem(devs.at(i).deviceName(), devs.at(i).deviceName());
- if (!found_preferred_device
- && devs.at(i).deviceName() == olive::config.preferred_audio_input) {
- audio_input_devices->setCurrentIndex(audio_input_devices->count()-1);
- found_preferred_device = true;
- }
- }
-
- audio_tab_layout->addWidget(audio_input_devices, row, 1);
-
- row++;
-
- // Audio -> Sample Rate
-
- audio_tab_layout->addWidget(new QLabel(tr("Sample Rate:")), row, 0);
-
- audio_sample_rate = new QComboBox();
- combobox_audio_sample_rates(audio_sample_rate);
- for (int i=0;icount();i++) {
- if (audio_sample_rate->itemData(i).toInt() == olive::config.audio_rate) {
- audio_sample_rate->setCurrentIndex(i);
- break;
- }
- }
-
- audio_tab_layout->addWidget(audio_sample_rate, row, 1);
-
- row++;
-
- // Audio -> Audio Recording
- audio_tab_layout->addWidget(new QLabel(tr("Audio Recording:"), this), row, 0);
-
- recordingComboBox = new QComboBox(general_tab);
- recordingComboBox->addItem(tr("Mono"));
- recordingComboBox->addItem(tr("Stereo"));
- recordingComboBox->setCurrentIndex(olive::config.recording_mode - 1);
- audio_tab_layout->addWidget(recordingComboBox, row, 1);
-
- row++;
-
- tabWidget->addTab(audio_tab, tr("Audio"));
-
- //
- // COLOR MANAGEMENT
- //
-
- QWidget* color_management_tab = new QWidget();
-
- QGridLayout* color_management_layout = new QGridLayout(color_management_tab);
-
- row = 0;
-
- // COLOR MANAGEMENT -> Enable Color Management
- enable_color_management = new QCheckBox(tr("Enable Color Management"));
- enable_color_management->setChecked(olive::config.enable_color_management);
- color_management_layout->addWidget(enable_color_management, row, 0);
-
- row++;
-
- QGroupBox* opencolorio_groupbox = new QGroupBox();
- QGridLayout* opencolorio_groupbox_layout = new QGridLayout(opencolorio_groupbox);
-
- // COLOR MANAGEMENT -> OpenColorIO Config File
- opencolorio_groupbox_layout->addWidget(new QLabel(tr("OpenColorIO Config File:")), 0, 0);
-
- ocio_config_file = new QLineEdit();
- ocio_config_file->setText(olive::config.ocio_config_path);
- connect(ocio_config_file, SIGNAL(textChanged(const QString &)), this, SLOT(update_ocio_config(const QString&)));
- opencolorio_groupbox_layout->addWidget(ocio_config_file, 0, 1, 1, 4);
-
- QPushButton* ocio_config_browse_btn = new QPushButton(tr("Browse"));
- connect(ocio_config_browse_btn, SIGNAL(clicked(bool)), this, SLOT(browse_ocio_config()));
- opencolorio_groupbox_layout->addWidget(ocio_config_browse_btn, 0, 5);
-
- // COLOR MANAGEMENT -> Default Input Color Space
- ocio_default_input = new QComboBox();
- opencolorio_groupbox_layout->addWidget(new QLabel(tr("Default Input Color Space:")), 1, 0);
- opencolorio_groupbox_layout->addWidget(ocio_default_input, 1, 1, 1, 5);
-
- // COLOR MANAGEMENT -> Display
- ocio_display = new QComboBox();
- connect(ocio_display, SIGNAL(currentIndexChanged(int)), this, SLOT(update_ocio_view_menu()));
- opencolorio_groupbox_layout->addWidget(new QLabel(tr("Display:")), 2, 0);
- opencolorio_groupbox_layout->addWidget(ocio_display, 2, 1);
-
- // COLOR MANAGEMENT -> View
- ocio_view = new QComboBox();
- opencolorio_groupbox_layout->addWidget(new QLabel(tr("View:")), 2, 2);
- opencolorio_groupbox_layout->addWidget(ocio_view, 2, 3);
-
- // COLOR MANAGEMENT -> Look
- ocio_look = new QComboBox();
- opencolorio_groupbox_layout->addWidget(new QLabel(tr("Look:")), 2, 4);
- opencolorio_groupbox_layout->addWidget(ocio_look, 2, 5);
-
- color_management_layout->addWidget(opencolorio_groupbox, row, 0);
-
- row++;
-
- // COLOR MANAGEMENT -> Bit Depth
- QGroupBox* bit_depth_groupbox = new QGroupBox(tr("Bit Depth"));
- QGridLayout* bit_depth_groupbox_layout = new QGridLayout(bit_depth_groupbox);
-
- // COLOR MANAGEMENT -> Bit Depth -> Playback
- playback_bit_depth = new QComboBox();
- for (int i=0;iaddItem(olive::pixel_formats.at(i).name, i);
- }
- playback_bit_depth->setCurrentIndex(olive::config.playback_bit_depth);
- bit_depth_groupbox_layout->addWidget(new QLabel(tr("Playback (Offline):")), 0, 0);
- bit_depth_groupbox_layout->addWidget(playback_bit_depth, 0, 1);
-
- // COLOR MANAGEMENT -> Bit Depth -> Export
- export_bit_depth = new QComboBox();
- for (int i=0;iaddItem(olive::pixel_formats.at(i).name, i);
- }
- export_bit_depth->setCurrentIndex(olive::config.export_bit_depth);
- bit_depth_groupbox_layout->addWidget(new QLabel(tr("Export (Online):")), 0, 2);
- bit_depth_groupbox_layout->addWidget(export_bit_depth, 0, 3);
-
- color_management_layout->addWidget(bit_depth_groupbox, row, 0);
-
-
-
- //row++;
-
- populate_ocio_menus(OCIO::GetCurrentConfig());
-
- tabWidget->addTab(color_management_tab, tr("Color Management"));
-
- // Shortcuts
- QWidget* shortcut_tab = new QWidget(this);
-
- QVBoxLayout* shortcut_layout = new QVBoxLayout(shortcut_tab);
-
- QLineEdit* key_search_line = new QLineEdit(shortcut_tab);
- 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(shortcut_tab);
- QTreeWidgetItem* tree_header = keyboard_tree->headerItem();
- tree_header->setText(0, tr("Action"));
- tree_header->setText(1, tr("Shortcut"));
- shortcut_layout->addWidget(keyboard_tree);
-
- QHBoxLayout* reset_shortcut_layout = new QHBoxLayout(shortcut_tab);
-
- QPushButton* import_shortcut_button = new QPushButton(tr("Import"), shortcut_tab);
- 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(tr("Export"), shortcut_tab);
- 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(tr("Reset Selected"), shortcut_tab);
- 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(tr("Reset All"), shortcut_tab);
- 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, tr("Keyboard"));
-
- verticalLayout->addWidget(tabWidget);
-
- QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
- buttonBox->setOrientation(Qt::Horizontal);
- buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
-
- verticalLayout->addWidget(buttonBox);
-
- connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
-}
diff --git a/dialogs/preferencesdialog.h b/dialogs/preferencesdialog.h
deleted file mode 100644
index 721a2b505..000000000
--- a/dialogs/preferencesdialog.h
+++ /dev/null
@@ -1,432 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#ifndef PREFERENCESDIALOG_H
-#define PREFERENCESDIALOG_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-namespace OCIO = OCIO_NAMESPACE::v1;
-
-#include "timeline/sequence.h"
-
-class KeySequenceEditor;
-
-/**
- * @brief The PreferencesDialog class
- *
- * A dialog for the global application settings. Mostly an interface for Config. Can be loaded from any part of the
- * application.
- */
-class PreferencesDialog : public QDialog
-{
- Q_OBJECT
-
-public:
- /**
- * @brief PreferencesDialog Constructor
- *
- * @param parent
- *
- * QWidget parent. Usually MainWindow.
- */
- explicit PreferencesDialog(QWidget *parent = nullptr);
-
-private slots:
- /**
- * @brief Override of accept to save preferences to Config.
- */
- virtual void accept() override;
-
- /**
- * @brief Reset all selected shortcuts in keyboard_tree to their defaults
- */
- void reset_default_shortcut();
-
- /**
- * @brief Reset all shortcuts indiscriminately to their defaults
- *
- * This is safe to call directly as it'll ask the user if they wish to do so before it resets.
- */
- void reset_all_shortcuts();
-
- /**
- * @brief Shows/hides shortcut entries according to a shortcut query.
- *
- * This function can be directly connected to QLineEdit::textChanged() for simplicity.
- *
- * @param s
- *
- * The search query to compare shortcut names to.
- *
- * @param parent
- *
- * This is used as the function calls itself recursively to traverse the menu item hierarchy. This should be left as
- * nullptr when called externally.
- *
- * @return
- *
- * Value used as function calls itself recursively to determine if a menu parent has any children that are not hidden.
- * If so, TRUE is returned so the parent is shown too (even if it doesn't match the search query). If not, FALSE is
- * returned so the parent is hidden.
- */
- bool refine_shortcut_list(const QString &s, QTreeWidgetItem* parent = nullptr);
-
- /**
- * @brief Show a file dialog to load an external shortcut preset from file
- */
- void load_shortcut_file();
-
- /**
- * @brief Show a file dialog to save an external shortcut preset from file
- */
- void save_shortcut_file();
-
- /**
- * @brief Delete all previews (waveform and thumbnail cache)
- */
- void delete_all_previews();
-
- // Browse for file functionns
- /**
- * @brief Show a file dialog to browse for an external CSS file to load for styling the application.
- */
- void browse_css_file();
- void browse_ocio_config();
-
- // OCIO function
- void update_ocio_view_menu();
- void update_ocio_view_menu(OCIO::ConstConfigRcPtr config);
- void update_ocio_config(const QString&);
-
- /**
- * @brief Shows a NewSequenceDialog attached to default_sequence
- */
- void edit_default_sequence_settings();
-
-private:
-
- /**
- * @brief Create and arrange all UI widgets
- */
- void setup_ui();
-
- /**
- * @brief Populate keyboard shortcut panel with keyboard shortcuts from the menu bar
- *
- * @param menu
- *
- * A reference to the main application's menu bar. Usually MainWindow::menuBar().
- */
- void setup_kbd_shortcuts(QMenuBar* menu);
-
- /**
- * @brief Internal function called by setup_kbd_shortcuts() to traverse down the menu bar's hierarchy and populate the
- * shortcut panel.
- *
- * This function will call itself recursively as it finds submenus belong to the menu provided. It will also create
- * QTreeWidgetItems as children of the parent item provided, either using them as parents themselves for submenus
- * or attaching a KeySequenceEditor to them for shortcut editing.
- *
- * @param menu
- *
- * The current menu to traverse down.
- *
- * @param parent
- *
- * The parent item to add QTreeWidgetItems to.
- */
- void setup_kbd_shortcut_worker(QMenu* menu, QTreeWidgetItem* parent);
-
- enum PreviewDeleteTypes {
- DELETE_NONE,
- DELETE_THUMBNAILS,
- DELETE_WAVEFORMS,
- DELETE_BOTH
- };
-
- // used to delete previews
- // type can be: 't' for thumbnails, 'w' for waveforms, or 1 for all
- /**
- * @brief Delete disk cached preview files (thumbnails, waveforms, etc.)
- *
- * @param type
- *
- * The types of previews to delete.
- */
- void delete_previews(PreviewDeleteTypes type);
-
- void populate_ocio_menus(OCIO::ConstConfigRcPtr config);
-
- /**
- * @brief UI widget for editing the CSS filename
- */
- QLineEdit* custom_css_fn;
-
- /**
- * @brief UI widget for editing the list of extensions to detect image sequences from
- */
- QLineEdit* imgSeqFormatEdit;
-
- /**
- * @brief UI widget for editing the recording channels
- */
- QComboBox* recordingComboBox;
-
-
- /**
- * @brief UI widget for editing keyboard shortcuts
- */
- QTreeWidget* keyboard_tree;
-
- /**
- * @brief UI widget for editing the upcoming queue size
- */
- QDoubleSpinBox* upcoming_queue_spinbox;
-
- /**
- * @brief UI widget for editing the upcoming queue type
- */
- QComboBox* upcoming_queue_type;
-
- /**
- * @brief UI widget for editing the previous queue size
- */
- QDoubleSpinBox* previous_queue_spinbox;
-
- /**
- * @brief UI widget for editing the previous queue type
- */
- QComboBox* previous_queue_type;
-
- /**
- * @brief UI widget for editing the size of textboxes in the EffectControls panel
- */
- QSpinBox* effect_textbox_lines_field;
-
- /**
- * @brief UI widget for selecting the output audio device
- */
- QComboBox* audio_output_devices;
-
- /**
- * @brief UI widget for selecting the input audio device
- */
- QComboBox* audio_input_devices;
-
- /**
- * @brief UI widget for selecting the audio sampling rates
- */
- QComboBox* audio_sample_rate;
-
- /**
- * @brief UI widget for selecting the UI language
- */
- QComboBox* language_combobox;
-
- /**
- * @brief UI widget for selecting the resolution of the thumbnails to generate
- */
- QSpinBox* thumbnail_res_spinbox;
-
- /**
- * @brief UI widget for selecting the resolution of the waveforms to generate
- */
- QSpinBox* waveform_res_spinbox;
-
- QCheckBox* enable_color_management;
- QLineEdit* ocio_config_file;
- QComboBox* ocio_default_input;
- QComboBox* ocio_display;
- QComboBox* ocio_view;
- QComboBox* ocio_look;
- QComboBox* playback_bit_depth;
- QComboBox* export_bit_depth;
-
- /**
- * @brief UI widget for selecting the current UI style
- */
- QComboBox* ui_style;
-
- /**
- * @brief Stored default Sequence object
- *
- * Default Sequence settings are loaded into an actual Sequence object that can be loaded into NewSequenceDialog
- * for the sake of familiarity with the user.
- */
- Sequence default_sequence;
-
- /**
- * @brief List of keyboard shortcut actions that can be triggered (links with key_shortcut_items and
- * key_shortcut_fields)
- */
- QVector key_shortcut_actions;
-
- /**
- * @brief List of keyboard shortcut items in keyboard_tree corresponding to existing actions (links with
- * key_shortcut_actions and key_shortcut_fields)
- */
- QVector key_shortcut_items;
-
- /**
- * @brief List of keyboard shortcut editing fields in keyboard_tree corresponding to existing actions (links with
- * key_shortcut_actions and key_shortcut_fields)
- */
- QVector key_shortcut_fields;
-
- /**
- * @brief Tests an OpenColorIO configuration file to determine whether it's valid and throws a messagebox if not
- *
- * @param url
- *
- * URL to the OpenColorIO configuration file.
- *
- * @return
- *
- * A OCIO::ConstConfigRcPtr config pointer if the configuration file is valid, nullptr if not.
- */
- OCIO::ConstConfigRcPtr TestOCIOConfig(const QString& url);
-
- /**
- * @brief Add an automated QCheckBox+boolean value pair
- *
- * Many preferences are simple true/false (or on/off) options. Rather than adding a QCheckBox for each one and
- * manually setting its checked value to the configuration setting (and vice versa when saving), this convenience
- * function will add it to an automated set of checkboxes, automatically setting the checked state to the current
- * setting, and then saving the new checked state back to the setting when the user accepts the changes (clicks OK).
- *
- * @param ui
- *
- * A valid QCheckBox item. This function does not take ownership of the QWidget or place it in a layout anywhere.
- *
- * @param value
- *
- * A pointer to the Boolean value this QCheckBox should be shared with. The QCheckBox widget's checked state will be
- * set to the value of this pointer.
- *
- * @param restart_required
- *
- * Defaults to FALSE, set this to TRUE if changing this setting should prompt the user for a restart of Olive before
- * the setting change takes effect.
- */
- void AddBoolPair(QCheckBox* ui, bool* value, bool restart_required = false);
-
- /**
- * @brief Internal array managed by AddBoolPair(). Do not access this directly.
- */
- QVector bool_ui;
-
- /**
- * @brief Internal array managed by AddBoolPair(). Do not access this directly.
- */
- QVector bool_value;
-
- /**
- * @brief Internal array managed by AddBoolPair(). Do not access this directly.
- */
- QVector bool_restart_required;
-};
-
-/**
- * @brief The KeySequenceEditor class
- *
- * Simple derived class of QKeySequenceEdit that attaches to a QAction and provides functions for transferring
- * keyboard shortcuts to and from it.
- */
-class KeySequenceEditor : public QKeySequenceEdit {
- Q_OBJECT
-public:
- /**
- * @brief KeySequenceEditor Constructor
- *
- * @param parent
- *
- * QWidget parent.
- *
- * @param a
- *
- * The QAction to link to. This cannot be changed throughout the lifetime of a KeySequenceEditor.
- */
- KeySequenceEditor(QWidget *parent, QAction* a);
-
- /**
- * @brief Sets the attached QAction's shortcut to the shortcut entered in this field.
- *
- * This is not done automatically in case the user cancels out of the Preferences dialog, in which case the
- * expectation is that the changes made will not be saved. Therefore, this needs to be triggered manually when
- * PreferencesDialog saves.
- */
- void set_action_shortcut();
-
- /**
- * @brief Set this shortcut back to the QAction's default shortcut
- *
- * Each QAction contains the default shortcut in its `property("default")` and can be used to restore the default
- * "hard-coded" shortcut with this function.
- *
- * This function does not save the default shortcut back into the QAction, it simply loads the default shortcut from
- * the QAction into this edit field. To save it into the QAction, it's necessary to call set_action_shortcut() after
- * calling this function.
- */
- void reset_to_default();
-
- /**
- * @brief Return attached QAction's unique ID
- *
- * Each of Olive's menu actions has a unique string ID (that, unlike the text, is not translated) for matching with
- * an external shortcut configuration file. The ID is stored in the QAction's `property("id")`. This function returns
- * that ID.
- *
- * @return
- *
- * The QAction's unique ID.
- */
- QString action_name();
-
- /**
- * @brief Serialize this shortcut entry into a string that can be saved to a file
- *
- * @return
- *
- * A string serialization of this shortcut. The format is "[ID]\t[SEQUENCE]" where [ID] is the attached QAction's
- * unique identifier and [SEQUENCE] is the current keyboard shortcut in the field (NOT necessarily the shortcut in
- * the QAction). If the entered shortcut is the same as the QAction's default shortcut, the return value is empty
- * because a default shortcut does not need to be saved to a file.
- */
- QString export_shortcut();
-private:
- /**
- * @brief Internal reference to the linked QAction
- */
- QAction* action;
-};
-
-#endif // PREFERENCESDIALOG_H
diff --git a/dialogs/proxydialog.cpp b/dialogs/proxydialog.cpp
deleted file mode 100644
index 21534ca9f..000000000
--- a/dialogs/proxydialog.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/***
-
- Olive - Non-Linear Video Editor
- Copyright (C) 2019 Olive Team
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-***/
-
-#include "proxydialog.h"
-
-#include
-#include
-#include
-#include
-#include