]> sigrok.org Git - pulseview.git/blobdiff - pv/mainwindow.hpp
Session: Fix issue #67 by improving error handling
[pulseview.git] / pv / mainwindow.hpp
index 141e96e90dd74d8b1e1befd635d49bfee2827ec8..493e3a55cc0dec32b3ca6e1471138dd0a0bdeac7 100644 (file)
 
 #include <QMainWindow>
 #include <QShortcut>
-#include <QSignalMapper>
 #include <QTabWidget>
 #include <QToolButton>
 
-#include "globalsettings.hpp"
 #include "session.hpp"
 #include "subwindows/subwindowbase.hpp"
-#include "views/viewbase.hpp"
 
 using std::list;
 using std::map;
@@ -55,6 +52,7 @@ class MainBar;
 
 namespace view {
 class View;
+class ViewBase;
 }
 
 namespace widgets {
@@ -63,7 +61,10 @@ class DecoderMenu;
 #endif
 }
 
-class MainWindow : public QMainWindow, public GlobalSettingsInterface
+using pv::views::ViewBase;
+using pv::views::ViewType;
+
+class MainWindow : public QMainWindow
 {
        Q_OBJECT
 
@@ -80,10 +81,9 @@ public:
 
        shared_ptr<views::ViewBase> get_active_view() const;
 
-       shared_ptr<views::ViewBase> add_view(const QString &title,
-               views::ViewType type, Session &session);
+       shared_ptr<views::ViewBase> add_view(ViewType type, Session &session);
 
-       void remove_view(shared_ptr<views::ViewBase> view);
+       void remove_view(shared_ptr<ViewBase> view);
 
        shared_ptr<subwindows::SubWindowBase> add_subwindow(
                subwindows::SubWindowType type, Session &session);
@@ -100,17 +100,13 @@ public:
        void save_sessions();
        void restore_sessions();
 
-       void on_setting_changed(const QString &key, const QVariant &value);
-
 private:
        void setup_ui();
+       void update_acq_button(Session *session);
 
        void save_ui_settings();
        void restore_ui_settings();
 
-       void zoom_current_view(double steps);
-       void scroll_to_start_or_end(bool start);
-
        shared_ptr<Session> get_tab_session(int index) const;
 
        void closeEvent(QCloseEvent *event);
@@ -119,21 +115,27 @@ private:
 
        virtual bool restoreState(const QByteArray &state, int version = 0);
 
+Q_SIGNALS:
+       void session_error_raised(const QString text, const QString info_text);
+
+public Q_SLOTS:
+       void on_run_stop_clicked();
+       void on_session_error_raised(const QString text, const QString info_text);
+
 private Q_SLOTS:
-       void on_add_view(const QString &title, views::ViewType type,
-               Session *session);
+       void on_add_view(ViewType type, Session *session);
 
        void on_focus_changed();
        void on_focused_session_changed(shared_ptr<Session> session);
 
        void on_new_session_clicked();
-       void on_run_stop_clicked();
        void on_settings_clicked();
 
        void on_session_name_changed();
-       void on_capture_state_changed(QObject *obj);
+       void on_session_device_changed();
+       void on_session_capture_state_changed(int state);
 
-       void on_new_view(Session *session);
+       void on_new_view(Session *session, int view_type);
        void on_view_close_clicked();
 
        void on_tab_changed(int index);
@@ -147,15 +149,6 @@ private Q_SLOTS:
        void on_view_show_sampling_points_shortcut();
        void on_view_show_analog_minor_grid_shortcut();
 
-       void on_settingViewColoredBg_changed(const QVariant new_value);
-       void on_settingViewShowSamplingPoints_changed(const QVariant new_value);
-       void on_settingViewShowAnalogMinorGrid_changed(const QVariant new_value);
-
-       void on_zoom_out_shortcut_triggered();
-       void on_zoom_in_shortcut_triggered();
-       void on_scroll_to_start_triggered();
-       void on_scroll_to_end_triggered();
-
        void on_close_current_tab();
 
 private:
@@ -172,7 +165,6 @@ private:
        QWidget *static_tab_widget_;
        QToolButton *new_session_button_, *run_stop_button_, *settings_button_;
        QTabWidget session_selector_;
-       QSignalMapper session_state_mapper_;
 
        QIcon icon_red_;
        QIcon icon_green_;
@@ -185,10 +177,6 @@ private:
        QShortcut *run_stop_shortcut_;
        QShortcut *close_application_shortcut_;
        QShortcut *close_current_tab_shortcut_;
-       QShortcut *zoom_in_shortcut_;
-       QShortcut *zoom_out_shortcut_;
-       QShortcut *home_shortcut_;
-       QShortcut *end_shortcut_;
 };
 
 } // namespace pv