linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #06936
[Branch ~dcplusplus-team/dcpp-plugin-sdk-cpp/trunk] Rev 25: add UI::clearCommands
------------------------------------------------------------
revno: 25
committer: poy <poy@xxxxxxxxxx>
branch nick: dcpp-plugin-sdk-cpp
timestamp: Sun 2013-06-02 13:17:26 +0200
message:
add UI::clearCommands
added:
packaging/README.txt
modified:
.bzrignore
pluginsdk/UI.cpp
pluginsdk/UI.h
--
lp:dcpp-plugin-sdk-cpp
https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcpp-plugin-sdk-cpp.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/trunk/+edit-subscription
=== modified file '.bzrignore'
--- .bzrignore 2013-05-23 16:06:31 +0000
+++ .bzrignore 2013-06-02 11:17:26 +0000
@@ -12,8 +12,7 @@
./doc/build.bat
./doc/html
./doc/latex
-./packaging/*
-!./packaging/packager
+./packaging/info_generated.xml
./projects/make/build*
./projects/vs2010/Debug
./projects/vs2010/ipch
=== added file 'packaging/README.txt'
--- packaging/README.txt 1970-01-01 00:00:00 +0000
+++ packaging/README.txt 2013-06-02 11:17:26 +0000
@@ -0,0 +1,25 @@
+This directory helps package a plugin into a .dcext file. The "Plugin format (dcext).txt" file in
+the "doc" directory contains more information about the process.
+
+The "packager" directory contains a helper script that generates an info.xml template to be used as
+a base for the final info.xml which will be included in the .dcext archive.
+
+Building the project should create an info_generated.xml file in this directory. Here follows the
+comment block it will contain.
+
+---
+
+This file is an example info.xml to be included in the dcext package. For more
+information, read "Plugin format (dcext).txt" in the "doc" directory.
+
+This file has been generated using the information filled in the src/version.h file.
+
+Edit the <Plugin> tags to include your plugin files.
+If you support Windows, include pe-x64 and pe-x86 platforms.
+If you support Linux, include elf-x64 and elf-x86 platforms.
+
+The <Files> tag is empty; should you want to distribute additional files, include them
+in there within <File> tags (again, more information in the above doc file).
+
+When you are done editing this file, rename it to "info.xml", move the relevant files
+to this directory and zip them; rename that .zip to .dcext and you are done!
=== modified file 'pluginsdk/UI.cpp'
--- pluginsdk/UI.cpp 2013-05-13 17:27:19 +0000
+++ pluginsdk/UI.cpp 2013-06-02 11:17:26 +0000
@@ -46,6 +46,13 @@
commands.erase(name);
}
+void UI::clearCommands() {
+ for(auto i = commands.cbegin(), iend = commands.cend(); i != iend; ++i) {
+ ui->remove_command(guid.c_str(), i->first.c_str());
+ }
+ commands.clear();
+}
+
void DCAPI UI::commandCallback(const char* name) {
commands[name].first();
}
=== modified file 'pluginsdk/UI.h'
--- pluginsdk/UI.h 2013-05-13 17:27:19 +0000
+++ pluginsdk/UI.h 2013-06-02 11:17:26 +0000
@@ -44,6 +44,7 @@
typedef function<void ()> Command;
static void addCommand(string name, Command command, string icon);
static void removeCommand(const string& name);
+ static void clearCommands();
private:
static void DCAPI commandCallback(const char* name);
@@ -51,6 +52,8 @@
static DCUIPtr ui;
static string guid;
+
+ // command name -> pair<callback, icon>
static unordered_map<string, pair<UI::Command, string>> commands;
};