linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #04946
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2716: minor stuff wrt user matching
------------------------------------------------------------
revno: 2716
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2011-12-13 18:16:36 +0100
message:
minor stuff wrt user matching
modified:
dcpp/UserMatchManager.cpp
win32/ConnectivityPage.cpp
win32/StylesPage.cpp
win32/UserInfoBase.cpp
win32/UserMatchDlg.cpp
win32/UserMatchPage.cpp
--
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/UserMatchManager.cpp'
--- dcpp/UserMatchManager.cpp 2011-12-11 18:36:51 +0000
+++ dcpp/UserMatchManager.cpp 2011-12-13 17:16:36 +0000
@@ -22,7 +22,6 @@
#include "Client.h"
#include "ClientManager.h"
#include "format.h"
-#include "ScopedFunctor.h"
#include "SimpleXML.h"
#include "version.h"
@@ -97,7 +96,7 @@
matcher.setFlag(UserMatch::GENERATED);
matcher.setFlag(ignore ? UserMatch::IGNORE_CHAT : UserMatch::FORCE_CHAT);
- matcher.name = str(F_("Match %1% (added by %2%)") % nick % APPNAME);
+ matcher.name = str(F_("%1% %2% (added by %3%)") % (ignore ? _("Ignore") : _("Un-ignore")) % nick % APPNAME);
if(!user.user->isNMDC()) {
// for ADC, just match the CID.
@@ -124,19 +123,17 @@
auto newList = list;
- ScopedFunctor(([this, &newList, &matcher] {
- newList.insert(newList.begin(), std::move(matcher));
- setList(std::move(newList));
- }));
-
// see if an automatic matcher with these rules already exists.
for(auto i = newList.begin(), iend = newList.end(); i != iend; ++i) {
if(i->isSet(UserMatch::GENERATED) && i->rules == matcher.rules) {
matcher.style = i->style;
newList.erase(i);
- return;
+ break;
}
}
+
+ newList.insert(newList.begin(), std::move(matcher));
+ setList(std::move(newList));
}
void UserMatchManager::on(SettingsManagerListener::Load, SimpleXML& xml) noexcept {
=== modified file 'win32/ConnectivityPage.cpp'
--- win32/ConnectivityPage.cpp 2011-10-23 13:22:23 +0000
+++ win32/ConnectivityPage.cpp 2011-12-13 17:16:36 +0000
@@ -81,6 +81,7 @@
edit = cur2->addChild(Button::Seed(T_("Edit detected settings")));
edit->setHelpId(IDH_SETTINGS_CONNECTIVITY_EDIT);
+ edit->setImage(WinUtil::buttonIcon(IDI_CONN_GREY));
edit->onClicked([this] { handleEdit(); });
}
=== modified file 'win32/StylesPage.cpp'
--- win32/StylesPage.cpp 2011-12-11 18:36:51 +0000
+++ win32/StylesPage.cpp 2011-12-13 17:16:36 +0000
@@ -143,6 +143,7 @@
auto button = row->addChild(Button::Seed(T_("Configure user matching definitions")));
button->setHelpId(IDH_SETTINGS_STYLES_CONF_USER_MATCHING);
+ button->setImage(WinUtil::buttonIcon(IDI_USERS));
button->onClicked([this] { static_cast<SettingsDialog*>(getRoot())->activatePage<UserMatchPage>(); });
showGen = row->addChild(CheckBox::Seed(str(TF_("Show those generated by %1%") % APPNAME)));
=== modified file 'win32/UserInfoBase.cpp'
--- win32/UserInfoBase.cpp 2011-12-10 18:51:47 +0000
+++ win32/UserInfoBase.cpp 2011-12-13 17:16:36 +0000
@@ -165,9 +165,15 @@
auto priv = ui->keepHub();
auto lock = ClientManager::getInstance()->lock();
auto ou = ClientManager::getInstance()->findOnlineUser(ui->getUser(), priv);
- if(ou && ou->getIdentity().noChat()) {
+ if(ou) {
+ if(ou->getIdentity().noChat()) {
+ unsetFlag(chatNotIgnoredOnly);
+ } else {
+ unsetFlag(chatIgnoredOnly);
+ }
+ } else {
+ // offline user: show both ignore & un-ignore commands
unsetFlag(chatNotIgnoredOnly);
- } else {
unsetFlag(chatIgnoredOnly);
}
}
=== modified file 'win32/UserMatchDlg.cpp'
--- win32/UserMatchDlg.cpp 2011-12-11 18:36:51 +0000
+++ win32/UserMatchDlg.cpp 2011-12-13 17:16:36 +0000
@@ -146,29 +146,29 @@
auto controls = rules->getChildren<Control>();
int8_t counter = -1;
- std::unique_ptr<UserMatch::Rule> rule;
+ UserMatch::Rule rule;
boost::for_each(controls, [this, &counter, &rule](Control* control) {
enum { RuleField, RuleSearch, RuleMethod, RuleRemove };
switch(++counter) {
case RuleField:
{
- rule.reset(new UserMatch::Rule());
- rule->field = static_cast<decltype(rule->field)>(static_cast<ComboBoxPtr>(control)->getSelected());
+ rule = UserMatch::Rule();
+ rule.field = static_cast<decltype(rule.field)>(static_cast<ComboBoxPtr>(control)->getSelected());
break;
}
case RuleSearch:
{
- rule->pattern = Text::fromT(static_cast<TextBoxPtr>(control)->getText());
+ rule.pattern = Text::fromT(static_cast<TextBoxPtr>(control)->getText());
break;
}
case RuleMethod:
{
- rule->setMethod(static_cast<UserMatch::Rule::Method>(static_cast<ComboBoxPtr>(control)->getSelected()));
+ rule.setMethod(static_cast<UserMatch::Rule::Method>(static_cast<ComboBoxPtr>(control)->getSelected()));
break;
}
case RuleRemove:
{
- this->result.addRule(std::move(*rule));
+ this->result.addRule(std::move(rule));
counter = -1;
break;
}
=== modified file 'win32/UserMatchPage.cpp'
--- win32/UserMatchPage.cpp 2011-12-10 18:51:47 +0000
+++ win32/UserMatchPage.cpp 2011-12-13 17:16:36 +0000
@@ -105,6 +105,7 @@
{
auto button = grid->addChild(Grid::Seed(1, 1))->addChild(Button::Seed(T_("Configure styles (fonts / colors) for these user matching definitions")));
button->setHelpId(IDH_SETTINGS_USER_MATCH_STYLES);
+ button->setImage(WinUtil::buttonIcon(IDI_STYLES));
button->onClicked([this] { static_cast<SettingsDialog*>(getRoot())->activatePage<StylesPage>(); });
}