Skip to content

Commit

Permalink
Improve sample context exploration (#679)
Browse files Browse the repository at this point in the history
* Add sample context view plugin

* Add feature to add a view plugin floated

* Add plugins list model

* Work on plugin picker action and refactor of plugins models

* Work on plugin picker action

* Work on plugin picker action

* Further work on the plugin picker action

* Add plugins list and tree model to the plugins manager

* Switch to dynamically allocated list and tree model

* Implements plugin type filtering in the plugin picker action

* Plugin removal is now also correctly handled by the plugin picker action

* Change icon to mouse pointer in case of no option action selection

* Display sample context text in sample context plugin

* Various improvements in opening sample context window

* Add OpenGLWidget abstract convenience baseclass (#684)

* Add abstract OpenGLWidget baseclass

The baseclass contains logic for initializing a QOpenGLWidget,
initializing the surface format and keeping track of the correct pixel ratio.

* Add OpenGLWidgets to MV_Public dependencies

* Export OpenGLWidget class with core

* (View) plugin learning center (#671)

* Add skeleton code for shortcut map overlay widget

* Add shortcut map class skeleton code

* Add shortcut map class to base plugin class

* Add getter to get the shortcut map from the plugin

* Add routine to create a shortcut map overlay from the shortcut map class

* Add view plugin learning center overlay widget skeleton code

* Add learning center overlay widget to the view plugin

* Add learning center overlay widget to view plugin and add popup widget skeleton code

* Add alignment to view plugin learning center

* Learning center overlay widget alignment is working

* Allow target widget to change after the widget overlayer has been constructed

* Add view plugin getter to get a reference to the learning center overlay and some refactoring

* Work on shortcut map class signals and add const shortcut map getter in base plugin class

* Work on view plugin learning center popup widget

* Work on shorcut mapping and view plugin learning center

Add methods for querying shortcuts
Add method in widget overlayer utility to query the target widget
Add widget fader to the view plugin learning center

* Add methods to add and remove shortcuts from the shortcut map

* Refactor

Moved shortcut map to the plugin factory
Add some facade methods to access the shortcut maps from the plugin
Test with data hierarchy plugin
Add some actions to view plugin learning center overlay

* Fade in/out shortcut map overlay widget on show/hide

* Add shortcut map overlay widget to view plugin

* Add HTML label to shortcut map overlay widget

* Add shortcut map title change management

* Add title getter to shortcut map

* Work on view plugin learning center

Only create the shortcut map overlay widget when needed
Add some utility functions to the widget overlayer
Work on the view plugin

* Move icon label class to core and work on widget overlayer

* In the process of fixing focus issues

* Re-instating the shortcut map overlay widget

* Add some padding

* Work on overlay widget

* Work on overlay issues

* End of day commit (still issues with event handling)

* Fixed the combined mouse event handling with overlay widgets with masking

* Tidied up the overlay widget class

* Tidied up the widget overlayer utility class

* Improved overlay widget documentation and removed code comment

* Move the business logic for mask creation from the resize event to its own method

* Remove code comment and tiny refactor

* Add signal for target widget changed
Add toolbar item widget for view plugin learning center overlay popup widget

* Fixed various issues

* Remove redundant comments and some styling improvement

* Make shortcuts display scrollable

* Fix shortcut title indentation

* Adding toolbar items and some work on shortcut cheat sheet

* Small cosmetic change

* Allow users to go back to the project from the start and learning page (if there is an active project)

* Small cosmetic changes

* Transfer shortcuts from data hierachy plugin to scatterplot plugin (where they were intended)

* Add close toolbar widget

* Add short and long description members to plugin base class and getters/setters

* Visit Github repository will now first try to load the markdown URL if it is valid

* Remove readme toolbar item widget and fix compile warning

* Work on toolbar item widget

* Move plugin description getters and setters to plugin factory

* Refactor

* Add video tags string list model to the plugin base class

* Refactor

* Tooltip changes

* Relocate the videos model and filter model to the help manager (for global access to video content)

* Add video utility class

* View plugin videos are working nicely now

* End of day commit some cosmetic changes and small bug fix

* Move short-related member function outside of the plugin class and move them to a dedicated plugin shortcuts class
The same for the plugin learning center related member functions

* Work on plugin shortcuts

* Refactor of plugin learning center

All learning center-related functionality bundled in the learning center action
Add shortcuts to the data hierarchy plugin
Remove help action from view plugin class

* Further work on plugin learning center action

* Work on plugin description support

* Add base view plugin overlay widget (1)

* Work on view description overlay widget

* End of day commit, working version

* Help manager should not be part of the mv namespace

* Small refactor

* Fix plugin learning center toolbar item widget visibility mechanism

* Rework the video class a bit

* Add short and long description to data properties plugin

* Fix typo

* Add short and long description for the shared parameters plugin

* Add short and long description in tasks plugin

* Add short and long description in logging plugin

* Add documentation

* Fix issue with sampler action combination with learning center overlay

* Removed redundant debug print

* Fix overlay widget alignment issue

* Small tweaks to learning center overlay widget

* Move learning center overlay widget to plugin learning center action

* Explicitly create the view plugin overlay from the view plugin class

* Add feature to set a (human readable) custom plugin title and adjusted the core plugins accordingly

* End of day commit; update tooltip appropriately

* Refactor and add viewing mode

* Add sample context view plugin

* Add feature to add a view plugin floated

* Add plugins list model

* Work on plugin picker action and refactor of plugins models

* Work on plugin picker action

* Work on plugin picker action

* Further work on the plugin picker action

* Add plugins list and tree model to the plugins manager

* Switch to dynamically allocated list and tree model

* Implements plugin type filtering in the plugin picker action

* Plugin removal is now also correctly handled by the plugin picker action

* Change icon to mouse pointer in case of no option action selection

* Display sample context text in sample context plugin

* Various improvements in opening sample context window

* Refactor and add viewing mode

* Adhere to new view sampler action

* Add viewing mode to view sampler action, small refactor and adhere to core signature change

* Rename to SampleScopePlugin

* Filter plugins by if they can view samples

* Small refactor

* Install proper event filter, remove some warnings and simplified some code

* Add some read-only updates and handle tooltip visibility

* Fix word wrap and small windowed mode guard

* Re-draw tooltip when the viewing mode changes

* Several improvements and some bug fixes

Use option action for viewing mode
Do not throw an exception when, during the loading of a plugin picker action, a plugin is not available
Add general shortcuts to the view plugin
Change option action selection icon
Small cosmetic code changes
Remove widget fader debug print statements

* Open sample window when switching to windowed mode

* Floating dock widgets use dock widget icon from now on

* Fix warning

* Cleanup switch statement

---------

Co-authored-by: JulianThijssen <julianthijssen@gmail.com>
  • Loading branch information
ThomasKroes and JulianThijssen committed Sep 12, 2024
1 parent 83a5a20 commit cd6be62
Show file tree
Hide file tree
Showing 46 changed files with 2,399 additions and 473 deletions.
1 change: 1 addition & 0 deletions ManiVault/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ add_subdirectory(src/plugins/DataPropertiesPlugin)
add_subdirectory(src/plugins/SharedParametersPlugin)
add_subdirectory(src/plugins/LoggingPlugin)
add_subdirectory(src/plugins/TasksPlugin)
add_subdirectory(src/plugins/SampleScopePlugin)

# Data plugins
add_subdirectory(src/plugins/PointData)
Expand Down
4 changes: 4 additions & 0 deletions ManiVault/cmake/CMakeMvSourcesPublic.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ set(PUBLIC_TOOLBAR_ACTIONS_FILES
set(PUBLIC_MISCELLANEOUS_ACTIONS_HEADERS
src/actions/Actions.h
src/actions/DatasetPickerAction.h
src/actions/PluginPickerAction.h
src/actions/ImageAction.h
src/actions/PixelSelectionAction.h
src/actions/WindowLevelAction.h
Expand All @@ -280,6 +281,7 @@ set(PUBLIC_MISCELLANEOUS_ACTIONS_HEADERS

set(PUBLIC_MISCELLANEOUS_ACTIONS_SOURCES
src/actions/DatasetPickerAction.cpp
src/actions/PluginPickerAction.cpp
src/actions/ImageAction.cpp
src/actions/PixelSelectionAction.cpp
src/actions/WindowLevelAction.cpp
Expand Down Expand Up @@ -821,12 +823,14 @@ set(PUBLIC_TASKS_MODEL_FILES
set(PUBLIC_PLUGINS_MODEL_HEADERS
src/models/AbstractPluginsModel.h
src/models/PluginsTreeModel.h
src/models/PluginsListModel.h
src/models/PluginsFilterModel.h
)

set(PUBLIC_PLUGINS_MODEL_SOURCES
src/models/AbstractPluginsModel.cpp
src/models/PluginsTreeModel.cpp
src/models/PluginsListModel.cpp
src/models/PluginsFilterModel.cpp
)

Expand Down
28 changes: 27 additions & 1 deletion ManiVault/src/AbstractPluginManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
namespace mv
{

class PluginsListModel;
class PluginsTreeModel;

namespace plugin {
class Plugin;
class PluginFactory;
Expand Down Expand Up @@ -88,14 +91,23 @@ class CORE_EXPORT AbstractPluginManager : public AbstractManager
public:

/**
* Create a view plugin plugin of \p kind and dock it to \p dockToViewPlugin at \p dockArea
* Create a view plugin of \p kind, dock it to \p dockToViewPlugin at \p dockArea and assign the \p datasets
* @param kind Kind of plugin (name of the plugin)
* @param dockToViewPlugin View plugin instance to dock to
* @param dockArea Dock area to dock in
* @param datasets Datasets to assign to the view plugin
* @return Pointer of view plugin type to created view plugin, nullptr if creation failed
*/
virtual plugin::ViewPlugin* requestViewPlugin(const QString& kind, plugin::ViewPlugin* dockToViewPlugin = nullptr, gui::DockAreaFlag dockArea = gui::DockAreaFlag::Right, Datasets datasets = Datasets()) = 0;

/**
* Create a view plugin of \p kind and float it on top of the main window
* @param kind Kind of plugin (name of the plugin)
* @param datasets Datasets to assign to the view plugin
* @return Pointer of view plugin type to created view plugin, nullptr if creation failed
*/
virtual plugin::ViewPlugin* requestViewPluginFloated(const QString& kind, Datasets datasets = Datasets()) = 0;

/**
* Destroy \p plugin
* @param plugin Pointer to the plugin that is to be destroyed
Expand Down Expand Up @@ -212,6 +224,20 @@ class CORE_EXPORT AbstractPluginManager : public AbstractManager
*/
virtual QIcon getPluginIcon(const QString& pluginKind) const = 0;

public: // Model access

/**
* Get list model of all loaded plugins
* @return Reference to plugins list model
*/
virtual const PluginsListModel& getListModel() const = 0;

/**
* Get tree model of all loaded plugins
* @return Reference to plugins tree model
*/
virtual const PluginsTreeModel& getTreeModel() const = 0;

protected:

/**
Expand Down
6 changes: 6 additions & 0 deletions ManiVault/src/AbstractWorkspaceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ class CORE_EXPORT AbstractWorkspaceManager : public AbstractManager
*/
virtual void addViewPlugin(plugin::ViewPlugin* viewPlugin, plugin::ViewPlugin* dockToViewPlugin = nullptr, gui::DockAreaFlag dockArea = gui::DockAreaFlag::Right) = 0;

/**
* Add a \p viewPlugin on top of the main window
* @param viewPlugin Pointer to view plugin to add
*/
virtual void addViewPluginFloated(plugin::ViewPlugin* viewPlugin) = 0;

/**
* Set whether \p viewPlugin is isolated or not (closes all other view plugins when isolated)
* @param viewPlugin Pointer to view plugin to add to layout
Expand Down
2 changes: 1 addition & 1 deletion ManiVault/src/ApplicationSettingsAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CORE_EXPORT ApplicationSettingsAction final : public GlobalSettingsGroupAc
OptionAction& getAppearanceOptionAction() { return _appearanceOptionAction; }

private:
StringAction _applicationSessionIdAction; /** String action for the application session ID */
StringAction _applicationSessionIdAction; /** String action for the application session Id */
OptionAction _appearanceOptionAction; /** Options action for dark, light, or system appearance */
};

Expand Down
3 changes: 2 additions & 1 deletion ManiVault/src/Plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <QMap>
#include <QVariant>
#include <QIcon>
#include <QStringListModel>

#include "actions/PluginLearningCenterAction.h"

Expand Down Expand Up @@ -188,4 +187,6 @@ class CORE_EXPORT Plugin : public mv::gui::WidgetAction
friend class PluginFactory;
};

using Plugins = std::vector<Plugin*>;

}
9 changes: 9 additions & 0 deletions ManiVault/src/ViewPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ ViewPlugin::ViewPlugin(const PluginFactory* factory) :
_mayMoveAction.setChecked(_dockingOptionsAction.getSelectedOptions().contains("May Move"));
});

auto& shortcuts = getShortcuts();

shortcuts.add({ QKeySequence(Qt::Key_F2), "General", "Make a screenshot" });

if (!isSystemViewPlugin())
shortcuts.add({ QKeySequence(Qt::Key_F3), "General", "Toggle view isolation (hides the other views)" });

shortcuts.add({ QKeySequence(Qt::Key_F12), "General", "Edit the view parameters" });

getLearningCenterAction().createViewPluginOverlayWidget();
}

Expand Down
26 changes: 2 additions & 24 deletions ManiVault/src/actions/DatasetPickerAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ DatasetPickerAction::DatasetPickerAction(QObject* parent, const QString& title)
OptionAction(parent, title),
_populationMode(AbstractDatasetsModel::PopulationMode::Automatic),
_datasetsListModel(AbstractDatasetsModel::PopulationMode::Manual),
_datasetsFilterModel(),
_blockDatasetsChangedSignal(false),
_currentDatasetsIds()
_blockDatasetsChangedSignal(false)
{
setText(title);
setIconByName("database");
Expand All @@ -44,9 +42,6 @@ DatasetPickerAction::DatasetPickerAction(QObject* parent, const QString& title)
case AbstractDatasetsModel::PopulationMode::Automatic:
emit datasetPicked(mv::data().getDatasetsListModel().getDataset(sourceModelRow));
break;

default:
break;
}
});

Expand Down Expand Up @@ -96,9 +91,6 @@ Datasets DatasetPickerAction::getDatasets() const
case AbstractDatasetsModel::PopulationMode::Automatic:
datasets << mv::data().getDatasetsListModel().getDataset(sourceModelIndex.row());
break;

default:
break;
}
}

