Scroom 0.14-49-gb7ae7a6d
Loading...
Searching...
No Matches
Metadata Class Reference

#include <metadata.hh>

Inheritance diagram for Metadata:
Inheritance graph
Collaboration diagram for Metadata:
Collaboration graph

Public Types

using Ptr = std::shared_ptr< Metadata >
 
- Public Types inherited from PluginInformationInterface
using Ptr = std::shared_ptr< PluginInformationInterface >
 
- Public Types inherited from ViewObserver
using Ptr = std::shared_ptr< ViewObserver >
 

Public Member Functions

std::string getPluginName () override
 
std::string getPluginVersion () override
 
void registerCapabilities (ScroomPluginInterface::Ptr host) override
 
Scroom::Bookkeeping::Token viewAdded (ViewInterface::Ptr v) override
 
- Public Member Functions inherited from PluginInformationInterface
 PluginInformationInterface ()=default
 
- Public Member Functions inherited from Scroom::Utils::Base
 Base ()=default
 
 Base (const Base &)=delete
 
 Base (Base &&)=delete
 
Baseoperator= (const Base &)=delete
 
Baseoperator= (Base &&)=delete
 
virtual ~Base ()=default
 
template<typename R >
std::shared_ptr< R > shared_from_this ()
 
template<typename R >
std::shared_ptr< R const > shared_from_this () const
 

Static Public Member Functions

static Ptr create ()
 

Private Member Functions

 Metadata ()=default
 

Additional Inherited Members

- Public Attributes inherited from PluginInformationInterface
const int pluginApiVersion {PLUGIN_API_VERSION}
 

Member Typedef Documentation

◆ Ptr

using Metadata::Ptr = std::shared_ptr<Metadata>

Constructor & Destructor Documentation

◆ Metadata()

Metadata::Metadata ( )
privatedefault

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

◆ create()

Metadata::Ptr Metadata::create ( )
static

Creates a pointer to a metadata object

Returns
Pointer to metadata object
41{ return Ptr(new Metadata()); }
Metadata()=default
std::shared_ptr< Metadata > Ptr
Definition metadata.hh:18

Referenced by getPluginInformation().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPluginName()

std::string Metadata::getPluginName ( )
overridevirtual

Gets the name of metadata plugin

Returns
std::string "Metadata"

Implements PluginInformationInterface.

52{ return "Metadata"; }

◆ getPluginVersion()

std::string Metadata::getPluginVersion ( )
overridevirtual

Gets the version number of metadata plugin

Returns
std::string "0.0"

Implements PluginInformationInterface.

59{ return PACKAGE_VERSION; }

◆ registerCapabilities()

void Metadata::registerCapabilities ( ScroomPluginInterface::Ptr  host)
overridevirtual

Register plugin to observers

Parameters
hostPointer to scroom plugin interface
Returns
std::string "0.0"

Implements PluginInformationInterface.

68{
69 host->registerViewObserver("Metadata", shared_from_this<Metadata>());
70}

◆ viewAdded()

Scroom::Bookkeeping::Token Metadata::viewAdded ( ViewInterface::Ptr  view)
overridevirtual

Shows an image metadata button in the view that can be activated by clicking.

Parameters
viewScreen or view that is displayed
Postcondition
Metadata button is shown in toolbar
Returns
Scroom::Bookkeeping::Token token for bookkeeping of scroom

Implements ViewObserver.

84{
85 auto presentation = view->getCurrentPresentation();
86 auto showMetaDataInterface = std::dynamic_pointer_cast<ShowMetadataInterface>(presentation);
87 if(presentation->isPropertyDefined(METADATA_PROPERTY_NAME))
88 {
89 require(showMetaDataInterface);
90
91 // create button for metadata and add it to the toolbar
92 GtkToolItem* button = gtk_tool_item_new();
93 GtkWidget* buttonMetadata = gtk_button_new_with_label("Metadata");
94 gtk_widget_set_visible(buttonMetadata, true);
95 gtk_container_add(GTK_CONTAINER(button), buttonMetadata);
96 // connect signal to the button for when it is being pressed
97 g_signal_connect(static_cast<gpointer>(buttonMetadata), "clicked", G_CALLBACK(on_image_properties_activate), view.get());
98
100 [&]
101 {
102 view->addToToolbar(button); // adds metadata button next to other tools in toolbar
103 }
104 );
105 }
106 return {};
107}
#define require(expr)
Definition assertions.hh:30
void on_image_properties_activate(GtkButton *self, gpointer user_data)
Definition metadata.cc:23
void sync_on_ui_thread(T f)
Definition gtk-helpers.hh:59
const auto view
Definition pipette-tests.cc:227
const std::string METADATA_PROPERTY_NAME
Definition showmetadatainterface.hh:15
Here is the call graph for this function:

The documentation for this class was generated from the following files: