Merge authors: poy (poy) ------------------------------------------------------------ revno: 26 [merge] committer: poy <p...@123gen.com> branch nick: DevPlugin timestamp: Mon 2013-05-13 19:40:32 +0200 message: merge modified: .bzrignore pluginsdk/PluginDefs.h pluginsdk/UI.cpp pluginsdk/UI.h projects/make/Makefile src/Plugin.cpp src/Plugin.h
-- lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/DevPlugin https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/DevPlugin Your team Dcplusplus-team is subscribed to branch lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/DevPlugin. To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/DevPlugin/+edit-subscription
=== modified file '.bzrignore' --- .bzrignore 2013-04-26 15:33:58 +0000 +++ .bzrignore 2013-05-13 17:40:32 +0000 @@ -14,7 +14,7 @@ ./doc/build.bat ./doc/html ./doc/latex -./projects/make/build +./projects/make/build* ./projects/vs2010/Debug ./projects/vs2010/ipch ./projects/vs2010/Release === modified file 'pluginsdk/PluginDefs.h' --- pluginsdk/PluginDefs.h 2013-04-23 18:12:02 +0000 +++ pluginsdk/PluginDefs.h 2013-05-13 17:18:05 +0000 @@ -444,11 +444,12 @@ /* Add a command identified by "name". "icon" is optional; it is the path to an icon file used to illustrate the command. */ - void (DCAPI *add_command) (const char* name, DCCommandFunc command, const char* icon); + void (DCAPI *add_command) (const char* guid, const char* name, DCCommandFunc command, const char* icon); /* Remove a command previously added with add_command. */ - void (DCAPI *remove_command) (const char* name); + void (DCAPI *remove_command) (const char* guid, const char* name); void (DCAPI *play_sound) (const char* path); + void (DCAPI *notify) (const char* title, const char* message); } DCUI, *DCUIPtr; #ifdef __cplusplus === modified file 'pluginsdk/UI.cpp' --- pluginsdk/UI.cpp 2013-04-23 18:12:02 +0000 +++ pluginsdk/UI.cpp 2013-05-13 17:27:19 +0000 @@ -25,23 +25,24 @@ namespace dcapi { DCUIPtr UI::ui; +string UI::guid; unordered_map<string, pair<UI::Command, string>> UI::commands; -bool UI::init() { +bool UI::init(string pluginGuid) { if(!Core::handle()) { return false; } - init(reinterpret_cast<DCUIPtr>(Core::handle()->query_interface(DCINTF_DCPP_UI, DCINTF_DCPP_UI_VER))); + init(reinterpret_cast<DCUIPtr>(Core::handle()->query_interface(DCINTF_DCPP_UI, DCINTF_DCPP_UI_VER)), move(pluginGuid)); return ui; } -void UI::init(DCUIPtr coreUI) { ui = coreUI; } +void UI::init(DCUIPtr coreUI, string pluginGuid) { ui = coreUI; guid = move(pluginGuid); } DCUIPtr UI::handle() { return ui; } void UI::addCommand(string name, Command command, string icon) { const auto& iter = commands.insert(std::make_pair(move(name), std::make_pair(command, move(icon)))).first; - ui->add_command(iter->first.c_str(), commandCallback, iter->second.second.c_str()); + ui->add_command(guid.c_str(), iter->first.c_str(), commandCallback, iter->second.second.c_str()); } void UI::removeCommand(const string& name) { - ui->remove_command(name.c_str()); + ui->remove_command(guid.c_str(), name.c_str()); commands.erase(name); } === modified file 'pluginsdk/UI.h' --- pluginsdk/UI.h 2013-04-23 18:12:02 +0000 +++ pluginsdk/UI.h 2013-05-13 17:27:19 +0000 @@ -37,8 +37,8 @@ class UI { public: - static bool init(); - static void init(DCUIPtr coreUI); + static bool init(string pluginGuid); + static void init(DCUIPtr coreUI, string pluginGuid); static DCUIPtr handle(); typedef function<void ()> Command; @@ -50,6 +50,7 @@ static DCUIPtr ui; + static string guid; static unordered_map<string, pair<UI::Command, string>> commands; }; === modified file 'projects/make/Makefile' --- projects/make/Makefile 2013-05-05 13:49:41 +0000 +++ projects/make/Makefile 2013-05-13 17:40:32 +0000 @@ -32,7 +32,9 @@ src/Plugin.o \ src/stdafx.o -ifeq ($(findstring mingw, $(shell gcc -dumpmachine)),) +COMPILER_SPEC = $(shell $(CC) -dumpmachine) + +ifeq ($(findstring mingw, $(COMPILER_SPEC)),) LIBEXT = .so else CPPFLAGS += -D_WIN32_WINNT=0x502 -DWINVER=0x502 -D_WIN32_IE=0x600 \ @@ -43,7 +45,7 @@ OUTPUT_DIR := $(OUTPUT_DIR)-mingw endif -ifeq ($(findstring x86_64, $(shell gcc -dumpmachine)),) +ifeq ($(findstring x86_64, $(COMPILER_SPEC)),) CPPFLAGS += -march=i686 OUTPUT_DIR := $(OUTPUT_DIR)-x86 else === modified file 'src/Plugin.cpp' --- src/Plugin.cpp 2013-04-25 18:35:22 +0000 +++ src/Plugin.cpp 2013-05-13 17:40:32 +0000 @@ -45,10 +45,6 @@ Plugin::~Plugin() { clearHooks(); - - if(UI::handle()) { - UI::removeCommand(commandName); - } } Plugin* instance; @@ -97,27 +93,19 @@ gui.create(); addHooks(); Config::setConfig("Enabled", true); - refreshSwitchCommand(); } void Plugin::close() { Config::setConfig("Enabled", false); clearHooks(); gui.close(); - refreshSwitchCommand(); -} - -void Plugin::refreshSwitchCommand() { - UI::removeCommand(commandName); - commandName = Hooks::empty() ? PLUGIN_NAME ": enable" : PLUGIN_NAME ": disable"; - UI::addCommand(commandName, [this] { onSwitched(); }, Config::getInstallPath() + "DevPlugin.ico"); } bool Plugin::onLoad(DCCorePtr core, bool install) { /* Initialization phase. Initiate additional interfaces that you may have included from the plugin SDK. */ Core::init(core); - if(!Config::init(PLUGIN_GUID) || !Connections::init() || !Hooks::init() || !Hubs::init() || !Logger::init() || !UI::init() || !Util::init()) { + if(!Config::init(PLUGIN_GUID) || !Connections::init() || !Hooks::init() || !Hubs::init() || !Logger::init() || !UI::init(PLUGIN_GUID) || !Util::init()) { return false; } @@ -131,8 +119,6 @@ // Start the plugin logic here; add hooks with functions from the Hooks interface. if(Config::getBoolConfig("Enabled")) { start(); - } else { - refreshSwitchCommand(); } return true; === modified file 'src/Plugin.h' --- src/Plugin.h 2013-01-29 18:42:08 +0000 +++ src/Plugin.h 2013-05-13 17:40:32 +0000 @@ -40,8 +40,6 @@ void start(); void close(); - void refreshSwitchCommand(); - bool onLoad(DCCorePtr core, bool install); void onSwitched(); bool onHubDataIn(HubDataPtr hHub, char* message);
_______________________________________________ Mailing list: https://launchpad.net/~linuxdcpp-team Post to : linuxdcpp-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~linuxdcpp-team More help : https://help.launchpad.net/ListHelp