diff --git a/dialogs/aboutdialog.h b/dialogs/aboutdialog.h index 9c548b9ab..2faee3f58 100644 --- a/dialogs/aboutdialog.h +++ b/dialogs/aboutdialog.h @@ -28,7 +28,7 @@ class AboutDialog : public QDialog Q_OBJECT public: - explicit AboutDialog(QWidget *parent = 0); + explicit AboutDialog(QWidget *parent = 0); }; #endif // ABOUTDIALOG_H diff --git a/dialogs/actionsearch.h b/dialogs/actionsearch.h index a3898b063..5d9632899 100644 --- a/dialogs/actionsearch.h +++ b/dialogs/actionsearch.h @@ -24,9 +24,7 @@ #include #include #include - -class QListWidget; -class QMenu; +#include class ActionSearchList : public QListWidget { Q_OBJECT diff --git a/dialogs/advancedvideodialog.h b/dialogs/advancedvideodialog.h index 95c14b310..5f986692d 100644 --- a/dialogs/advancedvideodialog.h +++ b/dialogs/advancedvideodialog.h @@ -22,11 +22,10 @@ #define ADVANCEDVIDEODIALOG_H #include +#include #include "io/exportthread.h" -class QComboBox; - class AdvancedVideoDialog : public QDialog { Q_OBJECT public: diff --git a/dialogs/debugdialog.h b/dialogs/debugdialog.h index d3b5bbeec..b58c53833 100644 --- a/dialogs/debugdialog.h +++ b/dialogs/debugdialog.h @@ -22,7 +22,7 @@ #define DEBUGDIALOG_H #include -class QTextEdit; +#include class DebugDialog : public QDialog { Q_OBJECT diff --git a/dialogs/exportdialog.cpp b/dialogs/exportdialog.cpp index f13cedc78..7328e4b23 100644 --- a/dialogs/exportdialog.cpp +++ b/dialogs/exportdialog.cpp @@ -28,18 +28,12 @@ #include #include #include -#include -#include -#include -#include #include -#include #include "oliveglobal.h" #include "dialogs/advancedvideodialog.h" #include "panels/panels.h" #include "ui/viewerwidget.h" -#include "project/sequence.h" #include "io/exportthread.h" #include "playback/playback.h" #include "mainwindow.h" @@ -343,6 +337,7 @@ void ExportDialog::render_thread_finished() { panel_sequence_viewer->viewer_widget->makeCurrent(); panel_sequence_viewer->viewer_widget->initializeGL(); update_ui(false); + et->deleteLater(); if (progressBar->value() == 100) accept(); } @@ -537,7 +532,6 @@ void ExportDialog::export_action() { et = new ExportThread(params, vcodec_params, this); - connect(et, SIGNAL(finished()), et, SLOT(deleteLater())); connect(et, SIGNAL(finished()), this, SLOT(render_thread_finished())); connect(et, SIGNAL(progress_changed(int, qint64)), this, SLOT(update_progress_bar(int, qint64))); @@ -549,7 +543,6 @@ void ExportDialog::export_action() { prep_ui_for_render(true); - et->ed = this; cancelled = false; et->start(); diff --git a/dialogs/exportdialog.h b/dialogs/exportdialog.h index d06c7d3eb..8fd4f0ce3 100644 --- a/dialogs/exportdialog.h +++ b/dialogs/exportdialog.h @@ -22,15 +22,14 @@ #define EXPORTDIALOG_H #include +#include +#include +#include +#include +#include +#include -struct Sequence; -class ExportThread; -class QComboBox; -class QSpinBox; -class QDoubleSpinBox; -class QLabel; -class QProgressBar; -class QGroupBox; +#include "project/sequence.h" #include "io/exportthread.h" diff --git a/dialogs/loaddialog.cpp b/dialogs/loaddialog.cpp index 78c4db704..35902a2a0 100644 --- a/dialogs/loaddialog.cpp +++ b/dialogs/loaddialog.cpp @@ -20,17 +20,14 @@ #include "loaddialog.h" -#include #include #include -#include #include #include "oliveglobal.h" #include "panels/panels.h" -#include "io/loadthread.h" #include "playback/playback.h" #include "ui/sourcetable.h" #include "mainwindow.h" @@ -59,7 +56,7 @@ LoadDialog::LoadDialog(QWidget *parent, bool autorecovery) : QDialog(parent) { update(); - lt = new LoadThread(this, autorecovery); + lt = new LoadThread(autorecovery); QObject::connect(lt, SIGNAL(success()), this, SLOT(thread_done())); QObject::connect(lt, SIGNAL(error()), this, SLOT(die())); QObject::connect(lt, SIGNAL(report_progress(int)), bar, SLOT(setValue(int))); diff --git a/dialogs/loaddialog.h b/dialogs/loaddialog.h index 84b112bf9..e75bc289d 100644 --- a/dialogs/loaddialog.h +++ b/dialogs/loaddialog.h @@ -22,13 +22,11 @@ #define LOADDIALOG_H #include +#include +#include -class QProgressBar; -struct Sequence; -class Media; -struct Footage; -class QHBoxLayout; -class LoadThread; +#include "project/projectelements.h" +#include "io/loadthread.h" class LoadDialog : public QDialog { diff --git a/dialogs/mediapropertiesdialog.h b/dialogs/mediapropertiesdialog.h index 9c1ff9d30..a2e63da8b 100644 --- a/dialogs/mediapropertiesdialog.h +++ b/dialogs/mediapropertiesdialog.h @@ -22,14 +22,14 @@ #define MEDIAPROPERTIESDIALOG_H #include +#include +#include +#include +#include +#include -struct Footage; -class QComboBox; -class QLineEdit; -class Media; -class QListWidget; -class QDoubleSpinBox; -class QCheckBox; +#include "project/footage.h" +#include "project/media.h" class MediaPropertiesDialog : public QDialog { Q_OBJECT diff --git a/dialogs/newsequencedialog.h b/dialogs/newsequencedialog.h index bf16f980f..f9d5164c6 100644 --- a/dialogs/newsequencedialog.h +++ b/dialogs/newsequencedialog.h @@ -22,13 +22,13 @@ #define NEWSEQUENCEDIALOG_H #include +#include +#include +#include -class Project; -class Media; -class QComboBox; -class QSpinBox; -class QLineEdit; -struct Sequence; +#include "panels/project.h" +#include "project/media.h" +#include "project/sequence.h" class NewSequenceDialog : public QDialog { diff --git a/dialogs/preferencesdialog.cpp b/dialogs/preferencesdialog.cpp index 9a02a5a7a..cf292e2b7 100644 --- a/dialogs/preferencesdialog.cpp +++ b/dialogs/preferencesdialog.cpp @@ -83,10 +83,10 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) : setWindowTitle(tr("Preferences")); setup_ui(); - accurateSeekButton->setChecked(!config.fast_seeking); - fastSeekButton->setChecked(config.fast_seeking); - recordingComboBox->setCurrentIndex(config.recording_mode - 1); - imgSeqFormatEdit->setText(config.img_seq_formats); + accurateSeekButton->setChecked(!Olive::CurrentConfig.fast_seeking); + fastSeekButton->setChecked(Olive::CurrentConfig.fast_seeking); + recordingComboBox->setCurrentIndex(Olive::CurrentConfig.recording_mode - 1); + imgSeqFormatEdit->setText(Olive::CurrentConfig.img_seq_formats); } PreferencesDialog::~PreferencesDialog() {} @@ -184,11 +184,11 @@ void PreferencesDialog::save() { } // Check if any settings will require a restart of Olive - if (config.effect_textbox_lines != effect_textbox_lines_field->value() - || config.use_software_fallback != use_software_fallbacks_checkbox->isChecked() - || config.language_file != language_combobox->currentData().toString() - || config.thumbnail_resolution != thumbnail_res_spinbox->value() - || config.waveform_resolution != waveform_res_spinbox->value()) { + if (Olive::CurrentConfig.effect_textbox_lines != effect_textbox_lines_field->value() + || Olive::CurrentConfig.use_software_fallback != use_software_fallbacks_checkbox->isChecked() + || Olive::CurrentConfig.language_file != language_combobox->currentData().toString() + || Olive::CurrentConfig.thumbnail_resolution != thumbnail_res_spinbox->value() + || Olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value()) { // any changes to these settings will require a restart - ask the user if we should do one now or later @@ -215,51 +215,51 @@ void PreferencesDialog::save() { } // Audio settings may require the audio device to be re-initiated. - if (config.preferred_audio_output != audio_output_devices->currentData().toString() - || config.preferred_audio_input != audio_input_devices->currentData().toString() - || config.audio_rate != audio_sample_rate->currentData().toInt()) { + if (Olive::CurrentConfig.preferred_audio_output != audio_output_devices->currentData().toString() + || Olive::CurrentConfig.preferred_audio_input != audio_input_devices->currentData().toString() + || Olive::CurrentConfig.audio_rate != audio_sample_rate->currentData().toInt()) { reinit_audio = true; } // save settings from UI to backend - config.css_path = custom_css_fn->text(); - Olive::MainWindow->load_css_from_file(config.css_path); + Olive::CurrentConfig.css_path = custom_css_fn->text(); + Olive::MainWindow->load_css_from_file(Olive::CurrentConfig.css_path); - config.recording_mode = recordingComboBox->currentIndex() + 1; - config.img_seq_formats = imgSeqFormatEdit->text(); - config.fast_seeking = fastSeekButton->isChecked(); - config.upcoming_queue_size = upcoming_queue_spinbox->value(); - config.upcoming_queue_type = upcoming_queue_type->currentIndex(); - config.previous_queue_size = previous_queue_spinbox->value(); - config.previous_queue_type = previous_queue_type->currentIndex(); - config.add_default_effects_to_clips = add_default_effects_to_clips->isChecked(); + Olive::CurrentConfig.recording_mode = recordingComboBox->currentIndex() + 1; + Olive::CurrentConfig.img_seq_formats = imgSeqFormatEdit->text(); + Olive::CurrentConfig.fast_seeking = fastSeekButton->isChecked(); + Olive::CurrentConfig.upcoming_queue_size = upcoming_queue_spinbox->value(); + Olive::CurrentConfig.upcoming_queue_type = upcoming_queue_type->currentIndex(); + Olive::CurrentConfig.previous_queue_size = previous_queue_spinbox->value(); + Olive::CurrentConfig.previous_queue_type = previous_queue_type->currentIndex(); + Olive::CurrentConfig.add_default_effects_to_clips = add_default_effects_to_clips->isChecked(); - config.preferred_audio_output = audio_output_devices->currentData().toString(); - config.preferred_audio_input = audio_input_devices->currentData().toString(); - config.audio_rate = audio_sample_rate->currentData().toInt(); + Olive::CurrentConfig.preferred_audio_output = audio_output_devices->currentData().toString(); + Olive::CurrentConfig.preferred_audio_input = audio_input_devices->currentData().toString(); + Olive::CurrentConfig.audio_rate = audio_sample_rate->currentData().toInt(); - config.effect_textbox_lines = effect_textbox_lines_field->value(); - config.use_software_fallback = use_software_fallbacks_checkbox->isChecked(); - config.language_file = language_combobox->currentData().toString(); + Olive::CurrentConfig.effect_textbox_lines = effect_textbox_lines_field->value(); + Olive::CurrentConfig.use_software_fallback = use_software_fallbacks_checkbox->isChecked(); + Olive::CurrentConfig.language_file = language_combobox->currentData().toString(); - if (config.thumbnail_resolution != thumbnail_res_spinbox->value() - || config.waveform_resolution != waveform_res_spinbox->value()) { + if (Olive::CurrentConfig.thumbnail_resolution != thumbnail_res_spinbox->value() + || Olive::CurrentConfig.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 char delete_match = 0; - if (config.thumbnail_resolution != thumbnail_res_spinbox->value()) { + if (Olive::CurrentConfig.thumbnail_resolution != thumbnail_res_spinbox->value()) { // delete existing thumbnails - config.thumbnail_resolution = thumbnail_res_spinbox->value(); + Olive::CurrentConfig.thumbnail_resolution = thumbnail_res_spinbox->value(); // delete only thumbnails delete_match = 't'; } - if (config.waveform_resolution != waveform_res_spinbox->value()) { + if (Olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value()) { // delete existing waveforms - config.waveform_resolution = waveform_res_spinbox->value(); + Olive::CurrentConfig.waveform_resolution = waveform_res_spinbox->value(); // if we're already deleting thumbnails if (delete_match == 't') { @@ -468,7 +468,7 @@ void PreferencesDialog::setup_ui() { QString locale_str = locale_file_basename.mid(locale_file_basename.lastIndexOf('_')+1); language_combobox->addItem(QLocale(locale_str).nativeLanguageName(), locale_relative_path); - if (config.language_file == locale_relative_path) { + if (Olive::CurrentConfig.language_file == locale_relative_path) { language_combobox->setCurrentIndex(language_combobox->count() - 1); } } @@ -483,7 +483,7 @@ void PreferencesDialog::setup_ui() { general_layout->addWidget(new QLabel(tr("Custom CSS:"), this), row, 0); custom_css_fn = new QLineEdit(general_tab); - custom_css_fn->setText(config.css_path); + custom_css_fn->setText(Olive::CurrentConfig.css_path); general_layout->addWidget(custom_css_fn, row, 1, 1, 3); QPushButton* custom_css_browse = new QPushButton(tr("Browse"), general_tab); @@ -516,7 +516,7 @@ void PreferencesDialog::setup_ui() { effect_textbox_lines_field = new QSpinBox(general_tab); effect_textbox_lines_field->setMinimum(1); - effect_textbox_lines_field->setValue(config.effect_textbox_lines); + effect_textbox_lines_field->setValue(Olive::CurrentConfig.effect_textbox_lines); general_layout->addWidget(effect_textbox_lines_field, row, 1, 1, 4); row++; @@ -527,7 +527,7 @@ void PreferencesDialog::setup_ui() { thumbnail_res_spinbox = new QSpinBox(this); thumbnail_res_spinbox->setMinimum(0); thumbnail_res_spinbox->setMaximum(INT_MAX); - thumbnail_res_spinbox->setValue(config.thumbnail_resolution); + thumbnail_res_spinbox->setValue(Olive::CurrentConfig.thumbnail_resolution); general_layout->addWidget(thumbnail_res_spinbox, row, 1); general_layout->addWidget(new QLabel(tr("Waveform Resolution:"), this), row, 2); @@ -535,7 +535,7 @@ void PreferencesDialog::setup_ui() { waveform_res_spinbox = new QSpinBox(this); waveform_res_spinbox->setMinimum(0); waveform_res_spinbox->setMaximum(INT_MAX); - waveform_res_spinbox->setValue(config.waveform_resolution); + waveform_res_spinbox->setValue(Olive::CurrentConfig.waveform_resolution); general_layout->addWidget(waveform_res_spinbox, row, 3); QPushButton* delete_preview_btn = new QPushButton(tr("Delete Previews")); @@ -547,7 +547,7 @@ void PreferencesDialog::setup_ui() { // General -> Use Software Fallbacks When Possible use_software_fallbacks_checkbox = new QCheckBox(general_tab); use_software_fallbacks_checkbox->setText(tr("Use Software Fallbacks When Possible")); - use_software_fallbacks_checkbox->setChecked(config.use_software_fallback); + use_software_fallbacks_checkbox->setChecked(Olive::CurrentConfig.use_software_fallback); general_layout->addWidget(use_software_fallbacks_checkbox, row, 0, 1, 4); tabWidget->addTab(general_tab, tr("General")); @@ -559,7 +559,7 @@ void PreferencesDialog::setup_ui() { QVBoxLayout* behavior_tab_layout = new QVBoxLayout(behavior_tab); add_default_effects_to_clips = new QCheckBox("Add Default Effects to New Clips"); - add_default_effects_to_clips->setChecked(config.add_default_effects_to_clips); + add_default_effects_to_clips->setChecked(Olive::CurrentConfig.add_default_effects_to_clips); behavior_tab_layout->addWidget(add_default_effects_to_clips); // Playback @@ -584,21 +584,21 @@ void PreferencesDialog::setup_ui() { 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(config.upcoming_queue_size); + upcoming_queue_spinbox->setValue(Olive::CurrentConfig.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(config.upcoming_queue_type); + upcoming_queue_type->setCurrentIndex(Olive::CurrentConfig.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(config.previous_queue_size); + previous_queue_spinbox->setValue(Olive::CurrentConfig.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(config.previous_queue_type); + previous_queue_type->setCurrentIndex(Olive::CurrentConfig.previous_queue_type); memory_usage_layout->addWidget(previous_queue_type, 1, 2); playback_tab_layout->addWidget(memory_usage_group); @@ -620,7 +620,7 @@ void PreferencesDialog::setup_ui() { for (int i=0;iaddItem(devs.at(i).deviceName(), devs.at(i).deviceName()); if (!found_preferred_device - && devs.at(i).deviceName() == config.preferred_audio_output) { + && devs.at(i).deviceName() == Olive::CurrentConfig.preferred_audio_output) { audio_output_devices->setCurrentIndex(audio_output_devices->count()-1); found_preferred_device = true; } @@ -639,7 +639,7 @@ void PreferencesDialog::setup_ui() { for (int i=0;iaddItem(devs.at(i).deviceName(), devs.at(i).deviceName()); if (!found_preferred_device - && devs.at(i).deviceName() == config.preferred_audio_input) { + && devs.at(i).deviceName() == Olive::CurrentConfig.preferred_audio_input) { audio_input_devices->setCurrentIndex(audio_input_devices->count()-1); found_preferred_device = true; } @@ -652,7 +652,7 @@ void PreferencesDialog::setup_ui() { 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() == config.audio_rate) { + if (audio_sample_rate->itemData(i).toInt() == Olive::CurrentConfig.audio_rate) { audio_sample_rate->setCurrentIndex(i); break; } diff --git a/dialogs/preferencesdialog.h b/dialogs/preferencesdialog.h index 5469ce8a6..8aa3d232a 100644 --- a/dialogs/preferencesdialog.h +++ b/dialogs/preferencesdialog.h @@ -23,16 +23,16 @@ #include #include -class QMenuBar; -class QLineEdit; -class QComboBox; -class QRadioButton; -class QTreeWidget; -class QTreeWidgetItem; -class QMenu; -class QCheckBox; -class QDoubleSpinBox; -class QSpinBox; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include class KeySequenceEditor : public QKeySequenceEdit { Q_OBJECT diff --git a/dialogs/proxydialog.h b/dialogs/proxydialog.h index 95367c7bd..d8917be54 100644 --- a/dialogs/proxydialog.h +++ b/dialogs/proxydialog.h @@ -25,7 +25,7 @@ #include #include -struct Footage; +#include "project/footage.h" class ProxyDialog : public QDialog { Q_OBJECT diff --git a/dialogs/replaceclipmediadialog.cpp b/dialogs/replaceclipmediadialog.cpp index 237cd72ae..1f42a910a 100644 --- a/dialogs/replaceclipmediadialog.cpp +++ b/dialogs/replaceclipmediadialog.cpp @@ -20,20 +20,16 @@ #include "replaceclipmediadialog.h" -#include "ui/sourcetable.h" #include "panels/panels.h" -#include "project/projectelements.h" #include "playback/playback.h" #include "playback/cacher.h" #include "project/undo.h" #include -#include #include #include #include -#include ReplaceClipMediaDialog::ReplaceClipMediaDialog(QWidget *parent, Media *old_media) : QDialog(parent), diff --git a/dialogs/replaceclipmediadialog.h b/dialogs/replaceclipmediadialog.h index f254c1f38..1971579f4 100644 --- a/dialogs/replaceclipmediadialog.h +++ b/dialogs/replaceclipmediadialog.h @@ -22,11 +22,11 @@ #define REPLACECLIPMEDIADIALOG_H #include +#include +#include -class SourceTable; -class QTreeView; -class Media; -class QCheckBox; +#include "ui/sourcetable.h" +#include "project/projectelements.h" class ReplaceClipMediaDialog : public QDialog { Q_OBJECT diff --git a/dialogs/speeddialog.cpp b/dialogs/speeddialog.cpp index 384bb4a0d..37c65c157 100644 --- a/dialogs/speeddialog.cpp +++ b/dialogs/speeddialog.cpp @@ -23,12 +23,9 @@ #include #include #include -#include #include #include -#include "ui/labelslider.h" -#include "project/clip.h" #include "project/sequence.h" #include "project/footage.h" #include "playback/playback.h" diff --git a/dialogs/speeddialog.h b/dialogs/speeddialog.h index 947ddd4b7..1da29af83 100644 --- a/dialogs/speeddialog.h +++ b/dialogs/speeddialog.h @@ -22,10 +22,10 @@ #define SPEEDDIALOG_H #include +#include -class Clip; -class LabelSlider; -class QCheckBox; +#include "project/clip.h" +#include "ui/labelslider.h" class SpeedDialog : public QDialog { diff --git a/dialogs/stabilizerdialog.cpp b/dialogs/stabilizerdialog.cpp deleted file mode 100644 index 2ffcbee53..000000000 --- a/dialogs/stabilizerdialog.cpp +++ /dev/null @@ -1,124 +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 "stabilizerdialog.h" - -#include -#include -#include -#include -#include - -#include "ui/labelslider.h" - -// NOTE: this is never used in Olive, hasn't been maintained, and needs to be written - -StabilizerDialog::StabilizerDialog(QWidget *parent) : QDialog(parent) { - setWindowTitle("Stabilizer"); - - layout = new QVBoxLayout(this); - - enable_stab = new QCheckBox(this); - enable_stab->setText("Enable Stabilizer"); - layout->addWidget(enable_stab); - - analysis = new QGroupBox("Analysis", this); - layout->addWidget(analysis); - - analysis_layout = new QGridLayout(analysis); - analysis->setLayout(analysis_layout); - - analysis_layout->addWidget(new QLabel("Shakiness:", this), 0, 0); - - shakiness_slider = new LabelSlider(this); - shakiness_slider->set_minimum_value(1); - shakiness_slider->set_default_value(5); - shakiness_slider->set_maximum_value(10); - analysis_layout->addWidget(shakiness_slider, 0, 1); - - analysis_layout->addWidget(new QLabel("Accuracy:", this), 1, 0); - - accuracy_slider = new LabelSlider(this); - accuracy_slider->set_minimum_value(1); - accuracy_slider->set_default_value(15); - accuracy_slider->set_maximum_value(15); - analysis_layout->addWidget(accuracy_slider, 1, 1); - - analysis_layout->addWidget(new QLabel("Step Size:", this), 2, 0); - - stepsize_slider = new LabelSlider(this); - stepsize_slider->set_minimum_value(1); - stepsize_slider->set_default_value(6); - analysis_layout->addWidget(stepsize_slider, 2, 1); - - analysis_layout->addWidget(new QLabel("Minimum Contrast:", this), 3, 0); - - mincontrast_slider = new LabelSlider(this); - mincontrast_slider->set_minimum_value(0); - mincontrast_slider->set_default_value(0.3); - mincontrast_slider->set_maximum_value(1); - analysis_layout->addWidget(mincontrast_slider, 3, 1); - - /*analysis_layout->addWidget(new QLabel("Tripod Mode:"), 4, 0); - - tripod_mode_box = new QCheckBox(); - analysis_layout->addWidget(tripod_mode_box, 4, 1);*/ - - stabilization = new QGroupBox("Stabilization", this); - layout->addWidget(stabilization); - - stabilization_layout = new QGridLayout(this); - stabilization->setLayout(stabilization_layout); - - stabilization_layout->addWidget(new QLabel("Smoothing:", this), 0, 0); - - smoothing_slider = new LabelSlider(); - smoothing_slider->set_minimum_value(0); - smoothing_slider->set_default_value(10); - stabilization_layout->addWidget(smoothing_slider, 0, 1); - - stabilization_layout->addWidget(new QLabel("Gaussian Motion:"), 1, 0); - - gaussian_motion = new QCheckBox(); - gaussian_motion->setChecked(true); - stabilization_layout->addWidget(gaussian_motion, 1, 1); - - stabilization_layout->addWidget(new QLabel("Maximum Movement:"), 2, 0); - stabilization_layout->addWidget(new QLabel("Maximum Rotation:"), 3, 0); - stabilization_layout->addWidget(new QLabel("Crop:"), 4, 0); - stabilization_layout->addWidget(new QLabel("Zoom Behavior:"), 5, 0); - stabilization_layout->addWidget(new QLabel("Zoom Speed:"), 6, 0); - stabilization_layout->addWidget(new QLabel("Interpolation Quality:"), 7, 0); - - buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); - layout->addWidget(buttons); - - connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttons, SIGNAL(rejected()), this, SLOT(reject())); - - connect(enable_stab, SIGNAL(toggled(bool)), this, SLOT(set_all_enabled(bool))); - - set_all_enabled(false); -} - -void StabilizerDialog::set_all_enabled(bool e) { - analysis->setEnabled(e); - stabilization->setEnabled(e); -} diff --git a/dialogs/stabilizerdialog.h b/dialogs/stabilizerdialog.h deleted file mode 100644 index 995ed1408..000000000 --- a/dialogs/stabilizerdialog.h +++ /dev/null @@ -1,57 +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 STABILIZERDIALOG_H -#define STABILIZERDIALOG_H - -class QVBoxLayout; -class QCheckBox; -class QDialogButtonBox; -class QGroupBox; -class QGridLayout; -class LabelSlider; - -#include - -class StabilizerDialog : public QDialog -{ - Q_OBJECT -public: - StabilizerDialog(QWidget* parent = 0); -private slots: - void set_all_enabled(bool e); -private: - QVBoxLayout* layout; - QCheckBox* enable_stab; - QDialogButtonBox* buttons; - QGroupBox* analysis; - QGridLayout* analysis_layout; - LabelSlider* shakiness_slider; - LabelSlider* accuracy_slider; - LabelSlider* stepsize_slider; - LabelSlider* mincontrast_slider; - QCheckBox* tripod_mode_box; - QGroupBox* stabilization; - QGridLayout* stabilization_layout; - LabelSlider* smoothing_slider; - QCheckBox* gaussian_motion; -}; - -#endif // STABILIZERDIALOG_H diff --git a/dialogs/texteditdialog.cpp b/dialogs/texteditdialog.cpp index b7cb7ad82..2dcc158af 100644 --- a/dialogs/texteditdialog.cpp +++ b/dialogs/texteditdialog.cpp @@ -21,7 +21,6 @@ #include "texteditdialog.h" #include -#include #include TextEditDialog::TextEditDialog(QWidget *parent, const QString &s) : diff --git a/dialogs/texteditdialog.h b/dialogs/texteditdialog.h index d58823d1a..6e7b29567 100644 --- a/dialogs/texteditdialog.h +++ b/dialogs/texteditdialog.h @@ -22,13 +22,12 @@ #define TEXTEDITDIALOG_H #include - -class QPlainTextEdit; +#include class TextEditDialog : public QDialog { Q_OBJECT public: - TextEditDialog(QWidget* parent = 0, const QString& s = 0); + TextEditDialog(QWidget* parent = nullptr, const QString& s = nullptr); const QString& get_string(); private slots: void save(); diff --git a/effects/internal/ocio.frag b/effects/internal/ocio.frag new file mode 100644 index 000000000..1d732b00d --- /dev/null +++ b/effects/internal/ocio.frag @@ -0,0 +1,10 @@ +#version 110 + +uniform sampler2D tex1; +uniform sampler3D tex2; + +void main() +{ + vec4 col = texture2D(tex1, gl_TexCoord[0].st); + gl_FragColor = OCIODisplay(col, tex2); +} \ No newline at end of file diff --git a/effects/internal/solideffect.h b/effects/internal/solideffect.h index c05e5b196..309098c58 100644 --- a/effects/internal/solideffect.h +++ b/effects/internal/solideffect.h @@ -23,7 +23,6 @@ #include "project/effect.h" -class QOpenGLTexture; #include class SolidEffect : public Effect { diff --git a/effects/internal/texteffect.h b/effects/internal/texteffect.h index 02f83964f..e07ea1695 100644 --- a/effects/internal/texteffect.h +++ b/effects/internal/texteffect.h @@ -25,7 +25,6 @@ #include #include -class QOpenGLTexture; class TextEffect : public Effect { Q_OBJECT diff --git a/effects/internal/timecodeeffect.cpp b/effects/internal/timecodeeffect.cpp index acbf5b333..495ee5874 100644 --- a/effects/internal/timecodeeffect.cpp +++ b/effects/internal/timecodeeffect.cpp @@ -82,10 +82,10 @@ TimecodeEffect::TimecodeEffect(Clip *c, const EffectMeta* em) : void TimecodeEffect::redraw(double timecode) { if (tc_select->get_combo_data(timecode).toBool()){ - display_timecode = prepend_text->get_string_value(timecode) + frame_to_timecode(Olive::ActiveSequence->playhead, config.timecode_view, Olive::ActiveSequence->frame_rate);} + display_timecode = prepend_text->get_string_value(timecode) + frame_to_timecode(Olive::ActiveSequence->playhead, Olive::CurrentConfig.timecode_view, Olive::ActiveSequence->frame_rate);} else { double media_rate = parent_clip->getMediaFrameRate(); - display_timecode = prepend_text->get_string_value(timecode) + frame_to_timecode(timecode * media_rate, config.timecode_view, media_rate);} + display_timecode = prepend_text->get_string_value(timecode) + frame_to_timecode(timecode * media_rate, Olive::CurrentConfig.timecode_view, media_rate);} img.fill(Qt::transparent); QPainter p(&img); diff --git a/effects/internal/timecodeeffect.h b/effects/internal/timecodeeffect.h index 6ec709c28..2caeb3276 100644 --- a/effects/internal/timecodeeffect.h +++ b/effects/internal/timecodeeffect.h @@ -25,7 +25,6 @@ #include #include -class QOpenGLTexture; class TimecodeEffect : public Effect { Q_OBJECT diff --git a/effects/internal/vsthost.h b/effects/internal/vsthost.h index ef0ddce50..752f0b7b3 100644 --- a/effects/internal/vsthost.h +++ b/effects/internal/vsthost.h @@ -32,7 +32,7 @@ // Plugin's dispatcher function typedef intptr_t (*dispatcherFuncPtr)(AEffect *effect, int32_t opCode, int32_t index, int32_t value, void *ptr, float opt); -class QDialog; +#include class VSTHost : public Effect { Q_OBJECT diff --git a/io/clipboard.h b/io/clipboard.h index 3c96d5e66..cb81758a4 100644 --- a/io/clipboard.h +++ b/io/clipboard.h @@ -23,7 +23,7 @@ #include -class Transition; +#include #define CLIPBOARD_TYPE_CLIP 0 #define CLIPBOARD_TYPE_EFFECT 1 diff --git a/io/config.cpp b/io/config.cpp index 01836bf80..ec273992e 100644 --- a/io/config.cpp +++ b/io/config.cpp @@ -29,8 +29,8 @@ #include "debug.h" -Config config; -RuntimeConfig runtime_config; +Config Olive::CurrentConfig; +RuntimeConfig Olive::CurrentRuntimeConfig; Config::Config() : saved_layout(false), diff --git a/io/config.h b/io/config.h index c79fed787..da598fae3 100644 --- a/io/config.h +++ b/io/config.h @@ -103,7 +103,9 @@ struct RuntimeConfig { QString external_translation_file; }; -extern Config config; -extern RuntimeConfig runtime_config; +namespace Olive { + extern Config CurrentConfig; + extern RuntimeConfig CurrentRuntimeConfig; +} #endif // CONFIG_H diff --git a/io/exportthread.cpp b/io/exportthread.cpp index bc9244093..2330ca985 100644 --- a/io/exportthread.cpp +++ b/io/exportthread.cpp @@ -31,7 +31,6 @@ #include "ui/renderfunctions.h" #include "playback/playback.h" #include "playback/audio.h" -#include "dialogs/exportdialog.h" #include "mainwindow.h" #include "debug.h" @@ -80,7 +79,7 @@ bool ExportThread::encode(AVFormatContext* ofmt_ctx, AVCodecContext* codec_ctx, ret = avcodec_send_frame(codec_ctx, frame); if (ret < 0) { qCritical() << "Failed to send frame to encoder." << ret; - ed->export_error = tr("failed to send frame to encoder (%1)").arg(QString::number(ret)); + export_error = tr("failed to send frame to encoder (%1)").arg(QString::number(ret)); return false; } @@ -91,7 +90,7 @@ bool ExportThread::encode(AVFormatContext* ofmt_ctx, AVCodecContext* codec_ctx, } else if (ret < 0) { if (ret != AVERROR_EOF) { qCritical() << "Failed to receive packet from encoder." << ret; - ed->export_error = tr("failed to receive packet from encoder (%1)").arg(QString::number(ret)); + export_error = tr("failed to receive packet from encoder (%1)").arg(QString::number(ret)); } return false; } @@ -112,7 +111,7 @@ bool ExportThread::setupVideo() { vcodec = avcodec_find_encoder(static_cast(params.video_codec)); if (!vcodec) { qCritical() << "Could not find video encoder"; - ed->export_error = tr("could not video encoder for %1").arg(QString::number(params.video_codec)); + export_error = tr("could not video encoder for %1").arg(QString::number(params.video_codec)); return false; } @@ -121,7 +120,7 @@ bool ExportThread::setupVideo() { video_stream->id = 0; if (!video_stream) { qCritical() << "Could not allocate video stream"; - ed->export_error = tr("could not allocate video stream"); + export_error = tr("could not allocate video stream"); return false; } @@ -130,7 +129,7 @@ bool ExportThread::setupVideo() { vcodec_ctx = avcodec_alloc_context3(vcodec); if (!vcodec_ctx) { qCritical() << "Could not allocate video encoding context"; - ed->export_error = tr("could not allocate video encoding context"); + export_error = tr("could not allocate video encoding context"); return false; } @@ -168,7 +167,7 @@ bool ExportThread::setupVideo() { ret = avcodec_open2(vcodec_ctx, vcodec, &opts); if (ret < 0) { qCritical() << "Could not open output video encoder." << ret; - ed->export_error = tr("could not open output video encoder (%1)").arg(QString::number(ret)); + export_error = tr("could not open output video encoder (%1)").arg(QString::number(ret)); return false; } @@ -176,7 +175,7 @@ bool ExportThread::setupVideo() { ret = avcodec_parameters_from_context(video_stream->codecpar, vcodec_ctx); if (ret < 0) { qCritical() << "Could not copy video encoder parameters to output stream." << ret; - ed->export_error = tr("could not copy video encoder parameters to output stream (%1)").arg(QString::number(ret)); + export_error = tr("could not copy video encoder parameters to output stream (%1)").arg(QString::number(ret)); return false; } @@ -214,7 +213,7 @@ bool ExportThread::setupAudio() { acodec = avcodec_find_encoder(static_cast(params.audio_codec)); if (!acodec) { qCritical() << "Could not find audio encoder"; - ed->export_error = tr("could not audio encoder for %1").arg(QString::number(params.audio_codec)); + export_error = tr("could not audio encoder for %1").arg(QString::number(params.audio_codec)); return false; } @@ -223,7 +222,7 @@ bool ExportThread::setupAudio() { audio_stream->id = 1; if (!audio_stream) { qCritical() << "Could not allocate audio stream"; - ed->export_error = tr("could not allocate audio stream"); + export_error = tr("could not allocate audio stream"); return false; } @@ -232,7 +231,7 @@ bool ExportThread::setupAudio() { acodec_ctx = avcodec_alloc_context3(acodec); if (!acodec_ctx) { qCritical() << "Could not find allocate audio encoding context"; - ed->export_error = tr("could not allocate audio encoding context"); + export_error = tr("could not allocate audio encoding context"); return false; } @@ -257,7 +256,7 @@ bool ExportThread::setupAudio() { ret = avcodec_open2(acodec_ctx, acodec, nullptr); if (ret < 0) { qCritical() << "Could not open output audio encoder." << ret; - ed->export_error = tr("could not open output audio encoder (%1)").arg(QString::number(ret)); + export_error = tr("could not open output audio encoder (%1)").arg(QString::number(ret)); return false; } @@ -265,7 +264,7 @@ bool ExportThread::setupAudio() { ret = avcodec_parameters_from_context(audio_stream->codecpar, acodec_ctx); if (ret < 0) { qCritical() << "Could not copy audio encoder parameters to output stream." << ret; - ed->export_error = tr("could not copy audio encoder parameters to output stream (%1)").arg(QString::number(ret)); + export_error = tr("could not copy audio encoder parameters to output stream (%1)").arg(QString::number(ret)); return false; } @@ -295,7 +294,7 @@ bool ExportThread::setupAudio() { ret = av_frame_get_buffer(audio_frame, 0); if (ret < 0) { qCritical() << "Could not allocate audio buffer." << ret; - ed->export_error = tr("could not allocate audio buffer (%1)").arg(QString::number(ret)); + export_error = tr("could not allocate audio buffer (%1)").arg(QString::number(ret)); return false; } aframe_bytes = av_samples_get_buffer_size(nullptr, audio_frame->channels, audio_frame->nb_samples, static_cast(audio_frame->format), 0); @@ -317,7 +316,7 @@ bool ExportThread::setupContainer() { avformat_alloc_output_context2(&fmt_ctx, nullptr, nullptr, c_filename); if (!fmt_ctx) { qCritical() << "Could not create output context"; - ed->export_error = tr("could not create output format context"); + export_error = tr("could not create output format context"); return false; } @@ -326,7 +325,7 @@ bool ExportThread::setupContainer() { ret = avio_open(&fmt_ctx->pb, c_filename, AVIO_FLAG_WRITE); if (ret < 0) { qCritical() << "Could not open output file." << ret; - ed->export_error = tr("could not open output file (%1)").arg(QString::number(ret)); + export_error = tr("could not open output file (%1)").arg(QString::number(ret)); return false; } @@ -352,7 +351,7 @@ void ExportThread::run() { ret = avformat_write_header(fmt_ctx, nullptr); if (ret < 0) { qCritical() << "Could not write output file header." << ret; - ed->export_error = tr("could not write output file header (%1)").arg(QString::number(ret)); + export_error = tr("could not write output file header (%1)").arg(QString::number(ret)); continueEncode = false; } } @@ -489,11 +488,13 @@ void ExportThread::run() { ret = av_write_trailer(fmt_ctx); if (ret < 0) { qCritical() << "Could not write output file trailer." << ret; - ed->export_error = tr("could not write output file trailer (%1)").arg(QString::number(ret)); + export_error = tr("could not write output file trailer (%1)").arg(QString::number(ret)); continueEncode = false; } - emit progress_changed(100, 0); + if (continueEncode) { + emit progress_changed(100, 0); + } } avio_closep(&fmt_ctx->pb); @@ -522,7 +523,11 @@ void ExportThread::run() { av_frame_free(&swr_frame); } - delete [] c_filename; + delete [] c_filename; +} + +const QString &ExportThread::getError() { + return export_error; } void ExportThread::wake() { diff --git a/io/exportthread.h b/io/exportthread.h index 8c0a0c075..c7ab7a2c0 100644 --- a/io/exportthread.h +++ b/io/exportthread.h @@ -26,7 +26,6 @@ #include #include -class ExportDialog; struct AVFormatContext; struct AVCodecContext; struct AVFrame; @@ -75,9 +74,9 @@ public: ExportThread(const ExportParams& iparams, const VideoCodecParams& ivparams, QObject* parent = nullptr); void run(); - QOffscreenSurface surface; + const QString& getError(); - ExportDialog* ed; + QOffscreenSurface surface; bool continueEncode; signals: @@ -119,6 +118,8 @@ private: QMutex mutex; QWaitCondition waitCond; + + QString export_error; }; #endif // EXPORTTHREAD_H diff --git a/io/loadthread.cpp b/io/loadthread.cpp index 1c50389fa..bde477567 100644 --- a/io/loadthread.cpp +++ b/io/loadthread.cpp @@ -31,22 +31,13 @@ #include "io/config.h" #include "playback/playback.h" #include "io/previewgenerator.h" -#include "dialogs/loaddialog.h" #include "effects/internal/voideffect.h" #include "debug.h" #include #include -struct TransitionData { - int id; - QString name; - long length; - Clip* otc; - Clip* ctc; -}; - -LoadThread::LoadThread(LoadDialog* l, bool a) : ld(l), autorecovery(a), cancelled(false) { +LoadThread::LoadThread(bool a) : autorecovery(a), cancelled(false) { connect(this, SIGNAL(finished()), this, SLOT(deleteLater())); connect(this, SIGNAL(success()), this, SLOT(success_func())); connect(this, SIGNAL(error()), this, SLOT(error_func())); diff --git a/io/loadthread.h b/io/loadthread.h index 6d660773f..3b51715e9 100644 --- a/io/loadthread.h +++ b/io/loadthread.h @@ -28,19 +28,21 @@ #include #include -class Media; -struct Footage; -class Clip; -struct Sequence; -class LoadDialog; -struct TransitionData; -struct EffectMeta; +#include "project/projectelements.h" + +struct TransitionData { + int id; + QString name; + long length; + Clip* otc; + Clip* ctc; +}; class LoadThread : public QThread { Q_OBJECT public: - LoadThread(LoadDialog* l, bool a); + LoadThread(bool a); void run(); void cancel(); signals: @@ -57,7 +59,6 @@ private slots: void create_effect_ui(QXmlStreamReader* stream, Clip* c, int type, const QString *effect_name, const EffectMeta* meta, long effect_length, bool effect_enabled); void create_dual_transition(const TransitionData* td, Clip* primary, Clip* secondary, const EffectMeta* meta); private: - LoadDialog* ld; bool autorecovery; bool load_worker(QFile& f, QXmlStreamReader& stream, int type); diff --git a/io/previewgenerator.cpp b/io/previewgenerator.cpp index cdf1df2ae..20fb69fa0 100644 --- a/io/previewgenerator.cpp +++ b/io/previewgenerator.cpp @@ -36,13 +36,6 @@ #include #include -extern "C" { -#include -#include -#include -#include -} - QSemaphore sem(5); // only 5 preview generators can run at one time PreviewGenerator::PreviewGenerator(Media* i, Footage* m, bool r) : @@ -249,8 +242,8 @@ void PreviewGenerator::generate_waveform() { // we only generate previews for video and audio // and only if the thumbnail and waveform sizes are > 0 - if ((fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && config.thumbnail_resolution > 0) - || (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && config.waveform_resolution > 0)) { + if ((fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && Olive::CurrentConfig.thumbnail_resolution > 0) + || (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && Olive::CurrentConfig.waveform_resolution > 0)) { AVCodec* codec = avcodec_find_decoder(fmt_ctx->streams[i]->codecpar->codec_id); if (codec != nullptr) { @@ -325,7 +318,7 @@ void PreviewGenerator::generate_waveform() { if (s != nullptr) { if (fmt_ctx->streams[packet->stream_index]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { if (!s->preview_done) { - int dstH = config.thumbnail_resolution; + int dstH = Olive::CurrentConfig.thumbnail_resolution; int dstW = qRound(dstH * (float(temp_frame->width)/float(temp_frame->height))); uint8_t* data = new uint8_t[size_t(dstW*dstH*4)]; @@ -388,7 +381,7 @@ void PreviewGenerator::generate_waveform() { // `config.waveform_resolution` determines how many samples per second are stored in waveform. // `sample_rate` is samples per second, so `interval` is how many samples are averaged in // each "point" of the waveform - int interval = qFloor((temp_frame->sample_rate/config.waveform_resolution)/4)*4; + int interval = qFloor((temp_frame->sample_rate/Olive::CurrentConfig.waveform_resolution)/4)*4; // get the amount of bytes in an audio sample int sample_size = av_get_bytes_per_sample(static_cast(swr_frame->format)); diff --git a/io/previewgenerator.h b/io/previewgenerator.h index 28ac5bd8d..a1b5d5252 100644 --- a/io/previewgenerator.h +++ b/io/previewgenerator.h @@ -31,10 +31,15 @@ enum IconType { ICON_TYPE_ERROR }; -struct Footage; -struct FootageStream; -struct AVFormatContext; -class Media; +#include "project/footage.h" +#include "project/media.h" + +extern "C" { + #include + #include + #include + #include +} class PreviewGenerator : public QThread { diff --git a/io/proxygenerator.cpp b/io/proxygenerator.cpp index 22d2e4ba5..fb2dd74e1 100644 --- a/io/proxygenerator.cpp +++ b/io/proxygenerator.cpp @@ -20,7 +20,6 @@ #include "proxygenerator.h" -#include "project/footage.h" #include "io/path.h" #include "mainwindow.h" diff --git a/io/proxygenerator.h b/io/proxygenerator.h index 4458cd718..b8afeb379 100644 --- a/io/proxygenerator.h +++ b/io/proxygenerator.h @@ -26,7 +26,7 @@ #include #include -struct Footage; +#include "project/footage.h" struct ProxyInfo { Footage* footage; diff --git a/main.cpp b/main.cpp index 3a8714a08..e11799615 100644 --- a/main.cpp +++ b/main.cpp @@ -70,15 +70,15 @@ int main(int argc, char *argv[]) { } else if (!strcmp(argv[i], "--fullscreen") || !strcmp(argv[i], "-f")) { launch_fullscreen = true; } else if (!strcmp(argv[i], "--disable-shaders")) { - runtime_config.shaders_are_enabled = false; + Olive::CurrentRuntimeConfig.shaders_are_enabled = false; } else if (!strcmp(argv[i], "--no-debug")) { use_internal_logger = false; } else if (!strcmp(argv[i], "--disable-blend-modes")) { - runtime_config.disable_blending = true; + Olive::CurrentRuntimeConfig.disable_blending = true; } else if (!strcmp(argv[i], "--translation")) { if (i + 1 < argc && argv[i + 1][0] != '-') { // load translation file - runtime_config.external_translation_file = argv[i + 1]; + Olive::CurrentRuntimeConfig.external_translation_file = argv[i + 1]; i++; } else { diff --git a/mainwindow.cpp b/mainwindow.cpp index c78828fe6..9e3759825 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -200,18 +200,18 @@ MainWindow::MainWindow(QWidget *parent) : config_dir.mkpath("."); QString config_fn = config_dir.filePath("config.xml"); if (QFileInfo::exists(config_fn)) { - config.load(config_fn); + Olive::CurrentConfig.load(config_fn); - if (!config.css_path.isEmpty()) { - load_css_from_file(config.css_path); + if (!Olive::CurrentConfig.css_path.isEmpty()) { + load_css_from_file(Olive::CurrentConfig.css_path); } } } // load preferred language from file - QString language_file = runtime_config.external_translation_file.isEmpty() ? - config.language_file : - runtime_config.external_translation_file; + QString language_file = Olive::CurrentRuntimeConfig.external_translation_file.isEmpty() ? + Olive::CurrentConfig.language_file : + Olive::CurrentRuntimeConfig.external_translation_file; if (!language_file.isEmpty()) { @@ -450,12 +450,12 @@ void MainWindow::setup_menus() { track_lines = view_menu->addAction(tr("Track Lines"), &Olive::MenuHelper, SLOT(toggle_bool_action())); track_lines->setProperty("id", "tracklines"); track_lines->setCheckable(true); - track_lines->setData(reinterpret_cast(&config.show_track_lines)); + track_lines->setData(reinterpret_cast(&Olive::CurrentConfig.show_track_lines)); rectified_waveforms = view_menu->addAction(tr("Rectified Waveforms"), &Olive::MenuHelper, SLOT(toggle_bool_action())); rectified_waveforms->setProperty("id", "rectifiedwaveforms"); rectified_waveforms->setCheckable(true); - rectified_waveforms->setData(reinterpret_cast(&config.rectified_waveforms)); + rectified_waveforms->setData(reinterpret_cast(&Olive::CurrentConfig.rectified_waveforms)); view_menu->addSeparator(); @@ -544,7 +544,7 @@ void MainWindow::setup_menus() { loop_action = playback_menu->addAction(tr("Loop"), &Olive::MenuHelper, SLOT(toggle_bool_action())); loop_action->setProperty("id", "loop"); loop_action->setCheckable(true); - loop_action->setData(reinterpret_cast(&config.loop)); + loop_action->setData(reinterpret_cast(&Olive::CurrentConfig.loop)); // INITIALIZE WINDOW MENU @@ -646,67 +646,67 @@ void MainWindow::setup_menus() { selecting_also_seeks = tools_menu->addAction(tr("Selecting Also Seeks"), &Olive::MenuHelper, SLOT(toggle_bool_action())); selecting_also_seeks->setProperty("id", "selectingalsoseeks"); selecting_also_seeks->setCheckable(true); - selecting_also_seeks->setData(reinterpret_cast(&config.select_also_seeks)); + selecting_also_seeks->setData(reinterpret_cast(&Olive::CurrentConfig.select_also_seeks)); edit_tool_also_seeks = tools_menu->addAction(tr("Edit Tool Also Seeks"), &Olive::MenuHelper, SLOT(toggle_bool_action())); edit_tool_also_seeks->setProperty("id", "editalsoseeks"); edit_tool_also_seeks->setCheckable(true); - edit_tool_also_seeks->setData(reinterpret_cast(&config.edit_tool_also_seeks)); + edit_tool_also_seeks->setData(reinterpret_cast(&Olive::CurrentConfig.edit_tool_also_seeks)); edit_tool_selects_links = tools_menu->addAction(tr("Edit Tool Selects Links"), &Olive::MenuHelper, SLOT(toggle_bool_action())); edit_tool_selects_links->setProperty("id", "editselectslinks"); edit_tool_selects_links->setCheckable(true); - edit_tool_selects_links->setData(reinterpret_cast(&config.edit_tool_selects_links)); + edit_tool_selects_links->setData(reinterpret_cast(&Olive::CurrentConfig.edit_tool_selects_links)); seek_also_selects = tools_menu->addAction(tr("Seek Also Selects"), &Olive::MenuHelper, SLOT(toggle_bool_action())); seek_also_selects->setProperty("id", "seekalsoselects"); seek_also_selects->setCheckable(true); - seek_also_selects->setData(reinterpret_cast(&config.seek_also_selects)); + seek_also_selects->setData(reinterpret_cast(&Olive::CurrentConfig.seek_also_selects)); seek_to_end_of_pastes = tools_menu->addAction(tr("Seek to the End of Pastes"), &Olive::MenuHelper, SLOT(toggle_bool_action())); seek_to_end_of_pastes->setProperty("id", "seektoendofpastes"); seek_to_end_of_pastes->setCheckable(true); - seek_to_end_of_pastes->setData(reinterpret_cast(&config.paste_seeks)); + seek_to_end_of_pastes->setData(reinterpret_cast(&Olive::CurrentConfig.paste_seeks)); scroll_wheel_zooms = tools_menu->addAction(tr("Scroll Wheel Zooms"), &Olive::MenuHelper, SLOT(toggle_bool_action())); scroll_wheel_zooms->setProperty("id", "scrollwheelzooms"); scroll_wheel_zooms->setCheckable(true); - scroll_wheel_zooms->setData(reinterpret_cast(&config.scroll_zooms)); + scroll_wheel_zooms->setData(reinterpret_cast(&Olive::CurrentConfig.scroll_zooms)); enable_drag_files_to_timeline = tools_menu->addAction(tr("Enable Drag Files to Timeline"), &Olive::MenuHelper, SLOT(toggle_bool_action())); enable_drag_files_to_timeline->setProperty("id", "enabledragfilestotimeline"); enable_drag_files_to_timeline->setCheckable(true); - enable_drag_files_to_timeline->setData(reinterpret_cast(&config.enable_drag_files_to_timeline)); + enable_drag_files_to_timeline->setData(reinterpret_cast(&Olive::CurrentConfig.enable_drag_files_to_timeline)); autoscale_by_default = tools_menu->addAction(tr("Auto-Scale By Default"), &Olive::MenuHelper, SLOT(toggle_bool_action())); autoscale_by_default->setProperty("id", "autoscalebydefault"); autoscale_by_default->setCheckable(true); - autoscale_by_default->setData(reinterpret_cast(&config.autoscale_by_default)); + autoscale_by_default->setData(reinterpret_cast(&Olive::CurrentConfig.autoscale_by_default)); enable_seek_to_import = tools_menu->addAction(tr("Enable Seek to Import"), &Olive::MenuHelper, SLOT(toggle_bool_action())); enable_seek_to_import->setProperty("id", "enableseektoimport"); enable_seek_to_import->setCheckable(true); - enable_seek_to_import->setData(reinterpret_cast(&config.enable_seek_to_import)); + enable_seek_to_import->setData(reinterpret_cast(&Olive::CurrentConfig.enable_seek_to_import)); enable_audio_scrubbing = tools_menu->addAction(tr("Audio Scrubbing"), &Olive::MenuHelper, SLOT(toggle_bool_action())); enable_audio_scrubbing->setProperty("id", "audioscrubbing"); enable_audio_scrubbing->setCheckable(true); - enable_audio_scrubbing->setData(reinterpret_cast(&config.enable_audio_scrubbing)); + enable_audio_scrubbing->setData(reinterpret_cast(&Olive::CurrentConfig.enable_audio_scrubbing)); enable_drop_on_media_to_replace = tools_menu->addAction(tr("Enable Drop on Media to Replace"), &Olive::MenuHelper, SLOT(toggle_bool_action())); enable_drop_on_media_to_replace->setProperty("id", "enabledropmediareplace"); enable_drop_on_media_to_replace->setCheckable(true); - enable_drop_on_media_to_replace->setData(reinterpret_cast(&config.drop_on_media_to_replace)); + enable_drop_on_media_to_replace->setData(reinterpret_cast(&Olive::CurrentConfig.drop_on_media_to_replace)); enable_hover_focus = tools_menu->addAction(tr("Enable Hover Focus"), &Olive::MenuHelper, SLOT(toggle_bool_action())); enable_hover_focus->setProperty("id", "hoverfocus"); enable_hover_focus->setCheckable(true); - enable_hover_focus->setData(reinterpret_cast(&config.hover_focus)); + enable_hover_focus->setData(reinterpret_cast(&Olive::CurrentConfig.hover_focus)); set_name_and_marker = tools_menu->addAction(tr("Ask For Name When Setting Marker"), &Olive::MenuHelper, SLOT(toggle_bool_action())); set_name_and_marker->setProperty("id", "asknamemarkerset"); set_name_and_marker->setCheckable(true); - set_name_and_marker->setData(reinterpret_cast(&config.set_name_with_marker)); + set_name_and_marker->setData(reinterpret_cast(&Olive::CurrentConfig.set_name_with_marker)); tools_menu->addSeparator(); @@ -784,7 +784,7 @@ void MainWindow::closeEvent(QCloseEvent *e) { QString config_fn = config_dir.filePath("config.xml"); // save settings - config.save(config_fn); + Olive::CurrentConfig.save(config_fn); // save panel layout QFile panel_config(config_path + "/layout"); @@ -866,22 +866,22 @@ void MainWindow::playbackMenu_About_To_Be_Shown() { void MainWindow::viewMenu_About_To_Be_Shown() { Olive::MenuHelper.set_bool_action_checked(track_lines); - Olive::MenuHelper.set_int_action_checked(frames_action, config.timecode_view); - Olive::MenuHelper.set_int_action_checked(drop_frame_action, config.timecode_view); - Olive::MenuHelper.set_int_action_checked(nondrop_frame_action, config.timecode_view); - Olive::MenuHelper.set_int_action_checked(milliseconds_action, config.timecode_view); + Olive::MenuHelper.set_int_action_checked(frames_action, Olive::CurrentConfig.timecode_view); + Olive::MenuHelper.set_int_action_checked(drop_frame_action, Olive::CurrentConfig.timecode_view); + Olive::MenuHelper.set_int_action_checked(nondrop_frame_action, Olive::CurrentConfig.timecode_view); + Olive::MenuHelper.set_int_action_checked(milliseconds_action, Olive::CurrentConfig.timecode_view); - title_safe_off->setChecked(!config.show_title_safe_area); - title_safe_default->setChecked(config.show_title_safe_area - && !config.use_custom_title_safe_ratio); - title_safe_43->setChecked(config.show_title_safe_area - && config.use_custom_title_safe_ratio - && qFuzzyCompare(config.custom_title_safe_ratio, title_safe_43->data().toDouble())); - title_safe_169->setChecked(config.show_title_safe_area - && config.use_custom_title_safe_ratio - && qFuzzyCompare(config.custom_title_safe_ratio, title_safe_169->data().toDouble())); - title_safe_custom->setChecked(config.show_title_safe_area - && config.use_custom_title_safe_ratio + title_safe_off->setChecked(!Olive::CurrentConfig.show_title_safe_area); + title_safe_default->setChecked(Olive::CurrentConfig.show_title_safe_area + && !Olive::CurrentConfig.use_custom_title_safe_ratio); + title_safe_43->setChecked(Olive::CurrentConfig.show_title_safe_area + && Olive::CurrentConfig.use_custom_title_safe_ratio + && qFuzzyCompare(Olive::CurrentConfig.custom_title_safe_ratio, title_safe_43->data().toDouble())); + title_safe_169->setChecked(Olive::CurrentConfig.show_title_safe_area + && Olive::CurrentConfig.use_custom_title_safe_ratio + && qFuzzyCompare(Olive::CurrentConfig.custom_title_safe_ratio, title_safe_169->data().toDouble())); + title_safe_custom->setChecked(Olive::CurrentConfig.show_title_safe_area + && Olive::CurrentConfig.use_custom_title_safe_ratio && !title_safe_43->isChecked() && !title_safe_169->isChecked()); @@ -916,9 +916,9 @@ void MainWindow::toolMenu_About_To_Be_Shown() { Olive::MenuHelper.set_bool_action_checked(set_name_and_marker); Olive::MenuHelper.set_bool_action_checked(seek_also_selects); - Olive::MenuHelper.set_int_action_checked(no_autoscroll, config.autoscroll); - Olive::MenuHelper.set_int_action_checked(page_autoscroll, config.autoscroll); - Olive::MenuHelper.set_int_action_checked(smooth_autoscroll, config.autoscroll); + Olive::MenuHelper.set_int_action_checked(no_autoscroll, Olive::CurrentConfig.autoscroll); + Olive::MenuHelper.set_int_action_checked(page_autoscroll, Olive::CurrentConfig.autoscroll); + Olive::MenuHelper.set_int_action_checked(smooth_autoscroll, Olive::CurrentConfig.autoscroll); } void MainWindow::toggle_panel_visibility() { diff --git a/olive.pro b/olive.pro index 6b47a5db6..f75aacc71 100644 --- a/olive.pro +++ b/olive.pro @@ -117,7 +117,6 @@ SOURCES += \ effects/internal/cubetransition.cpp \ project/effectgizmo.cpp \ io/clipboard.cpp \ - dialogs/stabilizerdialog.cpp \ ui/resizablescrollbar.cpp \ ui/sourceiconview.cpp \ project/sourcescommon.cpp \ @@ -223,7 +222,6 @@ HEADERS += \ effects/internal/cubetransition.h \ project/effectgizmo.h \ io/clipboard.h \ - dialogs/stabilizerdialog.h \ ui/resizablescrollbar.h \ ui/sourceiconview.h \ project/sourcescommon.h \ diff --git a/panels/effectcontrols.h b/panels/effectcontrols.h index 674604547..dc2156264 100644 --- a/panels/effectcontrols.h +++ b/panels/effectcontrols.h @@ -24,19 +24,18 @@ #include #include #include +#include +#include +#include +#include +#include +#include -class Clip; -class QMenu; -class Effect; -class TimelineHeader; -class QScrollArea; -class KeyframeView; -class QVBoxLayout; -class ResizableScrollBar; -class QLabel; -class KeyframeView; -class QScrollBar; -class QHBoxLayout; +#include "project/projectelements.h" +#include "ui/timelineheader.h" +#include "ui/keyframeview.h" +#include "ui/resizablescrollbar.h" +#include "ui/keyframeview.h" class EffectsArea : public QWidget { Q_OBJECT diff --git a/panels/grapheditor.h b/panels/grapheditor.h index 759886fd3..4b22e9d9f 100644 --- a/panels/grapheditor.h +++ b/panels/grapheditor.h @@ -22,20 +22,20 @@ #define GRAPHEDITOR_H #include +#include +#include +#include -class GraphView; -class TimelineHeader; -class QPushButton; -class EffectRow; -class QHBoxLayout; -class LabelSlider; -class QLabel; -class KeyframeNavigator; +#include "ui/graphview.h" +#include "ui/timelineheader.h" +#include "ui/labelslider.h" +#include "ui/keyframenavigator.h" +#include "project/effectrow.h" class GraphEditor : public QDockWidget { Q_OBJECT public: - GraphEditor(QWidget* parent = 0); + GraphEditor(QWidget* parent = nullptr); void update_panel(); void set_row(EffectRow* r); bool view_is_focused(); diff --git a/panels/panels.cpp b/panels/panels.cpp index 7e1dce1d8..98f92c5d3 100644 --- a/panels/panels.cpp +++ b/panels/panels.cpp @@ -136,7 +136,7 @@ void update_ui(bool modified) { QDockWidget *get_focused_panel(bool force_hover) { QDockWidget* w = nullptr; - if (config.hover_focus || force_hover) { + if (Olive::CurrentConfig.hover_focus || force_hover) { if (panel_project->underMouse()) { w = panel_project; } else if (panel_effect_controls->underMouse()) { diff --git a/panels/panels.h b/panels/panels.h index 62831b5c5..161699fde 100644 --- a/panels/panels.h +++ b/panels/panels.h @@ -27,10 +27,6 @@ #include "grapheditor.h" #include "project.h" -class QWidget; -class QDockWidget; -class QScrollBar; - extern Project* panel_project; extern EffectControls* panel_effect_controls; extern Viewer* panel_sequence_viewer; diff --git a/panels/project.cpp b/panels/project.cpp index 5e0d02962..0f3c543e7 100644 --- a/panels/project.cpp +++ b/panels/project.cpp @@ -22,10 +22,6 @@ #include "oliveglobal.h" -#include "project/projectelements.h" - -#include "panels/panels.h" - #include "playback/playback.h" #include "io/previewgenerator.h" #include "project/undo.h" @@ -93,7 +89,7 @@ Project::Project(QWidget *parent) : // optional toolbar toolbar_widget = new QWidget(); - toolbar_widget->setVisible(config.show_project_toolbar); + toolbar_widget->setVisible(Olive::CurrentConfig.show_project_toolbar); toolbar_widget->setObjectName("project_toolbar"); QHBoxLayout* toolbar = new QHBoxLayout(toolbar_widget); @@ -430,7 +426,7 @@ void Project::new_folder() { Olive::UndoStack.push(new AddMediaCommand(m, get_selected_folder())); QModelIndex index = project_model.create_index(m->row(), 0, m); - switch (config.project_view_type) { + switch (Olive::CurrentConfig.project_view_type) { case PROJECT_VIEW_TREE: tree_view->edit(sorter->mapFromSource(index)); break; @@ -682,7 +678,7 @@ void Project::process_file_list(QStringList& files, bool recursive, Media* repla QVector image_sequence_urls; QVector image_sequence_importassequence; - QStringList image_sequence_formats = config.img_seq_formats.split("|"); + QStringList image_sequence_formats = Olive::CurrentConfig.img_seq_formats.split("|"); if (!recursive) last_imported_media.clear(); @@ -871,7 +867,7 @@ bool Project::reveal_media(Media *media, QModelIndex parent) { // retrieve its parent item QModelIndex hierarchy = sorted_index.parent(); - if (config.project_view_type == PROJECT_VIEW_TREE) { + if (Olive::CurrentConfig.project_view_type == PROJECT_VIEW_TREE) { // if we're in tree view, expand every folder in the hierarchy containing the media while (hierarchy.isValid()) { @@ -886,7 +882,7 @@ bool Project::reveal_media(Media *media, QModelIndex parent) { ); tree_view->selectionModel()->select(row_select, QItemSelectionModel::Select); - } else if (config.project_view_type == PROJECT_VIEW_ICON) { + } else if (Olive::CurrentConfig.project_view_type == PROJECT_VIEW_ICON) { // if we're in icon view, we just "browse" to the parent folder icon_view->setRootIndex(hierarchy); @@ -1225,10 +1221,10 @@ void Project::save_project(bool autorecovery) { } void Project::update_view_type() { - tree_view->setVisible(config.project_view_type == PROJECT_VIEW_TREE); - icon_view_container->setVisible(config.project_view_type == PROJECT_VIEW_ICON); + tree_view->setVisible(Olive::CurrentConfig.project_view_type == PROJECT_VIEW_TREE); + icon_view_container->setVisible(Olive::CurrentConfig.project_view_type == PROJECT_VIEW_ICON); - switch (config.project_view_type) { + switch (Olive::CurrentConfig.project_view_type) { case PROJECT_VIEW_TREE: sources_common->view = tree_view; break; @@ -1239,12 +1235,12 @@ void Project::update_view_type() { } void Project::set_icon_view() { - config.project_view_type = PROJECT_VIEW_ICON; + Olive::CurrentConfig.project_view_type = PROJECT_VIEW_ICON; update_view_type(); } void Project::set_tree_view() { - config.project_view_type = PROJECT_VIEW_TREE; + Olive::CurrentConfig.project_view_type = PROJECT_VIEW_TREE; update_view_type(); } @@ -1328,7 +1324,7 @@ QVector Project::list_all_project_sequences() { } QModelIndexList Project::get_current_selected() { - if (config.project_view_type == PROJECT_VIEW_TREE) { + if (Olive::CurrentConfig.project_view_type == PROJECT_VIEW_TREE) { return panel_project->tree_view->selectionModel()->selectedRows(); } return panel_project->icon_view->selectionModel()->selectedIndexes(); diff --git a/panels/project.h b/panels/project.h index 33f0b7fe7..581fa1780 100644 --- a/panels/project.h +++ b/panels/project.h @@ -25,25 +25,21 @@ #include #include #include +#include +#include +#include +#include #include "project/projectmodel.h" #include "project/projectfilter.h" +#include "project/projectelements.h" +#include "project/undo.h" +#include "project/sourcescommon.h" +#include "ui/sourceiconview.h" -struct Footage; -struct Sequence; -class Clip; -class Timeline; -class Viewer; -class SourceTable; -class Media; -class QXmlStreamWriter; -class QXmlStreamReader; -class QFile; -class ProjectFilter; -class ComboAction; -class SourceIconView; -class QPushButton; -class SourcesCommon; +#include "panels.h" + +#include "ui/sourcetable.h" #define LOAD_TYPE_VERSION 69 #define LOAD_TYPE_URL 70 diff --git a/panels/timeline.cpp b/panels/timeline.cpp index d225e38c1..058f92600 100644 --- a/panels/timeline.cpp +++ b/panels/timeline.cpp @@ -335,7 +335,7 @@ void Timeline::add_clips_from_ghosts(ComboAction* ca, Sequence* s) { } } - if (config.add_default_effects_to_clips) { + if (Olive::CurrentConfig.add_default_effects_to_clips) { if (c->track < 0) { // add default video effects c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_TRANSFORM, EFFECT_TYPE_EFFECT))); @@ -346,7 +346,7 @@ void Timeline::add_clips_from_ghosts(ComboAction* ca, Sequence* s) { } } } - if (config.enable_seek_to_import) { + if (Olive::CurrentConfig.enable_seek_to_import) { panel_sequence_viewer->seek(earliest_point); } ghosts.clear(); @@ -504,13 +504,13 @@ void Timeline::repaint_timeline() { && panel_sequence_viewer->playing && !zoom_just_changed) { // auto scroll - if (config.autoscroll == AUTOSCROLL_PAGE_SCROLL) { + if (Olive::CurrentConfig.autoscroll == AUTOSCROLL_PAGE_SCROLL) { int playhead_x = getTimelineScreenPointFromFrame(Olive::ActiveSequence->playhead); if (playhead_x < 0 || playhead_x > (editAreas->width() - videoScrollbar->width())) { horizontalScrollBar->setValue(getScreenPointFromFrame(zoom, Olive::ActiveSequence->playhead)); draw = false; } - } else if (config.autoscroll == AUTOSCROLL_SMOOTH_SCROLL) { + } else if (Olive::CurrentConfig.autoscroll == AUTOSCROLL_SMOOTH_SCROLL) { if (center_scroll_to_playhead(horizontalScrollBar, zoom, Olive::ActiveSequence->playhead)) { draw = false; } @@ -1188,7 +1188,7 @@ void Timeline::paste(bool insert) { update_ui(true); - if (config.paste_seeks) { + if (Olive::CurrentConfig.paste_seeks) { panel_sequence_viewer->seek(paste_end); } } else if (clipboard_type == CLIPBOARD_TYPE_EFFECT) { @@ -1483,7 +1483,7 @@ void Timeline::ripple_delete() { if (Olive::ActiveSequence != nullptr) { if (Olive::ActiveSequence->selections.size() > 0) { panel_timeline->delete_selection(Olive::ActiveSequence->selections, true); - } else if (config.hover_focus && get_focused_panel() == panel_timeline) { + } else if (Olive::CurrentConfig.hover_focus && get_focused_panel() == panel_timeline) { if (panel_timeline->can_ripple_empty_space(panel_timeline->cursor_frame, panel_timeline->cursor_track)) { panel_timeline->ripple_delete_empty_space(); } diff --git a/panels/viewer.cpp b/panels/viewer.cpp index 8dd2acfce..5322d20f0 100644 --- a/panels/viewer.cpp +++ b/panels/viewer.cpp @@ -276,7 +276,7 @@ void Viewer::seek(long p) { if (main_sequence) { panel_timeline->scroll_to_frame(p); panel_effect_controls->scroll_to_frame(p); - if (config.seek_also_selects) { + if (Olive::CurrentConfig.seek_also_selects) { panel_timeline->select_from_playhead(); update_fx = true; } @@ -386,7 +386,7 @@ void Viewer::play(bool in_to_out) { playback_speed = 1; } - bool seek_to_in = (seq->using_workarea && (config.loop || playing_in_to_out)); + bool seek_to_in = (seq->using_workarea && (Olive::CurrentConfig.loop || playing_in_to_out)); if (!is_recording_cued() && playback_speed > 0 && (playing_in_to_out @@ -469,7 +469,7 @@ void Viewer::update_playhead_timecode(long p) { } void Viewer::update_end_timecode() { - end_timecode->setText((seq == nullptr) ? frame_to_timecode(0, config.timecode_view, 30) : frame_to_timecode(seq->getEndFrame(), config.timecode_view, seq->frame_rate)); + end_timecode->setText((seq == nullptr) ? frame_to_timecode(0, Olive::CurrentConfig.timecode_view, 30) : frame_to_timecode(seq->getEndFrame(), Olive::CurrentConfig.timecode_view, seq->frame_rate)); } void Viewer::update_header_zoom() { @@ -603,13 +603,13 @@ void Viewer::set_playback_speed(int s) { } long Viewer::get_seq_in() { - return ((config.loop || playing_in_to_out) && seq->using_workarea) + return ((Olive::CurrentConfig.loop || playing_in_to_out) && seq->using_workarea) ? seq->workarea_in : 0; } long Viewer::get_seq_out() { - return ((config.loop || playing_in_to_out) && seq->using_workarea && previous_playhead < seq->workarea_out) + return ((Olive::CurrentConfig.loop || playing_in_to_out) && seq->using_workarea && previous_playhead < seq->workarea_out) ? seq->workarea_out : seq->getEndFrame(); } @@ -801,8 +801,8 @@ void Viewer::timer_update() { previous_playhead = seq->playhead; seq->playhead = qMax(0, qRound(playhead_start + ((QDateTime::currentMSecsSinceEpoch()-start_msecs) * 0.001 * seq->frame_rate * playback_speed))); - if (config.seek_also_selects) panel_timeline->select_from_playhead(); - update_parents(config.seek_also_selects); + if (Olive::CurrentConfig.seek_also_selects) panel_timeline->select_from_playhead(); + update_parents(Olive::CurrentConfig.seek_also_selects); if (playing) { if (playback_speed < 0 && seq->playhead == 0) { @@ -816,7 +816,7 @@ void Viewer::timer_update() { pause(); } if (seq->using_workarea && seq->playhead >= seq->workarea_out) { - if (config.loop) { + if (Olive::CurrentConfig.loop) { // loop play(); } else if (playing_in_to_out) { diff --git a/playback/audio.cpp b/playback/audio.cpp index 86c446bd4..1ac0b519d 100644 --- a/playback/audio.cpp +++ b/playback/audio.cpp @@ -68,7 +68,7 @@ QAudioDeviceInfo get_audio_device(QAudio::Mode mode) { QList devs = QAudioDeviceInfo::availableDevices(mode); // try to retrieve preferred device from config - QString preferred_device = (mode == QAudio::AudioOutput) ? config.preferred_audio_output : config.preferred_audio_input; + QString preferred_device = (mode == QAudio::AudioOutput) ? Olive::CurrentConfig.preferred_audio_output : Olive::CurrentConfig.preferred_audio_input; if (!preferred_device.isEmpty()) { for (int i=0;iformat(); - if (config.recording_mode != audio_format.channelCount()) { - audio_format.setChannelCount(config.recording_mode); + if (Olive::CurrentConfig.recording_mode != audio_format.channelCount()) { + audio_format.setChannelCount(Olive::CurrentConfig.recording_mode); } QAudioDeviceInfo info = get_audio_device(QAudio::AudioInput); diff --git a/playback/cacher.cpp b/playback/cacher.cpp index 29ae8c029..c1f71985a 100644 --- a/playback/cacher.cpp +++ b/playback/cacher.cpp @@ -743,15 +743,15 @@ void open_clip_worker(Clip* clip) { clip->max_queue_size = 1; } else { clip->max_queue_size = 0; - if (config.upcoming_queue_type == FRAME_QUEUE_TYPE_FRAMES) { - clip->max_queue_size += qCeil(config.upcoming_queue_size); + if (Olive::CurrentConfig.upcoming_queue_type == FRAME_QUEUE_TYPE_FRAMES) { + clip->max_queue_size += qCeil(Olive::CurrentConfig.upcoming_queue_size); } else { - clip->max_queue_size += qCeil(ms->video_frame_rate * m->speed * config.upcoming_queue_size); + clip->max_queue_size += qCeil(ms->video_frame_rate * m->speed * Olive::CurrentConfig.upcoming_queue_size); } - if (config.previous_queue_type == FRAME_QUEUE_TYPE_FRAMES) { - clip->max_queue_size += qCeil(config.previous_queue_size); + if (Olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_FRAMES) { + clip->max_queue_size += qCeil(Olive::CurrentConfig.previous_queue_size); } else { - clip->max_queue_size += qCeil(ms->video_frame_rate * m->speed * config.previous_queue_size); + clip->max_queue_size += qCeil(ms->video_frame_rate * m->speed * Olive::CurrentConfig.previous_queue_size); } } diff --git a/playback/playback.cpp b/playback/playback.cpp index 843d58f72..d156d653b 100644 --- a/playback/playback.cpp +++ b/playback/playback.cpp @@ -200,8 +200,8 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) { int64_t minimum_ts = target_frame->pts; int previous_frame_count = 0; - if (config.previous_queue_type == FRAME_QUEUE_TYPE_SECONDS) { - minimum_ts -= (second_pts*config.previous_queue_size); + if (Olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_SECONDS) { + minimum_ts -= (second_pts*Olive::CurrentConfig.previous_queue_size); } //dout << "closest frame was" << closest_frame << "with" << target_frame->pts << "/" << target_pts; @@ -210,7 +210,7 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) { next_pts = c->queue.at(i)->pts; } if (c->queue.at(i) != target_frame && ((c->queue.at(i)->pts > minimum_ts) == c->reverse)) { - if (config.previous_queue_type == FRAME_QUEUE_TYPE_SECONDS) { + if (Olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_SECONDS) { //dout << "removed frame at" << i << "because its pts was" << c->queue.at(i)->pts << "compared to" << target_frame->pts; av_frame_free(&c->queue[i]); // may be a little heavy for the main thread? c->queue.removeAt(i); @@ -222,8 +222,8 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) { } } - if (config.previous_queue_type == FRAME_QUEUE_TYPE_FRAMES) { - while (previous_frame_count > qCeil(config.previous_queue_size)) { + if (Olive::CurrentConfig.previous_queue_type == FRAME_QUEUE_TYPE_FRAMES) { + while (previous_frame_count > qCeil(Olive::CurrentConfig.previous_queue_size)) { int smallest = 0; for (int i=1;iqueue.size();i++) { if (c->queue.at(i)->pts < c->queue.at(smallest)->pts) { @@ -257,7 +257,7 @@ void get_clip_frame(Clip* c, long playhead, bool& texture_failed) { #ifdef GCF_DEBUG dout << "GCF ==> RESET" << target_pts << "(" << target_frame->pts << "-" << target_frame->pts+target_frame->pkt_duration << ")"; #endif - if (!config.fast_seeking) target_frame = nullptr; + if (!Olive::CurrentConfig.fast_seeking) target_frame = nullptr; reset = true; c->last_invalid_ts = target_pts; } else { diff --git a/project/clip.cpp b/project/clip.cpp index e16007642..5ae72eb7f 100644 --- a/project/clip.cpp +++ b/project/clip.cpp @@ -49,7 +49,7 @@ Clip::Clip(Sequence* s) : speed(1.0), reverse(false), maintain_audio_pitch(false), - autoscale(config.autoscale_by_default), + autoscale(Olive::CurrentConfig.autoscale_by_default), opening_transition(-1), closing_transition(-1), undeletable(false), diff --git a/project/effect.cpp b/project/effect.cpp index e691b187b..d8d05e70a 100644 --- a/project/effect.cpp +++ b/project/effect.cpp @@ -774,7 +774,7 @@ void Effect::open() { qWarning() << "Tried to open an effect that was already open"; close(); } - if (runtime_config.shaders_are_enabled && enable_shader) { + if (Olive::CurrentRuntimeConfig.shaders_are_enabled && enable_shader) { if (QOpenGLContext::currentContext() == nullptr) { qWarning() << "No current context to create a shader program for - will retry next repaint"; } else { @@ -832,7 +832,7 @@ void Effect::startEffect() { open(); qWarning() << "Tried to start a closed effect - opening"; } - if (runtime_config.shaders_are_enabled + if (Olive::CurrentRuntimeConfig.shaders_are_enabled && enable_shader && glslProgram->isLinked()) { bound = glslProgram->bind(); diff --git a/project/effectfield.cpp b/project/effectfield.cpp index fe36e7db7..5cea2015f 100644 --- a/project/effectfield.cpp +++ b/project/effectfield.cpp @@ -70,7 +70,7 @@ EffectField::EffectField(EffectRow *parent, int t, const QString &i) : TextEditEx* edit = new TextEditEx(); // TODO magic number 2 - i'm not sure how to make this work otherwise though - edit->setFixedHeight(qCeil(edit->fontMetrics().lineSpacing()*config.effect_textbox_lines + edit->document()->documentMargin() + edit->document()->documentMargin() + 2)); + edit->setFixedHeight(qCeil(edit->fontMetrics().lineSpacing()*Olive::CurrentConfig.effect_textbox_lines + edit->document()->documentMargin() + edit->document()->documentMargin() + 2)); edit->setUndoRedoEnabled(true); ui_element = edit; diff --git a/project/effectloaders.cpp b/project/effectloaders.cpp index d34b5b25c..eaa93fc5b 100644 --- a/project/effectloaders.cpp +++ b/project/effectloaders.cpp @@ -39,7 +39,7 @@ typedef void (*f0rGetPluginInfo)(f0r_plugin_info_t* info); #endif void load_internal_effects() { - if (!runtime_config.shaders_are_enabled) qWarning() << "Shaders are disabled, some effects may be nonfunctional"; + if (!Olive::CurrentRuntimeConfig.shaders_are_enabled) qWarning() << "Shaders are disabled, some effects may be nonfunctional"; EffectMeta em; diff --git a/project/marker.cpp b/project/marker.cpp index ba93829a8..587f75acb 100644 --- a/project/marker.cpp +++ b/project/marker.cpp @@ -53,7 +53,7 @@ void set_marker_internal(Sequence* seq, const QVector& clips) { // add_marker is used to determine whether we're adding a marker, depending on whether the user input a marker name // however if (config.set_name_with_marker) is true, we don't need a marker name so we just add - bool add_marker = !config.set_name_with_marker; + bool add_marker = !Olive::CurrentConfig.set_name_with_marker; QString marker_name; diff --git a/project/media.cpp b/project/media.cpp index 31292dee6..5dc2d7833 100644 --- a/project/media.cpp +++ b/project/media.cpp @@ -305,7 +305,7 @@ QVariant Media::data(int column, int role) { if (root) return QCoreApplication::translate("Media", "Duration"); if (get_type() == MEDIA_TYPE_SEQUENCE) { Sequence* s = to_sequence(); - return frame_to_timecode(s->getEndFrame(), config.timecode_view, s->frame_rate); + return frame_to_timecode(s->getEndFrame(), Olive::CurrentConfig.timecode_view, s->frame_rate); } if (get_type() == MEDIA_TYPE_FOOTAGE) { Footage* f = to_footage(); @@ -315,7 +315,7 @@ QVariant Media::data(int column, int role) { r = f->video_tracks.at(0).video_frame_rate * f->speed; long len = f->get_length_in_frames(r); - if (len > 0) return frame_to_timecode(len, config.timecode_view, r); + if (len > 0) return frame_to_timecode(len, Olive::CurrentConfig.timecode_view, r); } break; case 2: diff --git a/project/sourcescommon.cpp b/project/sourcescommon.cpp index a6f23e282..176600906 100644 --- a/project/sourcescommon.cpp +++ b/project/sourcescommon.cpp @@ -269,7 +269,7 @@ void SourcesCommon::dropEvent(QWidget* parent, QDropEvent *event, const QModelIn && drop_item.isValid() && m->get_type() == MEDIA_TYPE_FOOTAGE && !QFileInfo(paths.at(0)).isDir() - && config.drop_on_media_to_replace + && Olive::CurrentConfig.drop_on_media_to_replace && QMessageBox::question( parent, tr("Replace Media"), diff --git a/ui/labelslider.cpp b/ui/labelslider.cpp index f7ef71813..8d65c1bf2 100644 --- a/ui/labelslider.cpp +++ b/ui/labelslider.cpp @@ -88,7 +88,7 @@ QString LabelSlider::valueToString() { } else { switch (display_type) { case LABELSLIDER_FRAMENUMBER: - return frame_to_timecode(long(v), config.timecode_view, frame_rate); + return frame_to_timecode(long(v), Olive::CurrentConfig.timecode_view, frame_rate); case LABELSLIDER_PERCENT: return QString::number((v*100), 'f', decimal_places).append("%"); case LABELSLIDER_DECIBEL: @@ -274,7 +274,7 @@ void LabelSlider::mouseReleaseEvent(QMouseEvent*) { if (s.isEmpty()) return; // parse string timecode to a frame number - d = timecode_to_frame(s, config.timecode_view, frame_rate); + d = timecode_to_frame(s, Olive::CurrentConfig.timecode_view, frame_rate); } else { diff --git a/ui/menuhelper.cpp b/ui/menuhelper.cpp index 05dd5370a..9a470fb66 100644 --- a/ui/menuhelper.cpp +++ b/ui/menuhelper.cpp @@ -100,23 +100,23 @@ void MenuHelper::set_titlesafe_from_menu() { if (qIsNaN(tsa)) { // disable title safe area - config.show_title_safe_area = false; + Olive::CurrentConfig.show_title_safe_area = false; } else { // using title safe area - config.show_title_safe_area = true; + Olive::CurrentConfig.show_title_safe_area = true; // are we using the default area aspect ratio, or a specific one if (qIsNull(tsa)) { // default title safe area - config.use_custom_title_safe_ratio = false; + Olive::CurrentConfig.use_custom_title_safe_ratio = false; } else { // using a specific aspect ratio - config.use_custom_title_safe_ratio = true; + Olive::CurrentConfig.use_custom_title_safe_ratio = true; if (tsa < 0.0) { @@ -136,13 +136,13 @@ void MenuHelper::set_titlesafe_from_menu() { if (!input.isEmpty()) { QStringList inputList = input.split(':'); - config.custom_title_safe_ratio = inputList.at(0).toDouble()/inputList.at(1).toDouble(); + Olive::CurrentConfig.custom_title_safe_ratio = inputList.at(0).toDouble()/inputList.at(1).toDouble(); } } else { // specified tsa is a specific custom aspect ratio - config.custom_title_safe_ratio = tsa; + Olive::CurrentConfig.custom_title_safe_ratio = tsa; } } @@ -154,7 +154,7 @@ void MenuHelper::set_titlesafe_from_menu() { void MenuHelper::set_autoscroll() { QAction* action = static_cast(sender()); - config.autoscroll = action->data().toInt(); + Olive::CurrentConfig.autoscroll = action->data().toInt(); } void MenuHelper::menu_click_button() { @@ -163,7 +163,7 @@ void MenuHelper::menu_click_button() { void MenuHelper::set_timecode_view() { QAction* action = static_cast(sender()); - config.timecode_view = action->data().toInt(); + Olive::CurrentConfig.timecode_view = action->data().toInt(); update_ui(false); } diff --git a/ui/renderfunctions.cpp b/ui/renderfunctions.cpp index fb597f076..725b56708 100644 --- a/ui/renderfunctions.cpp +++ b/ui/renderfunctions.cpp @@ -112,7 +112,7 @@ void process_effect(Clip* c, if (e->enable_coords) { e->process_coords(timecode, coords, data); } - bool can_process_shaders = (e->enable_shader && runtime_config.shaders_are_enabled); + bool can_process_shaders = (e->enable_shader && Olive::CurrentRuntimeConfig.shaders_are_enabled); if (can_process_shaders || e->enable_superimpose) { e->startEffect(); if (can_process_shaders && e->is_glsl_linked()) { @@ -506,7 +506,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) { // copy front buffer to back buffer (only if we're using blending modes - which we usually will be) - if (!runtime_config.disable_blending) { + if (!Olive::CurrentRuntimeConfig.disable_blending) { if (params.nests.size() > 0) { draw_clip(params.ctx, params.nests.last()->fbo[2]->handle(), params.nests.last()->fbo[0]->texture(), true); } else { @@ -523,7 +523,7 @@ GLuint compose_sequence(ComposeSequenceParams ¶ms) { // bind front buffer as draw buffer params.ctx->functions()->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, final_fbo); - if (runtime_config.disable_blending) { + if (Olive::CurrentRuntimeConfig.disable_blending) { // some GPUs don't like the blending shader, so we provide a pure GL fallback here params.ctx->functions()->glBindTexture(GL_TEXTURE_2D, backend_tex_1); diff --git a/ui/renderfunctions.h b/ui/renderfunctions.h index 2ad96b472..2197a59ee 100644 --- a/ui/renderfunctions.h +++ b/ui/renderfunctions.h @@ -42,7 +42,7 @@ struct ComposeSequenceParams { * * Primarily used for calling Viewer::play_wake() when appropriate. */ - Viewer* viewer; + Viewer* viewer; /** * @brief The OpenGL context to use while rendering. @@ -51,7 +51,7 @@ struct ComposeSequenceParams { * * \see ComposeSequenceParams::video */ - QOpenGLContext* ctx; + QOpenGLContext* ctx; /** * @brief The sequence to compose @@ -59,7 +59,7 @@ struct ComposeSequenceParams { * In addition to clips, sequences also contain the playhead position so compose_sequence() knows which frame * to render. */ - Sequence* seq; + Sequence* seq; /** * @brief Array to store the nested sequence hierarchy @@ -67,7 +67,7 @@ struct ComposeSequenceParams { * Should be left empty. This array gets passed around compose_sequence() as it calls itself recursively to * handle nested sequences. */ - QVector nests; + QVector nests; /** * @brief Set compose mode to video or audio @@ -82,7 +82,7 @@ struct ComposeSequenceParams { * A pointer to a pointer that will be set to the Effect whose gizmos are being rendered and should therefore * be interacted with if the user uses them. */ - Effect** gizmos; + Effect** gizmos; /** * @brief A variable that compose_sequence() will set to **TRUE** if any of the clips couldn't be shown. @@ -104,7 +104,7 @@ struct ComposeSequenceParams { * This may be preferable. See ComposeSequenceParams::single_threaded for a similar function that could be * removed. */ - bool texture_failed; + bool texture_failed; /** * @brief Run all cachers in the same thread that compose_sequence() is in @@ -129,7 +129,7 @@ struct ComposeSequenceParams { * * \see ComposeSequenceParams::video */ - int playback_speed; + int playback_speed; /** * @brief Blending mode shader @@ -142,7 +142,7 @@ struct ComposeSequenceParams { * * \see ComposeSequenceParams::video */ - QOpenGLShaderProgram* blend_mode_program; + QOpenGLShaderProgram* blend_mode_program; /** * @brief Premultiply alpha shader @@ -154,7 +154,7 @@ struct ComposeSequenceParams { * premultiplied (see Footage::alpha_is_premultiplied) using this shader. Must be compiled and linked beforehand. * See RenderThread::premultiply_program for how this is properly set up. */ - QOpenGLShaderProgram* premultiply_program; + QOpenGLShaderProgram* premultiply_program; /** * @brief The OpenGL framebuffer object that the final texture to be shown is rendered to. @@ -163,7 +163,7 @@ struct ComposeSequenceParams { * * When compose_sequence() is rendering the final image, this framebuffer will be bound. */ - GLuint main_buffer; + GLuint main_buffer; /** * @brief The attachment to the framebuffer in main_buffer @@ -172,7 +172,7 @@ struct ComposeSequenceParams { * * The OpenGL texture attached to the framebuffer referenced by main_buffer. */ - GLuint main_attachment; + GLuint main_attachment; /** * @brief Backend OpenGL framebuffer 1 used for further processing before rendering to main_buffer @@ -180,7 +180,7 @@ struct ComposeSequenceParams { * In some situations, compose_sequence() will do some processing through shaders that requires "ping-ponging" * between framebuffers. backend_buffer1 and backend_buffer2 are used for this purpose. */ - GLuint backend_buffer1; + GLuint backend_buffer1; /** * @brief Backend OpenGL framebuffer 1's texture attachment @@ -188,7 +188,7 @@ struct ComposeSequenceParams { * The texture that ComposeSequenceParams::backend_buffer1 renders to. Bound and drawn to * ComposeSequenceParams::backend_buffer2 to "ping-pong" between them and various shaders. */ - GLuint backend_attachment1; + GLuint backend_attachment1; /** * @brief Backend OpenGL framebuffer 2 used for further processing before rendering to main_buffer @@ -196,7 +196,7 @@ struct ComposeSequenceParams { * In some situations, compose_sequence() will do some processing through shaders that requires "ping-ponging" * between framebuffers. backend_buffer1 and backend_buffer2 are used for this purpose. */ - GLuint backend_buffer2; + GLuint backend_buffer2; /** * @brief Backend OpenGL framebuffer 2's texture attachment @@ -204,7 +204,17 @@ struct ComposeSequenceParams { * The texture that ComposeSequenceParams::backend_buffer2 renders to. Bound and drawn to * ComposeSequenceParams::backend_buffer1 to "ping-pong" between them and various shaders. */ - GLuint backend_attachment2; + GLuint backend_attachment2; + + /** + * @brief OpenGL shader containing OpenColorIO shader information + */ + QOpenGLShaderProgram* ocio_shader; + + /** + * @brief OpenGL texture containing LUT obtained form OpenColorIO + */ + GLuint ocio_lut_texture; }; /** diff --git a/ui/renderthread.cpp b/ui/renderthread.cpp index d5136b59b..66af9046b 100644 --- a/ui/renderthread.cpp +++ b/ui/renderthread.cpp @@ -29,6 +29,12 @@ #include "playback/playback.h" #include "project/sequence.h" +// copied from source code to OCIODisplay +#define LUT3D_EDGE_SIZE 32 + +// copied from source code to OCIODisplay, expanded from 3*LUT3D_EDGE_SIZE*LUT3D_EDGE_SIZE*LUT3D_EDGE_SIZE +#define NUM_3D_ENTRIES 98304 + RenderThread::RenderThread() : front_buffer(0), front_texture(0), diff --git a/ui/renderthread.h b/ui/renderthread.h index de67edd83..4c2288098 100644 --- a/ui/renderthread.h +++ b/ui/renderthread.h @@ -29,6 +29,12 @@ #include #include +// copied from source code to OCIODisplay +#define LUT3D_EDGE_SIZE 32 + +// copied from source code to OCIODisplay, expanded from 3*LUT3D_EDGE_SIZE*LUT3D_EDGE_SIZE*LUT3D_EDGE_SIZE +#define NUM_3D_ENTRIES 98304 + struct Sequence; class Effect; @@ -70,6 +76,8 @@ private: GLuint back_texture_1; GLuint back_texture_2; + float ocio_lut_data[NUM_3D_ENTRIES]; + Sequence* seq; int divider; int tex_width; diff --git a/ui/scrollarea.cpp b/ui/scrollarea.cpp index f2c512208..3e41fcba1 100644 --- a/ui/scrollarea.cpp +++ b/ui/scrollarea.cpp @@ -30,7 +30,7 @@ ScrollArea::ScrollArea(QWidget* parent) : QScrollArea(parent) {} void ScrollArea::wheelEvent(QWheelEvent *e) { - if (config.scroll_zooms) { + if (Olive::CurrentConfig.scroll_zooms) { e->ignore(); if (e->angleDelta().y() > 0) { diff --git a/ui/timelineheader.cpp b/ui/timelineheader.cpp index 54eb1b218..a6a9c9639 100644 --- a/ui/timelineheader.cpp +++ b/ui/timelineheader.cpp @@ -372,14 +372,14 @@ void TimelineHeader::paintEvent(QPaintEvent*) { // draw text bool draw_text = false; if (text_enabled && lineX-textWidth > lastTextBoundary) { - timecode = frame_to_timecode(frame + in_visible, config.timecode_view, viewer->seq->frame_rate); + timecode = frame_to_timecode(frame + in_visible, Olive::CurrentConfig.timecode_view, viewer->seq->frame_rate); fullTextWidth = fm.width(timecode); textWidth = fullTextWidth>>1; text_x = lineX; // centers the text to that point on the timeline, LEFT aligns it if not - if (config.center_timeline_timecodes) { + if (Olive::CurrentConfig.center_timeline_timecodes) { text_x -= textWidth; } else { text_x += TEXT_PADDING_FROM_LINE; @@ -399,7 +399,7 @@ void TimelineHeader::paintEvent(QPaintEvent*) { // draw line markers p.setPen(Qt::gray); - p.drawLine(lineX, (!config.center_timeline_timecodes && draw_text) ? 0 : yoff, lineX, height()); + p.drawLine(lineX, (!Olive::CurrentConfig.center_timeline_timecodes && draw_text) ? 0 : yoff, lineX, height()); // draw sub-line markers for (int j=1;jsetCheckable(true); - center_timecodes->setChecked(config.center_timeline_timecodes); - center_timecodes->setData(reinterpret_cast(&config.center_timeline_timecodes)); + center_timecodes->setChecked(Olive::CurrentConfig.center_timeline_timecodes); + center_timecodes->setData(reinterpret_cast(&Olive::CurrentConfig.center_timeline_timecodes)); menu.exec(mapToGlobal(pos)); } diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp index 3a4e9bd64..6e3c8cfb7 100644 --- a/ui/timelinewidget.cpp +++ b/ui/timelinewidget.cpp @@ -30,7 +30,6 @@ #include "ui/sourceiconview.h" #include "project/undo.h" #include "ui/viewerwidget.h" -#include "dialogs/stabilizerdialog.h" #include "ui/resizablescrollbar.h" #include "dialogs/newsequencedialog.h" #include "mainwindow.h" @@ -207,9 +206,9 @@ void TimelineWidget::tooltip_timer_timeout() { QToolTip::showText(QCursor::pos(), tr("%1\nStart: %2\nEnd: %3\nDuration: %4").arg( c->name, - frame_to_timecode(c->timeline_in, config.timecode_view, Olive::ActiveSequence->frame_rate), - frame_to_timecode(c->timeline_out, config.timecode_view, Olive::ActiveSequence->frame_rate), - frame_to_timecode(c->getLength(), config.timecode_view, Olive::ActiveSequence->frame_rate) + frame_to_timecode(c->timeline_in, Olive::CurrentConfig.timecode_view, Olive::ActiveSequence->frame_rate), + frame_to_timecode(c->timeline_out, Olive::CurrentConfig.timecode_view, Olive::ActiveSequence->frame_rate), + frame_to_timecode(c->getLength(), Olive::CurrentConfig.timecode_view, Olive::ActiveSequence->frame_rate) )); } } @@ -242,11 +241,6 @@ void TimelineWidget::rename_clip() { } } -void TimelineWidget::show_stabilizer_diag() { - StabilizerDialog sd; - sd.exec(); -} - void TimelineWidget::open_sequence_properties() { QList sequence_items; QList all_top_level_items; @@ -291,7 +285,7 @@ void TimelineWidget::dragEnterEvent(QDragEnterEvent *event) { } } - if (config.enable_drag_files_to_timeline && event->mimeData()->hasUrls()) { + if (Olive::CurrentConfig.enable_drag_files_to_timeline && event->mimeData()->hasUrls()) { QList urls = event->mimeData()->urls(); if (!urls.isEmpty()) { QStringList file_list; @@ -385,7 +379,7 @@ void TimelineWidget::wheelEvent(QWheelEvent *event) { int scroll_amount = alt ? (event->angleDelta().x()) : (event->angleDelta().y()); bool in = (scroll_amount > 0); - if (config.scroll_zooms != shift) { + if (Olive::CurrentConfig.scroll_zooms != shift) { // if config.scroll_zooms is enabled or shift is held, zoom instead of scrolling if (in) { @@ -710,7 +704,7 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) { s.track = clip->track; Olive::ActiveSequence->selections.append(s); - if (config.select_also_seeks) { + if (Olive::CurrentConfig.select_also_seeks) { panel_sequence_viewer->seek(clip->timeline_in); } @@ -749,7 +743,7 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) { panel_timeline->drag_y_start = pos.y(); break; case TIMELINE_TOOL_EDIT: - if (config.edit_tool_also_seeks) panel_sequence_viewer->seek(panel_timeline->drag_frame_start); + if (Olive::CurrentConfig.edit_tool_also_seeks) panel_sequence_viewer->seek(panel_timeline->drag_frame_start); panel_timeline->selecting = true; break; case TIMELINE_TOOL_RAZOR: @@ -844,7 +838,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) { add.append(c); ca->append(new AddClipCommand(Olive::ActiveSequence, add)); - if (c->track < 0 && config.add_default_effects_to_clips) { + if (c->track < 0 && Olive::CurrentConfig.add_default_effects_to_clips) { // default video effects (before custom effects) c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_TRANSFORM, EFFECT_TYPE_EFFECT))); } @@ -876,7 +870,7 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) { break; } - if (c->track >= 0 && config.add_default_effects_to_clips) { + if (c->track >= 0 && Olive::CurrentConfig.add_default_effects_to_clips) { // default audio effects (after custom effects) c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_VOLUME, EFFECT_TYPE_EFFECT))); c->effects.append(create_effect(c, get_internal_meta(EFFECT_INTERNAL_PAN, EFFECT_TYPE_EFFECT))); @@ -1615,9 +1609,9 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { } if (panel_timeline->importing) { - QToolTip::showText(mapToGlobal(mouse_pos), frame_to_timecode(earliest_in_point, config.timecode_view, Olive::ActiveSequence->frame_rate)); + QToolTip::showText(mapToGlobal(mouse_pos), frame_to_timecode(earliest_in_point, Olive::CurrentConfig.timecode_view, Olive::ActiveSequence->frame_rate)); } else { - QString tip = ((frame_diff < 0) ? "-" : "+") + frame_to_timecode(qAbs(frame_diff), config.timecode_view, Olive::ActiveSequence->frame_rate); + QString tip = ((frame_diff < 0) ? "-" : "+") + frame_to_timecode(qAbs(frame_diff), Olive::CurrentConfig.timecode_view, Olive::ActiveSequence->frame_rate); if (panel_timeline->trim_target > -1) { // find which clip is being moved const Ghost* g = nullptr; @@ -1636,7 +1630,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { } else { len += frame_diff; } - tip += frame_to_timecode(len, config.timecode_view, Olive::ActiveSequence->frame_rate); + tip += frame_to_timecode(len, Olive::CurrentConfig.timecode_view, Olive::ActiveSequence->frame_rate); } } QToolTip::showText(mapToGlobal(mouse_pos), tip); @@ -1656,7 +1650,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { if (!panel_timeline->moving_init) track_resizing = false; if (isLiveEditing()) { - panel_timeline->snap_to_timeline(&panel_timeline->cursor_frame, !config.edit_tool_also_seeks || !panel_timeline->selecting, true, true); + panel_timeline->snap_to_timeline(&panel_timeline->cursor_frame, !Olive::CurrentConfig.edit_tool_also_seeks || !panel_timeline->selecting, true, true); } if (panel_timeline->selecting) { int selection_count = 1 + qMax(panel_timeline->cursor_track, panel_timeline->drag_track_start) - qMin(panel_timeline->cursor_track, panel_timeline->drag_track_start) + panel_timeline->selection_offset; @@ -1674,7 +1668,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { } // select linked clips too - if (config.edit_tool_selects_links) { + if (Olive::CurrentConfig.edit_tool_selects_links) { for (int j=0;jclips.size();j++) { Clip* c = Olive::ActiveSequence->clips.at(j); for (int k=0;kselections.size();k++) { @@ -1710,7 +1704,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { } } - if (config.edit_tool_also_seeks) { + if (Olive::CurrentConfig.edit_tool_also_seeks) { panel_sequence_viewer->seek(qMin(panel_timeline->drag_frame_start, panel_timeline->cursor_frame)); } else { panel_timeline->repaint_timeline(); @@ -2208,7 +2202,7 @@ void TimelineWidget::mouseMoveEvent(QMouseEvent *event) { int mouse_pos = pos.y() + scroll; if (mouse_pos > y_test_value-test_range && mouse_pos < y_test_value+test_range) { // if track lines are hidden, only resize track if a clip is already there - if (config.show_track_lines || cursor_contains_clip) { + if (Olive::CurrentConfig.show_track_lines || cursor_contains_clip) { found = true; track_resizing = true; track_target = track; @@ -2306,7 +2300,7 @@ void draw_waveform(Clip* clip, const FootageStream* ms, long media_length, QPain } for (int j=0;jaudio_channels;j++) { - int mid = (config.rectified_waveforms) ? clip_rect.top()+channel_height*(j+1) : clip_rect.top()+channel_height*j+(channel_height/2); + int mid = (Olive::CurrentConfig.rectified_waveforms) ? clip_rect.top()+channel_height*(j+1) : clip_rect.top()+channel_height*j+(channel_height/2); int offset_range_start = last_waveform_index+(j*2); int offset_range_end = waveform_index+(j*2); @@ -2323,7 +2317,7 @@ void draw_waveform(Clip* clip, const FootageStream* ms, long media_length, QPain } // draw waveforms - if (config.rectified_waveforms) { + if (Olive::CurrentConfig.rectified_waveforms) { // rectified waveforms start from the bottom and draw upwards p->drawLine(clip_rect.left()+i, mid, clip_rect.left()+i, mid - (max - min)); @@ -2695,7 +2689,7 @@ void TimelineWidget::paintEvent(QPaintEvent*) { } // Draw track lines - if (config.show_track_lines) { + if (Olive::CurrentConfig.show_track_lines) { p.setPen(QColor(0, 0, 0, 96)); audio_track_limit++; if (video_track_limit == 0) video_track_limit--; @@ -2842,7 +2836,7 @@ int TimelineWidget::getTrackFromScreenPoint(int y) { int counter = ((!bottom_align && y > 0) || (bottom_align && y < 0)) ? 0 : -1; int track_height = panel_timeline->calculate_track_height(counter, -1); while (qAbs(y) > height_measure+track_height) { - if (config.show_track_lines && counter != -1) y--; + if (Olive::CurrentConfig.show_track_lines && counter != -1) y--; height_measure += track_height; if ((!bottom_align && y > 0) || (bottom_align && y < 0)) { counter++; @@ -2861,7 +2855,7 @@ int TimelineWidget::getScreenPointFromTrack(int track) { if (bottom_align) counter--; y += panel_timeline->calculate_track_height(counter, -1); if (!bottom_align) counter++; - if (config.show_track_lines && counter != -1) y++; + if (Olive::CurrentConfig.show_track_lines && counter != -1) y++; } y++; return (bottom_align) ? height() - y - scroll : y - scroll; diff --git a/ui/timelinewidget.h b/ui/timelinewidget.h index e4a6f49bb..3fc352a6a 100644 --- a/ui/timelinewidget.h +++ b/ui/timelinewidget.h @@ -103,8 +103,7 @@ private slots: void show_context_menu(const QPoint& pos); void toggle_autoscale(); void tooltip_timer_timeout(); - void rename_clip(); - void show_stabilizer_diag(); + void rename_clip(); void open_sequence_properties(); }; diff --git a/ui/viewerwidget.cpp b/ui/viewerwidget.cpp index 695552a41..26bfeb345 100644 --- a/ui/viewerwidget.cpp +++ b/ui/viewerwidget.cpp @@ -426,11 +426,11 @@ void ViewerWidget::draw_title_safe_area() { double viewportAr = (double) width() / (double) height(); double halfAr = viewportAr*0.5; - if (config.use_custom_title_safe_ratio && config.custom_title_safe_ratio > 0) { - if (config.custom_title_safe_ratio > viewportAr) { - halfHeight = (config.custom_title_safe_ratio/viewportAr)*0.5; + if (Olive::CurrentConfig.use_custom_title_safe_ratio && Olive::CurrentConfig.custom_title_safe_ratio > 0) { + if (Olive::CurrentConfig.custom_title_safe_ratio > viewportAr) { + halfHeight = (Olive::CurrentConfig.custom_title_safe_ratio/viewportAr)*0.5; } else { - halfWidth = (viewportAr/config.custom_title_safe_ratio)*0.5; + halfWidth = (viewportAr/Olive::CurrentConfig.custom_title_safe_ratio)*0.5; } } @@ -609,7 +609,7 @@ void ViewerWidget::paintGL() { glBindTexture(GL_TEXTURE_2D, 0); // draw title/action safe area - if (config.show_title_safe_area) { + if (Olive::CurrentConfig.show_title_safe_area) { draw_title_safe_area(); }