------------------------------------------------------------ revno: 3244 committer: poy <p...@123gen.com> branch nick: trunk timestamp: Sat 2013-03-30 15:28:28 +0100 message: PCH (lack thereof) & transfers modified: SConstruct dcpp/FavoriteManagerListener.h dcpp/LogManagerListener.h dcpp/QueueManagerListener.h test/testbase.h win32/AboutDlg.h win32/MDIChildFrame.h win32/SplashWindow.h win32/TransferView.cpp win32/TransferView.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 'SConstruct' --- SConstruct 2013-03-25 20:52:49 +0000 +++ SConstruct 2013-03-30 14:28:28 +0000 @@ -264,7 +264,9 @@ # a 32-bit program). the only differentiator is __MINGW64_VERSION_MAJOR. if conf.CheckDeclaration('__MINGW64_VERSION_MAJOR', '#include <windows.h>', 'C++'): conf.env.Append(CPPDEFINES='HAVE_MINGW64') - conf.env['pch'] = 0 # precompiled headers crash mingw64's gcc... + if conf.env['pch']: + conf.env['pch'] = 0 # precompiled headers crash mingw64's gcc... + conf.env['CPPDEFINES'].remove('HAS_PCH') env = conf.Finish() dev.boost = dev.build('boost/') === modified file 'dcpp/FavoriteManagerListener.h' --- dcpp/FavoriteManagerListener.h 2013-01-18 21:28:38 +0000 +++ dcpp/FavoriteManagerListener.h 2013-03-30 14:28:28 +0000 @@ -19,11 +19,15 @@ #ifndef DCPLUSPLUS_DCPP_FAVORITEMANAGERLISTENER_H_ #define DCPLUSPLUS_DCPP_FAVORITEMANAGERLISTENER_H_ +#include <string> + #include "forward.h" #include "noexcept.h" namespace dcpp { +using std::string; + class FavoriteManagerListener { public: virtual ~FavoriteManagerListener() { } === modified file 'dcpp/LogManagerListener.h' --- dcpp/LogManagerListener.h 2013-01-18 21:28:38 +0000 +++ dcpp/LogManagerListener.h 2013-03-30 14:28:28 +0000 @@ -19,10 +19,14 @@ #ifndef DCPLUSPLUS_DCPP_LOG_MANAGER_LISTENER_H #define DCPLUSPLUS_DCPP_LOG_MANAGER_LISTENER_H +#include <string> + #include "noexcept.h" namespace dcpp { +using std::string; + class LogManagerListener { public: virtual ~LogManagerListener() { } === modified file 'dcpp/QueueManagerListener.h' --- dcpp/QueueManagerListener.h 2013-01-18 21:28:38 +0000 +++ dcpp/QueueManagerListener.h 2013-03-30 14:28:28 +0000 @@ -19,11 +19,15 @@ #ifndef DCPLUSPLUS_DCPP_QUEUE_MANAGER_LISTENER_H #define DCPLUSPLUS_DCPP_QUEUE_MANAGER_LISTENER_H +#include <string> + #include "forward.h" #include "noexcept.h" namespace dcpp { +using std::string; + class QueueManagerListener { public: virtual ~QueueManagerListener() { } === modified file 'test/testbase.h' --- test/testbase.h 2012-11-02 22:23:18 +0000 +++ test/testbase.h 2013-03-30 14:28:28 +0000 @@ -2,6 +2,12 @@ #include <dcpp/stdinc.h> +#ifdef _WIN32 +#include <dcpp/w.h> +#endif + +#include <dcpp/typedefs.h> + #include "gtest.h" #define _(x) === modified file 'win32/AboutDlg.h' --- win32/AboutDlg.h 2013-01-18 21:28:38 +0000 +++ win32/AboutDlg.h 2013-03-30 14:28:28 +0000 @@ -19,12 +19,16 @@ #ifndef DCPLUSPLUS_WIN32_ABOUT_DLG_H #define DCPLUSPLUS_WIN32_ABOUT_DLG_H +#include <memory> +#include <string> + #include <dcpp/forward.h> #include <dwt/widgets/ModalDialog.h> #include "forward.h" +using std::string; using std::unique_ptr; class AboutDlg : public dwt::ModalDialog === modified file 'win32/MDIChildFrame.h' --- win32/MDIChildFrame.h 2013-01-18 21:28:38 +0000 +++ win32/MDIChildFrame.h 2013-03-30 14:28:28 +0000 @@ -20,6 +20,7 @@ #define DCPLUSPLUS_WIN32_MDI_CHILD_FRAME_H_ #include <functional> +#include <string> #include <dcpp/SettingsManager.h> #include <dcpp/WindowInfo.h> @@ -31,6 +32,8 @@ #include "WinUtil.h" #include "resource.h" +using std::string; + using dwt::util::escapeMenu; template<typename T> === modified file 'win32/SplashWindow.h' --- win32/SplashWindow.h 2013-03-11 17:34:35 +0000 +++ win32/SplashWindow.h 2013-03-30 14:28:28 +0000 @@ -19,6 +19,8 @@ #ifndef DCPLUSPLUS_WIN32_SPLASHWINDOW_H #define DCPLUSPLUS_WIN32_SPLASHWINDOW_H +#include <dcpp/typedefs.h> + #include <dwt/widgets/Window.h> class SplashWindow : public dwt::Window { === modified file 'win32/TransferView.cpp' --- win32/TransferView.cpp 2013-03-29 17:34:08 +0000 +++ win32/TransferView.cpp 2013-03-30 14:28:28 +0000 @@ -34,8 +34,9 @@ #include <dwt/util/StringUtils.h> #include <dwt/widgets/TableTree.h> +#include "HoldRedraw.h" #include "resource.h" -#include "HoldRedraw.h" +#include "ShellMenu.h" #include "TypedTable.h" #include "WinUtil.h" @@ -171,7 +172,7 @@ } void TransferView::ConnectionInfo::update(const UpdateInfo& ui) { - if(ui.updateMask & UpdateInfo::MASK_FILE) { + if(ui.updateMask & UpdateInfo::MASK_PATH) { parent.path = ui.path; parent.updatePath(); columns[COLUMN_FILE] = parent.getText(COLUMN_FILE); @@ -258,11 +259,12 @@ ConnectionManager::getInstance()->disconnect(user, parent.download); } -TransferView::TransferInfo::TransferInfo(const TTHValue& tth, bool download, const string& path) : +TransferView::TransferInfo::TransferInfo(const TTHValue& tth, bool download, const string& path, const string& tempPath) : ItemInfo(), tth(tth), download(download), path(path), + tempPath(tempPath), startPos(0) { } @@ -290,11 +292,9 @@ set<string> hubs; for(auto& conn: conns) { - if(conn.status == ConnectionInfo::STATUS_RUNNING) { - if(!download) { timeleft += conn.timeleft; } - speed += conn.speed; - transferred += conn.transferred; - } + if(!download) { timeleft += conn.timeleft; } + speed += conn.speed; + transferred += conn.transferred; hubs.insert(conn.getUser().hint); } @@ -345,12 +345,12 @@ } double TransferView::TransferInfo::barPos() const { - if(conns.size() == 1) { - return conns.front().barPos(); + if(download) { + return size > 0 && transferred >= 0 ? + static_cast<double>(transferred) / static_cast<double>(size) : -1; + } else { + return conns.size() == 1 ? conns.front().barPos() : -1; } - - return download && size > 0 && transferred >= 0 ? - static_cast<double>(transferred) / static_cast<double>(size) : -1; } void TransferView::TransferInfo::force() { @@ -381,33 +381,56 @@ auto selData = (sel.size() == 1) ? transfers->getSelectedData() : nullptr; auto transfer = dynamic_cast<TransferInfo*>(selData); - auto menu = addChild(WinUtil::Seeds::menu); - - menu->setTitle(selData ? escapeMenu(selData->getText(transfer ? COLUMN_FILE : COLUMN_USER)) : - str(TF_("%1% items") % sel.size()), - transfer ? WinUtil::fileImages->getIcon(selData->getImage(COLUMN_FILE)) : nullptr); + auto menu = addChild(ShellMenu::Seed(WinUtil::Seeds::menu)); + + tstring title; + dwt::IconPtr icon; + if(selData) { + title = escapeMenu(selData->getText(transfer ? COLUMN_FILE : COLUMN_USER)); + if(title.empty()) { + title = escapeMenu(selData->getText(COLUMN_USER)); + icon = WinUtil::fileImages->getIcon(WinUtil::TRANSFER_ICON_USER); + } else { + icon = WinUtil::fileImages->getIcon(selData->getImage(COLUMN_FILE)); + } + } else { + title = str(TF_("%1% items") % sel.size()); + } + menu->setTitle(title, icon); + + appendUserItems(mdi, menu.get(), false); set<TransferInfo*> files; for(auto i: sel) { - files.insert(&transfers->getData(i)->transfer()); + if(!transfer->getText(COLUMN_FILE).empty()) { + files.insert(&transfers->getData(i)->transfer()); + } } if(files.size() == 1) { + menu->appendSeparator(); transfer = *files.begin(); WinUtil::addHashItems(menu.get(), transfer->tth, transfer->getText(COLUMN_FILE), transfer->size); - menu->appendSeparator(); } else if(!files.empty()) { + menu->appendSeparator(); for(auto transfer: files) { auto file = transfer->getText(COLUMN_FILE); WinUtil::addHashItems( menu->appendPopup(file, WinUtil::fileImages->getIcon(transfer->getImage(COLUMN_FILE))), transfer->tth, file, transfer->size); } - menu->appendSeparator(); - } - - appendUserItems(mdi, menu.get(), false); + } + + StringList paths; + for(auto transfer: files) { + if(File::getSize(transfer->path) != -1) { + paths.push_back(transfer->path); + } else if(!transfer->tempPath.empty() && File::getSize(transfer->tempPath) != -1) { + paths.push_back(transfer->tempPath); + } + } + menu->appendShellMenu(paths); + menu->appendSeparator(); - menu->appendItem(T_("&Force attempt"), [this] { handleForce(); }); menu->appendSeparator(); menu->appendItem(T_("&Disconnect"), [this] { handleDisconnect(); }); @@ -622,7 +645,7 @@ TransferInfo* transfer = nullptr; auto conn = findConn(ui.user, ui.download); - if(ui.updateMask & UpdateInfo::MASK_FILE) { + if(ui.updateMask & UpdateInfo::MASK_PATH) { // adding a connection we know the transfer of. transfer = findTransfer(ui.path, ui.download); if(conn && &conn->parent != transfer) { @@ -630,7 +653,7 @@ conn = nullptr; } if(!transfer) { - transferItems.emplace_back(ui.tth, ui.download, ui.path); + transferItems.emplace_back(ui.tth, ui.download, ui.path, ui.tempPath); transfer = &transferItems.back(); transfers->insert(transfer); } @@ -646,7 +669,7 @@ removeConn(*conn); conn = nullptr; } - transferItems.emplace_back(TTHValue(), ui.download, ui.user.user->getCID().toBase32()); + transferItems.emplace_back(TTHValue(), ui.download, ui.user.user->getCID().toBase32(), Util::emptyString); transfer = &transferItems.back(); transfers->insert(transfer); } @@ -847,6 +870,7 @@ void TransferView::on(DownloadManagerListener::Requesting, Download* d) noexcept { auto ui = new UpdateInfo(d->getHintedUser(), true); starting(ui, d); + ui->setTempPath(d->getTempTarget()); ui->setStatusString(str(TF_("Requesting %1%") % getFile(d))); addedConn(ui); @@ -912,7 +936,8 @@ } void TransferView::starting(UpdateInfo* ui, Transfer* t) { - ui->setFile(t->getTTH(), t->getPath()); + ui->setTTH(t->getTTH()); + ui->setFile(t->getPath()); ui->setStatus(ConnectionInfo::STATUS_RUNNING); ui->setTransferred(t->getPos(), t->getActual(), t->getSize()); const UserConnection& uc = t->getUserConnection(); @@ -930,7 +955,7 @@ void TransferView::onTransferComplete(Transfer* t, bool download) { auto ui = new UpdateInfo(t->getHintedUser(), download); - ui->setFile(t->getTTH(), t->getPath()); + ui->setFile(t->getPath()); ui->setStatus(ConnectionInfo::STATUS_WAITING); ui->setStatusString(T_("Idle")); ui->setTransferred(t->getPos(), t->getActual(), t->getSize()); @@ -940,7 +965,7 @@ void TransferView::onFailed(Download* d, const string& aReason) { auto ui = new UpdateInfo(d->getHintedUser(), true, true); - ui->setFile(d->getTTH(), d->getPath()); + ui->setFile(d->getPath()); ui->setStatus(ConnectionInfo::STATUS_WAITING); ui->setStatusString(Text::toT(aReason)); === modified file 'win32/TransferView.h' --- win32/TransferView.h 2013-03-29 17:34:08 +0000 +++ win32/TransferView.h 2013-03-30 14:28:28 +0000 @@ -128,7 +128,7 @@ }; struct TransferInfo : public ItemInfo { - TransferInfo(const TTHValue& tth, bool download, const string& path); + TransferInfo(const TTHValue& tth, bool download, const string& path, const string& tempPath); bool operator==(const TransferInfo& other) const; @@ -147,6 +147,7 @@ TTHValue tth; bool download; string path; + string tempPath; int64_t startPos; list<ConnectionInfo> conns; @@ -161,7 +162,7 @@ MASK_CIPHER = 1 << 4, MASK_IP = 1 << 5, MASK_COUNTRY = 1 << 6, - MASK_FILE = 1 << 7 + MASK_PATH = 1 << 7 }; UpdateInfo(const HintedUser& user, bool download, bool transferFailed = false) : @@ -174,8 +175,12 @@ bool transferFailed; TTHValue tth; + void setTTH(const TTHValue& tth) { this->tth = tth; } string path; - void setFile(const TTHValue& tth, const string& path) { this->tth = tth; this->path = path; updateMask |= MASK_FILE; } + void setFile(const string& path) { this->path = path; updateMask |= MASK_PATH; } + + string tempPath; + void setTempPath(const string& path) { tempPath = path; } void setStatus(ConnectionInfo::Status aStatus) { status = aStatus; updateMask |= MASK_STATUS; } ConnectionInfo::Status status;
_______________________________________________ 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