Show seeders and leechers in properties window.

Show ratio instead of download rate when torrent is finished.
This commit is contained in:
Josh Elsasser 2006-02-07 17:15:16 +00:00
parent 9b2e8566dd
commit 187bbf909e
5 changed files with 92 additions and 39 deletions

View File

@ -380,7 +380,7 @@ makeinfowind(GtkWindow *parent, tr_handle_t *tr, int id) {
GtkWidget *wind, *label;
int ii;
char *str;
const int rowcount = 12;
const int rowcount = 14;
GtkWidget *table = gtk_table_new(rowcount, 2, FALSE);
/* XXX would be nice to be able to stat just one */
@ -420,6 +420,8 @@ makeinfowind(GtkWindow *parent, tr_handle_t *tr, int id) {
INFOLINEA(table, ii, _("Piece Size:"), readablesize(sb[id].info.pieceSize, 1));
INFOLINEF(table, ii, "%i", _("Pieces:"), sb[id].info.pieceCount);
INFOLINEA(table, ii, _("Total Size:"), readablesize(sb[id].info.totalSize, 1));
INFOLINEF(table, ii, "%i", _("Seeders:"), sb[id].seeders);
INFOLINEF(table, ii, "%i", _("Leechers:"), sb[id].leechers);
INFOSEP(table, ii);

View File

@ -691,9 +691,14 @@ dfprog(GtkTreeViewColumn *col SHUTUP, GtkCellRenderer *rend,
else if(1.0 < prog)
prog = 1.0;
dlstr = readablesize(dl * 1024.0, 2);
ulstr = readablesize(ul * 1024.0, 2);
str = g_strdup_printf(_("DL: %s/s\nUL: %s/s"), dlstr, ulstr);
if(1.0 == prog) {
dlstr = ratiostr(dl, ul);
str = g_strdup_printf(_("Ratio: %s\nUL: %s/s"), dlstr, ulstr);
} else {
dlstr = readablesize(dl * 1024.0, 2);
str = g_strdup_printf(_("DL: %s/s\nUL: %s/s"), dlstr, ulstr);
}
marked = g_markup_printf_escaped("<small>%s</small>", str);
g_object_set(rend, "text", str, "value", prog, NULL);
g_free(dlstr);

View File

@ -8,12 +8,12 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-02-05 12:27-0500\n"
"POT-Creation-Date: 2006-02-07 12:08-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
@ -43,7 +43,7 @@ msgid ""
"%s"
msgstr ""
#: conf.c:115 dialogs.c:191 main.c:947
#: conf.c:115 dialogs.c:191 main.c:1014
#, c-format
msgid ""
"Failed to create the directory %s:\n"
@ -69,21 +69,21 @@ msgid ""
"%s"
msgstr ""
#: conf.c:233 conf.c:431
#: conf.c:233 conf.c:432
#, c-format
msgid ""
"Failed to open or lock the file %s:\n"
"%s"
msgstr ""
#: conf.c:253 conf.c:471
#: conf.c:253 conf.c:472
#, c-format
msgid ""
"Error while writing to the file %s:\n"
"%s"
msgstr ""
#: conf.c:260 conf.c:478
#: conf.c:260 conf.c:479
#, c-format
msgid ""
"Failed to rename the file %s to %s:\n"
@ -167,71 +167,79 @@ msgstr ""
msgid "Total Size:"
msgstr ""
#: dialogs.c:426
msgid "Directory:"
#: dialogs.c:423
msgid "Seeders:"
msgstr ""
#: dialogs.c:427
msgid "Downloaded:"
#: dialogs.c:424
msgid "Leechers:"
msgstr ""
#: dialogs.c:428
msgid "Directory:"
msgstr ""
#: dialogs.c:429
msgid "Downloaded:"
msgstr ""
#: dialogs.c:430
msgid "Uploaded:"
msgstr ""
#: main.c:149
#: main.c:154
msgid "Add"
msgstr ""
#: main.c:150
#: main.c:155
msgid "Add a new torrent"
msgstr ""
#: main.c:151
#: main.c:156
msgid "Start"
msgstr ""
#: main.c:153
#: main.c:158
msgid "Start a torrent that is not running"
msgstr ""
#: main.c:154
#: main.c:159
msgid "Stop"
msgstr ""
#: main.c:156
#: main.c:161
msgid "Stop a torrent that is running"
msgstr ""
#: main.c:157
#: main.c:162
msgid "Remove"
msgstr ""
#: main.c:158
#: main.c:163
msgid "Remove a torrent"
msgstr ""
#: main.c:159
#: main.c:164
msgid "Properties"
msgstr ""
#: main.c:160
#: main.c:165
msgid "Show additional information about a torrent"
msgstr ""
#: main.c:161
#: main.c:166
msgid "Preferences"
msgstr ""
#: main.c:162
#: main.c:167
msgid "Customize application behavior"
msgstr ""
#: main.c:180
#: main.c:185
msgid "Transmission"
msgstr ""
#: main.c:308 main.c:959
#: main.c:315 main.c:1026
#, c-format
msgid "Failed to load the torrent file %s"
msgid_plural ""
@ -240,64 +248,71 @@ msgid_plural ""
msgstr[0] ""
msgstr[1] ""
#: main.c:494
#: main.c:556
msgid "Name"
msgstr ""
#. this string is only used to determing the size of the progress bar
#: main.c:501
#: main.c:563
msgid " fnord fnord "
msgstr ""
#: main.c:504
#: main.c:566
msgid "Progress"
msgstr ""
#: main.c:579
#: main.c:641
#, c-format
msgid "Checking existing files (%.1f%%)"
msgstr ""
#: main.c:581
#: main.c:643
#, c-format
msgid "Finishing in %02i:%02i:%02i (%.1f%%)"
msgstr ""
#: main.c:584
#: main.c:646
#, c-format
msgid "Seeding, uploading to %d of %d peer"
msgid_plural "Seeding, uploading to %d of %d peers"
msgstr[0] ""
msgstr[1] ""
#: main.c:588
#: main.c:650
msgid "Stopping..."
msgstr ""
#: main.c:590
#: main.c:652
#, c-format
msgid "Stopped (%.1f%%)"
msgstr ""
#: main.c:598
#: main.c:660
msgid "Error: "
msgstr ""
#: main.c:602
#: main.c:664
#, c-format
msgid "Downloading from %i of %i peer"
msgid_plural "Downloading from %i of %i peers"
msgstr[0] ""
msgstr[1] ""
#: main.c:634
#: main.c:697
#, c-format
msgid ""
"Ratio: %s\n"
"UL: %s/s"
msgstr ""
#: main.c:700
#, c-format
msgid ""
"DL: %s/s\n"
"UL: %s/s"
msgstr ""
#: main.c:681
#: main.c:748
#, c-format
msgid " Total DL: %s/s Total UL: %s/s"
msgstr ""
@ -329,3 +344,12 @@ msgstr ""
#: util.c:63
msgid "EiB"
msgstr ""
#: util.c:87
msgid "N/A"
msgstr ""
#. this is a UTF-8 infinity symbol
#: util.c:91
msgid "∞"
msgstr ""

View File

@ -79,6 +79,23 @@ readablesize(guint64 size, int decimals) {
return g_strdup_printf("%.*f %s", decimals, small, gettext(sizestrs[ii]));
}
char *
ratiostr(guint64 down, guint64 up) {
double ratio;
if(0 == up && 0 == down)
return g_strdup(_("N/A"));
if(0 == down)
/* this is a UTF-8 infinity symbol */
return g_strdup(_("\xE2\x88\x9E"));
ratio = up / down;
return g_strdup_printf("%.*f", (10.0 > ratio ? 2 : (100.0 > ratio ? 1 : 0)),
ratio);
}
gboolean
mkdir_p(const char *name, mode_t mode) {
struct stat sb;

View File

@ -53,6 +53,11 @@ strbool(const char *str);
char *
readablesize(guint64 size, int decimals);
/* returns a string representing the download ratio.
the string must be g_free()d */
char *
ratiostr(guint64 down, guint64 up);
/* create a directory and any missing parent directories */
gboolean
mkdir_p(const char *name, mode_t mode);