Hot key

  • You only define names for the functions you want to use with a hotkey.
    This names has to be registered with the hotkey-functions in your plugin.

    Code
    /* Helper function to create a hotkey */static struct PluginHotkey* createHotkey(const char* keyword, const char* description) {    struct PluginHotkey* hotkey = (struct PluginHotkey*)malloc(sizeof(struct PluginHotkey));    _strcpy(hotkey->keyword, PLUGIN_HOTKEY_BUFSZ, keyword);    _strcpy(hotkey->description, PLUGIN_HOTKEY_BUFSZ, description);    return hotkey;}/* Some makros to make the code to create hotkeys a bit more readable */#define BEGIN_CREATE_HOTKEYS(x) const size_t sz = x + 1; size_t n = 0; *hotkeys = (struct PluginHotkey**)malloc(sizeof(struct PluginHotkey*) * sz);#define CREATE_HOTKEY(a, b) (*hotkeys)[n++] = createHotkey(a, b);#define END_CREATE_HOTKEYS (*hotkeys)[n++] = NULL; assert(n == sz);/* * Initialize plugin hotkeys. If your plugin does not use this feature, this function can be omitted. * Hotkeys require ts3plugin_registerPluginID and ts3plugin_freeMemory to be implemented. * This function is automatically called by the client after ts3plugin_init. */void ts3plugin_initHotkeys(struct PluginHotkey*** hotkeys) {    QVariantHash hotkeyEntries = moduleLoader::instance()->getHotkeyEntries();    BEGIN_CREATE_HOTKEYS((hotkeyEntries.keys().count()));    foreach(QString keyword, hotkeyEntries.keys()) {        CREATE_HOTKEY('<keyword>', '<description>');    }    END_CREATE_HOTKEYS;}


    After that, you define the hotkeys in the configuration of your teamspeak-client.
    Then you get a notification with this callback when the hotkey is pressed:

    Code
    void ts3plugin_onHotkeyEvent(const char* keyword)void ts3plugin_onHotkeyEvent(const char* keyword)
  • Teamspeak3-Client Menu -> Extras -> Optionen


    Dort den Reiter "Hotkeys" öffnen, und beim hinzufügen die "Erweiterten Aktionen" einblenden.
    Dann ist dort der Eintrag "Plugins" ersichtlich, unter welchem die Hotkeys mit der gesetzten Beschreibung vorhanden sind.

  • Dieses Thema enthält 4 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind, bitte registrieren Sie sich oder melden Sie sich an um diese lesen zu können.