separated effect from UI

This commit is contained in:
itsmattkc
2019-03-12 22:49:01 +11:00
parent 0b090ddc21
commit 5b03af5e5a
58 changed files with 1166 additions and 1071 deletions
+15 -13
View File
@@ -73,12 +73,12 @@ Media::~Media() {
}
}
FootagePtr Media::to_footage() {
return std::static_pointer_cast<Footage>(object);
Footage* Media::to_footage() {
return static_cast<Footage*>(object.get());
}
SequencePtr Media::to_sequence() {
return std::static_pointer_cast<Sequence>(object);
Sequence* Media::to_sequence() {
return static_cast<Sequence*>(object.get());
}
void Media::set_footage(FootagePtr f) {
@@ -90,7 +90,9 @@ void Media::set_sequence(SequencePtr s) {
set_icon(olive::icon::MediaSequence);
type = MEDIA_TYPE_SEQUENCE;
object = VoidPtr(s);
if (s != nullptr) update_tooltip();
if (s != nullptr) {
update_tooltip();
}
}
void Media::set_folder() {
@@ -119,7 +121,7 @@ void Media::update_tooltip(const QString& error) {
switch (type) {
case MEDIA_TYPE_FOOTAGE:
{
FootagePtr f = to_footage();
Footage* f = to_footage();
tooltip = QCoreApplication::translate("Media", "Name:") + " " + f->name + "\n" + QCoreApplication::translate("Media", "Filename:") + " " + f->url + "\n";
if (error.isEmpty()) {
@@ -190,7 +192,7 @@ void Media::update_tooltip(const QString& error) {
break;
case MEDIA_TYPE_SEQUENCE:
{
SequencePtr s = to_sequence();
Sequence* s = to_sequence();
tooltip = QCoreApplication::translate("Media", "Name: %1"
"\nVideo Dimensions: %2x%3"
@@ -238,7 +240,7 @@ double Media::get_frame_rate(int stream) {
switch (get_type()) {
case MEDIA_TYPE_FOOTAGE:
{
FootagePtr f = to_footage();
Footage* f = to_footage();
if (stream < 0) return f->video_tracks.at(0).video_frame_rate * f->speed;
return f->get_stream_from_file_index(true, stream)->video_frame_rate * f->speed;
}
@@ -251,7 +253,7 @@ int Media::get_sampling_rate(int stream) {
switch (get_type()) {
case MEDIA_TYPE_FOOTAGE:
{
FootagePtr f = to_footage();
Footage* f = to_footage();
if (stream < 0) return f->audio_tracks.at(0).audio_frequency * f->speed;
return to_footage()->get_stream_from_file_index(false, stream)->audio_frequency * f->speed;
}
@@ -293,7 +295,7 @@ QVariant Media::data(int column, int role) {
case Qt::DecorationRole:
if (column == 0) {
if (get_type() == MEDIA_TYPE_FOOTAGE) {
FootagePtr f = to_footage();
Footage* f = to_footage();
if (f->video_tracks.size() > 0
&& f->video_tracks.at(0).preview_done) {
return f->video_tracks.at(0).video_preview_square;
@@ -309,11 +311,11 @@ QVariant Media::data(int column, int role) {
case 1:
if (root) return QCoreApplication::translate("Media", "Duration");
if (get_type() == MEDIA_TYPE_SEQUENCE) {
SequencePtr s = to_sequence();
Sequence* s = to_sequence();
return frame_to_timecode(s->getEndFrame(), olive::CurrentConfig.timecode_view, s->frame_rate);
}
if (get_type() == MEDIA_TYPE_FOOTAGE) {
FootagePtr f = to_footage();
Footage* f = to_footage();
double r = 30;
if (f->video_tracks.size() > 0 && !qIsNull(f->video_tracks.at(0).video_frame_rate))
@@ -327,7 +329,7 @@ QVariant Media::data(int column, int role) {
if (root) return QCoreApplication::translate("Media", "Rate");
if (get_type() == MEDIA_TYPE_SEQUENCE) return QString::number(get_frame_rate()) + " FPS";
if (get_type() == MEDIA_TYPE_FOOTAGE) {
FootagePtr f = to_footage();
Footage* f = to_footage();
double r;
if (f->video_tracks.size() > 0 && !qIsNull(r = get_frame_rate())) {
return QString::number(get_frame_rate()) + " FPS";