#include <vector>
#include "clip_list.h"
+#include "timebase.h"
#include "ui_mainwindow.h"
using namespace std;
string pts_to_string(int64_t pts)
{
- // FIXME: This depends on a fixed timebase.
- int64_t t = lrint((pts / 12800.0) * 1e3); // In milliseconds.
+ int64_t t = lrint((pts / double(TIMEBASE)) * 1e3); // In milliseconds.
int ms = t % 1000;
t /= 1000;
int sec = t % 60;
string duration_to_string(int64_t pts_diff)
{
- // FIXME: This depends on a fixed timebase.
- int64_t t = lrint((pts_diff / 12800.0) * 1e3); // In milliseconds.
+ int64_t t = lrint((pts_diff / double(TIMEBASE)) * 1e3); // In milliseconds.
int ms = t % 1000;
t /= 1000;
int sec = t % 60;
}
}
- if (role != Qt::DisplayRole)
+ if (role != Qt::DisplayRole && role != Qt::EditRole)
return QVariant();
switch (Column(column)) {
}
}
- if (role != Qt::DisplayRole)
+ if (role != Qt::DisplayRole && role != Qt::EditRole)
return QVariant();
switch (Column(column)) {
switch (Column(column)) {
case Column::DESCRIPTION:
+ case Column::CAMERA:
+ return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
default:
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
clips[row].descriptions[clips[row].stream_idx] = value.toString().toStdString();
emit_data_changed(row);
return true;
+ case Column::CAMERA: {
+ bool ok;
+ int camera_idx = value.toInt(&ok);
+ if (!ok || camera_idx < 1 || camera_idx > NUM_CAMERAS) {
+ return false;
+ }
+ clips[row].stream_idx = camera_idx - 1;
+ emit_data_changed(row);
+ return true;
+ }
default:
return false;
}