]> sigrok.org Git - pulseview.git/blame - pv/views/trace/standardbar.hpp
TabularDecView: Allow return/enter press and don't change scale
[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
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 28#include <QToolBar>
89914a86 29#include <QToolButton>
e0ba4f6f
SA
30#include <QWidget>
31
32#include <pv/session.hpp>
33
89914a86
SA
34#include "trace.hpp"
35
e0ba4f6f
SA
36namespace pv {
37
38class MainWindow;
39class Session;
40
41namespace views {
42
f23c4692 43namespace trace {
e0ba4f6f
SA
44class View;
45}
46
47namespace trace {
48
49class StandardBar : public QToolBar
50{
51 Q_OBJECT
52
53public:
54 StandardBar(Session &session, QWidget *parent,
f23c4692 55 trace::View *view, bool add_default_widgets = true);
e0ba4f6f 56
1978e0c2 57 Session &session() const;
e0ba4f6f
SA
58
59 QAction* action_view_zoom_in() const;
60 QAction* action_view_zoom_out() const;
61 QAction* action_view_zoom_fit() const;
e0ba4f6f
SA
62 QAction* action_view_show_cursors() const;
63
64protected:
65 virtual void add_toolbar_widgets();
66
7f965464
SA
67 virtual void show_multi_segment_ui(const bool state);
68
e0ba4f6f 69 Session &session_;
f23c4692 70 trace::View *view_;
e0ba4f6f
SA
71
72 QAction *const action_view_zoom_in_;
73 QAction *const action_view_zoom_out_;
74 QAction *const action_view_zoom_fit_;
e0ba4f6f
SA
75 QAction *const action_view_show_cursors_;
76
89914a86
SA
77 QToolButton *segment_display_mode_selector_;
78 QAction *const action_sdm_last_;
79 QAction *const action_sdm_last_complete_;
80 QAction *const action_sdm_single_;
81
7f965464
SA
82 QSpinBox *segment_selector_;
83
341d9a79
SA
84Q_SIGNALS:
85 void segment_selected(int segment_id);
86
e0ba4f6f
SA
87protected Q_SLOTS:
88 void on_actionViewZoomIn_triggered();
89
90 void on_actionViewZoomOut_triggered();
91
dfe1bf82 92 void on_actionViewZoomFit_triggered(bool checked);
e0ba4f6f 93
e0ba4f6f 94 void on_actionViewShowCursors_triggered();
e4e5a958 95 void on_cursor_state_changed(bool show);
e0ba4f6f 96
89914a86
SA
97 void on_actionSDMLast_triggered();
98 void on_actionSDMLastComplete_triggered();
99 void on_actionSDMSingle_triggered();
100
e0ba4f6f 101 void on_always_zoom_to_fit_changed(bool state);
7f965464 102
4e86ec70 103 void on_new_segment(int new_segment_id);
7daebd05 104 void on_segment_changed(int segment_id);
341d9a79 105 void on_segment_selected(int ui_segment_id);
89914a86 106 void on_segment_display_mode_changed(int mode, bool segment_selectable);
7f965464
SA
107
108private:
109 vector<QAction*> multi_segment_actions_;
e0ba4f6f
SA
110};
111
112} // namespace trace
113} // namespace views
114} // namespace pv
115
116#endif // PULSEVIEW_PV_VIEWS_TRACE_STANDARDBAR_HPP