Skip to content

Commit

Permalink
Further work on skeleton code
Browse files Browse the repository at this point in the history
Renamed all classes etc
Removed redundant code left over from copy
  • Loading branch information
ThomasKroes committed Jun 14, 2024
1 parent 4c067c6 commit 5eb468c
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 325 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ add_subdirectory(ExampleTransformation)
add_subdirectory(ExampleLoader)
add_subdirectory(ExampleWriter)
add_subdirectory(ExampleData)
add_subdirectory(ExampleActions)
10 changes: 5 additions & 5 deletions ExampleActions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ option(MV_UNITY_BUILD "Combine target source files into batches for faster compi
# -----------------------------------------------------------------------------
# ExampleView Plugin
# -----------------------------------------------------------------------------
PROJECT("ExampleViewPlugin")
PROJECT("ExampleActionsPlugin")

# -----------------------------------------------------------------------------
# CMake Options
Expand Down Expand Up @@ -41,13 +41,13 @@ find_package(Qt6 COMPONENTS Widgets WebEngineWidgets REQUIRED)
# -----------------------------------------------------------------------------
# Define the plugin sources
set(PLUGIN_SOURCES
src/ExampleViewPlugin.h
src/ExampleViewPlugin.cpp
src/ExampleViewPlugin.json
src/ExampleActionsPlugin.h
src/ExampleActionsPlugin.cpp
src/ExampleActionsPlugin.json
)

set(PLUGIN_MOC_HEADERS
src/ExampleViewPlugin.h
src/ExampleActionsPlugin.h
)

source_group( Plugin FILES ${PLUGIN_SOURCES})
Expand Down
30 changes: 30 additions & 0 deletions ExampleActions/src/ExampleActionsPlugin.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "ExampleActionsPlugin.h"

#include <CoreInterface.h>

#include <QDebug>

Q_PLUGIN_METADATA(IID "studio.manivault.ExampleActionsPlugin")

using namespace mv;

ExampleActionsPlugin::ExampleActionsPlugin(const PluginFactory* factory) :
ViewPlugin(factory)
{
}

void ExampleActionsPlugin::init()
{
// Create layout
auto layout = new QVBoxLayout();

layout->setContentsMargins(0, 0, 0, 0);

// Apply the layout
getWidget().setLayout(layout);
}

ViewPlugin* ExampleActionsPluginFactory::produce()
{
return new ExampleActionsPlugin(this);
}
70 changes: 70 additions & 0 deletions ExampleActions/src/ExampleActionsPlugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#pragma once

#include <ViewPlugin.h>

#include <QWidget>

/** All plugin related classes are in the ManiVault plugin namespace */
using namespace mv::plugin;

/** Drop widget used in this plugin is located in the ManiVault gui namespace */
using namespace mv::gui;

/** Dataset reference used in this plugin is located in the ManiVault util namespace */
using namespace mv::util;

/**
* Example actions view plugin class
*
* This view plugin class provides skeleton code that shows how to use GUI building
* blocks (aka actions) to build interfaces.
*
* To see the plugin in action, please follow the steps below:
*
* 1. Go to the visualization menu in ManiVault
* 2. Choose the Example actions menu item, the view will be added to the layout
*
* @author T. Kroes
*/
class ExampleActionsPlugin : public ViewPlugin
{
Q_OBJECT

public:

/**
* Construct with pointer to plugin \p factory
* @param factory Pointer to the plugin factory
*/
ExampleActionsPlugin(const PluginFactory* factory);

/** Destructor */
~ExampleActionsPlugin() override = default;

/** This function is called by the core after the view plugin has been created */
void init() override;
};

/**
* Example actions plugin factory class
*
* Note: Factory does not need to be altered (merely responsible for generating new plugins when requested)
*/
class ExampleActionsPluginFactory : public ViewPluginFactory
{
Q_INTERFACES(mv::plugin::ViewPluginFactory mv::plugin::PluginFactory)
Q_OBJECT
Q_PLUGIN_METADATA(IID "studio.manivault.ExampleActionsPlugin"
FILE "ExampleActionsPlugin.json")

public:

/** Default constructor */
ExampleActionsPluginFactory() {}

/** Destructor */
~ExampleActionsPluginFactory() override {}

/** Creates an instance of the example view plugin */
ViewPlugin* produce() override;
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name" : "Example View",
"name" : "Example Actions",
"version" : "1.1",
"dependencies" : ["Points"]
}
219 changes: 0 additions & 219 deletions ExampleActions/src/ExampleViewPlugin.cpp

This file was deleted.

Loading

0 comments on commit 5eb468c

Please sign in to comment.