linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #07655
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3369: Hub icon will change depending on user status (user/registered/operator)
------------------------------------------------------------
revno: 3369
committer: Fredrik Ullner <ullner@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Fri 2013-11-22 23:26:10 +0100
message:
Hub icon will change depending on user status (user/registered/operator)
added:
res/UserReg.ico
modified:
changelog.txt
win32/DCPlusPlus.rc
win32/HubFrame.cpp
win32/HubFrame.h
win32/WinUtil.cpp
win32/WinUtil.h
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 'changelog.txt'
--- changelog.txt 2013-11-18 22:11:26 +0000
+++ changelog.txt 2013-11-22 22:26:10 +0000
@@ -2,6 +2,7 @@
* [L#1225420] Open own list when using get/browse file list on self (ullner)
* [L#1250614] Added menu option on hub tab for only searching in that hub (ullner)
* [L#250238] Remove queued files that are already shared when DC++ starts (ullner)
+* [L#309815] Hub icon will change depending on user status (user/registered/operator) (ullner)
-- 0.831 2013-11-11 --
* [L#1249810] Fix NMDC TTH search responses (emtee)
=== added file 'res/UserReg.ico'
Binary files res/UserReg.ico 1970-01-01 00:00:00 +0000 and res/UserReg.ico 2013-11-22 22:26:10 +0000 differ
=== modified file 'win32/DCPlusPlus.rc'
--- win32/DCPlusPlus.rc 2013-11-19 18:58:56 +0000
+++ win32/DCPlusPlus.rc 2013-11-22 22:26:10 +0000
@@ -95,6 +95,7 @@
IDI_DLIMIT ICON "res/DLimit.ico"
IDI_OPEN_OWN_FILE_LIST ICON "res/OpenOwnFileList.ico"
IDI_PLUGINS ICON "res/Plugins.ico"
+IDI_USER_REG ICON "res/UserReg.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Version
=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp 2013-11-13 21:48:31 +0000
+++ win32/HubFrame.cpp 2013-11-22 22:26:10 +0000
@@ -183,7 +183,8 @@
updateUsers(false),
currentUser(0),
hubMenu(false),
-inTabComplete(false)
+inTabComplete(false),
+tabIcon(IDI_HUB)
{
paned = addChild(SplitterContainer::Seed(SETTING(HUB_PANED_POS)));
@@ -958,6 +959,12 @@
}
void HubFrame::on(ClientListener::UserUpdated, Client*, const OnlineUser& user) noexcept {
+
+ if(user.getIdentity().isSelf())
+ {
+ callAsync([this] { setTabIcon(); });
+ }
+
auto task = new UserTask(user);
callAsync([this, task] {
tasks.emplace_back([=](const UserTask& u) {
@@ -975,6 +982,11 @@
void HubFrame::on(UsersUpdated, Client*, const OnlineUserList& aList) noexcept {
for(auto& i: aList) {
+ if(i->getIdentity().isSelf())
+ {
+ callAsync([this] { setTabIcon(); });
+ }
+
auto task = new UserTask(*i);
callAsync([this, task] { tasks.emplace_back([=](const UserTask& u) { updateUser(u); }, unique_ptr<UserTask>(task)); });
}
@@ -1526,3 +1538,46 @@
HubFrame::UserInfoList HubFrame::selectedUsersImpl() const {
return showUsers->getChecked() ? usersFromTable(users) : (currentUser ? UserInfoList(1, currentUser) : UserInfoList());
}
+
+void HubFrame::setTabIcon()
+{
+ bool setTabIcon = false;
+
+ auto myIdentity = client->getMyIdentity();
+ if(myIdentity.isOp())
+ {
+ if(tabIcon != IDI_USER_OP)
+ {
+ tabIcon = IDI_USER_OP;
+
+ setTabIcon = true;
+ }
+ }
+ else if(myIdentity.isRegistered())
+ {
+ if(tabIcon != IDI_USER_REG)
+ {
+ tabIcon = IDI_USER_REG;
+
+ setTabIcon = true;
+ }
+ }
+ else
+ {
+ if(tabIcon != IDI_HUB)
+ {
+ tabIcon = IDI_HUB;
+
+ setTabIcon = true;
+ }
+ }
+
+ if(setTabIcon)
+ {
+ std::vector<int> icons;
+ icons.push_back(IDI_HUB);
+ icons.push_back(tabIcon);
+
+ setIcon(WinUtil::mergeIcons(icons));
+ }
+}
=== modified file 'win32/HubFrame.h'
--- win32/HubFrame.h 2013-11-13 21:48:31 +0000
+++ win32/HubFrame.h 2013-11-22 22:26:10 +0000
@@ -285,6 +285,12 @@
virtual void on(SearchFlood, Client*, const string&) noexcept;
virtual void on(ClientLine, Client*, const string& line, int type) noexcept;
void onStatusMessage(const string& line, int flags);
+
+ // Icon management
+ void setTabIcon();
+
+ int tabIcon;
+
};
#endif // !defined(HUB_FRAME_H)
=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp 2013-11-13 21:48:31 +0000
+++ win32/WinUtil.cpp 2013-11-22 22:26:10 +0000
@@ -1642,3 +1642,17 @@
dwt::IconPtr WinUtil::toolbarIcon(unsigned id) {
return createIcon(id, SETTING(TOOLBAR_SIZE));
}
+
+dwt::IconPtr WinUtil::mergeIcons(const std::vector<int>& iconIds)
+{
+ const dwt::Point size(16, 16);
+ dwt::ImageList icons(size);
+
+ for(auto& item : iconIds)
+ {
+ auto icon = createIcon(item, 16);
+ icons.add(*icon);
+ }
+
+ return dwt::util::merge(icons);
+}
=== modified file 'win32/WinUtil.h'
--- win32/WinUtil.h 2013-11-13 21:48:31 +0000
+++ win32/WinUtil.h 2013-11-22 22:26:10 +0000
@@ -317,6 +317,8 @@
static inline dwt::IconPtr tabIcon(unsigned id) { return createIcon(id, 16); }
static dwt::IconPtr toolbarIcon(unsigned id);
+ static dwt::IconPtr mergeIcons(const std::vector<int>& iconIds);
+
private:
static void initUserMatching();
static void initHelpPath();
=== modified file 'win32/resource.h'
--- win32/resource.h 2013-11-01 18:38:32 +0000
+++ win32/resource.h 2013-11-22 22:26:10 +0000
@@ -83,6 +83,7 @@
#define IDI_OPEN_OWN_FILE_LIST 177
#define IDI_PLUGINS 178
#define IDI_UPLOAD_FILTERING 179
+#define IDI_USER_REG 180
// Stuff that uses multiple id's