ctkPluginGenerator_p.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef CTKPLUGINGENERATOR_H
  16. #define CTKPLUGINGENERATOR_H
  17. #include <QMainWindow>
  18. #include <QMultiMap>
  19. #include <ctkPluginGeneratorAbstractUiExtension.h>
  20. class ctkPluginFramework;
  21. class QListWidgetItem;
  22. class QFileSystemModel;
  23. #include <QModelIndex>
  24. namespace Ui {
  25. class ctkPluginGeneratorMainWindow;
  26. }
  27. class ctkPluginGenerator : public QMainWindow
  28. {
  29. Q_OBJECT
  30. public:
  31. explicit ctkPluginGenerator(ctkPluginFramework* framework, QWidget *parent = 0);
  32. ~ctkPluginGenerator();
  33. protected Q_SLOTS:
  34. void previewClicked();
  35. void generateClicked();
  36. void previewIndexChanged(const QModelIndex& index);
  37. void extensionItemClicked(QListWidgetItem* item);
  38. void errorMessageChanged(const QString& errMsg);
  39. void menuOptionsTriggered();
  40. private:
  41. void extensionClicked(ctkPluginGeneratorAbstractUiExtension* extension);
  42. QString createPlugin(const QString& path);
  43. bool createPreview();
  44. enum GeneratorMode {
  45. EDIT,
  46. PREVIEW
  47. };
  48. ctkPluginFramework *const framework;
  49. Ui::ctkPluginGeneratorMainWindow *ui;
  50. GeneratorMode mode;
  51. QFileSystemModel* previewModel;
  52. QString previewDir;
  53. QMultiMap<int, ctkPluginGeneratorAbstractUiExtension*> uiExtensionMap;
  54. QHash<int, ctkPluginGeneratorAbstractUiExtension*> idToExtensionMap;
  55. };
  56. #endif // CTKPLUGINGENERATOR_H