From b0b5c33c8bb9437d04415e6071b8a23d74786ace Mon Sep 17 00:00:00 2001 From: Maxime Calka Date: Fri, 6 Mar 2020 11:48:33 +0100 Subject: [PATCH 1/4] Add new file wizard --- .../wizard/ActionCreationState - Copy.cpp | 131 ++ .../wizard/ActionCreationState - Copy.h | 110 ++ .../wizard/CepCreateRecapState.cpp | 15 + sdk/applications/wizard/CepCreateRecapState.h | 1 + .../wizard/CepCreateRecapWidget.cpp | 45 +- .../wizard/CepCreateRecapWidget.h | 12 +- .../wizard/CepCreateRecapWidget.ui | 96 ++ sdk/applications/wizard/DefaultGUIText.h | 70 + .../wizard/ExtensionSummaryState.cpp | 7 + .../wizard/ExtensionSummaryState.h | 3 + .../wizard/ViewerCreationState.cpp | 127 ++ sdk/applications/wizard/ViewerCreationState.h | 102 ++ .../wizard/ViewerDescriptionState.cpp | 118 ++ .../wizard/ViewerDescriptionState.h | 74 + .../wizard/ViewerDescriptionWidget.cpp | 182 +++ .../wizard/ViewerDescriptionWidget.h | 81 + .../wizard/ViewerDescriptionWidget.ui | 1306 +++++++++++++++++ .../wizard/ViewerExtensionCreationState.cpp | 137 ++ .../wizard/ViewerExtensionCreationState.h | 108 ++ .../ViewerExtensionDependenciesState.cpp | 81 + .../wizard/ViewerExtensionDependenciesState.h | 70 + .../ViewerExtensionDescriptionState.cpp | 57 + .../wizard/ViewerExtensionDescriptionState.h | 67 + .../ViewerExtensionDescriptionWidget.cpp | 108 ++ .../wizard/ViewerExtensionDescriptionWidget.h | 68 + .../ViewerExtensionDescriptionWidget.ui | 766 ++++++++++ .../wizard/ViewerSummaryState.cpp | 87 ++ sdk/applications/wizard/ViewerSummaryState.h | 65 + .../wizard/ViewerSummaryWidget.cpp | 80 + sdk/applications/wizard/ViewerSummaryWidget.h | 71 + .../wizard/ViewerSummaryWidget.ui | 695 +++++++++ .../wizard/ViewersCreationState.cpp | 70 + .../wizard/ViewersCreationState.h | 67 + .../wizard/ViewersCreationWidget.cpp | 97 ++ .../wizard/ViewersCreationWidget.h | 77 + .../wizard/ViewersCreationWidget.ui | 673 +++++++++ sdk/applications/wizard/WizardController.cpp | 8 + 37 files changed, 5920 insertions(+), 12 deletions(-) create mode 100644 sdk/applications/wizard/ActionCreationState - Copy.cpp create mode 100644 sdk/applications/wizard/ActionCreationState - Copy.h create mode 100644 sdk/applications/wizard/ViewerCreationState.cpp create mode 100644 sdk/applications/wizard/ViewerCreationState.h create mode 100644 sdk/applications/wizard/ViewerDescriptionState.cpp create mode 100644 sdk/applications/wizard/ViewerDescriptionState.h create mode 100644 sdk/applications/wizard/ViewerDescriptionWidget.cpp create mode 100644 sdk/applications/wizard/ViewerDescriptionWidget.h create mode 100644 sdk/applications/wizard/ViewerDescriptionWidget.ui create mode 100644 sdk/applications/wizard/ViewerExtensionCreationState.cpp create mode 100644 sdk/applications/wizard/ViewerExtensionCreationState.h create mode 100644 sdk/applications/wizard/ViewerExtensionDependenciesState.cpp create mode 100644 sdk/applications/wizard/ViewerExtensionDependenciesState.h create mode 100644 sdk/applications/wizard/ViewerExtensionDescriptionState.cpp create mode 100644 sdk/applications/wizard/ViewerExtensionDescriptionState.h create mode 100644 sdk/applications/wizard/ViewerExtensionDescriptionWidget.cpp create mode 100644 sdk/applications/wizard/ViewerExtensionDescriptionWidget.h create mode 100644 sdk/applications/wizard/ViewerExtensionDescriptionWidget.ui create mode 100644 sdk/applications/wizard/ViewerSummaryState.cpp create mode 100644 sdk/applications/wizard/ViewerSummaryState.h create mode 100644 sdk/applications/wizard/ViewerSummaryWidget.cpp create mode 100644 sdk/applications/wizard/ViewerSummaryWidget.h create mode 100644 sdk/applications/wizard/ViewerSummaryWidget.ui create mode 100644 sdk/applications/wizard/ViewersCreationState.cpp create mode 100644 sdk/applications/wizard/ViewersCreationState.h create mode 100644 sdk/applications/wizard/ViewersCreationWidget.cpp create mode 100644 sdk/applications/wizard/ViewersCreationWidget.h create mode 100644 sdk/applications/wizard/ViewersCreationWidget.ui diff --git a/sdk/applications/wizard/ActionCreationState - Copy.cpp b/sdk/applications/wizard/ActionCreationState - Copy.cpp new file mode 100644 index 00000000..e1924535 --- /dev/null +++ b/sdk/applications/wizard/ActionCreationState - Copy.cpp @@ -0,0 +1,131 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ + +// Include .h file +#include "ActionCreationState.h" +#include "WizardMainWindow.h" +#include "ActionExtensionCreationState.h" + +#include "ActionDescriptionWidget.h" +#include "ActionDescriptionState.h" +#include "ActionAddParameterWidget.h" +#include "ActionAddParameterState.h" +#include "ActionClassificationWidget.h" +#include "ActionClassificationState.h" +#include "ActionSummaryWidget.h" +#include "ActionSummaryState.h" + +#include +#include +#include + +ActionCreationState::ActionCreationState(QString name, WizardMainWindow* mainWindow, cepcoreschema::Cep* domCep, ActionExtensionCreationState* parent) : QState(parent) { + this->name = name; + this->cancelled = false; + this->domAction = nullptr; + + this->domActionExtension = nullptr; + this->domCep = domCep; + + createSubStates(mainWindow); +} + +void ActionCreationState::resetDomActionExtension(cepcoreschema::ActionExtension* domActionExtension) { + this->domActionExtension = domActionExtension; +} + +void ActionCreationState::onEntry(QEvent* event) { + this->cancelled = false; + cepcoreschema::Classification classification("No Family"); + + if (domAction != nullptr) { + delete domAction; + domAction = nullptr; + } + + domAction = new cepcoreschema::Action("An Action", "An action description", "None", classification); + actionDescriptionState->resetDomAction(domAction, domActionExtension); + actionAddParameterState->resetDomAction(domAction); + actionClassificationState->resetDomAction(domAction); + actionSummaryState->resetAction(domAction); + +} + +void ActionCreationState::onExit(QEvent* event) { + if (! cancelled) { + domActionExtension->actions().action().push_back((*domAction)); + } + else { + if (domAction != nullptr) { + delete domAction; + domAction = nullptr; + } + } +} + +void ActionCreationState::actionFinished() { + cancelled = false; + emit nextACS(); +} + +void ActionCreationState::actionCancelled() { + cancelled = true; + emit nextACS(); +} + +void ActionCreationState::createSubStates(WizardMainWindow* mainWindow) { + actionDescriptionWidget = new ActionDescriptionWidget(nullptr); + actionDescriptionState = new ActionDescriptionState("Action Description", actionDescriptionWidget, mainWindow, domCep, this); + + actionAddParameterWidget = new ActionAddParameterWidget(nullptr); + actionAddParameterState = new ActionAddParameterState("Action Creation", actionAddParameterWidget, mainWindow, this); + + actionClassificationWidget = new ActionClassificationWidget(nullptr); + actionClassificationState = new ActionClassificationState("Action Classification", actionClassificationWidget, mainWindow, this); + + actionSummaryWidget = new ActionSummaryWidget(nullptr); + actionSummaryState = new ActionSummaryState("Action Summary", actionSummaryWidget, mainWindow, this); + + this->setInitialState(actionDescriptionState); + + actionDescriptionState->addTransition(actionDescriptionWidget, SIGNAL(next()), actionAddParameterState); + + actionAddParameterState->addTransition(actionAddParameterWidget, SIGNAL(next()), actionClassificationState); + actionAddParameterState->addTransition(actionAddParameterWidget, SIGNAL(previous()), actionDescriptionState); + + actionClassificationState->addTransition(actionClassificationWidget, SIGNAL(next()), actionSummaryState); + actionClassificationState->addTransition(actionClassificationWidget, SIGNAL(previous()), actionAddParameterState); + + actionSummaryState->addTransition(actionSummaryWidget, SIGNAL(previous()), actionClassificationState); + + QObject::connect(actionDescriptionWidget, SIGNAL(cancel()), this, SLOT(actionCancelled())); + QObject::connect(actionAddParameterWidget, SIGNAL(cancel()), this, SLOT(actionCancelled())); + QObject::connect(actionClassificationWidget, SIGNAL(cancel()), this, SLOT(actionCancelled())); + QObject::connect(actionSummaryWidget, SIGNAL(cancel()), this, SLOT(actionCancelled())); + + + QObject::connect(actionSummaryWidget, SIGNAL(next()), this, SLOT(actionFinished())); + +} diff --git a/sdk/applications/wizard/ActionCreationState - Copy.h b/sdk/applications/wizard/ActionCreationState - Copy.h new file mode 100644 index 00000000..1b455636 --- /dev/null +++ b/sdk/applications/wizard/ActionCreationState - Copy.h @@ -0,0 +1,110 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ +#ifndef ACTIONCREATIONSTATE_H +#define ACTIONCREATIONSTATE_H + +#include +#include + +class WizardMainWindow; +class ActionExtensionCreationState; + +// Sub-states +class ActionDescriptionWidget; +class ActionDescriptionState; +class ActionAddParameterWidget; +class ActionAddParameterState; +class ActionClassificationWidget; +class ActionClassificationState; +class ActionSummaryWidget; +class ActionSummaryState; + +// Dependency from cepcoreschema +// Declaration here to avoid declaration in dependant projects. +namespace cepcoreschema { +class ActionExtension; +class Action; +class Cep; +} + +/** + * @ingroup group_sdk_application_wizard + * + * @brief + * State to create one action. + * + * This state manages sub-state to create one action. + * + */ +class ActionCreationState : public QState { + + Q_OBJECT; + +public: + /** Constructor */ + ActionCreationState(QString name, WizardMainWindow* mainWidnow, cepcoreschema::Cep* domCep, ActionExtensionCreationState* parent); + + /** Destructor */ + ~ActionCreationState() override = default; + + void resetDomActionExtension(cepcoreschema::ActionExtension* domActionExtension); + +signals: + void nextACS(); + +public slots: + virtual void actionFinished(); + virtual void actionCancelled(); + +protected: + /// Reimplemented from QState + /// @{ + void onEntry(QEvent* event) override; + + void onExit(QEvent* event) override; + ///@} + + /// Substates (to be updated with domAction at each entry) + ActionDescriptionWidget* actionDescriptionWidget; + ActionDescriptionState* actionDescriptionState; + ActionAddParameterWidget* actionAddParameterWidget; + ActionAddParameterState* actionAddParameterState; + ActionClassificationWidget* actionClassificationWidget; + ActionClassificationState* actionClassificationState; + ActionSummaryWidget* actionSummaryWidget; + ActionSummaryState* actionSummaryState; + + +private: + void createSubStates(WizardMainWindow* mainWindow); + + bool cancelled; + QString name; + cepcoreschema::ActionExtension* domActionExtension; + cepcoreschema::Action* domAction; + cepcoreschema::Cep* domCep; + +}; +#endif diff --git a/sdk/applications/wizard/CepCreateRecapState.cpp b/sdk/applications/wizard/CepCreateRecapState.cpp index 026b4b78..33accfa5 100644 --- a/sdk/applications/wizard/CepCreateRecapState.cpp +++ b/sdk/applications/wizard/CepCreateRecapState.cpp @@ -49,6 +49,7 @@ void CepCreateRecapState::onEntry(QEvent* event) { if (cepCreateRecapWidget != nullptr) { updateCepDescription(cepCreateRecapWidget); updateActionExtensions(cepCreateRecapWidget); + updateViewerExtensions(cepCreateRecapWidget); updateComponentExtensions(cepCreateRecapWidget); updateCepLibraries(cepCreateRecapWidget); } @@ -71,6 +72,20 @@ void CepCreateRecapState::updateCepDescription(CepCreateRecapWidget* cepCreateRe cepCreateRecapWidget->setContactItself(cepContact); } + +void CepCreateRecapState::updateViewerExtensions(CepCreateRecapWidget* cepCreateRecapWidget) { + cepCreateRecapWidget->emptyExistingViewerExtensions(); + if (domCep->viewerExtensions().present()) { + cepcoreschema::ViewerExtensions cepViewerExtensions = domCep->viewerExtensions().get(); + cepcoreschema::ViewerExtensions::viewerExtension_iterator it; + for (it = cepViewerExtensions.viewerExtension().begin(); it != cepViewerExtensions.viewerExtension().end(); it++) { + cepcoreschema::ViewerExtension extension = (*it); + QString viewerExtensionName = extension.name().c_str(); + cepCreateRecapWidget->addViewerExtension(viewerExtensionName); + } + } +} + void CepCreateRecapState::updateActionExtensions(CepCreateRecapWidget* cepCreateRecapWidget) { cepCreateRecapWidget->emptyExistingActionExtensions(); if (domCep->actionExtensions().present()) { diff --git a/sdk/applications/wizard/CepCreateRecapState.h b/sdk/applications/wizard/CepCreateRecapState.h index 4ccd4b6e..eb8fb20e 100644 --- a/sdk/applications/wizard/CepCreateRecapState.h +++ b/sdk/applications/wizard/CepCreateRecapState.h @@ -58,6 +58,7 @@ protected: private: void updateCepDescription(CepCreateRecapWidget* cepCreateRecapWidget); + void updateViewerExtensions(CepCreateRecapWidget * cepCreateRecapWidget); void updateActionExtensions(CepCreateRecapWidget* cepCreateRecapWidget); void updateComponentExtensions(CepCreateRecapWidget* cepCreateRecapWidget); void updateCepLibraries(CepCreateRecapWidget* cepCreateRecapWidget); diff --git a/sdk/applications/wizard/CepCreateRecapWidget.cpp b/sdk/applications/wizard/CepCreateRecapWidget.cpp index 68db0e72..914487d9 100644 --- a/sdk/applications/wizard/CepCreateRecapWidget.cpp +++ b/sdk/applications/wizard/CepCreateRecapWidget.cpp @@ -36,6 +36,16 @@ static const QString defaultExistingActionExtensions = "\ \ "; +static const QString defaultExistingViewerExtensions = "\ +\ + \ + \ +

Created Viewer Extensions:

\ +
    \ +
