]> sigrok.org Git - pulseview.git/blame - pv/mainwindow.hpp
LogicSignal: Don't paint hover marker if channel is disabled
[pulseview.git] / pv / mainwindow.hpp
CommitLineData
d7bed479 1/*
b3f22de0 2 * This file is part of the PulseView project.
d7bed479
JH
3 *
4 * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
efdec55a 17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
d7bed479
JH
18 */
19
7a01bd36
JH
20#ifndef PULSEVIEW_PV_MAINWINDOW_HPP
21#define PULSEVIEW_PV_MAINWINDOW_HPP
d7bed479 22
18203d86 23#include <list>
dd3fd4df 24#include <map>
f9abf97e 25#include <memory>
b1264f56 26
d7bed479 27#include <QMainWindow>
aca9aa83 28#include <QShortcut>
3231fbf9 29#include <QSignalMapper>
3b84fd0b 30#include <QTabWidget>
aca9aa83 31#include <QToolButton>
d7bed479 32
d0c0573b 33#include "globalsettings.hpp"
f65cd27b 34#include "session.hpp"
f4e57597 35#include "views/viewbase.hpp"
2953961c 36
6f925ba9
UH
37using std::list;
38using std::map;
39using std::shared_ptr;
40using std::string;
41
269528f5
JH
42struct srd_decoder;
43
7d5425ef 44class QVBoxLayout;
7d5425ef 45
51e77110
JH
46namespace pv {
47
107ca6d3 48class DeviceManager;
94574501 49
f4c92e1c 50namespace toolbars {
404aad0e 51class ContextBar;
7c657094 52class MainBar;
f4c92e1c 53}
51e77110
JH
54
55namespace view {
56class View;
57}
58
f0d37dab 59namespace widgets {
e79171dc 60#ifdef ENABLE_DECODE
f0d37dab 61class DecoderMenu;
19be0af1 62#endif
f0d37dab
JH
63}
64
d0c0573b 65class MainWindow : public QMainWindow, public GlobalSettingsInterface
d7bed479
JH
66{
67 Q_OBJECT
68
33e1afbe
SA
69private:
70 static const QString WindowTitle;
71
d7bed479 72public:
107ca6d3 73 explicit MainWindow(DeviceManager &device_manager,
f54fc97e 74 QWidget *parent = nullptr);
d7bed479 75
47e9e7bb
SA
76 ~MainWindow();
77
5e685656
SA
78 static void show_session_error(const QString text, const QString info_text);
79
6f925ba9 80 shared_ptr<views::ViewBase> get_active_view() const;
168bd8ac 81
6f925ba9 82 shared_ptr<views::ViewBase> add_view(const QString &title,
f4e57597 83 views::ViewType type, Session &session);
7cd2b5f3 84
6f925ba9 85 void remove_view(shared_ptr<views::ViewBase> view);
f30eb549 86
6f925ba9 87 shared_ptr<Session> add_session();
101e7a9b 88
6f925ba9 89 void remove_session(shared_ptr<Session> session);
36a8185e 90
3ed18835
SA
91 void add_session_with_file(string open_file_name, string open_file_format);
92
93 void add_default_session();
94
95 void save_sessions();
96 void restore_sessions();
97
d0c0573b
SA
98 void on_setting_changed(const QString &key, const QVariant &value);
99
d7bed479 100private:
7d5425ef
JH
101 void setup_ui();
102
93f683ad 103 void save_ui_settings();
3ed18835 104 void restore_ui_settings();
93f683ad 105
6f925ba9 106 shared_ptr<Session> get_tab_session(int index) const;
e7aff437 107
93f683ad
SA
108 void closeEvent(QCloseEvent *event);
109
d290e89f
SA
110 virtual QMenu* createPopupMenu();
111
55547a45
SA
112 virtual bool restoreState(const QByteArray &state, int version = 0);
113
4df7756e 114private Q_SLOTS:
f4e57597 115 void on_add_view(const QString &title, views::ViewType type,
3a21afa6
SA
116 Session *session);
117
33e1afbe 118 void on_focus_changed();
6f925ba9 119 void on_focused_session_changed(shared_ptr<Session> session);
33e1afbe 120
f1e2d26b 121 void on_new_session_clicked();
3231fbf9 122 void on_run_stop_clicked();
bf9f1268 123 void on_settings_clicked();
3231fbf9 124
33e1afbe 125 void on_session_name_changed();
3231fbf9
SA
126 void on_capture_state_changed(QObject *obj);
127
c9da5118 128 void on_new_view(Session *session);
36a8185e 129 void on_view_close_clicked();
c9da5118 130
e7aff437 131 void on_tab_changed(int index);
4a4e20f5
SA
132 void on_tab_close_requested(int index);
133
641574bc 134 void on_view_colored_bg_shortcut();
87a97d8a 135 void on_view_sticky_scrolling_shortcut();
051ba3b3 136 void on_view_show_sampling_points_shortcut();
8ad61f40 137 void on_view_show_analog_minor_grid_shortcut();
0fb9d645 138
641574bc 139 void on_settingViewColoredBg_changed(const QVariant new_value);
051ba3b3 140 void on_settingViewShowSamplingPoints_changed(const QVariant new_value);
8ad61f40 141 void on_settingViewShowAnalogMinorGrid_changed(const QVariant new_value);
24c29d4f 142
763945bb
PET
143 void on_close_current_tab();
144
7d5425ef 145private:
8dbbc7f0 146 DeviceManager &device_manager_;
d4984fe7 147
6f925ba9
UH
148 list< shared_ptr<Session> > sessions_;
149 shared_ptr<Session> last_focused_session_;
18203d86 150
6f925ba9 151 map< QDockWidget*, shared_ptr<views::ViewBase> > view_docks_;
7d5425ef 152
6f925ba9 153 map< shared_ptr<Session>, QMainWindow*> session_windows_;
3b84fd0b 154
cc964645 155 QWidget *static_tab_widget_;
4d1ec09a 156 QToolButton *new_session_button_, *run_stop_button_, *settings_button_;
3b84fd0b 157 QTabWidget session_selector_;
3231fbf9 158 QSignalMapper session_state_mapper_;
3b84fd0b 159
3231fbf9
SA
160 QIcon icon_red_;
161 QIcon icon_green_;
162 QIcon icon_grey_;
45cb64ff 163
9eae6de4 164 QShortcut *view_sticky_scrolling_shortcut_;
051ba3b3 165 QShortcut *view_show_sampling_points_shortcut_;
8ad61f40 166 QShortcut *view_show_analog_minor_grid_shortcut_;
641574bc 167 QShortcut *view_colored_bg_shortcut_;
45cb64ff 168 QShortcut *run_stop_shortcut_;
763945bb
PET
169 QShortcut *close_application_shortcut_;
170 QShortcut *close_current_tab_shortcut_;
d7bed479
JH
171};
172
51e77110
JH
173} // namespace pv
174
7a01bd36 175#endif // PULSEVIEW_PV_MAINWINDOW_HPP