← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcpp-plugin-sdk-cpp/ChatPlugin] Rev 19: add notifications

 

Merge authors:
  poy (poy)
------------------------------------------------------------
revno: 19 [merge]
committer: poy <poy@xxxxxxxxxx>
branch nick: ChatPlugin
timestamp: Sun 2013-04-28 23:14:38 +0200
message:
  add notifications
modified:
  .bzrignore
  pluginsdk/PluginDefs.h
  projects/make/Makefile
  src/Plugin.cpp
  src/Rule.cpp
  src/Rule.h
  src/RuleDlg.cpp


--
lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/ChatPlugin
https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/ChatPlugin

Your team Dcplusplus-team is subscribed to branch lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/ChatPlugin.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/ChatPlugin/+edit-subscription
=== modified file '.bzrignore'
--- .bzrignore	2013-02-05 19:19:23 +0000
+++ .bzrignore	2013-04-28 21:08:26 +0000
@@ -12,7 +12,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-04-28 21:08:26 +0000
@@ -449,6 +449,7 @@
 	void		(DCAPI *remove_command)				(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 'projects/make/Makefile'
--- projects/make/Makefile	2013-04-28 20:34:59 +0000
+++ projects/make/Makefile	2013-04-28 21:14:38 +0000
@@ -35,7 +35,9 @@
 	src/RuleDlg.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 \
@@ -46,7 +48,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-28 20:34:59 +0000
+++ src/Plugin.cpp	2013-04-28 21:14:38 +0000
@@ -145,6 +145,7 @@
 		rule.font = Config::getConfig(conf("Font").c_str());
 		rule.replacement = Config::getConfig(conf("Replacement").c_str());
 		rule.sound = Config::getConfig(conf("Sound").c_str());
+		rule.notification = Config::getConfig(conf("Notification").c_str());
 
 		rule.refresh();
 
@@ -172,6 +173,7 @@
 		Config::setConfig(conf("Font").c_str(), rule.font);
 		Config::setConfig(conf("Replacement").c_str(), rule.replacement);
 		Config::setConfig(conf("Sound").c_str(), rule.sound);
+		Config::setConfig(conf("Notification").c_str(), rule.notification);
 
 		++counter;
 	}

=== modified file 'src/Rule.cpp'
--- src/Rule.cpp	2013-04-28 20:34:59 +0000
+++ src/Rule.cpp	2013-04-28 21:14:38 +0000
@@ -184,6 +184,8 @@
 			UI::handle()->play_sound(sound.c_str());
 		}
 
-		// TODO notify
+		if(!notification.empty()) {
+			UI::handle()->notify(PLUGIN_NAME, notification.c_str());
+		}
 	}
 }

=== modified file 'src/Rule.h'
--- src/Rule.h	2013-04-28 20:34:59 +0000
+++ src/Rule.h	2013-04-28 21:14:38 +0000
@@ -57,6 +57,7 @@
 	string replacement;
 
 	string sound;
+	string notification;
 
 private:
 	boost::regex regex;

=== modified file 'src/RuleDlg.cpp'
--- src/RuleDlg.cpp	2013-04-28 20:34:59 +0000
+++ src/RuleDlg.cpp	2013-04-28 21:14:38 +0000
@@ -54,7 +54,7 @@
 }
 
 int RuleDlg::run() {
-	create(Seed(dwt::Point(500, 400)));
+	create(Seed(dwt::Point(600, 500)));
 	return show();
 }
 
@@ -63,7 +63,7 @@
 }
 
 bool RuleDlg::handleInitDialog() {
-	grid = addChild(Grid::Seed(9, 1));
+	grid = addChild(Grid::Seed(10, 1));
 	grid->column(0).mode = GridInfo::FILL;
 	grid->setSpacing(6);
 
@@ -197,6 +197,11 @@
 	}
 
 	{
+		auto box = grid->addChild(GroupBox::Seed(_T("Notification message")))->addChild(TextBox::Seed(Util::toT(rule.notification)));
+		box->onUpdated([this, box] { rule.notification = Util::fromT(box->getText()); });
+	}
+
+	{
 		auto cur = grid->addChild(Grid::Seed(1, 2));
 		cur->column(0).mode = GridInfo::FILL;
 		cur->column(0).align = GridInfo::BOTTOM_RIGHT;