← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2412: More status bar icons

 

------------------------------------------------------------
revno: 2412
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2011-02-02 18:45:47 +0100
message:
  More status bar icons
added:
  res/SlotsFull.ico
modified:
  changelog.txt
  res/Slots.ico
  win32/DCPlusPlus.rc
  win32/HubFrame.cpp
  win32/HubFrame.h
  win32/MainWindow.cpp
  win32/MainWindow.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	2011-02-02 16:46:25 +0000
+++ changelog.txt	2011-02-02 17:45:47 +0000
@@ -6,6 +6,7 @@
 * Favorite user nicks are saved in Users.xml
 * Be stricter when determining whether MiniUPnP has succeeded (poy)
 * Display the name of the device MiniUPnP has bound to (poy)
+* More status bar icons
 
 -- 0.781 2011-01-12 --
 * Add a dummy serial number to TLS certs to satisfy some parsers (poy)

=== modified file 'res/Slots.ico'
Binary files res/Slots.ico	2010-08-29 15:42:38 +0000 and res/Slots.ico	2011-02-02 17:45:47 +0000 differ
=== added file 'res/SlotsFull.ico'
Binary files res/SlotsFull.ico	1970-01-01 00:00:00 +0000 and res/SlotsFull.ico	2011-02-02 17:45:47 +0000 differ
=== modified file 'win32/DCPlusPlus.rc'
--- win32/DCPlusPlus.rc	2011-02-01 20:32:13 +0000
+++ win32/DCPlusPlus.rc	2011-02-02 17:45:47 +0000
@@ -98,6 +98,7 @@
 IDI_FAVORITE_USER_OFF   ICON                    "res/FavoriteUserOff.ico"
 IDI_GRANT_SLOT_ON       ICON                    "res/GrantSlotOn.ico"
 IDI_GRANT_SLOT_OFF      ICON                    "res/GrantSlotOff.ico"
+IDI_SLOTS_FULL          ICON                    "res/SlotsFull.ico"
 
 /////////////////////////////////////////////////////////////////////////////
 //

=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp	2011-01-30 13:28:11 +0000
+++ win32/HubFrame.cpp	2011-02-02 17:45:47 +0000
@@ -196,6 +196,8 @@
 	status->setSize(STATUS_SHOW_USERS, showUsers->getPreferredSize().x);
 	status->onDblClicked(STATUS_STATUS, std::bind(&HubFrame::openLog, this, false));
 
+	status->setIcon(STATUS_USERS, WinUtil::statusIcon(IDI_USER));
+
 	status->setHelpId(STATUS_STATUS, IDH_HUB_STATUS);
 	status->setHelpId(STATUS_SECURE, IDH_HUB_SECURE_STATUS);
 	status->setHelpId(STATUS_USERS, IDH_HUB_USERS_COUNT);
@@ -279,7 +281,10 @@
 }
 
 void HubFrame::updateStatus() {
-	status->setText(STATUS_USERS, getStatusUsers());
+	auto users = getStatusUsers();
+	status->setText(STATUS_USERS, users.second + Text::toT(Util::toString(users.first)));
+	status->setToolTip(STATUS_USERS, users.second + str(TFN_("%1% user", "%1% users", users.first) % users.first));
+
 	status->setText(STATUS_SHARED, getStatusShared());
 	status->setText(STATUS_AVERAGE_SHARED, getStatusAverageShared());
 }
@@ -861,7 +866,7 @@
 	return Text::toT(Util::formatBytes(available));
 }
 
-tstring HubFrame::getStatusUsers() const {
+pair<size_t, tstring> HubFrame::getStatusUsers() const {
 	size_t userCount = 0;
 	for(UserMap::const_iterator i = userMap.begin(); i != userMap.end(); ++i){
 		UserInfo* ui = i->second;
@@ -874,7 +879,7 @@
 		textForUsers += Text::toT(Util::toString(users->countSelected()) + "/");
 	if (showUsers->getChecked() && users->size() < userCount)
 		textForUsers += Text::toT(Util::toString(users->size()) + "/");
-	return textForUsers + str(TFN_("%1% user", "%1% users", userCount) % userCount);
+	return make_pair(userCount, textForUsers);
 }
 
 tstring HubFrame::getStatusAverageShared() const {

=== modified file 'win32/HubFrame.h'
--- win32/HubFrame.h	2011-01-30 13:28:11 +0000
+++ win32/HubFrame.h	2011-02-02 17:45:47 +0000
@@ -201,7 +201,7 @@
 	void addChat(const tstring& aLine);
 	void addStatus(const tstring& aLine, bool legitimate = true);
 
-	tstring getStatusUsers() const;
+	pair<size_t, tstring> getStatusUsers() const;
 	tstring getStatusShared() const;
 	tstring getStatusAverageShared() const;
 	void updateStatus();

=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp	2011-01-30 20:01:21 +0000
+++ win32/MainWindow.cpp	2011-02-02 17:45:47 +0000
@@ -93,7 +93,8 @@
 lastUp(0),
 lastDown(0),
 lastTick(GET_TICK()),
-prevAway(false)
+prevAway(false),
+fullSlots(false)
 {
 	links.homepage = _T("http://dcplusplus.sourceforge.net/";);
 	links.downloads = links.homepage + _T("download/");
@@ -918,9 +919,14 @@
 	status->setText(STATUS_COUNTS, s);
 	status->setToolTip(STATUS_COUNTS, str(TF_("Hubs: %1%") % s));
 
-	s = str(TF_("%1%/%2%") % UploadManager::getInstance()->getFreeSlots() % (SETTING(SLOTS)));
-	status->setText(STATUS_SLOTS, s, true);
-	status->setToolTip(STATUS_SLOTS, str(TF_("Slots: %1%") % s));
+	auto freeSlots = UploadManager::getInstance()->getFreeSlots();
+	auto totalSlots = SETTING(SLOTS);
+	status->setText(STATUS_SLOTS, str(TF_("%1%/%2%") % freeSlots % totalSlots), true);
+	status->setToolTip(STATUS_SLOTS, str(TF_("%1% free slots of %2% total upload slots") % freeSlots % totalSlots));
+	if(!freeSlots ^ fullSlots) {
+		fullSlots = !freeSlots;
+		status->setIcon(STATUS_SLOTS, WinUtil::statusIcon(fullSlots ? IDI_SLOTS_FULL : IDI_SLOTS));
+	}
 
 	s = Text::toT(Util::formatBytes(down));
 	status->setText(STATUS_DOWN_TOTAL, s);

=== modified file 'win32/MainWindow.h'
--- win32/MainWindow.h	2011-01-09 14:54:10 +0000
+++ win32/MainWindow.h	2011-02-02 17:45:47 +0000
@@ -132,6 +132,7 @@
 	int64_t lastDown;
 	uint64_t lastTick;
 	bool prevAway;
+	bool fullSlots;
 
 	dwt::Application::FilterIter filterIter;
 	dwt::NotificationPtr notify;

=== modified file 'win32/resource.h'
--- win32/resource.h	2011-01-30 16:17:57 +0000
+++ win32/resource.h	2011-02-02 17:45:47 +0000
@@ -64,6 +64,7 @@
 #define IDI_FAVORITE_USER_OFF 156
 #define IDI_GRANT_SLOT_ON 157
 #define IDI_GRANT_SLOT_OFF 158
+#define IDI_SLOTS_FULL 159
 
 // Stuff that uses multiple id's