linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #07697
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3373: Added icons to the favorite hubs window for the status
------------------------------------------------------------
revno: 3373
committer: Fredrik Ullner <ullner@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Fri 2013-11-29 23:04:09 +0100
message:
Added icons to the favorite hubs window for the status
modified:
win32/FavHubsFrame.cpp
win32/FavHubsFrame.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 'win32/FavHubsFrame.cpp'
--- win32/FavHubsFrame.cpp 2013-11-29 17:42:21 +0000
+++ win32/FavHubsFrame.cpp 2013-11-29 22:04:09 +0000
@@ -43,6 +43,8 @@
const string FavHubsFrame::id = "FavHubs";
const string& FavHubsFrame::getId() const { return id; }
+dwt::ImageListPtr FavHubsFrame::hubIcons;
+
static const ColumnInfo hubsColumns[] = {
{ N_("Status"), 25, false },
{ N_("Name"), 200, false },
@@ -81,6 +83,14 @@
WinUtil::makeColumns(hubs, hubsColumns, COLUMN_LAST, SETTING(FAVHUBSFRAME_ORDER), SETTING(FAVHUBSFRAME_WIDTHS));
+ if(!hubIcons) {
+ const dwt::Point size(16, 16);
+ hubIcons = dwt::ImageListPtr(new dwt::ImageList(size));
+ hubIcons->add(dwt::Icon(IDI_HUB, size));
+ hubIcons->add(dwt::Icon(IDI_HUB_OFF, size));
+ }
+ hubs->setSmallImageList(hubIcons);
+
hubs->onDblClicked([this] { handleDoubleClick(); });
hubs->onKeyDown([this](int c) { return handleKeyDown(c); });
hubs->onContextMenu([this](const dwt::ScreenCoordinate &sc) { return handleContextMenu(sc); });
@@ -410,9 +420,11 @@
index = -1;
auto statusText = Util::emptyStringT;
+ auto statusIcon = HUB_OFF_ICON;
if(ClientManager::getInstance()->isHubConnected(entry->getServer()))
{
statusText = T_("Connected");
+ statusIcon = HUB_ON_ICON;
}
TStringList l;
@@ -425,7 +437,9 @@
l.push_back(Text::toT(entry->get(HubSettings::Description)));
l.push_back(Text::toT(group));
- hubs->insert(l, reinterpret_cast<LPARAM>(entry), index);
+ auto row = hubs->insert(l, reinterpret_cast<LPARAM>(entry), index);
+
+ hubs->setIcon(row, COLUMN_STATUS, statusIcon);
}
}
=== modified file 'win32/FavHubsFrame.h'
--- win32/FavHubsFrame.h 2013-11-29 17:42:21 +0000
+++ win32/FavHubsFrame.h 2013-11-29 22:04:09 +0000
@@ -78,9 +78,16 @@
int scroll;
};
+ enum {
+ HUB_ON_ICON,
+ HUB_OFF_ICON
+ };
+
GridPtr grid;
TablePtr hubs;
+ static dwt::ImageListPtr hubIcons;
+
void handleAdd();
void handleProperties();
void handleMove(bool up);