]> sigrok.org Git - pulseview.git/blob - pv/views/trace/standardbar.hpp
Use identifiers for fixed conversion preset values
[pulseview.git] / pv / views / trace / standardbar.hpp
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
18  * along with this program; if not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #ifndef PULSEVIEW_PV_VIEWS_TRACE_STANDARDBAR_HPP
22 #define PULSEVIEW_PV_VIEWS_TRACE_STANDARDBAR_HPP
23
24 #include <cstdint>
25
26 #include <QAction>
27 #include <QToolBar>
28 #include <QWidget>
29
30 #include <pv/session.hpp>
31
32 namespace pv {
33
34 class MainWindow;
35 class Session;
36
37 namespace views {
38
39 namespace trace {
40 class View;
41 }
42
43 namespace trace {
44
45 class StandardBar : public QToolBar
46 {
47         Q_OBJECT
48
49 public:
50         StandardBar(Session &session, QWidget *parent,
51                 trace::View *view, bool add_default_widgets = true);
52
53         Session &session() const;
54
55         QAction* action_view_zoom_in() const;
56         QAction* action_view_zoom_out() const;
57         QAction* action_view_zoom_fit() const;
58         QAction* action_view_zoom_one_to_one() const;
59         QAction* action_view_show_cursors() const;
60
61 protected:
62         virtual void add_toolbar_widgets();
63
64         Session &session_;
65         trace::View *view_;
66
67         QAction *const action_view_zoom_in_;
68         QAction *const action_view_zoom_out_;
69         QAction *const action_view_zoom_fit_;
70         QAction *const action_view_zoom_one_to_one_;
71         QAction *const action_view_show_cursors_;
72
73 protected Q_SLOTS:
74         void on_actionViewZoomIn_triggered();
75
76         void on_actionViewZoomOut_triggered();
77
78         void on_actionViewZoomFit_triggered(bool checked);
79
80         void on_actionViewZoomOneToOne_triggered();
81
82         void on_actionViewShowCursors_triggered();
83
84         void on_always_zoom_to_fit_changed(bool state);
85 };
86
87 } // namespace trace
88 } // namespace views
89 } // namespace pv
90
91 #endif // PULSEVIEW_PV_VIEWS_TRACE_STANDARDBAR_HPP