mainwindow.h
Go to the documentation of this file.
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3 
4 #include <set>
5 #include <deque>
6 #include <functional>
7 
8 #include <QCommandLineParser>
9 #include <QElapsedTimer>
10 #include <QMainWindow>
11 #include <QSignalMapper>
12 #include <QShortcut>
13 
14 #include "plotwidget.h"
15 #include "plotmatrix.h"
16 #include "curvelist_panel.h"
17 #include "tabbedplotwidget.h"
18 #include "subwindow.h"
19 #include "realslider.h"
20 #include "utils.h"
25 
26 #include "ui_mainwindow.h"
27 
28 class MainWindow : public QMainWindow
29 {
30  Q_OBJECT
31 
32 public:
33  explicit MainWindow(const QCommandLineParser& commandline_parser, QWidget *parent = nullptr);
34 
35  ~MainWindow();
36 
37  bool loadLayoutFromFile(QString filename);
38  bool loadDataFromFiles(QStringList filenames );
39  bool loadDataFromFile(const FileLoadInfo &info);
40 
41 public slots:
42 
43  void resizeEvent(QResizeEvent *) ;
44 
45  // Undo - Redo
46  void onUndoableChange();
47  void onUndoInvoked();
48  void onRedoInvoked();
49 
50  // Actions in UI
51  void on_streamingToggled();
52  void on_pushButtonStreaming_toggled(bool streaming);
54 
55  void on_splitterMoved(int, int);
56 
57  void onTrackerTimeUpdated(double absolute_time , bool do_replot);
58  void onTrackerMovedFromWidget(QPointF pos );
59  void onTimeSlider_valueChanged(double abs_time);
60 
61  void onPlotAdded(PlotWidget* plot);
62  void onPlotMatrixAdded(PlotMatrix* matrix);
63 
64  void on_tabbedAreaDestroyed(QObject*object);
65 
66  void onFloatingWindowDestroyed(QObject*object);
67 
68  void onCreateFloatingWindow(PlotMatrix* first_tab = nullptr);
69 
70  void onSwapPlots(PlotWidget* source, PlotWidget* destination);
71 
72  void updateDataAndReplot(bool replot_hidden_tabs);
73 
75 
76  void onDeleteMultipleCurves(const std::vector<std::string> &curve_names);
77 
78  void on_addMathPlot(const std::string &linked_name);
79  void on_editMathPlot(const std::string &plot_name);
80  void on_refreshMathPlot(const std::string &plot_name);
81 
82  void onPlaybackLoop();
83 
84 private:
85 
86  Ui::MainWindow *ui;
87 
89 
90  QShortcut _undo_shortcut;
91  QShortcut _redo_shortcut;
94  QShortcut _playback_shotcut;
95 
96  bool _minimized;
97 
99 
102 
103  std::map<QString,DataLoader*> _data_loader;
104  std::map<QString,StatePublisher*> _state_publisher;
105  std::map<QString,DataStreamer*> _data_streamer;
107 
108  std::deque<QDomDocument> _undo_states;
109  std::deque<QDomDocument> _redo_states;
110  QElapsedTimer _undo_timer;
112 
114 
116 
118 
119  std::vector<FileLoadInfo> _loaded_datafiles;
121 
122  std::map<CurveTracker::Parameter, QIcon> _tracker_button_icons;
123 
125 
126  QTimer *_replot_timer;
127  QTimer *_publish_timer;
128 
130 
131  void initializeActions();
132  void initializePlugins(QString subdir_name);
133 
134  void forEachWidget(std::function<void(PlotWidget*, PlotMatrix*, int, int)> op);
135  void forEachWidget(std::function<void(PlotWidget*)> op);
136 
137  void rearrangeGridLayout();
138 
139  QDomDocument xmlSaveState() const;
140  bool xmlLoadState(QDomDocument state_document);
141 
142  void checkAllCurvesFromLayout(const QDomElement& root);
143 
144  void createTabbedDialog(QString suggest_win_name, PlotMatrix *first_tab);
145 
146  void importPlotDataMap(PlotDataMapRef &new_data, bool remove_old);
147 
148  bool isStreamingActive() const ;
149 
150  void closeEvent(QCloseEvent *event);
151 
152  void loadPluginState(const QDomElement &root);
153  QDomElement savePluginState(QDomDocument &doc);
154 
155  std::tuple<double,double,int> calculateVisibleRangeX();
156 
157  void addOrEditMathPlot(const std::string &name, bool edit);
158 
159  void deleteAllData();
160 
161  void updateRecentDataMenu(QStringList new_filenames);
162  void updateRecentLayoutMenu(QStringList new_filenames);
163 
164  void updatedDisplayTime();
165 
166  void updateTimeSlider();
167  void updateTimeOffset();
168 
169  void buildDummyData();
170 
171 signals:
172  void requestRemoveCurveByName(const std::string& name);
173  void activateStreamingMode( bool active);
174  void activateTracker(bool active);
175 
176 public slots:
181 
185 
188 
190 
195 
199 
200  void on_pushButtonOptions_toggled(bool checked);
201  void on_pushButtonActivateGrid_toggled(bool checked);
202  void on_pushButtonRatio_toggled(bool checked);
203  void on_pushButtonPlay_toggled(bool checked);
204  void on_pushButtonUseDateTime_toggled(bool checked);
206  void on_pushButtonRemoveTimeOffset_toggled(bool checked);
207 
208  void on_actionStartStreaming(QString streamer_name);
209 };
210 
211 
212 
213 #endif // MAINWINDOW_H
void on_actionExit_triggered()
void onRedoInvoked()
Definition: mainwindow.cpp:234
void on_actionSaveAllPlotTabs_triggered()
void on_actionClearBuffer_triggered()
DataStreamer * _current_streamer
Definition: mainwindow.h:106
void on_actionStopStreaming_triggered()
filename
QShortcut _streaming_shortcut
Definition: mainwindow.h:93
QTimer * _replot_timer
Definition: mainwindow.h:126
void on_actionSupportPlotJuggler_triggered()
Ui::MainWindow * ui
Definition: mainwindow.h:86
void rearrangeGridLayout()
void initializePlugins(QString subdir_name)
Definition: mainwindow.cpp:436
void on_actionSaveLayout_triggered()
QShortcut _fullscreen_shortcut
Definition: mainwindow.h:92
void on_actionFunctionEditor_triggered()
void onPlotMatrixAdded(PlotMatrix *matrix)
Definition: mainwindow.cpp:668
CurveListPanel * _curvelist_widget
Definition: mainwindow.h:98
void updatedDisplayTime()
bool _test_option
Definition: mainwindow.h:113
std::vector< FileLoadInfo > _loaded_datafiles
Definition: mainwindow.h:119
QTimer * _publish_timer
Definition: mainwindow.h:127
void deleteAllData()
Definition: mainwindow.cpp:932
void resizeEvent(QResizeEvent *)
Definition: mainwindow.cpp:625
bool loadDataFromFiles(QStringList filenames)
void checkAllCurvesFromLayout(const QDomElement &root)
Definition: mainwindow.cpp:699
PlotDataMapRef _mapped_plot_data
Definition: mainwindow.h:100
void closeEvent(QCloseEvent *event)
std::map< CurveTracker::Parameter, QIcon > _tracker_button_icons
Definition: mainwindow.h:122
bool xmlLoadState(QDomDocument state_document)
Definition: mainwindow.cpp:753
bool loadLayoutFromFile(QString filename)
void on_actionReportBug_triggered()
void on_actionClearRecentLayout_triggered()
void on_actionCheatsheet_triggered()
void onTrackerMovedFromWidget(QPointF pos)
Definition: mainwindow.cpp:329
void on_actionClearRecentData_triggered()
std::deque< QDomDocument > _redo_states
Definition: mainwindow.h:109
void onPlotAdded(PlotWidget *plot)
Definition: mainwindow.cpp:631
void updateDataAndReplot(bool replot_hidden_tabs)
void on_actionStartStreaming(QString streamer_name)
void onTimeSlider_valueChanged(double abs_time)
Definition: mainwindow.cpp:340
void addOrEditMathPlot(const std::string &name, bool edit)
MainWindow(const QCommandLineParser &commandline_parser, QWidget *parent=nullptr)
Definition: mainwindow.cpp:45
void on_pushButtonOptions_toggled(bool checked)
void initializeActions()
Definition: mainwindow.cpp:397
double _tracker_time
Definition: mainwindow.h:117
void onSwapPlots(PlotWidget *source, PlotWidget *destination)
void on_pushButtonPlay_toggled(bool checked)
void buildDummyData()
Definition: mainwindow.cpp:561
void on_actionLoadDummyData_triggered()
QElapsedTimer _undo_timer
Definition: mainwindow.h:110
void on_pushButtonStreaming_toggled(bool streaming)
bool loadDataFromFile(const FileLoadInfo &info)
void on_actionLoadLayout_triggered()
void onTrackerTimeUpdated(double absolute_time, bool do_replot)
Definition: mainwindow.cpp:346
TabbedPlotWidget * _main_tabbed_widget
Definition: mainwindow.h:88
void on_editMathPlot(const std::string &plot_name)
void on_actionFullscreen_triggered()
void updateRecentLayoutMenu(QStringList new_filenames)
Definition: mainwindow.cpp:887
QShortcut _playback_shotcut
Definition: mainwindow.h:94
void onPlaybackLoop()
void loadPluginState(const QDomElement &root)
T value
void on_refreshMathPlot(const std::string &plot_name)
void on_tabbedAreaDestroyed(QObject *object)
QDateTime _prev_publish_time
Definition: mainwindow.h:129
CurveTracker::Parameter _tracker_param
Definition: mainwindow.h:120
std::map< QString, DataStreamer * > _data_streamer
Definition: mainwindow.h:105
void updateTimeSlider()
void on_pushButtonRatio_toggled(bool checked)
void on_streamingSpinBox_valueChanged(int value)
void onUndoInvoked()
Definition: mainwindow.cpp:250
QDomElement savePluginState(QDomDocument &doc)
QShortcut _redo_shortcut
Definition: mainwindow.h:91
bool isStreamingActive() const
void createTabbedDialog(QString suggest_win_name, PlotMatrix *first_tab)
Definition: mainwindow.cpp:366
bool _minimized
Definition: mainwindow.h:96
void on_actionDeleteAllData_triggered()
CustomPlotMap _custom_plots
Definition: mainwindow.h:101
void onDeleteMultipleCurves(const std::vector< std::string > &curve_names)
Definition: mainwindow.cpp:815
std::unordered_map< std::string, CustomPlotPtr > CustomPlotMap
bool _autostart_publishers
Definition: mainwindow.h:115
MonitoredValue _time_offset
Definition: mainwindow.h:124
void on_addMathPlot(const std::string &linked_name)
void on_actionAbout_triggered()
std::deque< QDomDocument > _undo_states
Definition: mainwindow.h:108
void on_actionLoadData_triggered()
void onFloatingWindowDestroyed(QObject *object)
void on_streamingToggled()
void activateStreamingMode(bool active)
void on_pushButtonUseDateTime_toggled(bool checked)
void requestRemoveCurveByName(const std::string &name)
void updateTimeOffset()
void forEachWidget(std::function< void(PlotWidget *, PlotMatrix *, int, int)> op)
QShortcut _undo_shortcut
Definition: mainwindow.h:90
void activateTracker(bool active)
std::map< QString, DataLoader * > _data_loader
Definition: mainwindow.h:103
void on_pushButtonActivateGrid_toggled(bool checked)
void importPlotDataMap(PlotDataMapRef &new_data, bool remove_old)
void on_pushButtonTimeTracker_pressed()
bool _disable_undo_logging
Definition: mainwindow.h:111
void onUndoableChange()
Definition: mainwindow.cpp:214
std::map< QString, StatePublisher * > _state_publisher
Definition: mainwindow.h:104
The DataStreamer base class to create your own plugin.
QDomDocument xmlSaveState() const
Definition: mainwindow.cpp:674
void on_splitterMoved(int, int)
Definition: mainwindow.cpp:611
void on_pushButtonRemoveTimeOffset_toggled(bool checked)
void updateRecentDataMenu(QStringList new_filenames)
Definition: mainwindow.cpp:846
void onUpdateLeftTableValues()
Definition: mainwindow.cpp:267
std::tuple< double, double, int > calculateVisibleRangeX()
void onCreateFloatingWindow(PlotMatrix *first_tab=nullptr)


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17