diff --git a/HDPS/src/Project.cpp b/HDPS/src/Project.cpp index 707eea905..4a8116696 100644 --- a/HDPS/src/Project.cpp +++ b/HDPS/src/Project.cpp @@ -5,6 +5,7 @@ #include "Project.h" #include "AbstractProjectManager.h" #include "CoreInterface.h" +#include "Set.h" #include "util/Serialization.h" @@ -28,13 +29,7 @@ Project::Project(QObject* parent /*= nullptr*/) : } Project::Project(const QString& filePath, QObject* parent /*= nullptr*/) : - QObject(parent), - Serializable("Project"), - _filePath(), - _startupProject(), - _applicationVersion(Application::current()->getVersion()), - _projectMetaAction(this), - _task(this, "Project Task") + Project(parent) { setFilePath(filePath); initialize(); @@ -160,19 +155,48 @@ void Project::updateContributors() void Project::setStudioMode(bool studioMode) { +<<<<<<< HEAD auto plugins = hdps::plugins().getPluginsByTypes({ plugin::Type::VIEW, plugin::Type::ANALYSIS }); +======= + auto plugins = hdps::plugins().getPluginsByTypes(); // by default gets all plugin types + auto& datasets = hdps::data().allSets(); +>>>>>>> origin/master if (studioMode) { for (auto plugin : plugins) plugin->cacheConnectionPermissions(true); +<<<<<<< HEAD for (auto plugin : plugins) plugin->setConnectionPermissionsToAll(true); +======= + + for (auto plugin : plugins) + plugin->setConnectionPermissionsToAll(true); + + for (auto& dataset : datasets) + { + for (auto& action : dataset.get()->getActions()) + action->cacheConnectionPermissions(true); + + for (auto& action : dataset.get()->getActions()) + action->setConnectionPermissionsToAll(true); + } + +>>>>>>> origin/master } else { for (auto plugin : plugins) plugin->restoreConnectionPermissions(true); +<<<<<<< HEAD +======= + + for (auto& dataset : datasets) + for (auto& action : dataset.get()->getActions()) + action->restoreConnectionPermissions(true); +>>>>>>> origin/master } + } ProjectMetaAction& Project::getProjectMetaAction() diff --git a/HDPS/src/actions/ColorPickerAction.cpp b/HDPS/src/actions/ColorPickerAction.cpp index 96f0a1707..0c22f871a 100644 --- a/HDPS/src/actions/ColorPickerAction.cpp +++ b/HDPS/src/actions/ColorPickerAction.cpp @@ -100,6 +100,11 @@ ColorPickerAction::Widget::Widget(QWidget* parent, ColorPickerAction* colorPicke auto colorPickerWidget = getWidgetFromColorDialog("QColorPicker"); auto colorLuminanceWidget = getWidgetFromColorDialog("QColorLuminancePicker"); + if(colorPickerWidget == nullptr) + colorPickerWidget = getWidgetFromColorDialog("QtPrivate::QColorPicker"); + if(colorLuminanceWidget == nullptr) + colorLuminanceWidget = getWidgetFromColorDialog("QtPrivate::QColorLuminancePicker"); + colorPickerWidget->setFixedSize(250, 150); auto pickersLayout = new QHBoxLayout(); diff --git a/HDPS/src/actions/NumericalRangeAction.h b/HDPS/src/actions/NumericalRangeAction.h index 9384f3e22..90623c22d 100644 --- a/HDPS/src/actions/NumericalRangeAction.h +++ b/HDPS/src/actions/NumericalRangeAction.h @@ -25,6 +25,7 @@ class NumericalRangeAction : public GroupAction using RangeChangedCB = std::function; public: + using ValueType = NumericalType; /** Describes the widget settings */ enum WidgetFlag { @@ -126,11 +127,8 @@ class NumericalRangeAction : public GroupAction if (range == getRange()) return; - QSignalBlocker rangeMinActionBlocker(&_rangeMinAction); - QSignalBlocker rangeMaxActionBlocker(&_rangeMaxAction); - - _rangeMinAction.initialize(range.getMinimum(), range.getMaximum(), range.getMinimum(), range.getMinimum()); - _rangeMaxAction.initialize(range.getMinimum(), range.getMaximum(), range.getMaximum(), range.getMaximum()); + _rangeMinAction.setValue(range.getMinimum()); + _rangeMaxAction.setValue(range.getMaximum()); _rangeChanged(); } @@ -152,6 +150,7 @@ class NumericalRangeAction : public GroupAction return; _rangeMinAction.setMinimum(limitsMinimum); + _rangeMaxAction.setMinimum(limitsMinimum); _limitsChanged(); } @@ -169,9 +168,10 @@ class NumericalRangeAction : public GroupAction * @param limitsMaximum Limits maximum */ void setLimitsMaximum(NumericalType limitsMaximum) { - if (limitsMaximum == _rangeMaxAction.getMinimum()) + if (limitsMaximum == _rangeMaxAction.getMaximum()) return; + _rangeMinAction.setMaximum(limitsMaximum); _rangeMaxAction.setMaximum(limitsMaximum); _limitsChanged(); @@ -191,6 +191,9 @@ class NumericalRangeAction : public GroupAction return; _rangeMinAction.setMinimum(limits.getMinimum()); + _rangeMaxAction.setMinimum(limits.getMinimum()); + + _rangeMinAction.setMaximum(limits.getMaximum()); _rangeMaxAction.setMaximum(limits.getMaximum()); _limitsChanged(); diff --git a/HDPS/src/actions/RectangleAction.h b/HDPS/src/actions/RectangleAction.h index 4a66a2e4d..509af4ddd 100644 --- a/HDPS/src/actions/RectangleAction.h +++ b/HDPS/src/actions/RectangleAction.h @@ -22,6 +22,8 @@ namespace hdps::gui { template class RectangleAction : public GroupAction { + typedef typename NumericalRangeActionType::ValueType NumValType; + using ValueRange = util::NumericalRange; public: /** Templated classes with Q_OBJECT macro are not allowed, so use function pointers in stead */ @@ -98,7 +100,8 @@ class RectangleAction : public GroupAction */ RectangleAction(QObject * parent, const QString& title, const RectangleType& rectangle = RectangleType()) : GroupAction(parent, title), - _rangeAction{ NumericalRangeActionType(this, "X-range"), NumericalRangeActionType(this, "Y-range") } + _rangeAction{ NumericalRangeActionType(this, "X-range", ValueRange(std::numeric_limits::lowest(), std::numeric_limits::max())), NumericalRangeActionType(this, "Y-range", ValueRange(std::numeric_limits::lowest(), std::numeric_limits::max())) }, + _rectangle() { setDefaultWidgetFlags(WidgetFlag::Default); @@ -118,9 +121,7 @@ class RectangleAction : public GroupAction */ RectangleType getRectangle() const { - RectangleType rectangle; - - return rectangle; + return _rectangle; } /** @@ -129,14 +130,75 @@ class RectangleAction : public GroupAction */ void setRectangle(const RectangleType& rectangle) { - /* if (rectangle == _rectangle) return; _rectangle = rectangle; + getRangeAction(Axis::X).setRange(ValueRange(static_cast(_rectangle.left()), static_cast(_rectangle.right()))); + getRangeAction(Axis::Y).setRange(ValueRange(static_cast(_rectangle.bottom()), static_cast(_rectangle.top()))); + + _rectangleChanged(); + } + + /** + * Set left rectangle value to to \p left + * @param left New left rectangle value + */ + void setValueLeft(typename NumericalRangeActionType::ValueType left) + { + if (left == _rectangle.left()) + return; + + _rectangle.setLeft(left); + getRangeAction(Axis::X).setMinimum(left); + + _rectangleChanged(); + } + + /** + * Set right rectangle value to to \p right + * @param right New right rectangle value + */ + void setValueRight(typename NumericalRangeActionType::ValueType right) + { + if (right == _rectangle.right()) + return; + + _rectangle.setRight(right); + getRangeAction(Axis::X).setMaximum(right); + + _rectangleChanged(); + } + + /** + * Set bottom rectangle value to to \p bottom + * @param bottom New bottom rectangle value + */ + void setValueBottom(typename NumericalRangeActionType::ValueType bottom) + { + if (bottom == _rectangle.bottom()) + return; + + _rectangle.setBottom(bottom); + getRangeAction(Axis::Y).setMinimum(bottom); + + _rectangleChanged(); + } + + /** + * Set top rectangle value to to \p top + * @param top New top rectangle value + */ + void setValueTop(typename NumericalRangeActionType::ValueType top) + { + if (top == _rectangle.top()) + return; + + _rectangle.setTop(top); + getRangeAction(Axis::Y).setMaximum(top); + _rectangleChanged(); - */ } public: // Action getters @@ -150,6 +212,7 @@ class RectangleAction : public GroupAction protected: RectangleChangedCB _rectangleChanged; /** Callback which is called when the rectangle changed */ + RectangleType _rectangle; /** Rectanlge values (left, right, top, bottom) */ }; } diff --git a/HDPS/src/plugins/ClusterData/src/InfoAction.h b/HDPS/src/plugins/ClusterData/src/InfoAction.h index 73782d2f6..c5d1ae794 100644 --- a/HDPS/src/plugins/ClusterData/src/InfoAction.h +++ b/HDPS/src/plugins/ClusterData/src/InfoAction.h @@ -8,7 +8,7 @@ #include "ClusterData.h" #include "ClustersAction.h" -#include "actions/Actions.h" +#include "actions/StringAction.h" #include "event/EventListener.h" namespace hdps { diff --git a/HDPS/src/plugins/ClusterData/src/SubsetAction.h b/HDPS/src/plugins/ClusterData/src/SubsetAction.h index 0a7275dc3..d109e58ed 100644 --- a/HDPS/src/plugins/ClusterData/src/SubsetAction.h +++ b/HDPS/src/plugins/ClusterData/src/SubsetAction.h @@ -4,7 +4,8 @@ #pragma once -#include "actions/Actions.h" +#include "actions/StringAction.h" +#include "actions/TriggerAction.h" using namespace hdps; using namespace hdps::gui; diff --git a/HDPS/src/plugins/DataHierarchyPlugin/src/DataHierarchyWidget.cpp b/HDPS/src/plugins/DataHierarchyPlugin/src/DataHierarchyWidget.cpp index 04012df77..ed615eb66 100644 --- a/HDPS/src/plugins/DataHierarchyPlugin/src/DataHierarchyWidget.cpp +++ b/HDPS/src/plugins/DataHierarchyPlugin/src/DataHierarchyWidget.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -138,16 +139,20 @@ DataHierarchyWidget::DataHierarchyWidget(QWidget* parent) : }); connect(&_hierarchyWidget.getTreeView(), &QTreeView::customContextMenuRequested, this, [this](const QPoint& position) { - const auto selectedRows = _hierarchyWidget.getSelectedRows(); - Datasets datasets; + auto createContextMenu = [this, position]() -> void { + Datasets datasets; - for (const auto& selectedRow : selectedRows) - datasets << _model.getItem(selectedRow, Qt::DisplayRole)->getDataHierarchyItem()->getDataset(); + for (const auto& selectedRow : _hierarchyWidget.getSelectedRows()) + datasets << _model.getItem(selectedRow, Qt::DisplayRole)->getDataHierarchyItem()->getDataset(); - auto datasetsContextMenu = new DataHierarchyWidgetContextMenu(this, datasets); + QScopedPointer datasetsContextMenu(new DataHierarchyWidgetContextMenu(this, datasets)); + datasetsContextMenu->exec(_hierarchyWidget.getTreeView().viewport()->mapToGlobal(position)); - datasetsContextMenu->exec(_hierarchyWidget.getTreeView().viewport()->mapToGlobal(position)); + }; + + // Get around possible signal-execution order complications + QTimer::singleShot(10, createContextMenu); }); for (const auto topLevelItem : Application::core()->getDataHierarchyManager().getTopLevelItems()) diff --git a/HDPS/src/plugins/DataPropertiesPlugin/src/DataPropertiesPlugin.cpp b/HDPS/src/plugins/DataPropertiesPlugin/src/DataPropertiesPlugin.cpp index 56bf54927..e1a9dcbe3 100644 --- a/HDPS/src/plugins/DataPropertiesPlugin/src/DataPropertiesPlugin.cpp +++ b/HDPS/src/plugins/DataPropertiesPlugin/src/DataPropertiesPlugin.cpp @@ -7,6 +7,8 @@ #include #include #include +#include +#include Q_PLUGIN_METADATA(IID "nl.BioVault.DataPropertiesPlugin") @@ -14,8 +16,47 @@ using namespace hdps; DataPropertiesPlugin::DataPropertiesPlugin(const PluginFactory* factory) : ViewPlugin(factory), - _dataPropertiesWidget(nullptr) + _dataPropertiesWidget(nullptr), + _additionalEditorAction(this, "Edit dataset parameters..."), + _dataset(nullptr) { + _additionalEditorAction.setIcon(Application::getIconFont("FontAwesome").getIcon("cogs")); + _additionalEditorAction.setShortcut(tr("F11")); + _additionalEditorAction.setShortcutContext(Qt::WidgetWithChildrenShortcut); + _additionalEditorAction.setConfigurationFlag(WidgetAction::ConfigurationFlag::VisibleInMenu); + _additionalEditorAction.setConnectionPermissionsToForceNone(); + _additionalEditorAction.setEnabled(false); + + addTitleBarMenuAction(&_additionalEditorAction); + + connect(&Application::core()->getDataHierarchyManager(), &AbstractDataHierarchyManager::selectedItemsChanged, this, &DataPropertiesPlugin::selectedItemsChanged, Qt::DirectConnection); + + connect(&_additionalEditorAction, &TriggerAction::triggered, this, [this]() -> void { + + if (!_dataset.isValid()) + return; + + auto* viewPluginEditorDialog = new hdps::gui::ViewPluginEditorDialog(nullptr, dynamic_cast(_dataset.get())); + connect(viewPluginEditorDialog, &hdps::gui::ViewPluginEditorDialog::finished, viewPluginEditorDialog, &hdps::gui::ViewPluginEditorDialog::deleteLater); + viewPluginEditorDialog->open(); + }); + +} + +void DataPropertiesPlugin::selectedItemsChanged(DataHierarchyItems selectedItems) +{ + if (projects().isOpeningProject() || projects().isImportingProject()) + return; + + if (selectedItems.isEmpty()) { + _dataset = nullptr; + _additionalEditorAction.setEnabled(false); + return; + } + + // Save reference to currently selected dataset + _dataset = selectedItems.first()->getDataset(); + _additionalEditorAction.setEnabled(true); } void DataPropertiesPlugin::init() diff --git a/HDPS/src/plugins/DataPropertiesPlugin/src/DataPropertiesPlugin.h b/HDPS/src/plugins/DataPropertiesPlugin/src/DataPropertiesPlugin.h index f7af26caa..e01b18e2d 100644 --- a/HDPS/src/plugins/DataPropertiesPlugin/src/DataPropertiesPlugin.h +++ b/HDPS/src/plugins/DataPropertiesPlugin/src/DataPropertiesPlugin.h @@ -7,6 +7,7 @@ #include "DataPropertiesWidget.h" #include +#include using namespace hdps::plugin; @@ -26,8 +27,18 @@ class DataPropertiesPlugin : public ViewPlugin void init() override; +protected: + + /** + * Callback when is called when the selected items in the data hierarchy changes + * @param datasetId Globally unique identifier of the dataset + */ + void selectedItemsChanged(DataHierarchyItems selectedItems); + private: DataPropertiesWidget _dataPropertiesWidget; /** Data properties widget */ + gui::TriggerAction _additionalEditorAction; /** Trigger action to start the data set editor */ + Dataset _dataset; /** Smart pointer to currently selected dataset */ }; class DataPropertiesPluginFactory : public ViewPluginFactory diff --git a/HDPS/src/plugins/ImageData/src/InfoAction.h b/HDPS/src/plugins/ImageData/src/InfoAction.h index 3fb96525f..cea96ce7e 100644 --- a/HDPS/src/plugins/ImageData/src/InfoAction.h +++ b/HDPS/src/plugins/ImageData/src/InfoAction.h @@ -4,7 +4,7 @@ #pragma once -#include "actions/Actions.h" +#include "actions/StringAction.h" #include "event/EventListener.h" #include "Images.h" diff --git a/HDPS/src/plugins/PointData/src/DimensionsPickerAction.cpp b/HDPS/src/plugins/PointData/src/DimensionsPickerAction.cpp index 0dcf2c2d0..43466df5a 100644 --- a/HDPS/src/plugins/PointData/src/DimensionsPickerAction.cpp +++ b/HDPS/src/plugins/PointData/src/DimensionsPickerAction.cpp @@ -3,7 +3,6 @@ // Copyright (C) 2023 BioVault (Biomedical Visual Analytics Unit LUMC - TU Delft) #include "DimensionsPickerAction.h" -#include "PointData.h" #include "Application.h" diff --git a/HDPS/src/plugins/PointData/src/DimensionsPickerAction.h b/HDPS/src/plugins/PointData/src/DimensionsPickerAction.h index 85cadd41b..1373be4c6 100644 --- a/HDPS/src/plugins/PointData/src/DimensionsPickerAction.h +++ b/HDPS/src/plugins/PointData/src/DimensionsPickerAction.h @@ -6,6 +6,8 @@ #include "pointdata_export.h" +#include "PointData.h" + #include "DimensionsPickerHolder.h" #include "DimensionsPickerItemModel.h" #include "DimensionsPickerProxyModel.h" @@ -16,7 +18,7 @@ #include "ModelResetter.h" -#include "actions/Actions.h" +#include "actions/StringAction.h" #include @@ -24,7 +26,6 @@ using namespace hdps; using namespace hdps::gui; class QMenu; -class Points; /** * Dimensions picker action class diff --git a/HDPS/src/plugins/PointData/src/DimensionsPickerFilterAction.cpp b/HDPS/src/plugins/PointData/src/DimensionsPickerFilterAction.cpp index c685121ca..49b086a8f 100644 --- a/HDPS/src/plugins/PointData/src/DimensionsPickerFilterAction.cpp +++ b/HDPS/src/plugins/PointData/src/DimensionsPickerFilterAction.cpp @@ -7,6 +7,8 @@ #include +#include + namespace hdps::gui { DimensionsPickerFilterAction::DimensionsPickerFilterAction(DimensionsPickerAction& dimensionsPickerAction) : diff --git a/HDPS/src/plugins/PointData/src/DimensionsPickerMiscellaneousAction.cpp b/HDPS/src/plugins/PointData/src/DimensionsPickerMiscellaneousAction.cpp index 4bbfaf216..7b9c208d1 100644 --- a/HDPS/src/plugins/PointData/src/DimensionsPickerMiscellaneousAction.cpp +++ b/HDPS/src/plugins/PointData/src/DimensionsPickerMiscellaneousAction.cpp @@ -7,6 +7,8 @@ #include +#include + namespace hdps::gui { DimensionsPickerMiscellaneousAction::DimensionsPickerMiscellaneousAction(DimensionsPickerAction& dimensionsPickerAction) : diff --git a/HDPS/src/plugins/PointData/src/DimensionsPickerSelectAction.cpp b/HDPS/src/plugins/PointData/src/DimensionsPickerSelectAction.cpp index 5ca7e43cc..ad54b0af3 100644 --- a/HDPS/src/plugins/PointData/src/DimensionsPickerSelectAction.cpp +++ b/HDPS/src/plugins/PointData/src/DimensionsPickerSelectAction.cpp @@ -9,6 +9,7 @@ #include #include +#include namespace hdps::gui { diff --git a/HDPS/src/plugins/PointData/src/SelectedIndicesAction.h b/HDPS/src/plugins/PointData/src/SelectedIndicesAction.h index 879c769a2..44aa16e06 100644 --- a/HDPS/src/plugins/PointData/src/SelectedIndicesAction.h +++ b/HDPS/src/plugins/PointData/src/SelectedIndicesAction.h @@ -4,8 +4,6 @@ #pragma once -#include "actions/Actions.h" - #include "PointData.h" #include diff --git a/HDPS/src/private/DataHierarchyManager.cpp b/HDPS/src/private/DataHierarchyManager.cpp index f648270ee..dad82659c 100644 --- a/HDPS/src/private/DataHierarchyManager.cpp +++ b/HDPS/src/private/DataHierarchyManager.cpp @@ -225,11 +225,11 @@ void DataHierarchyManager::fromVariantMap(const QVariantMap& variantMap) sortedItems.resize(variantMap.count()); // Sort the items - for (auto variant : variantMap.values()) + for (const auto& variant : variantMap.values()) sortedItems[variant.toMap()["SortIndex"].toInt()] = variant.toMap(); // Add items in intended order - for (auto item : sortedItems) + for (const auto& item : sortedItems) loadDataHierarchyItem(item["Children"].toMap(), loadDataset(item, item["Name"].toString(), parent)); }; diff --git a/HDPS/src/private/ProjectManager.cpp b/HDPS/src/private/ProjectManager.cpp index 1ee32ad97..a6e3d2ebf 100644 --- a/HDPS/src/private/ProjectManager.cpp +++ b/HDPS/src/private/ProjectManager.cpp @@ -164,7 +164,7 @@ ProjectManager::ProjectManager(QObject* parent /*= nullptr*/) : saveProjectAs(); }); - connect(&_editProjectSettingsAction, &TriggerAction::triggered, this, [this]() -> void { + connect(&_editProjectSettingsAction, &TriggerAction::triggered, this, [this](bool checked) -> void { auto* dialog = new ProjectSettingsDialog(); connect(dialog, &ProjectSettingsDialog::finished, dialog, &ProjectSettingsDialog::deleteLater); dialog->open(); @@ -173,13 +173,13 @@ ProjectManager::ProjectManager(QObject* parent /*= nullptr*/) : connect(&_importDataMenu, &QMenu::aboutToShow, this, [this]() -> void { _importDataMenu.clear(); - for (auto pluginTriggerAction : plugins().getPluginTriggerActions(plugin::Type::LOADER)) + for (auto& pluginTriggerAction : plugins().getPluginTriggerActions(plugin::Type::LOADER)) _importDataMenu.addAction(pluginTriggerAction); _importDataMenu.setEnabled(!_importDataMenu.actions().isEmpty()); }); - connect(&_pluginManagerAction, &TriggerAction::triggered, this, [this]() -> void { + connect(&_pluginManagerAction, &TriggerAction::triggered, this, [this](bool checked) -> void { PluginManagerDialog::create(); }); diff --git a/HDPS/src/widgets/HierarchyWidget.cpp b/HDPS/src/widgets/HierarchyWidget.cpp index af7f4edc5..8a6de2924 100644 --- a/HDPS/src/widgets/HierarchyWidget.cpp +++ b/HDPS/src/widgets/HierarchyWidget.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #ifdef _DEBUG diff --git a/HDPS/src/widgets/HierarchyWidget.h b/HDPS/src/widgets/HierarchyWidget.h index 2163f01b7..6f5c6be7a 100644 --- a/HDPS/src/widgets/HierarchyWidget.h +++ b/HDPS/src/widgets/HierarchyWidget.h @@ -154,7 +154,8 @@ class HierarchyWidget : public QWidget * Set input model to \p model * @param model Input model */ - void setModel(const QAbstractItemModel& model); + // TODO: to be implemented + // void setModel(const QAbstractItemModel& model); /** * Get input filter model diff --git a/HDPS/src/widgets/ViewPluginEditorDialog.cpp b/HDPS/src/widgets/ViewPluginEditorDialog.cpp index 9bacf4b3d..9570c3a32 100644 --- a/HDPS/src/widgets/ViewPluginEditorDialog.cpp +++ b/HDPS/src/widgets/ViewPluginEditorDialog.cpp @@ -24,13 +24,7 @@ ViewPluginEditorDialog::ViewPluginEditorDialog(QWidget* parent, ViewPlugin* view _actionsWidget(this, _actionsHierarchyModel), _settingsAction(this, "Settings") { - setWindowIcon(Application::getIconFont("FontAwesome").getIcon("cog")); setWindowTitle(QString("Edit (%1) settings").arg(viewPlugin->text())); - setMinimumSize(QSize(640, 480)); - - auto layout = new QVBoxLayout(); - - layout->addWidget(&_actionsWidget); _settingsAction.setLabelSizingType(GroupAction::LabelSizingType::Auto); @@ -38,6 +32,34 @@ ViewPluginEditorDialog::ViewPluginEditorDialog(QWidget* parent, ViewPlugin* view _settingsAction.addAction(&viewPlugin->getDockingOptionsAction()); _settingsAction.addAction(&viewPlugin->getGuiNameAction()); + init(); +} + +ViewPluginEditorDialog::ViewPluginEditorDialog(QWidget* parent, WidgetAction* rootAction) : + QDialog(parent), + _groupsAction(this, "Groups"), + _actionsListModel(this, rootAction), + _actionsHierarchyModel(this, rootAction), + _actionsWidget(this, _actionsHierarchyModel), + _settingsAction(this, "Settings") +{ + setWindowTitle(QString("Edit plugin settings")); + + init(); +} + + +void ViewPluginEditorDialog::init() +{ + setWindowIcon(Application::getIconFont("FontAwesome").getIcon("cog")); + setMinimumSize(QSize(640, 480)); + + auto layout = new QVBoxLayout(); + + layout->addWidget(&_actionsWidget); + + _settingsAction.setLabelSizingType(GroupAction::LabelSizingType::Auto); + layout->addWidget(_settingsAction.createWidget(this)); setLayout(layout); diff --git a/HDPS/src/widgets/ViewPluginEditorDialog.h b/HDPS/src/widgets/ViewPluginEditorDialog.h index ba5eddbf0..84a88bf61 100644 --- a/HDPS/src/widgets/ViewPluginEditorDialog.h +++ b/HDPS/src/widgets/ViewPluginEditorDialog.h @@ -34,12 +34,19 @@ class ViewPluginEditorDialog : public QDialog public: /** - * Constructor + * Constructor for plugin-attached actions * @param parent Pointer to parent widget * @param viewPlugin Pointer to view plugin to edit */ ViewPluginEditorDialog(QWidget* parent, hdps::plugin::ViewPlugin* viewPlugin); + /** + * Constructor for dataset-attached actions + * @param parent Pointer to parent widget + * @param rootAction Pointer to parent action of all actions to be displayed + */ + ViewPluginEditorDialog(QWidget* parent, hdps::gui::WidgetAction* rootAction); + /** Get preferred size */ QSize sizeHint() const override { return QSize(800, 600); @@ -50,6 +57,10 @@ class ViewPluginEditorDialog : public QDialog return sizeHint(); } +private: + /** Setup function common to all constructor */ + void init(); + private: GroupsAction _groupsAction; /** Groups action */ ActionsListModel _actionsListModel; /** List actions model of the view plugin action and its descendants */