changed NULLs to nullptr

This commit is contained in:
itsmattkc
2019-01-12 12:57:15 +11:00
parent 6da0f29e8c
commit a8e37ac76a
59 changed files with 785 additions and 785 deletions
+33 -33
View File
@@ -25,7 +25,7 @@ Clip::Clip(Sequence* s) :
timeline_in(0),
timeline_out(0),
track(0),
media(NULL),
media(nullptr),
speed(1.0),
reverse(false),
maintain_audio_pitch(false),
@@ -36,9 +36,9 @@ Clip::Clip(Sequence* s) :
replaced(false),
ignore_reverse(false),
use_existing_frame(false),
filter_graph(NULL),
fbo(NULL),
opts(NULL)
filter_graph(nullptr),
fbo(nullptr),
opts(nullptr)
{
pkt = av_packet_alloc();
reset();
@@ -67,10 +67,10 @@ Clip* Clip::copy(Sequence* s) {
copy->effects.append(effects.at(i)->copy(copy));
}
copy->cached_fr = (this->sequence == NULL) ? cached_fr : this->sequence->frame_rate;
copy->cached_fr = (this->sequence == nullptr) ? cached_fr : this->sequence->frame_rate;
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip == NULL) copy->opening_transition = get_opening_transition()->copy(copy, NULL);
if (get_closing_transition() != NULL && get_closing_transition()->secondary_clip == NULL) copy->closing_transition = get_closing_transition()->copy(copy, NULL);
if (get_opening_transition() != nullptr && get_opening_transition()->secondary_clip == nullptr) copy->opening_transition = get_opening_transition()->copy(copy, nullptr);
if (get_closing_transition() != nullptr && get_closing_transition()->secondary_clip == nullptr) copy->closing_transition = get_closing_transition()->copy(copy, nullptr);
copy->recalculateMaxLength();
@@ -86,16 +86,16 @@ void Clip::reset() {
frame_sample_index = -1;
audio_buffer_write = false;
texture_frame = -1;
formatCtx = NULL;
stream = NULL;
codec = NULL;
codecCtx = NULL;
texture = NULL;
formatCtx = nullptr;
stream = nullptr;
codec = nullptr;
codecCtx = nullptr;
texture = nullptr;
last_invalid_ts = -1;
}
void Clip::reset_audio() {
if (media == NULL || media->get_type() == MEDIA_TYPE_FOOTAGE) {
if (media == nullptr || media->get_type() == MEDIA_TYPE_FOOTAGE) {
audio_reset = true;
frame_sample_index = -1;
audio_buffer_write = 0;
@@ -103,14 +103,14 @@ void Clip::reset_audio() {
Sequence* nested_sequence = media->to_sequence();
for (int i=0;i<nested_sequence->clips.size();i++) {
Clip* c = nested_sequence->clips.at(i);
if (c != NULL) c->reset_audio();
if (c != nullptr) c->reset_audio();
}
}
}
void Clip::refresh() {
// validates media if it was replaced
if (replaced && media != NULL && media->get_type() == MEDIA_TYPE_FOOTAGE) {
if (replaced && media != nullptr && media->get_type() == MEDIA_TYPE_FOOTAGE) {
Footage* m = media->to_footage();
if (track < 0 && m->video_tracks.size() > 0) {
@@ -150,24 +150,24 @@ void Clip::queue_remove_earliest() {
Transition* Clip::get_opening_transition() {
if (opening_transition > -1) {
if (this->sequence == NULL) {
if (this->sequence == nullptr) {
return clipboard_transitions.at(opening_transition);
} else {
return this->sequence->transitions.at(opening_transition);
}
}
return NULL;
return nullptr;
}
Transition* Clip::get_closing_transition() {
if (closing_transition > -1) {
if (this->sequence == NULL) {
if (this->sequence == nullptr) {
return clipboard_transitions.at(closing_transition);
} else {
return this->sequence->transitions.at(closing_transition);
}
}
return NULL;
return nullptr;
}
Clip::~Clip() {
@@ -185,7 +185,7 @@ Clip::~Clip() {
}
long Clip::get_clip_in_with_transition() {
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip != NULL) {
if (get_opening_transition() != nullptr && get_opening_transition()->secondary_clip != nullptr) {
// we must be the secondary clip, so return (timeline in - length)
return clip_in - get_opening_transition()->get_true_length();
}
@@ -193,7 +193,7 @@ long Clip::get_clip_in_with_transition() {
}
long Clip::get_timeline_in_with_transition() {
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip != NULL) {
if (get_opening_transition() != nullptr && get_opening_transition()->secondary_clip != nullptr) {
// we must be the secondary clip, so return (timeline in - length)
return timeline_in - get_opening_transition()->get_true_length();
}
@@ -201,7 +201,7 @@ long Clip::get_timeline_in_with_transition() {
}
long Clip::get_timeline_out_with_transition() {
if (get_closing_transition() != NULL && get_closing_transition()->secondary_clip != NULL) {
if (get_closing_transition() != nullptr && get_closing_transition()->secondary_clip != nullptr) {
// we must be the primary clip, so return (timeline out + length2)
return timeline_out + get_closing_transition()->get_true_length();
} else {
@@ -216,29 +216,29 @@ long Clip::getLength() {
double Clip::getMediaFrameRate() {
Q_ASSERT(track < 0);
if (media != NULL) {
if (media != nullptr) {
double rate = media->get_frame_rate(media_stream);
if (!qIsNaN(rate)) return rate;
}
if (sequence != NULL) return sequence->frame_rate;
if (sequence != nullptr) return sequence->frame_rate;
return qSNaN();
}
void Clip::recalculateMaxLength() {
if (sequence != NULL) {
if (sequence != nullptr) {
double fr = this->sequence->frame_rate;
fr /= speed;
calculated_length = LONG_MAX;
if (media != NULL) {
if (media != nullptr) {
switch (media->get_type()) {
case MEDIA_TYPE_FOOTAGE:
{
Footage* m = media->to_footage();
const FootageStream* ms = m->get_stream_from_file_index(track < 0, media_stream);
if (ms != NULL && ms->infinite_length) {
if (ms != nullptr && ms->infinite_length) {
calculated_length = LONG_MAX;
} else {
calculated_length = m->get_length_in_frames(fr);
@@ -261,13 +261,13 @@ long Clip::getMaximumLength() {
}
int Clip::getWidth() {
if (media == NULL && sequence != NULL) return sequence->width;
if (media == nullptr && sequence != nullptr) return sequence->width;
switch (media->get_type()) {
case MEDIA_TYPE_FOOTAGE:
{
const FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
if (ms != NULL) return ms->video_width;
if (sequence != NULL) return sequence->width;
if (ms != nullptr) return ms->video_width;
if (sequence != nullptr) return sequence->width;
}
case MEDIA_TYPE_SEQUENCE:
{
@@ -279,13 +279,13 @@ int Clip::getWidth() {
}
int Clip::getHeight() {
if (media == NULL && sequence != NULL) return sequence->height;
if (media == nullptr && sequence != nullptr) return sequence->height;
switch (media->get_type()) {
case MEDIA_TYPE_FOOTAGE:
{
const FootageStream* ms = media->to_footage()->get_stream_from_file_index(track < 0, media_stream);
if (ms != NULL) return ms->video_height;
if (sequence != NULL) return sequence->height;
if (ms != nullptr) return ms->video_height;
if (sequence != nullptr) return sequence->height;
}
case MEDIA_TYPE_SEQUENCE:
{
+29 -29
View File
@@ -73,7 +73,7 @@ Effect* create_effect(Clip* c, const EffectMeta* em) {
qCritical() << "Invalid effect data";
QMessageBox::critical(mainWindow, "Invalid effect", "No candidate for effect '" + em->name + "'. This effect may be corrupt. Try reinstalling it or Olive.");
}
return NULL;
return nullptr;
}
const EffectMeta* get_internal_meta(int internal_id, int type) {
@@ -82,11 +82,11 @@ const EffectMeta* get_internal_meta(int internal_id, int type) {
return &effects.at(i);
}
}
return NULL;
return nullptr;
}
void load_internal_effects() {
qWarning() << "Shaders are disabled, some effects may be nonfunctional";
qWarning() << "Shaders are disabled, some effects may be nonfunctional";
EffectMeta em;
@@ -266,8 +266,8 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
enable_coords(false),
enable_superimpose(false),
enable_image(false),
glslProgram(NULL),
texture(NULL),
glslProgram(nullptr),
texture(nullptr),
isOpen(false),
bound(false),
enable_always_update(false)
@@ -283,7 +283,7 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
connect(container->title_bar, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(show_context_menu(const QPoint&)));
if (em != NULL) {
if (em != nullptr) {
// set up UI from effect file
container->setText(em->name);
@@ -504,7 +504,7 @@ void Effect::copy_field_keyframes(Effect* e) {
}
EffectRow* Effect::add_row(const QString& name, bool savable, bool keyframable) {
EffectRow* row = new EffectRow(this, savable, ui_layout, name, rows.size());
EffectRow* row = new EffectRow(this, savable, ui_layout, name, rows.size(), keyframable);
rows.append(row);
return row;
}
@@ -590,7 +590,7 @@ void Effect::move_down() {
}
int Effect::get_index_in_clip() {
if (parent_clip != NULL) {
if (parent_clip != nullptr) {
for (int i=0;i<parent_clip->effects.size();i++) {
if (parent_clip->effects.at(i) == this) {
return i;
@@ -729,7 +729,7 @@ void Effect::load(QXmlStreamReader& stream) {
}
}
void Effect::custom_load(QXmlStreamReader &stream) {}
void Effect::custom_load(QXmlStreamReader &) {}
void Effect::save(QXmlStreamWriter& stream) {
stream.writeAttribute("name", meta->name);
@@ -788,9 +788,9 @@ void Effect::open() {
if (isOpen) {
qWarning() << "Tried to open an effect that was already open";
close();
}
if (shaders_are_enabled && enable_shader) {
if (QOpenGLContext::currentContext() == NULL) {
}
if (shaders_are_enabled && enable_shader) {
if (QOpenGLContext::currentContext() == nullptr) {
qWarning() << "No current context to create a shader program for - will retry next repaint";
} else {
glslProgram = new QOpenGLShaderProgram();
@@ -835,15 +835,15 @@ void Effect::close() {
qWarning() << "Tried to close an effect that was already closed";
}
delete_texture();
if (glslProgram != NULL) {
if (glslProgram != nullptr) {
delete glslProgram;
glslProgram = NULL;
glslProgram = nullptr;
}
isOpen = false;
}
bool Effect::is_glsl_linked() {
return glslProgram != NULL && glslProgram->isLinked();
return glslProgram != nullptr && glslProgram->isLinked();
}
void Effect::startEffect() {
@@ -851,11 +851,11 @@ void Effect::startEffect() {
open();
qWarning() << "Tried to start a closed effect - opening";
}
if (shaders_are_enabled
&& enable_shader
&& glslProgram->isLinked()) {
bound = glslProgram->bind();
}
if (shaders_are_enabled
&& enable_shader
&& glslProgram->isLinked()) {
bound = glslProgram->bind();
}
}
void Effect::endEffect() {
@@ -903,7 +903,7 @@ void Effect::process_shader(double timecode, GLTextureCoords&) {
}
}
void Effect::process_coords(double, GLTextureCoords&, int data) {}
void Effect::process_coords(double, GLTextureCoords&, int) {}
GLuint Effect::process_superimpose(double timecode) {
bool recreate_texture = false;
@@ -919,7 +919,7 @@ GLuint Effect::process_superimpose(double timecode) {
redraw(timecode);
}
if (texture != NULL) {
if (texture != nullptr) {
if (recreate_texture || texture->width() != img.width() || texture->height() != img.height()) {
delete_texture();
texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
@@ -939,21 +939,21 @@ void Effect::gizmo_draw(double, GLTextureCoords &) {}
void Effect::gizmo_move(EffectGizmo* gizmo, int x_movement, int y_movement, double timecode, bool done) {
for (int i=0;i<gizmos.size();i++) {
if (gizmos.at(i) == gizmo) {
ComboAction* ca = NULL;
ComboAction* ca = nullptr;
if (done) ca = new ComboAction();
if (gizmo->x_field1 != NULL) {
if (gizmo->x_field1 != nullptr) {
gizmo->x_field1->set_double_value(gizmo->x_field1->get_double_value(timecode) + x_movement*gizmo->x_field_multi1);
gizmo->x_field1->make_key_from_change(ca);
}
if (gizmo->y_field1 != NULL) {
if (gizmo->y_field1 != nullptr) {
gizmo->y_field1->set_double_value(gizmo->y_field1->get_double_value(timecode) + y_movement*gizmo->y_field_multi1);
gizmo->y_field1->make_key_from_change(ca);
}
if (gizmo->x_field2 != NULL) {
if (gizmo->x_field2 != nullptr) {
gizmo->x_field2->set_double_value(gizmo->x_field2->get_double_value(timecode) + x_movement*gizmo->x_field_multi2);
gizmo->x_field2->make_key_from_change(ca);
}
if (gizmo->y_field2 != NULL) {
if (gizmo->y_field2 != nullptr) {
gizmo->y_field2->set_double_value(gizmo->y_field2->get_double_value(timecode) + y_movement*gizmo->y_field_multi2);
gizmo->y_field2->make_key_from_change(ca);
}
@@ -1063,9 +1063,9 @@ bool Effect::valueHasChanged(double timecode) {
}
void Effect::delete_texture() {
if (texture != NULL) {
if (texture != nullptr) {
delete texture;
texture = NULL;
texture = nullptr;
}
}
+2 -2
View File
@@ -270,7 +270,7 @@ QVariant EffectField::validate_keyframe_data(double timecode, bool async) {
void EffectField::ui_element_change() {
bool dragging_double = (type == EFFECT_FIELD_DOUBLE && static_cast<LabelSlider*>(ui_element)->is_dragging());
ComboAction* ca = NULL;
ComboAction* ca = nullptr;
if (!dragging_double) ca = new ComboAction();
make_key_from_change(ca);
if (!dragging_double) undo_stack.push(ca);
@@ -280,7 +280,7 @@ void EffectField::ui_element_change() {
void EffectField::make_key_from_change(ComboAction* ca) {
if (parent_row->isKeyframing()) {
parent_row->set_keyframe_now(ca);
} else if (ca != NULL) {
} else if (ca != nullptr) {
// set undo
ca->append(new EffectFieldUndo(this));
}
+8 -8
View File
@@ -4,13 +4,13 @@
#include "effectfield.h"
EffectGizmo::EffectGizmo(int type) :
x_field1(NULL),
x_field1(nullptr),
x_field_multi1(1.0),
y_field1(NULL),
y_field1(nullptr),
y_field_multi1(1.0),
x_field2(NULL),
x_field2(nullptr),
x_field_multi2(1.0),
y_field2(NULL),
y_field2(nullptr),
y_field_multi2(1.0),
type(type),
cursor(-1)
@@ -23,10 +23,10 @@ EffectGizmo::EffectGizmo(int type) :
}
void EffectGizmo::set_previous_value() {
if (x_field1 != NULL) static_cast<LabelSlider*>(x_field1->ui_element)->set_previous_value();
if (y_field1 != NULL) static_cast<LabelSlider*>(y_field1->ui_element)->set_previous_value();
if (x_field2 != NULL) static_cast<LabelSlider*>(x_field2->ui_element)->set_previous_value();
if (y_field2 != NULL) static_cast<LabelSlider*>(y_field2->ui_element)->set_previous_value();
if (x_field1 != nullptr) static_cast<LabelSlider*>(x_field1->ui_element)->set_previous_value();
if (y_field1 != nullptr) static_cast<LabelSlider*>(y_field1->ui_element)->set_previous_value();
if (x_field2 != nullptr) static_cast<LabelSlider*>(x_field2->ui_element)->set_previous_value();
if (y_field2 != nullptr) static_cast<LabelSlider*>(y_field2->ui_element)->set_previous_value();
}
int EffectGizmo::get_point_count() {
+4 -4
View File
@@ -31,7 +31,7 @@ EffectRow::EffectRow(Effect *parent, bool save, QGridLayout *uilayout, const QSt
column_count = 1;
if (parent_effect->meta != NULL
if (parent_effect->meta != nullptr
&& parent_effect->meta->type != EFFECT_TYPE_TRANSITION
&& keyframable) {
connect(label, SIGNAL(clicked()), this, SLOT(focus_row()));
@@ -209,7 +209,7 @@ void EffectRow::set_keyframe_now(ComboAction* ca) {
field(i)->keyframes[unsafe_keys.at(i)].data = field(i)->get_current_data();
}
if (ca != NULL) {
if (ca != nullptr) {
for (int i=0;i<fieldCount();i++) {
if (key_is_new.at(i)) ca->append(new KeyframeFieldSet(field(i), unsafe_keys.at(i)));
ca->append(new SetQVariant(&field(i)->keyframes[unsafe_keys.at(i)].data, unsafe_old_data.at(i), field(i)->get_current_data()));
@@ -225,7 +225,7 @@ void EffectRow::set_keyframe_now(ComboAction* ca) {
/*if (ca != NULL) {
/*if (ca != nullptr) {
just_made_unsafe_keyframe = false;
} else {
if (!just_made_unsafe_keyframe) {
@@ -248,7 +248,7 @@ void EffectRow::set_keyframe_now(ComboAction* ca) {
KeyframeSet* ks = new KeyframeSet(this, index, time, just_made_unsafe_keyframe);
if (ca != NULL) {
if (ca != nullptr) {
just_made_unsafe_keyframe = false;
ca->append(ks);
} else {
+3 -3
View File
@@ -11,7 +11,7 @@ extern "C" {
#include "project/clip.h"
Footage::Footage() : ready(false), preview_gen(NULL), invalid(false), in(0), out(0), speed(1.0) {
Footage::Footage() : ready(false), preview_gen(nullptr), invalid(false), in(0), out(0), speed(1.0) {
ready_lock.lock();
}
@@ -20,7 +20,7 @@ Footage::~Footage() {
}
void Footage::reset() {
if (preview_gen != NULL) {
if (preview_gen != nullptr) {
preview_gen->cancel();
preview_gen->wait();
}
@@ -48,7 +48,7 @@ FootageStream* Footage::get_stream_from_file_index(bool video, int index) {
}
}
}
return NULL;
return nullptr;
}
void FootageStream::make_square_thumb() {
+9 -9
View File
@@ -28,9 +28,9 @@ QString get_interlacing_name(int interlacing) {
QString get_channel_layout_name(int channels, uint64_t layout) {
switch (channels) {
case 0: return "Invalid"; break;
case 1: return "Mono"; break;
case 2: return "Stereo"; break;
case 0: return "Invalid";
case 1: return "Mono";
case 2: return "Stereo";
default: {
char buf[50];
av_get_channel_layout_string(buf, sizeof(buf), channels, layout);
@@ -41,7 +41,7 @@ QString get_channel_layout_name(int channels, uint64_t layout) {
Media::Media(Media* iparent) :
parent(iparent),
throbber(NULL),
throbber(nullptr),
root(false),
type(-1)
{}
@@ -49,9 +49,9 @@ Media::Media(Media* iparent) :
Media::~Media() {
switch (get_type()) {
case MEDIA_TYPE_FOOTAGE: delete to_footage(); break;
case MEDIA_TYPE_SEQUENCE: if (object != NULL) delete to_sequence(); break;
case MEDIA_TYPE_SEQUENCE: if (object != nullptr) delete to_sequence(); break;
}
if (throbber != NULL) delete throbber;
if (throbber != nullptr) delete throbber;
qDeleteAll(children);
}
@@ -72,14 +72,14 @@ void Media::set_sequence(Sequence *s) {
set_icon(QIcon(":/icons/sequence.png"));
type = MEDIA_TYPE_SEQUENCE;
object = s;
if (s != NULL) update_tooltip();
if (s != nullptr) update_tooltip();
}
void Media::set_folder() {
if (folder_name.isEmpty()) folder_name = "New Folder";
set_icon(QIcon(":/icons/folder.png"));
type = MEDIA_TYPE_FOLDER;
object = NULL;
object = nullptr;
}
void Media::set_icon(const QIcon &ico) {
@@ -207,7 +207,7 @@ double Media::get_frame_rate(int stream) {
}
case MEDIA_TYPE_SEQUENCE: return to_sequence()->frame_rate;
}
return NULL;
return 0;
}
int Media::get_sampling_rate(int stream) {
+9 -9
View File
@@ -6,7 +6,7 @@
#include "project/media.h"
#include "debug.h"
ProjectModel::ProjectModel(QObject *parent) : QAbstractItemModel(parent), root_item(NULL) {
ProjectModel::ProjectModel(QObject *parent) : QAbstractItemModel(parent), root_item(nullptr) {
root_item = new Media(0);
root_item->root = true;
}
@@ -16,10 +16,10 @@ ProjectModel::~ProjectModel() {
}
void ProjectModel::destroy_root() {
if (panel_sequence_viewer != NULL) panel_sequence_viewer->viewer_widget->delete_function();
if (panel_footage_viewer != NULL) panel_footage_viewer->viewer_widget->delete_function();
if (panel_sequence_viewer != nullptr) panel_sequence_viewer->viewer_widget->delete_function();
if (panel_footage_viewer != nullptr) panel_footage_viewer->viewer_widget->delete_function();
if (root_item != NULL) {
if (root_item != nullptr) {
delete root_item;
}
}
@@ -143,14 +143,14 @@ void ProjectModel::set_icon(Media* m, const QIcon &ico) {
}
void ProjectModel::appendChild(Media *parent, Media *child) {
if (parent == NULL) parent = root_item;
if (parent == nullptr) parent = root_item;
beginInsertRows(parent == root_item ? QModelIndex() : createIndex(parent->row(), 0, parent), parent->childCount(), parent->childCount());
parent->appendChild(child);
endInsertRows();
}
void ProjectModel::moveChild(Media *child, Media *to) {
if (to == NULL) to = root_item;
if (to == nullptr) to = root_item;
Media* from = child->parentItem();
beginMoveRows(
from == root_item ? QModelIndex() : createIndex(from->row(), 0, from),
@@ -165,18 +165,18 @@ void ProjectModel::moveChild(Media *child, Media *to) {
}
void ProjectModel::removeChild(Media* parent, Media* m) {
if (parent == NULL) parent = root_item;
if (parent == nullptr) parent = root_item;
beginRemoveRows(parent == root_item ? QModelIndex() : createIndex(parent->row(), 0, parent), m->row(), m->row());
parent->removeChild(m->row());
endRemoveRows();
}
Media* ProjectModel::child(int i, Media* parent) {
if (parent == NULL) parent = root_item;
if (parent == nullptr) parent = root_item;
return parent->child(i);
}
int ProjectModel::childCount(Media *parent) {
if (parent == NULL) parent = root_item;
if (parent == nullptr) parent = root_item;
return parent->childCount();
}
+2 -2
View File
@@ -31,8 +31,8 @@ public:
void appendChild(Media* parent, Media* child);
void moveChild(Media *child, Media *to);
void removeChild(Media *parent, Media* m);
Media *child(int i, Media* parent = NULL);
int childCount(Media* parent = NULL);
Media *child(int i, Media* parent = nullptr);
int childCount(Media* parent = nullptr);
void set_icon(Media* m, const QIcon &ico);
private:
+11 -11
View File
@@ -33,8 +33,8 @@ Sequence* Sequence::copy() {
s->clips.resize(clips.size());
for (int i=0;i<clips.size();i++) {
Clip* c = clips.at(i);
if (c == NULL) {
s->clips[i] = NULL;
if (c == nullptr) {
s->clips[i] = nullptr;
} else {
Clip* copy = c->copy(s);
copy->linked = c->linked;
@@ -48,7 +48,7 @@ long Sequence::getEndFrame() {
long end = 0;
for (int j=0;j<clips.size();j++) {
Clip* c = clips.at(j);
if (c != NULL && c->timeline_out > end) {
if (c != nullptr && c->timeline_out > end) {
end = c->timeline_out;
}
}
@@ -61,10 +61,10 @@ void Sequence::hard_delete_transition(Clip *c, int type) {
bool del = true;
Transition* t = transitions.at(transition_index);
if (t->secondary_clip != NULL) {
if (t->secondary_clip != nullptr) {
for (int i=0;i<clips.size();i++) {
Clip* comp = clips.at(i);
if (comp != NULL
if (comp != nullptr
&& c != comp
&& (c->opening_transition == transition_index
|| c->closing_transition == transition_index)) {
@@ -74,14 +74,14 @@ void Sequence::hard_delete_transition(Clip *c, int type) {
}
del = false;
t->secondary_clip = NULL;
t->secondary_clip = nullptr;
}
}
}
if (del) {
delete transitions.at(transition_index);
transitions[transition_index] = NULL;
transitions[transition_index] = nullptr;
}
if (type == TA_OPENING_TRANSITION) {
@@ -97,7 +97,7 @@ void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
int at = 0;
for (int j=0;j<clips.size();j++) {
Clip* c = clips.at(j);
if (c != NULL) {
if (c != nullptr) {
if (c->track < 0 && c->track < vt) { // video clip
vt = c->track;
} else if (c->track > at) {
@@ -105,9 +105,9 @@ void Sequence::getTrackLimits(int* video_tracks, int* audio_tracks) {
}
}
}
if (video_tracks != NULL) *video_tracks = vt;
if (audio_tracks != NULL) *audio_tracks = at;
if (video_tracks != nullptr) *video_tracks = vt;
if (audio_tracks != nullptr) *audio_tracks = at;
}
// static variable for the currently active sequence
Sequence* sequence = NULL;
Sequence* sequence = nullptr;
+7 -7
View File
@@ -18,8 +18,8 @@
#include <QDesktopServices>
SourcesCommon::SourcesCommon(Project* parent) :
project_parent(parent),
editing_item(NULL)
editing_item(nullptr),
project_parent(parent)
{
rename_timer.setInterval(1000);
connect(&rename_timer, SIGNAL(timeout()), this, SLOT(rename_interval()));
@@ -39,7 +39,7 @@ void SourcesCommon::create_seq_from_selected() {
panel_timeline->create_ghosts_from_media(s, 0, media_list);
panel_timeline->add_clips_from_ghosts(ca, s);
project_parent->new_sequence(ca, s, true, NULL);
project_parent->new_sequence(ca, s, true, nullptr);
undo_stack.push(ca);
}
}
@@ -148,7 +148,7 @@ void SourcesCommon::item_click(Media *m, const QModelIndex& index) {
}
}
void SourcesCommon::mouseDoubleClickEvent(QMouseEvent *e, const QModelIndexList& selected_items) {
void SourcesCommon::mouseDoubleClickEvent(QMouseEvent *, const QModelIndexList& selected_items) {
stop_rename_timer();
if (selected_items.size() == 0) {
project_parent->import_dialog();
@@ -196,7 +196,7 @@ void SourcesCommon::dropEvent(QWidget* parent, QDropEvent *event, const QModelIn
parent = drop_item.parent();
}
}
project_parent->process_file_list(paths, false, NULL, panel_project->item_to_media(parent));
project_parent->process_file_list(paths, false, nullptr, panel_project->item_to_media(parent));
}
}
event->acceptProposedAction();
@@ -271,7 +271,7 @@ void SourcesCommon::stop_rename_timer() {
void SourcesCommon::rename_interval() {
stop_rename_timer();
if (view->hasFocus() && editing_item != NULL) {
if (view->hasFocus() && editing_item != nullptr) {
view->edit(editing_index);
}
}
@@ -280,6 +280,6 @@ void SourcesCommon::item_renamed(Media* item) {
if (editing_item == item) {
MediaRename* mr = new MediaRename(item, "idk");
undo_stack.push(mr);
editing_item = NULL;
editing_item = nullptr;
}
}
+5 -5
View File
@@ -31,7 +31,7 @@ Transition::Transition(Clip* c, Clip* s, const EffectMeta* em) :
LabelSlider* length_ui_ele = static_cast<LabelSlider*>(length_field->ui_element);
length_ui_ele->set_display_type(LABELSLIDER_FRAMENUMBER);
length_ui_ele->set_frame_rate(parent_clip->sequence == NULL ? parent_clip->cached_fr : parent_clip->sequence->frame_rate);
length_ui_ele->set_frame_rate(parent_clip->sequence == nullptr ? parent_clip->cached_fr : parent_clip->sequence->frame_rate);
}
int Transition::copy(Clip *c, Clip* s) {
@@ -48,7 +48,7 @@ long Transition::get_true_length() {
}
long Transition::get_length() {
if (secondary_clip != NULL) {
if (secondary_clip != nullptr) {
return length * 2;
}
return length;
@@ -76,14 +76,14 @@ Transition* get_transition_from_meta(Clip* c, Clip* s, const EffectMeta* em) {
qCritical() << "Invalid transition data";
QMessageBox::critical(mainWindow, "Invalid transition", "No candidate for transition '" + em->name + "'. This transition may be corrupt. Try reinstalling it or Olive.");
}
return NULL;
return nullptr;
}
int create_transition(Clip* c, Clip* s, const EffectMeta* em, long length) {
Transition* t = get_transition_from_meta(c, s, em);
if (t != NULL) {
if (t != nullptr) {
if (length >= 0) t->set_length(length);
QVector<Transition*>& transition_list = (c->sequence == NULL) ? clipboard_transitions : c->sequence->transitions;
QVector<Transition*>& transition_list = (c->sequence == nullptr) ? clipboard_transitions : c->sequence->transitions;
transition_list.append(t);
return transition_list.size() - 1;
}
+35 -35
View File
@@ -116,7 +116,7 @@ DeleteClipAction::DeleteClipAction(Sequence* s, int clip) :
{}
DeleteClipAction::~DeleteClipAction() {
if (ref != NULL) delete ref;
if (ref != nullptr) delete ref;
}
void DeleteClipAction::undo() {
@@ -141,7 +141,7 @@ void DeleteClipAction::undo() {
seq->clips.at(linkClipIndex.at(i))->linked.insert(linkLinkIndex.at(i), index);
}
ref = NULL;
ref = nullptr;
mainWindow->setWindowModified(old_project_changed);
}
@@ -152,18 +152,18 @@ void DeleteClipAction::redo() {
if (ref->open) {
close_clip(ref, true);
}
seq->clips[index] = NULL;
seq->clips[index] = nullptr;
// save shared transitions
if (ref->opening_transition > -1 && ref->get_opening_transition()->secondary_clip != NULL) {
if (ref->opening_transition > -1 && ref->get_opening_transition()->secondary_clip != nullptr) {
opening_transition = ref->opening_transition;
ref->get_opening_transition()->parent_clip = ref->get_opening_transition()->secondary_clip;
ref->get_opening_transition()->secondary_clip = NULL;
ref->get_opening_transition()->secondary_clip = nullptr;
ref->opening_transition = -1;
}
if (ref->closing_transition > -1 && ref->get_closing_transition()->secondary_clip != NULL) {
if (ref->closing_transition > -1 && ref->get_closing_transition()->secondary_clip != nullptr) {
closing_transition = ref->closing_transition;
ref->get_closing_transition()->secondary_clip = NULL;
ref->get_closing_transition()->secondary_clip = nullptr;
ref->closing_transition = -1;
}
@@ -172,7 +172,7 @@ void DeleteClipAction::redo() {
linkLinkIndex.clear();
for (int i=0;i<seq->clips.size();i++) {
Clip* c = seq->clips.at(i);
if (c != NULL) {
if (c != nullptr) {
for (int j=0;j<c->linked.size();j++) {
if (c->linked.at(j) == index) {
linkClipIndex.append(i);
@@ -256,7 +256,7 @@ AddEffectCommand::AddEffectCommand(Clip* c, Effect* e, const EffectMeta *m, int
{}
AddEffectCommand::~AddEffectCommand() {
if (!done && ref != NULL) delete ref;
if (!done && ref != nullptr) delete ref;
}
void AddEffectCommand::undo() {
@@ -271,7 +271,7 @@ void AddEffectCommand::undo() {
}
void AddEffectCommand::redo() {
if (ref == NULL) {
if (ref == nullptr) {
ref = create_effect(clip, meta);
}
if (pos < 0) {
@@ -295,14 +295,14 @@ AddTransitionCommand::AddTransitionCommand(Clip* c, Clip *s, Transition* copy, c
void AddTransitionCommand::undo() {
clip->sequence->hard_delete_transition(clip, type);
if (secondary != NULL) secondary->sequence->hard_delete_transition(secondary, (type == TA_OPENING_TRANSITION) ? TA_CLOSING_TRANSITION : TA_OPENING_TRANSITION);
if (secondary != nullptr) secondary->sequence->hard_delete_transition(secondary, (type == TA_OPENING_TRANSITION) ? TA_CLOSING_TRANSITION : TA_OPENING_TRANSITION);
if (type == TA_OPENING_TRANSITION) {
clip->opening_transition = old_ptransition;
if (secondary != NULL) secondary->closing_transition = old_stransition;
if (secondary != nullptr) secondary->closing_transition = old_stransition;
} else {
clip->closing_transition = old_ptransition;
if (secondary != NULL) secondary->opening_transition = old_stransition;
if (secondary != nullptr) secondary->opening_transition = old_stransition;
}
mainWindow->setWindowModified(old_project_changed);
@@ -311,8 +311,8 @@ void AddTransitionCommand::undo() {
void AddTransitionCommand::redo() {
if (type == TA_OPENING_TRANSITION) {
old_ptransition = clip->opening_transition;
clip->opening_transition = (transition_to_copy == NULL) ? create_transition(clip, secondary, transition) : transition_to_copy->copy(clip, NULL);
if (secondary != NULL) {
clip->opening_transition = (transition_to_copy == nullptr) ? create_transition(clip, secondary, transition) : transition_to_copy->copy(clip, nullptr);
if (secondary != nullptr) {
old_stransition = secondary->closing_transition;
secondary->closing_transition = clip->opening_transition;
}
@@ -321,8 +321,8 @@ void AddTransitionCommand::redo() {
}
} else {
old_ptransition = clip->closing_transition;
clip->closing_transition = (transition_to_copy == NULL) ? create_transition(clip, secondary, transition) : transition_to_copy->copy(clip, NULL);
if (secondary != NULL) {
clip->closing_transition = (transition_to_copy == nullptr) ? create_transition(clip, secondary, transition) : transition_to_copy->copy(clip, nullptr);
if (secondary != nullptr) {
old_stransition = secondary->opening_transition;
secondary->opening_transition = clip->closing_transition;
}
@@ -356,30 +356,30 @@ void ModifyTransitionCommand::redo() {
DeleteTransitionCommand::DeleteTransitionCommand(Sequence* s, int transition_index) :
seq(s),
index(transition_index),
transition(NULL),
otc(NULL),
ctc(NULL),
transition(nullptr),
otc(nullptr),
ctc(nullptr),
old_project_changed(mainWindow->isWindowModified())
{}
DeleteTransitionCommand::~DeleteTransitionCommand() {
if (transition != NULL) delete transition;
if (transition != nullptr) delete transition;
}
void DeleteTransitionCommand::undo() {
seq->transitions[index] = transition;
if (otc != NULL) otc->opening_transition = index;
if (ctc != NULL) ctc->closing_transition = index;
if (otc != nullptr) otc->opening_transition = index;
if (ctc != nullptr) ctc->closing_transition = index;
transition = NULL;
transition = nullptr;
mainWindow->setWindowModified(old_project_changed);
}
void DeleteTransitionCommand::redo() {
for (int i=0;i<seq->clips.size();i++) {
Clip* c = seq->clips.at(i);
if (c != NULL) {
if (c != nullptr) {
if (c->opening_transition == index) {
otc = c;
c->opening_transition = -1;
@@ -392,7 +392,7 @@ void DeleteTransitionCommand::redo() {
}
transition = seq->transitions.at(index);
seq->transitions[index] = NULL;
seq->transitions[index] = nullptr;
mainWindow->setWindowModified(true);
}
@@ -403,7 +403,7 @@ NewSequenceCommand::NewSequenceCommand(Media *s, Media* iparent) :
done(false),
old_project_changed(mainWindow->isWindowModified())
{
if (parent == NULL) parent = project_model.get_root();
if (parent == nullptr) parent = project_model.get_root();
}
NewSequenceCommand::~NewSequenceCommand() {
@@ -518,8 +518,8 @@ void AddClipCommand::redo() {
for (int j=0;j<original->linked.size();j++) {
copy->linked[j] = original->linked.at(j) + linkOffset;
}
if (original->opening_transition > -1) copy->opening_transition = original->get_opening_transition()->copy(copy, NULL);
if (original->closing_transition > -1) copy->closing_transition = original->get_closing_transition()->copy(copy, NULL);
if (original->opening_transition > -1) copy->opening_transition = original->get_opening_transition()->copy(copy, nullptr);
if (original->closing_transition > -1) copy->closing_transition = original->get_closing_transition()->copy(copy, nullptr);
seq->clips.append(copy);
}
}
@@ -591,7 +591,7 @@ void ReplaceMediaCommand::replace(QString& filename) {
Sequence* s = all_sequences.at(i)->to_sequence();
for (int j=0;j<s->clips.size();j++) {
Clip* c = s->clips.at(j);
if (c != NULL && c->media == item && c->open) {
if (c != nullptr && c->media == item && c->open) {
close_clip(c, true);
c->replaced = true;
}
@@ -602,7 +602,7 @@ void ReplaceMediaCommand::replace(QString& filename) {
QStringList files;
files.append(filename);
item->to_footage()->ready_lock.lock();
panel_project->process_file_list(files, false, item, NULL);
panel_project->process_file_list(files, false, item, nullptr);
}
void ReplaceMediaCommand::undo() {
@@ -713,7 +713,7 @@ void MediaMove::undo() {
}
void MediaMove::redo() {
if (to == NULL) to = project_model.get_root();
if (to == nullptr) to = project_model.get_root();
froms.resize(items.size());
for (int i=0;i<items.size();i++) {
Media* parent = items.at(i)->parentItem();
@@ -998,7 +998,7 @@ void EditSequenceCommand::update() {
item->set_sequence(seq);
for (int i=0;i<seq->clips.size();i++) {
if (seq->clips.at(i) != NULL) seq->clips.at(i)->refresh();
if (seq->clips.at(i) != nullptr) seq->clips.at(i)->refresh();
}
if (sequence == seq) {
@@ -1157,7 +1157,7 @@ void RippleAction::redo() {
for (int i=0;i<s->clips.size();i++) {
if (!ignore.contains(i)) {
Clip* c = s->clips.at(i);
if (c != NULL) {
if (c != nullptr) {
if (c->timeline_in >= point) {
move_clip(ca, c, length, length, 0, 0, true, true);
}
@@ -1265,7 +1265,7 @@ void RefreshClips::redo() {
Sequence* s = all_sequences.at(i)->to_sequence();
for (int j=0;j<s->clips.size();j++) {
Clip* c = s->clips.at(j);
if (c != NULL && c->media == media) {
if (c != nullptr && c->media == media) {
c->replaced = true;
c->refresh();
}