+void View::on_metadata_object_changed(MetadataObject* obj,
+ MetadataValueType value_type)
+{
+ // Check if we need to update the model's data range. We only work on the
+ // end sample value because the start sample value is updated first and
+ // we don't want to update the model twice
+
+ if ((view_mode_selector_->currentIndex() == ViewModeVisible) &&
+ (obj->type() == MetadataObjMainViewRange) &&
+ (value_type == MetadataValueEndSample)) {
+
+ int64_t start_sample = obj->value(MetadataValueStartSample).toLongLong();
+ int64_t end_sample = obj->value(MetadataValueEndSample).toLongLong();
+
+ model_->set_sample_range(max((int64_t)0, start_sample),
+ max((int64_t)0, end_sample));
+ }
+
+ if (obj->type() == MetadataObjMousePos) {
+ QModelIndex first_visual_idx = table_view_->indexAt(table_view_->rect().topLeft());
+ QModelIndex last_visual_idx = table_view_->indexAt(table_view_->rect().bottomLeft());
+
+ model_->update_highlighted_rows(first_visual_idx, last_visual_idx,
+ obj->value(MetadataValueStartSample).toLongLong());
+ }
+}
+