case Column::OUT:
case Column::DURATION:
case Column::FADE_TIME:
+ case Column::SPEED:
return Qt::AlignRight + Qt::AlignVCenter;
case Column::CAMERA:
return Qt::AlignCenter;
ss << fixed << clips[row].fade_time_seconds;
return QString::fromStdString(ss.str());
}
+ case Column::SPEED: {
+ stringstream ss;
+ ss.imbue(locale("C"));
+ ss.precision(3);
+ ss << fixed << clips[row].speed;
+ return QString::fromStdString(ss.str());
+ }
default:
return "";
}
case Column::DURATION:
return "Duration";
default:
- if (section >= int(Column::CAMERA_1) && section < int(Column::CAMERA_1) + num_cameras) {
+ if (is_camera_column(section)) {
return QString::fromStdString("Camera " + to_string(section - int(Column::CAMERA_1) + 1));
} else {
return "";
return "Description";
case Column::FADE_TIME:
return "Fade time";
+ case Column::SPEED:
+ return "Speed";
default:
return "";
}
case Column::DESCRIPTION:
case Column::CAMERA:
case Column::FADE_TIME:
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
+ case Column::SPEED:
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
default:
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
case Column::CAMERA: {
bool ok;
int camera_idx = value.toInt(&ok);
- if (!ok || camera_idx < 1 || camera_idx > num_cameras) {
+ if (!ok || camera_idx < 1 || camera_idx > int(num_cameras)) {
return false;
}
clips[row].stream_idx = camera_idx - 1;
emit_data_changed(row);
return true;
}
+ case Column::SPEED: {
+ bool ok;
+ double val = value.toDouble(&ok);
+ if (!ok || !(val >= 0.001)) {
+ return false;
+ }
+ clips[row].speed = val;
+ emit_data_changed(row);
+ return true;
+ }
default:
return false;
}
emit any_content_changed();
}
-void PlayList::set_currently_playing(int index, double progress)
-{
- int old_index = currently_playing_index;
- int column = int(Column::PLAYING);
- if (index != old_index) {
- currently_playing_index = index;
- play_progress = progress;
- if (old_index != -1) {
- emit dataChanged(this->index(old_index, column), this->index(old_index, column));
- }
- if (index != -1) {
- emit dataChanged(this->index(index, column), this->index(index, column));
- }
- } else if (index != -1 && fabs(progress - play_progress) > 1e-3) {
- play_progress = progress;
- emit dataChanged(this->index(index, column), this->index(index, column));
- }
-}
-
void PlayList::set_progress(const map<size_t, double> &progress)
{
const int column = int(Column::PLAYING);
}
clip.stream_idx = clip_proto.stream_idx();
clip.fade_time_seconds = clip_proto.fade_time_seconds();
+ if (clip_proto.speed() < 0.001) {
+ clip.speed = 0.5; // Default.
+ } else {
+ clip.speed = clip_proto.speed();
+ }
return clip;
}
}
clip_proto->set_stream_idx(clip.stream_idx);
clip_proto->set_fade_time_seconds(clip.fade_time_seconds);
+ clip_proto->set_speed(clip.speed);
}
} // namespace