Class: Ruber::Plugin

Inherits:
Qt::Object
  • Object
show all
Includes:
PluginLike
Defined in:
lib/ruber/plugin.rb

Overview

Base class for all plugins

Most of its functionality comes from the included PluginLike module.

Direct Known Subclasses

Autosave::AutosavePlugin, GuiPlugin, IRB::Plugin, RI::Plugin, RubySyntaxChecker::Plugin, State::Plugin, SyntaxChecker::Plugin, SyntaxChecker::SyntaxCheckerPlugin, YAMLSyntaxChecker::Plugin

Constant Summary

LICENSES =

A map between the license symbols used in the PSF and the KDE::AboutData licenses constants

{
:unknown => KDE::AboutData::License_Unknown,
:gpl => KDE::AboutData::License_GPL,
:gpl2 => KDE::AboutData::License_GPL_V2,
:lgpl => KDE::AboutData::License_LGPL,
:lgpl2 => KDE::AboutData::License_LGPL_V2,
:bsd => KDE::AboutData::License_BSD,
:artistic => KDE::AboutData::License_Artistic,
:qpl => KDE::AboutData::License_QPL,
:qpl1 => KDE::AboutData::License_QPL_V1_0,
:gpl3 => KDE::AboutData::License_GPL_V3,
:lgpl3 => KDE::AboutData::License_LGPL_V3
}

Instance Attribute Summary

Attributes included from PluginLike

plugin_description

Instance Method Summary (collapse)

Methods included from PluginLike

#add_extensions_to_project, #add_options_to_project, #add_widgets_to_project, #create_tool_widget, #delayed_initialize, #initialize_plugin, #load_settings, #plugin_name, #query_close, #register_options, #register_with_project, #remove_extensions_from_project, #remove_from_project, #remove_options_from_project, #remove_widgets_from_project, #restore_session, #save_settings, #session_data, #setup_action, #setup_actions, #shutdown, #unload, #update_project

Signal Summary

Constructor Details

- (Plugin) initialize(psf)

Creates a new instance

This method takes care of calling the Ruber::PluginLike#initialize_plugin method required by the Ruber::PluginLike module

with the plugin

Parameters:



87
88
89
90
# File 'lib/ruber/plugin.rb', line 87

def initialize psf
  super(Ruber[:app])
  initialize_plugin psf
end

Instance Method Details

- (KDE::AboutData) about_data

Creates a KDE::AboutData object for the plugin

Note: every time this method is called, a new KDE::AboutData object is created

taken from the PSF

Returns:

  • (KDE::AboutData)

    a KDE::AboutData containing information about the plugin,



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/ruber/plugin.rb', line 100

def about_data
  about = @plugin_description.about
  app_name = @plugin_description.name.to_s
  version = @plugin_description.version
  license = @plugin_description.about.license
  license_key, license_text =
  if about.license.is_a? String then [KDE::AboutData::License_Custom, about.license]
  else [LICENSES[about.license], nil]
  end
  res = KDE::AboutData.new app_name, '', KDE.ki18n(about.human_name), version, 
      KDE.ki18n(about.description), license_key
  res.license_text = KDE.ki18n(license_text) if license_text
  @plugin_description.about.authors.each do |a|
    res.add_author KDE.ki18n(a[0]), KDE.ki18n(''), Qt::ByteArray.new(a[1] || '')
  end
  res.bug_address = Qt::ByteArray.new(about.bug_address) unless about.bug_address.empty?
  res.copyright_statement = KDE.ki18n(about.copyright) unless about.copyright.empty?
  res.homepage = Qt::ByteArray.new(about.homepage) unless about.homepage.empty?
  res.program_icon_name = about.icon unless about.icon.empty?
  res
end

Signal Details

- extension_added(QString name, QObject* ext)

Signal emitted after an extension has been added

Parameters:

  • name (String)

    the name of the extension

  • ext (Qt::Object)

    the extension object itself

- removing_extension(QString name, QObject* ext)

Signal emitted before removing an extension

Parameters:

  • name (String)

    the the name of the extension being removed

  • ext (Qt::Object)

    the extension object being removed

- extension_removed(QString name, QObject* ext)

Signal emitted after removing an extension

Parameters:

  • name (String)

    the the name of the removed extension

  • ext (Qt::Object)

    the removed extension object