linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05301
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2854: add a "Max PM windows" setting
------------------------------------------------------------
revno: 2854
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2012-02-04 18:40:35 +0100
message:
add a "Max PM windows" setting
modified:
dcpp/SettingsManager.cpp
dcpp/SettingsManager.h
help/settings_expert.html
win32/ExpertsPage.cpp
win32/HubFrame.cpp
win32/PrivateFrame.cpp
win32/PrivateFrame.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 'dcpp/SettingsManager.cpp'
--- dcpp/SettingsManager.cpp 2012-01-16 18:29:26 +0000
+++ dcpp/SettingsManager.cpp 2012-02-04 17:40:35 +0000
@@ -94,6 +94,7 @@
"AutoDetectIncomingConnection", "SettingsSaveInterval",
"BalloonMainChat", "BalloonPM", "BalloonPMWindow", "BalloonFinishedDL", "BalloonFinishedFL",
"UsersFilterOnline","UsersFilterFavorite","UsersFilterQueue","UsersFilterWaiting",
+ "MaxPMWindows",
"SENTRY",
// Int64
"TotalUpload", "TotalDownload",
@@ -326,6 +327,7 @@
setDefault(USERS_FILTER_FAVORITE, true);
setDefault(USERS_FILTER_QUEUE, false);
setDefault(USERS_FILTER_WAITING, false);
+ setDefault(MAX_PM_WINDOWS, 20);
setSearchTypeDefaults();
=== modified file 'dcpp/SettingsManager.h'
--- dcpp/SettingsManager.h 2012-01-16 18:29:26 +0000
+++ dcpp/SettingsManager.h 2012-02-04 17:40:35 +0000
@@ -112,6 +112,7 @@
AUTO_DETECT_CONNECTION, SETTINGS_SAVE_INTERVAL,
BALLOON_MAIN_CHAT, BALLOON_PM, BALLOON_PM_WINDOW, BALLOON_FINISHED_DL, BALLOON_FINISHED_FL,
USERS_FILTER_ONLINE, USERS_FILTER_FAVORITE, USERS_FILTER_QUEUE, USERS_FILTER_WAITING,
+ MAX_PM_WINDOWS,
INT_LAST };
enum Int64Setting { INT64_FIRST = INT_LAST + 1,
=== modified file 'help/settings_expert.html'
--- help/settings_expert.html 2011-04-07 13:40:55 +0000
+++ help/settings_expert.html 2012-02-04 17:40:35 +0000
@@ -9,42 +9,51 @@
<h1>Experts only</h1>
<dl style="margin-left: 40px;">
<dt>Max hash speed</dt>
- <dd cshelp="IDH_SETTINGS_ADVANCED3_MAX_HASH_SPEED">This is the speed at which DC++ will hash your files, in
+ <dd cshelp="IDH_SETTINGS_EXPERT_MAX_HASH_SPEED">This is the speed at which DC++ will hash your files, in
MiB/s.
It is limited by the speed of your disk subsystem, but it can be
used to make hashing slower and less noticable. A "normal" hash
speed may be anywhere from 20 to 50 MiB/s. (no default)</dd>
<dt>Write buffer size</dt>
- <dd cshelp="IDH_SETTINGS_ADVANCED3_BUFFERSIZE">This controls the size of the chunks that DC++ writes to
+ <dd cshelp="IDH_SETTINGS_EXPERT_BUFFERSIZE">This controls the size of the chunks that DC++ writes to
disk for downloads. Measured in kibibytes. (default: 16 KiB)</dd>
<dt id="autosearchlimit">Auto-search limit</dt>
- <dd cshelp="IDH_SETTINGS_ADVANCED3_AUTO_SEARCH_LIMIT">This will limit the amount of sources a file can have before it will no longer be auto searched for. For example, if this option is set to 2, if a file has more than or exactly 2 sources, the file will be excluded from the auto-search list.</dd>
+ <dd cshelp="IDH_SETTINGS_EXPERT_AUTO_SEARCH_LIMIT">This will limit the amount of sources a file can have before it will no longer be auto searched for. For example, if this option is set to 2, if a file has more than or exactly 2 sources, the file will be excluded from the auto-search list.</dd>
<dt id="minislotsize">Mini slot size</dt>
- <dd cshelp="IDH_SETTINGS_ADVANCED3_MINISLOT_SIZE">This defines the size of the <a href="settings_sharing.html#slots">mini slot</a>. The
+ <dd cshelp="IDH_SETTINGS_EXPERT_MINISLOT_SIZE">This defines the size of the <a href="settings_sharing.html#slots">mini slot</a>. The
minimum value for this setting is 64 KiB. (default: 64 KiB)</dd>
<dt id="maxlistsize">Max filelist size</dt>
- <dd cshelp="IDH_SETTINGS_ADVANCED3_MAX_FILELIST_SIZE">This setting controls the size of the maximum file list
+ <dd cshelp="IDH_SETTINGS_EXPERT_MAX_FILELIST_SIZE">This setting controls the size of the maximum file list
that DC++
will open, in mebibytes. This setting helps protect against
malformed file lists that require large amounts of memory to decode.
You may need to reduce or increase the value of this setting
based on personal experience. (default: 256 MiB)</dd>
<dt>PID</dt>
- <dd cshelp="IDH_SETTINGS_ADVANCED3_PRIVATE_ID">This is your unique private ID (PID). This will later with an algorithm be used to identify you on ADC hubs. <b>Do not share this with other users.</b></dd>
+ <dd cshelp="IDH_SETTINGS_EXPERT_PRIVATE_ID">This is your unique private ID (PID). This will later with an algorithm be used to identify you on ADC hubs. <b>Do not share this with other users.</b></dd>
<dt id="autorefresh">Auto refresh time</dt>
- <dd cshelp="IDH_SETTINGS_ADVANCED3_AUTO_REFRESH_TIME">This controls the interval at which your shared directories
+ <dd cshelp="IDH_SETTINGS_EXPERT_AUTO_REFRESH_TIME">This controls the interval at which your shared directories
are rescanned for new and changed content. This is measured
in minutes. (default: 60 minutes)</dd>
<dt>Settings save interval</dt>
- <dd cshelp="IDH_SETTINGS_ADVANCED3_SETTINGS_SAVE_INTERVAL">This controls the interval at which
+ <dd cshelp="IDH_SETTINGS_EXPERT_SETTINGS_SAVE_INTERVAL">This controls the interval at which
your settings are automatically saved; good to prevent losses in case of crashes. This is
measured in minutes. (default: 10 minutes)</dd>
<dt>Socket read buffer</dt>
- <dd cshelp="IDH_SETTINGS_ADVANCED3_SOCKET_IN_BUFFER">The size of the buffer DC++ use to read sockets. Measured
+ <dd cshelp="IDH_SETTINGS_EXPERT_SOCKET_IN_BUFFER">The size of the buffer DC++ use to read sockets. Measured
in bytes. (default: 8192 bytes)</dd>
<dt id="writebuffer">Socket write buffer</dt>
- <dd cshelp="IDH_SETTINGS_ADVANCED3_SOCKET_OUT_BUFFER">The size of the buffer DC++ use to write to sockets.
-Measured in bytes. (default: 8192 bytes)</dd>
+ <dd cshelp="IDH_SETTINGS_EXPERT_SOCKET_OUT_BUFFER">The size of the buffer DC++ use to write to sockets.
+ Measured in bytes. (default: 8192 bytes)</dd>
+ <dt>Max PM windows</dt>
+ <dd cshelp="IDH_SETTINGS_EXPERT_MAX_PM_WINDOWS">
+ The maximum amount of <placeholder><a href="window_pm.html">Private Message</a></placeholder>
+ windows that are allowed to be opened at the same time. (default: 20)<br/>
+ When a <placeholder><a href="window_pm.html">Private Message</a></placeholder> window can't be
+ opened because this setting would not be satisfied, the chat message that spawned it will be
+ shown in its originating <placeholder><a href="window_hub.html">Hub</a></placeholder> window
+ instead.
+ </dd>
</dl>
</body>
</html>
=== modified file 'win32/ExpertsPage.cpp'
--- win32/ExpertsPage.cpp 2012-01-23 20:18:58 +0000
+++ win32/ExpertsPage.cpp 2012-02-04 17:40:35 +0000
@@ -40,16 +40,17 @@
grid->column(0).mode = GridInfo::FILL;
grid->column(1).mode = GridInfo::FILL;
- addItem(T_("Max hash speed"), SettingsManager::MAX_HASH_SPEED, true, IDH_SETTINGS_ADVANCED3_MAX_HASH_SPEED, T_("MiB/s"));
- addItem(T_("Write buffer size"), SettingsManager::BUFFER_SIZE, true, IDH_SETTINGS_ADVANCED3_BUFFERSIZE, T_("KiB"));
- addItem(T_("Auto-search limit"), SettingsManager::AUTO_SEARCH_LIMIT, true, IDH_SETTINGS_ADVANCED3_AUTO_SEARCH_LIMIT);
- addItem(T_("Mini slot size"), SettingsManager::SET_MINISLOT_SIZE, true, IDH_SETTINGS_ADVANCED3_MINISLOT_SIZE, T_("KiB"));
- addItem(T_("Max filelist size"), SettingsManager::MAX_FILELIST_SIZE, true, IDH_SETTINGS_ADVANCED3_MAX_FILELIST_SIZE, T_("MiB"));
- addItem(T_("PID"), SettingsManager::PRIVATE_ID, false, IDH_SETTINGS_ADVANCED3_PRIVATE_ID);
- addItem(T_("Auto refresh time"), SettingsManager::AUTO_REFRESH_TIME, true, IDH_SETTINGS_ADVANCED3_AUTO_REFRESH_TIME, T_("minutes"));
- addItem(T_("Settings save interval"), SettingsManager::SETTINGS_SAVE_INTERVAL, true, IDH_SETTINGS_ADVANCED3_SETTINGS_SAVE_INTERVAL, T_("minutes"));
- addItem(T_("Socket read buffer"), SettingsManager::SOCKET_IN_BUFFER, true, IDH_SETTINGS_ADVANCED3_SOCKET_IN_BUFFER, T_("B"));
- addItem(T_("Socket write buffer"), SettingsManager::SOCKET_OUT_BUFFER, true, IDH_SETTINGS_ADVANCED3_SOCKET_OUT_BUFFER, T_("B"));
+ addItem(T_("Max hash speed"), SettingsManager::MAX_HASH_SPEED, true, IDH_SETTINGS_EXPERT_MAX_HASH_SPEED, T_("MiB/s"));
+ addItem(T_("Write buffer size"), SettingsManager::BUFFER_SIZE, true, IDH_SETTINGS_EXPERT_BUFFERSIZE, T_("KiB"));
+ addItem(T_("Auto-search limit"), SettingsManager::AUTO_SEARCH_LIMIT, true, IDH_SETTINGS_EXPERT_AUTO_SEARCH_LIMIT);
+ addItem(T_("Mini slot size"), SettingsManager::SET_MINISLOT_SIZE, true, IDH_SETTINGS_EXPERT_MINISLOT_SIZE, T_("KiB"));
+ addItem(T_("Max filelist size"), SettingsManager::MAX_FILELIST_SIZE, true, IDH_SETTINGS_EXPERT_MAX_FILELIST_SIZE, T_("MiB"));
+ addItem(T_("PID"), SettingsManager::PRIVATE_ID, false, IDH_SETTINGS_EXPERT_PRIVATE_ID);
+ addItem(T_("Auto refresh time"), SettingsManager::AUTO_REFRESH_TIME, true, IDH_SETTINGS_EXPERT_AUTO_REFRESH_TIME, T_("minutes"));
+ addItem(T_("Settings save interval"), SettingsManager::SETTINGS_SAVE_INTERVAL, true, IDH_SETTINGS_EXPERT_SETTINGS_SAVE_INTERVAL, T_("minutes"));
+ addItem(T_("Socket read buffer"), SettingsManager::SOCKET_IN_BUFFER, true, IDH_SETTINGS_EXPERT_SOCKET_IN_BUFFER, T_("B"));
+ addItem(T_("Socket write buffer"), SettingsManager::SOCKET_OUT_BUFFER, true, IDH_SETTINGS_EXPERT_SOCKET_OUT_BUFFER, T_("B"));
+ addItem(T_("Max PM windows"), SettingsManager::MAX_PM_WINDOWS, true, IDH_SETTINGS_EXPERT_MAX_PM_WINDOWS);
PropPage::read(items);
}
=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp 2012-02-01 16:26:37 +0000
+++ win32/HubFrame.cpp 2012-02-04 17:40:35 +0000
@@ -658,10 +658,9 @@
if(ignore) {
addStatus(str(TF_("Ignored message: %1%") % Text::toT(message.message)), false);
+
} else {
- if(window) {
- PrivateFrame::gotMessage(getParent(), message.from, message.to, message.replyTo, message, url);
- } else {
+ if(!window || !PrivateFrame::gotMessage(getParent(), message.from, message.to, message.replyTo, message, url)) {
/// @todo add formatting here (for PMs in main chat)
addChat(str(TF_("Private message from %1%: %2%") % getNick(message.from) % Text::toT(message.message)));
}
=== modified file 'win32/PrivateFrame.cpp'
--- win32/PrivateFrame.cpp 2012-02-01 16:26:37 +0000
+++ win32/PrivateFrame.cpp 2012-02-04 17:40:35 +0000
@@ -56,9 +56,13 @@
frame->sendMessage(msg);
}
-void PrivateFrame::gotMessage(TabViewPtr parent, const UserPtr& from, const UserPtr& to, const UserPtr& replyTo,
+bool PrivateFrame::gotMessage(TabViewPtr parent, const UserPtr& from, const UserPtr& to, const UserPtr& replyTo,
const ChatMessage& message, const string& hubHint)
{
+ if(frames.size() >= SETTING(MAX_PM_WINDOWS)) {
+ return false;
+ }
+
const UserPtr& user = (replyTo == ClientManager::getInstance()->getMe()) ? to : replyTo;
auto i = frames.find(user);
if(i == frames.end()) {
@@ -82,6 +86,8 @@
}
WinUtil::notify(WinUtil::NOTIFICATION_PM, Text::toT(message.message), [user] { activateWindow(user); });
+
+ return true;
}
void PrivateFrame::activateWindow(const UserPtr& u) {
=== modified file 'win32/PrivateFrame.h'
--- win32/PrivateFrame.h 2012-02-01 16:26:37 +0000
+++ win32/PrivateFrame.h 2012-02-04 17:40:35 +0000
@@ -55,7 +55,8 @@
static const string id;
const string& getId() const;
- static void gotMessage(TabViewPtr parent, const UserPtr& from, const UserPtr& to, const UserPtr& replyTo,
+ /// @return whether a new window can be opened (wrt the "Max PM windows" setting).
+ static bool gotMessage(TabViewPtr parent, const UserPtr& from, const UserPtr& to, const UserPtr& replyTo,
const ChatMessage& message, const string& hubHint);
static void openWindow(TabViewPtr parent, const HintedUser& replyTo, const tstring& msg = Util::emptyStringT,
const string& logPath = Util::emptyString, bool activate = true);