]> sigrok.org Git - pulseview.git/blame_incremental - pv/dialogs/connect.hpp
Add "new session" and "new view" toolbar buttons
[pulseview.git] / pv / dialogs / connect.hpp
... / ...
CommitLineData
1/*
2 * This file is part of the PulseView project.
3 *
4 * Copyright (C) 2012-2013 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
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef PULSEVIEW_PV_CONNECT_HPP
22#define PULSEVIEW_PV_CONNECT_HPP
23
24#include <memory>
25
26#include <QCheckBox>
27#include <QComboBox>
28#include <QDialog>
29#include <QDialogButtonBox>
30#include <QFormLayout>
31#include <QHBoxLayout>
32#include <QLineEdit>
33#include <QSpinBox>
34#include <QListWidget>
35#include <QPushButton>
36#include <QVBoxLayout>
37
38namespace sigrok {
39class Driver;
40}
41
42namespace pv {
43namespace devices {
44class HardwareDevice;
45}
46}
47
48Q_DECLARE_METATYPE(std::shared_ptr<sigrok::Driver>);
49Q_DECLARE_METATYPE(std::shared_ptr<pv::devices::HardwareDevice>);
50
51namespace pv {
52
53class DeviceManager;
54
55namespace dialogs {
56
57class Connect : public QDialog
58{
59 Q_OBJECT
60
61public:
62 Connect(QWidget *parent, pv::DeviceManager &device_manager);
63
64 std::shared_ptr<devices::HardwareDevice> get_selected_device() const;
65
66private:
67 void populate_drivers();
68
69 void populate_serials(std::shared_ptr<sigrok::Driver> driver);
70
71 void unset_connection();
72
73private Q_SLOTS:
74 void driver_selected(int index);
75
76 void serial_toggled(bool checked);
77 void tcp_toggled(bool checked);
78
79 void scan_pressed();
80
81private:
82 pv::DeviceManager &device_manager_;
83
84 QVBoxLayout layout_;
85
86 QWidget form_;
87 QFormLayout form_layout_;
88
89 QComboBox drivers_;
90
91 QComboBox serial_devices_;
92
93 QWidget *tcp_config_;
94 QLineEdit *tcp_host_;
95 QSpinBox *tcp_port_;
96 QCheckBox *tcp_use_vxi_;
97
98 QPushButton scan_button_;
99 QListWidget device_list_;
100
101 QDialogButtonBox button_box_;
102};
103
104} // namespace dialogs
105} // namespace pv
106
107#endif // PULSEVIEW_PV_CONNECT_HPP