|
From: <arn...@us...> - 2008-02-17 21:23:25
|
Revision: 1012
http://dcplusplus.svn.sourceforge.net/dcplusplus/?rev=1012&view=rev
Author: arnetheduck
Date: 2008-02-17 13:23:07 -0800 (Sun, 17 Feb 2008)
Log Message:
-----------
Cleanup
Modified Paths:
--------------
dcplusplus/trunk/changelog.txt
dcplusplus/trunk/dcpp/DownloadManager.cpp
dcplusplus/trunk/dcpp/Exception.h
dcplusplus/trunk/dcpp/QueueManager.cpp
dcplusplus/trunk/dcpp/QueueManager.h
dcplusplus/trunk/dcpp/UploadManager.cpp
dcplusplus/trunk/dcpp/UploadManager.h
dcplusplus/trunk/dcpp/UploadManagerListener.h
dcplusplus/trunk/win32/AboutDlg.cpp
dcplusplus/trunk/win32/MainWindow.cpp
dcplusplus/trunk/win32/PrivateFrame.h
dcplusplus/trunk/win32/TransferView.cpp
dcplusplus/trunk/win32/TransferView.h
dcplusplus/trunk/win32/WaitingUsersFrame.cpp
dcplusplus/trunk/win32/WaitingUsersFrame.h
Modified: dcplusplus/trunk/changelog.txt
===================================================================
--- dcplusplus/trunk/changelog.txt 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/changelog.txt 2008-02-17 21:23:07 UTC (rev 1012)
@@ -35,6 +35,7 @@
* [L#190955] Fixed 100% on remove all sources in queue
* Fixed a few hardcoded dc++'s (thanks steven sheehy)
* Don't always show the tray icon after killing and re-opening explorer.exe (poy)
+* Updated links (thanks pietry)
-- 0.704 2007-12-14 --
* Hub lists added to utilize Coral's distributed network (ullner)
Modified: dcplusplus/trunk/dcpp/DownloadManager.cpp
===================================================================
--- dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/dcpp/DownloadManager.cpp 2008-02-17 21:23:07 UTC (rev 1012)
@@ -447,7 +447,6 @@
aConn->disconnect();
}
-
void DownloadManager::removeDownload(Download* d) {
if(d->getFile()) {
if(d->getActual() > 0) {
Modified: dcplusplus/trunk/dcpp/Exception.h
===================================================================
--- dcplusplus/trunk/dcpp/Exception.h 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/dcpp/Exception.h 2008-02-17 21:23:07 UTC (rev 1012)
@@ -21,11 +21,14 @@
namespace dcpp {
-class Exception
+class Exception : std::exception
{
public:
Exception() { }
Exception(const string& aError) throw() : error(aError) { dcdrun(if(error.size()>0)) dcdebug("Thrown: %s\n", error.c_str()); }
+
+ virtual const char* what() const throw() { return getError().c_str(); }
+
virtual ~Exception() throw() { }
virtual const string& getError() const throw() { return error; }
protected:
Modified: dcplusplus/trunk/dcpp/QueueManager.cpp
===================================================================
--- dcplusplus/trunk/dcpp/QueueManager.cpp 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/dcpp/QueueManager.cpp 2008-02-17 21:23:07 UTC (rev 1012)
@@ -42,12 +42,6 @@
#undef ff
#endif
-#ifndef _WIN32
-#include <sys/types.h>
-#include <dirent.h>
-#include <fnmatch.h>
-#endif
-
namespace dcpp {
QueueItem* QueueManager::FileQueue::add(const string& aTarget, int64_t aSize,
@@ -235,7 +229,6 @@
}
void QueueManager::UserQueue::removeDownload(QueueItem* qi, const UserPtr& user) {
- // Remove the download from running
running.erase(user);
for(DownloadList::iterator i = qi->getDownloads().begin(); i != qi->getDownloads().end(); ++i) {
@@ -355,10 +348,9 @@
if(!BOOLSETTING(KEEP_LISTS)) {
string path = Util::getListPath();
StringList filelists = File::findFiles(path, "*.xml.bz2");
- StringList filelists2 = File::findFiles(path, "*.DcLst");
- filelists.insert(filelists.end(), filelists2.begin(), filelists2.end());
-
std::for_each(filelists.begin(), filelists.end(), &File::deleteFile);
+ filelists = File::findFiles(path, "*.DcLst");
+ std::for_each(filelists.begin(), filelists.end(), &File::deleteFile);
}
}
@@ -408,6 +400,7 @@
string target = Util::getListPath() + nick + aUser->getCID().toBase32();
if (!aInitialDir.empty()) {
+ Lock l(cs);
dirMap[aUser->getCID().toBase32()] = aInitialDir;
}
@@ -433,7 +426,7 @@
ConnectionManager::getInstance()->getDownloadConnection(aUser);
}
-void QueueManager::add(const string& aTarget, int64_t aSize, const TTHValue& root, UserPtr aUser,
+void QueueManager::add(const string& aTarget, int64_t aSize, const TTHValue& root, const UserPtr& aUser,
int aFlags /* = QueueItem::FLAG_RESUME */, bool addBad /* = true */) throw(QueueException, FileException)
{
bool wantConnection = true;
@@ -545,7 +538,7 @@
}
/** Add a source to an existing queue item */
-bool QueueManager::addSource(QueueItem* qi, UserPtr aUser, Flags::MaskType addBad) throw(QueueException, FileException) {
+bool QueueManager::addSource(QueueItem* qi, const UserPtr& aUser, Flags::MaskType addBad) throw(QueueException, FileException) {
bool wantConnection = (qi->getPriority() != QueueItem::PAUSED) && !userQueue.getRunning(aUser);
if(qi->isSource(aUser)) {
Modified: dcplusplus/trunk/dcpp/QueueManager.h
===================================================================
--- dcplusplus/trunk/dcpp/QueueManager.h 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/dcpp/QueueManager.h 2008-02-17 21:23:07 UTC (rev 1012)
@@ -73,7 +73,7 @@
{
public:
/** Add a file to the queue. */
- void add(const string& aTarget, int64_t aSize, const TTHValue& root, UserPtr aUser,
+ void add(const string& aTarget, int64_t aSize, const TTHValue& root, const UserPtr& aUser,
int aFlags = QueueItem::FLAG_RESUME, bool addBad = true) throw(QueueException, FileException);
/** Add a user's filelist to the queue. */
void addList(const UserPtr& aUser, int aFlags, const string& aInitialDir = Util::emptyString) throw(QueueException, FileException);
@@ -224,7 +224,7 @@
/** Sanity check for the target filename */
static string checkTarget(const string& aTarget, int64_t aSize, int& flags) throw(QueueException, FileException);
/** Add a source to an existing queue item */
- bool addSource(QueueItem* qi, UserPtr aUser, Flags::MaskType addBad) throw(QueueException, FileException);
+ bool addSource(QueueItem* qi, const UserPtr& aUser, Flags::MaskType addBad) throw(QueueException, FileException);
void processList(const string& name, UserPtr& user, int flags);
Modified: dcplusplus/trunk/dcpp/UploadManager.cpp
===================================================================
--- dcplusplus/trunk/dcpp/UploadManager.cpp 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/dcpp/UploadManager.cpp 2008-02-17 21:23:07 UTC (rev 1012)
@@ -387,7 +387,7 @@
return u;
}
-const UploadManager::FileSet& UploadManager::getWaitingUserFiles(const UserPtr &u) {
+const UploadManager::FileSet& UploadManager::getWaitingUserFiles(const UserPtr& u) {
Lock l(cs);
return waitingFiles.find(u)->second;
}
Modified: dcplusplus/trunk/dcpp/UploadManager.h
===================================================================
--- dcplusplus/trunk/dcpp/UploadManager.h 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/dcpp/UploadManager.h 2008-02-17 21:23:07 UTC (rev 1012)
@@ -59,7 +59,7 @@
typedef unordered_map<UserPtr, FileSet, User::Hash> FilesMap;
void clearUserFiles(const UserPtr&);
UserList getWaitingUsers();
- const FileSet& getWaitingUserFiles(const UserPtr &);
+ const FileSet& getWaitingUserFiles(const UserPtr&);
/** @internal */
void addConnection(UserConnectionPtr conn);
Modified: dcplusplus/trunk/dcpp/UploadManagerListener.h
===================================================================
--- dcplusplus/trunk/dcpp/UploadManagerListener.h 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/dcpp/UploadManagerListener.h 2008-02-17 21:23:07 UTC (rev 1012)
@@ -21,8 +21,8 @@
virtual void on(Tick, const UploadList&) throw() { }
virtual void on(Complete, Upload*) throw() { }
virtual void on(Failed, Upload*, const string&) throw() { }
- virtual void on(WaitingAddFile, const UserPtr, const string&) throw() { }
- virtual void on(WaitingRemoveUser, const UserPtr) throw() { }
+ virtual void on(WaitingAddFile, const UserPtr&, const string&) throw() { }
+ virtual void on(WaitingRemoveUser, const UserPtr&) throw() { }
};
Modified: dcplusplus/trunk/win32/AboutDlg.cpp
===================================================================
--- dcplusplus/trunk/win32/AboutDlg.cpp 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/win32/AboutDlg.cpp 2008-02-17 21:23:07 UTC (rev 1012)
@@ -53,7 +53,7 @@
}
bool AboutDlg::handleInitDialog() {
- setItemText(IDC_VERSION, Text::toT("DC++ " VERSIONSTRING "\n(c) Copyright 2001-2007 Jacek Sieka\nEx-codeveloper: Per Lind\303\251n\nGraphics: Martin Skogevall et al.\nDC++ is licenced under GPL\nhttp://dcplusplus.sourceforge.net/"));
+ setItemText(IDC_VERSION, Text::toT("DC++ " VERSIONSTRING "\n(c) Copyright 2001-2008 Jacek Sieka\nEx-codeveloper: Per Lind\303\251n\nGraphics: Martin Skogevall et al.\nDC++ is licenced under GPL\nhttp://dcplusplus.sourceforge.net/"));
setItemText(IDC_TTH, WinUtil::tth);
setItemText(IDC_THANKS, Text::toT(thanks));
setItemText(IDC_TOTALS, str(TF_("Upload: %1%, Download: %2%") % Text::toT(Util::formatBytes(SETTING(TOTAL_UPLOAD))) % Text::toT(Util::formatBytes(SETTING(TOTAL_DOWNLOAD)))));
Modified: dcplusplus/trunk/win32/MainWindow.cpp
===================================================================
--- dcplusplus/trunk/win32/MainWindow.cpp 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/win32/MainWindow.cpp 2008-02-17 21:23:07 UTC (rev 1012)
@@ -66,14 +66,14 @@
UPnP_TCPConnection(0),
UPnP_UDPConnection(0)
{
- links.homepage = _T("http://dcpp.net/");
+ links.homepage = _T("http://dcplusplus.sourceforge.net/");
links.downloads = links.homepage + _T("download/");
links.geoipfile = _T("http://www.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip");
links.faq = links.homepage + _T("faq/");
- links.help = links.homepage + _T("forum/");
- links.discuss = links.homepage + _T("forum/");
- links.features = links.homepage + _T("bugzilla/");
- links.bugs = links.homepage + _T("bugzilla/");
+ links.help = links.homepage + _T("help/");
+ links.discuss = links.homepage + _T("discussion/");
+ links.features = links.homepage + _T("featurereq/");
+ links.bugs = links.homepage + _T("bugs/");
links.donate = _T("https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=arnetheduck%40gmail%2ecom&item_name=DCPlusPlus&no_shipping=1&return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cancel_return=http%3a%2f%2fdcplusplus%2esf%2enet%2f&cn=Greeting&tax=0¤cy_code=EUR&bn=PP%2dDonationsBF&charset=UTF%2d8");
initWindow();
@@ -849,7 +849,6 @@
if(xml.findChild("Version")) {
if(Util::toDouble(xml.getChildData()) > VERSIONFLOAT) {
xml.resetCurrentChild();
- xml.resetCurrentChild();
if(xml.findChild("Title")) {
const string& title = xml.getChildData();
xml.resetCurrentChild();
@@ -865,43 +864,42 @@
}
}
}
-
+ }
+ xml.resetCurrentChild();
+ if(xml.findChild("Links")) {
+ xml.stepIn();
+ if(xml.findChild("Homepage")) {
+ links.homepage = Text::toT(xml.getChildData());
+ }
xml.resetCurrentChild();
- if(xml.findChild("Links")) {
- xml.stepIn();
- if(xml.findChild("Homepage")) {
- links.homepage = Text::toT(xml.getChildData());
- }
- xml.resetCurrentChild();
- if(xml.findChild("Downloads")) {
- links.downloads = Text::toT(xml.getChildData());
- }
- xml.resetCurrentChild();
- if(xml.findChild("GeoIP database update")) {
- links.geoipfile = Text::toT(xml.getChildData());
- }
- xml.resetCurrentChild();
- if(xml.findChild("Faq")) {
- links.faq = Text::toT(xml.getChildData());
- }
- xml.resetCurrentChild();
- if(xml.findChild("Bugs")) {
- links.bugs = Text::toT(xml.getChildData());
- }
- xml.resetCurrentChild();
- if(xml.findChild("Features")) {
- links.features = Text::toT(xml.getChildData());
- }
- xml.resetCurrentChild();
- if(xml.findChild("Help")) {
- links.help = Text::toT(xml.getChildData());
- }
- xml.resetCurrentChild();
- if(xml.findChild("Forum")) {
- links.discuss = Text::toT(xml.getChildData());
- }
- xml.stepOut();
+ if(xml.findChild("Downloads")) {
+ links.downloads = Text::toT(xml.getChildData());
}
+ xml.resetCurrentChild();
+ if(xml.findChild("GeoIP database update")) {
+ links.geoipfile = Text::toT(xml.getChildData());
+ }
+ xml.resetCurrentChild();
+ if(xml.findChild("Faq")) {
+ links.faq = Text::toT(xml.getChildData());
+ }
+ xml.resetCurrentChild();
+ if(xml.findChild("Bugs")) {
+ links.bugs = Text::toT(xml.getChildData());
+ }
+ xml.resetCurrentChild();
+ if(xml.findChild("Features")) {
+ links.features = Text::toT(xml.getChildData());
+ }
+ xml.resetCurrentChild();
+ if(xml.findChild("Help")) {
+ links.help = Text::toT(xml.getChildData());
+ }
+ xml.resetCurrentChild();
+ if(xml.findChild("Forum")) {
+ links.discuss = Text::toT(xml.getChildData());
+ }
+ xml.stepOut();
}
xml.stepOut();
} catch (const Exception&) {
Modified: dcplusplus/trunk/win32/PrivateFrame.h
===================================================================
--- dcplusplus/trunk/win32/PrivateFrame.h 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/win32/PrivateFrame.h 2008-02-17 21:23:07 UTC (rev 1012)
@@ -38,7 +38,7 @@
static void gotMessage(SmartWin::WidgetTabView* mdiParent, const UserPtr& from, const UserPtr& to, const UserPtr& replyTo, const tstring& aMessage);
static void openWindow(SmartWin::WidgetTabView* mdiParent, const UserPtr& replyTo, const tstring& aMessage = Util::emptyStringT);
- static bool isOpen(const UserPtr u) { return frames.find(u) != frames.end(); }
+ static bool isOpen(const UserPtr& u) { return frames.find(u) != frames.end(); }
static void closeAll();
static void closeAllOffline();
Modified: dcplusplus/trunk/win32/TransferView.cpp
===================================================================
--- dcplusplus/trunk/win32/TransferView.cpp 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/win32/TransferView.cpp 2008-02-17 21:23:07 UTC (rev 1012)
@@ -734,15 +734,17 @@
speak(CONNECTIONS_UPDATE, ui);
}
-void TransferView::on(DownloadManagerListener::Tick, const DownloadList& dl) throw() {
- for(DownloadList::const_iterator j = dl.begin(); j != dl.end(); ++j) {
- Download* d = *j;
+void TransferView::onTransferTick(Transfer* t) {
+ UpdateInfo* ui = new UpdateInfo(d->getUser(), true);
+ ui->setTransfered(t->getPos(), t->getActual());
+ ui->setSpeed(t->getAverageSpeed());
+ ui->setChunk(t->getPos(), t->getSize());
+ tasks.add(CONNECTIONS_UPDATE, ui);
+}
- UpdateInfo* ui = new UpdateInfo(d->getUser(), true);
- ui->setTransfered(d->getPos(), d->getActual());
- ui->setSpeed(d->getAverageSpeed());
- ui->setChunk(d->getPos(), d->getSize());
- tasks.add(CONNECTIONS_UPDATE, ui);
+void TransferView::on(DownloadManagerListener::Tick, const DownloadList& dl) throw() {
+ for(DownloadList::const_iterator i = dl.begin(); i != dl.end(); ++i) {
+ onTransferTick(*i);
}
std::vector<TickInfo*> dis;
@@ -812,15 +814,8 @@
}
void TransferView::on(UploadManagerListener::Tick, const UploadList& ul) throw() {
- for(UploadList::const_iterator j = ul.begin(); j != ul.end(); ++j) {
- Upload* u = *j;
-
- UpdateInfo* ui = new UpdateInfo(u->getUser(), false);
- ui->setTransfered(u->getPos(), u->getActual());
- ui->setSpeed(u->getAverageSpeed());
- ui->setChunk(u->getPos(), u->getSize());
-
- tasks.add(CONNECTIONS_UPDATE, ui);
+ for(UploadList::const_iterator i = ul.begin(); i != ul.end(); ++i) {
+ onTransferTick(*i);
}
speak();
@@ -841,6 +836,7 @@
ui->setStatus(ConnectionInfo::STATUS_WAITING);
ui->setStatusString(T_("Idle"));
+ ui->setChunk(aTransfer->getPos(), aTransfer->getSize());
speak(CONNECTIONS_UPDATE, ui);
}
Modified: dcplusplus/trunk/win32/TransferView.h
===================================================================
--- dcplusplus/trunk/win32/TransferView.h 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/win32/TransferView.h 2008-02-17 21:23:07 UTC (rev 1012)
@@ -291,6 +291,7 @@
virtual void on(QueueManagerListener::Removed, QueueItem*) throw();
+ void onTransferTick(Transfer* aTransfer);
void onTransferComplete(Transfer* aTransfer, bool isUpload);
void starting(UpdateInfo* ui, Transfer* t);
Modified: dcplusplus/trunk/win32/WaitingUsersFrame.cpp
===================================================================
--- dcplusplus/trunk/win32/WaitingUsersFrame.cpp 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/win32/WaitingUsersFrame.cpp 2008-02-17 21:23:07 UTC (rev 1012)
@@ -180,11 +180,11 @@
}
// UploadManagerListener
-void WaitingUsersFrame::on(UploadManagerListener::WaitingRemoveUser, const UserPtr aUser) throw() {
+void WaitingUsersFrame::on(UploadManagerListener::WaitingRemoveUser, const UserPtr& aUser) throw() {
speak(SPEAK_REMOVE_USER, (LPARAM)new UserItem(aUser));
}
-void WaitingUsersFrame::on(UploadManagerListener::WaitingAddFile, const UserPtr aUser, const string& aFilename) throw() {
+void WaitingUsersFrame::on(UploadManagerListener::WaitingAddFile, const UserPtr& aUser, const string& aFilename) throw() {
speak(SPEAK_ADD_FILE, (LPARAM)new pair<UserPtr, string>(aUser, aFilename));
}
Modified: dcplusplus/trunk/win32/WaitingUsersFrame.h
===================================================================
--- dcplusplus/trunk/win32/WaitingUsersFrame.h 2008-02-17 11:51:38 UTC (rev 1011)
+++ dcplusplus/trunk/win32/WaitingUsersFrame.h 2008-02-17 21:23:07 UTC (rev 1012)
@@ -89,8 +89,8 @@
void updateSearch(int index, BOOL doDelete = TRUE);
// UploadManagerListener
- virtual void on(UploadManagerListener::WaitingRemoveUser, const UserPtr) throw();
- virtual void on(UploadManagerListener::WaitingAddFile, const UserPtr, const string&) throw();
+ virtual void on(UploadManagerListener::WaitingRemoveUser, const UserPtr&) throw();
+ virtual void on(UploadManagerListener::WaitingAddFile, const UserPtr&, const string&) throw();
};
#endif /* WAITING_QUEUE_FRAME_H */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|