Exact file size column in filelist windows

Archived discussion about features (predating the use of Bugzilla as a bug and feature tracker)

Moderator: Moderators

Locked
paka
Posts: 45
Joined: 2004-12-27 19:20

Exact file size column in filelist windows

Post by paka » 2005-01-11 17:24

There's an exact file size column in search window, in download queue, but there is no such column in filelist windows. I find this column very useful when comparing files in my queue, in filelists and on a disk.

I've submitted a patch to Bugzilla: http://dcplusplus.sourceforge.net/cgi-b ... cgi?id=431.

The patch was tested on a few filelists and works for me.

BigDil
Posts: 10
Joined: 2004-07-18 05:19
Location: Budapest, Hungary
Contact:

Post by BigDil » 2005-01-12 10:04

I already have "Exact size" column in filelist windows, using BCDC++ 0.668.
Or is it a BCDC only feature? If this is the case, then I'm sorry. :)

paka
Posts: 45
Joined: 2004-12-27 19:20

Post by paka » 2005-01-12 10:54

Yes, the feature is present in BCDC++ 0.668, but not in clean (vanilla) DC++ 0.668. It's four lines of code in directory listing frame source file that add this functionality.

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2005-01-12 11:50

Good, let's hope arne accepts it
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2005-01-12 12:40

Cologic would have to submit it first. I think it's he that committed the code in the first place.

paka
Posts: 45
Joined: 2004-12-27 19:20

Post by paka » 2005-01-12 15:53

The fact that cologic wrote it first doesn't mean that noone else could write the same (exactly: four) lines of code. Let's have a look at them:

Code: Select all

 ctrlList.InsertColumn(COLUMN_SIZE, CTSTRING(SIZE), LVCFMT_RIGHT, 100, COLUMN_SIZE);
+ctrlList.InsertColumn(COLUMN_EXACT_SIZE, CTSTRING(EXACT_SIZE), LVCFMT_RIGHT, 100, COLUMN_EXACT_SIZE);
 ctrlList.InsertColumn(COLUMN_TTH, CTSTRING(TTH_ROOT), LVCFMT_LEFT, 200, COLUMN_TTH);
The line dealing with SIZE copied to EXACT_SIZE.

Code: Select all

 COLUMN_SIZE,
+COLUMN_EXACT_SIZE,
 COLUMN_TTH,
Naturally, EXACT_SIZE placed in the window after SIZE.

Code: Select all

 columns[COLUMN_SIZE] = Text::toT(Util::formatBytes(f->getSize()));
 if(f->getTTH() != NULL)
  columns[COLUMN_TTH] = Text::toT(f->getTTH()->toBase32());
+columns[COLUMN_EXACT_SIZE] = Text::toT(Util::toString(f->getSize()));
 }; 
Just convert the exact size to a string.

Code: Select all

 switch(col) {
+case COLUMN_EXACT_SIZE:
 case COLUMN_SIZE: return compare(a->file->getSize(), b->file->getSize());
EXACT_SIZE uses the same method of comparing items as SIZE, so both cases together.

The modification is so obvious, that if anyone did an attempt to implement this feature, it would probably look identically. Of course I have no objection if cologic will be listed before me, as the first one to write this patch.

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2005-01-12 16:06

I was actually thinking the same thing, If someone writes the same 4 lines of code and sends them to Arne (of course putting cologic as contributor). Has he rejected them in the past?
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2005-01-13 12:07

I'm just trying to warn people away from submitting code written by others. And, personally, I'd use SIZE_EXACT. :)

The issue I'm avoiding here is detailing what can be covered by copyright. If you can find a clear-cut set of guidelines, especially for source code, feel free to share them.

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2005-01-13 12:12

Ok, I get your point
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2005-01-13 12:54

Guitarm wrote:Ok, I get your point
And that's only for the USA. I think the Berne convention is supposed to normalize copyright law across signing nations, but... Well, in summary, I am not a laywer. And I do like to do things as legally as possible (not rhetoric).

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2005-01-13 13:26

GargoyleMT wrote:I am not a laywer. And I do like to do things as legally as possible (not rhetoric).
Neither am I. And I definitely agree with doing things as legal as possible (at least according to what can be interpreted as legal)
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

