]>
Commit | Line | Data |
---|---|---|
e0ba4f6f SA |
1 | /* |
2 | * This file is part of the PulseView project. | |
3 | * | |
4 | * Copyright (C) 2016 Soeren Apel <soeren@apelpie.net> | |
5 | * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk> | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
efdec55a | 18 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
e0ba4f6f SA |
19 | */ |
20 | ||
21 | #ifndef PULSEVIEW_PV_VIEWS_TRACE_STANDARDBAR_HPP | |
22 | #define PULSEVIEW_PV_VIEWS_TRACE_STANDARDBAR_HPP | |
23 | ||
cafe470e | 24 | #include <cstdint> |
e0ba4f6f SA |
25 | |
26 | #include <QAction> | |
7f965464 | 27 | #include <QSpinBox> |
e0ba4f6f SA |
28 | #include <QToolBar> |
29 | #include <QWidget> | |
30 | ||
31 | #include <pv/session.hpp> | |
32 | ||
33 | namespace pv { | |
34 | ||
35 | class MainWindow; | |
36 | class Session; | |
37 | ||
38 | namespace views { | |
39 | ||
f23c4692 | 40 | namespace trace { |
e0ba4f6f SA |
41 | class View; |
42 | } | |
43 | ||
44 | namespace trace { | |
45 | ||
46 | class StandardBar : public QToolBar | |
47 | { | |
48 | Q_OBJECT | |
49 | ||
50 | public: | |
51 | StandardBar(Session &session, QWidget *parent, | |
f23c4692 | 52 | trace::View *view, bool add_default_widgets = true); |
e0ba4f6f | 53 | |
1978e0c2 | 54 | Session &session() const; |
e0ba4f6f SA |
55 | |
56 | QAction* action_view_zoom_in() const; | |
57 | QAction* action_view_zoom_out() const; | |
58 | QAction* action_view_zoom_fit() const; | |
59 | QAction* action_view_zoom_one_to_one() const; | |
60 | QAction* action_view_show_cursors() const; | |
61 | ||
62 | protected: | |
63 | virtual void add_toolbar_widgets(); | |
64 | ||
7f965464 SA |
65 | virtual void show_multi_segment_ui(const bool state); |
66 | ||
e0ba4f6f | 67 | Session &session_; |
f23c4692 | 68 | trace::View *view_; |
e0ba4f6f SA |
69 | |
70 | QAction *const action_view_zoom_in_; | |
71 | QAction *const action_view_zoom_out_; | |
72 | QAction *const action_view_zoom_fit_; | |
73 | QAction *const action_view_zoom_one_to_one_; | |
74 | QAction *const action_view_show_cursors_; | |
75 | ||
7f965464 SA |
76 | QSpinBox *segment_selector_; |
77 | ||
341d9a79 SA |
78 | Q_SIGNALS: |
79 | void segment_selected(int segment_id); | |
80 | ||
e0ba4f6f SA |
81 | protected Q_SLOTS: |
82 | void on_actionViewZoomIn_triggered(); | |
83 | ||
84 | void on_actionViewZoomOut_triggered(); | |
85 | ||
dfe1bf82 | 86 | void on_actionViewZoomFit_triggered(bool checked); |
e0ba4f6f SA |
87 | |
88 | void on_actionViewZoomOneToOne_triggered(); | |
89 | ||
90 | void on_actionViewShowCursors_triggered(); | |
91 | ||
92 | void on_always_zoom_to_fit_changed(bool state); | |
7f965464 | 93 | |
4e86ec70 | 94 | void on_new_segment(int new_segment_id); |
7daebd05 | 95 | void on_segment_changed(int segment_id); |
341d9a79 | 96 | void on_segment_selected(int ui_segment_id); |
7daebd05 | 97 | void on_segment_display_mode_changed(bool segment_selectable); |
7f965464 SA |
98 | |
99 | private: | |
100 | vector<QAction*> multi_segment_actions_; | |
e0ba4f6f SA |
101 | }; |
102 | ||
103 | } // namespace trace | |
104 | } // namespace views | |
105 | } // namespace pv | |
106 | ||
107 | #endif // PULSEVIEW_PV_VIEWS_TRACE_STANDARDBAR_HPP |