+ int save_type = SaveTypeCSVQuoted;
+
+ if (action)
+ save_type = action->data().toInt();
+
+ save_data_as_csv(save_type);
+}
+
+void View::on_table_item_clicked(const QModelIndex& index)
+{
+ (void)index;
+
+ // Force repaint, otherwise the new selection isn't shown for some reason
+ table_view_->viewport()->update();
+}
+
+void View::on_table_item_double_clicked(const QModelIndex& index)
+{
+ const Annotation* ann = static_cast<const Annotation*>(index.internalPointer());
+
+ shared_ptr<views::ViewBase> main_view = session_.main_view();
+
+ main_view->focus_on_range(ann->start_sample(), ann->end_sample());
+}
+
+void View::on_table_header_requested(const QPoint& pos)
+{
+ QMenu* menu = new QMenu(this);
+
+ for (int i = 0; i < table_view_->horizontalHeader()->count(); i++) {
+ int column = table_view_->horizontalHeader()->logicalIndex(i);
+
+ const QString title = model_->headerData(column, Qt::Horizontal, Qt::DisplayRole).toString();
+ QAction* action = new QAction(title, this);
+
+ action->setCheckable(true);
+ action->setChecked(!table_view_->horizontalHeader()->isSectionHidden(column));
+ action->setData(column);
+
+ connect(action, SIGNAL(toggled(bool)), this, SLOT(on_table_header_toggled(bool)));
+
+ menu->addAction(action);
+ }
+
+ menu->popup(table_view_->horizontalHeader()->viewport()->mapToGlobal(pos));
+}
+
+void View::on_table_header_toggled(bool checked)
+{
+ QAction* action = qobject_cast<QAction*>(QObject::sender());
+ assert(action);
+
+ const int column = action->data().toInt();
+
+ table_view_->horizontalHeader()->setSectionHidden(column, !checked);
+}
+
+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)) {