Expand Down Expand Up @@ -126,9 +118,7 @@ void DatasetPickerAction::setDatasets(Datasets datasets, bool silent /*= false*/
emit datasetsChanged(_datasetsListModel.getDatasets());
}

auto publicDatasetPickerAction = dynamic_cast<DatasetPickerAction*>(getPublicAction());

if (publicDatasetPickerAction)
if (auto publicDatasetPickerAction = dynamic_cast<DatasetPickerAction*>(getPublicAction()))
setCurrentDataset(publicDatasetPickerAction->getCurrentDataset());
}

Expand Down Expand Up @@ -163,9 +153,6 @@ Dataset<DatasetImpl> DatasetPickerAction::getCurrentDataset() const

case AbstractDatasetsModel::PopulationMode::Automatic:
return mv::data().getDatasetsListModel().getDataset(sourceModelIndex.row());

default:
break;
}

return {};
Expand All @@ -185,9 +172,6 @@ void DatasetPickerAction::setCurrentDataset(Dataset<DatasetImpl> currentDataset)
case AbstractDatasetsModel::PopulationMode::Automatic:
datasetIndex = mv::data().getDatasetsListModel().getIndexFromDataset(currentDataset);
break;

default:
break;
}
}

Expand All @@ -213,9 +197,6 @@ void DatasetPickerAction::setCurrentDataset(const QString& datasetId)
case AbstractDatasetsModel::PopulationMode::Automatic:
datasetIndex = mv::data().getDatasetsListModel().getIndexFromDataset(datasetId);
break;

