preferencesdialog.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 PREFERENCESDIALOG_H
  21. #define PREFERENCESDIALOG_H
  22. class MainWindow;
  23. class ConfigurationManager;
  24. class SessionSetupManager;
  25. #include <QMetaType>
  26. #include <QDialog>
  27. #include <QComboBox>
  28. #include "starpu_top_types.h"
  29. namespace Ui
  30. {
  31. class PreferencesDialog;
  32. }
  33. class PreferencesDialog: public QDialog
  34. { /* The preferences panel of the application.
  35. Each type of preferences is in a different tab. */
  36. Q_OBJECT
  37. public:
  38. explicit PreferencesDialog(MainWindow *mainWindow,
  39. ConfigurationManager *configurationManager,
  40. SessionSetupManager *sessionSetupManger, int activeTab = 0);
  41. ~PreferencesDialog();
  42. protected:
  43. // Events
  44. void changeEvent(QEvent *e);
  45. void closeEvent(QCloseEvent *ce);
  46. private:
  47. // GUI components
  48. Ui::PreferencesDialog *ui;
  49. QList<QComboBox*> _dataWidgetListComboBoxes;
  50. QList<QComboBox*> _interactiveWidgetListComboBoxes;
  51. // Components
  52. MainWindow *_mainWindow;
  53. ConfigurationManager *_configurationManager;
  54. SessionSetupManager *_sessionSetupManager;
  55. // Metadata
  56. const QHash<DataWidgetType, QString> *_dataWidgetNames;
  57. const QHash<DataType, QSet<DataWidgetType> > *_dataWidgetPossibilities;
  58. const QHash<InteractiveWidgetType, QString> *_interactiveWidgetNames;
  59. const QHash<ParamType, QSet<InteractiveWidgetType> >
  60. *_interactiveWidgetPossibilities;
  61. // Util methods
  62. int indexOfDataWidget(QComboBox* dataWidgetList, DataWidgetType widget);
  63. int indexOfInteractiveWidget(QComboBox* interactiveWidgetList,
  64. InteractiveWidgetType widget);
  65. private slots:
  66. // Other methods
  67. void displayWidgetPreferences();
  68. void displaySessionSetupsList();
  69. void updateDisplayModeIndex(int index);
  70. void updateDataWidgetType(int index);
  71. void updateInteractiveWidgetType(int index);
  72. void loadSessionSetup(QString fileName);
  73. void loadDefaultDataWidgets();
  74. void loadDefaultInteractiveWidgets();
  75. void sessionDescriptionsSetupLoaded(
  76. QList<DataDescriptionSetup> dataDescriptionsSetup,
  77. QList<ParamDescriptionSetup> paramDescriptionsSetup);
  78. void sessionMainWindowSetupLoaded(MainWindowSetup mainWindowSetup);
  79. };
  80. // Model structs for the widget choice comboboxes
  81. Q_DECLARE_METATYPE( DataWidgetListItemData)
  82. Q_DECLARE_METATYPE(InteractiveWidgetListItemData)
  83. #endif // PREFERENCESDIALOG_H