\ + \ +"; + static const QString defaultExistingComponentExtensions = "\ \ \ @@ -62,6 +72,7 @@ CepCreateRecapWidget::CepCreateRecapWidget(QWidget* parent) : QWidget(parent) { ui.setupUi(this); createdLibrariesString = defaultExistingLibraries; createdActionsString = defaultExistingActionExtensions; + createdViewersString = defaultExistingViewerExtensions; createdComponentsString = defaultExistingComponentExtensions; } @@ -84,6 +95,11 @@ void CepCreateRecapWidget::setContactItself(QString contact) { void CepCreateRecapWidget::addActionExtensionClicked() { emit addActionExtension(); } + +void CepCreateRecapWidget::addViewerExtensionClicked() { + emit addViewerExtension(); +} + void CepCreateRecapWidget::addComponentExtensionClicked() { emit addComponentExtension(); } @@ -97,6 +113,21 @@ void CepCreateRecapWidget::emptyExistingActionExtensions() { ui.existingActionExtensions->setHtml(createdActionsString); } +void CepCreateRecapWidget::emptyExistingViewerExtensions() { + createdViewersString = defaultExistingViewerExtensions; + ui.existingViewerExtensions->setHtml(createdViewersString); +} + +void CepCreateRecapWidget::emptyExistingComponentExtensions() { + createdComponentsString = defaultExistingComponentExtensions; + ui.existingComponentExtensions->setHtml(createdComponentsString); +} + +void CepCreateRecapWidget::emptyExistingLibraries() { + createdLibrariesString = defaultExistingLibraries; + ui.existingLibrariesTextEdit->setHtml(createdLibrariesString); +} + void CepCreateRecapWidget::addActionExtension(QString actionExtensionName) { QString toBeInserted = "
  • " + actionExtensionName + "
  • \n"; int index = createdActionsString.lastIndexOf(""); @@ -105,9 +136,12 @@ void CepCreateRecapWidget::addActionExtension(QString actionExtensionName) { ui.existingActionExtensions->setHtml(createdActionsString); } -void CepCreateRecapWidget::emptyExistingComponentExtensions() { - createdComponentsString = defaultExistingComponentExtensions; - ui.existingComponentExtensions->setHtml(createdComponentsString); +void CepCreateRecapWidget::addViewerExtension(QString viewerExtensionName) { + QString toBeInserted = "
  • " + viewerExtensionName + "
  • \n"; + int index = createdViewersString.lastIndexOf(""); + + createdViewersString.insert(index, toBeInserted); + ui.existingViewerExtensions->setHtml(createdViewersString); } void CepCreateRecapWidget::addComponentExtension(QString componentExtensionName) { @@ -118,11 +152,6 @@ void CepCreateRecapWidget::addComponentExtension(QString componentExtensionName) ui.existingComponentExtensions->setHtml(createdComponentsString); } -void CepCreateRecapWidget::emptyExistingLibraries() { - createdLibrariesString = defaultExistingLibraries; - ui.existingLibrariesTextEdit->setHtml(createdLibrariesString); -} - void CepCreateRecapWidget::addLibrary(QString libraryNamme) { QString toBeInserted = "
  • " + libraryNamme + "
  • \n"; int index = createdLibrariesString.lastIndexOf(""); diff --git a/sdk/applications/wizard/CepCreateRecapWidget.h b/sdk/applications/wizard/CepCreateRecapWidget.h index 0cfbcd49..e55a2787 100644 --- a/sdk/applications/wizard/CepCreateRecapWidget.h +++ b/sdk/applications/wizard/CepCreateRecapWidget.h @@ -53,17 +53,19 @@ public: void setContactItself(QString contact); void emptyExistingActionExtensions(); - void addActionExtension(QString actionExtensionName); + void emptyExistingViewerExtensions(); + void emptyExistingComponentExtensions(); + void emptyExistingLibraries(); - void emptyExistingComponentExtensions(); + void addActionExtension(QString actionExtensionName); + void addViewerExtension(QString viewerExtensionName); void addComponentExtension(QString componentExtensionName); - - void emptyExistingLibraries(); void addLibrary(QString libraryNamme); public slots: virtual void nextButtonClicked(); virtual void addActionExtensionClicked(); + virtual void addViewerExtensionClicked(); virtual void addComponentExtensionClicked(); virtual void addLibrariesClicked(); @@ -71,6 +73,7 @@ signals: void next(); void addLibrary(); void addActionExtension(); + void addViewerExtension(); void addComponentExtension(); private: @@ -79,6 +82,7 @@ private: QString createdLibrariesString; QString createdActionsString; + QString createdViewersString; QString createdComponentsString; }; #endif diff --git a/sdk/applications/wizard/CepCreateRecapWidget.ui b/sdk/applications/wizard/CepCreateRecapWidget.ui index ff310b43..43e7b2a2 100644 --- a/sdk/applications/wizard/CepCreateRecapWidget.ui +++ b/sdk/applications/wizard/CepCreateRecapWidget.ui @@ -187,6 +187,33 @@ + + + + + + + + 0 + 32 + + + + + 64 + 64 + + + + + + + + :/resources/edit_add.png:/resources/edit_add.png + + + + @@ -219,6 +246,38 @@ + + + + + + + true + + + + 64 + 128 + + + + + 128 + 128 + + + + + + + :/resources/viewer.png + + + true + + + + @@ -297,6 +356,13 @@ <html><head/><body><p align="center"><span style=" font-style:italic;">Add An Action Extension</span></p></body></html> + + + + + <html><head/><body><p align="center"><span style=" font-style:italic;">Add An Viewer Extension</span></p></body></html> + + @@ -410,6 +476,19 @@ + + + + + 0 + 0 + + + + true + + + @@ -588,10 +667,27 @@ + + addViewerPushButton + clicked() + CepCreateRecapWidget + addViewerExtensionClicked() + + + 604 + 466 + + + 581 + 540 + + + nextButtonClicked() addActionExtensionClicked() + addViewerExtensionClicked() addComponentExtensionClicked() addLibrariesClicked() diff --git a/sdk/applications/wizard/DefaultGUIText.h b/sdk/applications/wizard/DefaultGUIText.h index ef40d551..e0c0f0d6 100644 --- a/sdk/applications/wizard/DefaultGUIText.h +++ b/sdk/applications/wizard/DefaultGUIText.h @@ -110,9 +110,28 @@ static const QString defaultActionExtensionExplanation = "\ \ "; +/* ------------------- Action Extension Description Widget ------------------ */ +static const QString defaultViewerExtensionExplanation = "\ +\ + \ + \ +

    \ + An Viewer Extension manages one or a set of actions targeting the same objective.
    \ + There is one directory for each Viewer Extension.
    \ + Each Viewer Extension results in one dynamic library (dll, so or dylib).\ +

    \ +

    Please fill-in the information requested for creating of an Viewer Extension.

    \ +

    The Viewers composing this Viewer Extension will be added in the next forms.

    \ + \ +\ +"; + static const QString defaultActionExtensionName = "Example Of An Action Extension"; static const QString defaultActionExtensionDescription = "This extension description is automatically generated in order to show new users how to easily write an extension with one or several Action(s)."; +static const QString defaultViewerExtensionName = "Example Of An Viewer Extension"; +static const QString defaultViewerExtensionDescription = "This extension description is automatically generated in order to show new users how to easily write an extension with one or several Viewer(s)."; + /* ------------------- Component Extension Description Widget ------------------ */ static const QString defaultComponentExtensionExplanation = "\ \ @@ -145,6 +164,15 @@ static const QString defaultRealActionName = "Please provide a real na static const QString defaultRealActionDescription = "Please provide a real description for your action,\nA real description should explain the goal and tell a little bit about the method of your action (for instance, you can reference a/your paper here).\n"; static const QString defaultActionNameAndExtension = "Please provide a name that is different from the name of the Action Extension.\n"; +/* ------------------------ Viewer Description Widget ----------------------- */ + +static const QString defaultViewerName = "Example Of An Viewer"; +static const QString defaultViewerDescription = "This description is automatically generated in order to show new users how to easily write an Viewer."; + +static const QString defaultRealViewerName = "Please provide a real name for your viewer,\nA real action name should express what your viewer is about.\n"; +static const QString defaultRealViewerDescription = "Please provide a real description for your viewer,\nA real description should explain the goal and tell a little bit about the method of your viewer (for instance, you can reference a/your paper here).\n"; +static const QString defaultViewerNameAndExtension = "Please provide a name that is different from the name of the Viewer Extension.\n"; + /* ------------------------ Component Description Widget ----------------------- */ static const QString defaultComponentName = "Example Of A Component"; @@ -174,6 +202,17 @@ static const QString defaultCreatedActionsString = "\ \ "; +/* ----------------------- Actions Creation Widget --------------------------- */ +static const QString defaultCreatedViewersString = "\ +\ +\ +\ +

    Created Viewer(s):

    \ +
      \ +
    \ +\ +"; + /* ----------------------- Components Creation Widget --------------------------- */ static const QString defaultCreatedComponentsString = "\ \ @@ -217,6 +256,37 @@ static const QString defaultActionSummary = "\ "; +/* ----------------------- Viewer Symmary --------------------------- */ +static const QString defaultViewerSummary = "\ +\ + \ +\ +

    Summary

    \ +

    You are about to add the following Action

    \ +
      \ +
    • Name: @NAME@
    • \ +
    • Description: @DESCRIPTION@
    • \ +
    • Component: @COMPONENT@
    • \ +
    • Parameter(s): \ +
        \ +@PARAMETERS_LIST@ \ +
      \ +
    • \ +
    • Family: @FAMILY@
    • \ +
    • Tag(s): \ +
        \ +@TAGS_LIST@ \ +
      \ +
    • \ +
    \ +
    \ +

    If you want to modify some elements of your Action, click on Previous.

    \ +

    If you want to cancel the creation of this Action, click on Cancel.

    \ +

    Clicking on Next will bring you back to the Action Extension page.

    \ +\ +"; + + /* ----------------------- Component Symmary --------------------------- */ static const QString defaultComponentSummary = "\ \ diff --git a/sdk/applications/wizard/ExtensionSummaryState.cpp b/sdk/applications/wizard/ExtensionSummaryState.cpp index 35951b11..7eb11455 100644 --- a/sdk/applications/wizard/ExtensionSummaryState.cpp +++ b/sdk/applications/wizard/ExtensionSummaryState.cpp @@ -37,6 +37,7 @@ #include #include #include +#include ExtensionSummaryState::ExtensionSummaryState(QString name, ExtensionSummaryWidget* widget, QString type, WizardMainWindow* mainWindow, QState* parent) @@ -61,6 +62,12 @@ void ExtensionSummaryState::setComponentExtension(cepcoreschema::ComponentExtens } +void ExtensionSummaryState::setViewerExtension(cepcoreschema::ViewerExtension* domViewerExtension) { + if (this->type == "Viewer") { + this->domViewerExtension = domViewerExtension; + this->domComponentExtension = nullptr; + } +} void ExtensionSummaryState::onEntry(QEvent* event) { WizardState::onEntry(event); diff --git a/sdk/applications/wizard/ExtensionSummaryState.h b/sdk/applications/wizard/ExtensionSummaryState.h index 5818973d..bb2820b3 100644 --- a/sdk/applications/wizard/ExtensionSummaryState.h +++ b/sdk/applications/wizard/ExtensionSummaryState.h @@ -34,6 +34,7 @@ class ExtensionSummaryWidget; namespace cepcoreschema { class ActionExtension; class ComponentExtension; +class ViewerExtension; } /** @@ -56,6 +57,7 @@ public: void setActionExtension(cepcoreschema::ActionExtension* domActionExtension); void setComponentExtension(cepcoreschema::ComponentExtension* domComponentExtension); + void setViewerExtension(cepcoreschema::ViewerExtension * domViewerExtension); protected: void onEntry(QEvent* event) override; @@ -65,6 +67,7 @@ protected: cepcoreschema::ActionExtension* domActionExtension; cepcoreschema::ComponentExtension* domComponentExtension; + cepcoreschema::ViewerExtension* domViewerExtension; }; #endif diff --git a/sdk/applications/wizard/ViewerCreationState.cpp b/sdk/applications/wizard/ViewerCreationState.cpp new file mode 100644 index 00000000..e6066747 --- /dev/null +++ b/sdk/applications/wizard/ViewerCreationState.cpp @@ -0,0 +1,127 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ + +// Include .h file +#include "ViewerCreationState.h" +#include "WizardMainWindow.h" +#include "ViewerExtensionCreationState.h" + +#include "ViewerDescriptionWidget.h" +#include "ViewerDescriptionState.h" +#include "ViewerSummaryWidget.h" +#include "ViewerSummaryState.h" + +#include +#include +#include + +ViewerCreationState::ViewerCreationState(QString name, WizardMainWindow* mainWindow, cepcoreschema::Cep* domCep, ViewerExtensionCreationState* parent) : QState(parent) { + this->name = name; + this->cancelled = false; + this->domViewer = nullptr; + + this->domViewerExtension = nullptr; + this->domCep = domCep; + + createSubStates(mainWindow); +} + +void ViewerCreationState::resetDomViewerExtension(cepcoreschema::ViewerExtension* domViewerExtension) { + this->domViewerExtension = domViewerExtension; +} + +void ViewerCreationState::onEntry(QEvent* event) { + this->cancelled = false; + cepcoreschema::Classification classification("No Family"); + + if (domViewer != nullptr) { + delete domViewer; + domViewer = nullptr; + } + + //domViewer = new cepcoreschema::Viewer("An Viewer", "An viewer description", "None", classification); + viewerDescriptionState->resetDomViewer(domViewer, domViewerExtension); + /*viewerAddParameterState->resetDomViewer(domViewer); + viewerClassificationState->resetDomViewer(domViewer);*/ + viewerSummaryState->resetViewer(domViewer); + +} + +void ViewerCreationState::onExit(QEvent* event) { + //if (! cancelled) { + // domViewerExtension->viewers().viewer().push_back((*domViewer)); + //} + //else { + // if (domViewer != nullptr) { + // delete domViewer; + // domViewer = nullptr; + // } + //} +} + +void ViewerCreationState::viewerFinished() { + cancelled = false; + emit nextACS(); +} + +void ViewerCreationState::viewerCancelled() { + cancelled = true; + emit nextACS(); +} + +void ViewerCreationState::createSubStates(WizardMainWindow* mainWindow) { + viewerDescriptionWidget = new ViewerDescriptionWidget(nullptr); + viewerDescriptionState = new ViewerDescriptionState("Viewer Description", viewerDescriptionWidget, mainWindow, domCep, this); + + //viewerAddParameterWidget = new ViewerAddParameterWidget(nullptr); + //viewerAddParameterState = new ViewerAddParameterState("Viewer Creation", viewerAddParameterWidget, mainWindow, this); + + //viewerClassificationWidget = new ViewerClassificationWidget(nullptr); + //viewerClassificationState = new ViewerClassificationState("Viewer Classification", viewerClassificationWidget, mainWindow, this); + + viewerSummaryWidget = new ViewerSummaryWidget(nullptr); + viewerSummaryState = new ViewerSummaryState("Viewer Summary", viewerSummaryWidget, mainWindow, this); + + this->setInitialState(viewerDescriptionState); + + //viewerDescriptionState->addTransition(viewerDescriptionWidget, SIGNAL(next()), viewerAddParameterState); + + //viewerAddParameterState->addTransition(viewerAddParameterWidget, SIGNAL(next()), viewerClassificationState); + //viewerAddParameterState->addTransition(viewerAddParameterWidget, SIGNAL(previous()), viewerDescriptionState); + + //viewerClassificationState->addTransition(viewerClassificationWidget, SIGNAL(next()), viewerSummaryState); + //viewerClassificationState->addTransition(viewerClassificationWidget, SIGNAL(previous()), viewerAddParameterState); + + //viewerSummaryState->addTransition(viewerSummaryWidget, SIGNAL(previous()), viewerClassificationState); + + QObject::connect(viewerDescriptionWidget, SIGNAL(cancel()), this, SLOT(viewerCancelled())); + //QObject::connect(viewerAddParameterWidget, SIGNAL(cancel()), this, SLOT(viewerCancelled())); + //QObject::connect(viewerClassificationWidget, SIGNAL(cancel()), this, SLOT(viewerCancelled())); + QObject::connect(viewerSummaryWidget, SIGNAL(cancel()), this, SLOT(viewerCancelled())); + + + QObject::connect(viewerSummaryWidget, SIGNAL(next()), this, SLOT(viewerFinished())); + +} diff --git a/sdk/applications/wizard/ViewerCreationState.h b/sdk/applications/wizard/ViewerCreationState.h new file mode 100644 index 00000000..4cb98a27 --- /dev/null +++ b/sdk/applications/wizard/ViewerCreationState.h @@ -0,0 +1,102 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ +#ifndef VIEWERCREATIONSTATE_H +#define VIEWERCREATIONSTATE_H + +#include +#include + +class WizardMainWindow; +class ViewerExtensionCreationState; + +// Sub-states +class ViewerDescriptionWidget; +class ViewerDescriptionState; +class ViewerSummaryWidget; +class ViewerSummaryState; + +// Dependency from cepcoreschema +// Declaration here to avoid declaration in dependant projects. +namespace cepcoreschema { +class ViewerExtension; +class Viewer; +class Cep; +} + +/** + * @ingroup group_sdk_application_wizard + * + * @brief + * State to create one action. + * + * This state manages sub-state to create one action. + * + */ +class ViewerCreationState : public QState { + + Q_OBJECT; + +public: + /** Constructor */ + ViewerCreationState(QString name, WizardMainWindow* mainWidnow, cepcoreschema::Cep* domCep, ViewerExtensionCreationState* parent); + + /** Destructor */ + ~ViewerCreationState() override = default; + + void resetDomViewerExtension(cepcoreschema::ViewerExtension* domViewerExtension); + +signals: + void nextACS(); + +public slots: + virtual void viewerFinished(); + virtual void viewerCancelled(); + +protected: + /// Reimplemented from QState + /// @{ + void onEntry(QEvent* event) override; + + void onExit(QEvent* event) override; + ///@} + + /// Substates (to be updated with domAction at each entry) + ViewerDescriptionWidget* viewerDescriptionWidget; + ViewerDescriptionState* viewerDescriptionState; + ViewerSummaryWidget* viewerSummaryWidget; + ViewerSummaryState* viewerSummaryState; + + +private: + void createSubStates(WizardMainWindow* mainWindow); + + bool cancelled; + QString name; + cepcoreschema::ViewerExtension* domViewerExtension; + cepcoreschema::Viewer* domViewer; + cepcoreschema::Cep* domCep; + +}; +#endif diff --git a/sdk/applications/wizard/ViewerDescriptionState.cpp b/sdk/applications/wizard/ViewerDescriptionState.cpp new file mode 100644 index 00000000..2f12cf51 --- /dev/null +++ b/sdk/applications/wizard/ViewerDescriptionState.cpp @@ -0,0 +1,118 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ + +// Include .h file +#include "ViewerDescriptionState.h" +#include "ViewerDescriptionWidget.h" +#include "WizardMainWindow.h" +#include "ViewerCreationState.h" + +// includes from coreschema +#include +#include +#include +#include +#include + +// includes from cepgenerator +#include + +// temporary +#include + +ViewerDescriptionState::ViewerDescriptionState(QString name, ViewerDescriptionWidget* widget, WizardMainWindow* mainWindow, cepcoreschema::Cep* domCep, ViewerCreationState* parent) + : WizardState(name, widget, mainWindow, parent) { + this->domViewer = nullptr; + this->domViewerExtension = nullptr; + this->domCep = domCep; +} + +void ViewerDescriptionState::resetDomViewer(cepcoreschema::Viewer* domViewer, cepcoreschema::ViewerExtension* domViewerExtension) { + this->domViewer = domViewer; + this->domViewerExtension = domViewerExtension; + auto* viewerDescriptionWidget = dynamic_cast(widget); + if (viewerDescriptionWidget) { + QString viewerExtensionName = domViewerExtension->name().c_str(); + viewerDescriptionWidget->setToDefault(viewerExtensionName); + } +} + +void ViewerDescriptionState::onEntry(QEvent* event) { + WizardState::onEntry(event); + auto* viewerDescriptionWidget = dynamic_cast(widget); + if (viewerDescriptionWidget) { + QString ViewerExtensionName = domViewerExtension->name().c_str(); + viewerDescriptionWidget->setToDefault(ViewerExtensionName); + if ((domViewer != NULL) && (QString("A Viewer") != QString(domViewer->name().c_str()))) { + viewerDescriptionWidget->setName(QString(domViewer->name().c_str())); + viewerDescriptionWidget->setDescription(QString(domViewer->description().c_str())); + } + + // Check existing CEP components + // CS: problem to get components name. + // The loop was under component extension, the corresction is to loop under components for each componentExtension. + if (domCep->componentExtensions().present()) { + cepcoreschema::ComponentExtensions::componentExtension_sequence cepComponentExtensions = domCep->componentExtensions().get().componentExtension(); + cepcoreschema::ComponentExtensions::componentExtension_iterator itCompExt; + // Loop on ComponentExtensions + for (itCompExt = cepComponentExtensions.begin(); itCompExt != cepComponentExtensions.end(); itCompExt++) { + cepcoreschema::Components::component_iterator itComp; + // Loop on components for each componentExtension. + for (itComp = itCompExt->components().component().begin(); itComp != itCompExt->components().component().end(); itComp++) { + QString componentName = (*itComp).name().c_str(); + componentName = ClassNameHandler::getClassName(componentName); + viewerDescriptionWidget->addPossibleComponent(componentName); + } + } + } + } + +} + +void ViewerDescriptionState::onExit(QEvent* event) { + WizardState::onExit(event); + auto* viewerDescriptionWidget = dynamic_cast(widget); + + if (viewerDescriptionWidget) { + QString viewerName = viewerDescriptionWidget->getViewerName(); + QString viewerDescription = viewerDescriptionWidget->getViewerDescription(); + QString componentName = viewerDescriptionWidget->getComponentName(); + + domViewer->name(viewerName.toStdString()); + domViewer->description(viewerDescription.toStdString()); +// domViewer->component(componentName.toStdString()); + + if (viewerDescriptionWidget->isItkFilter()) { + std::cout << "ITK Filter" << std::endl; + QString outputType = viewerDescriptionWidget->getOutputType(); + std::cout << "Type: " << outputType.toStdString() << std::endl; + + cepcoreschema::ItkFilter theFilter(outputType.toStdString()); +// domViewer->classification().itkFilter(theFilter); + } + + } + +} diff --git a/sdk/applications/wizard/ViewerDescriptionState.h b/sdk/applications/wizard/ViewerDescriptionState.h new file mode 100644 index 00000000..5ef2430a --- /dev/null +++ b/sdk/applications/wizard/ViewerDescriptionState.h @@ -0,0 +1,74 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ +#ifndef VIEWERDESCRIPTIONSTATE_H +#define VIEWERDESCRIPTIONSTATE_H + +#include "WizardState.h" + +class ViewerDescriptionWidget; +class ViewerCreationState; + +// Dependency from cepcoreschema +// Declaration here to avoid declaration in dependant projects. +namespace cepcoreschema { +class Viewer; +class ViewerExtension; +class Cep; +} + +/** + * @ingroup group_sdk_application_wizard + * + * @brief + * State to describe action + * + */ +class ViewerDescriptionState : public WizardState { + + Q_OBJECT; + +public: + /** Constructor */ + ViewerDescriptionState(QString name, ViewerDescriptionWidget* widget, WizardMainWindow* mainWindow, cepcoreschema::Cep* domCep, ViewerCreationState* parent); + + /** Destructor */ + ~ViewerDescriptionState() override = default; + + void resetDomViewer(cepcoreschema::Viewer* domViewer, cepcoreschema::ViewerExtension* domViewerExtension); + +protected: + void onExit(QEvent* event) override; + void onEntry(QEvent* event) override; + +private: + // Dom element that will be completed with the name + cepcoreschema::Viewer* domViewer; + // Just to check that the name of the Action is not the same of the Action Extension + cepcoreschema::ViewerExtension* domViewerExtension; + // To know which Components are available within the CEP (ot possibly apply the Action on). + cepcoreschema::Cep* domCep; + +}; +#endif diff --git a/sdk/applications/wizard/ViewerDescriptionWidget.cpp b/sdk/applications/wizard/ViewerDescriptionWidget.cpp new file mode 100644 index 00000000..78b80c26 --- /dev/null +++ b/sdk/applications/wizard/ViewerDescriptionWidget.cpp @@ -0,0 +1,182 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ + +// Include .h file +#include "ViewerDescriptionWidget.h" + +#include "DefaultGUIText.h" + +// Qt files +#include + +ViewerDescriptionWidget::ViewerDescriptionWidget(QWidget* parent) : QWidget(parent) { + ui.setupUi(this); + setToDefault(defaultViewerExtensionName); +} + +void ViewerDescriptionWidget::nextButtonClicked() { + QString viewerName = ui.viewerNameItself->text(); + QString viewerDescription = ui.viewerGoalItself->toPlainText(); +#ifndef _WIZARD_QUESTIONS_SQUEEZE + if (viewerName == viewerExtensionName) { + ui.viewerNameStar->setStyleSheet(enhancedStyle); + ui.viewerGoalStar->setStyleSheet(normalStyle); + ui.requiredLabel->setStyleSheet(enhancedStyle); + + // CCC Exception: Use a QMessageBox::warning instead of CAMITK_WARNING in the wizard + QMessageBox::warning(this, defaultBeforeGoingFurther, defaultViewerNameAndExtension); + } + else if (viewerName.toUtf8() != viewerName.toLatin1()) { + ui.viewerNameStar->setStyleSheet(enhancedStyle); + ui.viewerGoalStar->setStyleSheet(normalStyle); + ui.requiredLabel->setStyleSheet(enhancedStyle); + + // CCC Exception: Use a QMessageBox::warning instead of CAMITK_WARNING in the wizard + QMessageBox::warning(this, defaultBeforeGoingFurther, defaultAscii); + } + else if ((viewerName.isEmpty()) || (viewerName == defaultViewerName)) { + ui.viewerNameStar->setStyleSheet(enhancedStyle); + ui.viewerGoalStar->setStyleSheet(normalStyle); + ui.requiredLabel->setStyleSheet(enhancedStyle); + + // CCC Exception: Use a QMessageBox::warning instead of CAMITK_WARNING in the wizard + QMessageBox::warning(this, defaultBeforeGoingFurther, defaultRealViewerName); + } + else if (viewerDescription.toUtf8() != viewerDescription.toLatin1()) { + ui.viewerNameStar->setStyleSheet(normalStyle); + ui.viewerGoalStar->setStyleSheet(enhancedStyle); + ui.requiredLabel->setStyleSheet(enhancedStyle); + + // CCC Exception: Use a QMessageBox::warning instead of CAMITK_WARNING in the wizard + QMessageBox::warning(this, defaultBeforeGoingFurther, defaultAscii); + } + else if ((viewerDescription.isEmpty()) || (viewerDescription == defaultViewerDescription)) { + ui.viewerNameStar->setStyleSheet(normalStyle); + ui.viewerGoalStar->setStyleSheet(enhancedStyle); + ui.requiredLabel->setStyleSheet(enhancedStyle); + + // CCC Exception: Use a QMessageBox::warning instead of CAMITK_WARNING in the wizard + QMessageBox::warning(this, defaultBeforeGoingFurther, defaultRealViewerDescription); + } + else { + emit next(); + } +#else + emit next(); +#endif +} + +void ViewerDescriptionWidget::cancelButtonClicked() { + emit cancel(); +} + + +QString ViewerDescriptionWidget::getViewerName() { + return ui.viewerNameItself->text(); +} + +QString ViewerDescriptionWidget::getViewerDescription() { + return ui.viewerGoalItself->toPlainText(); +} + +QString ViewerDescriptionWidget::getComponentName() { + return ui.componentComboBox->currentText(); +} + +bool ViewerDescriptionWidget::isItkFilter() { + return ui.itkFilterCheckBox->isChecked(); +} + +QString ViewerDescriptionWidget::getOutputType() { + return ui.itkOutputImageTypeComboBox->currentText(); +} + +void ViewerDescriptionWidget::addPossibleComponent(QString possibleComponent) { + possibleComponents << possibleComponent; + ui.componentComboBox->clear(); + ui.componentComboBox->insertItems(0, possibleComponents); +} + +void ViewerDescriptionWidget::itkFilterClicked(bool checked) { + if ((ui.componentComboBox->currentText() == "ImageComponent") && checked) { + ui.itkOutputImageLabel->show(); + ui.itkOutputImageTypeComboBox->show(); + } + else { + ui.itkOutputImageLabel->hide(); + ui.itkOutputImageTypeComboBox->hide(); + + } +} + +void ViewerDescriptionWidget::setToDefault(QString viewerExtensionName) { + + this->viewerExtensionName = viewerExtensionName; + + ui.viewerNameItself->setText(defaultViewerName); + ui.viewerGoalItself->setPlainText(defaultViewerDescription); + ui.viewerNameStar->setStyleSheet(normalStyle); + ui.viewerGoalStar->setStyleSheet(normalStyle); + ui.requiredLabel->setStyleSheet(normalStyle); + + possibleComponents = defaultPossibleComponents; + + ui.componentComboBox->clear(); + ui.componentComboBox->insertItems(0, possibleComponents); + ui.itkFilterCheckBox->setChecked(false); + ui.itkOutputImageLabel->hide(); + ui.itkOutputImageTypeComboBox->hide(); + ui.componentComboBox->setCurrentIndex(possibleComponents.indexOf("ImageComponent")); +} + +void ViewerDescriptionWidget::setName(QString name) { + ui.viewerNameItself->setText(name); +} + +void ViewerDescriptionWidget::setDescription(QString description) { + ui.viewerGoalItself->setPlainText(description); +} + +void ViewerDescriptionWidget::setComponent(QString component) { + ui.componentComboBox->setCurrentIndex(possibleComponents.indexOf(component)); +} + +void ViewerDescriptionWidget::componentChanged(QString text) { + if (ui.componentComboBox->currentText() == "ImageComponent") { + ui.itkFilterCheckBox->show(); + if (ui.itkFilterCheckBox->isChecked()) { + ui.itkOutputImageLabel->show(); + ui.itkOutputImageTypeComboBox->show(); + } + } + else { + + ui.itkFilterCheckBox->hide(); + ui.itkOutputImageLabel->hide(); + ui.itkOutputImageTypeComboBox->hide(); + } +} + + diff --git a/sdk/applications/wizard/ViewerDescriptionWidget.h b/sdk/applications/wizard/ViewerDescriptionWidget.h new file mode 100644 index 00000000..602228e9 --- /dev/null +++ b/sdk/applications/wizard/ViewerDescriptionWidget.h @@ -0,0 +1,81 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ +#ifndef VIEWERDESCRIPTIONWIDGET_H +#define VIEWERDESCRIPTIONWIDGET_H + +// Include GUI automatically generated file +#include "ui_ViewerDescriptionWidget.h" + +// includes from Qt +#include + +/** + * @ingroup group_sdk_application_wizard + * + * @brief + * Widget to describe action + * + */ +class ViewerDescriptionWidget : public QWidget { + + Q_OBJECT; + +public: + /** Constructor * */ + ViewerDescriptionWidget(QWidget* parent); + + /** Destructor */ + ~ViewerDescriptionWidget() override = default; + + void setToDefault(QString viewerExtensionName); + void addPossibleComponent(QString possibleComponent); + + void setName(QString name); + void setDescription(QString description); + void setComponent(QString component); + + QString getViewerName(); + QString getViewerDescription(); + QString getComponentName(); + bool isItkFilter(); + QString getOutputType(); + +public slots: + virtual void nextButtonClicked(); + virtual void cancelButtonClicked(); + virtual void componentChanged(QString); + virtual void itkFilterClicked(bool); + +signals: + void next(); + void cancel(); + +private: + QStringList possibleComponents; + Ui::ViewerDescriptionWidget ui; + + QString viewerExtensionName; +}; +#endif diff --git a/sdk/applications/wizard/ViewerDescriptionWidget.ui b/sdk/applications/wizard/ViewerDescriptionWidget.ui new file mode 100644 index 00000000..34ef8af4 --- /dev/null +++ b/sdk/applications/wizard/ViewerDescriptionWidget.ui @@ -0,0 +1,1306 @@ + + + ViewerDescriptionWidget + + + + 0 + 0 + 759 + 630 + + + + Form + + + + + + 3 + + + + + + + + 0 + 0 + + + + + Sans Serif + 8 + 50 + false + + + + Viewer-extension + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + Sans Serif + 9 + 75 + false + true + + + + Viewer(s) + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + Sans Serif + 8 + 50 + false + + + + Dependencies + + + Qt::AlignCenter + + + + + + + + Sans Serif + 8 + + + + Summary + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + true + + + + 0 + 0 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + Sans Serif + 8 + 50 + false + + + + 1 + + + Qt::AlignCenter + + + 0 + + + + + + + + 0 + 0 + + + + + 110 + 0 + + + + + 70 + 0 + + + + Qt::Horizontal + + + + + + + + Sans Serif + 9 + 75 + false + true + + + + 2 + + + Qt::AlignCenter + + + + + + + + 70 + 0 + + + + + 70 + 0 + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + 50 + false + + + + 3 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + + + + 4 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + + + + 3 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 85 + 20 + + + + + + + + + 0 + 0 + + + + + Sans Serif + 9 + 75 + true + + + + Description + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + Sans Serif + 8 + 50 + false + + + + Parameter(s) + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + Sans Serif + 8 + 50 + false + + + + Classification + + + Qt::AlignCenter + + + + + + + + Sans Serif + 8 + + + + Summary + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 85 + 20 + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 105 + 20 + + + + + + + + true + + + + 0 + 0 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + Sans Serif + 9 + 75 + true + + + + 1 + + + Qt::AlignCenter + + + 0 + + + + + + + + 0 + 0 + + + + + 70 + 0 + + + + + 70 + 0 + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + 50 + false + + + + 2 + + + Qt::AlignCenter + + + + + + + + 70 + 0 + + + + + 70 + 0 + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + 50 + false + + + + 3 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + + + + 4 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 105 + 20 + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + 1 + + + 1 + + + + + + 32 + 32 + + + + + 32 + 32 + + + + <html><head/><body><p>Choose the type of component your viewer will use.</p></body></html> + + + + + + + + + :/resources/Help.png + + + true + + + Qt::AlignCenter + + + + + + + + Sans Serif + 11 + + + + Name of your viewer: + + + + + + + + + + 32 + 32 + + + + + 32 + 32 + + + + <html><head/><body><p>Give a precise description of what your viewer will do.</p></body></html> + + + + + + :/resources/Help.png + + + true + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + background-color: rgb(255, 255, 255); + + + + + + + + + + + + + Sans Serif + + + + ITK Filter ? + + + + + + + + Sans Serif + + + + Output Image Type + + + + + + + + Sans Serif + + + + background-color: rgb(255, 255, 255); + + + + Same as Input + + + + + unsigned char + + + + + char + + + + + unsigned short + + + + + short + + + + + unsigned int + + + + + int + + + + + long + + + + + double + + + + + + + + + + + Sans Serif + 11 + + + + Component: + + + + + + + IBeamCursor + + + background-color: rgb(255, 255, 255); + + + true + + + + + + + + + + + 20 + 0 + + + + + 20 + 16777215 + + + + * + + + Qt::AlignCenter + + + + + + + + 20 + 0 + + + + + 20 + 16777215 + + + + * + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + 20 + 0 + + + + + 20 + 16777215 + + + + * + + + Qt::AlignHCenter|Qt::AlignTop + + + + + + + + Sans Serif + 11 + + + + Goal(s) of your viewer: + + + Qt::AlignHCenter|Qt::AlignTop + + + + + + + + 32 + 32 + + + + + 32 + 32 + + + + <html><head/><body><p>Give a meaningful name to your viewer.</p></body></html> + + + + + + + + + :/resources/Help.png + + + true + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + + 16777215 + 20 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + Arial + + + + background-color: rgb(255, 255, 255); + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + * <i>required field</i> + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 9 + + + + Cancel + + + + :/resources/button_cancel.png:/resources/button_cancel.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 64 + 32 + + + + + 128 + 32 + + + + + 9 + + + + Qt::RightToLeft + + + Next + + + + :/resources/rightarrow.png:/resources/rightarrow.png + + + + 16 + 16 + + + + true + + + + + + + + + + + + + nextPushButton + clicked() + ViewerDescriptionWidget + nextButtonClicked() + + + 649 + 604 + + + 647 + 577 + + + + + componentComboBox + currentIndexChanged(QString) + ViewerDescriptionWidget + componentChanged(QString) + + + 491 + 381 + + + 494 + 417 + + + + + itkFilterCheckBox + toggled(bool) + ViewerDescriptionWidget + itkFilterClicked(bool) + + + 379 + 424 + + + 276 + 421 + + + + + cancelPushButton + clicked() + ViewerDescriptionWidget + cancelButtonClicked() + + + 313 + 598 + + + 268 + 579 + + + + + + componentChanged(QString) + nextButtonClicked() + itkFilterClicked(bool) + cancelButtonClicked() + + diff --git a/sdk/applications/wizard/ViewerExtensionCreationState.cpp b/sdk/applications/wizard/ViewerExtensionCreationState.cpp new file mode 100644 index 00000000..f3ee5fa8 --- /dev/null +++ b/sdk/applications/wizard/ViewerExtensionCreationState.cpp @@ -0,0 +1,137 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ + +// Include .h file +#include "ViewerExtensionCreationState.h" +#include "WizardMainWindow.h" + +#include "ViewerExtensionDescriptionWidget.h" +#include "ViewerExtensionDescriptionState.h" +#include "ViewersCreationWidget.h" +#include "ViewersCreationState.h" +#include "ViewerCreationState.h" +#include "ViewerExtensionDependenciesState.h" +#include "DependenciesWidget.h" +#include "ExtensionSummaryWidget.h" +#include "ExtensionSummaryState.h" + +#include +#include +#include + +ViewerExtensionCreationState::ViewerExtensionCreationState(QString name, WizardMainWindow* mainWindow, cepcoreschema::Cep* domCep) : QState() { + this->cancelled = false; + this->name = name; + this->domCep = domCep; + this->domViewerExtension = nullptr; + + createSubStates(mainWindow); +} + +void ViewerExtensionCreationState::onEntry(QEvent* event) { + this->cancelled = false; + if (this->domViewerExtension != nullptr) { + delete domViewerExtension; + domViewerExtension = nullptr; + } + + /*cepcoreschema::Viewers theViewers; + this->domViewerExtension = new cepcoreschema::ViewerExtension("A Viewer Extension", "A viewer extension description", theViewers);*/ + + viewerExtensionDescriptionState->resetDomViewerExtension(domViewerExtension); + viewersCreationState->resetDomViewerExtension(domViewerExtension); + viewerCreationState->resetDomViewerExtension(domViewerExtension); + viewerExtensionDependenciesState->resetDomViewerExtension(domViewerExtension); + viewerExtensionSummaryState->setViewerExtension(domViewerExtension); +} + +void ViewerExtensionCreationState::onExit(QEvent* event) { + /* if (! cancelled) { + cepcoreschema::Viewers someViewers; + if (domCep->viewerExtensions().present()) { + domCep->viewerExtensions().get().viewerExtension().push_back((*domViewerExtension)); + } + else { + cepcoreschema::ViewerExtensions theExtensions; + theExtensions.viewerExtension().push_back((*domViewerExtension)); + domCep->viewerExtensions(theExtensions); + } + } + else { + if (domViewerExtension != nullptr) { + delete domViewerExtension; + domViewerExtension = nullptr; + } + }*/ + +} + + +void ViewerExtensionCreationState::extensionFinished() { + cancelled = false; + emit next(); +} + +void ViewerExtensionCreationState::extensionCancelled() { + cancelled = true; + emit next(); +} + +void ViewerExtensionCreationState::createSubStates(WizardMainWindow* mainWindow) { + viewerExtensionDescriptionWidget = new ViewerExtensionDescriptionWidget(nullptr); + viewerExtensionDescriptionState = new ViewerExtensionDescriptionState("Viewer Extension", viewerExtensionDescriptionWidget, mainWindow, this); + + viewersCreationWidget = new ViewersCreationWidget(nullptr); + viewersCreationState = new ViewersCreationState("Viewers Creation", viewersCreationWidget, mainWindow, this); + + viewerCreationState = new ViewerCreationState("Viewer Creation", mainWindow, domCep, this); + + viewerExtensionDependenciesWidget = new DependenciesWidget(nullptr); + viewerExtensionDependenciesState = new ViewerExtensionDependenciesState("Viewer Extension Dependencies", viewerExtensionDependenciesWidget, mainWindow, domCep, this); + + viewerExtensionSummaryWidget = new ExtensionSummaryWidget(nullptr); + viewerExtensionSummaryState = new ExtensionSummaryState("Viewer Extension Summary", viewerExtensionSummaryWidget, "Viewer", mainWindow, this); + + viewerExtensionDescriptionState->addTransition(viewerExtensionDescriptionWidget, SIGNAL(next()), viewersCreationState); + viewersCreationState->addTransition(viewersCreationWidget, SIGNAL(newViewer()), viewerCreationState); + viewersCreationState->addTransition(viewersCreationWidget, SIGNAL(next()), viewerExtensionDependenciesState); + viewersCreationState->addTransition(viewersCreationWidget, SIGNAL(previous()), viewerExtensionDescriptionState); + + viewerCreationState->addTransition(viewerCreationState, SIGNAL(nextACS()), viewersCreationState); + + viewerExtensionDependenciesState->addTransition(viewerExtensionDependenciesWidget, SIGNAL(previous()), viewersCreationState); + viewerExtensionDependenciesState->addTransition(viewerExtensionDependenciesWidget, SIGNAL(next()), viewerExtensionSummaryState); + + viewerExtensionSummaryState->addTransition(viewerExtensionSummaryWidget, SIGNAL(previous()), viewerExtensionDependenciesState); + QObject::connect(viewerExtensionSummaryWidget, SIGNAL(next()), this, SLOT(extensionFinished())); + + // Cancel + QObject::connect(viewerExtensionDescriptionWidget, SIGNAL(cancel()), this, SLOT(extensionCancelled())); + QObject::connect(viewersCreationWidget, SIGNAL(cancel()), this, SLOT(extensionCancelled())); + QObject::connect(viewerExtensionDependenciesWidget, SIGNAL(cancel()), this, SLOT(extensionCancelled())); + QObject::connect(viewerExtensionSummaryWidget, SIGNAL(cancel()), this, SLOT(extensionCancelled())); + + this->setInitialState(viewerExtensionDescriptionState); +} diff --git a/sdk/applications/wizard/ViewerExtensionCreationState.h b/sdk/applications/wizard/ViewerExtensionCreationState.h new file mode 100644 index 00000000..11f3af28 --- /dev/null +++ b/sdk/applications/wizard/ViewerExtensionCreationState.h @@ -0,0 +1,108 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ +#ifndef VIEWEREXTENSIONCREATIONSTATE_H +#define VIEWEREXTENSIONCREATIONSTATE_H + +#include +#include + +class WizardMainWindow; +// Sub states +class ViewerExtensionDescriptionWidget; +class ViewerExtensionDescriptionState; +class ViewersCreationWidget; +class ViewersCreationState; +class ViewerCreationState; +class DependenciesWidget; +class ViewerExtensionDependenciesState; +class ExtensionSummaryWidget; +class ExtensionSummaryState; + +// Dependency from cepcoreschema +// Declaration here to avoid declaration in dependant projects. +namespace cepcoreschema { +class Cep; +class ViewerExtension; +} + +/** + * @ingroup group_sdk_application_wizard + * + * @brief + * State to create an action extension. \n + * + * This state enables to create all states to generate one or more actions. \n + * It manages a sub-states dedicated to the creation of actions. + * + */ +class ViewerExtensionCreationState : public QState { + + Q_OBJECT; + +public: + /** Constructor */ + ViewerExtensionCreationState(QString name, WizardMainWindow* mainWidnow, cepcoreschema::Cep* domCep); + + /** Destructor */ + ~ViewerExtensionCreationState() override = default; + +signals: + void next(); + +public slots: + virtual void extensionFinished(); + virtual void extensionCancelled(); + +protected: + /// Reimplemented from QState + /// @{ + void onEntry(QEvent* event) override; + + void onExit(QEvent* event) override; + ///@} + +private: + + bool cancelled; + + // Sub States + ViewerExtensionDescriptionWidget* viewerExtensionDescriptionWidget; + ViewerExtensionDescriptionState* viewerExtensionDescriptionState; + ViewersCreationWidget* viewersCreationWidget; + ViewersCreationState* viewersCreationState; + ViewerCreationState* viewerCreationState; + DependenciesWidget* viewerExtensionDependenciesWidget; + ViewerExtensionDependenciesState* viewerExtensionDependenciesState; + ExtensionSummaryWidget* viewerExtensionSummaryWidget; + ExtensionSummaryState* viewerExtensionSummaryState; + + void createSubStates(WizardMainWindow* mainWindow); + + QString name; + cepcoreschema::Cep* domCep; + cepcoreschema::ViewerExtension* domViewerExtension; + +}; +#endif diff --git a/sdk/applications/wizard/ViewerExtensionDependenciesState.cpp b/sdk/applications/wizard/ViewerExtensionDependenciesState.cpp new file mode 100644 index 00000000..bd8dabc2 --- /dev/null +++ b/sdk/applications/wizard/ViewerExtensionDependenciesState.cpp @@ -0,0 +1,81 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ + +// Include .h file +#include "ViewerExtensionDependenciesState.h" +#include "WizardMainWindow.h" +#include "ViewerExtensionCreationState.h" +#include "DependenciesWidget.h" + +// includes from coreschema +#include +#include + +ViewerExtensionDependenciesState::ViewerExtensionDependenciesState(QString name, DependenciesWidget* widget, WizardMainWindow* mainWindow, cepcoreschema::Cep* domCep, ViewerExtensionCreationState* parent) + : DependenciesState(name, widget, mainWindow, domCep, parent) { + this->domViewerExtension = nullptr; + widget->setElement("Viewer Extension"); +} + +void ViewerExtensionDependenciesState::resetDomViewerExtension(cepcoreschema::ViewerExtension* domViewerExtension) { + this->domViewerExtension = domViewerExtension; + auto* dependenciesWidget = dynamic_cast(widget); + if (dependenciesWidget != nullptr) { + dependenciesWidget->setToDefault(); + } +} + +void ViewerExtensionDependenciesState::onEntry(QEvent* event) { + DependenciesState::onEntry(event); + auto* dependenciesWidget = dynamic_cast(widget); + if (dependenciesWidget != nullptr) { + // Look for itk dependencies + if (isItkDependant(domViewerExtension)) { + dependenciesWidget->setItkDependency(true); + } + } +} + + +void ViewerExtensionDependenciesState::onExit(QEvent* event) { + DependenciesState::onExit(event); + cepcoreschema::Dependencies* domDeps = getDependencies(); + if (domDeps != nullptr) { + if (domDeps->dependency().size() > 0) { + domViewerExtension->dependencies((*domDeps)); + } + } +} + +bool ViewerExtensionDependenciesState::isItkDependant(cepcoreschema::ViewerExtension* domExtension) { + /*const cepcoreschema::Viewer::viewer_sequence createdViewers = domExtension->viewers().action(); + int i = 0; + while ((i < createdViewers.size() && (!createdViewers.at(i).classification().itkFilter().present()))) { + i++; + } + + return i < createdViewers.size();*/ + return false; +} diff --git a/sdk/applications/wizard/ViewerExtensionDependenciesState.h b/sdk/applications/wizard/ViewerExtensionDependenciesState.h new file mode 100644 index 00000000..befcd85b --- /dev/null +++ b/sdk/applications/wizard/ViewerExtensionDependenciesState.h @@ -0,0 +1,70 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ +#ifndef VIEWEREXTENSIONDEPENDENCIESSTATE_H +#define VIEWEREXTENSIONDEPENDENCIESSTATE_H + +#include "DependenciesState.h" + +class ViewerExtensionCreationState; + +// Dependency from cepcoreschema +// Declaration here to avoid declaration in dependant projects. +namespace cepcoreschema { +class ViewerExtension; +} + +/** + * @ingroup group_sdk_application_wizard + * + * @brief + * State to define action extension dependencies + * + */ +class ViewerExtensionDependenciesState : public DependenciesState { + + Q_OBJECT; + +public: + /** Constructor */ + ViewerExtensionDependenciesState(QString name, DependenciesWidget* widget, WizardMainWindow* mainWindow, cepcoreschema::Cep* domCep, ViewerExtensionCreationState* parent); + + /** Destructor */ + ~ViewerExtensionDependenciesState() override = default; + + void resetDomViewerExtension(cepcoreschema::ViewerExtension* domViewerExtension); + + cepcoreschema::ViewerExtension* domViewerExtension; + +protected: + void onEntry(QEvent* event) override; + void onExit(QEvent* event) override; + +private: + bool isItkDependant(cepcoreschema::ViewerExtension* domExtension); + + + +}; +#endif diff --git a/sdk/applications/wizard/ViewerExtensionDescriptionState.cpp b/sdk/applications/wizard/ViewerExtensionDescriptionState.cpp new file mode 100644 index 00000000..9b9192a5 --- /dev/null +++ b/sdk/applications/wizard/ViewerExtensionDescriptionState.cpp @@ -0,0 +1,57 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ + +// Include .h file +#include "ViewerExtensionDescriptionState.h" +#include "ViewerExtensionDescriptionWidget.h" +#include "WizardMainWindow.h" +#include "ViewerExtensionCreationState.h" + +// includes from coreschema +#include + +ViewerExtensionDescriptionState::ViewerExtensionDescriptionState(QString name, ViewerExtensionDescriptionWidget* widget, WizardMainWindow* mainWindow, ViewerExtensionCreationState* parent) + : WizardState(name, widget, mainWindow, parent) { + this->domViewerExtension = nullptr; +} + +void ViewerExtensionDescriptionState::resetDomViewerExtension(cepcoreschema::ViewerExtension* domViewerExtension) { + this->domViewerExtension = domViewerExtension; + auto* viewerExtensionDescriptionWidget = dynamic_cast(widget); + if (viewerExtensionDescriptionWidget != nullptr) { + viewerExtensionDescriptionWidget->setToDefault(); + } +} + +void ViewerExtensionDescriptionState::onExit(QEvent* event) { + WizardState::onExit(event); + auto* viewerExtensionDescriptionWidget = dynamic_cast(widget); + if (viewerExtensionDescriptionWidget != nullptr) { + QString viewerExtensionName = viewerExtensionDescriptionWidget->getViewerExtensionName(); + QString viewerExtensionDescription = viewerExtensionDescriptionWidget->getCepDescription(); + domViewerExtension->name(viewerExtensionName.toStdString()); + domViewerExtension->description(viewerExtensionDescription.toStdString()); + } +} diff --git a/sdk/applications/wizard/ViewerExtensionDescriptionState.h b/sdk/applications/wizard/ViewerExtensionDescriptionState.h new file mode 100644 index 00000000..893ba329 --- /dev/null +++ b/sdk/applications/wizard/ViewerExtensionDescriptionState.h @@ -0,0 +1,67 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ +#ifndef VIEWEREXTENSIONDESCRIPTIONSTATE_H +#define VIEWEREXTENSIONDESCRIPTIONSTATE_H + +#include "WizardState.h" + +class ViewerExtensionDescriptionWidget; +class ViewerExtensionCreationState; + +// Dependency from cepcoreschema +// Declaration here to avoid declaration in dependant projects. +namespace cepcoreschema { +class ViewerExtension; +} + +/** + * @ingroup group_sdk_application_wizard + * + * @brief + * State to enter the action extension description + * + */ +class ViewerExtensionDescriptionState : public WizardState { + + Q_OBJECT; + +public: + /** Constructor */ + ViewerExtensionDescriptionState(QString name, ViewerExtensionDescriptionWidget* widget, WizardMainWindow* mainWindow, ViewerExtensionCreationState* parent); + + /** Destructor */ + ~ViewerExtensionDescriptionState() override = default; + + void resetDomViewerExtension(cepcoreschema::ViewerExtension* domViewerExtension); + + +protected: + void onExit(QEvent* event) override; + +private: + cepcoreschema::ViewerExtension* domViewerExtension; + +}; +#endif diff --git a/sdk/applications/wizard/ViewerExtensionDescriptionWidget.cpp b/sdk/applications/wizard/ViewerExtensionDescriptionWidget.cpp new file mode 100644 index 00000000..bbbb4520 --- /dev/null +++ b/sdk/applications/wizard/ViewerExtensionDescriptionWidget.cpp @@ -0,0 +1,108 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ + +// Include .h file +#include "ViewerExtensionDescriptionWidget.h" + +#include "DefaultGUIText.h" + +// Qt files +#include + + +ViewerExtensionDescriptionWidget::ViewerExtensionDescriptionWidget(QWidget* parent) : QWidget(parent) { + ui.setupUi(this); +} + +void ViewerExtensionDescriptionWidget::cancelButtonClicked() { + emit cancel(); +} + +void ViewerExtensionDescriptionWidget::nextButtonClicked() { + QString viewerExtensionName = ui.viewerExtensionNameItself->text(); + QString viewerExtensionDescription = ui.viewerExtensionDescriptionItself->toPlainText(); + +#ifndef _WIZARD_QUESTIONS_SQUEEZE + if (viewerExtensionName.toUtf8() != viewerExtensionName.toLatin1()) { + ui.viewerExtensionNameStar->setStyleSheet(enhancedStyle); + ui.viewerExtensionDescriptionStar->setStyleSheet(normalStyle); + ui.requiredLabel->setStyleSheet(enhancedStyle); + + // CCC Exception: Use a QMessageBox::warning instead of CAMITK_WARNING in the wizard + QMessageBox::warning(this, defaultBeforeGoingFurther, defaultAscii); + } + else if ((viewerExtensionName.isEmpty()) || (viewerExtensionName == defaultViewerExtensionName)) { + ui.viewerExtensionNameStar->setStyleSheet(enhancedStyle); + ui.viewerExtensionDescriptionStar->setStyleSheet(normalStyle); + ui.requiredLabel->setStyleSheet(enhancedStyle); + + // CCC Exception: Use a QMessageBox::warning instead of CAMITK_WARNING in the wizard + QMessageBox::warning(this, defaultBeforeGoingFurther, defaultRealExtensionName); + } + else if (viewerExtensionDescription.toUtf8() != viewerExtensionDescription.toLatin1()) { + ui.viewerExtensionNameStar->setStyleSheet(normalStyle); + ui.viewerExtensionDescriptionStar->setStyleSheet(enhancedStyle); + ui.requiredLabel->setStyleSheet(enhancedStyle); + + // CCC Exception: Use a QMessageBox::warning instead of CAMITK_WARNING in the wizard + QMessageBox::warning(this, defaultBeforeGoingFurther, defaultAscii); + } + else if ((viewerExtensionDescription.isEmpty()) || (viewerExtensionDescription == defaultViewerExtensionDescription)) { + ui.viewerExtensionNameStar->setStyleSheet(normalStyle); + ui.viewerExtensionDescriptionStar->setStyleSheet(enhancedStyle); + ui.requiredLabel->setStyleSheet(enhancedStyle); + + // CCC Exception: Use a QMessageBox::warning instead of CAMITK_WARNING in the wizard + QMessageBox::warning(this, defaultBeforeGoingFurther, defaultRealExtensionDescription); + } + else { + ui.viewerExtensionNameStar->setStyleSheet(normalStyle); + ui.viewerExtensionDescriptionStar->setStyleSheet(normalStyle); + ui.requiredLabel->setStyleSheet(normalStyle); + emit next(); + } +#else + emit next(); +#endif +} + +void ViewerExtensionDescriptionWidget::setToDefault() { + ui.explanationLabel->setText(defaultViewerExtensionExplanation); + ui.viewerExtensionNameItself->setText(defaultViewerExtensionName); + ui.viewerExtensionDescriptionItself->setPlainText(defaultViewerExtensionDescription); + ui.viewerExtensionNameStar->setStyleSheet(normalStyle); + ui.viewerExtensionDescriptionStar->setStyleSheet(normalStyle); + ui.requiredLabel->setStyleSheet(normalStyle); +} + +QString ViewerExtensionDescriptionWidget::getViewerExtensionName() { + return ui.viewerExtensionNameItself->text(); +} + +QString ViewerExtensionDescriptionWidget::getCepDescription() { + return ui.viewerExtensionDescriptionItself->toPlainText(); +} + + diff --git a/sdk/applications/wizard/ViewerExtensionDescriptionWidget.h b/sdk/applications/wizard/ViewerExtensionDescriptionWidget.h new file mode 100644 index 00000000..d9868cb3 --- /dev/null +++ b/sdk/applications/wizard/ViewerExtensionDescriptionWidget.h @@ -0,0 +1,68 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ +#ifndef VIEWEREXTENSIONDESCRIPTIONWIDGET_H +#define VIEWEREXTENSIONDESCRIPTIONWIDGET_H + +// Include GUI automatically generated file +#include "ui_ViewerExtensionDescriptionWidget.h" + +// includes from Qt +#include + +/** + * @ingroup group_sdk_application_wizard + * + * @brief + * Widget to enter the action extension description + * + */ +class ViewerExtensionDescriptionWidget : public QWidget { + + Q_OBJECT; + +public: + /** Constructor */ + ViewerExtensionDescriptionWidget(QWidget* parent); + + /** Destructor */ + ~ViewerExtensionDescriptionWidget() override = default; + + void setToDefault(); + QString getViewerExtensionName(); + QString getCepDescription(); + +public slots: + virtual void nextButtonClicked(); + virtual void cancelButtonClicked(); + +signals: + void next(); + void cancel(); + +private: + + Ui::ViewerExtensionDescriptionWidget ui; +}; +#endif diff --git a/sdk/applications/wizard/ViewerExtensionDescriptionWidget.ui b/sdk/applications/wizard/ViewerExtensionDescriptionWidget.ui new file mode 100644 index 00000000..a2e36000 --- /dev/null +++ b/sdk/applications/wizard/ViewerExtensionDescriptionWidget.ui @@ -0,0 +1,766 @@ + + + ViewerExtensionDescriptionWidget + + + + 0 + 0 + 727 + 635 + + + + Form + + + + + + 3 + + + + + + + + 0 + 0 + + + + + Sans Serif + 9 + 75 + true + + + + Viewer-extension + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + Sans Serif + 8 + 50 + false + false + + + + Viewer(s) + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + Sans Serif + 8 + 50 + false + + + + Dependencies + + + Qt::AlignCenter + + + + + + + + Sans Serif + 8 + + + + Summary + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + true + + + + 0 + 0 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + Sans Serif + 11 + 75 + true + + + + 1 + + + Qt::AlignCenter + + + 0 + + + + + + + + 0 + 0 + + + + + 110 + 0 + + + + + 70 + 0 + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + 50 + false + false + + + + 2 + + + Qt::AlignCenter + + + + + + + + 70 + 0 + + + + + 70 + 0 + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + 50 + false + + + + 3 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + + + + 4 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 32 + 32 + + + + + 64 + 64 + + + + + + + :/resources/viewer_bas.png + + + true + + + + + + + + 14 + + + + <html><head/><body><p><span style=" font-size:14pt; font-weight:600;">Create your Viewer Extension</span></p></body></html> + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + + + + + 1 + + + 1 + + + + + + Sans Serif + 11 + + + + Description + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 32 + 32 + + + + + 32 + 32 + + + + <html><head/><body><p>Give a meaningful name your viewer-extension. The name can corresponds to the overall processing performed by the extension.</p></body></html> + + + + + + :/resources/Help.png + + + true + + + Qt::AlignCenter + + + + + + + + + + + Arial + + + + IBeamCursor + + + Qt::StrongFocus + + + background-color: rgb(255, 255, 255); + + + true + + + + + + + + + + + Arial + + + + Qt::StrongFocus + + + false + + + background-color: rgb(255, 255, 255); + + + + + + + + + + + 20 + 0 + + + + + 20 + 16777215 + + + + * + + + Qt::AlignCenter + + + + + + + + 20 + 0 + + + + + 20 + 16777215 + + + + * + + + Qt::AlignHCenter|Qt::AlignTop + + + + + + + + Sans Serif + 11 + + + + Name + + + + + + + + + + 32 + 32 + + + + + 32 + 32 + + + + <html><head/><body><p>Give a precise description of what your viewer-extension will do.</p></body></html> + + + + + + :/resources/Help.png + + + true + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + * <i>required field</i> + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 9 + + + + Cancel + + + + :/resources/button_cancel.png:/resources/button_cancel.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 64 + 32 + + + + + 128 + 32 + + + + + 9 + + + + Qt::RightToLeft + + + Next + + + + :/resources/rightarrow.png:/resources/rightarrow.png + + + + 16 + 16 + + + + true + + + + + + + + + + + + + nextPushButton + clicked() + ViewerExtensionDescriptionWidget + nextButtonClicked() + + + 668 + 606 + + + 653 + 582 + + + + + cancelPushButton + clicked() + ViewerExtensionDescriptionWidget + cancelButtonClicked() + + + 311 + 611 + + + 238 + 589 + + + + + + nextButtonClicked() + cancelButtonClicked() + + diff --git a/sdk/applications/wizard/ViewerSummaryState.cpp b/sdk/applications/wizard/ViewerSummaryState.cpp new file mode 100644 index 00000000..69d1c261 --- /dev/null +++ b/sdk/applications/wizard/ViewerSummaryState.cpp @@ -0,0 +1,87 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ + +// Include .h file +#include "ViewerSummaryState.h" +#include "ViewerSummaryWidget.h" + +#include "WizardMainWindow.h" + +// includes from coreschema +#include + +#include + +ViewerSummaryState::ViewerSummaryState(QString name, ViewerSummaryWidget* widget, + WizardMainWindow* mainWindow, QState* parent) + : WizardState(name, widget, mainWindow, parent) { + this->domViewer = nullptr; +} + +void ViewerSummaryState::resetViewer(cepcoreschema::Viewer* domViewer) { + this->domViewer = domViewer; +} + + +void ViewerSummaryState::onEntry(QEvent* event) { + WizardState::onEntry(event); + std::cout << "Viewer Summary State on Entry" << std::endl; + + auto* viewerSummaryWidget = dynamic_cast(widget); + if (viewerSummaryWidget != nullptr) { + if (domViewer != nullptr) { + std::cout << "domViewer non NULL" << std::endl; + QString name = domViewer->name().c_str(); + QString description = domViewer->description().c_str(); + //QString component = domViewer->component().c_str(); + + /* QStringList parameters; + if (domViewer->parameters().present()) { + cepcoreschema::Parameters::parameter_const_iterator it; + for (it = domViewer->parameters().get().parameter().begin(); it != domViewer->parameters().get().parameter().end(); it++) { + QString param = QString((*it).type().c_str()) + " " + (*it).name().c_str() + "(= " + (*it).defaultValue().get().c_str() + " )"; + parameters << param; + } + + } + + QString family = domViewer->classification().family().c_str(); + QStringList tags; + cepcoreschema::Classification::tag_iterator it; + for (it = domViewer->classification().tag().begin(); it != domViewer->classification().tag().end(); it++) { + tags << (*it).c_str(); + }*/ + + //viewerSummaryWidget->setSummary(name, description, component, parameters, family, tags); + } + } + +} + + +void ViewerSummaryState::onExit(QEvent* event) { + WizardState::onExit(event); +} + diff --git a/sdk/applications/wizard/ViewerSummaryState.h b/sdk/applications/wizard/ViewerSummaryState.h new file mode 100644 index 00000000..b6d6bed6 --- /dev/null +++ b/sdk/applications/wizard/ViewerSummaryState.h @@ -0,0 +1,65 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ +#ifndef VIEWERSUMMARYSTATE_H +#define VIEWERSUMMARYSTATE_H + +#include "WizardState.h" + +class ViewerSummaryWidget; + +// Dependency from cepcoreschema +// Declaration here to avoid declaration in dependant projects. +namespace cepcoreschema { +class Viewer; +} + +/** + * @ingroup group_sdk_application_wizard + * + * @brief + * State to summarize the created action + * + */ +class ViewerSummaryState : public WizardState { + + Q_OBJECT; + +public: + /** Constructor*/ + ViewerSummaryState(QString name, ViewerSummaryWidget* widget, WizardMainWindow* mainWindow, QState* parent); + + /** Destructor*/ + ~ViewerSummaryState() override = default; + + void resetViewer(cepcoreschema::Viewer* domViewer); + +protected: + void onEntry(QEvent* event) override; + void onExit(QEvent* event) override; + + cepcoreschema::Viewer* domViewer; + +}; +#endif diff --git a/sdk/applications/wizard/ViewerSummaryWidget.cpp b/sdk/applications/wizard/ViewerSummaryWidget.cpp new file mode 100644 index 00000000..f6104d32 --- /dev/null +++ b/sdk/applications/wizard/ViewerSummaryWidget.cpp @@ -0,0 +1,80 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ + +// Include .h file +#include "ViewerSummaryWidget.h" + +#include "DefaultGUIText.h" + +ViewerSummaryWidget::ViewerSummaryWidget(QWidget* parent) : QWidget(parent) { + ui.setupUi(this); +} + +void ViewerSummaryWidget::setToDefault() { + ui.summaryLabel->setText(""); +} + +void ViewerSummaryWidget::nextButtonClicked() { + emit next(); +} + +void ViewerSummaryWidget::cancelButtonClicked() { + emit cancel(); +} + +void ViewerSummaryWidget::previousButtonClicked() { + emit previous(); +} + + + +void ViewerSummaryWidget::setSummary(QString name, QString description, QString component, + QStringList parameters, QString family, QStringList tags) { + QString text = defaultViewerSummary; + + text = text.replace(QRegExp("@NAME@"), name); + text = text.replace(QRegExp("@DESCRIPTION@"), description); + text = text.replace(QRegExp("@COMPONENT@"), component); + text = text.replace(QRegExp("@FAMILY@"), family); + + QString parametersList = ""; + foreach (QString el, parameters) { + parametersList += "
  • " + el + "
  • \n"; + } + text = text.replace(QRegExp("@PARAMETERS_LIST@"), parametersList); + + QString tagsList = ""; + foreach (QString dep, tags) { + tagsList += "
  • " + dep + "
  • \n"; + } + text = text.replace(QRegExp("@TAGS_LIST@"), tagsList); + + + ui.viewerSummaryLabel->setText(text); +} + + + + diff --git a/sdk/applications/wizard/ViewerSummaryWidget.h b/sdk/applications/wizard/ViewerSummaryWidget.h new file mode 100644 index 00000000..fe5e4e34 --- /dev/null +++ b/sdk/applications/wizard/ViewerSummaryWidget.h @@ -0,0 +1,71 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ +#ifndef VIEWERSUMMARYWIDGET_H +#define VIEWERSUMMARYWIDGET_H + +// Include GUI automatically generated file +#include "ui_ViewerSummaryWidget.h" + +// includes from Qt +#include +#include + +/** + * @ingroup group_sdk_application_wizard + * + * @brief + * Widget to summarize the created action + * + */ +class ViewerSummaryWidget : public QWidget { + + Q_OBJECT; + +public: + /** Constructor */ + ViewerSummaryWidget(QWidget* parent); + + /** Destructor */ + ~ViewerSummaryWidget() override = default; + + void setToDefault(); + void setSummary(QString name, QString description, QString component, + QStringList parameters, QString family, QStringList tags); + +public slots: + virtual void nextButtonClicked(); + virtual void cancelButtonClicked(); + virtual void previousButtonClicked(); + +signals: + void next(); + void previous(); + void cancel(); + +private: + Ui::ViewerSummaryWidget ui; + +}; +#endif diff --git a/sdk/applications/wizard/ViewerSummaryWidget.ui b/sdk/applications/wizard/ViewerSummaryWidget.ui new file mode 100644 index 00000000..a35cea35 --- /dev/null +++ b/sdk/applications/wizard/ViewerSummaryWidget.ui @@ -0,0 +1,695 @@ + + + ViewerSummaryWidget + + + + 0 + 0 + 723 + 629 + + + + Form + + + + + + 3 + + + + + + + + 0 + 0 + + + + + Sans Serif + 8 + 50 + false + + + + Viewer-extension + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + Sans Serif + 9 + 75 + false + true + + + + Viewer(s) + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + Sans Serif + 8 + 50 + false + + + + Dependencies + + + Qt::AlignCenter + + + + + + + + Sans Serif + 8 + 50 + false + + + + Summary + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + true + + + + 0 + 0 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + Sans Serif + 8 + + + + 1 + + + Qt::AlignCenter + + + 0 + + + + + + + Qt::Horizontal + + + + + + + + Sans Serif + 9 + 75 + false + true + + + + 2 + + + Qt::AlignCenter + + + + + + + + 70 + 0 + + + + + 70 + 0 + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + 50 + false + + + + 3 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + 50 + false + + + + 4 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 85 + 20 + + + + + + + + + Sans Serif + 8 + + + + Description + + + Qt::AlignCenter + + + + + + + + Sans Serif + 8 + + + + Parameter(s) + + + Qt::AlignCenter + + + + + + + + Sans Serif + 8 + + + + Classification + + + Qt::AlignCenter + + + + + + + + Sans Serif + 9 + 75 + true + + + + Summary + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 85 + 20 + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 105 + 20 + + + + + + + + + Sans Serif + 8 + + + + 1 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + + + + 2 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + + + + 3 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + + + + + Sans Serif + 9 + 75 + true + + + + 4 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 105 + 20 + + + + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + 9 + + + + Previous + + + + :/resources/leftarrow.png:/resources/leftarrow.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 9 + + + + Cancel + + + + :/resources/button_cancel.png:/resources/button_cancel.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 64 + 32 + + + + + 128 + 32 + + + + + 9 + + + + Qt::RightToLeft + + + Next + + + + :/resources/rightarrow.png:/resources/rightarrow.png + + + + 16 + 16 + + + + true + + + + + + + + + + + + + + nextPushButton + clicked() + ViewerSummaryWidget + nextButtonClicked() + + + 710 + 616 + + + 682 + 530 + + + + + cancelPushButton + clicked() + ViewerSummaryWidget + cancelButtonClicked() + + + 424 + 616 + + + 249 + 628 + + + + + previousPushButton + clicked() + ViewerSummaryWidget + previousButtonClicked() + + + 91 + 616 + + + 18 + 628 + + + + + + nextButtonClicked() + cancelButtonClicked() + previousButtonClicked() + + diff --git a/sdk/applications/wizard/ViewersCreationState.cpp b/sdk/applications/wizard/ViewersCreationState.cpp new file mode 100644 index 00000000..de80f1e8 --- /dev/null +++ b/sdk/applications/wizard/ViewersCreationState.cpp @@ -0,0 +1,70 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ + +// Include .h file +#include "ViewersCreationState.h" +#include "ViewersCreationWidget.h" +#include "WizardMainWindow.h" +#include "ViewerExtensionCreationState.h" + +// includes from coreschema +#include +#include + + +ViewersCreationState::ViewersCreationState(QString name, ViewersCreationWidget* widget, WizardMainWindow* mainWindow, ViewerExtensionCreationState* parent) + : WizardState(name, widget, mainWindow, parent) { + this->domViewerExtension = nullptr; +} + +void ViewersCreationState::resetDomViewerExtension(cepcoreschema::ViewerExtension* domViewerExtension) { + this->domViewerExtension = domViewerExtension; + auto* viewersCreationWidget = dynamic_cast(widget); + if (viewersCreationWidget != nullptr) { + viewersCreationWidget->setToDefault(); + } +} + +void ViewersCreationState::onEntry(QEvent* event) { + WizardState::onEntry(event); + + /*auto* viewersCreationWidget = dynamic_cast(widget); + if (viewersCreationWidget != nullptr) { + QString viewerExtensionName = domViewerExtension->name().c_str(); + viewersCreationWidget->setGroupBoxTitle(viewerExtensionName); + + viewersCreationWidget->emptyExistingActions(); + cepcoreschema::Viewer theViewers = domViewerExtension->viewer(); + cepcoreschema::Viewer::viewer_iterator it; + for (it = theViewers.viewer().begin(); it != theViewers.viewer().end(); it++) { + QString viewerName = (*it).name().c_str(); + viewersCreationWidget->addViewerName(viewerName); + } + }*/ +} + +void ViewersCreationState::onExit(QEvent* event) { + WizardState::onExit(event); +} diff --git a/sdk/applications/wizard/ViewersCreationState.h b/sdk/applications/wizard/ViewersCreationState.h new file mode 100644 index 00000000..142d8762 --- /dev/null +++ b/sdk/applications/wizard/ViewersCreationState.h @@ -0,0 +1,67 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ +#ifndef VIEWERSCREATIONSTATE_H +#define VIEWERSCREATIONSTATE_H + +#include "WizardState.h" + +class ViewersCreationWidget; +class ViewerExtensionCreationState; + +// Dependency from cepcoreschema +// Declaration here to avoid declaration in dependant projects. +namespace cepcoreschema { +class ViewerExtension; +} + +/** + * @ingroup group_sdk_application_wizard + * + * @brief + * State to create actions + * + */ +class ViewersCreationState : public WizardState { + + Q_OBJECT; + +public: + /** Constructor */ + ViewersCreationState(QString name, ViewersCreationWidget* widget, WizardMainWindow* mainWindow, ViewerExtensionCreationState* parent); + + /** Destructor */ + ~ViewersCreationState() override = default; + + void resetDomViewerExtension(cepcoreschema::ViewerExtension* domViewerExtension); + +protected: + void onEntry(QEvent* event) override; + void onExit(QEvent* event) override; + +private: + cepcoreschema::ViewerExtension* domViewerExtension; + +}; +#endif diff --git a/sdk/applications/wizard/ViewersCreationWidget.cpp b/sdk/applications/wizard/ViewersCreationWidget.cpp new file mode 100644 index 00000000..25d813a6 --- /dev/null +++ b/sdk/applications/wizard/ViewersCreationWidget.cpp @@ -0,0 +1,97 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ + +// Include .h file +#include "ViewersCreationWidget.h" + +#include "DefaultGUIText.h" + +// Qt files +#include + +ViewersCreationWidget::ViewersCreationWidget(QWidget* parent) : QWidget(parent) { + ui.setupUi(this); +} + +void ViewersCreationWidget::setToDefault() { + ui.requiredLabel->setStyleSheet(normalStyle); + ui.label_Star->setStyleSheet(normalStyle); + emptyExistingActions(); +} + +void ViewersCreationWidget::nextButtonClicked() { + // check if at least an action has been created +#ifndef _WIZARD_QUESTIONS_SQUEEZE + if (createdViewers.isEmpty()) { + ui.requiredLabel->setStyleSheet(enhancedStyle); + ui.label_Star->setStyleSheet(enhancedStyle); + + // CCC Exception: Use a QMessageBox::warning instead of CAMITK_WARNING in the wizard + QMessageBox::warning(NULL, "Actions Creation Widget", "Please create at least one action in this ActionExtension\n"); + } + else { + ui.requiredLabel->setStyleSheet(normalStyle); + ui.label_Star->setStyleSheet(normalStyle); + emit next(); + } +#else + emit next(); +#endif +} + +void ViewersCreationWidget::addViewerClicked() { + ui.requiredLabel->setStyleSheet(normalStyle); + ui.label_Star->setStyleSheet(normalStyle); + + emit newViewer(); +} + +void ViewersCreationWidget::previousButtonClicked() { + emit previous(); +} + +void ViewersCreationWidget::cancelButtonClicked() { + emit cancel(); +} + +void ViewersCreationWidget::setGroupBoxTitle(QString text) { + ui.viewersGroupBox->setTitle(text); +} + +void ViewersCreationWidget::emptyExistingActions() { + createdViewers.clear(); + createdViewersString = defaultCreatedViewersString; + ui.createdViewersTextEdit->setHtml(createdViewersString); +} + +void ViewersCreationWidget::addViewerName(QString viewerName) { + this->createdViewers.append(viewerName); + + QString toBeInserted = "
  • " + viewerName + "
  • \n"; + int index = createdViewersString.lastIndexOf(""); + + createdViewersString.insert(index, toBeInserted); + ui.createdViewersTextEdit->setHtml(createdViewersString); +} diff --git a/sdk/applications/wizard/ViewersCreationWidget.h b/sdk/applications/wizard/ViewersCreationWidget.h new file mode 100644 index 00000000..b6fa7503 --- /dev/null +++ b/sdk/applications/wizard/ViewersCreationWidget.h @@ -0,0 +1,77 @@ +/***************************************************************************** + * $CAMITK_LICENCE_BEGIN$ + * + * CamiTK - Computer Assisted Medical Intervention ToolKit + * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) + * + * Visit http://camitk.imag.fr for more information + * + * This file is part of CamiTK. + * + * CamiTK is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * CamiTK is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with CamiTK. If not, see . + * + * $CAMITK_LICENCE_END$ + ****************************************************************************/ +#ifndef VIEWERSCREATIONWIDGET_H +#define VIEWERSCREATIONWIDGET_H + +// Include GUI automatically generated file +#include "ui_ViewersCreationWidget.h" + +// includes from Qt +#include +#include + +/** + * @ingroup group_sdk_application_wizard + * + * @brief + * Widget to create actions + * + */ +class ViewersCreationWidget : public QWidget { + + Q_OBJECT; + +public: + /** Constructor */ + ViewersCreationWidget(QWidget* parent); + + /** Destructor */ + ~ViewersCreationWidget() override = default; + + void setToDefault(); + + void setGroupBoxTitle(QString text); + void emptyExistingActions(); + void addViewerName(QString viewerName); + +public slots: + virtual void addViewerClicked(); + virtual void nextButtonClicked(); + virtual void previousButtonClicked(); + virtual void cancelButtonClicked(); + +signals: + void next(); + void cancel(); + void previous(); + void newViewer(); + +private: + QStringList createdViewers; + QString createdViewersString; + + Ui::ViewersCreationWidget ui; +}; +#endif diff --git a/sdk/applications/wizard/ViewersCreationWidget.ui b/sdk/applications/wizard/ViewersCreationWidget.ui new file mode 100644 index 00000000..69ea5f97 --- /dev/null +++ b/sdk/applications/wizard/ViewersCreationWidget.ui @@ -0,0 +1,673 @@ + + + ViewersCreationWidget + + + + 0 + 0 + 590 + 573 + + + + Form + + + + + + 3 + + + + + + + + 0 + 0 + + + + + Sans Serif + 8 + 50 + false + + + + Viewer-extension + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + Sans Serif + 9 + 75 + false + true + + + + Viewer(s) + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + Sans Serif + 8 + 50 + false + + + + Dependencies + + + Qt::AlignCenter + + + + + + + + Sans Serif + 8 + + + + Summary + + + Qt::AlignCenter + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + true + + + + 0 + 0 + + + + + 1 + 1 + + + + + 1 + 1 + + + + + Sans Serif + 8 + 50 + false + + + + 1 + + + Qt::AlignCenter + + + 0 + + + + + + + + 0 + 0 + + + + + 110 + 0 + + + + + 70 + 0 + + + + Qt::Horizontal + + + + + + + + Sans Serif + 9 + 75 + false + true + + + + 2 + + + Qt::AlignCenter + + + + + + + + 70 + 0 + + + + + 70 + 0 + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + 50 + false + + + + 3 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + + + + + Sans Serif + 8 + + + + 4 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 32 + 32 + + + + + 64 + 64 + + + + + + + :/resources/viewer_bas.png + + + true + + + + + + + + 14 + + + + <html><head/><body><p><span style=" font-weight:600;">Create your Viewers</span></p></body></html> + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Viewers + + + + + + + + + + + + + + + + 0 + 0 + + + + + 512 + 32 + + + + + 16777215 + 32 + + + + Add an Viewer + + + + :/resources/edit_add.png:/resources/edit_add.png + + + + + + + + Arial + 10 + true + + + + * + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + <html><head/><body><p>* Please, add at least an viewer in your extension</p></body></html> + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 9 + + + + Previous + + + + :/resources/leftarrow.png:/resources/leftarrow.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 9 + + + + Cancel + + + + :/resources/button_cancel.png:/resources/button_cancel.png + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 64 + 32 + + + + + 128 + 32 + + + + + 9 + + + + Qt::RightToLeft + + + Next + + + + :/resources/rightarrow.png:/resources/rightarrow.png + + + + 16 + 16 + + + + true + + + + + + + + + + + + + + + addViewerPushButton + clicked() + ViewersCreationWidget + addViewerClicked() + + + 476 + 399 + + + 454 + 254 + + + + + nextPushButton + clicked() + ViewersCreationWidget + nextButtonClicked() + + + 577 + 560 + + + 711 + 579 + + + + + cancelPushButton + clicked() + ViewersCreationWidget + cancelButtonClicked() + + + 291 + 545 + + + 389 + 522 + + + + + previousPushButton + clicked() + ViewersCreationWidget + previousButtonClicked() + + + 73 + 546 + + + 141 + 519 + + + + + + addViewerClicked() + nextButtonClicked() + cancelButtonClicked() + previousButtonClicked() + + diff --git a/sdk/applications/wizard/WizardController.cpp b/sdk/applications/wizard/WizardController.cpp index cc34d9ba..69e8b2d6 100644 --- a/sdk/applications/wizard/WizardController.cpp +++ b/sdk/applications/wizard/WizardController.cpp @@ -53,6 +53,7 @@ #include "GeneratingCEPState.h" #include "ActionExtensionCreationState.h" +#include "ViewerExtensionCreationState.h" #include "ComponentExtensionCreationState.h" #include "LibraryCreationState.h" @@ -93,6 +94,9 @@ WizardController::WizardController() { // -------------------------- Action extensions ActionExtensionCreationState* actionExtensionCreationState = new ActionExtensionCreationState("Action Extension State", mainWindow, domCep); + // -------------------------- Viewer extensions + ViewerExtensionCreationState* viewerExtensionCreationState = new ViewerExtensionCreationState("Viewer Extension State", mainWindow, domCep); + // -------------------------- Component extensions ComponentExtensionCreationState* componentExtensionCreationState = new ComponentExtensionCreationState("Component Extension State", mainWindow, domCep); // -------------------------- Libraries @@ -116,6 +120,7 @@ WizardController::WizardController() { machine.addState(cepCreateRecapState); machine.addState(actionExtensionCreationState); + machine.addState(viewerExtensionCreationState); machine.addState(componentExtensionCreationState); machine.addState(libraryCreationState); @@ -148,6 +153,9 @@ WizardController::WizardController() { cepCreateRecapState->addTransition(cepCreateRecapWidget, SIGNAL(addActionExtension()), actionExtensionCreationState); actionExtensionCreationState->addTransition(actionExtensionCreationState, SIGNAL(next()), cepCreateRecapState); + cepCreateRecapState->addTransition(cepCreateRecapWidget, SIGNAL(addViewerExtension()), viewerExtensionCreationState); + viewerExtensionCreationState->addTransition(viewerExtensionCreationState, SIGNAL(next()), cepCreateRecapState); + cepCreateRecapState->addTransition(cepCreateRecapWidget, SIGNAL(addComponentExtension()), componentExtensionCreationState); componentExtensionCreationState->addTransition(componentExtensionCreationState, SIGNAL(next()), cepCreateRecapState); -- GitLab From f765c57e65747b161557420e1b60ace51b432571 Mon Sep 17 00:00:00 2001 From: Maxime Calka Date: Fri, 6 Mar 2020 11:49:46 +0100 Subject: [PATCH 2/4] Change CmakeExtension.cmake --- sdk/cmake/modules/macros/camitk/CamiTKExtension.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/cmake/modules/macros/camitk/CamiTKExtension.cmake b/sdk/cmake/modules/macros/camitk/CamiTKExtension.cmake index f946f7e7..1d6574b4 100644 --- a/sdk/cmake/modules/macros/camitk/CamiTKExtension.cmake +++ b/sdk/cmake/modules/macros/camitk/CamiTKExtension.cmake @@ -217,9 +217,9 @@ macro(camitk_extension) ######################################################################### # BASIC DIRECTORIES - include_directories(${CAMITK_INCLUDE_DIRECTORIES}) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + include_directories(${CAMITK_INCLUDE_DIRECTORIES}) # USER INPUT DIRECTORIES include_directories(${${EXTENSION_NAME_CMAKE}_INCLUDE_DIRECTORIES}) -- GitLab From f41793779bb2c53776e3158f75c37af6ebcf3d2b Mon Sep 17 00:00:00 2001 From: Maxime Calka Date: Tue, 10 Mar 2020 17:13:53 +0100 Subject: [PATCH 3/4] Finish viewer extension, wait bug correction --- .../wizard/ActionCreationState - Copy.cpp | 131 ------ .../wizard/ActionCreationState - Copy.h | 110 ----- .../wizard/ActionSummaryWidget.cpp | 2 - sdk/applications/wizard/DefaultGUIText.h | 20 +- .../wizard/ExtensionSummaryState.cpp | 27 +- .../wizard/ViewerCreationState.cpp | 45 +- .../wizard/ViewerDescriptionState.cpp | 50 +- .../wizard/ViewerDescriptionWidget.cpp | 65 +-- .../wizard/ViewerDescriptionWidget.h | 9 +- .../wizard/ViewerDescriptionWidget.ui | 437 +----------------- .../wizard/ViewerExtensionCreationState.cpp | 15 +- .../ViewerExtensionDependenciesState.cpp | 7 - .../ViewerExtensionDescriptionWidget.ui | 2 +- .../wizard/ViewerSummaryState.cpp | 24 +- sdk/applications/wizard/ViewerSummaryState.h | 2 + .../wizard/ViewerSummaryWidget.cpp | 20 +- sdk/applications/wizard/ViewerSummaryWidget.h | 3 +- .../wizard/ViewerSummaryWidget.ui | 82 +--- .../wizard/ViewersCreationState.cpp | 20 +- .../wizard/ViewersCreationWidget.cpp | 17 +- .../wizard/ViewersCreationWidget.h | 9 +- .../wizard/ViewersCreationWidget.ui | 59 ++- .../macros/camitk/CamiTKExtension.cmake | 4 +- 23 files changed, 167 insertions(+), 993 deletions(-) delete mode 100644 sdk/applications/wizard/ActionCreationState - Copy.cpp delete mode 100644 sdk/applications/wizard/ActionCreationState - Copy.h diff --git a/sdk/applications/wizard/ActionCreationState - Copy.cpp b/sdk/applications/wizard/ActionCreationState - Copy.cpp deleted file mode 100644 index e1924535..00000000 --- a/sdk/applications/wizard/ActionCreationState - Copy.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/***************************************************************************** - * $CAMITK_LICENCE_BEGIN$ - * - * CamiTK - Computer Assisted Medical Intervention ToolKit - * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) - * - * Visit http://camitk.imag.fr for more information - * - * This file is part of CamiTK. - * - * CamiTK is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * CamiTK is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with CamiTK. If not, see . - * - * $CAMITK_LICENCE_END$ - ****************************************************************************/ - -// Include .h file -#include "ActionCreationState.h" -#include "WizardMainWindow.h" -#include "ActionExtensionCreationState.h" - -#include "ActionDescriptionWidget.h" -#include "ActionDescriptionState.h" -#include "ActionAddParameterWidget.h" -#include "ActionAddParameterState.h" -#include "ActionClassificationWidget.h" -#include "ActionClassificationState.h" -#include "ActionSummaryWidget.h" -#include "ActionSummaryState.h" - -#include -#include -#include - -ActionCreationState::ActionCreationState(QString name, WizardMainWindow* mainWindow, cepcoreschema::Cep* domCep, ActionExtensionCreationState* parent) : QState(parent) { - this->name = name; - this->cancelled = false; - this->domAction = nullptr; - - this->domActionExtension = nullptr; - this->domCep = domCep; - - createSubStates(mainWindow); -} - -void ActionCreationState::resetDomActionExtension(cepcoreschema::ActionExtension* domActionExtension) { - this->domActionExtension = domActionExtension; -} - -void ActionCreationState::onEntry(QEvent* event) { - this->cancelled = false; - cepcoreschema::Classification classification("No Family"); - - if (domAction != nullptr) { - delete domAction; - domAction = nullptr; - } - - domAction = new cepcoreschema::Action("An Action", "An action description", "None", classification); - actionDescriptionState->resetDomAction(domAction, domActionExtension); - actionAddParameterState->resetDomAction(domAction); - actionClassificationState->resetDomAction(domAction); - actionSummaryState->resetAction(domAction); - -} - -void ActionCreationState::onExit(QEvent* event) { - if (! cancelled) { - domActionExtension->actions().action().push_back((*domAction)); - } - else { - if (domAction != nullptr) { - delete domAction; - domAction = nullptr; - } - } -} - -void ActionCreationState::actionFinished() { - cancelled = false; - emit nextACS(); -} - -void ActionCreationState::actionCancelled() { - cancelled = true; - emit nextACS(); -} - -void ActionCreationState::createSubStates(WizardMainWindow* mainWindow) { - actionDescriptionWidget = new ActionDescriptionWidget(nullptr); - actionDescriptionState = new ActionDescriptionState("Action Description", actionDescriptionWidget, mainWindow, domCep, this); - - actionAddParameterWidget = new ActionAddParameterWidget(nullptr); - actionAddParameterState = new ActionAddParameterState("Action Creation", actionAddParameterWidget, mainWindow, this); - - actionClassificationWidget = new ActionClassificationWidget(nullptr); - actionClassificationState = new ActionClassificationState("Action Classification", actionClassificationWidget, mainWindow, this); - - actionSummaryWidget = new ActionSummaryWidget(nullptr); - actionSummaryState = new ActionSummaryState("Action Summary", actionSummaryWidget, mainWindow, this); - - this->setInitialState(actionDescriptionState); - - actionDescriptionState->addTransition(actionDescriptionWidget, SIGNAL(next()), actionAddParameterState); - - actionAddParameterState->addTransition(actionAddParameterWidget, SIGNAL(next()), actionClassificationState); - actionAddParameterState->addTransition(actionAddParameterWidget, SIGNAL(previous()), actionDescriptionState); - - actionClassificationState->addTransition(actionClassificationWidget, SIGNAL(next()), actionSummaryState); - actionClassificationState->addTransition(actionClassificationWidget, SIGNAL(previous()), actionAddParameterState); - - actionSummaryState->addTransition(actionSummaryWidget, SIGNAL(previous()), actionClassificationState); - - QObject::connect(actionDescriptionWidget, SIGNAL(cancel()), this, SLOT(actionCancelled())); - QObject::connect(actionAddParameterWidget, SIGNAL(cancel()), this, SLOT(actionCancelled())); - QObject::connect(actionClassificationWidget, SIGNAL(cancel()), this, SLOT(actionCancelled())); - QObject::connect(actionSummaryWidget, SIGNAL(cancel()), this, SLOT(actionCancelled())); - - - QObject::connect(actionSummaryWidget, SIGNAL(next()), this, SLOT(actionFinished())); - -} diff --git a/sdk/applications/wizard/ActionCreationState - Copy.h b/sdk/applications/wizard/ActionCreationState - Copy.h deleted file mode 100644 index 1b455636..00000000 --- a/sdk/applications/wizard/ActionCreationState - Copy.h +++ /dev/null @@ -1,110 +0,0 @@ -/***************************************************************************** - * $CAMITK_LICENCE_BEGIN$ - * - * CamiTK - Computer Assisted Medical Intervention ToolKit - * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO) - * - * Visit http://camitk.imag.fr for more information - * - * This file is part of CamiTK. - * - * CamiTK is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * CamiTK is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with CamiTK. If not, see . - * - * $CAMITK_LICENCE_END$ - ****************************************************************************/ -#ifndef ACTIONCREATIONSTATE_H -#define ACTIONCREATIONSTATE_H - -#include -#include - -class WizardMainWindow; -class ActionExtensionCreationState; - -// Sub-states -class ActionDescriptionWidget; -class ActionDescriptionState; -class ActionAddParameterWidget; -class ActionAddParameterState; -class ActionClassificationWidget; -class ActionClassificationState; -class ActionSummaryWidget; -class ActionSummaryState; - -// Dependency from cepcoreschema -// Declaration here to avoid declaration in dependant projects. -namespace cepcoreschema { -class ActionExtension; -class Action; -class Cep; -} - -/** - * @ingroup group_sdk_application_wizard - * - * @brief - * State to create one action. - * - * This state manages sub-state to create one action. - * - */ -class ActionCreationState : public QState { - - Q_OBJECT; - -public: - /** Constructor */ - ActionCreationState(QString name, WizardMainWindow* mainWidnow, cepcoreschema::Cep* domCep, ActionExtensionCreationState* parent); - - /** Destructor */ - ~ActionCreationState() override = default; - - void resetDomActionExtension(cepcoreschema::ActionExtension* domActionExtension); - -signals: - void nextACS(); - -public slots: - virtual void actionFinished(); - virtual void actionCancelled(); - -protected: - /// Reimplemented from QState - /// @{ - void onEntry(QEvent* event) override; - - void onExit(QEvent* event) override; - ///@} - - /// Substates (to be updated with domAction at each entry) - ActionDescriptionWidget* actionDescriptionWidget; - ActionDescriptionState* actionDescriptionState; - ActionAddParameterWidget* actionAddParameterWidget; - ActionAddParameterState* actionAddParameterState; - ActionClassificationWidget* actionClassificationWidget; - ActionClassificationState* actionClassificationState; - ActionSummaryWidget* actionSummaryWidget; - ActionSummaryState* actionSummaryState; - - -private: - void createSubStates(WizardMainWindow* mainWindow); - - bool cancelled; - QString name; - cepcoreschema::ActionExtension* domActionExtension; - cepcoreschema::Action* domAction; - cepcoreschema::Cep* domCep; - -}; -#endif diff --git a/sdk/applications/wizard/ActionSummaryWidget.cpp b/sdk/applications/wizard/ActionSummaryWidget.cpp index 55f43e1f..9877332c 100644 --- a/sdk/applications/wizard/ActionSummaryWidget.cpp +++ b/sdk/applications/wizard/ActionSummaryWidget.cpp @@ -48,8 +48,6 @@ void ActionSummaryWidget::previousButtonClicked() { emit previous(); } - - void ActionSummaryWidget::setSummary(QString name, QString description, QString component, QStringList parameters, QString family, QStringList tags) { QString text = defaultActionSummary; diff --git a/sdk/applications/wizard/DefaultGUIText.h b/sdk/applications/wizard/DefaultGUIText.h index e0c0f0d6..adb99f2b 100644 --- a/sdk/applications/wizard/DefaultGUIText.h +++ b/sdk/applications/wizard/DefaultGUIText.h @@ -262,27 +262,15 @@ static const QString defaultViewerSummary = "\ \ \

    Summary

    \ -

    You are about to add the following Action

    \ +

    You are about to add the following Viewer

    \
      \
    • Name: @NAME@
    • \
    • Description: @DESCRIPTION@
    • \ -
    • Component: @COMPONENT@
    • \ -
    • Parameter(s): \ -
        \ -@PARAMETERS_LIST@ \ -
      \ -
    • \ -
    • Family: @FAMILY@
    • \ -
    • Tag(s): \ -
        \ -@TAGS_LIST@ \ -
      \ -
    • \
    \
    \ -

    If you want to modify some elements of your Action, click on Previous.

    \ -

    If you want to cancel the creation of this Action, click on Cancel.

    \ -

    Clicking on Next will bring you back to the Action Extension page.

    \ +

    If you want to modify some elements of your Viewer, click on Previous.

    \ +

    If you want to cancel the creation of this Viewer, click on Cancel.

    \ +

    Clicking on Next will bring you back to the Viewer Extension page.

    \ \ "; diff --git a/sdk/applications/wizard/ExtensionSummaryState.cpp b/sdk/applications/wizard/ExtensionSummaryState.cpp index 7eb11455..7ee36347 100644 --- a/sdk/applications/wizard/ExtensionSummaryState.cpp +++ b/sdk/applications/wizard/ExtensionSummaryState.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include ExtensionSummaryState::ExtensionSummaryState(QString name, ExtensionSummaryWidget* widget, @@ -51,6 +52,7 @@ void ExtensionSummaryState::setActionExtension(cepcoreschema::ActionExtension* d if (this->type == "Action") { this->domActionExtension = domActionExtension; this->domComponentExtension = nullptr; + this->domViewerExtension = nullptr; } } @@ -58,14 +60,16 @@ void ExtensionSummaryState::setComponentExtension(cepcoreschema::ComponentExtens if (this->type == "Component") { this->domActionExtension = nullptr; this->domComponentExtension = domComponentExtension; + this->domViewerExtension = nullptr; } } void ExtensionSummaryState::setViewerExtension(cepcoreschema::ViewerExtension* domViewerExtension) { if (this->type == "Viewer") { - this->domViewerExtension = domViewerExtension; + this->domActionExtension = nullptr; this->domComponentExtension = nullptr; + this->domViewerExtension = domViewerExtension; } } @@ -126,6 +130,27 @@ void ExtensionSummaryState::onEntry(QEvent* event) { extensionSummaryWidget->setSummary(name, description, elements, dependencies); } + else if ((type == "Viewer") && (domViewerExtension != nullptr)) { + extensionSummaryWidget->setElement("Viewer"); + QString name = domViewerExtension->name().c_str(); + QString description = domViewerExtension->description().c_str(); + + QString viewerName = domViewerExtension->viewer().name().c_str(); + elements << viewerName; + + if (domViewerExtension->dependencies().present()) { + cepcoreschema::Dependencies deps = domViewerExtension->dependencies().get(); + cepcoreschema::Dependencies::dependency_iterator it; + for (it = deps.dependency().begin(); it != deps.dependency().end(); it++) { + cepcoreschema::Dependency& dep = (*it); + QString dependency = dep.name().c_str(); + dependencies << dependency; + } + } + + extensionSummaryWidget->setSummary(name, description, elements, dependencies); + } + } } diff --git a/sdk/applications/wizard/ViewerCreationState.cpp b/sdk/applications/wizard/ViewerCreationState.cpp index e6066747..09e9aafe 100644 --- a/sdk/applications/wizard/ViewerCreationState.cpp +++ b/sdk/applications/wizard/ViewerCreationState.cpp @@ -35,6 +35,7 @@ #include #include +#include #include ViewerCreationState::ViewerCreationState(QString name, WizardMainWindow* mainWindow, cepcoreschema::Cep* domCep, ViewerExtensionCreationState* parent) : QState(parent) { @@ -54,31 +55,28 @@ void ViewerCreationState::resetDomViewerExtension(cepcoreschema::ViewerExtension void ViewerCreationState::onEntry(QEvent* event) { this->cancelled = false; - cepcoreschema::Classification classification("No Family"); + cepcoreschema::ViewerType type(cepcoreschema::ViewerType::EMBEDDED); if (domViewer != nullptr) { delete domViewer; domViewer = nullptr; } - //domViewer = new cepcoreschema::Viewer("An Viewer", "An viewer description", "None", classification); + domViewer = new cepcoreschema::Viewer("A Viewer", "A viewer description", type); viewerDescriptionState->resetDomViewer(domViewer, domViewerExtension); - /*viewerAddParameterState->resetDomViewer(domViewer); - viewerClassificationState->resetDomViewer(domViewer);*/ viewerSummaryState->resetViewer(domViewer); - } void ViewerCreationState::onExit(QEvent* event) { - //if (! cancelled) { - // domViewerExtension->viewers().viewer().push_back((*domViewer)); - //} - //else { - // if (domViewer != nullptr) { - // delete domViewer; - // domViewer = nullptr; - // } - //} + if (! cancelled) { + domViewerExtension->viewer(); + } + else { + if (domViewer != nullptr) { + delete domViewer; + domViewer = nullptr; + } + } } void ViewerCreationState::viewerFinished() { @@ -95,33 +93,16 @@ void ViewerCreationState::createSubStates(WizardMainWindow* mainWindow) { viewerDescriptionWidget = new ViewerDescriptionWidget(nullptr); viewerDescriptionState = new ViewerDescriptionState("Viewer Description", viewerDescriptionWidget, mainWindow, domCep, this); - //viewerAddParameterWidget = new ViewerAddParameterWidget(nullptr); - //viewerAddParameterState = new ViewerAddParameterState("Viewer Creation", viewerAddParameterWidget, mainWindow, this); - - //viewerClassificationWidget = new ViewerClassificationWidget(nullptr); - //viewerClassificationState = new ViewerClassificationState("Viewer Classification", viewerClassificationWidget, mainWindow, this); - viewerSummaryWidget = new ViewerSummaryWidget(nullptr); viewerSummaryState = new ViewerSummaryState("Viewer Summary", viewerSummaryWidget, mainWindow, this); this->setInitialState(viewerDescriptionState); - //viewerDescriptionState->addTransition(viewerDescriptionWidget, SIGNAL(next()), viewerAddParameterState); - - //viewerAddParameterState->addTransition(viewerAddParameterWidget, SIGNAL(next()), viewerClassificationState); - //viewerAddParameterState->addTransition(viewerAddParameterWidget, SIGNAL(previous()), viewerDescriptionState); - - //viewerClassificationState->addTransition(viewerClassificationWidget, SIGNAL(next()), viewerSummaryState); - //viewerClassificationState->addTransition(viewerClassificationWidget, SIGNAL(previous()), viewerAddParameterState); - - //viewerSummaryState->addTransition(viewerSummaryWidget, SIGNAL(previous()), viewerClassificationState); + viewerDescriptionState->addTransition(viewerDescriptionWidget, SIGNAL(next()), viewerSummaryState); QObject::connect(viewerDescriptionWidget, SIGNAL(cancel()), this, SLOT(viewerCancelled())); - //QObject::connect(viewerAddParameterWidget, SIGNAL(cancel()), this, SLOT(viewerCancelled())); - //QObject::connect(viewerClassificationWidget, SIGNAL(cancel()), this, SLOT(viewerCancelled())); QObject::connect(viewerSummaryWidget, SIGNAL(cancel()), this, SLOT(viewerCancelled())); - QObject::connect(viewerSummaryWidget, SIGNAL(next()), this, SLOT(viewerFinished())); } diff --git a/sdk/applications/wizard/ViewerDescriptionState.cpp b/sdk/applications/wizard/ViewerDescriptionState.cpp index 2f12cf51..ff1f79fe 100644 --- a/sdk/applications/wizard/ViewerDescriptionState.cpp +++ b/sdk/applications/wizard/ViewerDescriptionState.cpp @@ -70,23 +70,22 @@ void ViewerDescriptionState::onEntry(QEvent* event) { viewerDescriptionWidget->setDescription(QString(domViewer->description().c_str())); } - // Check existing CEP components - // CS: problem to get components name. - // The loop was under component extension, the corresction is to loop under components for each componentExtension. - if (domCep->componentExtensions().present()) { - cepcoreschema::ComponentExtensions::componentExtension_sequence cepComponentExtensions = domCep->componentExtensions().get().componentExtension(); - cepcoreschema::ComponentExtensions::componentExtension_iterator itCompExt; - // Loop on ComponentExtensions - for (itCompExt = cepComponentExtensions.begin(); itCompExt != cepComponentExtensions.end(); itCompExt++) { - cepcoreschema::Components::component_iterator itComp; - // Loop on components for each componentExtension. - for (itComp = itCompExt->components().component().begin(); itComp != itCompExt->components().component().end(); itComp++) { - QString componentName = (*itComp).name().c_str(); - componentName = ClassNameHandler::getClassName(componentName); - viewerDescriptionWidget->addPossibleComponent(componentName); - } - } - } + // Check existing CEP viewers + // CS: problem to get viewers name. + // The loop was under viewer extension, the corresction is to loop under viewers for each viewerExtension. + // if (domCep->viewerExtensions().present()) { + // cepcoreschema::ViewerExtensions::viewerExtension_sequence cepViewerExtensions = domCep->viewerExtensions().get().viewerExtension(); + // cepcoreschema::ViewerExtensions::viewerExtension_iterator itCompExt; + // // Loop on viewerExtensions + // for (itCompExt = cepViewerExtensions.begin(); itCompExt != cepViewerExtensions.end(); itCompExt++) { + // cepcoreschema::Viewers::viewer_iterator itComp; + // // Loop on viewers for each viewerExtension. + // for (itComp = itCompExt->viewers().viewer().begin(); itComp != itCompExt->viewers().viewer().end(); itComp++) { + // QString viewerName = (*itComp).name().c_str(); + //viewerName = ClassNameHandler::getClassName(viewerName); + // } + // } + // } } } @@ -98,21 +97,14 @@ void ViewerDescriptionState::onExit(QEvent* event) { if (viewerDescriptionWidget) { QString viewerName = viewerDescriptionWidget->getViewerName(); QString viewerDescription = viewerDescriptionWidget->getViewerDescription(); - QString componentName = viewerDescriptionWidget->getComponentName(); + cepcoreschema::ViewerType type = viewerDescriptionWidget->getType(); domViewer->name(viewerName.toStdString()); domViewer->description(viewerDescription.toStdString()); -// domViewer->component(componentName.toStdString()); - - if (viewerDescriptionWidget->isItkFilter()) { - std::cout << "ITK Filter" << std::endl; - QString outputType = viewerDescriptionWidget->getOutputType(); - std::cout << "Type: " << outputType.toStdString() << std::endl; - - cepcoreschema::ItkFilter theFilter(outputType.toStdString()); -// domViewer->classification().itkFilter(theFilter); - } - + domViewer->type(type); } + domViewerExtension->viewer(*domViewer); + std::cout << domViewer->name() << std::endl; + std::cout << domViewer->description() << std::endl; } diff --git a/sdk/applications/wizard/ViewerDescriptionWidget.cpp b/sdk/applications/wizard/ViewerDescriptionWidget.cpp index 78b80c26..b96caec6 100644 --- a/sdk/applications/wizard/ViewerDescriptionWidget.cpp +++ b/sdk/applications/wizard/ViewerDescriptionWidget.cpp @@ -31,6 +31,8 @@ // Qt files #include +#include + ViewerDescriptionWidget::ViewerDescriptionWidget(QWidget* parent) : QWidget(parent) { ui.setupUi(this); setToDefault(defaultViewerExtensionName); @@ -101,34 +103,8 @@ QString ViewerDescriptionWidget::getViewerDescription() { return ui.viewerGoalItself->toPlainText(); } -QString ViewerDescriptionWidget::getComponentName() { - return ui.componentComboBox->currentText(); -} - -bool ViewerDescriptionWidget::isItkFilter() { - return ui.itkFilterCheckBox->isChecked(); -} - -QString ViewerDescriptionWidget::getOutputType() { - return ui.itkOutputImageTypeComboBox->currentText(); -} - -void ViewerDescriptionWidget::addPossibleComponent(QString possibleComponent) { - possibleComponents << possibleComponent; - ui.componentComboBox->clear(); - ui.componentComboBox->insertItems(0, possibleComponents); -} - -void ViewerDescriptionWidget::itkFilterClicked(bool checked) { - if ((ui.componentComboBox->currentText() == "ImageComponent") && checked) { - ui.itkOutputImageLabel->show(); - ui.itkOutputImageTypeComboBox->show(); - } - else { - ui.itkOutputImageLabel->hide(); - ui.itkOutputImageTypeComboBox->hide(); - - } +cepcoreschema::ViewerType ViewerDescriptionWidget::getType() { + return cepcoreschema::ViewerType::EMBEDDED; } void ViewerDescriptionWidget::setToDefault(QString viewerExtensionName) { @@ -140,15 +116,6 @@ void ViewerDescriptionWidget::setToDefault(QString viewerExtensionName) { ui.viewerNameStar->setStyleSheet(normalStyle); ui.viewerGoalStar->setStyleSheet(normalStyle); ui.requiredLabel->setStyleSheet(normalStyle); - - possibleComponents = defaultPossibleComponents; - - ui.componentComboBox->clear(); - ui.componentComboBox->insertItems(0, possibleComponents); - ui.itkFilterCheckBox->setChecked(false); - ui.itkOutputImageLabel->hide(); - ui.itkOutputImageTypeComboBox->hide(); - ui.componentComboBox->setCurrentIndex(possibleComponents.indexOf("ImageComponent")); } void ViewerDescriptionWidget::setName(QString name) { @@ -157,26 +124,4 @@ void ViewerDescriptionWidget::setName(QString name) { void ViewerDescriptionWidget::setDescription(QString description) { ui.viewerGoalItself->setPlainText(description); -} - -void ViewerDescriptionWidget::setComponent(QString component) { - ui.componentComboBox->setCurrentIndex(possibleComponents.indexOf(component)); -} - -void ViewerDescriptionWidget::componentChanged(QString text) { - if (ui.componentComboBox->currentText() == "ImageComponent") { - ui.itkFilterCheckBox->show(); - if (ui.itkFilterCheckBox->isChecked()) { - ui.itkOutputImageLabel->show(); - ui.itkOutputImageTypeComboBox->show(); - } - } - else { - - ui.itkFilterCheckBox->hide(); - ui.itkOutputImageLabel->hide(); - ui.itkOutputImageTypeComboBox->hide(); - } -} - - +} \ No newline at end of file diff --git a/sdk/applications/wizard/ViewerDescriptionWidget.h b/sdk/applications/wizard/ViewerDescriptionWidget.h index 602228e9..1181c340 100644 --- a/sdk/applications/wizard/ViewerDescriptionWidget.h +++ b/sdk/applications/wizard/ViewerDescriptionWidget.h @@ -31,6 +31,8 @@ // includes from Qt #include +#include + /** * @ingroup group_sdk_application_wizard * @@ -50,7 +52,6 @@ public: ~ViewerDescriptionWidget() override = default; void setToDefault(QString viewerExtensionName); - void addPossibleComponent(QString possibleComponent); void setName(QString name); void setDescription(QString description); @@ -58,22 +59,18 @@ public: QString getViewerName(); QString getViewerDescription(); - QString getComponentName(); - bool isItkFilter(); + cepcoreschema::ViewerType getType(); QString getOutputType(); public slots: virtual void nextButtonClicked(); virtual void cancelButtonClicked(); - virtual void componentChanged(QString); - virtual void itkFilterClicked(bool); signals: void next(); void cancel(); private: - QStringList possibleComponents; Ui::ViewerDescriptionWidget ui; QString viewerExtensionName; diff --git a/sdk/applications/wizard/ViewerDescriptionWidget.ui b/sdk/applications/wizard/ViewerDescriptionWidget.ui index 34ef8af4..9b401e32 100644 --- a/sdk/applications/wizard/ViewerDescriptionWidget.ui +++ b/sdk/applications/wizard/ViewerDescriptionWidget.ui @@ -269,7 +269,7 @@ - 4 + 2 Qt::AlignCenter @@ -343,54 +343,6 @@ - - - - - 0 - 0 - - - - - Sans Serif - 8 - 50 - false - - - - Parameter(s) - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - Sans Serif - 8 - 50 - false - - - - Classification - - - Qt::AlignCenter - - - @@ -485,86 +437,6 @@ - - - - - 0 - 0 - - - - - 70 - 0 - - - - - 70 - 0 - - - - Qt::Horizontal - - - - - - - - Sans Serif - 8 - 50 - false - - - - 2 - - - Qt::AlignCenter - - - - - - - - 70 - 0 - - - - - 70 - 0 - - - - Qt::Horizontal - - - - - - - - Sans Serif - 8 - 50 - false - - - - 3 - - - Qt::AlignCenter - - - @@ -629,40 +501,6 @@ 1 - - - - - 32 - 32 - - - - - 32 - 32 - - - - <html><head/><body><p>Choose the type of component your viewer will use.</p></body></html> - - - - - - - - - :/resources/Help.png - - - true - - - Qt::AlignCenter - - - @@ -734,104 +572,6 @@ - - - - - - - Sans Serif - - - - ITK Filter ? - - - - - - - - Sans Serif - - - - Output Image Type - - - - - - - - Sans Serif - - - - background-color: rgb(255, 255, 255); - - - - Same as Input - - - - - unsigned char - - - - - char - - - - - unsigned short - - - - - short - - - - - unsigned int - - - - - int - - - - - long - - - - - double - - - - - - - - - - - Sans Serif - 11 - - - - Component: - - - @@ -848,28 +588,6 @@ - - - - - 20 - 0 - - - - - 20 - 16777215 - - - - * - - - Qt::AlignCenter - - - @@ -892,22 +610,6 @@ - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - @@ -980,127 +682,6 @@ - - - - - 0 - 0 - - - - - 0 - 20 - - - - - 16777215 - 20 - - - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - - - Arial - - - - background-color: rgb(255, 255, 255); - - - @@ -1264,22 +845,6 @@ - - itkFilterCheckBox - toggled(bool) - ViewerDescriptionWidget - itkFilterClicked(bool) - - - 379 - 424 - - - 276 - 421 - - - cancelPushButton clicked() diff --git a/sdk/applications/wizard/ViewerExtensionCreationState.cpp b/sdk/applications/wizard/ViewerExtensionCreationState.cpp index f3ee5fa8..cd1b29de 100644 --- a/sdk/applications/wizard/ViewerExtensionCreationState.cpp +++ b/sdk/applications/wizard/ViewerExtensionCreationState.cpp @@ -57,19 +57,18 @@ void ViewerExtensionCreationState::onEntry(QEvent* event) { domViewerExtension = nullptr; } - /*cepcoreschema::Viewers theViewers; - this->domViewerExtension = new cepcoreschema::ViewerExtension("A Viewer Extension", "A viewer extension description", theViewers);*/ + cepcoreschema::Viewer theViewer("A Viewer", "A viewer description", cepcoreschema::ViewerType::EMBEDDED); + this->domViewerExtension = new cepcoreschema::ViewerExtension("A Viewer Extension", "A viewer extension description", theViewer); viewerExtensionDescriptionState->resetDomViewerExtension(domViewerExtension); - viewersCreationState->resetDomViewerExtension(domViewerExtension); - viewerCreationState->resetDomViewerExtension(domViewerExtension); viewerExtensionDependenciesState->resetDomViewerExtension(domViewerExtension); viewerExtensionSummaryState->setViewerExtension(domViewerExtension); + viewersCreationState->resetDomViewerExtension(domViewerExtension); + viewerCreationState->resetDomViewerExtension(domViewerExtension); } void ViewerExtensionCreationState::onExit(QEvent* event) { - /* if (! cancelled) { - cepcoreschema::Viewers someViewers; + if (! cancelled) { if (domCep->viewerExtensions().present()) { domCep->viewerExtensions().get().viewerExtension().push_back((*domViewerExtension)); } @@ -84,7 +83,7 @@ void ViewerExtensionCreationState::onExit(QEvent* event) { delete domViewerExtension; domViewerExtension = nullptr; } - }*/ + } } @@ -114,7 +113,7 @@ void ViewerExtensionCreationState::createSubStates(WizardMainWindow* mainWindow) viewerExtensionSummaryWidget = new ExtensionSummaryWidget(nullptr); viewerExtensionSummaryState = new ExtensionSummaryState("Viewer Extension Summary", viewerExtensionSummaryWidget, "Viewer", mainWindow, this); - viewerExtensionDescriptionState->addTransition(viewerExtensionDescriptionWidget, SIGNAL(next()), viewersCreationState); + viewerExtensionDescriptionState->addTransition(viewerExtensionDescriptionWidget, SIGNAL(next()), viewerCreationState); viewersCreationState->addTransition(viewersCreationWidget, SIGNAL(newViewer()), viewerCreationState); viewersCreationState->addTransition(viewersCreationWidget, SIGNAL(next()), viewerExtensionDependenciesState); viewersCreationState->addTransition(viewersCreationWidget, SIGNAL(previous()), viewerExtensionDescriptionState); diff --git a/sdk/applications/wizard/ViewerExtensionDependenciesState.cpp b/sdk/applications/wizard/ViewerExtensionDependenciesState.cpp index bd8dabc2..439e2075 100644 --- a/sdk/applications/wizard/ViewerExtensionDependenciesState.cpp +++ b/sdk/applications/wizard/ViewerExtensionDependenciesState.cpp @@ -70,12 +70,5 @@ void ViewerExtensionDependenciesState::onExit(QEvent* event) { } bool ViewerExtensionDependenciesState::isItkDependant(cepcoreschema::ViewerExtension* domExtension) { - /*const cepcoreschema::Viewer::viewer_sequence createdViewers = domExtension->viewers().action(); - int i = 0; - while ((i < createdViewers.size() && (!createdViewers.at(i).classification().itkFilter().present()))) { - i++; - } - - return i < createdViewers.size();*/ return false; } diff --git a/sdk/applications/wizard/ViewerExtensionDescriptionWidget.ui b/sdk/applications/wizard/ViewerExtensionDescriptionWidget.ui index a2e36000..5043b17a 100644 --- a/sdk/applications/wizard/ViewerExtensionDescriptionWidget.ui +++ b/sdk/applications/wizard/ViewerExtensionDescriptionWidget.ui @@ -63,7 +63,7 @@ - Viewer(s) + Viewer Qt::AlignCenter diff --git a/sdk/applications/wizard/ViewerSummaryState.cpp b/sdk/applications/wizard/ViewerSummaryState.cpp index 69d1c261..c3d0b8bb 100644 --- a/sdk/applications/wizard/ViewerSummaryState.cpp +++ b/sdk/applications/wizard/ViewerSummaryState.cpp @@ -31,12 +31,14 @@ // includes from coreschema #include +#include #include ViewerSummaryState::ViewerSummaryState(QString name, ViewerSummaryWidget* widget, WizardMainWindow* mainWindow, QState* parent) : WizardState(name, widget, mainWindow, parent) { + this->domViewerExtension = nullptr; this->domViewer = nullptr; } @@ -44,7 +46,6 @@ void ViewerSummaryState::resetViewer(cepcoreschema::Viewer* domViewer) { this->domViewer = domViewer; } - void ViewerSummaryState::onEntry(QEvent* event) { WizardState::onEntry(event); std::cout << "Viewer Summary State on Entry" << std::endl; @@ -55,32 +56,13 @@ void ViewerSummaryState::onEntry(QEvent* event) { std::cout << "domViewer non NULL" << std::endl; QString name = domViewer->name().c_str(); QString description = domViewer->description().c_str(); - //QString component = domViewer->component().c_str(); - - /* QStringList parameters; - if (domViewer->parameters().present()) { - cepcoreschema::Parameters::parameter_const_iterator it; - for (it = domViewer->parameters().get().parameter().begin(); it != domViewer->parameters().get().parameter().end(); it++) { - QString param = QString((*it).type().c_str()) + " " + (*it).name().c_str() + "(= " + (*it).defaultValue().get().c_str() + " )"; - parameters << param; - } - - } - QString family = domViewer->classification().family().c_str(); - QStringList tags; - cepcoreschema::Classification::tag_iterator it; - for (it = domViewer->classification().tag().begin(); it != domViewer->classification().tag().end(); it++) { - tags << (*it).c_str(); - }*/ - - //viewerSummaryWidget->setSummary(name, description, component, parameters, family, tags); + viewerSummaryWidget->setSummary(name, description); } } } - void ViewerSummaryState::onExit(QEvent* event) { WizardState::onExit(event); } diff --git a/sdk/applications/wizard/ViewerSummaryState.h b/sdk/applications/wizard/ViewerSummaryState.h index b6d6bed6..7116b524 100644 --- a/sdk/applications/wizard/ViewerSummaryState.h +++ b/sdk/applications/wizard/ViewerSummaryState.h @@ -33,6 +33,7 @@ class ViewerSummaryWidget; // Declaration here to avoid declaration in dependant projects. namespace cepcoreschema { class Viewer; +class ViewerExtension; } /** @@ -60,6 +61,7 @@ protected: void onExit(QEvent* event) override; cepcoreschema::Viewer* domViewer; + cepcoreschema::ViewerExtension* domViewerExtension; }; #endif diff --git a/sdk/applications/wizard/ViewerSummaryWidget.cpp b/sdk/applications/wizard/ViewerSummaryWidget.cpp index f6104d32..6a0c6bb7 100644 --- a/sdk/applications/wizard/ViewerSummaryWidget.cpp +++ b/sdk/applications/wizard/ViewerSummaryWidget.cpp @@ -48,29 +48,11 @@ void ViewerSummaryWidget::previousButtonClicked() { emit previous(); } - - -void ViewerSummaryWidget::setSummary(QString name, QString description, QString component, - QStringList parameters, QString family, QStringList tags) { +void ViewerSummaryWidget::setSummary(QString name, QString description) { QString text = defaultViewerSummary; text = text.replace(QRegExp("@NAME@"), name); text = text.replace(QRegExp("@DESCRIPTION@"), description); - text = text.replace(QRegExp("@COMPONENT@"), component); - text = text.replace(QRegExp("@FAMILY@"), family); - - QString parametersList = ""; - foreach (QString el, parameters) { - parametersList += "
  • " + el + "
  • \n"; - } - text = text.replace(QRegExp("@PARAMETERS_LIST@"), parametersList); - - QString tagsList = ""; - foreach (QString dep, tags) { - tagsList += "
  • " + dep + "
  • \n"; - } - text = text.replace(QRegExp("@TAGS_LIST@"), tagsList); - ui.viewerSummaryLabel->setText(text); } diff --git a/sdk/applications/wizard/ViewerSummaryWidget.h b/sdk/applications/wizard/ViewerSummaryWidget.h index fe5e4e34..a4b885df 100644 --- a/sdk/applications/wizard/ViewerSummaryWidget.h +++ b/sdk/applications/wizard/ViewerSummaryWidget.h @@ -51,8 +51,7 @@ public: ~ViewerSummaryWidget() override = default; void setToDefault(); - void setSummary(QString name, QString description, QString component, - QStringList parameters, QString family, QStringList tags); + void setSummary(QString name, QString description); public slots: virtual void nextButtonClicked(); diff --git a/sdk/applications/wizard/ViewerSummaryWidget.ui b/sdk/applications/wizard/ViewerSummaryWidget.ui index a35cea35..8cb9fc88 100644 --- a/sdk/applications/wizard/ViewerSummaryWidget.ui +++ b/sdk/applications/wizard/ViewerSummaryWidget.ui @@ -63,7 +63,7 @@
    - Viewer(s) + Viewer Qt::AlignCenter @@ -253,7 +253,7 @@ - 4 + 2 Qt::AlignCenter @@ -316,38 +316,6 @@
    - - - - - Sans Serif - 8 - - - - Parameter(s) - - - Qt::AlignCenter - - - - - - - - Sans Serif - 8 - - - - Classification - - - Qt::AlignCenter - - - @@ -425,52 +393,6 @@ - - - - - Sans Serif - 8 - - - - 2 - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - - - - - Sans Serif - 8 - - - - 3 - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - diff --git a/sdk/applications/wizard/ViewersCreationState.cpp b/sdk/applications/wizard/ViewersCreationState.cpp index de80f1e8..a03f5a2e 100644 --- a/sdk/applications/wizard/ViewersCreationState.cpp +++ b/sdk/applications/wizard/ViewersCreationState.cpp @@ -33,6 +33,7 @@ #include #include +#include ViewersCreationState::ViewersCreationState(QString name, ViewersCreationWidget* widget, WizardMainWindow* mainWindow, ViewerExtensionCreationState* parent) : WizardState(name, widget, mainWindow, parent) { @@ -50,21 +51,14 @@ void ViewersCreationState::resetDomViewerExtension(cepcoreschema::ViewerExtensio void ViewersCreationState::onEntry(QEvent* event) { WizardState::onEntry(event); - /*auto* viewersCreationWidget = dynamic_cast(widget); - if (viewersCreationWidget != nullptr) { - QString viewerExtensionName = domViewerExtension->name().c_str(); - viewersCreationWidget->setGroupBoxTitle(viewerExtensionName); - - viewersCreationWidget->emptyExistingActions(); - cepcoreschema::Viewer theViewers = domViewerExtension->viewer(); - cepcoreschema::Viewer::viewer_iterator it; - for (it = theViewers.viewer().begin(); it != theViewers.viewer().end(); it++) { - QString viewerName = (*it).name().c_str(); - viewersCreationWidget->addViewerName(viewerName); - } - }*/ + std::cout << domViewerExtension->name() << std::endl; + std::cout << domViewerExtension->description() << std::endl; + std::cout << domViewerExtension->viewer().name() << std::endl; + std::cout << domViewerExtension->viewer().description() << std::endl; } void ViewersCreationState::onExit(QEvent* event) { WizardState::onExit(event); } + + diff --git a/sdk/applications/wizard/ViewersCreationWidget.cpp b/sdk/applications/wizard/ViewersCreationWidget.cpp index 25d813a6..f26a1368 100644 --- a/sdk/applications/wizard/ViewersCreationWidget.cpp +++ b/sdk/applications/wizard/ViewersCreationWidget.cpp @@ -29,6 +29,7 @@ #include "DefaultGUIText.h" // Qt files +#include #include ViewersCreationWidget::ViewersCreationWidget(QWidget* parent) : QWidget(parent) { @@ -38,7 +39,7 @@ ViewersCreationWidget::ViewersCreationWidget(QWidget* parent) : QWidget(parent) void ViewersCreationWidget::setToDefault() { ui.requiredLabel->setStyleSheet(normalStyle); ui.label_Star->setStyleSheet(normalStyle); - emptyExistingActions(); + emptyExistingViewers(); } void ViewersCreationWidget::nextButtonClicked() { @@ -61,11 +62,13 @@ void ViewersCreationWidget::nextButtonClicked() { #endif } -void ViewersCreationWidget::addViewerClicked() { - ui.requiredLabel->setStyleSheet(normalStyle); - ui.label_Star->setStyleSheet(normalStyle); +void ViewersCreationWidget::registerDefaultViewerClicked() { + addViewerName("default"); +} - emit newViewer(); +void ViewersCreationWidget::registerNewViewerClicked() { + QString viewerName = QInputDialog::getText(this, "ViewerName", "Get a name to the New Viewer:"); + addViewerName(viewerName); } void ViewersCreationWidget::previousButtonClicked() { @@ -80,7 +83,7 @@ void ViewersCreationWidget::setGroupBoxTitle(QString text) { ui.viewersGroupBox->setTitle(text); } -void ViewersCreationWidget::emptyExistingActions() { +void ViewersCreationWidget::emptyExistingViewers() { createdViewers.clear(); createdViewersString = defaultCreatedViewersString; ui.createdViewersTextEdit->setHtml(createdViewersString); @@ -94,4 +97,4 @@ void ViewersCreationWidget::addViewerName(QString viewerName) { createdViewersString.insert(index, toBeInserted); ui.createdViewersTextEdit->setHtml(createdViewersString); -} +} \ No newline at end of file diff --git a/sdk/applications/wizard/ViewersCreationWidget.h b/sdk/applications/wizard/ViewersCreationWidget.h index b6fa7503..be173289 100644 --- a/sdk/applications/wizard/ViewersCreationWidget.h +++ b/sdk/applications/wizard/ViewersCreationWidget.h @@ -53,20 +53,21 @@ public: void setToDefault(); void setGroupBoxTitle(QString text); - void emptyExistingActions(); + void emptyExistingViewers(); void addViewerName(QString viewerName); public slots: - virtual void addViewerClicked(); + virtual void registerDefaultViewerClicked(); + virtual void registerNewViewerClicked(); virtual void nextButtonClicked(); - virtual void previousButtonClicked(); + virtual void previousButtonClicked(); virtual void cancelButtonClicked(); signals: void next(); void cancel(); void previous(); - void newViewer(); + void newDefaultViewer(); private: QStringList createdViewers; diff --git a/sdk/applications/wizard/ViewersCreationWidget.ui b/sdk/applications/wizard/ViewersCreationWidget.ui index 69ea5f97..dc0e1e8d 100644 --- a/sdk/applications/wizard/ViewersCreationWidget.ui +++ b/sdk/applications/wizard/ViewersCreationWidget.ui @@ -392,7 +392,7 @@ - + 0 @@ -401,7 +401,7 @@ - 512 + 550 32 @@ -412,7 +412,7 @@ - Add an Viewer + Register Default Viewer @@ -420,6 +420,36 @@ + + + + + 0 + 0 + + + + + 550 + 32 + + + + + 16777215 + 32 + + + + Register New Viewer + + + + :/resources/edit_add.png:/resources/edit_add.png + + + + @@ -600,10 +630,10 @@ - addViewerPushButton + registerDefaultViewerPushButton clicked() ViewersCreationWidget - addViewerClicked() + registerDefaultViewerClicked() 476 @@ -615,6 +645,22 @@ + + registerNewViewerPushButton + clicked() + ViewersCreationWidget + registerNewViewerClicked() + + + 476 + 399 + + + 454 + 254 + + + nextPushButton clicked() @@ -665,7 +711,8 @@ - addViewerClicked() + registerDefaultViewerClicked() + registerNewViewerClicked() nextButtonClicked() cancelButtonClicked() previousButtonClicked() diff --git a/sdk/cmake/modules/macros/camitk/CamiTKExtension.cmake b/sdk/cmake/modules/macros/camitk/CamiTKExtension.cmake index 1d6574b4..41ac1049 100644 --- a/sdk/cmake/modules/macros/camitk/CamiTKExtension.cmake +++ b/sdk/cmake/modules/macros/camitk/CamiTKExtension.cmake @@ -217,9 +217,9 @@ macro(camitk_extension) ######################################################################### # BASIC DIRECTORIES - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) - include_directories(${CAMITK_INCLUDE_DIRECTORIES}) + include_directories(${CAMITK_INCLUDE_DIRECTORIES}) # USER INPUT DIRECTORIES include_directories(${${EXTENSION_NAME_CMAKE}_INCLUDE_DIRECTORIES}) -- GitLab From b4d01fc7469be7b8cf53f5189a82c0353f72192e Mon Sep 17 00:00:00 2001 From: Maxime Calka Date: Wed, 11 Mar 2020 11:31:40 +0100 Subject: [PATCH 4/4] Close branch because too much problem --- .../wizard/ExtensionSummaryState.cpp | 1 + .../wizard/GeneratingCEPState.cpp | 2 + sdk/libraries/cepgenerator/CepGenerator.cpp | 42 +++++++++---------- sdk/libraries/cepgenerator/CepGenerator.h | 10 ++--- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/sdk/applications/wizard/ExtensionSummaryState.cpp b/sdk/applications/wizard/ExtensionSummaryState.cpp index 7ee36347..a6868829 100644 --- a/sdk/applications/wizard/ExtensionSummaryState.cpp +++ b/sdk/applications/wizard/ExtensionSummaryState.cpp @@ -46,6 +46,7 @@ ExtensionSummaryState::ExtensionSummaryState(QString name, ExtensionSummaryWidge this->type = type; this->domActionExtension = nullptr; this->domComponentExtension = nullptr; + this->domViewerExtension = nullptr; } void ExtensionSummaryState::setActionExtension(cepcoreschema::ActionExtension* domActionExtension) { diff --git a/sdk/applications/wizard/GeneratingCEPState.cpp b/sdk/applications/wizard/GeneratingCEPState.cpp index 53578b2a..741596b8 100644 --- a/sdk/applications/wizard/GeneratingCEPState.cpp +++ b/sdk/applications/wizard/GeneratingCEPState.cpp @@ -59,6 +59,8 @@ void GeneratingCEPState::onEntry(QEvent* event) { QString cepName = domCep->name().c_str(); std::cout << "cepName: " << cepName.toStdString() << std::endl; + std::cout << domCep->copyright().present() << std::endl; + cepcoreschema::Cep aCep(*domCep); std::unique_ptr domCepPtr(domCep); diff --git a/sdk/libraries/cepgenerator/CepGenerator.cpp b/sdk/libraries/cepgenerator/CepGenerator.cpp index 4c0a3f04..0738fe94 100644 --- a/sdk/libraries/cepgenerator/CepGenerator.cpp +++ b/sdk/libraries/cepgenerator/CepGenerator.cpp @@ -451,6 +451,26 @@ void CepGenerator::createComponentExtensionDoms() { } } +void CepGenerator::createViewerExtensionDoms() { + std::cout << "creating viewer extension doms..." << std::endl; + QString cmakelistFileName; + QDir currentDirectory; + currentDirectory.cd(devDirectoryName.absolutePath()); + currentDirectory.cd(cepDirectoryName); + currentDirectory.cd(cepViewersDirectoryName); + + if (domCep->viewerExtensions().present()) { + ViewerExtensions extensions = domCep->viewerExtensions().get(); + for (auto i = extensions.viewerExtension().begin(); i != extensions.viewerExtension().end(); i++) { + // TODO: find a way to use std:auto_ptr here for the dom extension instead of creating a new instance + // Is it only possible ? http://stackoverflow.com/questions/12674735/function-wont-accept-iterator-to-auto-ptr + ViewerExtension& extension = (*i); + ViewerExtensionGenerator* generator = new ViewerExtensionGenerator(extension, currentDirectory.absolutePath(), licence); + this->extensions.append(generator); + } + } +} + void CepGenerator::createLibrarieDoms() { std::cout << "creating library doms..." << std::endl; QDir currentDirectory; @@ -471,26 +491,6 @@ void CepGenerator::createLibrarieDoms() { } -void CepGenerator::createViewersExtensionDoms() { - std::cout << "creating viewer extension doms..." << std::endl; - QString cmakelistFileName; - QDir currentDirectory; - currentDirectory.cd(devDirectoryName.absolutePath()); - currentDirectory.cd(cepDirectoryName); - currentDirectory.cd(cepViewersDirectoryName); - - if (domCep->viewerExtensions().present()) { - ViewerExtensions extensions = domCep->viewerExtensions().get(); - for (auto i = extensions.viewerExtension().begin(); i != extensions.viewerExtension().end(); i++) { - // TODO: find a way to use std:auto_ptr here for the dom extension instead of creating a new instance - // Is it only possible ? http://stackoverflow.com/questions/12674735/function-wont-accept-iterator-to-auto-ptr - ViewerExtension& extension = (*i); - ViewerExtensionGenerator* generator = new ViewerExtensionGenerator(extension, currentDirectory.absolutePath(), licence); - this->extensions.append(generator); - } - } -} - void CepGenerator::generateExtensions() { std::cout << "inside generateExtension" << std::endl; @@ -507,6 +507,6 @@ void CepGenerator::process() { createComponentExtensionDoms(); createActionExtensionDoms(); createLibrarieDoms(); - createViewersExtensionDoms(); + createViewerExtensionDoms(); generateExtensions(); } diff --git a/sdk/libraries/cepgenerator/CepGenerator.h b/sdk/libraries/cepgenerator/CepGenerator.h index 9a843d8d..b43b9eef 100644 --- a/sdk/libraries/cepgenerator/CepGenerator.h +++ b/sdk/libraries/cepgenerator/CepGenerator.h @@ -177,15 +177,15 @@ protected: */ virtual void createComponentExtensionDoms(); + /** + Create the ViewersDom if needed and call the appropriate methods to generate the viewer extensions. + */ + virtual void createViewerExtensionDoms(); + /** Create the LibrariesDom if needed and call the appropriate methods to generate the libraries. */ virtual void createLibrarieDoms(); - - /** - Create the ViewersDom if needed and call the appropriate methods to generate the viewer extensions. - */ - virtual void createViewersExtensionDoms(); virtual void generateExtensions(); -- GitLab