CuteLogger
Fast and simple logging solution for Qt based applications
markersdock.h
1 /*
2  * Copyright (c) 2021 Meltytech, LLC
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef MARKERSDOCK_H
19 #define MARKERSDOCK_H
20 
21 #include <QDockWidget>
22 #include <QItemSelectionModel>
23 
24 class EditMarkerWidget;
25 class MarkerTreeView;
26 class MarkersModel;
27 class QLineEdit;
28 class QSortFilterProxyModel;
29 class QToolButton;
30 
31 class MarkersDock : public QDockWidget
32 {
33  Q_OBJECT
34 
35 public:
36  explicit MarkersDock(QWidget *parent = 0);
37  ~MarkersDock();
38  void setModel(MarkersModel *model);
39 
40 signals:
41  void seekRequested(int pos);
42  void addRequested();
43  void addAroundSelectionRequested();
44 
45 public slots:
46  void onMarkerSelectionRequest(int markerIndex);
47 
48 private slots:
49  void onSelectionChanged(QModelIndex &index);
50  void onRowClicked(const QModelIndex &index);
51  void onAddRequested();
52  void onRemoveRequested();
53  void onClearSelectionRequested();
54  void onRemoveAllRequested();
55  void onSearchChanged();
56  void onColorColumnToggled(bool checked);
57  void onTextColumnToggled(bool checked);
58  void onStartColumnToggled(bool checked);
59  void onEndColumnToggled(bool checked);
60  void onDurationColumnToggled(bool checked);
61  void onRowsInserted(const QModelIndex &parent, int first, int last);
62  void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
63  const QVector<int> &roles = QVector<int>());
64  void onValuesChanged();
65  void onModelReset();
66  void onSortIndicatorChanged(int logicalIndex, Qt::SortOrder order);
67 
68 private:
69  void enableButtons(bool enable);
70 
71  MarkersModel *m_model;
72  QSortFilterProxyModel *m_proxyModel;
73  MarkerTreeView *m_treeView;
74  QToolButton *m_addButton;
75  QToolButton *m_removeButton;
76  QToolButton *m_clearButton;
77  QLineEdit *m_searchField;
78  QToolButton *m_clearSearchButton;
79  EditMarkerWidget *m_editMarkerWidget;
80  bool m_editInProgress;
81 };
82 
83 #endif // MARKERSDOCK_H