dataaggregatorwidget.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. = StarPU-Top for StarPU =
  3. Copyright (C) 2011
  4. William Braik
  5. Yann Courtois
  6. Jean-Marie Couteyen
  7. Anthony Roy
  8. This library is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU Lesser General Public
  10. License as published by the Free Software Foundation; either
  11. version 2.1 of the License, or (at your option) any later version.
  12. This library is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. Lesser General Public License for more details.
  16. You should have received a copy of the GNU Lesser General Public
  17. License along with this library; if not, write to the Free Software
  18. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef DATAAGGREGATORWIDGET_H
  21. #define DATAAGGREGATORWIDGET_H
  22. class MainWindow;
  23. class WidgetWindowsManager;
  24. class QwtPlotItem;
  25. class QwtPlotCurve;
  26. class QwtPlot;
  27. #include <QHash>
  28. #include <QAction>
  29. #include "starpu_top_types.h"
  30. #include "abstractwidgetwindow.h"
  31. class DataAggregatorWidget : public AbstractWidgetWindow
  32. { /* Aggregates data from different data sources so they can
  33. be easily compared. Each data source is displayed as a curve
  34. in a plot widget. */
  35. Q_OBJECT
  36. public:
  37. explicit DataAggregatorWidget(
  38. WidgetWindowsManager *widgetWindowsManager,
  39. MainWindow *mainWindow,
  40. bool inside = false,
  41. QList<int> dataIds = QList<int>());
  42. ~DataAggregatorWidget();
  43. // Getters
  44. QSize minimumInternalWidgetSize() const;
  45. QList<int> aggregatedData() const;
  46. private:
  47. // Metadata
  48. // Curve colors
  49. QList<QColor> _curveColors;
  50. QListIterator<QColor> *_colorIterator;
  51. // Bound data descriptions
  52. QHash<int, QwtPlotCurve*> _curves;
  53. QHash<int, CurveData> _curvesData;
  54. // GUI components
  55. QToolButton *_addDataButton;
  56. QToolButton *_removeDataButton;
  57. QwtPlot *_plot;
  58. // Events
  59. void closeEvent(QCloseEvent *ce);
  60. public slots:
  61. void addData(int dataId);
  62. void removeData(int dataId);
  63. private slots:
  64. void createInternalWidget();
  65. void update(int value, int dataId);
  66. void update(double value, int dataId);
  67. void curveChecked(QwtPlotItem *curve, bool checked);
  68. void dataAdded();
  69. void dataRemoved();
  70. void disableData(int dataId);
  71. void enableData(int dataId);
  72. };
  73. #endif // DATAAGGREGATORWIDGET_H