← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3286: Toolbar button to access plugin commands

 

------------------------------------------------------------
revno: 3286
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sun 2013-05-05 14:36:15 +0200
message:
  Toolbar button to access plugin commands
modified:
  changelog.txt
  dcpp/SettingsManager.cpp
  dcpp/version.h
  help/window_main.html
  win32/DCPlusPlus.rc
  win32/MainWindow.cpp
  win32/MainWindow.h


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt	2013-04-22 22:31:37 +0000
+++ changelog.txt	2013-05-05 12:36:15 +0000
@@ -9,6 +9,7 @@
 * Support city-level GeoIP databases - new params such as %[city] (poy)
 * Distribute an x64 version
 * Package plugins as .dcext files (poy)
+* Toolbar button to access plugin commands (poy)
 
 -- 0.811 2013-03-04 --
 * Fix status bar parts when the window is too small (poy)

=== modified file 'dcpp/SettingsManager.cpp'
--- dcpp/SettingsManager.cpp	2013-04-22 22:31:37 +0000
+++ dcpp/SettingsManager.cpp	2013-05-05 12:36:15 +0000
@@ -491,10 +491,6 @@
 			// These were remade completely...
 			unset(USERSFRAME_ORDER);
 			unset(USERSFRAME_WIDTHS);
-
-			// the id has changed
-			if(isSet[TOOLBAR])
-				Util::replace("FavUsers", "Users", strSettings[TOOLBAR - STR_FIRST]);
 		}
 
 		if(v <= 0.791) {
@@ -504,17 +500,14 @@
 			}
 		}
 
-		if(v <= 0.802) {
-			// added an "open own file list" button; let's see if we can squeeze it next to "open file list"...
-			if(isSet[TOOLBAR])
-				Util::replace("OpenFL", "OpenFL,OpenOwnFL", strSettings[TOOLBAR - STR_FIRST]);
-		}
-
-		if(v <= 0.811) {
+		if(v < 0.820) {
 			// reset search columns
 			unset(SEARCHFRAME_ORDER);
 			unset(SEARCHFRAME_WIDTHS);
 			unset(SEARCHFRAME_SORT);
+
+			// reset the toolbar (new buttons).
+			unset(TOOLBAR);
 		}
 
 		if(SETTING(SET_MINISLOT_SIZE) < 512)

=== modified file 'dcpp/version.h'
--- dcpp/version.h	2013-03-18 18:26:38 +0000
+++ dcpp/version.h	2013-05-05 12:36:15 +0000
@@ -21,8 +21,8 @@
 #define APPNAME "DC++"
 
 // don't forget to update the .rc file as well!
-#define VERSIONSTRING "0.819"
-#define VERSIONFLOAT 0.819
+#define VERSIONSTRING "0.820"
+#define VERSIONFLOAT 0.820
 
 namespace dcpp {
 extern const std::string fullVersionString;

=== modified file 'help/window_main.html'
--- help/window_main.html	2013-01-24 22:53:46 +0000
+++ help/window_main.html	2013-05-05 12:36:15 +0000
@@ -215,6 +215,7 @@
 <a href="#tb_refresh" title="Refresh file list"><img src="Refresh.ico" width="20" height="20" alt="Refresh file list"/></a>
 <a href="#tb_settings" title="Settings"><img src="Settings.ico" width="20" height="20" alt="Settings"/></a>
 <a href="window_notepad.html" title="Notepad"><img src="Notepad.ico" width="20" height="20" alt="Notepad"/></a>
+<a href="#tb_plugins" title="Plugins"><img src="Plugins.ico" width="20" height="20" alt="Plugins"/></a>
 <a href="#tb_whats_this" title="What's This?"><img src="WhatsThis.ico" width="20" height="20" alt="What's This?"/></a>
 </p>
 <p>The toolbar provides quick access to some regularly used parts and functions of DC++. You can customize the toolbar for yourself, 
@@ -285,6 +286,11 @@
     <dt>Notepad</dt>
 	<dd cshelp="IDH_TOOLBAR_NOTEPAD">Open the <placeholder><a href="window_notepad.html">Notepad</a></placeholder> window.</dd>
 
+	<dt id="#tb_plugins">Plugins</dt>
+	<dd cshelp="IDH_TOOLBAR_PLUGINS">
+	Open menus listing commands that installed plugins have registered.
+	</dd>
+
     <dt id="tb_whats_this">What's This?</dt>
     <dd cshelp="IDH_TOOLBAR_WHATS_THIS">
         You can get help on specific parts of DC++ by using the &quot;What's This?&quot; help button: click it once, and your mouse cursor will change into a help cursor; then click on the control you wish to get help for.

=== modified file 'win32/DCPlusPlus.rc'
--- win32/DCPlusPlus.rc	2013-03-18 18:26:38 +0000
+++ win32/DCPlusPlus.rc	2013-05-05 12:36:15 +0000
@@ -100,8 +100,8 @@
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,8,1,9
- PRODUCTVERSION 0,8,1,9
+ FILEVERSION 0,8,2,0
+ PRODUCTVERSION 0,8,2,0
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -118,12 +118,12 @@
         BEGIN
             VALUE "Comments", "http://dcplusplus.sourceforge.net";
             VALUE "FileDescription", "DC++"
-            VALUE "FileVersion", "0, 8, 1, 9"
+            VALUE "FileVersion", "0, 8, 2, 0"
             VALUE "InternalName", "DC++"
             VALUE "LegalCopyright", "Copyright 2001-2013 Jacek Sieka"
             VALUE "OriginalFilename", "DCPlusPlus.exe"
             VALUE "ProductName", "DC++"
-            VALUE "ProductVersion", "0, 8, 1, 9"
+            VALUE "ProductVersion", "0, 8, 2, 0"
         END
     END
     BLOCK "VarFileInfo"

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2013-04-23 17:41:14 +0000
+++ win32/MainWindow.cpp	2013-05-05 12:36:15 +0000
@@ -315,8 +315,8 @@
 		file->appendItem(T_("GeoIP database update"), [this] { updateGeo(); });
 		file->appendSeparator();
 
-		pluginMenu = file->appendPopup(T_("Plugins"));
-		refreshPluginMenu();
+		pluginMenu = file->appendPopup(T_("Plugins"), WinUtil::menuIcon(IDI_PLUGINS));
+		addPluginCommands(pluginMenu);
 		file->appendSeparator();
 
 		file->appendItem(T_("E&xit\tAlt+F4"), [this] { close(true); }, WinUtil::menuIcon(IDI_EXIT));
@@ -459,6 +459,8 @@
 		IDH_TOOLBAR_NOTEPAD, [this] { NotepadFrame::openWindow(getTabView()); });
 	toolbar->addButton("Refresh", WinUtil::toolbarIcon(IDI_REFRESH), 0, T_("Refresh file list"), false,
 		IDH_TOOLBAR_REFRESH, [this] { handleRefreshFileList(); });
+	toolbar->addButton("Plugins", WinUtil::toolbarIcon(IDI_PLUGINS), 0, T_("Plugins"), false,
+		IDH_TOOLBAR_PLUGINS, nullptr, [this](const dwt::ScreenCoordinate& pt) { handlePlugins(pt); });
 	toolbar->addButton("CSHelp", WinUtil::toolbarIcon(IDI_WHATS_THIS), 0, T_("What's This?"), false,
 		IDH_TOOLBAR_WHATS_THIS, [this] { handleWhatsThis(); });
 
@@ -490,6 +492,8 @@
 			"Settings" + comma +
 			NotepadFrame::id + comma +
 			comma +
+			"Plugins" + comma +
+			comma +
 			"CSHelp");
 	}
 	toolbar->setLayout(StringTokenizer<string>(SETTING(TOOLBAR), ',').getTokens());
