Each script is collection of couple files. But it must have XML descriptor.
XML descriptor is plain xml-structured text file which contains references to all other files of this script. XML descriptor must be placed in folder “extensions” or its any subfolder and have file extension “.xml”. All references to other files are relative to location of XML descriptor, do not use absolute pathes.
You can use next tags:
<menu> – just container for all others
<section> – optional tag which contains name of the section where link will be placed. There are couple recognized sections: “calc, find, edit,export,navi, others”. If name does not match predefined it will be placed as subsection of “others”.
<script> – tag must exists. Contains name of the main script’s file with lua code. If it contains path it have to be related to position of the XML descriptor (no absolute pathes). If this file cannot be found SmartViewer will ignore script totally.
<form> – optional tag, contains name of the main UI QML file. Some additional naming rules like name’s case may apply, see QML documentation.
<button> – tag container which has visible to user link. Have to be at least 1 in file. Each such tag will be displayed as additional option in menu.
<name> – must exisits. Text shown to user.
<shortcut> – optional tag with keyboard shortcut. Use it carefull because other scripts may use same shortcut. Additional info.
<icon> – optional tag, allows to add icon to the menu. Contains image file name.
<callparam> – optional tag, anything contained here will be passed to script as global value CallParam when user selects this <button> from menu. So same script can have couple working modes.
<hint> – optional tag, contains text shown in status bar.
Sample:
<menu>
<section>find</section>
<script>find.lua</script><button>
<name>Text Search (case insensitive)</name>
<shortcut>ctrl+F</shortcut>
<icon>afind.png</icon>
<callparam>t</callparam>
</button><button>
<name>Binary Search</name>
<shortcut>ctrl+alt+F</shortcut>
<icon>hfind.png</icon>
<callparam>b</callparam>
</button>
</menu>
3 Comments