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
@@ -49,7 +49,7 @@ Clip::Clip(Sequence* s) :
speed(1.0),
reverse(false),
maintain_audio_pitch(false),
autoscale(Olive::CurrentConfig.autoscale_by_default),
autoscale(olive::CurrentConfig.autoscale_by_default),
opening_transition(-1),
closing_transition(-1),
undeletable(false),
+14 -14
View File
@@ -96,7 +96,7 @@ Effect* create_effect(Clip* c, const EffectMeta* em) {
return new Effect(c, em);
} else {
qCritical() << "Invalid effect data";
QMessageBox::critical(Olive::MainWindow,
QMessageBox::critical(olive::MainWindow,
QCoreApplication::translate("Effect", "Invalid effect"),
QCoreApplication::translate("Effect", "No candidate for effect '%1'. This effect may be corrupt. Try reinstalling it or Olive.").arg(em->name));
}
@@ -395,7 +395,7 @@ void Effect::field_changed() {
void Effect::show_context_menu(const QPoint& pos) {
if (meta->type == EFFECT_TYPE_EFFECT) {
QMenu menu(Olive::MainWindow);
QMenu menu(olive::MainWindow);
int index = get_index_in_clip();
@@ -432,7 +432,7 @@ void Effect::delete_self() {
EffectDeleteCommand* command = new EffectDeleteCommand();
command->clips.append(parent_clip);
command->fx.append(get_index_in_clip());
Olive::UndoStack.push(command);
olive::UndoStack.push(command);
update_ui(true);
}
@@ -441,7 +441,7 @@ void Effect::move_up() {
command->clip = parent_clip;
command->from = get_index_in_clip();
command->to = command->from - 1;
Olive::UndoStack.push(command);
olive::UndoStack.push(command);
panel_effect_controls->reload_clips();
panel_sequence_viewer->viewer_widget->frame_update();
}
@@ -451,14 +451,14 @@ void Effect::move_down() {
command->clip = parent_clip;
command->from = get_index_in_clip();
command->to = command->from + 1;
Olive::UndoStack.push(command);
olive::UndoStack.push(command);
panel_effect_controls->reload_clips();
panel_sequence_viewer->viewer_widget->frame_update();
}
void Effect::save_to_file() {
// save effect settings to file
QString file = QFileDialog::getSaveFileName(Olive::MainWindow,
QString file = QFileDialog::getSaveFileName(olive::MainWindow,
tr("Save Effect Settings"),
QString(),
tr("Effect XML Settings %1").arg("(*.xml)"));
@@ -478,7 +478,7 @@ void Effect::save_to_file() {
file_handle.close();
} else {
QMessageBox::critical(Olive::MainWindow,
QMessageBox::critical(olive::MainWindow,
tr("Save Settings Failed"),
tr("Failed to open \"%1\" for writing.").arg(file),
QMessageBox::Ok);
@@ -488,7 +488,7 @@ void Effect::save_to_file() {
void Effect::load_from_file() {
// load effect settings from file
QString file = QFileDialog::getOpenFileName(Olive::MainWindow,
QString file = QFileDialog::getOpenFileName(olive::MainWindow,
tr("Load Effect Settings"),
QString(),
tr("Effect XML Settings %1").arg("(*.xml)"));
@@ -498,13 +498,13 @@ void Effect::load_from_file() {
QFile file_handle(file);
if (file_handle.open(QFile::ReadOnly)) {
Olive::UndoStack.push(new SetEffectData(this, file_handle.readAll()));
olive::UndoStack.push(new SetEffectData(this, file_handle.readAll()));
file_handle.close();
update_ui(false);
} else {
QMessageBox::critical(Olive::MainWindow,
QMessageBox::critical(olive::MainWindow,
tr("Load Settings Failed"),
tr("Failed to open \"%1\" for reading.").arg(file),
QMessageBox::Ok);
@@ -713,7 +713,7 @@ void Effect::load_from_string(const QByteArray &s) {
// pass off to standard loading function
load(stream);
} else {
QMessageBox::critical(Olive::MainWindow,
QMessageBox::critical(olive::MainWindow,
tr("Load Settings Failed"),
tr("This settings file doesn't match this effect."),
QMessageBox::Ok);
@@ -774,7 +774,7 @@ void Effect::open() {
qWarning() << "Tried to open an effect that was already open";
close();
}
if (Olive::CurrentRuntimeConfig.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 (Olive::CurrentRuntimeConfig.shaders_are_enabled
if (olive::CurrentRuntimeConfig.shaders_are_enabled
&& enable_shader
&& glslProgram->isLinked()) {
bound = glslProgram->bind();
@@ -962,7 +962,7 @@ void Effect::gizmo_move(EffectGizmo* gizmo, int x_movement, int y_movement, doub
gizmo->y_field2->set_double_value(gizmo->y_field2->get_double_value(timecode) + y_movement*gizmo->y_field_multi2);
gizmo->y_field2->make_key_from_change(ca);
}
if (done) Olive::UndoStack.push(ca);
if (done) olive::UndoStack.push(ca);
break;
}
}
+2 -2
View File
@@ -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()*Olive::CurrentConfig.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;
@@ -349,7 +349,7 @@ void EffectField::ui_element_change() {
ComboAction* ca = nullptr;
if (!dragging_double) ca = new ComboAction();
make_key_from_change(ca);
if (!dragging_double) Olive::UndoStack.push(ca);
if (!dragging_double) olive::UndoStack.push(ca);
emit changed();
}
+1 -1
View File
@@ -39,7 +39,7 @@ typedef void (*f0rGetPluginInfo)(f0r_plugin_info_t* info);
#endif
void load_internal_effects() {
if (!Olive::CurrentRuntimeConfig.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;
+7 -7
View File
@@ -91,7 +91,7 @@ void EffectRow::set_keyframe_enabled(bool enabled) {
ComboAction* ca = new ComboAction();
ca->append(new SetKeyframing(this, true));
set_keyframe_now(ca);
Olive::UndoStack.push(ca);
olive::UndoStack.push(ca);
} else {
if (QMessageBox::question(panel_effect_controls,
tr("Disable Keyframes"),
@@ -106,7 +106,7 @@ void EffectRow::set_keyframe_enabled(bool enabled) {
}
}
ca->append(new SetKeyframing(this, false));
Olive::UndoStack.push(ca);
olive::UndoStack.push(ca);
panel_effect_controls->update_keyframes();
} else {
setKeyframing(true);
@@ -121,7 +121,7 @@ void EffectRow::goto_previous_key() {
EffectField* f = field(i);
for (int j=0;j<f->keyframes.size();j++) {
long comp = f->keyframes.at(j).time - c->clip_in + c->timeline_in;
if (comp < Olive::ActiveSequence->playhead) {
if (comp < olive::ActiveSequence->playhead) {
key = qMax(comp, key);
}
}
@@ -137,7 +137,7 @@ void EffectRow::toggle_key() {
EffectField* f = field(j);
for (int i=0;i<f->keyframes.size();i++) {
long comp = c->timeline_in - c->clip_in + f->keyframes.at(i).time;
if (comp == Olive::ActiveSequence->playhead) {
if (comp == olive::ActiveSequence->playhead) {
key_fields.append(f);
key_field_index.append(i);
}
@@ -153,7 +153,7 @@ void EffectRow::toggle_key() {
ca->append(new KeyframeDelete(key_fields.at(i), key_field_index.at(i)));
}
}
Olive::UndoStack.push(ca);
olive::UndoStack.push(ca);
update_ui(false);
}
@@ -164,7 +164,7 @@ void EffectRow::goto_next_key() {
EffectField* f = field(i);
for (int j=0;j<f->keyframes.size();j++) {
long comp = f->keyframes.at(j).time - c->clip_in + c->timeline_in;
if (comp > Olive::ActiveSequence->playhead) {
if (comp > olive::ActiveSequence->playhead) {
key = qMin(comp, key);
}
}
@@ -194,7 +194,7 @@ void EffectRow::add_widget(QWidget* w) {
}
void EffectRow::set_keyframe_now(ComboAction* ca) {
long time = Olive::ActiveSequence->playhead-parent_effect->parent_clip->timeline_in+parent_effect->parent_clip->clip_in;
long time = olive::ActiveSequence->playhead-parent_effect->parent_clip->timeline_in+parent_effect->parent_clip->clip_in;
if (!just_made_unsafe_keyframe) {
EffectKeyframe key;
+1 -1
View File
@@ -58,7 +58,7 @@ void delete_keyframes(QVector<EffectField *>& selected_key_fields, QVector<int>
for (int i=0;i<key_indices.size();i++) {
ca->append(new KeyframeDelete(fields.at(i), key_indices.at(i)));
}
Olive::UndoStack.push(ca);
olive::UndoStack.push(ca);
selected_keys.clear();
selected_key_fields.clear();
update_ui(false);
+3 -3
View File
@@ -53,13 +53,13 @@ void set_marker_internal(Sequence* seq, const QVector<int>& 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 = !Olive::CurrentConfig.set_name_with_marker;
bool add_marker = !olive::CurrentConfig.set_name_with_marker;
QString marker_name;
// if (config.set_name_with_marker) is false (set above), ask for a marker name
if (!add_marker) {
QInputDialog d(Olive::MainWindow);
QInputDialog d(olive::MainWindow);
d.setWindowTitle(QCoreApplication::translate("Marker", "Set Marker"));
d.setLabelText(clips.size() > 0
? QCoreApplication::translate("Marker", "Set clip marker name:")
@@ -110,7 +110,7 @@ void set_marker_internal(Sequence* seq, const QVector<int>& clips) {
// push action
Olive::UndoStack.push(ca);
olive::UndoStack.push(ca);
// redraw UI for new markers
update_ui(false);
+3 -3
View File
@@ -264,7 +264,7 @@ bool Media::setData(int col, const QVariant &value) {
if (col == 0) {
QString n = value.toString();
if (!n.isEmpty() && get_name() != n) {
Olive::UndoStack.push(new MediaRename(this, value.toString()));
olive::UndoStack.push(new MediaRename(this, value.toString()));
return true;
}
}
@@ -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(), Olive::CurrentConfig.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, Olive::CurrentConfig.timecode_view, r);
if (len > 0) return frame_to_timecode(len, olive::CurrentConfig.timecode_view, r);
}
break;
case 2:
+1 -1
View File
@@ -131,4 +131,4 @@ void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
}
// static variable for the currently active sequence
Sequence* Olive::ActiveSequence = nullptr;
Sequence* olive::ActiveSequence = nullptr;
+1 -1
View File
@@ -61,7 +61,7 @@ struct Sequence {
};
// static variable for the currently active sequence
namespace Olive {
namespace olive {
extern Sequence* ActiveSequence;
}
+12 -12
View File
@@ -69,7 +69,7 @@ void SourcesCommon::create_seq_from_selected() {
panel_timeline->add_clips_from_ghosts(ca, s);
project_parent->create_sequence_internal(ca, s, true, nullptr);
Olive::UndoStack.push(ca);
olive::UndoStack.push(ca);
}
}
@@ -82,7 +82,7 @@ void SourcesCommon::show_context_menu(QWidget* parent, const QModelIndexList& it
QObject::connect(import_action, SIGNAL(triggered(bool)), project_parent, SLOT(import_dialog()));
QMenu* new_menu = menu.addMenu(tr("New"));
Olive::MenuHelper.make_new_menu(new_menu);
olive::MenuHelper.make_new_menu(new_menu);
QMenu* view_menu = menu.addMenu(tr("View"));
@@ -247,7 +247,7 @@ void SourcesCommon::mouseDoubleClickEvent(QMouseEvent *, const QModelIndexList&
panel_footage_viewer->setFocus();
break;
case MEDIA_TYPE_SEQUENCE:
Olive::UndoStack.push(new ChangeSequenceAction(item->to_sequence()));
olive::UndoStack.push(new ChangeSequenceAction(item->to_sequence()));
break;
}
}
@@ -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()
&& Olive::CurrentConfig.drop_on_media_to_replace
&& olive::CurrentConfig.drop_on_media_to_replace
&& QMessageBox::question(
parent,
tr("Replace Media"),
@@ -326,7 +326,7 @@ void SourcesCommon::dropEvent(QWidget* parent, QDropEvent *event, const QModelIn
MediaMove* mm = new MediaMove();
mm->to = m;
mm->items = move_items;
Olive::UndoStack.push(mm);
olive::UndoStack.push(mm);
}
}
}
@@ -370,14 +370,14 @@ void SourcesCommon::rename_interval() {
void SourcesCommon::item_renamed(Media* item) {
if (editing_item == item) {
MediaRename* mr = new MediaRename(item, "idk");
Olive::UndoStack.push(mr);
olive::UndoStack.push(mr);
editing_item = nullptr;
}
}
void SourcesCommon::open_create_proxy_dialog() {
// open the proxy dialog and send it a list of currently selected footage
ProxyDialog pd(Olive::MainWindow, cached_selected_footage);
ProxyDialog pd(olive::MainWindow, cached_selected_footage);
pd.exec();
}
@@ -389,7 +389,7 @@ void SourcesCommon::clear_proxies_from_selected() {
if (f->proxy && !f->proxy_path.isEmpty()) {
if (QFileInfo::exists(f->proxy_path)) {
if (QMessageBox::question(Olive::MainWindow,
if (QMessageBox::question(olive::MainWindow,
tr("Delete proxy"),
tr("Would you like to delete the proxy file \"%1\" as well?").arg(f->proxy_path),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
@@ -402,9 +402,9 @@ void SourcesCommon::clear_proxies_from_selected() {
f->proxy_path.clear();
}
if (Olive::ActiveSequence != nullptr) {
if (olive::ActiveSequence != nullptr) {
// close all clips so we can delete any proxies requested to be deleted
closeActiveClips(Olive::ActiveSequence);
closeActiveClips(olive::ActiveSequence);
}
// delete proxies requested to be deleted
@@ -412,10 +412,10 @@ void SourcesCommon::clear_proxies_from_selected() {
QFile::remove(delete_list.at(i));
}
if (Olive::ActiveSequence != nullptr) {
if (olive::ActiveSequence != nullptr) {
// update viewer (will re-open active clips with original media)
panel_sequence_viewer->viewer_widget->frame_update();
}
Olive::MainWindow->setWindowModified(true);
olive::MainWindow->setWindowModified(true);
}
+1 -1
View File
@@ -95,7 +95,7 @@ Transition* get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* em) {
}
} else {
qCritical() << "Invalid transition data";
QMessageBox::critical(Olive::MainWindow,
QMessageBox::critical(olive::MainWindow,
QCoreApplication::translate("transition", "Invalid transition"),
QCoreApplication::translate("transition", "No candidate for transition '%1'. This transition may be corrupt. Try reinstalling it or Olive.").arg(em->name)
);
+7 -7
View File
@@ -46,7 +46,7 @@
#include "project/media.h"
#include "debug.h"
QUndoStack Olive::UndoStack;
QUndoStack olive::UndoStack;
ComboAction::ComboAction() {}
@@ -209,7 +209,7 @@ void ChangeSequenceAction::doUndo() {
}
void ChangeSequenceAction::doRedo() {
old_sequence = Olive::ActiveSequence;
old_sequence = olive::ActiveSequence;
set_sequence(new_sequence);
}
@@ -942,7 +942,7 @@ void EditSequenceCommand::update() {
if (seq->clips.at(i) != nullptr) seq->clips.at(i)->refresh();
}
if (Olive::ActiveSequence == seq) {
if (olive::ActiveSequence == seq) {
set_sequence(seq);
}
}
@@ -982,7 +982,7 @@ void CloseAllClipsCommand::doUndo() {
}
void CloseAllClipsCommand::doRedo() {
closeActiveClips(Olive::ActiveSequence);
closeActiveClips(olive::ActiveSequence);
}
UpdateFootageTooltip::UpdateFootageTooltip(Media *i) {
@@ -1230,7 +1230,7 @@ void OliveAction::undo() {
doUndo();
if (set_window_modified) {
Olive::MainWindow->setWindowModified(old_window_modified);
olive::MainWindow->setWindowModified(old_window_modified);
}
}
@@ -1240,10 +1240,10 @@ void OliveAction::redo() {
if (set_window_modified) {
// store current modified state
old_window_modified = Olive::MainWindow->isWindowModified();
old_window_modified = olive::MainWindow->isWindowModified();
// set modified to true
Olive::MainWindow->setWindowModified(true);
olive::MainWindow->setWindowModified(true);
}
}
+1 -1
View File
@@ -45,7 +45,7 @@ struct EffectMeta;
#include <QVariant>
#include <QModelIndex>
namespace Olive {
namespace olive {
extern QUndoStack UndoStack;
}