@@ -661,7 +665,7 @@
 
 	if(WinUtil::mainWindow && !WinUtil::mainWindow->closing()) {
 		WinUtil::mainWindow->pluginMenu->clear();
-		WinUtil::mainWindow->refreshPluginMenu();
+		WinUtil::mainWindow->addPluginCommands(WinUtil::mainWindow->pluginMenu);
 	}
 }
 
@@ -674,14 +678,14 @@
 	if(WinUtil::mainWindow && !WinUtil::mainWindow->closing()) {
 		WinUtil::mainWindow->pluginMenu->remove(index + 1 /* account for the menu title */);
 		if(pluginCommands.empty()) {
-			WinUtil::mainWindow->refreshPluginMenu();
+			WinUtil::mainWindow->addPluginCommands(WinUtil::mainWindow->pluginMenu);
 		}
 	}
 }
 
-void MainWindow::refreshPluginMenu() {
+void MainWindow::addPluginCommands(Menu* menu) {
 	if(pluginCommands.empty()) {
-		pluginMenu->appendItem(T_("(No plugin command found)"), nullptr, nullptr, false);
+		menu->appendItem(T_("(No plugin command found)"), nullptr, nullptr, false);
 	} else {
 		for(auto& i: pluginCommands) {
 			dwt::IconPtr icon;
@@ -689,7 +693,7 @@
 				try { icon = new dwt::Icon(i.second.second, dwt::Point(16, 16)); }
 				catch(const dwt::DWTException&) { }
 			}
-			pluginMenu->appendItem(i.first, i.second.first, icon);
+			menu->appendItem(i.first, i.second.first, icon);
 		}
 	}
 }
@@ -808,6 +812,14 @@
 	}
 }
 
+void MainWindow::handlePlugins(const dwt::ScreenCoordinate& pt) {
+	auto menu = addChild(WinUtil::Seeds::menu);
+
+	addPluginCommands(menu.get());
+
+	menu->open(pt);
+}
+
 void MainWindow::fillLimiterMenu(Menu* menu, bool upload) {
 	const auto title = upload ? T_("Upload limit") : T_("Download limit");
 	const auto menuIcon = WinUtil::menuIcon(upload ? IDI_ULIMIT : IDI_DLIMIT);

=== modified file 'win32/MainWindow.h'
--- win32/MainWindow.h	2013-04-23 17:41:14 +0000
+++ win32/MainWindow.h	2013-05-05 12:36:15 +0000
@@ -169,6 +169,7 @@
 	void handleFavHubsDropDown(const dwt::ScreenCoordinate& pt);
 	void handleRecent(const dwt::ScreenCoordinate& pt);
 	void handleConfigureRecent(const string& id, const tstring& title);
+	void handlePlugins(const dwt::ScreenCoordinate& pt);
 	void handleLimiterMenu(bool upload);
 	void handleQuickConnect();
 	void handleConnectFavHubGroup();
@@ -211,7 +212,7 @@
 	void layout();
 	void updateStatus();
 	void updateAwayStatus();
-	void refreshPluginMenu();
+	void addPluginCommands(Menu* menu);
 	void showPortsError(const string& port);
 	void setSaveTimer();
 	void saveSettings();