default:
break;
}

if (!datasetIndex.isValid())
Expand Down Expand Up @@ -268,9 +249,6 @@ void DatasetPickerAction::populationModeChanged()
_datasetsFilterModel.setSourceModel(&const_cast<DatasetsListModel&>(mv::data().getDatasetsListModel()));
break;
}

default:
break;
}
}

Expand Down
8 changes: 4 additions & 4 deletions ManiVault/src/actions/DatasetPickerAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,17 @@ Q_OBJECT
void datasetsChanged(mv::Datasets datasets);

/**
* Signals that the population mode changed from \p previousPopulationMode to \p populationMode
* Signals that the population mode changed from \p previousPopulationMode to \p currentPopulationMode
* @param previousPopulationMode Previous population mode
* @param populationMode Previous population mode
* @param currentPopulationMode Current population mode
*/
void populationModeChanged(AbstractDatasetsModel::PopulationMode previousPopulationMode, AbstractDatasetsModel::PopulationMode populationMode);
void populationModeChanged(AbstractDatasetsModel::PopulationMode previousPopulationMode, AbstractDatasetsModel::PopulationMode currentPopulationMode);

private:
AbstractDatasetsModel::PopulationMode _populationMode; /** Population mode (e.g. manual or automatic) */
DatasetsListModel _datasetsListModel; /** Datasets list model for manual population (mv::data().getDatasetsListModel() otherwise) */
DatasetsFilterModel _datasetsFilterModel; /** Filter model for the datasets model above */
bool _blockDatasetsChangedSignal; /** Boolean determining whether the DatasetPickerAction::datasetsChanged(...) signal may be engaged in reponse to change in the DatasetPickerAction#_datasetsFilterModel */
bool _blockDatasetsChangedSignal; /** Boolean determining whether the DatasetPickerAction::datasetsChanged(...) signal may be engaged in reponse to change in the DatasetPickerAction#_filterModel */
QStringList _currentDatasetsIds; /** Keep a list of current datasets identifiers so that we can avoid unnecessary emits of the DatasetPickerAction::datasetsChanged(...) signal */

