+const char* ViewModeNames[ViewModeCount] = {
+ "Show all",
+ "Show all and focus on newest",
+ "Show visible in main view"
+};
+
+
+CustomFilterProxyModel::CustomFilterProxyModel(QObject* parent) :
+ QSortFilterProxyModel(parent),
+ range_filtering_enabled_(false)
+{
+}
+
+bool CustomFilterProxyModel::filterAcceptsRow(int sourceRow,
+ const QModelIndex &sourceParent) const
+{
+ (void)sourceParent;
+ assert(sourceModel() != nullptr);
+
+ bool result = true;
+
+ if (range_filtering_enabled_) {
+ const QModelIndex ann_start_sample_idx = sourceModel()->index(sourceRow, 0);
+ const uint64_t ann_start_sample =
+ sourceModel()->data(ann_start_sample_idx, Qt::DisplayRole).toULongLong();
+
+ const QModelIndex ann_end_sample_idx = sourceModel()->index(sourceRow, 6);
+ const uint64_t ann_end_sample =
+ sourceModel()->data(ann_end_sample_idx, Qt::DisplayRole).toULongLong();
+
+ // We consider all annotations as visible that either
+ // a) begin to the left of the range and end within the range or
+ // b) begin and end within the range or
+ // c) begin within the range and end to the right of the range
+ // ...which is equivalent to the negation of "begins and ends outside the range"
+
+ const bool left_of_range = (ann_end_sample < range_start_sample_);
+ const bool right_of_range = (ann_start_sample > range_end_sample_);
+ const bool entirely_outside_of_range = left_of_range || right_of_range;
+
+ result = !entirely_outside_of_range;
+ }
+
+ return result;
+}
+
+void CustomFilterProxyModel::set_sample_range(uint64_t start_sample,
+ uint64_t end_sample)
+{
+ range_start_sample_ = start_sample;
+ range_end_sample_ = end_sample;
+
+ invalidateFilter();
+}
+
+void CustomFilterProxyModel::enable_range_filtering(bool value)
+{
+ range_filtering_enabled_ = value;
+
+ invalidateFilter();
+}
+
+
+QSize CustomTableView::minimumSizeHint() const