← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3009: remove the debug tab (use the dev plugin instead)

 

------------------------------------------------------------
revno: 3009
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2012-07-20 15:55:11 +0200
message:
  remove the debug tab (use the dev plugin instead)
removed:
  dcpp/DebugManager.h
  res/Debug.ico
  win32/DebugFrame.cpp
  win32/DebugFrame.h
modified:
  changelog.txt
  dcpp/Client.cpp
  dcpp/DCPlusPlus.cpp
  dcpp/UserConnection.cpp
  win32/DCPlusPlus.rc
  win32/MainWindow.cpp


--
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	2012-07-12 20:49:11 +0000
+++ changelog.txt	2012-07-20 13:55:11 +0000
@@ -14,7 +14,6 @@
 * Do not automatch queue for bad/removed sources (emtee)
 * Minor DL queue tab fixes (poy)
 * Replace the slot up-down control by a context menu (poy)
-* [L#733381] Add protocol debug window (bigmuscle, iceman50)
 * [L#745162] Fix upload log format for partial lists (emtee)
 * Fix GUI problems in a download attempt of a public hublist with invalid address (emtee)
 * Fix unsuccessful HTTP redirections (emtee)

=== modified file 'dcpp/Client.cpp'
--- dcpp/Client.cpp	2012-07-01 18:41:13 +0000
+++ dcpp/Client.cpp	2012-07-20 13:55:11 +0000
@@ -22,7 +22,6 @@
 #include "BufferedSocket.h"
 #include "ClientManager.h"
 #include "ConnectivityManager.h"
-#include "DebugManager.h"
 #include "FavoriteManager.h"
 #include "TimerManager.h"
 #include "UserMatchManager.h"
@@ -136,7 +135,6 @@
 
 	updateActivity();
 	sock->write(aMessage, aLen);
-	COMMAND_DEBUG(aMessage, DebugManager::HUB_OUT, getIpPort());
 }
 
 HubData* Client::getPluginObject() noexcept {
@@ -246,7 +244,6 @@
 
 void Client::on(Line, const string& aLine) noexcept {
 	updateActivity();
-	COMMAND_DEBUG(aLine, DebugManager::HUB_IN, getIpPort());
 }
 
 void Client::on(Second, uint64_t aTick) noexcept {

=== modified file 'dcpp/DCPlusPlus.cpp'
--- dcpp/DCPlusPlus.cpp	2012-07-07 16:11:11 +0000
+++ dcpp/DCPlusPlus.cpp	2012-07-20 13:55:11 +0000
@@ -24,7 +24,6 @@
 #include "ConnectionManager.h"
 #include "ConnectivityManager.h"
 #include "CryptoManager.h"
-#include "DebugManager.h"
 #include "DownloadManager.h"
 #include "FavoriteManager.h"
 #include "FinishedManager.h"
@@ -85,7 +84,6 @@
 	UserMatchManager::newInstance();
 	WindowManager::newInstance();
 	PluginManager::newInstance();
-	DebugManager::newInstance();
 
 	SettingsManager::getInstance()->load();
 
@@ -145,7 +143,6 @@
 	SettingsManager::getInstance()->save();
 
 	PluginManager::deleteInstance();
-	DebugManager::deleteInstance();
 	WindowManager::deleteInstance();
 	UserMatchManager::deleteInstance();
 	GeoManager::deleteInstance();

=== removed file 'dcpp/DebugManager.h'
--- dcpp/DebugManager.h	2012-06-21 18:52:47 +0000
+++ dcpp/DebugManager.h	1970-01-01 00:00:00 +0000
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2001-2012 Jacek Sieka, arnetheduck on gmail point com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#if !defined DCPLUSPLUS_DCPP_DEBUGMANAGER_H
-#define DCPLUSPLUS_DCPP_DEBUGMANAGER_H
-
-#pragma once
-
-#include "DCPlusPlus.h"
-#include "Singleton.h"
-#include "TimerManager.h"
-
-namespace dcpp {
-
-class DebugManagerListener {
-public:
-template<int I>	struct X { enum { TYPE = I };  };
-
-	typedef X<0> DebugCommand;
-
-	virtual void on(DebugCommand, const string&, int, const string&) noexcept { }
-
-};
-
-class DebugManager : public Singleton<DebugManager>, public Speaker<DebugManagerListener>
-{
-	friend class Singleton<DebugManager>;
-	DebugManager() { };
-public:
-	void SendCommandMessage(const string& mess, int cmdType, const string& ip) {
-		fire(DebugManagerListener::DebugCommand(), mess, cmdType, ip);
-	}
-	~DebugManager() { };
-	enum {
-		HUB_IN, HUB_OUT, CLIENT_IN, CLIENT_OUT
-	};
-};
-#define COMMAND_DEBUG(a,b,c) DebugManager::getInstance()->SendCommandMessage(a,b,c);
-
-} // namespace dcpp
-
-#endif // !defined(DEBUG_MANAGER_H)

=== modified file 'dcpp/UserConnection.cpp'
--- dcpp/UserConnection.cpp	2012-07-01 18:41:13 +0000
+++ dcpp/UserConnection.cpp	2012-07-20 13:55:11 +0000
@@ -27,7 +27,6 @@
 #include "format.h"
 #include "SettingsManager.h"
 #include "PluginManager.h"
-#include "DebugManager.h"
 
 namespace dcpp {
 
@@ -49,8 +48,6 @@
 
 void UserConnection::on(BufferedSocketListener::Line, const string& aLine) noexcept {
 
-	COMMAND_DEBUG(aLine, DebugManager::CLIENT_IN, getRemoteIp());
-
 	if(aLine.length() < 2) {
 		fire(UserConnectionListener::ProtocolError(), this, _("Invalid data"));
 		return;
@@ -282,7 +279,6 @@
 		return;
 
 	lastActivity = GET_TICK();
-	COMMAND_DEBUG(aString, DebugManager::CLIENT_OUT, getRemoteIp());
 	socket->write(aString);
 }
 

=== removed file 'res/Debug.ico'
Binary files res/Debug.ico	2012-05-15 20:17:06 +0000 and res/Debug.ico	1970-01-01 00:00:00 +0000 differ
=== modified file 'win32/DCPlusPlus.rc'
--- win32/DCPlusPlus.rc	2012-07-01 18:41:13 +0000
+++ win32/DCPlusPlus.rc	2012-07-20 13:55:11 +0000
@@ -93,7 +93,6 @@
 IDI_SOUND               ICON                    "res/Sound.ico"
 IDI_ULIMIT				ICON					"res/ULimit.ico"
 IDI_DLIMIT				ICON					"res/DLimit.ico"
-IDI_DEBUG				ICON					"res/Debug.ico"
 IDI_PLUGINS			ICON					"res/Plugins.ico"
 /////////////////////////////////////////////////////////////////////////////
 //

=== removed file 'win32/DebugFrame.cpp'
--- win32/DebugFrame.cpp	2012-06-21 18:52:47 +0000
+++ win32/DebugFrame.cpp	1970-01-01 00:00:00 +0000
@@ -1,271 +0,0 @@
-/*
- * Copyright (C) 2001-2012 Jacek Sieka, arnetheduck on gmail point com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include "stdafx.h"
-
-#include "DebugFrame.h"
-
-#include <dcpp/ClientManager.h>
-#include <dcpp/File.h>
-
-#include <dwt/widgets/Grid.h>
-#include <dwt/widgets/Button.h>
-
-#include "HoldRedraw.h"
-#include "ShellMenu.h"
-#include "WinUtil.h"
-
-#define IDH_DEBUG_FRAME 0
-
-using dwt::Grid;
-using dwt::GridInfo;
-
-
-const string DebugFrame::id = "DebugMessages";
-const string& DebugFrame::getId() const { return id; }
-
-DebugFrame::DebugFrame(TabViewPtr parent) :
-BaseType(parent, T_("Debug Messages"), IDH_DEBUG_FRAME, IDI_DEBUG, false),
-grid(0),
-debug(0),
-clientMsg(0),
-hubMsg(0),
-filterHub(0),
-showClientMsg(true),
-showHubMsg(true),
-filterByHub(false),
-hubs(0)
-{
-	grid = addChild(Grid::Seed(2, 5));
-	grid->column(0).mode = GridInfo::FILL;
-	grid->column(1).mode = GridInfo::FILL;
-	grid->column(2).mode = GridInfo::FILL;
-	grid->column(3).mode = GridInfo::FILL;
-	grid->column(4).mode = GridInfo::FILL;
-	grid->row(0).mode = GridInfo::FILL;
-	grid->row(0).align = GridInfo::STRETCH;
-
-	{
-		TextBox::Seed seed = WinUtil::Seeds::textBox;
-		seed.style |= WS_VSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL | ES_READONLY | ES_SUNKEN;
-		debug = grid->addChild(seed);
-		grid->setWidget(debug, 0, 0, 1, 5);
-		debug->setTextLimit(1024*64*5);
-		addWidget(debug);
-
-		debug->onKeyDown([this](int c) { return handleKeyDown(c); });
-	}
-	
-	{
-		ButtonPtr button;
-		Button::Seed cs = WinUtil::Seeds::button;
-		
-		cs.caption = T_("&Clear");
-		button = grid->addChild(cs);
-		button->onClicked([this] { clearMessages(); });
-		addWidget(button);
-		
-		CheckBox::Seed cb = WinUtil::Seeds::checkBox;
-		
-		cb.caption = T_("Show client messages");
-		clientMsg = grid->addChild(cb);
-		clientMsg->setChecked(showClientMsg);
-		clientMsg->onClicked([this] { handleClientMsg(); });
-		
-		cb.caption = T_("Show hub messages");
-		hubMsg = grid->addChild(cb);
-		hubMsg->setChecked(showHubMsg);
-		hubMsg->onClicked([this] { handleHubMsg(); });
-		
-		cb.caption = T_("Filter by hub");
-		filterHub = grid->addChild(cb);
-		filterHub->setChecked(filterByHub);
-		filterHub->onClicked([this] { handleFilterHub(); });
-
-		ComboBox::Seed cbSeed = WinUtil::Seeds::comboBox;
-		hubs = grid->addChild(cbSeed);
-		addWidget(hubs);
-
-	}
-
-	initStatus();
-
-	layout();
-	activate();
-
-	ClientManager* clientMgr = ClientManager::getInstance();
-	{
-		auto lock = clientMgr->lock();
-		clientMgr->addListener(this);
-		auto& clients = clientMgr->getClients();
-		for(auto client: clients) {
-			if(!client->isConnected())
-				continue;
-
-			onHubAdded(new HubInfo(client));
-		}
-	}
-	
-	updateStatus();
-
-	DebugManager::getInstance()->addListener(this);	
-}
-
-DebugFrame::~DebugFrame() {
-}
-
-void DebugFrame::layout() {
-	dwt::Rectangle r(this->getClientSize());
-
-	r.size.y -= status->refresh();
-
-	grid->resize(r);	
-}
-
-void DebugFrame::updateStatus() {	
-	
-	if(showClientMsg) {
-		status->setText(STATUS_CLIENT, T_("Showing client debug messages"));
-    } else {
-		status->setText(STATUS_CLIENT, T_("Client debug messages are disabled"));
-	}
-
-	if(showHubMsg) {
-		status->setText(STATUS_HUB, T_("Showing hub debug messages"));
-	} else {
-		status->setText(STATUS_HUB, T_("Hub debug messages are disabled"));
-	}
-	
-	if(filterByHub) {
-		status->setText(STATUS_HUB_ADDRESS, T_("Hub address filtering is enabled"));
-	} else {
-		status->setText(STATUS_HUB_ADDRESS, T_("Hub address filtering is disabled"));
-	}
-}
-
-void DebugFrame::addLine(const string& msg) {
-	cmdList.push_back(msg);
-	
-	auto x = Util::emptyString;
-	{		
-		if(cmdList.empty())
-			return;
-			
-		x = cmdList.front();
-		cmdList.pop_front();
-	}
-	
-	bool scroll = debug->scrollIsAtEnd();
-
-	debug->addText(Text::toT("\r\n[" + Util::getTimeString() + "] " + msg));
-
-	if(scroll)
-		debug->scrollToBottom();
-
-	setDirty(SettingsManager::BOLD_SYSTEM_LOG);
-}
-
-bool DebugFrame::preClosing() {
-	ClientManager::getInstance()->removeListener(this);
-	DebugManager::getInstance()->removeListener(this);	
-		
-	return true;
-}
-
-void DebugFrame::clearMessages() { 
-	debug->setSelection();
-	debug->replaceSelection(_T(""));
-}
-
-void DebugFrame::handleClientMsg() {
-	showClientMsg = clientMsg->getChecked();
-	updateStatus();
-}
-
-void DebugFrame::handleHubMsg() {
-	showHubMsg = hubMsg->getChecked();
-	updateStatus();
-}
-
-void DebugFrame::handleFilterHub() {
-	filterByHub = filterHub->getChecked();
-	updateStatus();	
-}
-
-bool DebugFrame::handleKeyDown(int c) {
-	switch(c) {
-	case VK_DELETE:
-		clearMessages();
-		return true;
-	}
-	return false;
-}
-
-void DebugFrame::on(ClientConnected, Client* c) noexcept {
-	auto hi = new HubInfo(c);
-	callAsync([=] { onHubAdded(hi); });
-}
-
-void DebugFrame::on(ClientDisconnected, Client* c) noexcept {
-	auto hi = new HubInfo(c);
-	callAsync([=] { onHubRemoved(hi); });
-}
-
-void DebugFrame::onHubAdded(HubInfo* info) {
-	hubs->addValue(info->ip);
-}
-
-void DebugFrame::onHubRemoved(HubInfo* info) {
-	auto idx = hubs->findString(info->ip);
-	hubs->erase(idx);
-}
-
-void DebugFrame::on(DebugCommand, const string& aLine, int cmdType, const string& ip) noexcept {
-	auto url = hubs->getText();
-	switch(cmdType) {
-		case DebugManager::HUB_IN:
-			if(!showHubMsg)
-				return;
-			if(!filterByHub || Text::toT(ip) == url) {
-				callAsync([=] { addLine("From Hub:\t\t<" + ip + ">\t \t" + aLine); });
-			}
-			break;
-		case DebugManager::HUB_OUT:
-			if(!showHubMsg)
-				return;
-			if(!filterByHub || Text::toT(ip) == url) {
-				callAsync([=] { addLine("To Hub:\t\t<" + ip + ">\t \t" + aLine); });
-			}
-			break;
-		case DebugManager::CLIENT_IN:
-			if(!showClientMsg)
-				return;
-			if(!filterByHub || Text::toT(ip) == url) {
-				callAsync([=] { addLine("From Client:\t\t<" + ip + ">\t \t" + aLine); });
-			}
-			break;
-		case DebugManager::CLIENT_OUT:
-			if(!showClientMsg)
-				return;
-			if(!filterByHub || Text::toT(ip) == url) {
-				callAsync([=] { addLine("To Client:\t\t<" + ip + ">\t \t" + aLine); });
-			}
-			break;
-		default: dcassert(0);
-	}
-}

=== removed file 'win32/DebugFrame.h'
--- win32/DebugFrame.h	2012-06-21 18:52:47 +0000
+++ win32/DebugFrame.h	1970-01-01 00:00:00 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2001-2012 Jacek Sieka, arnetheduck on gmail point com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef DCPLUSPLUS_WIN32_DEBUG_FRAME_H
-#define DCPLUSPLUS_WIN32_DEBUG_FRAME_H
-
-#include <dcpp/Client.h>
-#include <dcpp/ClientManagerListener.h>
-#include <dcpp/DebugManager.h>
-
-#include <deque>
-
-#include "StaticFrame.h"
-
-using std::deque;
-
-class DebugFrame : public StaticFrame<DebugFrame>,
-	private DebugManagerListener,
-	private ClientManagerListener
-{
-	typedef StaticFrame<DebugFrame> BaseType;
-public:
-	enum Status {
-		STATUS_STATUS,
-		STATUS_CLIENT,		
-		STATUS_HUB,
-		STATUS_HUB_ADDRESS,
-		STATUS_LAST
-	};
-	
-	static const string id;
-	const string& getId() const;
-	
-private:
-	deque<string> cmdList;
-
-	struct HubInfo : public FastAlloc<HubInfo> {
-		HubInfo(const tstring& aIp) : ip(aIp) { }
-		HubInfo(Client* client) : ip(Text::toT(client->getIpPort())) { }
-
-		tstring ip;
-	};
-
-	friend class StaticFrame<DebugFrame>;
-	friend class MDIChildFrame<DebugFrame>;
-
-	GridPtr grid;
-	
-	TextBoxPtr debug;
-	
-	CheckBoxPtr clientMsg, hubMsg, filterHub;
-	bool showClientMsg, showHubMsg, filterByHub;
-
-	ComboBoxPtr hubs;
-	
-	DebugFrame(TabViewPtr parent);
-	virtual ~DebugFrame();
-
-	void layout();
-	void updateStatus();
-	
-	void addLine(const string& msg);
-	
-	bool preClosing();
-	
-	void clearMessages();
-	void handleClientMsg();
-	void handleHubMsg();
-	void handleFilterHub();
-
-	bool handleKeyDown(int c);
-	
-	// ClientManagerListener
-	virtual void on(ClientConnected, Client* c) noexcept;
-	virtual void on(ClientDisconnected, Client* c) noexcept;
-
-	void onHubAdded(HubInfo* info);
-	void onHubRemoved(HubInfo* info);
-
-	// DebugManagerListener
-	virtual void on(DebugManagerListener::DebugCommand, const string& aLine, int cmdType, const string& ip) noexcept;
-
-};
-
-#endif

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2012-07-13 18:50:28 +0000
+++ win32/MainWindow.cpp	2012-07-20 13:55:11 +0000
@@ -79,7 +79,6 @@
 #include "StatsFrame.h"
 #include "SystemFrame.h"
 #include "UsersFrame.h"
-#include "DebugFrame.h"
 
 #ifdef HAVE_HTMLHELP_H
 #include <htmlhelp.h>
@@ -340,8 +339,6 @@
 			[this] { NotepadFrame::openWindow(getTabView()); }, WinUtil::menuIcon(IDI_NOTEPAD));
 		viewIndexes[SystemFrame::id] = viewMenu->appendItem(T_("System Log"),
 			[this] { SystemFrame::openWindow(getTabView()); });
-		viewIndexes[DebugFrame::id] = viewMenu->appendItem(T_("Debug Messages"),
-			[this] { DebugFrame::openWindow(getTabView()); }, WinUtil::menuIcon(IDI_DEBUG));
 		viewIndexes[StatsFrame::id] = viewMenu->appendItem(T_("Network Statistics"),
 			[this] { StatsFrame::openWindow(getTabView()); }, WinUtil::menuIcon(IDI_NET_STATS));
 		viewMenu->appendItem(T_("Indexing progress"), [this] { handleHashProgress(); }, WinUtil::menuIcon(IDI_INDEXING));
@@ -1769,6 +1766,5 @@
 	compare_id(SystemFrame);
 	compare_id(StatsFrame);
 	compare_id(TextFrame);
-	compare_id(DebugFrame);
 #undef compare_id
 }