switched global to unique ptr and renamed olive namespace

This commit is contained in:
itsmattkc
2019-02-16 15:08:33 -08:00
parent 3d0a65c70d
commit e063a5ba8f
65 changed files with 860 additions and 860 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ ActionSearch::ActionSearch(QWidget *parent) :
void ActionSearch::search_update(const QString &s, const QString &p, QMenu *parent) {
if (parent == nullptr) {
list_widget->clear();
QList<QAction*> menus = Olive::MainWindow->menuBar()->actions();
QList<QAction*> menus = olive::MainWindow->menuBar()->actions();
for (int i=0;i<menus.size();i++) {
QMenu* menu = menus.at(i)->menu();
search_update(s, p, menu);
+1 -1
View File
@@ -26,7 +26,7 @@
#include "debug.h"
DebugDialog* Olive::DebugDialog = nullptr;
DebugDialog* olive::DebugDialog = nullptr;
DebugDialog::DebugDialog(QWidget *parent) : QDialog(parent) {
setWindowTitle(tr("Debug Log"));
+1 -1
View File
@@ -36,7 +36,7 @@ private:
QTextEdit* textEdit;
};
namespace Olive {
namespace olive {
extern DebugDialog* DebugDialog;
}
+13 -13
View File
@@ -70,11 +70,11 @@ enum ExportFormats {
ExportDialog::ExportDialog(QWidget *parent) :
QDialog(parent)
{
setWindowTitle(tr("Export \"%1\"").arg(Olive::ActiveSequence->name));
setWindowTitle(tr("Export \"%1\"").arg(olive::ActiveSequence->name));
setup_ui();
rangeCombobox->setCurrentIndex(0);
if (Olive::ActiveSequence->using_workarea) {
if (olive::ActiveSequence->using_workarea) {
rangeCombobox->setEnabled(true);
rangeCombobox->setCurrentIndex(1);
}
@@ -107,10 +107,10 @@ ExportDialog::ExportDialog(QWidget *parent) :
}
formatCombobox->setCurrentIndex(FORMAT_MPEG4);
widthSpinbox->setValue(Olive::ActiveSequence->width);
heightSpinbox->setValue(Olive::ActiveSequence->height);
samplingRateSpinbox->setValue(Olive::ActiveSequence->audio_frequency);
framerateSpinbox->setValue(Olive::ActiveSequence->frame_rate);
widthSpinbox->setValue(olive::ActiveSequence->width);
heightSpinbox->setValue(olive::ActiveSequence->height);
samplingRateSpinbox->setValue(olive::ActiveSequence->audio_frequency);
framerateSpinbox->setValue(olive::ActiveSequence->frame_rate);
}
ExportDialog::~ExportDialog()
@@ -524,10 +524,10 @@ void ExportDialog::export_action() {
}
params.start_frame = 0;
params.end_frame = Olive::ActiveSequence->getEndFrame(); // entire sequence
params.end_frame = olive::ActiveSequence->getEndFrame(); // entire sequence
if (rangeCombobox->currentIndex() == 1) {
params.start_frame = qMax(Olive::ActiveSequence->workarea_in, params.start_frame);
params.end_frame = qMin(Olive::ActiveSequence->workarea_out, params.end_frame);
params.start_frame = qMax(olive::ActiveSequence->workarea_in, params.start_frame);
params.end_frame = qMin(olive::ActiveSequence->workarea_out, params.end_frame);
}
et = new ExportThread(params, vcodec_params, this);
@@ -535,11 +535,11 @@ void ExportDialog::export_action() {
connect(et, SIGNAL(finished()), this, SLOT(render_thread_finished()));
connect(et, SIGNAL(progress_changed(int, qint64)), this, SLOT(update_progress_bar(int, qint64)));
closeActiveClips(Olive::ActiveSequence);
closeActiveClips(olive::ActiveSequence);
Olive::Global.data()->set_rendering_state(true);
olive::Global->set_rendering_state(true);
Olive::Global.data()->save_autorecovery_file();
olive::Global->save_autorecovery_file();
prep_ui_for_render(true);
@@ -605,7 +605,7 @@ void ExportDialog::comp_type_changed(int) {
case COMPRESSION_TYPE_CBR:
case COMPRESSION_TYPE_TARGETBR:
videoBitrateLabel->setText(tr("Bitrate (Mbps):"));
videobitrateSpinbox->setValue(qMax(0.5, (double) qRound((0.01528 * Olive::ActiveSequence->height) - 4.5)));
videobitrateSpinbox->setValue(qMax(0.5, (double) qRound((0.01528 * olive::ActiveSequence->height) - 4.5)));
break;
case COMPRESSION_TYPE_CFR:
videoBitrateLabel->setText(tr("Quality (CRF):"));
+2 -2
View File
@@ -38,7 +38,7 @@ LoadDialog::LoadDialog(QWidget *parent, bool autorecovery) : QDialog(parent) {
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(new QLabel(tr("Loading '%1'...").arg(Olive::ActiveProjectFilename.mid(Olive::ActiveProjectFilename.lastIndexOf('/')+1)), this));
layout->addWidget(new QLabel(tr("Loading '%1'...").arg(olive::ActiveProjectFilename.mid(olive::ActiveProjectFilename.lastIndexOf('/')+1)), this));
bar = new QProgressBar(this);
bar->setValue(0);
@@ -70,7 +70,7 @@ void LoadDialog::cancel() {
}
void LoadDialog::die() {
Olive::Global.data()->new_project();
olive::Global->new_project();
reject();
}
+1 -1
View File
@@ -205,7 +205,7 @@ void MediaPropertiesDialog::accept() {
}
ca->appendPost(new UpdateViewer());
Olive::UndoStack.push(ca);
olive::UndoStack.push(ca);
QDialog::accept();
}
+2 -2
View File
@@ -96,7 +96,7 @@ void NewSequenceDialog::create() {
ComboAction* ca = new ComboAction();
panel_project->create_sequence_internal(ca, s, true, nullptr);
Olive::UndoStack.push(ca);
olive::UndoStack.push(ca);
} else {
ComboAction* ca = new ComboAction();
@@ -118,7 +118,7 @@ void NewSequenceDialog::create() {
}
}
Olive::UndoStack.push(ca);
olive::UndoStack.push(ca);
}
accept();
+52 -52
View File
@@ -83,10 +83,10 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) :
setWindowTitle(tr("Preferences"));
setup_ui();
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);
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 (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()) {
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
@@ -204,7 +204,7 @@ void PreferencesDialog::save() {
} else if (ret == QMessageBox::Yes) {
// Check if we can close the current project. If not, we'll treat it as if the user clicked "Cancel".
if (Olive::Global->can_close_project()) {
if (olive::Global->can_close_project()) {
restart_after_saving = true;
} else {
return;
@@ -215,51 +215,51 @@ void PreferencesDialog::save() {
}
// Audio settings may require the audio device to be re-initiated.
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()) {
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
Olive::CurrentConfig.css_path = custom_css_fn->text();
Olive::MainWindow->load_css_from_file(Olive::CurrentConfig.css_path);
olive::CurrentConfig.css_path = custom_css_fn->text();
olive::MainWindow->load_css_from_file(olive::CurrentConfig.css_path);
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();
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();
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();
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();
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.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 (Olive::CurrentConfig.thumbnail_resolution != thumbnail_res_spinbox->value()
|| Olive::CurrentConfig.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 (Olive::CurrentConfig.thumbnail_resolution != thumbnail_res_spinbox->value()) {
if (olive::CurrentConfig.thumbnail_resolution != thumbnail_res_spinbox->value()) {
// delete existing thumbnails
Olive::CurrentConfig.thumbnail_resolution = thumbnail_res_spinbox->value();
olive::CurrentConfig.thumbnail_resolution = thumbnail_res_spinbox->value();
// delete only thumbnails
delete_match = 't';
}
if (Olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value()) {
if (olive::CurrentConfig.waveform_resolution != waveform_res_spinbox->value()) {
// delete existing waveforms
Olive::CurrentConfig.waveform_resolution = waveform_res_spinbox->value();
olive::CurrentConfig.waveform_resolution = waveform_res_spinbox->value();
// if we're already deleting thumbnails
if (delete_match == 't') {
@@ -288,11 +288,11 @@ void PreferencesDialog::save() {
if (restart_after_saving) {
// since we already ran can_close_project(), bypass checking again by running setWindowModified(false)
Olive::MainWindow->setWindowModified(false);
olive::MainWindow->setWindowModified(false);
Olive::MainWindow->close();
olive::MainWindow->close();
QProcess::startDetached(QApplication::applicationFilePath(), { Olive::ActiveProjectFilename });
QProcess::startDetached(QApplication::applicationFilePath(), { olive::ActiveProjectFilename });
}
}
@@ -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 (Olive::CurrentConfig.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(Olive::CurrentConfig.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(Olive::CurrentConfig.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(Olive::CurrentConfig.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(Olive::CurrentConfig.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(Olive::CurrentConfig.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(Olive::CurrentConfig.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(Olive::CurrentConfig.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(Olive::CurrentConfig.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(Olive::CurrentConfig.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(Olive::CurrentConfig.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;i<devs.size();i++) {
audio_output_devices->addItem(devs.at(i).deviceName(), devs.at(i).deviceName());
if (!found_preferred_device
&& devs.at(i).deviceName() == Olive::CurrentConfig.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;i<devs.size();i++) {
audio_input_devices->addItem(devs.at(i).deviceName(), devs.at(i).deviceName());
if (!found_preferred_device
&& devs.at(i).deviceName() == Olive::CurrentConfig.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;i<audio_sample_rate->count();i++) {
if (audio_sample_rate->itemData(i).toInt() == Olive::CurrentConfig.audio_rate) {
if (audio_sample_rate->itemData(i).toInt() == olive::CurrentConfig.audio_rate) {
audio_sample_rate->setCurrentIndex(i);
break;
}
+1 -1
View File
@@ -152,7 +152,7 @@ void ProxyDialog::accept() {
proxy_generator.queue(info_list.at(i));
}
Olive::MainWindow->setWindowModified(true);
olive::MainWindow->setWindowModified(true);
QDialog::accept();
}
+4 -4
View File
@@ -96,7 +96,7 @@ void ReplaceClipMediaDialog::replace() {
QMessageBox::Ok
);
} else {
if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && Olive::ActiveSequence == new_item->to_sequence()) {
if (new_item->get_type() == MEDIA_TYPE_SEQUENCE && olive::ActiveSequence == new_item->to_sequence()) {
QMessageBox::critical(
this,
tr("Active sequence selected"),
@@ -110,14 +110,14 @@ void ReplaceClipMediaDialog::replace() {
use_same_media_in_points->isChecked()
);
for (int i=0;i<Olive::ActiveSequence->clips.size();i++) {
Clip* c = Olive::ActiveSequence->clips.at(i);
for (int i=0;i<olive::ActiveSequence->clips.size();i++) {
Clip* c = olive::ActiveSequence->clips.at(i);
if (c != nullptr && c->media == media) {
rcmc->clips.append(c);
}
}
Olive::UndoStack.push(rcmc);
olive::UndoStack.push(rcmc);
close();
}
+6 -6
View File
@@ -58,7 +58,7 @@ SpeedDialog::SpeedDialog(QWidget *parent) : QDialog(parent) {
grid->addWidget(new QLabel(tr("Duration:"), this), 2, 0);
duration = new LabelSlider(this);
duration->set_display_type(LABELSLIDER_FRAMENUMBER);
duration->set_frame_rate(Olive::ActiveSequence->frame_rate);
duration->set_frame_rate(olive::ActiveSequence->frame_rate);
grid->addWidget(duration, 2, 1);
main_layout->addLayout(grid);
@@ -339,14 +339,14 @@ void set_speed(ComboAction* ca, Clip* c, double speed, bool ripple, long& ep, lo
sel.in = c->timeline_in;
sel.out = proposed_out;
sel.track = c->track;
Olive::ActiveSequence->selections.append(sel);
olive::ActiveSequence->selections.append(sel);
}
void SpeedDialog::accept() {
ComboAction* ca = new ComboAction();
SetSelectionsCommand* sel_command = new SetSelectionsCommand(Olive::ActiveSequence);
sel_command->old_data = Olive::ActiveSequence->selections;
SetSelectionsCommand* sel_command = new SetSelectionsCommand(olive::ActiveSequence);
sel_command->old_data = olive::ActiveSequence->selections;
long earliest_point = LONG_MAX;
long longest_ripple = LONG_MIN;
@@ -419,10 +419,10 @@ void SpeedDialog::accept() {
ripple_clips(ca, clips.at(0)->sequence, earliest_point, longest_ripple);
}
sel_command->new_data = Olive::ActiveSequence->selections;
sel_command->new_data = olive::ActiveSequence->selections;
ca->append(sel_command);
Olive::UndoStack.push(ca);
olive::UndoStack.push(ca);
update_ui(true);
QDialog::accept();