datawidget.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 DATAWIDGET_H
  21. #define DATAWIDGET_H
  22. class MainWindow;
  23. class WidgetWindowsManager;
  24. class QwtPlotCurve;
  25. class QwtPlot;
  26. #include "starpu_top_types.h"
  27. #include "abstractwidgetwindow.h"
  28. class DataWidget : public AbstractWidgetWindow
  29. { /* Displays a single type of data in an internal widget,
  30. under different forms defined by the data widget specifications.
  31. The internal widget can be changed at any time. */
  32. Q_OBJECT
  33. public:
  34. explicit DataWidget(
  35. DataDescription *dataDescription,
  36. WidgetWindowsManager *widgetWindowManager,
  37. MainWindow *mainWindow,
  38. bool inside = false);
  39. ~DataWidget();
  40. // Getters
  41. DataDescription *description() const;
  42. QSize minimumInternalWidgetSize() const;
  43. private:
  44. // Events
  45. void closeEvent(QCloseEvent *ce);
  46. // Metadata
  47. DataDescription *_dataDescription;
  48. const QHash<DataWidgetType, QString> *_dataWidgetNames;
  49. QList<DataWidgetType> _dataWidgetPossibilities;
  50. // GUI components
  51. QWidget *_internalWidget;
  52. QwtPlotCurve *_curve;
  53. CurveData *_curveData;
  54. public slots:
  55. // Setters
  56. void setValue(bool value);
  57. void setValue(int value);
  58. void setValue(double value);
  59. // Other methods
  60. void recreateInternalWidget();
  61. private slots:
  62. void createInternalWidget();
  63. void widgetTypeChanged();
  64. void updateAction(DataWidgetType newWidget);
  65. signals:
  66. void valueChanged(bool value, int dataId);
  67. void valueChanged(int value, int dataId);
  68. void valueChanged(double value, int dataId);
  69. };
  70. #endif // DATAWIDGET_H