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 
44 public slots:
45  void onMarkerSelectionRequest(int markerIndex);
46 
47 private slots:
48  void onSelectionChanged(QModelIndex& index);
49  void onRowClicked(const QModelIndex& index);
50  void onAddRequested();
51  void onRemoveRequested();
52  void onClearSelectionRequested();
53  void onRemoveAllRequested();
54  void onSearchChanged();
55  void onColorColumnToggled(bool checked);
56  void onTextColumnToggled(bool checked);
57  void onStartColumnToggled(bool checked);
58  void onEndColumnToggled(bool checked);
59  void onDurationColumnToggled(bool checked);
60  void onRowsInserted(const QModelIndex &parent, int first, int last);
61  void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
62  void onValuesChanged();
63  void onModelReset();
64  void onSortIndicatorChanged(int logicalIndex, Qt::SortOrder order);
65 
66 private:
67  void enableButtons(bool enable);
68 
69  MarkersModel* m_model;
70  QSortFilterProxyModel* m_proxyModel;
71  MarkerTreeView* m_treeView;
72  QToolButton* m_addButton;
73  QToolButton* m_removeButton;
74  QToolButton* m_clearButton;
75  QToolButton* m_moreButton;
76  QLineEdit* m_searchField;
77  QToolButton* m_clearSearchButton;
78  EditMarkerWidget* m_editMarkerWidget;
79  bool m_editInProgress;
80 };
81 
82 #endif // MARKERSDOCK_H