Skip to main content

Overview

Every OpenTrack plugin must provide metadata through the Metadata class. This includes the plugin’s display name and icon that appear in the user interface.

Interface Definition

Base Classes

Metadata_

The base interface that defines the required methods.

TR

Provides translation support through Qt’s internationalization system. Inherit from this to enable tr() function for translatable strings.

Methods

name()

Returns the human-readable name of the plugin.
QString
The plugin name displayed in the UI dropdown menus
Guidelines:
  • Use descriptive, user-friendly names
  • Keep names concise (prefer “Easy Tracker” over “Easy Tracker Version 1.1”)
  • Use tr() for internationalization support
  • Include version numbers only if multiple versions exist
Examples:

icon()

Returns the plugin’s icon for display in the UI.
QIcon
A QIcon object, or empty icon if none available
Guidelines:
  • Use 16x16 or 32x32 PNG images for best results
  • Store icons in Qt resource files (.qrc)
  • Return QIcon() (empty) if no icon available
  • Use consistent icon style within plugin family
Icon resource setup:
  1. Create resource file (plugin.qrc):
  1. Add to CMakeLists.txt:
  1. Reference in code:
Examples:

Complete Implementation

Plugin Registration

The metadata class is used in plugin registration macros:

Tracker Registration

Example:

Protocol Registration

Example:

Filter Registration

Example:

Registration Macro Details

What the Macros Do

The registration macros expand to export three C functions:
These functions are called by OpenTrack to:
  1. GetMetadata(): Query plugin name/icon for UI display
  2. GetConstructor(): Create plugin instance when selected
  3. GetDialog(): Create settings dialog when configured

Macro Definition

Example Metadata Classes

Translation Support

To support multiple languages, use Qt’s translation system:

1. Mark Strings for Translation

2. Create Translation Files

Create .ts files for each language:

3. Add to Build System

Best Practices

  • Be descriptive: “Point Tracker” not “PT”
  • User-friendly: “Easy Tracker” not “tracker-easy”
  • Consistent: Match naming style of existing plugins
  • Versioned: Include version if multiple versions exist
  • Size: 16x16 or 32x32 pixels
  • Format: PNG with transparency
  • Style: Simple, recognizable shapes
  • Color: Match OpenTrack’s color scheme
  • Fallback: Return empty QIcon() if none available
  • Metadata class can have any name
  • Common patterns:
    • <PluginName>Metadata
    • <PluginName>Dll (legacy)
    • Metadata in plugin namespace

Common Issues

Common pitfalls when implementing metadata:

Missing Q_OBJECT Macro

Not Using tr() for Translation

Invalid Icon Path

See Also