|
SBB Host
Host communication with the self balancing bike.
|
A class for SBB Host application GUI. More...
#include <SBBHostApp.h>
Public Member Functions | |
| SBBHostApp () | |
| Constructor. More... | |
| virtual | ~SBBHostApp () |
| Destructor. More... | |
Static Public Member Functions | |
| static Glib::RefPtr< SBBHostApp > | create () |
| Create the object. More... | |
Public Attributes | |
| int | exitcode = EXIT_QUIT |
| Exit code for the application. More... | |
Static Public Attributes | |
| static constexpr int | EXIT_RESTART = 1 |
| Exitcode for app restarting. More... | |
| static constexpr int | EXIT_QUIT = 0 |
| Exitcode for application quit (default). More... | |
Protected Member Functions | |
| void | on_startup () override |
| Signal handler called on sturtup. More... | |
| void | on_activate () override |
| Signal handler called on activate. More... | |
| void | on_plotType_changed () |
| Signal handler called on plot type changed. More... | |
| void | on_buttonRun_toggled () |
| Signal handler called on run button toggled. More... | |
| void | on_buttonLog_toggled () |
| Signal handler called on log button toggled. More... | |
| void | on_darkModeSwitch_switched () |
| Signal handler called on darkmode button switched. More... | |
| void | on_streamModeSwitch_switched () |
| Signal handler called on streamMode button switched. More... | |
| void | on_menu_file_setfolder () |
| Signal handler called on set folder menu button. More... | |
| void | on_menu_file_save () |
| Signal handler called on save menu button. More... | |
| void | on_menu_file_saveas () |
| Signal handler called on saveas menu button. More... | |
| void | on_menu_file_open () |
| Signal handler called on open menu button. More... | |
| void | on_menu_file_quit () |
| Signal handler called on quit menu button. More... | |
| void | on_menu_stream_run () |
| Signal handler called on run menu button. More... | |
| void | on_menu_stream_log () |
| Signal handler called on log menu button. More... | |
| void | on_menu_stream_connect () |
| Signal handler called on connect menu button. More... | |
| void | on_menu_settings () |
| Signal handler called on settings menu button. More... | |
| void | on_menu_help_about () |
| Signal handler called on about menu button. More... | |
| void | on_menu_help_help () |
| Signal handler called on help menu button. More... | |
| void | on_menu_loadcfg () |
| Signal handler called on load config menu button. More... | |
| void | on_app_restart (int id_response) |
| Ask the user to restart the application. More... | |
| void | on_setting_dialog (int id_response) |
| Signal handler called on setting dialog close. More... | |
| void | on_file_setfolder_dialog (int id_response) |
| Signal handler called on setfolder dialog close. More... | |
| void | on_file_saveAs_dialog (int id_response) |
| Signal handler called on saveAs dialog close. More... | |
| void | on_file_open_dialog (int id_response) |
| Signal handler called on open dialog close. More... | |
| void | on_cfg_load_dialog (int id_response) |
| Signal handler called on config load dialog close. More... | |
| void | on_quit_confirmation (int id_response) |
| Signal handler called on quit confirmation. More... | |
| bool | on_file_drag_and_drop (const Glib::ValueBase &value, double x, double y) |
| Signal handler called drag-and-drop files into application. More... | |
| bool | on_read_serial () |
| Signal handler called during streaming. More... | |
| bool | on_win_close () |
| Signal handler called for close request. More... | |
| void | warning (int type) |
| Show warning dialog. More... | |
| void | info (int type) |
| Show information dialog. More... | |
| int | open (std::string filename) |
| Open a file and update the plot tree view. More... | |
Protected Attributes | |
| SBBHostCore | core |
| SBBHostCore object for the core management of the application. More... | |
| IniReader * | p_cfg |
| Pointer to IniReader object to read the configuration file when application starts. More... | |
| Glib::RefPtr< Gtk::Builder > | p_builder |
| Pointer to Gtk::Builder to read the XML file for the toolbase. More... | |
| Gtk::ApplicationWindow | mainWin |
| Gtk::ApplicationWindow object for the main application window. More... | |
| Gtk::HeaderBar | headerbar |
| Gtk::HeaderBar object for the window header bar. More... | |
| Gtk::Label | headerbarlabel |
| Gtk::Label object for the label of the window header bar. More... | |
| Gtk::MenuButton | menubutton |
| Gtk::MenuButton object for the menu button. More... | |
| Gtk::StackSwitcher | switcher |
| Gtk::StackSwitcher object for the tab switcher. More... | |
| Gtk::Stack | stack |
| Gtk::Stack object for the stream and plot tabs. More... | |
| Gtk::Paned | streamPaned |
| Gtk::Paned object for the adjustable horizontal panes in the stream tab. More... | |
| Gtk::Paned | plotPaned |
| Gtk::Paned object for the adjustable horizontal panes in the plot tab. More... | |
| Gtk::Box | streamBox0 |
| Gtk::Box object for a vertical box in the stream tab. More... | |
| Gtk::Box | streamBox1 |
| Gtk::Box object for a vertical box in the stream tab. More... | |
| Gtk::Box | streamBox2 |
| Gtk::Box object for a horizontal box in the stream tab. More... | |
| Gtk::Box | plotBox1 |
| Gtk::Box object for a vertical box in the plot tab. More... | |
| Gtk::Box | fftBox |
| Gtk::Box object for a horizontal box for the fft graph. More... | |
| Gtk::Overlay | plotGraphOverlay |
| Gtk::Overlay object to overlay graph in the plot tab. More... | |
| Gtk::Frame | streamTreeFrame |
| Gtk::Frame object containing a StreamTreeView object. More... | |
| Gtk::Frame | plotTreeFrame |
| Gtk::Frame object containing a PlotTreeView object. More... | |
| Gtk::Frame | streamGraphFrame |
| Gtk::Frame object containing the stream graph. More... | |
| Gtk::Label | streamTimeLabel |
| Gtk::Label object for the elapsed time during the signal streaming. More... | |
| Gtk::ToggleButton | buttonRun |
| Gtk::ToggleButton object for the run/stop button. More... | |
| Gtk::ToggleButton | buttonLog |
| Gtk::ToggleButton object for the log button. More... | |
| Gtk::AboutDialog | aboutDialog |
| Gtk::AboutDialog object for the about dialog of the application. More... | |
| Glib::ustring | def_dir |
| Default path where to save the log files. More... | |
| SettingsDialog | settingsDialog |
| SettingsDialog object for the setting dialog. More... | |
| Gtk::Switch | darkModeSwitch |
| Gtk::Switch object for the switch to enable/disable the dark mode. More... | |
| Gtk::ScrolledWindow | scrolledWinStream |
| Gtk::ScrolledWindow object containing a StreamTreeView object. More... | |
| Gtk::ScrolledWindow | scrolledWinPlot |
| Gtk::ScrolledWindow object containing a PlotTreeView object. More... | |
| StreamTreeView | streamTreeView |
| StreamTreeView object for the tree view in the stream tab. More... | |
| PlotTreeView | plotTreeView |
| PlotTreeView object for the tree view in the plot tab. More... | |
| Glib::Timer | timer |
| Glib::Timer object to count the elased time. More... | |
| HostControl | hostControl |
| HostControl object for the host control. More... | |
| ComboChoiceEntryLabel | plotTypeComboEntry |
| ComboChoiceEntryLabel object to choose the plot type in the plot tab. More... | |
| Glib::RefPtr< Gio::Menu > | p_winmenu = nullptr |
| Pointer to Gio::Menu object for the menu. More... | |
| Glib::RefPtr< Gio::Menu > | p_filemenu = nullptr |
| Pointer to Gio::Menu object for the file menu. More... | |
| Glib::RefPtr< Gio::Menu > | p_editmenu = nullptr |
| Pointer to Gio::Menu object for the edit menu. More... | |
| Glib::RefPtr< Gio::Menu > | p_helpmenu = nullptr |
| Pointer to Gio::Menu object for the help menu. More... | |
| Glib::RefPtr< Gio::Menu > | p_conntype = nullptr |
| Pointer to Gio::Menu object for the conn type menu. More... | |
| Glib::RefPtr< Gio::SimpleAction > | p_menuRun = nullptr |
| Pointer to Gio::SimpleAction object for the toolbar run button. More... | |
| Glib::RefPtr< Gio::SimpleAction > | p_menuLog = nullptr |
| Pointer to Gio::SimpleAction object for the toolbar log button. More... | |
| Glib::RefPtr< Gio::SimpleAction > | p_conn = nullptr |
| std::unique_ptr< Gtk::MessageDialog > | p_messageDialog = nullptr |
| Pointer to Gtk::MessageDialog object for message dialogs. More... | |
| Glib::RefPtr< Gtk::FileChooserNative > | p_fileSaveAsDialog = nullptr |
| Pointer to Gtk::FileChooserDialog object for the file saveas dialog. More... | |
| Glib::RefPtr< Gtk::FileChooserNative > | p_fileOpenDialog = nullptr |
| Pointer to Gtk::FileChooserDialog object for the file open dialog. More... | |
| Glib::RefPtr< Gtk::FileChooserNative > | p_cfgLoadDialog = nullptr |
| Pointer to Gtk::FileChooserDialog object for the config load dialog. More... | |
| Glib::RefPtr< Gtk::FileChooserNative > | p_setFolderDialog = nullptr |
| Pointer to Gtk::FileChooserDialog object for the setfolder dialog. More... | |
| Gtk::FileChooserDialog * | p_fileSaveAsDialog = nullptr |
| Pointer to Gtk::FileChooserDialog object for the file saveas dialog. More... | |
| Gtk::FileChooserDialog * | p_fileOpenDialog = nullptr |
| Pointer to Gtk::FileChooserDialog object for the file open dialog. More... | |
| Gtk::FileChooserDialog * | p_cfgLoadDialog = nullptr |
| Pointer to Gtk::FileChooserDialog object for the config load dialog. More... | |
| Gtk::FileChooserDialog * | p_setFolderDialog = nullptr |
| Pointer to Gtk::FileChooserDialog object for the setfolder dialog. More... | |
| CGraph::CairoGraph * | p_streamGraph = nullptr |
| Pointer to CGraph::CairoGraph object for the graph in the stream tab. More... | |
| CGraph::CairoGraph * | p_plotGraph = nullptr |
| Pointer to CGraph::CairoGraph object for the sample-domain graph in the plot tab. More... | |
| CGraph::CairoGraph * | p_magfftGraph = nullptr |
| Pointer to CGraph::CairoGraph object for the magnitude-spectra graph in the plot tab. More... | |
| CGraph::CairoGraph * | p_phfftGraph = nullptr |
| Pointer to CGraph::CairoGraph object for the phase-spectra graph in the plot tab. More... | |
Private Member Functions | |
| void | create_graph () |
| Create graph. More... | |
| void | create_toolbar () |
| Create toolbar. More... | |
| void | create_dialogs () |
| Create dialogs. More... | |
| void | parse_ini () |
| Parse the configuration file. More... | |
| void | set_tooltips () |
| Set tooltips. More... | |
| void | set_graph () |
| Set graph. More... | |
| void | set_tree () |
| Set tree view. More... | |
| void | set_streamTimer (int secs) |
| Set timer. More... | |
| void | clear_stream_graph () |
| Clear stream graph. More... | |
| void | set_drag_and_drop () |
| Set drag and drop. More... | |
| void | set_host_control () |
| Set host control. More... | |
| void | on_conntype_radio_button (int i) |
Private Attributes | |
| int | id = NULL_ID |
| Current log ID (used in save as). More... | |
| bool | force_close = false |
| Force the application to close. More... | |
| int | exitFlag = EXIT_DEFAULT |
| Exit flag (see config.h for details). More... | |
| double | streamTimer |
| Value of the stream timer. More... | |
| double | streamGraphTimer |
| Value of the stream-graph timer. More... | |
| Params | params |
| Params object to save application parameters. More... | |
A class for SBB Host application GUI.
Main class for the GUI of the SBB Host Application, extending the Gtk::Application class.
| SBBHostApp::SBBHostApp | ( | ) |
Constructor.
Defualt constructor.
|
virtual |
Destructor.
Defualt destructor.
|
private |
Clear stream graph.
Function to clear the stream graph.
|
static |
Create the object.
Function to create a SBBHostApp object, used in main().
|
private |
Create dialogs.
Function to create and set the dialogs.
|
private |
Create graph.
Function to create the graph.
|
private |
Create toolbar.
Function to create the toolbar and set its signal handlers.
|
protected |
Show information dialog.
Function to show an information dialog with a message.
| type | The type of the message to be shown (see exit flags in config.h for details). |
|
overrideprotected |
Signal handler called on activate.
Function for signal handler called on startup. It performs a full initialization for the application. It overrides the virtual member in Gtk::Application.
|
protected |
Ask the user to restart the application.
Ask the user to restart the application when loading a new configuration file.
| id_response | The response ID. |
|
protected |
Signal handler called on log button toggled.
Function for signal handler called when toggling the log button, in order to enable or disable the log. The button is unsensitive during signal streaming (log must be enabled or disabled before signal streaming starts).
|
protected |
Signal handler called on run button toggled.
Function for signal handler called when toggling the run button, in order to run or stop the signal streaming.
|
protected |
Signal handler called on config load dialog close.
Function for signal handler called when closing the load Gtk::FileChooserDialog. Depending on the reponse, it load the config or not (requires app restart).
| id_response | The response ID. |
|
private |
|
protected |
Signal handler called on darkmode button switched.
Function for signal handler called when switching the darkmode button, in order to enable or disable the dark mode.
|
protected |
Signal handler called drag-and-drop files into application.
Function for signal handler called when dragging-and-dropping one or more *.sbb files into the application.
| value | The Value being dropped. |
| x | The x coordinate of the current pointer position. |
| y | The y coordinate of the current pointer position. |
|
protected |
Signal handler called on open dialog close.
Function for signal handler called when closing the open Gtk::FileChooserDialog. Depending on the reponse, it opens the log or not.
| id_response | The response ID. |
|
protected |
Signal handler called on saveAs dialog close.
Function for signal handler called when closing the saveas Gtk::FileChooserDialog. Depending on the reponse, it saves the log or not.
| id_response | The response ID. |
|
protected |
Signal handler called on setfolder dialog close.
Function for signal handler called when closing the setfolder Gtk::FileChooserDialog. Depending on the reponse, it sets the folder or not.
| id_response | The response ID. |
|
protected |
Signal handler called on open menu button.
Function for signal handler called when presseing the 'Open' menu button. It opens a Gtk::FileChooserDialog in order to select the desired *.sbb file to open.
|
protected |
Signal handler called on quit menu button.
Function for signal handler called when presseing the 'Quit' menu button. It exits from the application. The user is asked for confirmation if unsaved logs are found.
|
protected |
Signal handler called on save menu button.
Function for signal handler called when presseing the 'Save' menu button. It save the last log (in the stream-tab mode) or the selected logs (in the plot-tab mode). In the latter case it is equivalent to PlotTreeView::on_menu_save().
|
protected |
Signal handler called on saveas menu button.
Function for signal handler called when presseing the 'Save As' menu button. It open a Gtk::FileChooserDialog in order to save the last log (in the stream-tab mode) or the selected logs (in the plot-tab mode) with a specified name, path, and extension (*.sbb, *.csv, or *.mat).
|
protected |
Signal handler called on set folder menu button.
Function for signal handler called when presseing the 'Set Folder' menu button. It opens a Gtk::FileChooserDialog in order to select the desired folder.
|
protected |
Signal handler called on about menu button.
Function for signal handler called when presseing the about menu button. It opens a Gtk::AboutDialog with information about the application.
|
protected |
Signal handler called on help menu button.
Function for signal handler called when presseing the help menu button. It opens the documentation.
|
protected |
Signal handler called on load config menu button.
Function for signal handle called when pressing the load config menu button. It loads a new config file a save for successive starts (requries restarting).
|
protected |
Signal handler called on settings menu button.
Function for signal handler called when presseing the settings menu button.
|
protected |
Signal handler called on connect menu button.
Function for signal handler called when presseing the connect menu button. It try to connect to the selected serial port (if any), or to the serial port found. If more serial ports are found, a warning is shown.
|
protected |
Signal handler called on log menu button.
Function for signal handler called when toggling the log menu button. It enable or disable the signal logging. The button is unsensitive during signal streaming (signal logging must be enabled or disabled before signal streaming starts).
|
protected |
Signal handler called on run menu button.
Function for signal handler called when toggling the run menu button. It starts of ends the signal streaming.
|
protected |
Signal handler called on plot type changed.
Function for signal handler called when changing the plot type in the plot tab by acting on the ComboChoiceEntryLabels.
|
protected |
Signal handler called on quit confirmation.
Function for signal handler called when exiting from the application in order to ask the user for confirmation when one or more unsaved log exists. Depending on the reponse, it quits from the application or not.
| id_response | The response ID. |
|
protected |
Signal handler called during streaming.
Function for signal handler called continously and as soon as possible during signal streaming, in order to read the packet from the host port
|
protected |
Signal handler called on setting dialog close.
Function for signal handler called when closing the SettingsDialog. Depending on the reponse, it sets the setting parameters or not.
| id_response | The response ID. |
|
overrideprotected |
Signal handler called on sturtup.
Function for signal handler called on startup. It performs basic initializations for the application. It overrides the virtual member in Gtk::Application.
|
protected |
Signal handler called on streamMode button switched.
Function for signal handler called when switching the streamode button, in order to enable or disable the dark mode.
|
protected |
Signal handler called for close request.
Function for signal handler called when closing the main application window.
|
protected |
Open a file and update the plot tree view.
Function to open the file with SBBHostCore::open and update the PlotTreeView object.
| filename | The comple file name to open (path+name). |
|
private |
|
private |
Set drag and drop.
Function to set the drag-and-drop signal handlers.
|
private |
Set graph.
Function to set the graph.
|
private |
Set host control.
Function to set the host control widget.
|
private |
Set timer.
Function to set the timer label during signal streaming.
|
private |
Set tooltips.
Function to set the tooltips of the widgets.
|
private |
|
protected |
Show warning dialog.
Function to show a warning dialog with a message.
| type | The type of the message to be shown (see exit flags in config.h for details). |
|
protected |
Gtk::AboutDialog object for the about dialog of the application.
|
protected |
Gtk::ToggleButton object for the log button.
|
protected |
Gtk::ToggleButton object for the run/stop button.
|
protected |
SBBHostCore object for the core management of the application.
|
protected |
Gtk::Switch object for the switch to enable/disable the dark mode.
|
protected |
Default path where to save the log files.
|
staticconstexpr |
Exitcode for application quit (default).
|
staticconstexpr |
Exitcode for app restarting.
| int SBBHostApp::exitcode = EXIT_QUIT |
Exit code for the application.
This is non-zero if application exit occurs in certain circumstances.
|
private |
Exit flag (see config.h for details).
|
protected |
Gtk::Box object for a horizontal box for the fft graph.
|
private |
Force the application to close.
|
protected |
Gtk::HeaderBar object for the window header bar.
|
protected |
Gtk::Label object for the label of the window header bar.
|
protected |
HostControl object for the host control.
|
private |
Current log ID (used in save as).
|
protected |
Gtk::ApplicationWindow object for the main application window.
|
protected |
Gtk::MenuButton object for the menu button.
|
protected |
Pointer to Gtk::Builder to read the XML file for the toolbase.
|
protected |
Pointer to IniReader object to read the configuration file when application starts.
|
protected |
Pointer to Gtk::FileChooserDialog object for the config load dialog.
|
protected |
Pointer to Gtk::FileChooserDialog object for the config load dialog.
|
protected |
|
protected |
Pointer to Gio::Menu object for the conn type menu.
|
protected |
Pointer to Gio::Menu object for the edit menu.
|
protected |
Pointer to Gio::Menu object for the file menu.
|
protected |
Pointer to Gtk::FileChooserDialog object for the file open dialog.
|
protected |
Pointer to Gtk::FileChooserDialog object for the file open dialog.
|
protected |
Pointer to Gtk::FileChooserDialog object for the file saveas dialog.
|
protected |
Pointer to Gtk::FileChooserDialog object for the file saveas dialog.
|
protected |
Pointer to Gio::Menu object for the help menu.
|
protected |
Pointer to CGraph::CairoGraph object for the magnitude-spectra graph in the plot tab.
|
protected |
Pointer to Gio::SimpleAction object for the toolbar log button.
|
protected |
Pointer to Gio::SimpleAction object for the toolbar run button.
|
protected |
Pointer to Gtk::MessageDialog object for message dialogs.
|
protected |
Pointer to CGraph::CairoGraph object for the phase-spectra graph in the plot tab.
|
protected |
Pointer to CGraph::CairoGraph object for the sample-domain graph in the plot tab.
|
protected |
Pointer to Gtk::FileChooserDialog object for the setfolder dialog.
|
protected |
Pointer to Gtk::FileChooserDialog object for the setfolder dialog.
|
protected |
Pointer to CGraph::CairoGraph object for the graph in the stream tab.
|
protected |
Pointer to Gio::Menu object for the menu.
|
protected |
Gtk::Box object for a vertical box in the plot tab.
|
protected |
Gtk::Overlay object to overlay graph in the plot tab.
|
protected |
Gtk::Paned object for the adjustable horizontal panes in the plot tab.
|
protected |
Gtk::Frame object containing a PlotTreeView object.
|
protected |
PlotTreeView object for the tree view in the plot tab.
|
protected |
ComboChoiceEntryLabel object to choose the plot type in the plot tab.
|
protected |
Gtk::ScrolledWindow object containing a PlotTreeView object.
|
protected |
Gtk::ScrolledWindow object containing a StreamTreeView object.
|
protected |
SettingsDialog object for the setting dialog.
|
protected |
Gtk::Stack object for the stream and plot tabs.
|
protected |
Gtk::Box object for a vertical box in the stream tab.
|
protected |
Gtk::Box object for a vertical box in the stream tab.
|
protected |
Gtk::Box object for a horizontal box in the stream tab.
|
protected |
Gtk::Frame object containing the stream graph.
|
private |
Value of the stream-graph timer.
|
protected |
Gtk::Paned object for the adjustable horizontal panes in the stream tab.
|
protected |
Gtk::Label object for the elapsed time during the signal streaming.
|
private |
Value of the stream timer.
|
protected |
Gtk::Frame object containing a StreamTreeView object.
|
protected |
StreamTreeView object for the tree view in the stream tab.
|
protected |
Gtk::StackSwitcher object for the tab switcher.
|
protected |
Glib::Timer object to count the elased time.