qt creator of all aspects of the source code analysis (2-10-3)

Plugin Meta Data

Plug-in metadata file is a JSON file that contains all the information required to load the plug-in library to determine which plug-ins, as well as load order to load (depending dependencies). In addition, it includes the use of plug-ins, plug-ins, and you can find more information about where to plug in. When you compile the plug, the file must be in the include search path, and must have .json extension. As JSON file compiled metadata to plug-in, and then read by loading plugins in Qt Creator.

Primary key

Primary key used to identify the plug-in, define the default load behavior, including mandatory key Name and Version, and optional key CompatVersion, Experimental, DisabledByDefault, Required and Platform.

key Value Type meaning
Name String Widget identifier is used, for example, references in other plug-in dependency.
Version String xyz_n form of version string that identifies the plug. See chapter "plug-in release notes" section.
CompatVersion String Optional. If not given, Version implicitly set to the same value. Release Notes version compatibility backward compatible plug-in after the current version can be binary, and resolve dependencies for this plug. That Version2.1.1 and CompatVersion 2.0.0, 2.1.1 means that the binary version of the plug-in is backwards compatible with all versions of the plug-in 2.1.1 - 2.0.0 (with 2.0.0).
Experimental Boolean Optional. The default is false. Experimental default widget is not loaded in the case, and must be explicitly enabled by the user. Should have a negative impact to the user experience might be a new plug-in to enable this property.
DisabledByDefault Boolean Optional. The default is false. If set, the corresponding default widget is not loaded in the case, and must be explicitly enabled by the user. Should not expected to be used by too many people plug-in settings to reduce the additional resource consumption.
HiddenByDefault Boolean Optional. The default is false. If set, the plugin does not appear in the "About Plug-ins ..." dialog box, the default view, only displayed when the user ask to see all plug-ins. If there together -version command line arguments, it also shows.
Required Boolean Optional. The default is false. As the "About Plug-ins ..." prompt dialog box that prompts the user may not be able to manually disable the plugin. Only for the Core plug-ins.
Platform String Optional. Regular expression platform name, matching run plug-ins. Omit the label, meaning that the plug can be loaded on all platforms.

Plug-described key

These keys are used only for a more detailed (user-centric) of the plug-in described. All of these are optional.

key Value Type meaning
Category String The default is Utilities. For "About Plug-ins ..." plugin Overview dialog box, the plug-ins associated with the node on the same tree.
Vendor String String that describes the plugin creators / providers, such as MyCompany.
Copyright String Short copyright notice, for example (C) 2016 MyCompany.
License String or array of strings Licensing information about possible multi-line plug-in. Since the UI is not designed for the long text, and should therefore be kept relatively short.
Description String or array of strings The contents of the plug should be provided describing possible multiple rows. Since the UI is not designed for the long text, and should therefore be kept relatively short.
Url String Links to more information about the plugin, for example http://www.mycompany-online.com/products/greatplugin.

rely

A plug-in can depend on other plug-ins. These are specified in the plug-in metadata to ensure that these additional plug-in is loaded before this plugin.

Dependencies by Dependencykey declaration key of an array of JSON objects, and comprising a force Name Version keys, and optional key Type.

The following equation describes the dependency information is how the match. In the formula, is dependent widget name (Name defined and dependent on the same object metadata) is represented DependencyName, is indicated as dependent version widget DependencyVersion. A plug having a plug element at a given Name, Version CompatVersion and data definitions, comprising the following description, can be successfully match the dependency for other plug-in dependencies:

  • It Namematches DependencyNameand
  • CompatVersion <= DependencyVersion <= Version.

For example, a plug-in for dependencies

  {
      "Name" : "SomeOtherPlugin",
      "Version" : "2.3.0_2"
  }

Will match with the following plug, the plug may be used as the above-dependent

  {
      "Name" : "SomeOtherPlugin",
      "Version" : "3.1.0",
      "CompatVersion" : "2.2.0",
      ...
  }

Because matching name, and version-dependent item label provided 2.3.0_2, it is in the range of 2.2.0 - 3.1.0.

