mainwindow.h 3.52 KB
Newer Older
DreamSourceLab's avatar
DreamSourceLab committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
/*
 * This file is part of the DSLogic-gui project.
 * DSLogic-gui is based on PulseView.
 *
 * Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
 * Copyright (C) 2013 DreamSourceLab <dreamsourcelab@dreamsourcelab.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 */


#ifndef DSLOGIC_PV_MAINWINDOW_H
#define DSLOGIC_PV_MAINWINDOW_H

#include <list>

#include <QMainWindow>

#include "sigsession.h"

class QAction;
class QMenuBar;
class QMenu;
class QVBoxLayout;
class QStatusBar;
class QToolBar;
class QWidget;
class QDockWidget;

namespace pv {

class DeviceManager;

namespace toolbars {
class SamplingBar;
class TrigBar;
class FileBar;
class LogoBar;
}

namespace dock{
class ProtocolDock;
class TriggerDock;
DreamSourceLab's avatar
v0.3  
DreamSourceLab committed
56
class DsoTriggerDock;
DreamSourceLab's avatar
DreamSourceLab committed
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
class MeasureDock;
class SearchDock;
}

namespace view {
class View;
}

class MainWindow : public QMainWindow
{
	Q_OBJECT

public:
	explicit MainWindow(DeviceManager &device_manager,
		const char *open_file_name = NULL,
		QWidget *parent = 0);

private:
	void setup_ui();

	void session_error(const QString text, const QString info_text);

DreamSourceLab's avatar
DreamSourceLab committed
79
    bool eventFilter(QObject *object, QEvent *event);
DreamSourceLab's avatar
DreamSourceLab committed
80 81 82 83

private slots:
	void load_file(QString file_name);

DreamSourceLab's avatar
DreamSourceLab committed
84 85 86 87 88 89 90
    /**
     * Updates the device list in the sampling bar, and updates the
     * selection.
     * @param selected_device The device to select, or NULL if the
     * first device in the device list should be selected.
     */
    void update_device_list();
DreamSourceLab's avatar
DreamSourceLab committed
91 92 93 94 95 96

	void show_session_error(
		const QString text, const QString info_text);

	void run_stop();

DreamSourceLab's avatar
DreamSourceLab committed
97
    void instant_stop();
DreamSourceLab's avatar
DreamSourceLab committed
98

DreamSourceLab's avatar
DreamSourceLab committed
99
    void test_data_error();
DreamSourceLab's avatar
DreamSourceLab committed
100

DreamSourceLab's avatar
DreamSourceLab committed
101
    void capture_state_changed(int state);
DreamSourceLab's avatar
DreamSourceLab committed
102 103 104 105 106 107 108 109 110 111 112

    void on_protocol(bool visible);

    void on_trigger(bool visible);

    void on_measure(bool visible);

    void on_search(bool visible);

    void on_screenShot();

DreamSourceLab's avatar
DreamSourceLab committed
113 114
    void on_save();

DreamSourceLab's avatar
DreamSourceLab committed
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
    /*
     * hotplug slot function
     */
    void device_attach();
    void device_detach();

private:
	DeviceManager &_device_manager;

	SigSession _session;

	pv::view::View *_view;

	QMenuBar *_menu_bar;
	QMenu *_menu_file;
	QAction *_action_open;
	QAction *_action_connect;
	QAction *_action_quit;

	QMenu *_menu_view;
	QAction *_action_view_zoom_in;
	QAction *_action_view_zoom_out;
	QAction *_action_view_show_cursors;

	QMenu *_menu_help;
	QAction *_action_about;

	QWidget *_central_widget;
	QVBoxLayout *_vertical_layout;

	toolbars::SamplingBar *_sampling_bar;
    toolbars::TrigBar *_trig_bar;
    toolbars::FileBar *_file_bar;
    toolbars::LogoBar *_logo_bar;

DreamSourceLab's avatar
DreamSourceLab committed
150
#ifdef ENABLE_DECODE
DreamSourceLab's avatar
DreamSourceLab committed
151 152
    QDockWidget *_protocol_dock;
    dock::ProtocolDock *_protocol_widget;
DreamSourceLab's avatar
DreamSourceLab committed
153 154
#endif

DreamSourceLab's avatar
DreamSourceLab committed
155
    QDockWidget *_trigger_dock;
DreamSourceLab's avatar
v0.3  
DreamSourceLab committed
156
    QDockWidget *_dso_trigger_dock;
DreamSourceLab's avatar
DreamSourceLab committed
157
    dock::TriggerDock *_trigger_widget;
DreamSourceLab's avatar
v0.3  
DreamSourceLab committed
158
    dock::DsoTriggerDock *_dso_trigger_widget;
DreamSourceLab's avatar
DreamSourceLab committed
159 160 161 162 163 164 165 166
    QDockWidget *_measure_dock;
    QDockWidget *_search_dock;
    dock::SearchDock * _search_widget;
};

} // namespace pv

#endif // DSLOGIC_PV_MAINWINDOW_H