Go to the documentation of this file.00001 #ifndef MAINWINDOW_H
00002 #define MAINWINDOW_H
00003
00004 #include <QMainWindow>
00005 #include <QElapsedTimer>
00006 #include <QShortcut>
00007 #include <QCommandLineParser>
00008 #include <QSignalMapper>
00009 #include <set>
00010 #include <deque>
00011 #include <functional>
00012 #include "plotwidget.h"
00013 #include "plotmatrix.h"
00014 #include "filterablelistwidget.h"
00015 #include "tabbedplotwidget.h"
00016 #include "subwindow.h"
00017 #include "realslider.h"
00018 #include "utils.h"
00019 #include "PlotJuggler/dataloader_base.h"
00020 #include "PlotJuggler/statepublisher_base.h"
00021 #include "PlotJuggler/datastreamer_base.h"
00022
00023 namespace Ui {
00024 class MainWindow;
00025 }
00026
00027
00028 class MainWindow : public QMainWindow
00029 {
00030 Q_OBJECT
00031
00032 public:
00033 explicit MainWindow(const QCommandLineParser& commandline_parser, QWidget *parent = 0);
00034 ~MainWindow();
00035
00036 public slots:
00037 void onUndoableChange();
00038
00039 private slots:
00040
00041 void onTrackerTimeUpdated(double absolute_time );
00042
00043 void onTrackerMovedFromWidget(QPointF pos );
00044
00045 void onSplitterMoved(int, int);
00046
00047 void resizeEvent(QResizeEvent *) ;
00048
00049 void onPlotAdded(PlotWidget* plot);
00050
00051 void onPlotMatrixAdded(PlotMatrix* matrix);
00052
00053 void onActionSaveLayout();
00054
00055 void onActionLoadLayout(bool reload_previous = false);
00056
00057 void onActionLoadLayoutFromFile(QString filename, bool load_data);
00058
00059 void onActionLoadDataFile(bool reload_from_settings = false);
00060
00061 void onActionLoadDataFileImpl(QString filename, bool reuse_last_configuration = false );
00062
00063 void onActionReloadDataFileFromSettings();
00064
00065 void onActionReloadRecentLayout();
00066
00067 void onActionLoadStreamer(QString streamer_name);
00068
00069 void onUndoInvoked();
00070
00071 void onRedoInvoked();
00072
00073 void on_tabbedAreaDestroyed(QObject*object);
00074
00075 void onFloatingWindowDestroyed(QObject*object);
00076
00077 void onCreateFloatingWindow(PlotMatrix* first_tab = NULL);
00078
00079 void onSwapPlots(PlotWidget* source, PlotWidget* destination);
00080
00081 void on_pushButtonStreaming_toggled(bool streaming);
00082
00083 void updateDataAndReplot();
00084
00085 void on_streamingSpinBox_valueChanged(int value);
00086
00087 void onDeleteLoadedData();
00088
00089 void on_actionAbout_triggered();
00090
00091 void on_actionStopStreaming_triggered();
00092
00093 void on_actionExit_triggered();
00094
00095 void on_actionQuick_Help_triggered();
00096
00097 void onTimeSlider_valueChanged(double value);
00098
00099 void updateLeftTableValues();
00100
00101 void deleteDataOfSingleCurve(const QString &curve_name);
00102
00103 void on_pushButtonRemoveTimeOffset_toggled(bool checked);
00104
00105 void on_pushButtonOptions_toggled(bool checked);
00106
00107 void on_pushButtonActivateGrid_toggled(bool checked);
00108
00109 void on_actionClearBuffer_triggered();
00110
00111 void on_pushButtonUseDateTime_toggled(bool checked);
00112
00113 void on_pushButtonTimeTracker_pressed();
00114
00115 void on_minimizeView();
00116
00117 private:
00118
00119 Ui::MainWindow *ui;
00120
00121 TabbedPlotWidget * _main_tabbed_widget;
00122
00123 QShortcut _undo_shortcut;
00124 QShortcut _redo_shortcut;
00125 QShortcut _minimize_view;
00126
00127 bool _minimized;
00128
00129 void createActions();
00130
00131 FilterableListWidget* _curvelist_widget;
00132
00133 void updatedDisplayTime();
00134
00135 void forEachWidget(std::function<void(PlotWidget*, PlotMatrix*, int, int)> op);
00136
00137 void forEachWidget(std::function<void(PlotWidget*)> op);
00138
00139 void updateTimeSlider();
00140
00141 void buildDummyData();
00142
00143 PlotDataMap _mapped_plot_data;
00144
00145 void rearrangeGridLayout();
00146
00147 void loadPlugins(QString subdir_name);
00148
00149 std::map<QString,DataLoader*> _data_loader;
00150
00151 std::map<QString,StatePublisher*> _state_publisher;
00152
00153 std::map<QString,DataStreamer*> _data_streamer;
00154
00155 DataStreamer* _current_streamer;
00156
00157 QDomDocument xmlSaveState() const;
00158
00159 bool xmlLoadState(QDomDocument state_document);
00160
00161 std::deque<QDomDocument> _undo_states;
00162
00163 std::deque<QDomDocument> _redo_states;
00164
00165 QElapsedTimer _undo_timer;
00166
00167 bool _disable_undo_logging;
00168
00169 bool _test_option;
00170
00171 double _tracker_time;
00172
00173 QString _loaded_datafile;
00174
00175 QString _last_load_configuration;
00176
00177 QString _last_stream_configuration;
00178
00179 QSignalMapper *_streamer_signal_mapper;
00180
00181 void createTabbedDialog(QString suggest_win_name, PlotMatrix *first_tab);
00182
00183 void importPlotDataMap(const PlotDataMap &new_data, bool delete_older);
00184
00185 bool isStreamingActive() const ;
00186
00187 CurveTracker::Parameter _tracker_param;
00188
00189 std::map<CurveTracker::Parameter, QIcon> _tracker_button_icons;
00190
00191 void closeEvent(QCloseEvent *event);
00192
00193 protected:
00194
00195 MonitoredValue _time_offset;
00196
00197 QTimer *_replot_timer;
00198 signals:
00199 void requestRemoveCurveByName(const QString& name);
00200
00201 void activateStreamingMode( bool active);
00202
00203 void activateTracker(bool active);
00204
00205 };
00206
00207
00208
00209 #endif // MAINWINDOW_H