linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #06702
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3228: search fixes
------------------------------------------------------------
revno: 3228
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2013-03-18 19:26:38 +0100
message:
search fixes
modified:
dcpp/SettingsManager.cpp
dcpp/version.h
dwt/src/widgets/Table.cpp
win32/DCPlusPlus.rc
win32/SearchFrame.cpp
win32/SearchFrame.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 2013-03-16 14:40:25 +0000
+++ dcpp/SettingsManager.cpp 2013-03-18 18:26:38 +0000
@@ -503,6 +503,13 @@
Util::replace("OpenFL", "OpenFL,OpenOwnFL", strSettings[TOOLBAR - STR_FIRST]);
}
+ if(v <= 0.811) {
+ // reset search columns
+ unset(SEARCHFRAME_ORDER);
+ unset(SEARCHFRAME_WIDTHS);
+ unset(SEARCHFRAME_SORT);
+ }
+
if(SETTING(SET_MINISLOT_SIZE) < 512)
set(SET_MINISLOT_SIZE, 512);
if(SETTING(AUTODROP_INTERVAL) < 1)
=== modified file 'dcpp/version.h'
--- dcpp/version.h 2013-03-04 12:40:34 +0000
+++ dcpp/version.h 2013-03-18 18:26:38 +0000
@@ -21,8 +21,8 @@
#define APPNAME "DC++"
// don't forget to update the .rc file as well!
-#define VERSIONSTRING "0.811"
-#define VERSIONFLOAT 0.811
+#define VERSIONSTRING "0.819"
+#define VERSIONFLOAT 0.819
namespace dcpp {
extern const std::string fullVersionString;
=== modified file 'dwt/src/widgets/Table.cpp'
--- dwt/src/widgets/Table.cpp 2013-03-16 15:25:18 +0000
+++ dwt/src/widgets/Table.cpp 2013-03-18 18:26:38 +0000
@@ -649,20 +649,17 @@
}
Rectangle Table::getRect(int row, int col, int code) {
- ::RECT r;
- ListView_GetSubItemRect(handle(), row, col, code, &r);
+ /* avoid ListView_GetSubItemRect which returns more or less garbage (depending on the Windows
+ version) when asked for the first column. */
+ auto rect = getRect(row, code);
- // when asked for the column 0, Windows returns a rect for the whole item.
- if(col == 0) {
- ::POINT org;
- ListView_GetOrigin(handle(), &org);
- ::RECT colRect;
- Header_GetItemRect(ListView_GetHeader(handle()), col, &colRect);
- r.left = colRect.left - org.x;
- r.right = colRect.right - org.x;
+ ::RECT colRect;
+ if(Header_GetItemRect(ListView_GetHeader(handle()), col, &colRect)) {
+ rect.pos.x += colRect.left;
+ rect.size.x = colRect.right - colRect.left;
}
- return Rectangle(r);
+ return rect;
}
}
=== modified file 'win32/DCPlusPlus.rc'
--- win32/DCPlusPlus.rc 2013-03-04 12:40:34 +0000
+++ win32/DCPlusPlus.rc 2013-03-18 18:26:38 +0000
@@ -100,8 +100,8 @@
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,8,1,1
- PRODUCTVERSION 0,8,1,1
+ FILEVERSION 0,8,1,9
+ PRODUCTVERSION 0,8,1,9
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -118,12 +118,12 @@
BEGIN
VALUE "Comments", "http://dcplusplus.sourceforge.net"
VALUE "FileDescription", "DC++"
- VALUE "FileVersion", "0, 8, 1, 1"
+ VALUE "FileVersion", "0, 8, 1, 9"
VALUE "InternalName", "DC++"
VALUE "LegalCopyright", "Copyright 2001-2013 Jacek Sieka"
VALUE "OriginalFilename", "DCPlusPlus.exe"
VALUE "ProductName", "DC++"
- VALUE "ProductVersion", "0, 8, 1, 1"
+ VALUE "ProductVersion", "0, 8, 1, 9"
END
END
BLOCK "VarFileInfo"
=== modified file 'win32/SearchFrame.cpp'
--- win32/SearchFrame.cpp 2013-03-17 13:54:47 +0000
+++ win32/SearchFrame.cpp 2013-03-18 18:26:38 +0000
@@ -47,11 +47,12 @@
static const ColumnInfo resultsColumns[] = {
{ N_("File"), 200, false },
+ { N_("Hits"), 50, true },
{ N_("User"), 100, false },
{ N_("Type"), 60, false },
{ N_("Size"), 80, true },
{ N_("Path"), 100, false },
- { N_("Slots"), 40, true },
+ { N_("Slots"), 50, true },
{ N_("Connection"), 70, false },
{ N_("Hub"), 150, false },
{ N_("Exact size"), 100, true },
@@ -77,23 +78,12 @@
int SearchFrame::SearchInfo::compareItems(const SearchInfo* a, const SearchInfo* b, int col) {
switch(col) {
- case COLUMN_NICK:
- if(a->srs.size() > 1 && b->srs.size() > 1)
- return compare(a->srs.size(), b->srs.size());
- else if (a->srs.size() > 1 || b->srs.size() > 1)
- return(a->srs.size() > 1) ? -1 : 1;
- else
- return compare(a->columns[COLUMN_NICK], b->columns[COLUMN_NICK]);
+ case COLUMN_HITS: return compare(a->srs.size(), b->srs.size());
case COLUMN_TYPE:
if(a->srs[0]->getType() == b->srs[0]->getType())
return compare(a->columns[COLUMN_TYPE], b->columns[COLUMN_TYPE]);
else
return(a->srs[0]->getType() == SearchResult::TYPE_DIRECTORY) ? -1 : 1;
- case COLUMN_SLOTS:
- if(a->srs[0]->getFreeSlots() == b->srs[0]->getFreeSlots())
- return compare(a->srs[0]->getSlots(), b->srs[0]->getSlots());
- else
- return compare(a->srs[0]->getFreeSlots(), b->srs[0]->getFreeSlots());
case COLUMN_SIZE: // Fall through
case COLUMN_EXACT_SIZE: return compare(a->srs[0]->getSize(), b->srs[0]->getSize());
default: return compare(a->getText(col), b->getText(col));
@@ -254,7 +244,7 @@
results->setSmallImageList(WinUtil::fileImages);
WinUtil::makeColumns(results, resultsColumns, COLUMN_LAST, SETTING(SEARCHFRAME_ORDER), SETTING(SEARCHFRAME_WIDTHS));
- WinUtil::setTableSort(results, COLUMN_LAST, SettingsManager::SEARCHFRAME_SORT, -1);
+ WinUtil::setTableSort(results, COLUMN_LAST, SettingsManager::SEARCHFRAME_SORT, COLUMN_HITS, false);
results->onDblClicked([this] { handleDownload(); });
results->onKeyDown([this](int c) { return handleKeyDown(c); });
@@ -493,19 +483,26 @@
}
}
+ if(parent) {
+ columns[COLUMN_HITS].clear();
+ } else {
+ columns[COLUMN_HITS] = Text::toT(Util::toString(srs.size())).c_str();
+ }
+
if(srs.size() > 1) {
- columns[COLUMN_NICK] = str(TFN_("%1% user", "%1% users", srs.size()) % srs.size());
columns[COLUMN_CONNECTION].clear();
columns[COLUMN_IP].clear();
columns[COLUMN_CID].clear();
- std::set<std::string> hubs;
+ std::set<std::string> nicks, hubs;
int freeSlots = 0, slots = 0;
for(auto& i: srs) {
+ nicks.insert(ClientManager::getInstance()->getNicks(i->getUser())[0]);
hubs.insert(i->getHubName());
freeSlots += i->getFreeSlots();
slots += i->getSlots();
}
+ columns[COLUMN_NICK] = Text::toT(Util::toString(StringList(nicks.begin(), nicks.end())));
columns[COLUMN_HUB] = Text::toT(Util::toString(StringList(hubs.begin(), hubs.end())));
columns[COLUMN_SLOTS] = Text::toT(Util::toString(freeSlots) + '/' + Util::toString(slots));
@@ -611,6 +608,12 @@
addToList(dupChild);
}
addToList(si);
+
+ /* single results get inserted at the right position; children, however, may alter their
+ parent's sorting. */
+ if(parent) {
+ results->resort();
+ }
}
updateStatusCount();
=== modified file 'win32/SearchFrame.h'
--- win32/SearchFrame.h 2013-03-17 13:54:47 +0000
+++ win32/SearchFrame.h 2013-03-18 18:26:38 +0000
@@ -65,6 +65,7 @@
enum {
COLUMN_FIRST,
COLUMN_FILENAME = COLUMN_FIRST,
+ COLUMN_HITS,
COLUMN_NICK,
COLUMN_TYPE,
COLUMN_SIZE,