linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #03772
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2468: Yank waiting users frame
------------------------------------------------------------
revno: 2468
committer: Jacek Sieka <arnetheduck@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Wed 2011-03-23 21:26:21 +0100
message:
Yank waiting users frame
removed:
res/WaitingUsers.ico
win32/WaitingUsersFrame.cpp
win32/WaitingUsersFrame.h
modified:
dwt/src/widgets/SplitterContainer.cpp
dwt/src/widgets/StatusBar.cpp
win32/MainWindow.cpp
win32/resource.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 'dwt/src/widgets/SplitterContainer.cpp'
--- dwt/src/widgets/SplitterContainer.cpp 2011-03-15 22:39:48 +0000
+++ dwt/src/widgets/SplitterContainer.cpp 2011-03-23 20:26:21 +0000
@@ -147,9 +147,6 @@
{
// TODO Check that one splitter does not move past another
splitter->setRelativePos(pos);
- RECT rc;
- ::GetWindowRect(handle(), &rc);
- ::MapWindowPoints(NULL, getParent()->handle(), (LPPOINT) &rc, 2);
layout();
redraw(true);
}
=== modified file 'dwt/src/widgets/StatusBar.cpp'
--- dwt/src/widgets/StatusBar.cpp 2011-03-15 21:16:24 +0000
+++ dwt/src/widgets/StatusBar.cpp 2011-03-23 20:26:21 +0000
@@ -41,7 +41,7 @@
const TCHAR StatusBar::windowClass[] = STATUSCLASSNAME;
StatusBar::Seed::Seed(unsigned parts_, unsigned fill_, bool sizeGrip) :
-BaseType::Seed(WS_CHILD | WS_CLIPCHILDREN),
+BaseType::Seed(WS_CHILD),
parts(parts_),
fill(fill_)
{
@@ -127,11 +127,11 @@
POINT p[2];
sendMessage(SB_GETRECT, part, reinterpret_cast<LPARAM>(p));
::MapWindowPoints(handle(), getParent()->handle(), (POINT*)p, 2);
- ::MoveWindow(widget->handle(),
+ ::SetWindowPos(widget->handle(), handle(),
p[0].x + padding.left(),
p[0].y + padding.top(),
p[1].x - p[0].x - padding.right(),
- p[1].y - p[0].y - padding.bottom(), TRUE);
+ p[1].y - p[0].y - padding.bottom(), SWP_NOACTIVATE | SWP_NOOWNERZORDER);
}
void StatusBar::onClicked(unsigned part, const F& f) {
=== removed file 'res/WaitingUsers.ico'
Binary files res/WaitingUsers.ico 2010-03-11 17:25:17 +0000 and res/WaitingUsers.ico 1970-01-01 00:00:00 +0000 differ
=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp 2011-03-18 21:48:06 +0000
+++ win32/MainWindow.cpp 2011-03-23 20:26:21 +0000
@@ -44,7 +44,6 @@
#include "StatsFrame.h"
#include "SystemFrame.h"
#include "UsersFrame.h"
-#include "WaitingUsersFrame.h"
#include <dcpp/SettingsManager.h>
#include <dcpp/ResourceManager.h>
@@ -270,8 +269,6 @@
[this] { QueueFrame::openWindow(getTabView()); }, WinUtil::menuIcon(IDI_QUEUE));
viewIndexes[FinishedDLFrame::id] = viewMenu->appendItem(T_("Finished Downloads"),
[this] { FinishedDLFrame::openWindow(getTabView()); }, WinUtil::menuIcon(IDI_FINISHED_DL));
- viewIndexes[WaitingUsersFrame::id] = viewMenu->appendItem(T_("Waiting Users"),
- [this] { WaitingUsersFrame::openWindow(getTabView()); }, WinUtil::menuIcon(IDI_WAITING_USERS));
viewIndexes[FinishedULFrame::id] = viewMenu->appendItem(T_("Finished Uploads"),
[this] { FinishedULFrame::openWindow(getTabView()); }, WinUtil::menuIcon(IDI_FINISHED_UL));
viewMenu->appendSeparator();
@@ -367,8 +364,6 @@
IDH_TOOLBAR_QUEUE, [this] { QueueFrame::openWindow(getTabView()); });
toolbar->addButton(FinishedDLFrame::id, WinUtil::toolbarIcon(IDI_FINISHED_DL), 0, T_("Finished Downloads"), false,
IDH_TOOLBAR_FINISHED_DL, [this] { FinishedDLFrame::openWindow(getTabView()); });
- toolbar->addButton(WaitingUsersFrame::id, WinUtil::toolbarIcon(IDI_WAITING_USERS), 0, T_("Waiting Users"), false,
- IDH_TOOLBAR_WAITING_USERS, [this] { WaitingUsersFrame::openWindow(getTabView()); });
toolbar->addButton(FinishedULFrame::id, WinUtil::toolbarIcon(IDI_FINISHED_UL), 0, T_("Finished Uploads"), false,
IDH_TOOLBAR_FINISHED_UL, [this] { FinishedULFrame::openWindow(getTabView()); });
toolbar->addButton(SearchFrame::id, WinUtil::toolbarIcon(IDI_SEARCH), 0, T_("Search"), false,
@@ -405,7 +400,6 @@
comma +
QueueFrame::id + comma +
FinishedDLFrame::id + comma +
- WaitingUsersFrame::id + comma +
FinishedULFrame::id + comma +
comma +
SearchFrame::id + comma +
@@ -1446,7 +1440,6 @@
compare_id(UsersFrame);
compare_id(QueueFrame);
compare_id(FinishedDLFrame);
- compare_id(WaitingUsersFrame);
compare_id(FinishedULFrame);
compare_id(ADLSearchFrame);
compare_id(SpyFrame);
=== removed file 'win32/WaitingUsersFrame.cpp'
--- win32/WaitingUsersFrame.cpp 2011-03-15 21:16:24 +0000
+++ win32/WaitingUsersFrame.cpp 1970-01-01 00:00:00 +0000
@@ -1,218 +0,0 @@
-/*
- * Copyright (C) 2001-2011 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 "resource.h"
-
-#include "WaitingUsersFrame.h"
-
-#include <dcpp/UploadManager.h>
-#include "UserInfoBase.h"
-#include "WinUtil.h"
-
-const string WaitingUsersFrame::id = "WaitingUsers";
-const string& WaitingUsersFrame::getId() const { return id; }
-
-// Constructor
-WaitingUsersFrame::WaitingUsersFrame(TabViewPtr parent) :
- BaseType(parent, T_("Waiting Users"), IDH_WAITING_USERS, IDI_WAITING_USERS)
-{
- UploadManager::getInstance()->addListener(this);
-
- // Create tree control
- {
- queued = addChild(WinUtil::Seeds::treeView);
- addWidget(queued);
- queued->onContextMenu(std::bind(&WaitingUsersFrame::handleContextMenu, this, _1));
- queued->onChar(std::bind(&WaitingUsersFrame::handleChar, this, _1));
- }
-
- initStatus();
-
- layout();
-
- // Load all waiting users & files.
- loadAll();
-}
-
-// Recalculate frame control layout
-void WaitingUsersFrame::layout() {
- dwt::Rectangle r(this->getClientSize());
-
- r.size.y -= status->refresh();
-
- queued->resize(r);
-}
-
-bool WaitingUsersFrame::preClosing() {
- UploadManager::getInstance()->removeListener(this);
- return true;
-}
-
-void WaitingUsersFrame::postClosing() {
- for(HTREEITEM userNode = queued->getRoot(); userNode; userNode = queued->getNextSibling(userNode)) {
- delete reinterpret_cast<UserInfoBase*>(queued->getData(userNode));
- }
-}
-
-bool WaitingUsersFrame::handleContextMenu(dwt::ScreenCoordinate pt) {
- if(pt.x() == -1 && pt.y() == -1) {
- pt = queued->getContextMenuPos();
- } else {
- queued->select(pt);
- }
-
- MenuPtr menu = addChild(WinUtil::Seeds::menu);
- appendUserItems(getParent(), menu);
- menu->appendSeparator();
- menu->appendItem(T_("&Copy filename"), std::bind(&WaitingUsersFrame::onCopyFilename, this));
- menu->appendItem(T_("&Remove"), std::bind(&WaitingUsersFrame::onRemove, this));
-
- menu->open(pt);
- return true;
-}
-
-// Load all searches from manager
-void WaitingUsersFrame::loadAll() {
- HintedUserList users = UploadManager::getInstance()->getWaitingUsers();
- for(HintedUserList::const_iterator ui = users.begin(), uiend = users.end(); ui != uiend; ++ui) {
- HTREEITEM lastInserted = queued->insert(WinUtil::getNicks(*ui) + _T(" - ") + WinUtil::getHubNames(*ui).first,
- NULL, reinterpret_cast<LPARAM>(new UserInfoBase(*ui)));
- UploadManager::FileSet files = UploadManager::getInstance()->getWaitingUserFiles(*ui);
- for(UploadManager::FileSet::const_iterator fi = files.begin(), fiend = files.end(); fi != fiend; ++fi) {
- queued->insert(Text::toT(*fi), lastInserted);
- }
- }
-}
-
-HTREEITEM WaitingUsersFrame::getParentItem() const {
- HTREEITEM sel = queued->getSelected();
- if(!sel) {
- return NULL;
- }
- HTREEITEM parent = queued->getParent(sel);
- return parent ? parent : sel;
-}
-
-UserInfoBase* WaitingUsersFrame::getSelectedUser() const {
- HTREEITEM selectedItem = getParentItem();
- return selectedItem ? reinterpret_cast<UserInfoBase*>(queued->getData(selectedItem)) : 0;
-}
-
-void WaitingUsersFrame::onCopyFilename() {
- HTREEITEM selectedItem = queued->getSelected(), parentItem = getParentItem();
-
- if (!selectedItem || !parentItem || selectedItem == parentItem)
- return;
-
- tstring txt = queued->getText(selectedItem);
- tstring::size_type i = txt.find(_T('('));
- if(i != tstring::npos && i > 0) {
- txt.erase(i - 1);
- }
- if(!txt.empty()) {
- WinUtil::setClipboard(txt);
- }
-}
-
-// Remove queued item
-void WaitingUsersFrame::onRemove()
-{
- UserInfoBase* user = getSelectedUser();
- if (user) {
- UploadManager::getInstance()->clearUserFiles(user->getUser());
- }
-}
-
-WaitingUsersFrame::UserInfoList WaitingUsersFrame::selectedUsersImpl() const {
- UserInfoList users;
- UserInfoBase* user = getSelectedUser();
- if(user)
- users.push_back(user);
- return users;
-}
-
-// UploadManagerListener
-void WaitingUsersFrame::on(UploadManagerListener::WaitingAddFile, const HintedUser& aUser, const string& aFilename) throw() {
- callAsync(std::bind(&WaitingUsersFrame::onAddFile, this, aUser, aFilename));
-}
-void WaitingUsersFrame::on(UploadManagerListener::WaitingRemoveUser, const HintedUser& aUser) throw() {
- callAsync(std::bind(&WaitingUsersFrame::onRemoveUser, this, aUser));
-}
-
-// Keyboard shortcuts
-bool WaitingUsersFrame::handleChar(int c) {
- if(c == VK_DELETE) {
- onRemove();
- return true;
- }
- return false;
-}
-
-void WaitingUsersFrame::onRemoveUser(const UserPtr& aUser) {
- HTREEITEM userNode = queued->getRoot();
-
- while(userNode) {
- UserInfoBase* u = reinterpret_cast<UserInfoBase*>(queued->getData(userNode));
- if(u->getUser() == aUser) {
- delete u;
- queued->erase(userNode);
- return;
- }
- userNode = queued->getNextSibling(userNode);
- }
-
- setDirty(SettingsManager::BOLD_WAITING_USERS);
-}
-
-void WaitingUsersFrame::onAddFile(const HintedUser& aUser, const string& aFile) {
- HTREEITEM userNode = queued->getRoot();
-
- string fname = aFile.substr(0, aFile.find(_T('(')));
-
- while(userNode) {
- if(reinterpret_cast<UserInfoBase*>(queued->getData(userNode))->getUser() == aUser) {
- HTREEITEM childNode = queued->getChild(userNode);
- while (childNode) {
- tstring buf = queued->getText(childNode);
-
- if (fname == Text::fromT(buf.substr(0, buf.find(_T('('))))) {
- delete reinterpret_cast<UserPtr *>(queued->getData(childNode));
- queued->erase(childNode);
- break;
- }
- childNode = queued->getNextSibling(childNode);
- }
-
- //file isn't already listed, add it
- queued->insert(Text::toT(aFile), userNode, reinterpret_cast<LPARAM>(new UserInfoBase(aUser)));
-
- return;
- }
-
- userNode = queued->getNextSibling(userNode);
- }
-
- userNode = queued->insert(WinUtil::getNicks(aUser) + _T(" - ") + WinUtil::getHubNames(aUser).first,
- NULL, reinterpret_cast<LPARAM>(new UserInfoBase(aUser)));
- queued->insert(Text::toT(aFile), userNode);
- queued->expand(userNode);
-
- setDirty(SettingsManager::BOLD_WAITING_USERS);
-}
=== removed file 'win32/WaitingUsersFrame.h'
--- win32/WaitingUsersFrame.h 2011-01-09 14:54:10 +0000
+++ win32/WaitingUsersFrame.h 1970-01-01 00:00:00 +0000
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2001-2011 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_WAITING_USERS_FRAME_H
-#define DCPLUSPLUS_WIN32_WAITING_USERS_FRAME_H
-
-#include "StaticFrame.h"
-#include "UserInfoBase.h"
-
-#include <dcpp/forward.h>
-#include <dcpp/UploadManagerListener.h>
-#include "resource.h"
-
-/// @todo use typed controls & auto-manage UserInfoBase pointers
-class WaitingUsersFrame :
- public StaticFrame<WaitingUsersFrame>,
- public AspectUserInfo<WaitingUsersFrame>,
- public UploadManagerListener
-{
- typedef StaticFrame<WaitingUsersFrame> BaseType;
-
- friend class StaticFrame<WaitingUsersFrame>;
- friend class MDIChildFrame<WaitingUsersFrame>;
- friend class AspectUserInfo<WaitingUsersFrame>;
-
-public:
- enum Status {
- STATUS_STATUS,
- STATUS_LAST
- };
-
- static const string id;
- const string& getId() const;
-
-protected:
- // Constructor
- WaitingUsersFrame(TabViewPtr parent);
- virtual ~WaitingUsersFrame() { }
-
-private:
- // Contained controls
- TreePtr queued;
-
- void layout();
- bool preClosing();
- void postClosing();
-
- // Message handlers
- void onGetList();
- void onCopyFilename();
- void onRemove();
- bool handleContextMenu(dwt::ScreenCoordinate pt);
- bool handleChar(int c);
-
- HTREEITEM getParentItem() const;
- UserInfoBase* getSelectedUser() const;
-
- // Communication with manager
- void loadAll();
- void updateSearch(int index, BOOL doDelete = TRUE);
-
- // AspectUserInfo
- UserInfoList selectedUsersImpl() const;
-
- // UploadManagerListener
- virtual void on(UploadManagerListener::WaitingAddFile, const HintedUser&, const string&) throw();
- virtual void on(UploadManagerListener::WaitingRemoveUser, const HintedUser&) throw();
- void onRemoveUser(const UserPtr&);
- void onAddFile(const HintedUser&, const string&);
-};
-
-#endif /* WAITING_QUEUE_FRAME_H */
=== modified file 'win32/resource.h'
--- win32/resource.h 2011-02-02 17:45:47 +0000
+++ win32/resource.h 2011-03-23 20:26:21 +0000
@@ -20,7 +20,6 @@
#define IDI_FAVORITE_USERS 112
#define IDI_SPY 113
#define IDI_NET_STATS 114
-#define IDI_WAITING_USERS 115
#define IDI_MAGNET 116
#define IDI_HUB_OFF 117
#define IDI_PRIVATE_OFF 118