Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/ImageLoaderPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include <PointData/PointData.h>

#include <widgets/MarkdownDialog.h>

#include <QDebug>

using namespace mv;
Expand Down Expand Up @@ -56,9 +58,31 @@ QModelIndexList ImageLoaderPlugin::getSelectedRows() const
ImageLoaderPluginFactory::ImageLoaderPluginFactory()
{
setIconByName("images");

connect(&getPluginMetadata().getTriggerHelpAction(), &TriggerAction::triggered, this, [this]() -> void {
if (!getReadmeMarkdownUrl().isValid() || _helpMarkdownDialog.get())
return;

_helpMarkdownDialog = new util::MarkdownDialog(getReadmeMarkdownUrl());

_helpMarkdownDialog->setWindowTitle(QString("%1").arg(getKind()));
_helpMarkdownDialog->setAttribute(Qt::WA_DeleteOnClose);
_helpMarkdownDialog->setWindowModality(Qt::NonModal);
_helpMarkdownDialog->show();
});
}

LoaderPlugin* ImageLoaderPluginFactory::produce()
{
return new ImageLoaderPlugin(this);
}

QUrl ImageLoaderPluginFactory::getReadmeMarkdownUrl() const
{
return QUrl("https://raw.githubusercontent.com/ManiVaultStudio/ImageLoaderPlugin/master/README.md");
}

QUrl ImageLoaderPluginFactory::getRepositoryUrl() const
{
return QUrl("https://github.com/ManiVaultStudio/ImageLoaderPlugin");
}
17 changes: 16 additions & 1 deletion src/ImageLoaderPlugin.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#pragma once

#include "Common.h"
#include "ImageCollectionScanner.h"
#include "ImageCollectionsModel.h"
#include "ConversionAction.h"

#include <LoaderPlugin.h>
#include <PluginFactory.h>

#include <QPointer>
#include <QUrl>

using mv::plugin::LoaderPluginFactory;
using mv::plugin::LoaderPlugin;

namespace mv::util {
class MarkdownDialog;
}

/**
* Image loader plugin class
*
Expand Down Expand Up @@ -65,9 +71,18 @@ class ImageLoaderPluginFactory : public LoaderPluginFactory
/** Destructor */
~ImageLoaderPluginFactory() override {}

QUrl getReadmeMarkdownUrl() const override;

bool hasHelp() const override { return true; }

QUrl getRepositoryUrl() const override;

/**
* Produces the plugin
* @return Pointer to the produced plugin
*/
LoaderPlugin* produce() override;

private:
QPointer<mv::util::MarkdownDialog> _helpMarkdownDialog = {};
};