key Value Type meaning
Dependencies Dependence array of objects Description dependence on other plug-ins

JSON an object is dependent objects having the key:

key Value Type meaning
Name String The name of the plug-in relies on plug-ins.
Version String Must be compatible with the version used to populate the plug-in dependencies are dependent on the format xyz_n. If the version does not matter, it can be empty.
Type String Optional. Value Required, Optionalor Test. If the dependency is a mandatory requirement or have plug-ins required to run the test, the definition. The default is Required.

Optional dependencies

Plug-in can specify a dependency on another plug-in is optional, by adding to the dependent objects "Type": "Optional":

  • If dependencies can be resolved, the plug-in and its dependencies plug-in will be loaded and initialized as Required dependencies.
  • If the dependencies can not be resolved, only plug-in is loaded and initialized, if there is no statement as dependencies.

Plug-in will not be notified in any way dependent on whether there is an optional plug-ins. Because the dependent plug-in might be loaded, or may not, plug-ins may not link to the dependent plug-ins. Optional plug-ins from a common method to access the object dependencies by :: :: :: ExtensionSystem PluginManager :: getObjectByName ( ) or ExtensionSystem PluginManager getObjectByClassName () from a global pool of objects on the object to obtain the object, and get the call QMetaObject function.

Test dependencies

When the user runs the application -test command line arguments, only loads the specified plug-in and rely on plug-ins. This is done to avoid loading unwanted plug-ins, thus speeding up the execution speed tests.

By using the "Type": "Test" Statement dependencies, plug-ins can be specified, required to perform test functions, rather than rely on plug-ins perform normal functions. Test load dependency is mandatory, and does not affect the loading sequence.

This dependency is not transmitted.

Command line parameters

Plug-ins can register the command-line parameters, the user can provide when starting the application. When the user uses the command line parameters -help run the application, the form of the command line parameters described in a single line will be displayed, and the Plugin Manager will perform integrity checking and parsing the command line based on the information. If Plug-in Manager command to find a match for plug-line arguments passed to the initialize () function to insert.

Command-line arguments Arguments key defined by the key parameter contains an array of objects. Each individual parameter object has forced bond Name, and optional bond and Parameter Description.

key Value Type meaning
Arguments Parameters array of objects Description command-line arguments plugin you want to process

JSON parameter object is an object having the key:

key Value Type meaning
Name String Command-line parameters themselves, include the prefix symbol '-', e.g.-my-parameter
Parameter String Optional. If this parameter is specified, then the command line parameter requires an added value, such as -my-parameter somevalue. The value of this attribute as a brief description, provided to the user.
Description String 可选项。参数的(单行)描述,用于命令行参数帮助。

Test.json示例

  {
      "Name" : "Test",
      "Version" : "1.0.1",
      "CompatVersion" : "1.0.0",
      "Vendor" : "My Company",
      "Copyright" : "(C) 2016 MyCompany",
      "License" : [
          "This is a default license bla",
          "blubbblubb",
          "end of terms"
      ],
      "Category" : "My Company Additions",
      "Description" : [
          "This plugin is just a test.",
          "It demonstrates the great use of the plugin meta data."
      ],
      "Url" : "http://www.mycompany-online.com/products/greatplugin",
      "Arguments" : [
          {
              "Name" : "-variant",
              "Parameter" : "fancy|boring",
              "Description" : "Brings up the fancy or boring user interface"
          }
      ],
      "Dependencies" : [
          { "Name" : "SomeOtherPlugin", "Version" : "2.3.0_2" },
          { "Name" : "EvenOther", "Version" : "1.0.0" }
      ]
  }

插件版本说明

插件版本的格式为x.y.z_n,其中x,y,z和n是非负整数。 您不必以完整格式指定版本 - 任何遗漏的部分都将隐式设置为零。 因此,2.10_2等于2.10.0_2,并且1与1.0.0_0相同。

Guess you like

Origin www.cnblogs.com/codeForFamily/p/qt-creator-ide-source-learn-2-10-3.html