friend class AbstractActionsManager;
Expand Down
2 changes: 1 addition & 1 deletion ManiVault/src/actions/HorizontalHeaderAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CORE_EXPORT HorizontalHeaderAction final : public VerticalGroupAction

private:

/** Re-populate the columns option action */
/** Re-populateFromPluginManager the columns option action */
void updateColumnsOptionsAction();

public: // Action getters
Expand Down
7 changes: 4 additions & 3 deletions ManiVault/src/actions/OptionAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ namespace mv::gui {

OptionAction::OptionAction(QObject* parent, const QString& title, const QStringList& options /*= QStringList()*/, const QString& currentOption /*= ""*/) :
WidgetAction(parent, title),
_defaultModel(),
_customModel(nullptr),
_currentIndex(-1),
_placeholderString()
_currentIndex(-1)
{
setText(title);
setDefaultWidgetFlags(WidgetFlag::Default);
Expand Down Expand Up @@ -390,6 +388,9 @@ void OptionAction::ComboBoxWidget::paintEvent(QPaintEvent* paintEvent)

initStyleOption(&styleOptionComboBox);

if (_optionAction->getCurrentIndex() == -1)
styleOptionComboBox.currentIcon = Application::getIconFont("FontAwesome").getIcon("list");

painter->drawComplexControl(QStyle::CC_ComboBox, styleOptionComboBox);

if (_optionAction->getCurrentIndex() < 0) {
Expand Down
Loading

0 comments on commit cd6be62

Please sign in to comment.