linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #04098
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2525: When holding shift at start, hubs are opened but not connected to
------------------------------------------------------------
revno: 2525
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2011-05-07 00:46:06 +0200
message:
When holding shift at start, hubs are opened but not connected to
removed:
dcpp/WindowManagerListener.h
modified:
changelog.txt
dcpp/WindowManager.cpp
dcpp/WindowManager.h
win32/HubFrame.cpp
win32/HubFrame.h
win32/IRecent.h
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 2011-05-06 21:39:48 +0000
+++ changelog.txt 2011-05-06 22:46:06 +0000
@@ -25,6 +25,7 @@
* More icons (many from the Crystal Clear project, thanks to them)
* Add notifications via balloon popups and sound (poy)
* Fix taskbar thumbnails and "Aero Peek" live previews when DC++ is elevated (poy)
+* When holding shift at start, hubs are opened but not connected to (poy)
-- 0.782 2011-03-05 --
* Prevent a remote crash triggered via malformed user commands (poy)
=== modified file 'dcpp/WindowManager.cpp'
--- dcpp/WindowManager.cpp 2011-04-13 19:16:51 +0000
+++ dcpp/WindowManager.cpp 2011-05-06 22:46:06 +0000
@@ -40,16 +40,6 @@
SettingsManager::getInstance()->removeListener(this);
}
-void WindowManager::autoOpen(bool skipHubs) {
- Lock l(cs);
- for(WindowInfoList::const_iterator i = list.begin(), iend = list.end(); i != iend; ++i) {
- const string& id = i->getId();
- if(skipHubs && id == hub())
- continue;
- fire(WindowManagerListener::Window(), id, i->getParams());
- }
-}
-
Lock WindowManager::lock() {
return Lock(cs);
}
@@ -62,6 +52,10 @@
list.clear();
}
+const WindowManager::WindowInfoList& WindowManager::getList() {
+ return list;
+}
+
void WindowManager::addRecent(const string& id, const WindowParams& params) {
Lock l(cs);
addRecent_(id, params, true);
=== modified file 'dcpp/WindowManager.h'
--- dcpp/WindowManager.h 2011-03-29 20:40:28 +0000
+++ dcpp/WindowManager.h 2011-05-06 22:46:06 +0000
@@ -22,13 +22,11 @@
#include "forward.h"
#include "SettingsManager.h"
#include "WindowInfo.h"
-#include "WindowManagerListener.h"
namespace dcpp {
class WindowManager :
public Singleton<WindowManager>,
- public Speaker<WindowManagerListener>,
private SettingsManagerListener
{
typedef std::unordered_map<string, unsigned> MaxRecentItems;
@@ -36,12 +34,11 @@
typedef std::vector<WindowInfo> WindowInfoList;
typedef std::unordered_map<string, WindowInfoList> RecentList;
- void autoOpen(bool skipHubs);
-
Lock lock();
void add(const string& id, const WindowParams& params);
void clear();
+ const WindowInfoList& getList();
/// adds the referenced window if it doesn't exist, and moves it to the top of the stack.
void addRecent(const string& id, const WindowParams& params);
=== removed file 'dcpp/WindowManagerListener.h'
--- dcpp/WindowManagerListener.h 2011-03-29 20:40:28 +0000
+++ dcpp/WindowManagerListener.h 1970-01-01 00:00:00 +0000
@@ -1,39 +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_DCPP_WINDOW_MANAGER_LISTENER_H
-#define DCPLUSPLUS_DCPP_WINDOW_MANAGER_LISTENER_H
-
-#include "forward.h"
-#include "WindowInfo.h"
-
-namespace dcpp {
-
-class WindowManagerListener {
-public:
- virtual ~WindowManagerListener() { }
- template<int I> struct X { enum { TYPE = I }; };
-
- typedef X<0> Window;
-
- virtual void on(Window, const string&, const WindowParams&) noexcept = 0;
-};
-
-} // namespace dcpp
-
-#endif // !defined(DCPLUSPLUS_DCPP_WINDOW_MANAGER_LISTENER_H)
=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp 2011-05-04 19:32:00 +0000
+++ win32/HubFrame.cpp 2011-05-06 22:46:06 +0000
@@ -65,7 +65,7 @@
HubFrame::FrameList HubFrame::frames;
-void HubFrame::openWindow(TabViewPtr parent, const string& url, bool activate) {
+void HubFrame::openWindow(TabViewPtr parent, const string& url, bool activate, bool connect) {
for(FrameIter i = frames.begin(); i != frames.end(); ++i) {
HubFrame* frame = *i;
if(frame->url == url) {
@@ -77,7 +77,7 @@
}
}
- auto frame = new HubFrame(parent, url);
+ auto frame = new HubFrame(parent, url, connect);
if(activate)
frame->activate();
}
@@ -114,9 +114,9 @@
}
void HubFrame::parseWindowParams(TabViewPtr parent, const WindowParams& params) {
- auto i = params.find(WindowInfo::address);
- if(i != params.end())
- openWindow(parent, i->second, parseActivateParam(params));
+ auto address = params.find(WindowInfo::address);
+ if(address != params.end())
+ openWindow(parent, address->second, parseActivateParam(params), params.find("NoConnect") == params.end());
}
bool HubFrame::isFavorite(const WindowParams& params) {
@@ -126,7 +126,7 @@
return false;
}
-HubFrame::HubFrame(TabViewPtr parent, const string& url_) :
+HubFrame::HubFrame(TabViewPtr parent, const string& url_, bool connect) :
BaseType(parent, Text::toT(url_), IDH_HUB, IDI_HUB_OFF, false),
paned(0),
userGrid(0),
@@ -228,7 +228,8 @@
client = ClientManager::getInstance()->getClient(url);
client->addListener(this);
- client->connect();
+ if(connect)
+ client->connect();
readLog(getLogPath(), SETTING(HUB_LAST_LOG_LINES));
=== modified file 'win32/HubFrame.h'
--- win32/HubFrame.h 2011-05-04 19:32:00 +0000
+++ win32/HubFrame.h 2011-05-06 22:46:06 +0000
@@ -65,7 +65,7 @@
static const string id;
const string& getId() const;
- static void openWindow(TabViewPtr parent, const string& url, bool activate = true);
+ static void openWindow(TabViewPtr parent, const string& url, bool activate = true, bool connect = true);
static void closeAll(bool all);
static void closeFavGroup(const string& group, bool reversed);
static void resortUsers();
@@ -189,7 +189,7 @@
typedef FrameList::iterator FrameIter;
static FrameList frames;
- HubFrame(TabViewPtr parent, const string& url);
+ HubFrame(TabViewPtr parent, const string& url, bool connect);
virtual ~HubFrame();
void layout();
=== modified file 'win32/IRecent.h'
--- win32/IRecent.h 2011-03-16 18:23:54 +0000
+++ win32/IRecent.h 2011-05-06 22:46:06 +0000
@@ -42,7 +42,7 @@
}
void addRecentParams(WindowParams& params) const {
- params["Title"] = WindowParam(Text::fromT(t().getText()), false);
+ params["Title"] = WindowParam(Text::fromT(t().getText()));
}
};
=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp 2011-05-04 19:32:00 +0000
+++ win32/MainWindow.cpp 2011-05-06 22:46:06 +0000
@@ -153,7 +153,6 @@
QueueManager::getInstance()->addListener(this);
LogManager::getInstance()->addListener(this);
- WindowManager::getInstance()->addListener(this);
onClosing([this] { return handleClosing(); });
@@ -178,7 +177,23 @@
showPortsError(e.getError());
}
- WindowManager::getInstance()->autoOpen(WinUtil::isShift());
+ {
+ bool skipHubCon = WinUtil::isShift();
+
+ WindowManager* wm = WindowManager::getInstance();
+ auto lock = wm->lock();
+ const auto& list = wm->getList();
+
+ for(auto i = list.cbegin(), iend = list.cend(); i != iend; ++i) {
+ auto id = i->getId();
+ auto params = i->getParams();
+
+ if(skipHubCon && id == WindowManager::hub())
+ params["NoConnect"] = WindowParam(Util::emptyString);
+
+ callAsync([this, id, params] { openWindow(id, params); });
+ }
+ }
callAsync([this] { parseCommandLine(tstring(::GetCommandLine())); });
@@ -915,7 +930,6 @@
if(transfers)
transfers->prepareClose();
- WindowManager::getInstance()->removeListener(this);
LogManager::getInstance()->removeListener(this);
QueueManager::getInstance()->removeListener(this);
@@ -1523,9 +1537,9 @@
}
}
-void MainWindow::on(WindowManagerListener::Window, const string& id, const WindowParams& params) noexcept {
+void MainWindow::openWindow(const string& id, const WindowParams& params) {
if(0);
-#define compare_id(frame) else if(frame::id == id) callAsync([this, params] { frame::parseWindowParams(getTabView(), params); })
+#define compare_id(frame) else if(frame::id == id) frame::parseWindowParams(getTabView(), params)
compare_id(HubFrame);
compare_id(PrivateFrame);
compare_id(DirectoryListingFrame);
=== modified file 'win32/MainWindow.h'
--- win32/MainWindow.h 2011-05-04 19:32:00 +0000
+++ win32/MainWindow.h 2011-05-06 22:46:06 +0000
@@ -21,9 +21,9 @@
#include <dcpp/QueueManagerListener.h>
#include <dcpp/LogManagerListener.h>
-#include <dcpp/WindowManagerListener.h>
#include <dcpp/HttpConnection.h>
#include <dcpp/User.h>
+#include <dcpp/WindowInfo.h>
#include <dwt/widgets/Window.h>
@@ -35,7 +35,6 @@
private HttpConnectionListener,
private QueueManagerListener,
private LogManagerListener,
- private WindowManagerListener,
public AspectStatus<MainWindow>
{
public:
@@ -187,6 +186,7 @@
void handleTrayClicked();
void handleTrayUpdate();
+ void openWindow(const string& id, const WindowParams& params);
void layout();
void updateStatus();
void updateAwayStatus();
@@ -217,9 +217,6 @@
// QueueManagerListener
virtual void on(QueueManagerListener::Finished, QueueItem* qi, const string& dir, int64_t speed) noexcept;
virtual void on(PartialList, const HintedUser&, const string& text) noexcept;
-
- // WindowManagerListener
- virtual void on(WindowManagerListener::Window, const string& id, const WindowParams& params) noexcept;
};
#endif // !defined(MAIN_FRM_H)