interactivewidget.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 INTERACTIVEWIDGET_H
  21. #define INTERACTIVEWIDGET_H
  22. #include <QWidget>
  23. #include <QCloseEvent>
  24. #include <QLabel>
  25. #include <QHBoxLayout>
  26. #include "starpu_top_types.h"
  27. class MainWindow;
  28. class InteractiveWidget: public QWidget
  29. { /* Widget which represents a single parameter on the server
  30. and which takes place in the parameters dock of
  31. the main window. Can display the parameter under
  32. different forms defined in the interactive widget
  33. specifications. The internal widget can be changed at any time. */
  34. Q_OBJECT
  35. public:
  36. explicit InteractiveWidget(ParamDescription *paramDescription,
  37. MainWindow *mainWindow);
  38. ~InteractiveWidget();
  39. // Getters
  40. ParamDescription *description() const;
  41. QSize minimumInternalWidgetSize() const;
  42. private:
  43. // Events
  44. void closeEvent(QCloseEvent *ce);
  45. // UI components
  46. MainWindow *_mainWindow;
  47. QLabel *_label;
  48. QWidget *_internalWidget;
  49. QHBoxLayout *_layout;
  50. // Data
  51. ParamDescription *_paramDescription;
  52. const QHash<InteractiveWidgetType, QString> *_interactiveWidgetNames;
  53. QList<InteractiveWidgetType> _interactiveWidgetPossibilities;
  54. // Create the internal widget
  55. void createInternalWidget();
  56. /** SLOTS **/
  57. public slots:
  58. // Setters
  59. void setValue(bool value);
  60. void setValue(int value);
  61. void setValue(double value);
  62. // Other methods
  63. void recreateInternalWidget();
  64. private slots:
  65. // Other methods
  66. void sliderValueChanged();
  67. void wheelValueChanged();
  68. void knobValueChanged();
  69. void dialValueChanged();
  70. void notifyValueChanged(bool value);
  71. void notifyValueChanged(int value);
  72. void notifyValueChanged(double value);
  73. void widgetTypeChanged();
  74. void updateAction(InteractiveWidgetType newWidget);
  75. signals:
  76. void paramValueChanged(int id, bool value);
  77. void paramValueChanged(int id, int value);
  78. void paramValueChanged(int id, double value);
  79. };
  80. #endif // INTERACTIVEWIDGET_H