]> sigrok.org Git - pulseview.git/blame - pv/views/trace/standardbar.hpp
MainWindow, View::View: Fix two memory errors reported by valgrind
[pulseview.git] / pv / views / trace / standardbar.hpp
CommitLineData
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
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22#ifndef PULSEVIEW_PV_VIEWS_TRACE_STANDARDBAR_HPP
23#define PULSEVIEW_PV_VIEWS_TRACE_STANDARDBAR_HPP
24
25#include <stdint.h>
26
27#include <QAction>
28#include <QToolBar>
29#include <QWidget>
30
31#include <pv/session.hpp>
32
33namespace pv {
34
35class MainWindow;
36class Session;
37
38namespace views {
39
40namespace TraceView {
41class View;
42}
43
44namespace trace {
45
46class StandardBar : public QToolBar
47{
48 Q_OBJECT
49
50public:
51 StandardBar(Session &session, QWidget *parent,
52 TraceView::View *view, bool add_default_widgets=true);
53
54 Session &session(void) const;
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
62protected:
63 virtual void add_toolbar_widgets();
64
65 Session &session_;
66 TraceView::View *view_;
67
68 QAction *const action_view_zoom_in_;
69 QAction *const action_view_zoom_out_;
70 QAction *const action_view_zoom_fit_;
71 QAction *const action_view_zoom_one_to_one_;
72 QAction *const action_view_show_cursors_;
73
74protected Q_SLOTS:
75 void on_actionViewZoomIn_triggered();
76
77 void on_actionViewZoomOut_triggered();
78
dfe1bf82 79 void on_actionViewZoomFit_triggered(bool checked);
e0ba4f6f
SA
80
81 void on_actionViewZoomOneToOne_triggered();
82
83 void on_actionViewShowCursors_triggered();
84
85 void on_always_zoom_to_fit_changed(bool state);
86};
87
88} // namespace trace
89} // namespace views
90} // namespace pv
91
92#endif // PULSEVIEW_PV_VIEWS_TRACE_STANDARDBAR_HPP