paka
Posts: 45
Joined: 2004-12-27 19:20

Post by paka » 2005-01-13 16:24

GargoyleMT wrote:I'm just trying to warn people away from submitting code written by others.
I only hope this won't stop the implementation of a nice little feature (or even a fix - someone must have forgotten to put the column in directory listings when placing it in other frames).
And, personally, I'd use SIZE_EXACT. :)
Right, that's your choice. Still using EXACT_SIZE is more natural, because it's already been used in QueueFrame.cpp, for example. And using another identifier in another part of the program is kind of breaking the standard. You would have to add SIZE_EXACT to StringDefs.* (and EXACT_SIZE is already there).
I am not a laywer.
Me neither, but have studied some law on the university.
The issue I'm avoiding here is detailing what can be covered by copyright.
Yes, this is the problem. Copyright does not protect solutions that are obvious and didn't require creative work to be implemented. In particular, patents do not protect common ideas that are no discovery. Think what it would lead to if they did. Patents deal with a slightly different area, but the idea is the same. Of course you would have to find regulations for your own country, if you want to check it for yourself.

paka
Posts: 45
Joined: 2004-12-27 19:20

Post by paka » 2005-01-13 22:05

I've sent a rewritten patch to Arne. It doesn't contain any line that appears in BCDC++. Also, it contains 2 new lines which deal with directory comparing and displaying directory size in bytes.

Todi
Forum Moderator
Posts: 699
Joined: 2003-03-04 12:16
Contact:

Post by Todi » 2005-01-14 02:38

I seem to remember there being some issues concerning this in the open source community around the time when part of the Windows source code was spread. Essentially, they warned everyone from even looking at the source, because once you've done that your mind could (without you noticing) use the same code in your own projects. It could be the same here.. i mean, sure you could have written the same code as in BCDC++ if you hadn't looked at it, but once you've done that, you most likely would do it the same way because it was a good way =)

paka
Posts: 45
Joined: 2004-12-27 19:20

Post by paka » 2005-01-14 10:57

You're right, Todi. This would most likely be applied to bigger patches. However, I must stick to the fact that the one I'm presenting here is actually only an extension of the idea that is already present in vanilla DC++ (in Download queue frame and in Search frame). It's an analogy, so Arne should probably be the one who has rights to it.

Guitarm
Forum Moderator
Posts: 385
Joined: 2004-01-18 15:38

Post by Guitarm » 2005-01-14 11:56

Seems very logical, yes
"Nothing really happens fast. Everything happens at such a rate that by the time it happens, it all seems normal."

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2005-01-14 13:17

paka wrote:Right, that's your choice. Still using EXACT_SIZE is more natural, because it's already been used in QueueFrame.cpp, for example. And using another identifier in another part of the program is kind of breaking the standard. You would have to add SIZE_EXACT to StringDefs.* (and EXACT_SIZE is already there).
You can use a different enum for the column name while still using ResourceManager::EXACT_SIZE...

paka
Posts: 45
Joined: 2004-12-27 19:20

Post by paka » 2005-01-14 21:29

GargoyleMT wrote:You can use a different enum for the column name while still using ResourceManager::EXACT_SIZE...
True (second parameter of ctrlList.InsertColumn). That's how I did it in the new version of the patch.

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2005-01-17 11:56

On a sidenote, exact size in the queue frame and the search frame both have a STRING(B) appended, and use the thousands separator - does your patch include the same?

paka
Posts: 45
Joined: 2004-12-27 19:20

Post by paka » 2005-01-20 15:02

Thanks, I've corrected this now. The rewritten and improved patch is available as the second attachment @ http://dcplusplus.sourceforge.net/cgi-b ... cgi?id=431. The patch is for DC++ 0.669 CVS version.

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2005-01-20 15:22

Sounds good. Did you mail that version to arne as well?

paka
Posts: 45
Joined: 2004-12-27 19:20

Post by paka » 2005-01-20 15:47

I've just finished writing a letter and sent it.

paka
Posts: 45
Joined: 2004-12-27 19:20

Post by paka » 2005-02-01 18:15

The patch v2 has been added to CVS development version 0.669 2005-02-01.

Locked