]> sigrok.org Git - pulseview.git/blobdiff - pv/mainwindow.hpp
Session: Fix issue #67 by improving error handling
[pulseview.git] / pv / mainwindow.hpp
index bf8be0ade1caa3b40caa765c721ebd71bcffc8ca..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);
@@ -92,8 +92,7 @@ public:
 
        void remove_session(shared_ptr<Session> session);
 
-       void add_session_with_file(string open_file_name,
-               string open_file_format,
+       void add_session_with_file(string open_file_name, string open_file_format,
                string open_setup_file_name);
 
        void add_default_session();
@@ -101,10 +100,9 @@ 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();
@@ -117,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);
@@ -145,10 +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_close_current_tab();
 
 private:
@@ -165,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_;