8 #include "../core/tracks.h" 10 #include <condition_variable> 16 struct SearchResultItem {
17 std::string span_label, track_label, branch_name;
18 std::shared_ptr<AnnotationSpan> span;
23 struct SearchResults {
24 bool query_empty =
false;
25 std::vector<SearchResultItem> items;
29 std::mutex _search_mutex;
30 std::condition_variable _search_condition;
31 std::string _search_query;
32 volatile bool _sort_ascending =
true;
33 volatile size_t _sort_index = 0;
34 volatile bool _search_exit =
false;
35 volatile bool _search_request =
false;
36 volatile bool _visible =
false;
37 std::shared_ptr<SearchResults> _previous_search_results;
39 std::shared_ptr<SearchSync> _sync = std::make_shared<SearchSync>();
41 std::thread _search_thread;
43 template <
class T>
static inline int compareValues(
const T &a,
const T &b) {
53 static void updateSearch(
const std::shared_ptr<SearchSync> &sync);
58 virtual void showEvent(QShowEvent *event)
override {
59 QDockWidget::showEvent(event);
60 _sync->_visible =
true;
63 virtual void hideEvent(QHideEvent *event)
override {
64 QDockWidget::hideEvent(event);
65 _sync->_visible =
false;