(trunk) remove the wx client
This commit is contained in:
parent
9d335e391e
commit
c756e244b3
|
@ -14,9 +14,6 @@ endif
|
|||
if BUILD_MAC
|
||||
MAC_DIR = macosx
|
||||
endif
|
||||
if BUILD_WX
|
||||
WX_DIR = wx
|
||||
endif
|
||||
|
||||
SUBDIRS = \
|
||||
doc \
|
||||
|
@ -26,8 +23,7 @@ SUBDIRS = \
|
|||
$(CLI_DIR) \
|
||||
$(BEOS_DIR) \
|
||||
$(GTK_DIR) \
|
||||
$(MAC_DIR) \
|
||||
$(WX_DIR)
|
||||
$(MAC_DIR)
|
||||
|
||||
EXTRA_DIST = \
|
||||
web \
|
||||
|
|
24
configure.ac
24
configure.ac
|
@ -271,27 +271,6 @@ if test "x$enable_nls" = "xyes" ; then
|
|||
AC_SUBST(transmissionlocaledir)
|
||||
fi
|
||||
|
||||
dnl ----------------------------------------------------------------------------
|
||||
dnl
|
||||
dnl wxWidgets detection for the wxWidgets client
|
||||
|
||||
build_wx=no
|
||||
AC_ARG_ENABLE([wx],
|
||||
AS_HELP_STRING([--enable-wx],[build wxWidgets client]),
|
||||
[want_wx=${enableval}],
|
||||
[want_wx=no])
|
||||
if test "x$want_wx" != "xno"; then
|
||||
AM_OPTIONS_WXCONFIG
|
||||
AM_PATH_WXCONFIG($WX_MINIMUM,[have_wx=yes],[have_wx=no])
|
||||
if test "x$have_wx" = "xyes"; then
|
||||
build_wx=yes
|
||||
elif test "x$want_wx" = "xyes"; then
|
||||
AC_MSG_ERROR("wxWidgets not found!")
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL([BUILD_WX],[test "x$build_wx" = "xyes"])
|
||||
|
||||
|
||||
|
||||
dnl ----------------------------------------------------------------------------
|
||||
dnl
|
||||
|
@ -375,8 +354,6 @@ AC_CONFIG_FILES([Makefile
|
|||
third-party/miniupnp/Makefile
|
||||
third-party/libnatpmp/Makefile
|
||||
macosx/Makefile
|
||||
wx/Makefile
|
||||
wx/images/Makefile
|
||||
gtk/Makefile
|
||||
gtk/icons/Makefile
|
||||
po/Makefile.in])
|
||||
|
@ -397,6 +374,5 @@ Configuration:
|
|||
... dbus-glib support: ${use_dbus_glib}
|
||||
... libnotify support: ${use_libnotify}
|
||||
Build OS X client: ${build_mac}
|
||||
Build wxWidgets client: ${build_wx}
|
||||
|
||||
"
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
AM_CPPFLAGS = -I$(top_srcdir) $(WX_CPPFLAGS) $(LIBEVENT_CPPFLAGS)
|
||||
AM_CFLAGS = $(PTHREAD_CFLAGS) $(OPENSSL_CFLAGS)
|
||||
AM_CXXFLAGS = $(WX_CXXFLAGS)
|
||||
|
||||
SUBDIRS = images
|
||||
|
||||
bin_PROGRAMS = xmission
|
||||
|
||||
noinst_HEADERS = \
|
||||
filter.h \
|
||||
foreach.h \
|
||||
speed-stats.h \
|
||||
torrent-list.h \
|
||||
torrent-stats.h
|
||||
|
||||
xmission_SOURCES = \
|
||||
speed-stats.cc \
|
||||
filter.cc \
|
||||
torrent-list.cc \
|
||||
torrent-stats.cc \
|
||||
xmission.cc
|
||||
|
||||
xmission_LDADD = \
|
||||
$(top_builddir)/libtransmission/libtransmission.a \
|
||||
$(top_builddir)/third-party/libevent/libevent.la \
|
||||
$(top_builddir)/third-party/miniupnp/libminiupnp.a \
|
||||
$(top_builddir)/third-party/libnatpmp/libnatpmp.a \
|
||||
$(WX_LIBS) \
|
||||
$(OPENSSL_LIBS) \
|
||||
$(LIBCURL_LIBS) \
|
||||
$(PTHREAD_LIBS) -lm
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
STATUS:
|
||||
|
||||
The wx client of Transmission is barely even a proof of concept
|
||||
at this time. The only recommended users at this point are
|
||||
people willing to contribute artwork or code.
|
||||
|
||||
|
||||
CREDITS:
|
||||
|
||||
some Toolbar artwork is by Diana Fong for Fedora's Echo Theme,
|
||||
under a CC share-alike, and modified here to survive xpm's jaggies.
|
||||
http://fedoraproject.org/wiki/Artwork/EchoDevelopment
|
|
@ -1,4 +0,0 @@
|
|||
peers column is awkward to read
|
||||
peers column doesn't sort
|
||||
pulse doesn't resort items in the torrent list
|
||||
resorting the torrent list causes a 'blink', which makes pulsing resort unpleasant
|
116
wx/filter.cc
116
wx/filter.cc
|
@ -1,116 +0,0 @@
|
|||
/*
|
||||
* Xmission - a cross-platform bittorrent client
|
||||
* Copyright (C) 2007 Charles Kerr <charles@transmissionbt.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "foreach.h"
|
||||
#include "filter.h"
|
||||
|
||||
int
|
||||
TorrentFilter :: GetFlags( const tr_torrent * tor )
|
||||
{
|
||||
int flags = 0;
|
||||
const tr_stat * s = tr_torrentStat( (tr_torrent*)tor );
|
||||
|
||||
switch( s->activity )
|
||||
{
|
||||
case TR_STATUS_DOWNLOAD:
|
||||
flags |= FLAG_LEECHING;
|
||||
break;
|
||||
|
||||
case TR_STATUS_SEED:
|
||||
flags |= FLAG_SEEDING;
|
||||
break;
|
||||
|
||||
case TR_STATUS_STOPPED:
|
||||
case TR_STATUS_CHECK:
|
||||
case TR_STATUS_CHECK_WAIT:
|
||||
break;
|
||||
}
|
||||
|
||||
flags |= ( ( s->pieceUploadSpeed + s->pieceDownloadSpeed ) > 0.01 )
|
||||
? FLAG_ACTIVE
|
||||
: FLAG_IDLE;
|
||||
|
||||
flags |= s->leftUntilDone
|
||||
? FLAG_INCOMPLETE
|
||||
: FLAG_COMPLETE;
|
||||
|
||||
flags |= FLAG_ALL;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
void
|
||||
TorrentFilter :: CountHits( const torrents_v & torrents,
|
||||
int * counts )
|
||||
{
|
||||
memset( counts, '\0', sizeof(int) * N_FILTERS );
|
||||
foreach_const( torrents_v, torrents, it ) {
|
||||
const int flags = GetFlags( *it );
|
||||
if( flags & FLAG_ALL ) ++counts[ALL];
|
||||
if( flags & FLAG_LEECHING ) ++counts[LEECHING];
|
||||
if( flags & FLAG_SEEDING ) ++counts[SEEDING];
|
||||
if( flags & FLAG_ACTIVE ) ++counts[ACTIVE];
|
||||
if( flags & FLAG_IDLE ) ++counts[IDLE];
|
||||
if( flags & FLAG_COMPLETE ) ++counts[COMPLETE];
|
||||
if( flags & FLAG_INCOMPLETE ) ++counts[INCOMPLETE];
|
||||
}
|
||||
}
|
||||
|
||||
wxString
|
||||
TorrentFilter :: GetName( int show, int count )
|
||||
{
|
||||
static const wxString names[N_FILTERS] = {
|
||||
_("&All"),
|
||||
_("&Complete"),
|
||||
_("&Incomplete"),
|
||||
_("&Seeding"),
|
||||
_("&Leeching"),
|
||||
_("Acti&ve"),
|
||||
_("I&dle")
|
||||
};
|
||||
|
||||
assert( 0<=show && show<N_FILTERS );
|
||||
|
||||
wxString xstr = names[show];
|
||||
if( count )
|
||||
xstr += wxString::Format(_T(" (%d)"), count );
|
||||
return xstr;
|
||||
}
|
||||
|
||||
void
|
||||
TorrentFilter :: RemoveFailures( int show,
|
||||
torrents_v & torrents )
|
||||
{
|
||||
torrents_v tmp;
|
||||
|
||||
foreach_const( torrents_v, torrents, it ) {
|
||||
const int flags = GetFlags( *it );
|
||||
if( ( ( show == ALL ) && ( flags & FLAG_ALL ) )
|
||||
|| ( ( show == LEECHING ) && ( flags & FLAG_LEECHING ) )
|
||||
|| ( ( show == SEEDING ) && ( flags & FLAG_SEEDING ) )
|
||||
|| ( ( show == ACTIVE ) && ( flags & FLAG_ACTIVE ) )
|
||||
|| ( ( show == IDLE ) && ( flags & FLAG_IDLE ) )
|
||||
|| ( ( show == COMPLETE ) && ( flags & FLAG_COMPLETE ) )
|
||||
|| ( ( show == INCOMPLETE ) && ( flags & FLAG_INCOMPLETE ) ) )
|
||||
tmp.push_back( *it );
|
||||
}
|
||||
|
||||
torrents.swap( tmp );
|
||||
}
|
67
wx/filter.h
67
wx/filter.h
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* Xmission - a cross-platform bittorrent client
|
||||
* Copyright (C) 2007 Charles Kerr <charles@transmissionbt.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __XMISSION_TORRENT_FILTER_H__
|
||||
#define __XMISSION_TORRENT_FILTER_H__
|
||||
|
||||
#include <vector>
|
||||
#include <wx/intl.h>
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
class TorrentFilter
|
||||
{
|
||||
private:
|
||||
|
||||
enum ShowFlags
|
||||
{
|
||||
FLAG_ALL = (1<<0),
|
||||
FLAG_COMPLETE = (1<<1),
|
||||
FLAG_INCOMPLETE = (1<<2),
|
||||
FLAG_SEEDING = (1<<3),
|
||||
FLAG_LEECHING = (1<<4),
|
||||
FLAG_ACTIVE = (1<<5),
|
||||
FLAG_IDLE = (1<<6)
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
typedef std::vector<tr_torrent*> torrents_v;
|
||||
|
||||
enum Show {
|
||||
ALL,
|
||||
COMPLETE, INCOMPLETE,
|
||||
SEEDING, LEECHING,
|
||||
ACTIVE, IDLE,
|
||||
N_FILTERS
|
||||
};
|
||||
|
||||
static int GetFlags( const tr_torrent * );
|
||||
|
||||
static void CountHits( const torrents_v & torrents,
|
||||
int * counts );
|
||||
|
||||
static wxString GetName( int show, int count=0 );
|
||||
|
||||
static void RemoveFailures( int show,
|
||||
torrents_v & torrents );
|
||||
};
|
||||
|
||||
|
||||
#endif
|
45
wx/foreach.h
45
wx/foreach.h
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* Xmission - a cross-platform bittorrent client
|
||||
* Copyright (C) 2007 Charles Kerr <charles@transmissionbt.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _Foreach_h_
|
||||
#define _Foreach_h_
|
||||
|
||||
#define foreach(Type,var,itname) \
|
||||
for (Type::iterator itname(var.begin()), \
|
||||
itname##end(var.end()); itname!=itname##end; \
|
||||
++itname)
|
||||
|
||||
#define foreach_const(Type,var,itname) \
|
||||
for (Type::const_iterator itname(var.begin()), \
|
||||
itname##end(var.end()); itname!=itname##end; \
|
||||
++itname)
|
||||
|
||||
#define foreach_r(Type,var,itname) \
|
||||
for (Type::reverse_iterator itname(var.rbegin()), \
|
||||
itname##end(var.rend()); itname!=itname##end; \
|
||||
++itname)
|
||||
|
||||
#define foreach_const_r(Type,var,itname) \
|
||||
for (Type::const_reverse_iterator itname(var.rbegin()), \
|
||||
itname##end(var.rend()); itname!=itname##end; \
|
||||
++itname)
|
||||
|
||||
#endif
|
|
@ -1,18 +0,0 @@
|
|||
EXTRA_DIST = \
|
||||
exec.png \
|
||||
exec.xpm \
|
||||
fileopen.png \
|
||||
fileopen.xpm \
|
||||
gtk-info.png \
|
||||
gtk-info.xpm \
|
||||
gtk-properties.png \
|
||||
gtk-properties.xpm \
|
||||
gtk-remove.png \
|
||||
gtk-remove.xpm \
|
||||
play.xpm \
|
||||
plus.xpm \
|
||||
minus.xpm \
|
||||
stop.xpm \
|
||||
systray.xpm \
|
||||
transmission.png \
|
||||
transmission.xpm
|
Binary file not shown.
Before Width: | Height: | Size: 1018 B |
|
@ -1,237 +0,0 @@
|
|||
/* XPM */
|
||||
static char * exec_xpm[] = {
|
||||
"24 24 210 2",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #0A0A0A",
|
||||
"@ c #1C1C1C",
|
||||
"# c #090B0F",
|
||||
"$ c #283143",
|
||||
"% c #4E545F",
|
||||
"& c #898989",
|
||||
"* c #B2B2B2",
|
||||
"= c #AFAFAF",
|
||||
"- c #797979",
|
||||
"; c #0B0C0F",
|
||||
"> c #373F4F",
|
||||
", c #5D6C8A",
|
||||
"' c #758BB9",
|
||||
") c #7B97D1",
|
||||
"! c #6381BD",
|
||||
"~ c #4F699E",
|
||||
"{ c #646A75",
|
||||
"] c #5E5E5E",
|
||||
"^ c #5B5B5B",
|
||||
"/ c #6F6F6F",
|
||||
"( c #494B4D",
|
||||
"_ c #090909",
|
||||
": c #2F2F2F",
|
||||
"< c #5E687C",
|
||||
"[ c #8FA4CF",
|
||||
"} c #AAC5FA",
|
||||
"| c #97B2E9",
|
||||
"1 c #728CC2",
|
||||
"2 c #4E6698",
|
||||
"3 c #364E7F",
|
||||
"4 c #294274",
|
||||
"5 c #28447B",
|
||||
"6 c #213865",
|
||||
"7 c #818181",
|
||||
"8 c #9F9F9F",
|
||||
"9 c #9A9A9A",
|
||||
"0 c #9C9C9C",
|
||||
"a c #262626",
|
||||
"b c #919191",
|
||||
"c c #BEBEBE",
|
||||
"d c #B4B4B4",
|
||||
"e c #8C8E91",
|
||||
"f c #6C7FA6",
|
||||
"g c #49608F",
|
||||
"h c #2F4779",
|
||||
"i c #29447B",
|
||||
"j c #2E4C8A",
|
||||
"k c #315192",
|
||||
"l c #335393",
|
||||
"m c #365596",
|
||||
"n c #2A4272",
|
||||
"o c #8A8A8A",
|
||||
"p c #333333",
|
||||
"q c #676767",
|
||||
"r c #AAAAAA",
|
||||
"s c #C4C4C4",
|
||||
"t c #EFEFEF",
|
||||
"u c #767676",
|
||||
"v c #626262",
|
||||
"w c #7E7E7E",
|
||||
"x c #182849",
|
||||
"y c #325293",
|
||||
"z c #345495",
|
||||
"A c #375797",
|
||||
"B c #3B5B9A",
|
||||
"C c #405F9E",
|
||||
"D c #4564A3",
|
||||
"E c #4C6BA9",
|
||||
"F c #3E5483",
|
||||
"G c #939393",
|
||||
"H c #666666",
|
||||
"I c #A1A1A1",
|
||||
"J c #A3A3A3",
|
||||
"K c #CDCDCD",
|
||||
"L c #858585",
|
||||
"M c #B0B0B0",
|
||||
"N c #BABABA",
|
||||
"O c #BFBFBF",
|
||||
"P c #1F2F4E",
|
||||
"Q c #4261A1",
|
||||
"R c #4867A6",
|
||||
"S c #4F6EAC",
|
||||
"T c #5775B2",
|
||||
"U c #607DBA",
|
||||
"V c #6987C2",
|
||||
"W c #7491CB",
|
||||
"X c #556890",
|
||||
"Y c #595959",
|
||||
"Z c #616161",
|
||||
"` c #6C6C6C",
|
||||
" . c #7C7C7C",
|
||||
".. c #B9B9B9",
|
||||
"+. c #6E6E6E",
|
||||
"@. c #454545",
|
||||
"#. c #959595",
|
||||
"$. c #2E3D5C",
|
||||
"%. c #6482BE",
|
||||
"&. c #6E8BC6",
|
||||
"*. c #7996D0",
|
||||
"=. c #718ABC",
|
||||
"-. c #546589",
|
||||
";. c #444F64",
|
||||
">. c #62656C",
|
||||
",. c #8F8F8F",
|
||||
"'. c #CFCFCF",
|
||||
"). c #FFFFFF",
|
||||
"!. c #E5E5E5",
|
||||
"~. c #A2A2A2",
|
||||
"{. c #606060",
|
||||
"]. c #AEAEAE",
|
||||
"^. c #888888",
|
||||
"/. c #EAEAEA",
|
||||
"(. c #323D52",
|
||||
"_. c #58698C",
|
||||
":. c #465166",
|
||||
"<. c #62666D",
|
||||
"[. c #FEFEFE",
|
||||
"}. c #4B4B4B",
|
||||
"|. c #848484",
|
||||
"1. c #646464",
|
||||
"2. c #6D6D6D",
|
||||
"3. c #FDFDFD",
|
||||
"4. c #FCFCFC",
|
||||
"5. c #FBFBFB",
|
||||
"6. c #FAFAFA",
|
||||
"7. c #E0E0E0",
|
||||
"8. c #323232",
|
||||
"9. c #C8C8C8",
|
||||
"0. c #757575",
|
||||
"a. c #CECECE",
|
||||
"b. c #DDDDDD",
|
||||
"c. c #F9F9F9",
|
||||
"d. c #F8F8F8",
|
||||
"e. c #F7F7F7",
|
||||
"f. c #F6F6F6",
|
||||
"g. c #F5F5F5",
|
||||
"h. c #F4F4F4",
|
||||
"i. c #DBDBDB",
|
||||
"j. c #313131",
|
||||
"k. c #C6C6C6",
|
||||
"l. c #C7C7C7",
|
||||
"m. c #D9D9D9",
|
||||
"n. c #0F0F0F",
|
||||
"o. c #2E2E2E",
|
||||
"p. c #F3F3F3",
|
||||
"q. c #F2F2F2",
|
||||
"r. c #F1F1F1",
|
||||
"s. c #F0F0F0",
|
||||
"t. c #EEEEEE",
|
||||
"u. c #EDEDED",
|
||||
"v. c #D5D5D5",
|
||||
"w. c #303030",
|
||||
"x. c #C1C1C1",
|
||||
"y. c #C3C3C3",
|
||||
"z. c #DFDFDF",
|
||||
"A. c #ECECEC",
|
||||
"B. c #EBEBEB",
|
||||
"C. c #E9E9E9",
|
||||
"D. c #E8E8E8",
|
||||
"E. c #E7E7E7",
|
||||
"F. c #E6E6E6",
|
||||
"G. c #B8B8B8",
|
||||
"H. c #BCBCBC",
|
||||
"I. c #DCDCDC",
|
||||
"J. c #0E0E0E",
|
||||
"K. c #565656",
|
||||
"L. c #BDBDBD",
|
||||
"M. c #2B2B2B",
|
||||
"N. c #555555",
|
||||
"O. c #E4E4E4",
|
||||
"P. c #E3E3E3",
|
||||
"Q. c #E2E2E2",
|
||||
"R. c #E1E1E1",
|
||||
"S. c #969696",
|
||||
"T. c #2C2C2C",
|
||||
"U. c #B1B1B1",
|
||||
"V. c #B7B7B7",
|
||||
"W. c #9B9B9B",
|
||||
"X. c #C5C5C5",
|
||||
"Y. c #999999",
|
||||
"Z. c #D1D1D1",
|
||||
"`. c #DEDEDE",
|
||||
" + c #DADADA",
|
||||
".+ c #A5A5A5",
|
||||
"++ c #181818",
|
||||
"@+ c #2A2A2A",
|
||||
"#+ c #A9A9A9",
|
||||
"$+ c #D8D8D8",
|
||||
"%+ c #D7D7D7",
|
||||
"&+ c #D6D6D6",
|
||||
"*+ c #CACACA",
|
||||
"=+ c #B5B5B5",
|
||||
"-+ c #878787",
|
||||
";+ c #525252",
|
||||
">+ c #272727",
|
||||
",+ c #080808",
|
||||
"'+ c #838383",
|
||||
")+ c #ABABAB",
|
||||
"!+ c #D4D4D4",
|
||||
"~+ c #D3D3D3",
|
||||
"{+ c #D2D2D2",
|
||||
"]+ c #505050",
|
||||
"^+ c #1D1D1D",
|
||||
"/+ c #8C8C8C",
|
||||
"(+ c #7D7D7D",
|
||||
"_+ c #4A4A4A",
|
||||
":+ c #353535",
|
||||
"<+ c #1E1E1E",
|
||||
" ",
|
||||
" ",
|
||||
" . + @ . ",
|
||||
" . # $ % & * = - + ",
|
||||
" . . ; > , ' ) ! ~ { ] ^ / ( . ",
|
||||
" . _ : < [ } | 1 2 3 4 5 6 7 8 9 0 . ",
|
||||
" a b c d e f g h i j k l m n o p q r . ",
|
||||
" . s t u v w x y z A B C D E F G H I J . ",
|
||||
" @ K L M N O P Q R S T U V W X Y Z ` .. ",
|
||||
" a ..v +.@.#.$.%.&.*.=.-.;.>.,.'.).).!.. ",
|
||||
" a ~.{.].^./.(._.:.<.,.'.).).).).).[.!.. ",
|
||||
" : ~.}.|.1.2.,.'.[.[.[.[.3.3.4.5.5.6.7.. ",
|
||||
" 8.9.0.a.b.4.4.5.6.6.c.d.e.e.f.g.h.h.i.. ",
|
||||
" j.k.l.m.n.o.9 g.h.p.q.q.r.s.t t t.u.v.. ",
|
||||
" w.O x.r.y.. Y t.z.x.A.B./.C.D.D.E.F.a.. ",
|
||||
" o.G.H.I.J.K.L.M.. N.!.O.P.Q.Q.R.7.z.S.. ",
|
||||
" T.U.V.P.W.Q.X.Y.Z.z.`.b.I.i. + +a..+++ ",
|
||||
" @+#+U.I.I.i. +m.$+%+%+&+*+=+-+;+>+,+ ",
|
||||
" . '+)+v.!+!+~+{+x.U.L ]+>+,+. ",
|
||||
" ^+/+a.c #+(+_+a ,+. ",
|
||||
" n.:+<+. . ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
Binary file not shown.
Before Width: | Height: | Size: 962 B |
|
@ -1,214 +0,0 @@
|
|||
/* XPM */
|
||||
static char * fileopen_xpm[] = {
|
||||
"24 24 187 2",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #1E1A12",
|
||||
"@ c #5C5038",
|
||||
"# c #9B865F",
|
||||
"$ c #AB956A",
|
||||
"% c #100E0A",
|
||||
"& c #4C422F",
|
||||
"* c #897655",
|
||||
"= c #79684B",
|
||||
"- c #8C8069",
|
||||
"; c #DABD86",
|
||||
"> c #FADA9B",
|
||||
", c #FCDB9D",
|
||||
"' c #FDDC9E",
|
||||
") c #FCDB9E",
|
||||
"! c #9C8761",
|
||||
"~ c #1E1A13",
|
||||
"{ c #C5AA7A",
|
||||
"] c #F2D096",
|
||||
"^ c #F1CE94",
|
||||
"/ c #EFCC93",
|
||||
"( c #EECB92",
|
||||
"_ c #1D1912",
|
||||
": c #FEEDCE",
|
||||
"< c #FBDA9D",
|
||||
"[ c #F9D89B",
|
||||
"} c #F7D69A",
|
||||
"| c #F5D498",
|
||||
"1 c #F4D297",
|
||||
"2 c #ECC991",
|
||||
"3 c #EBC890",
|
||||
"4 c #E9C68F",
|
||||
"5 c #E8C58E",
|
||||
"6 c #544732",
|
||||
"7 c #1F1F1E",
|
||||
"8 c #5F5F5B",
|
||||
"9 c #0F0F0F",
|
||||
"0 c #FDF4E5",
|
||||
"a c #E0BE84",
|
||||
"b c #D6B578",
|
||||
"c c #CCAD6D",
|
||||
"d c #B69654",
|
||||
"e c #83775C",
|
||||
"f c #8F8E8A",
|
||||
"g c #CDC8BB",
|
||||
"h c #F9EBD0",
|
||||
"i c #F3DBB1",
|
||||
"j c #3C352A",
|
||||
"k c #CCC6BA",
|
||||
"l c #EDCB92",
|
||||
"m c #C0A15E",
|
||||
"n c #BD9F63",
|
||||
"o c #D2BE95",
|
||||
"p c #DCD0B6",
|
||||
"q c #FBF0D8",
|
||||
"r c #F7E3BF",
|
||||
"s c #F1D3A0",
|
||||
"t c #EDCA92",
|
||||
"u c #EAC78F",
|
||||
"v c #CBAC7C",
|
||||
"w c #BFBFBD",
|
||||
"x c #C3A461",
|
||||
"y c #BC9D5D",
|
||||
"z c #CBB483",
|
||||
"A c #D8C7A5",
|
||||
"B c #EFE3CB",
|
||||
"C c #FAEBCD",
|
||||
"D c #F6DFB4",
|
||||
"E c #F1CF95",
|
||||
"F c #E5C18B",
|
||||
"G c #E3BF8A",
|
||||
"H c #544733",
|
||||
"I c #8F8F8D",
|
||||
"J c #D0B072",
|
||||
"K c #C1A35F",
|
||||
"L c #BE9F5B",
|
||||
"M c #C5AD7C",
|
||||
"N c #E6D9C0",
|
||||
"O c #FCF1DA",
|
||||
"P c #F9E4BC",
|
||||
"Q c #F6D8A3",
|
||||
"R c #E9C68E",
|
||||
"S c #E6C28C",
|
||||
"T c #E3C08A",
|
||||
"U c #E2BE89",
|
||||
"V c #E1BD88",
|
||||
"W c #D3B17F",
|
||||
"X c #0F0C09",
|
||||
"Y c #7F7F7D",
|
||||
"Z c #E7CA9E",
|
||||
"` c #BD9F5B",
|
||||
" . c #C0A25E",
|
||||
".. c #BCA170",
|
||||
"+. c #FCEED4",
|
||||
"@. c #F6D499",
|
||||
"#. c #F3D196",
|
||||
"$. c #F0CD94",
|
||||
"%. c #E7C48D",
|
||||
"&. c #E4C08B",
|
||||
"*. c #E2BE88",
|
||||
"=. c #E0BC87",
|
||||
"-. c #DFBB86",
|
||||
";. c #8B7453",
|
||||
">. c #7F7F7C",
|
||||
",. c #E4CA9F",
|
||||
"'. c #B1924E",
|
||||
"). c #A78542",
|
||||
"!. c #E8DEC9",
|
||||
"~. c #F1CE95",
|
||||
"{. c #E0BC86",
|
||||
"]. c #DEBA85",
|
||||
"^. c #DCB883",
|
||||
"/. c #DAB680",
|
||||
"(. c #433827",
|
||||
"_. c #D7BD90",
|
||||
":. c #A48441",
|
||||
"<. c #9C7C43",
|
||||
"[. c #F6E6C9",
|
||||
"}. c #DFBB85",
|
||||
"|. c #DDB984",
|
||||
"1. c #DBB781",
|
||||
"2. c #D8B47E",
|
||||
"3. c #D5B17A",
|
||||
"4. c #C4A26F",
|
||||
"5. c #3F3F3D",
|
||||
"6. c #D3B98B",
|
||||
"7. c #977634",
|
||||
"8. c #B19B77",
|
||||
"9. c #E9CB9E",
|
||||
"0. c #DEBA84",
|
||||
"a. c #DCB882",
|
||||
"b. c #D9B57F",
|
||||
"c. c #D6B27C",
|
||||
"d. c #D2AE77",
|
||||
"e. c #CEAA73",
|
||||
"f. c #C9A56D",
|
||||
"g. c #7B6441",
|
||||
"h. c #CEB486",
|
||||
"i. c #7F5C1F",
|
||||
"j. c #E1D7C3",
|
||||
"k. c #E1BD87",
|
||||
"l. c #D7B37D",
|
||||
"m. c #D3AF79",
|
||||
"n. c #CFAB74",
|
||||
"o. c #CAA66F",
|
||||
"p. c #C5A168",
|
||||
"q. c #BE9A61",
|
||||
"r. c #B79359",
|
||||
"s. c #2D2416",
|
||||
"t. c #CAB081",
|
||||
"u. c #80602D",
|
||||
"v. c #F3E4CB",
|
||||
"w. c #D1AD76",
|
||||
"x. c #CCA871",
|
||||
"y. c #C6A26B",
|
||||
"z. c #C09C64",
|
||||
"A. c #B9955C",
|
||||
"B. c #927546",
|
||||
"C. c #624E2D",
|
||||
"D. c #20190E",
|
||||
"E. c #B99F6E",
|
||||
"F. c #98815F",
|
||||
"G. c #E8D1AC",
|
||||
"H. c #D6B27B",
|
||||
"I. c #CDA972",
|
||||
"J. c #C8A46D",
|
||||
"K. c #C29E66",
|
||||
"L. c #A58654",
|
||||
"M. c #685333",
|
||||
"N. c #382D1B",
|
||||
"O. c #0B0805",
|
||||
"P. c #5F5E5B",
|
||||
"Q. c #9C8051",
|
||||
"R. c #D4C9B7",
|
||||
"S. c #D6B480",
|
||||
"T. c #CAA66E",
|
||||
"U. c #B99762",
|
||||
"V. c #79623F",
|
||||
"W. c #473924",
|
||||
"X. c #17120B",
|
||||
"Y. c #3F3F3C",
|
||||
"Z. c #D5CBB7",
|
||||
"`. c #E7D6B8",
|
||||
" + c #967B51",
|
||||
".+ c #56462E",
|
||||
"++ c #241D12",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" . . . ",
|
||||
" . . + @ # $ % . % & * = . ",
|
||||
" . - ; > , ' ) ! ~ & * { ] ^ / ( _ . ",
|
||||
" . : ) < [ } | 1 ] ^ / ( 2 3 4 5 6 . . 7 8 9 ",
|
||||
" . 0 | 1 ] ^ / ( 2 3 4 5 a b c d e f g h i j ",
|
||||
" . k / l 2 3 4 5 a b c m n o p q r s t u v . ",
|
||||
" . w 4 5 a b c x y z A B C D E ( 3 5 F G H ",
|
||||
" . I F J K L M N O P Q ] / 2 R S T U V W X ",
|
||||
" Y Z ` ...+.@.#.$.t u %.&.U *.V =.-.;.. ",
|
||||
" >.,.'.).!.~.( 3 5 F G U V V {.].^./.(. ",
|
||||
" >._.:.<.[.R S T U V V =.}.|.1.2.3.4.. ",
|
||||
" 5.6.7.8.9.U V V =.-.0.a.b.c.d.e.f.g.. ",
|
||||
" 5.h.i.j.V k.{.].^./.l.m.n.o.p.q.r.s. ",
|
||||
" 5.t.u.v.}.|.1.2.3.w.x.y.z.A.B.C.D.. ",
|
||||
" 5.E.F.G.b.H.d.I.J.K.L.M.N.O.. ",
|
||||
" P.Q.R.S.n.T.U.V.W.X.. . ",
|
||||
" Y.Z.`. +.+++. . ",
|
||||
" . Y.. . ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
Binary file not shown.
Before Width: | Height: | Size: 966 B |
|
@ -1,144 +0,0 @@
|
|||
/* XPM */
|
||||
static char * gtk_info_xpm[] = {
|
||||
"24 24 117 2",
|
||||
" c None",
|
||||
". c #222427",
|
||||
"+ c #1B1E22",
|
||||
"@ c #181C20",
|
||||
"# c #181C1F",
|
||||
"$ c #17191B",
|
||||
"% c #292D30",
|
||||
"& c #555B61",
|
||||
"* c #909EAC",
|
||||
"= c #8EA2B9",
|
||||
"- c #8BA2BA",
|
||||
"; c #8CA2BB",
|
||||
"> c #8AA1BA",
|
||||
", c #859AB2",
|
||||
"' c #6B7A8B",
|
||||
") c #394048",
|
||||
"! c #141518",
|
||||
"~ c #30363C",
|
||||
"{ c #86929F",
|
||||
"] c #92A6BD",
|
||||
"^ c #819AB5",
|
||||
"/ c #7590AE",
|
||||
"( c #829AB3",
|
||||
"_ c #606B77",
|
||||
": c #212428",
|
||||
"< c #41464C",
|
||||
"[ c #92A0AD",
|
||||
"} c #8EA3BC",
|
||||
"| c #8199B2",
|
||||
"1 c #6E7C8B",
|
||||
"2 c #23282C",
|
||||
"3 c #1E2126",
|
||||
"4 c #87919D",
|
||||
"5 c #889FB8",
|
||||
"6 c #7792AF",
|
||||
"7 c #FFFFFF",
|
||||
"8 c #7691AF",
|
||||
"9 c #8198B3",
|
||||
"0 c #6A7683",
|
||||
"a c #1C1F21",
|
||||
"b c #626971",
|
||||
"c c #89A0B8",
|
||||
"d c #8097B1",
|
||||
"e c #333B43",
|
||||
"f c #202325",
|
||||
"g c #717D89",
|
||||
"h c #506378",
|
||||
"i c #0B0E11",
|
||||
"j c #27292D",
|
||||
"k c #90A5BB",
|
||||
"l c #68809B",
|
||||
"m c #0F1215",
|
||||
"n c #393E44",
|
||||
"o c #93A8BF",
|
||||
"p c #677F9A",
|
||||
"q c #0E1015",
|
||||
"r c #393F44",
|
||||
"s c #68819B",
|
||||
"t c #0F1418",
|
||||
"u c #3A3E44",
|
||||
"v c #93A8C0",
|
||||
"w c #6C85A1",
|
||||
"x c #0F1217",
|
||||
"y c #3C4046",
|
||||
"z c #91A5BB",
|
||||
"A c #60768F",
|
||||
"B c #0C0F13",
|
||||
"C c #27292B",
|
||||
"D c #8F9FB0",
|
||||
"E c #7D96B2",
|
||||
"F c #728CA9",
|
||||
"G c #445466",
|
||||
"H c #080A0C",
|
||||
"I c #6B747C",
|
||||
"J c #8EA4BB",
|
||||
"K c #7791AF",
|
||||
"L c #748FAD",
|
||||
"M c #637A94",
|
||||
"N c #212933",
|
||||
"O c #23272D",
|
||||
"P c #8A97A6",
|
||||
"Q c #7F98B4",
|
||||
"R c #708AA7",
|
||||
"S c #475769",
|
||||
"T c #434A51",
|
||||
"U c #9AA7B6",
|
||||
"V c #7892B0",
|
||||
"W c #6A839E",
|
||||
"X c #4C5D71",
|
||||
"Y c #191F26",
|
||||
"Z c #353D45",
|
||||
"` c #8896A4",
|
||||
" . c #91A6BD",
|
||||
".. c #7C96B2",
|
||||
"+. c #69829D",
|
||||
"@. c #415061",
|
||||
"#. c #191E25",
|
||||
"$. c #1F232A",
|
||||
"%. c #5E6772",
|
||||
"&. c #788A9E",
|
||||
"*. c #839AB3",
|
||||
"=. c #7C93AD",
|
||||
"-. c #6F89A6",
|
||||
";. c #6D86A3",
|
||||
">. c #647B95",
|
||||
",. c #4D5F73",
|
||||
"'. c #2E3945",
|
||||
"). c #0D1014",
|
||||
"!. c #0D0F11",
|
||||
"~. c #282D33",
|
||||
"{. c #323940",
|
||||
"]. c #2A3139",
|
||||
"^. c #222B34",
|
||||
"/. c #202932",
|
||||
"(. c #1D232B",
|
||||
"_. c #12161C",
|
||||
":. c #030405",
|
||||
" ",
|
||||
" ",
|
||||
" . + @ @ # @ $ ",
|
||||
" % & * = - ; > , ' ) ! ",
|
||||
" ~ { ] ^ / / / / / / ( _ : ",
|
||||
" < [ } / / / / / / / / / | 1 2 ",
|
||||
" 3 4 5 6 / / / 7 7 7 / / / 8 9 0 a ",
|
||||
" b c / / / / / 7 7 7 / / / / / d e ",
|
||||
" f g ^ / / / / / 7 7 7 / / / / / / h i ",
|
||||
" j k / / / / / / / / / / / / / / / l m ",
|
||||
" n o / / / / / 7 7 7 7 / / / / / / p q ",
|
||||
" r o / / / / / 7 7 7 7 / / / / / / s t ",
|
||||
" u v / / / / / / 7 7 7 / / / / / / w x ",
|
||||
" y z / / / / / / 7 7 7 / / / / / / A B ",
|
||||
" C D E / / / / / 7 7 7 / / / / / F G H ",
|
||||
" I J K / / / / 7 7 7 / / / / L M N ",
|
||||
" O P Q / / / / 7 7 7 / / / / R S x ",
|
||||
" T U Q V / / / / / / / L W X Y ",
|
||||
" Z ` .../ / / / / F +.@.#. ",
|
||||
" $.%.&.*.=.-.;.>.,.'.). ",
|
||||
" !.~.{.].^./.(._.:. ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
Binary file not shown.
Before Width: | Height: | Size: 650 B |
|
@ -1,82 +0,0 @@
|
|||
/* XPM */
|
||||
static char * gtk_properties_xpm[] = {
|
||||
"24 24 55 1",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #5D5D5D",
|
||||
"@ c #B4B4B4",
|
||||
"# c #BABABA",
|
||||
"$ c #161616",
|
||||
"% c #747474",
|
||||
"& c #B3B3B3",
|
||||
"* c #A7A7A7",
|
||||
"= c #222222",
|
||||
"- c #181818",
|
||||
"; c #B2B2B2",
|
||||
"> c #505050",
|
||||
", c #0E0E0E",
|
||||
"' c #353535",
|
||||
") c #BDBDBD",
|
||||
"! c #B9B9B9",
|
||||
"~ c #787878",
|
||||
"{ c #0F0F0F",
|
||||
"] c #646464",
|
||||
"^ c #C5C5C5",
|
||||
"/ c #C1C1C1",
|
||||
"( c #7C7C7C",
|
||||
"_ c #454545",
|
||||
": c #E5E5E5",
|
||||
"< c #565656",
|
||||
"[ c #D1D1D1",
|
||||
"} c #AFAFAF",
|
||||
"| c #BFBFBF",
|
||||
"1 c #CFCFCF",
|
||||
"2 c #D7D7D7",
|
||||
"3 c #DFDFDF",
|
||||
"4 c #8F8F8F",
|
||||
"5 c #A9A9A9",
|
||||
"6 c #B0B0B0",
|
||||
"7 c #C8C8C8",
|
||||
"8 c #DEDEDE",
|
||||
"9 c #E4E4E4",
|
||||
"0 c #BBBBBB",
|
||||
"a c #E3E3E3",
|
||||
"b c #6E6E6E",
|
||||
"c c #727272",
|
||||
"d c #393939",
|
||||
"e c #535353",
|
||||
"f c #242424",
|
||||
"g c #C2C2C2",
|
||||
"h c #AEAEAE",
|
||||
"i c #A8A8A8",
|
||||
"j c #B8B8B8",
|
||||
"k c #DDDDDD",
|
||||
"l c #7D7D7D",
|
||||
"m c #6F6F6F",
|
||||
"n c #383838",
|
||||
"o c #E0E0E0",
|
||||
"p c #474747",
|
||||
" ",
|
||||
" .... ",
|
||||
" .+@#$ ",
|
||||
" .%&*= ",
|
||||
" -#;>. ,. ",
|
||||
" ')!~. {!. ",
|
||||
" .]^/!(_#:. ",
|
||||
" .<[}|123:4. ",
|
||||
" .<[567289#{ ",
|
||||
" .<[560abcd. ",
|
||||
" .<[560ae. ",
|
||||
" .<[560ae. ",
|
||||
" .<[560ae. ",
|
||||
" .<[560ae. ",
|
||||
" .f'][560ae. ",
|
||||
" .%##gh60ae. ",
|
||||
" +&;!/)7ae. ",
|
||||
" .i*>~j1kl. ",
|
||||
" .#= .m28c ",
|
||||
" .$ no9p ",
|
||||
" {#:#. ",
|
||||
" ,!:4{ ",
|
||||
" .... ",
|
||||
" "};
|
Binary file not shown.
Before Width: | Height: | Size: 198 B |
|
@ -1,48 +0,0 @@
|
|||
/* XPM */
|
||||
static char * gtk_remove_xpm[] = {
|
||||
"24 24 21 1",
|
||||
" c None",
|
||||
". c #141414",
|
||||
"+ c #4E3329",
|
||||
"@ c #FF8E66",
|
||||
"# c #FF8761",
|
||||
"$ c #FF805C",
|
||||
"% c #FF7856",
|
||||
"& c #FF6F50",
|
||||
"* c #FF664A",
|
||||
"= c #FF5D43",
|
||||
"- c #FF543D",
|
||||
"; c #FF4B36",
|
||||
"> c #FF412F",
|
||||
", c #FF3727",
|
||||
"' c #FF2D20",
|
||||
") c #4E3228",
|
||||
"! c #FF2219",
|
||||
"~ c #4E3027",
|
||||
"{ c #FF1711",
|
||||
"] c #4E2E25",
|
||||
"^ c #FF0D09",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .............. ",
|
||||
" +@#$%&*=-;>,'. ",
|
||||
" )#$%&*=-;>,'!. ",
|
||||
" ~$%&*=-;>,'!{. ",
|
||||
" ]%&*=-;>,'!{^. ",
|
||||
" .............. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
|
@ -1,68 +0,0 @@
|
|||
/* XPM */
|
||||
static char * minus_xpm[] = {
|
||||
"25 9 56 1",
|
||||
" c None",
|
||||
". c #1F3038",
|
||||
"+ c #EBF4F8",
|
||||
"@ c #E9F3F8",
|
||||
"# c #EAF3F8",
|
||||
"$ c #ECF4F8",
|
||||
"% c #EDF4F8",
|
||||
"& c #EEF4F8",
|
||||
"* c #EFF5F8",
|
||||
"= c #F0F5F8",
|
||||
"- c #F1F5F8",
|
||||
"; c #F1F6F8",
|
||||
"> c #F2F6F8",
|
||||
", c #F3F6F8",
|
||||
"' c #F3F5F7",
|
||||
") c #F1F3F5",
|
||||
"! c #EEF1F3",
|
||||
"~ c #DBDBDB",
|
||||
"{ c #42BCFF",
|
||||
"] c #19AEFF",
|
||||
"^ c #22B1FF",
|
||||
"/ c #33B7FF",
|
||||
"( c #43BCFF",
|
||||
"_ c #53C2FF",
|
||||
": c #5FC6FF",
|
||||
"< c #6BCAFF",
|
||||
"[ c #76CEFF",
|
||||
"} c #7FD2FF",
|
||||
"| c #87D4FF",
|
||||
"1 c #8DD7FF",
|
||||
"2 c #92D8FF",
|
||||
"3 c #95D9FF",
|
||||
"4 c #96DAFF",
|
||||
"5 c #94D9FF",
|
||||
"6 c #DCE0E2",
|
||||
"7 c #1AAEFF",
|
||||
"8 c #28B3FF",
|
||||
"9 c #35B7FF",
|
||||
"0 c #41BBFF",
|
||||
"a c #4BBFFF",
|
||||
"b c #54C2FF",
|
||||
"c c #5BC5FF",
|
||||
"d c #61C7FF",
|
||||
"e c #65C8FF",
|
||||
"f c #68C9FF",
|
||||
"g c #69CAFF",
|
||||
"h c #67C9FF",
|
||||
"i c #D3D9DC",
|
||||
"j c #1CAFFF",
|
||||
"k c #25B2FF",
|
||||
"l c #2BB4FF",
|
||||
"m c #31B6FF",
|
||||
"n c #38B8FF",
|
||||
"o c #39B9FF",
|
||||
"p c #CDD5D9",
|
||||
"q c #CBD4D9",
|
||||
".........................",
|
||||
".+@@@@@#$%&*=-;>,,,,')!..",
|
||||
".{]]]]]]^/(_:<[}|123445..",
|
||||
".{]]]]]]]]7890abcdefggh..",
|
||||
".{]]]]]]]]]]]]jklm9noon..",
|
||||
".{]]]]]]]]]]]]]]]]]]]]]..",
|
||||
".{]]]]]]]]]]]]]]]]]]]]]..",
|
||||
".........................",
|
||||
"........................."};
|
|
@ -1,34 +0,0 @@
|
|||
/* XPM */
|
||||
static char * play_xpm[] = {
|
||||
"18 24 7 1",
|
||||
" c None",
|
||||
". c #ADB7BC",
|
||||
"+ c #ADB5B8",
|
||||
"@ c #1F3038",
|
||||
"# c #193B4B",
|
||||
"$ c #19AEFF",
|
||||
"% c #27B3FF",
|
||||
".+ ",
|
||||
" ",
|
||||
" ",
|
||||
"@@# ",
|
||||
"@$@@@ ",
|
||||
"@$$$@@@ ",
|
||||
"@$$$$$@@@ ",
|
||||
"@$$$$$$$@@@ ",
|
||||
"@$$$$$$$$$@@@ ",
|
||||
"@$$$$$$$$$$$@@@ ",
|
||||
"@$%$$$$$$$$$$$@@@ ",
|
||||
"@$%$$$$$$$$$$$$$@@",
|
||||
"@$%$$$$$$$$$$$$$$@",
|
||||
"@$%$$$$$$$$$$$$$@@",
|
||||
"@$%$$$$$$$$$$$@@@ ",
|
||||
"@$$$$$$$$$$$@@@ ",
|
||||
"@$$$$$$$$$@@@ ",
|
||||
"@$$$$$$$@@@ ",
|
||||
"@$$$$$@@@ ",
|
||||
"@$$$@@@ ",
|
||||
"@$@@@ ",
|
||||
"@@# ",
|
||||
" ",
|
||||
" "};
|
|
@ -1,98 +0,0 @@
|
|||
/* XPM */
|
||||
static char * plus_xpm[] = {
|
||||
"23 24 71 1",
|
||||
" c None",
|
||||
". c #1F3038",
|
||||
"+ c #EBF8FF",
|
||||
"@ c #EDF9FF",
|
||||
"# c #EFF9FF",
|
||||
"$ c #F1FAFF",
|
||||
"% c #F7FCFF",
|
||||
"& c #63C7FF",
|
||||
"* c #73CDFF",
|
||||
"= c #84D3FF",
|
||||
"- c #94D9FF",
|
||||
"; c #C0E8FF",
|
||||
"> c #5CC5FF",
|
||||
", c #6CCBFF",
|
||||
"' c #7CD0FF",
|
||||
") c #8CD6FF",
|
||||
"! c #B8E6FF",
|
||||
"~ c #51C1FF",
|
||||
"{ c #61C7FF",
|
||||
"] c #71CCFF",
|
||||
"^ c #80D2FF",
|
||||
"/ c #B1E3FF",
|
||||
"( c #44BCFF",
|
||||
"_ c #54C2FF",
|
||||
": c #63C8FF",
|
||||
"< c #72CDFF",
|
||||
"[ c #A6DFFF",
|
||||
"} c #33B7FF",
|
||||
"| c #43BCFF",
|
||||
"1 c #53C2FF",
|
||||
"2 c #62C7FF",
|
||||
"3 c #9ADBFF",
|
||||
"4 c #21B0FF",
|
||||
"5 c #30B6FF",
|
||||
"6 c #3FBBFF",
|
||||
"7 c #4FC0FF",
|
||||
"8 c #19AEFF",
|
||||
"9 c #1BAEFF",
|
||||
"0 c #2AB3FF",
|
||||
"a c #38B8FF",
|
||||
"b c #B3E4FF",
|
||||
"c c #A3DFFF",
|
||||
"d c #8BD6FF",
|
||||
"e c #20B0FF",
|
||||
"f c #4EC1FF",
|
||||
"g c #A3DEFF",
|
||||
"h c #A9E0FF",
|
||||
"i c #AFE3FF",
|
||||
"j c #BDE7FF",
|
||||
"k c #C6EBFF",
|
||||
"l c #42BCFF",
|
||||
"m c #1FB0FF",
|
||||
"n c #2BB4FF",
|
||||
"o c #36B8FF",
|
||||
"p c #41BBFF",
|
||||
"q c #4BBFFF",
|
||||
"r c #55C2FF",
|
||||
"s c #5DC5FF",
|
||||
"t c #23B1FF",
|
||||
"u c #2CB4FF",
|
||||
"v c #35B7FF",
|
||||
"w c #3EBAFF",
|
||||
"x c #1DAFFF",
|
||||
"y c #A7E0FF",
|
||||
"z c #7ED2FF",
|
||||
"A c #1B2F3A",
|
||||
"B c #2B3E47",
|
||||
"C c #243641",
|
||||
"D c #5DC6FF",
|
||||
"E c #C2E9FF",
|
||||
"F c #D4F0FF",
|
||||
" ....... ",
|
||||
" .+@#$%. ",
|
||||
" .&*=-;. ",
|
||||
" .>,')!. ",
|
||||
" .~{]^/. ",
|
||||
" .(_:<[. ",
|
||||
" .}|123. ",
|
||||
" .4567). ",
|
||||
".........890a'........ ",
|
||||
".bccccccd888efghib!jk. ",
|
||||
".l888888888888mnopqrs. ",
|
||||
".l888888888888888tuvw. ",
|
||||
".l888888888888888888x. ",
|
||||
".l8888888888888888888. ",
|
||||
".y------z8888lccccccc. ",
|
||||
"ABBBBBBC.8888D........ ",
|
||||
" .8888D. ",
|
||||
" .8888D. ",
|
||||
" .8888D. ",
|
||||
" .8888D. ",
|
||||
" .8888D. ",
|
||||
" .8888D. ",
|
||||
" .EEEEF. ",
|
||||
" ....... "};
|
|
@ -1,175 +0,0 @@
|
|||
/* XPM */
|
||||
static char * stop_xpm[] = {
|
||||
"23 24 148 2",
|
||||
" c None",
|
||||
". c #1F3038",
|
||||
"+ c #FFFFFF",
|
||||
"@ c #E7F5FD",
|
||||
"# c #73C5F2",
|
||||
"$ c #71C4F2",
|
||||
"% c #74C5F2",
|
||||
"& c #7CC9F3",
|
||||
"* c #84CAF3",
|
||||
"= c #8CCFF3",
|
||||
"- c #93D1F4",
|
||||
"; c #9BD4F4",
|
||||
"> c #A4D8F5",
|
||||
", c #AADAF5",
|
||||
"' c #B3DDF6",
|
||||
") c #BAE0F6",
|
||||
"! c #C2E4F6",
|
||||
"~ c #CAE6F6",
|
||||
"{ c #D1E9F6",
|
||||
"] c #D3EAF6",
|
||||
"^ c #CFE8F6",
|
||||
"/ c #C9E5F6",
|
||||
"( c #C2E3F5",
|
||||
"_ c #FBFDFE",
|
||||
": c #D2ECFA",
|
||||
"< c #10A5F6",
|
||||
"[ c #19AEFF",
|
||||
"} c #27B2FF",
|
||||
"| c #34B7FF",
|
||||
"1 c #42BCFF",
|
||||
"2 c #50C1FF",
|
||||
"3 c #5EC6FF",
|
||||
"4 c #6CCBFF",
|
||||
"5 c #7ACFFF",
|
||||
"6 c #87D4FF",
|
||||
"7 c #95D9FF",
|
||||
"8 c #A3DEFF",
|
||||
"9 c #B0E2FF",
|
||||
"0 c #BDE7FF",
|
||||
"a c #BCE7FF",
|
||||
"b c #92D3F8",
|
||||
"c c #F7FCFE",
|
||||
"d c #24B1FF",
|
||||
"e c #32B6FF",
|
||||
"f c #3FBBFF",
|
||||
"g c #4EC0FF",
|
||||
"h c #5CC5FF",
|
||||
"i c #69CAFF",
|
||||
"j c #77CFFF",
|
||||
"k c #85D3FF",
|
||||
"l c #93D8FF",
|
||||
"m c #A0DDFF",
|
||||
"n c #AEE2FF",
|
||||
"o c #BAE6FF",
|
||||
"p c #B9E6FF",
|
||||
"q c #A1DDFF",
|
||||
"r c #8ED1F8",
|
||||
"s c #F7FBFE",
|
||||
"t c #21B0FF",
|
||||
"u c #2EB5FF",
|
||||
"v c #3CBAFF",
|
||||
"w c #4ABFFF",
|
||||
"x c #57C3FF",
|
||||
"y c #64C8FF",
|
||||
"z c #72CDFF",
|
||||
"A c #7FD1FF",
|
||||
"B c #8CD6FF",
|
||||
"C c #99DAFF",
|
||||
"D c #A4DEFF",
|
||||
"E c #ABE1FF",
|
||||
"F c #87CFF7",
|
||||
"G c #1CAFFF",
|
||||
"H c #29B3FF",
|
||||
"I c #37B8FF",
|
||||
"J c #44BDFF",
|
||||
"K c #51C1FF",
|
||||
"L c #6BCAFF",
|
||||
"M c #83D3FF",
|
||||
"N c #8DD6FF",
|
||||
"O c #96D9FF",
|
||||
"P c #9BDBFF",
|
||||
"Q c #8ED7FF",
|
||||
"R c #7DCBF6",
|
||||
"S c #F6FBFE",
|
||||
"T c #23B1FF",
|
||||
"U c #30B6FF",
|
||||
"V c #3DBAFF",
|
||||
"W c #56C3FF",
|
||||
"X c #62C7FF",
|
||||
"Y c #6DCBFF",
|
||||
"Z c #81D2FF",
|
||||
"` c #8BD6FF",
|
||||
" . c #71C6F6",
|
||||
".. c #1BAEFF",
|
||||
"+. c #28B3FF",
|
||||
"@. c #35B7FF",
|
||||
"#. c #41BCFF",
|
||||
"$. c #4CC0FF",
|
||||
"%. c #6ACAFF",
|
||||
"&. c #73CDFF",
|
||||
"*. c #78CFFF",
|
||||
"=. c #7BD0FF",
|
||||
"-. c #79CFFF",
|
||||
";. c #64C1F5",
|
||||
">. c #F5FBFE",
|
||||
",. c #1FB0FF",
|
||||
"'. c #2BB4FF",
|
||||
"). c #4CBFFF",
|
||||
"!. c #55C3FF",
|
||||
"~. c #5DC5FF",
|
||||
"{. c #68C9FF",
|
||||
"]. c #56BCF5",
|
||||
"^. c #F4FAFE",
|
||||
"/. c #35B8FF",
|
||||
"(. c #48BEFF",
|
||||
"_. c #4FC0FF",
|
||||
":. c #54C2FF",
|
||||
"<. c #59C4FF",
|
||||
"[. c #5BC5FF",
|
||||
"}. c #47B6F4",
|
||||
"|. c #F3FAFE",
|
||||
"1. c #20B0FF",
|
||||
"2. c #39B9FF",
|
||||
"3. c #40BBFF",
|
||||
"4. c #46BDFF",
|
||||
"5. c #49BEFF",
|
||||
"6. c #4BBFFF",
|
||||
"7. c #38B2F4",
|
||||
"8. c #F2FAFE",
|
||||
"9. c #31B6FF",
|
||||
"0. c #3BB9FF",
|
||||
"a. c #28AAF3",
|
||||
"b. c #F1F9FE",
|
||||
"c. c #1DAFFF",
|
||||
"d. c #22B1FF",
|
||||
"e. c #26B2FF",
|
||||
"f. c #1AA6F3",
|
||||
"g. c #F1F9FD",
|
||||
"h. c #1AAEFF",
|
||||
"i. c #0DA1F3",
|
||||
"j. c #F0F9FD",
|
||||
"k. c #099CEE",
|
||||
"l. c #0DA2F3",
|
||||
"m. c #079AEC",
|
||||
"n. c #F9FCFE",
|
||||
"o. c #DDF1FC",
|
||||
"p. c #EEF8FD",
|
||||
"q. c #FEFFFF",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . ",
|
||||
". + + + + + + + + + + + + + + + + + + + + + . ",
|
||||
". @ # $ % & * = - ; > , ' ) ! ~ { ] ^ / ( _ . ",
|
||||
". : < [ [ } | 1 2 3 4 5 6 7 8 9 0 a 9 8 b c . ",
|
||||
". : < [ [ d e f g h i j k l m n o p n q r s . ",
|
||||
". : < [ [ t u v w x y z A B C D E E D C F s . ",
|
||||
". : < [ [ G H I J K 3 L j M N O P P O Q R S . ",
|
||||
". : < [ [ [ T U V w W X Y j Z 6 ` ` 6 Z .S . ",
|
||||
". : < [ [ [ ..+.@.#.$.x X %.&.*.=.=.-.&.;.>.. ",
|
||||
". : < [ [ [ [ ,.'.I #.).!.~.y {.L L i y ].^.. ",
|
||||
". : < [ [ [ [ [ t './.f (._.:.<.[.[.<.W }.|.. ",
|
||||
". : < [ [ [ [ [ [ 1.H e 2.3.4.5.6.6.w 4.7.8.. ",
|
||||
". : < [ [ [ [ [ [ [ G d '.9./.2.0.0.2.I a.b.. ",
|
||||
". : < [ [ [ [ [ [ [ [ [ c.d.e.H '.'.H } f.g.. ",
|
||||
". : < [ [ [ [ [ [ [ [ [ [ [ [ [ ....h.[ i.j.. ",
|
||||
". : < [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ i.j.. ",
|
||||
". : < [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ i.j.. ",
|
||||
". : < [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ i.j.. ",
|
||||
". : < [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ i.j.. ",
|
||||
". : < [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ i.j.. ",
|
||||
". : < [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ i.j.. ",
|
||||
". : k.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.l.m.j.. ",
|
||||
". n.o.o.o.o.o.o.o.o.o.o.@ p.p.p.p.p.p.p.p.q.. ",
|
||||
". . . . . . . . . . . . . . . . . . . . . . . "};
|
|
@ -1,216 +0,0 @@
|
|||
/* XPM */
|
||||
static char * systray_xpm[] = {
|
||||
"24 24 189 2",
|
||||
" c None",
|
||||
". c #918989",
|
||||
"+ c #C55643",
|
||||
"@ c #CE634C",
|
||||
"# c #D4674A",
|
||||
"$ c #C9583A",
|
||||
"% c #B1ACAB",
|
||||
"& c #8F8F8F",
|
||||
"* c #858585",
|
||||
"= c #8E8E8E",
|
||||
"- c #B47C6B",
|
||||
"; c #C43F17",
|
||||
"> c #BF3009",
|
||||
", c #B72803",
|
||||
"' c #911600",
|
||||
") c #D07056",
|
||||
"! c #B96E5A",
|
||||
"~ c #BBB9B9",
|
||||
"{ c #B7B7B7",
|
||||
"] c #CBCBCB",
|
||||
"^ c #CABAB7",
|
||||
"/ c #B41E01",
|
||||
"( c #AA1800",
|
||||
"_ c #931300",
|
||||
": c #750C00",
|
||||
"< c #C75C46",
|
||||
"[ c #D26E4D",
|
||||
"} c #C64C25",
|
||||
"| c #B32A05",
|
||||
"1 c #BC9A97",
|
||||
"2 c #ECECEC",
|
||||
"3 c #F7F7F7",
|
||||
"4 c #EDEDED",
|
||||
"5 c #982E16",
|
||||
"6 c #871000",
|
||||
"7 c #6F0A00",
|
||||
"8 c #B04029",
|
||||
"9 c #C7502B",
|
||||
"0 c #B52805",
|
||||
"a c #BB2100",
|
||||
"b c #B11B00",
|
||||
"c c #8D473E",
|
||||
"d c #E4E4E4",
|
||||
"e c #C4C4C4",
|
||||
"f c #999999",
|
||||
"g c #672823",
|
||||
"h c #AF746A",
|
||||
"i c #B52803",
|
||||
"j c #B52100",
|
||||
"k c #A91900",
|
||||
"l c #9A1700",
|
||||
"m c #661A11",
|
||||
"n c #9F9F9F",
|
||||
"o c #686868",
|
||||
"p c #525252",
|
||||
"q c #444343",
|
||||
"r c #424242",
|
||||
"s c #8B8181",
|
||||
"t c #801404",
|
||||
"u c #750B00",
|
||||
"v c #6A0700",
|
||||
"w c #5F0600",
|
||||
"x c #4E2D2C",
|
||||
"y c #8D8D8D",
|
||||
"z c #3B3B3B",
|
||||
"A c #343434",
|
||||
"B c #484848",
|
||||
"C c #727272",
|
||||
"D c #696969",
|
||||
"E c #454545",
|
||||
"F c #2A2A2A",
|
||||
"G c #939393",
|
||||
"H c #3D3D3D",
|
||||
"I c #3C3C3C",
|
||||
"J c #4A4A4A",
|
||||
"K c #585858",
|
||||
"L c #535353",
|
||||
"M c #5C5C5C",
|
||||
"N c #474747",
|
||||
"O c #7D7D7D",
|
||||
"P c #777777",
|
||||
"Q c #6B6B6B",
|
||||
"R c #7C7C7C",
|
||||
"S c #BEBEBE",
|
||||
"T c #949494",
|
||||
"U c #5D5D5D",
|
||||
"V c #787878",
|
||||
"W c #909090",
|
||||
"X c #545454",
|
||||
"Y c #666666",
|
||||
"Z c #A7A7A7",
|
||||
"` c #9C9C9C",
|
||||
" . c #969696",
|
||||
".. c #C0C0C0",
|
||||
"+. c #636363",
|
||||
"@. c #6A6A6A",
|
||||
"#. c #515151",
|
||||
"$. c #3A3A3A",
|
||||
"%. c #444444",
|
||||
"&. c #848484",
|
||||
"*. c #A3A3A3",
|
||||
"=. c #9D9D9D",
|
||||
"-. c #565656",
|
||||
";. c #A2A2A2",
|
||||
">. c #BBBBBB",
|
||||
",. c #C9C9C9",
|
||||
"'. c #BFBFBF",
|
||||
"). c #434343",
|
||||
"!. c #575757",
|
||||
"~. c #282828",
|
||||
"{. c #A9A9A9",
|
||||
"]. c #CACACA",
|
||||
"^. c #CCCCCC",
|
||||
"/. c #151515",
|
||||
"(. c #595959",
|
||||
"_. c #838383",
|
||||
":. c #717171",
|
||||
"<. c #989898",
|
||||
"[. c #CFCFCF",
|
||||
"}. c #9A9A9A",
|
||||
"|. c #898989",
|
||||
"1. c #171717",
|
||||
"2. c #4C4C4C",
|
||||
"3. c #868686",
|
||||
"4. c #D1D1D1",
|
||||
"5. c #5F5F5F",
|
||||
"6. c #555555",
|
||||
"7. c #CDCDCD",
|
||||
"8. c #E3E3E3",
|
||||
"9. c #646464",
|
||||
"0. c #99999A",
|
||||
"a. c #ADADAD",
|
||||
"b. c #494949",
|
||||
"c. c #C7C7C7",
|
||||
"d. c #D5D5D5",
|
||||
"e. c #D6D6D6",
|
||||
"f. c #B9B9B9",
|
||||
"g. c #8C8C8C",
|
||||
"h. c #A6A6A6",
|
||||
"i. c #9B9B9B",
|
||||
"j. c #EAEAEA",
|
||||
"k. c #F0F0F0",
|
||||
"l. c #E5E5E5",
|
||||
"m. c #C2C2C2",
|
||||
"n. c #313131",
|
||||
"o. c #D7D7D7",
|
||||
"p. c #DADADA",
|
||||
"q. c #DBDBDB",
|
||||
"r. c #B2B2B2",
|
||||
"s. c #F5F5F5",
|
||||
"t. c #F8F8F8",
|
||||
"u. c #B8B8B8",
|
||||
"v. c #D4D4D4",
|
||||
"w. c #DEDEDE",
|
||||
"x. c #E0E0E0",
|
||||
"y. c #F1F1F1",
|
||||
"z. c #A1A1A1",
|
||||
"A. c #3F3F3F",
|
||||
"B. c #6E6E6E",
|
||||
"C. c #FCFCFC",
|
||||
"D. c #F2F2F2",
|
||||
"E. c #B6B6B6",
|
||||
"F. c #C5C5C5",
|
||||
"G. c #979797",
|
||||
"H. c #F9F9F9",
|
||||
"I. c #656565",
|
||||
"J. c #272727",
|
||||
"K. c #B4B4B4",
|
||||
"L. c #BDBDBD",
|
||||
"M. c #919191",
|
||||
"N. c #FFFFFF",
|
||||
"O. c #FAFAFA",
|
||||
"P. c #E2E2E2",
|
||||
"Q. c #B1B1B1",
|
||||
"R. c #C3C3C3",
|
||||
"S. c #AFAFAF",
|
||||
"T. c #797979",
|
||||
"U. c #B5B5B5",
|
||||
"V. c #BCBCBC",
|
||||
"W. c #393939",
|
||||
"X. c #BABABA",
|
||||
"Y. c #B3B3B3",
|
||||
"Z. c #F6F6F6",
|
||||
"`. c #B0B0B0",
|
||||
" + c #A5A5A5",
|
||||
".+ c #AEAEAE",
|
||||
"++ c #6D6D6D",
|
||||
"@+ c #5B5B5B",
|
||||
"#+ c #1F1F1F",
|
||||
" . + @ # $ ",
|
||||
" % & * = - ; > , ' ",
|
||||
" ) ! ~ { ] ^ / ( _ : ",
|
||||
" < [ } | 1 2 3 4 5 6 7 ",
|
||||
" 8 9 0 a b c d e f g ",
|
||||
" * h i j k l m n o p q r r ",
|
||||
" s t u v w x y z A B C D E ",
|
||||
" F G H I J K L M N ",
|
||||
" r H B O P Q R S T U p ",
|
||||
" r N V W X Y Z ` ...e +.@.#. ",
|
||||
" $.%.= &.*.=.-.;.*.T >.,.'.).@.!. ",
|
||||
" ~.E {.].^.]./.(._.:.<.[.[.}.X :.|. ",
|
||||
" 1.2.3.[.4.S ` 5.6.(.D 7.8.4 9.0.a. ",
|
||||
" b.p c.d.e.e.f.g.'.h.i.j.k.l.).'.m. ",
|
||||
" n.U & o.p.q.q...c.r.5.Y s.t.{.V u.v. ",
|
||||
" o M ].w.x.y.8.z.& A.B.C.C.D.i.E.F. ",
|
||||
" #.o G.8.H.3 y R I.J.K.s.o.L.{ e 3. ",
|
||||
" M.=.d N.N.N.O.P.{.,.E.Q.R.S.5. ",
|
||||
" T.U.R.C.N.N.H.e.r.r.u.V.T. ",
|
||||
" W.X.Y.q.Z.e.U.`.{ '.G ",
|
||||
" y U.S.S.S.K.m. +(. ",
|
||||
" A.S r.r.'..+++ ",
|
||||
" Q i.= @+ ",
|
||||
" #+ "};
|
Binary file not shown.
Before Width: | Height: | Size: 18 KiB |
File diff suppressed because it is too large
Load Diff
|
@ -1,242 +0,0 @@
|
|||
/*
|
||||
* Xmission - a cross-platform bittorrent client
|
||||
* Copyright (C) 2007 Charles Kerr <charles@transmissionbt.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <wx/dcclient.h>
|
||||
#include <wx/dcmemory.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/intl.h>
|
||||
#include <libtransmission/transmission.h>
|
||||
#include "foreach.h"
|
||||
#include "speed-stats.h"
|
||||
|
||||
#define SNAPSHOT_PIXEL_WIDTH 2
|
||||
|
||||
BEGIN_EVENT_TABLE( SpeedStats, wxPanel )
|
||||
EVT_SIZE( SpeedStats::OnSize )
|
||||
EVT_PAINT( SpeedStats::OnPaint )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
SpeedStats :: SpeedStats( wxWindow * parent,
|
||||
wxWindowID id,
|
||||
const wxPoint & pos,
|
||||
const wxSize & size,
|
||||
long style,
|
||||
const wxString & name ):
|
||||
wxPanel( parent, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name ),
|
||||
myBitmap( 0 ),
|
||||
myTorrent( 0 ),
|
||||
myMaxSpeed( -1 ),
|
||||
myHistory( 0 )
|
||||
{
|
||||
myColors[BACKGROUND] = wxColour( 0, 0, 0 ); // black
|
||||
myColors[FRAME] = wxColour( 34, 139, 34 ); // forest green
|
||||
myColors[ALL_UP] = wxColour( 255, 0, 0 );
|
||||
myColors[TORRENT_UP] = wxColour( 255, 255, 0 );
|
||||
|
||||
myColors[ALL_DOWN] = wxColour( 255, 0, 255 );
|
||||
myColors[TORRENT_DOWN] = wxColour( 0, 255, 128 );
|
||||
}
|
||||
|
||||
SpeedStats :: ~SpeedStats()
|
||||
{
|
||||
delete myBitmap;
|
||||
}
|
||||
|
||||
/**
|
||||
***
|
||||
**/
|
||||
|
||||
void
|
||||
SpeedStats :: SetColor( int i, const wxColour& c )
|
||||
{
|
||||
assert( 0<=i && i<N_COLORS );
|
||||
|
||||
myColors[i] = c;
|
||||
}
|
||||
|
||||
wxString
|
||||
SpeedStats :: GetColorName( int i )
|
||||
{
|
||||
static const wxString xstr[N_COLORS] = {
|
||||
_T("background"), _T("frame"),
|
||||
_T("torrent-up"), _T("torrent-down"),
|
||||
_T("all-up"), _T("all-down")
|
||||
};
|
||||
|
||||
wxString ret = _T("speed-color-");
|
||||
ret += xstr[i];
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
***
|
||||
**/
|
||||
|
||||
void
|
||||
SpeedStats :: OnSize( wxSizeEvent& event )
|
||||
{
|
||||
delete myBitmap;
|
||||
|
||||
const wxSize size = event.GetSize();
|
||||
myBitmap = new wxBitmap( size.GetWidth(), size.GetHeight() );
|
||||
myHistory = size.GetWidth() / SNAPSHOT_PIXEL_WIDTH;
|
||||
}
|
||||
|
||||
void
|
||||
SpeedStats :: OnPaint( wxPaintEvent& WXUNUSED(event) )
|
||||
{
|
||||
const int draw_width = myBitmap->GetWidth();
|
||||
const int draw_height = myBitmap->GetHeight();
|
||||
|
||||
const int top = (((int)myMaxSpeed + 11) / 10) * 10;
|
||||
const double y_scale = (double)draw_height / top;
|
||||
const int num_bars = 4;
|
||||
const int per_bar = top / num_bars;
|
||||
|
||||
// clear
|
||||
wxMemoryDC memDC;
|
||||
memDC.SelectObject( *myBitmap );
|
||||
memDC.SetBackground( myColors[BACKGROUND] );
|
||||
memDC.Clear( );
|
||||
|
||||
// draw the frame
|
||||
|
||||
memDC.SetPen( wxPen ( myColors[FRAME] ) );
|
||||
memDC.SetTextForeground( myColors[FRAME] );
|
||||
|
||||
const int fontsize = 10;
|
||||
const int dely = int( draw_height / num_bars );
|
||||
|
||||
wxString xstr;
|
||||
|
||||
memDC.SetFont( wxFont ( fontsize, wxFONTFAMILY_SWISS,
|
||||
wxFONTSTYLE_NORMAL,
|
||||
wxFONTWEIGHT_NORMAL ) );
|
||||
|
||||
for( int i=0; i<=num_bars; ++i )
|
||||
{
|
||||
const int y = (int)(draw_height - (i*dely+0.5));
|
||||
|
||||
// line
|
||||
memDC.DrawLine( wxCoord(0), wxCoord(draw_height - (i*dely+0.5)),
|
||||
wxCoord(draw_width), wxCoord(draw_height - (i*dely+0.5)) );
|
||||
|
||||
xstr.Printf( _("%d KiB/s"), (per_bar*i) );
|
||||
memDC.DrawText( xstr, wxCoord(0), wxCoord(y+2) );
|
||||
}
|
||||
|
||||
const int n = myStats.size( );
|
||||
if( n )
|
||||
{
|
||||
wxPoint * points = new wxPoint[ n ];
|
||||
|
||||
int x = draw_width - (n * SNAPSHOT_PIXEL_WIDTH);
|
||||
for( int i=0; i<n; ++i ) {
|
||||
points[i].x = x;
|
||||
x += SNAPSHOT_PIXEL_WIDTH;
|
||||
}
|
||||
|
||||
// torrent upload
|
||||
for( int i=0; i<n; ++i )
|
||||
points[i].y = draw_height - 10 - int(myStats[i].torrentUp * y_scale);
|
||||
wxPen pen( myColors[TORRENT_UP] );
|
||||
memDC.SetPen( pen );
|
||||
memDC.DrawLines( n, points, 0, 0 );
|
||||
|
||||
// torrent download
|
||||
for( int i=0; i<n; ++i )
|
||||
points[i].y = draw_height - int(myStats[i].torrentDown * y_scale);
|
||||
pen.SetColour( myColors[TORRENT_DOWN] );
|
||||
memDC.SetPen( pen );
|
||||
memDC.DrawLines( n, points, 0, 0 );
|
||||
|
||||
// all upload
|
||||
for( int i=0; i<n; ++i )
|
||||
points[i].y = draw_height - int(myStats[i].allUp * y_scale);
|
||||
pen.SetColour( myColors[ALL_UP] );
|
||||
memDC.SetPen( pen );
|
||||
memDC.DrawLines( n, points, 0, 0 );
|
||||
|
||||
// all download
|
||||
for( int i=0; i<n; ++i )
|
||||
points[i].y = draw_height - int(myStats[i].allDown * y_scale);
|
||||
pen.SetColour( myColors[ALL_DOWN] );
|
||||
memDC.SetPen( pen );
|
||||
memDC.DrawLines( n, points, 0, 0 );
|
||||
|
||||
delete [] points;
|
||||
}
|
||||
|
||||
wxPaintDC dc( this );
|
||||
dc.Blit( 0, 0, draw_width, draw_height, &memDC, 0, 0 );
|
||||
memDC.SelectObject( wxNullBitmap );
|
||||
}
|
||||
|
||||
void
|
||||
SpeedStats :: SetTorrent( tr_torrent * tor )
|
||||
{
|
||||
if( tor != myTorrent )
|
||||
{
|
||||
myTorrent = tor;
|
||||
|
||||
myMaxSpeed = 0;
|
||||
foreach( stats_t, myStats, it )
|
||||
{
|
||||
it->torrentUp = 0;
|
||||
it->torrentDown = 0;
|
||||
myMaxSpeed = std::max( myMaxSpeed, it->allUp );
|
||||
myMaxSpeed = std::max( myMaxSpeed, it->allDown );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SpeedStats :: Pulse( tr_session * handle )
|
||||
{
|
||||
// add a new record
|
||||
const double allUp = tr_sessionGetPieceSpeed( handle, TR_UP );
|
||||
const double allDown = tr_sessionGetPieceSpeed( handle, TR_DOWN );
|
||||
Speed s;
|
||||
s.time = time( NULL );
|
||||
s.allUp = allUp;
|
||||
s.allDown = allDown;
|
||||
if( myTorrent ) {
|
||||
const tr_stat * stat = tr_torrentStat( myTorrent );
|
||||
s.torrentUp = stat->pieceUploadSpeed;
|
||||
s.torrentDown = stat->pieceDownloadSpeed;
|
||||
}
|
||||
myStats.push_back( s );
|
||||
|
||||
// age off old data
|
||||
const int eraseCount = myStats.size() - myHistory;
|
||||
if( eraseCount > 0 )
|
||||
myStats.erase( myStats.begin(),
|
||||
myStats.begin() + eraseCount );
|
||||
|
||||
// update max
|
||||
myMaxSpeed = std::max( myMaxSpeed, s.allUp );
|
||||
myMaxSpeed = std::max( myMaxSpeed, s.allDown );
|
||||
myMaxSpeed = std::max( myMaxSpeed, s.torrentUp );
|
||||
myMaxSpeed = std::max( myMaxSpeed, s.torrentDown );
|
||||
|
||||
Refresh( false );
|
||||
}
|
107
wx/speed-stats.h
107
wx/speed-stats.h
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
* Xmission - a cross-platform bittorrent client
|
||||
* Copyright (C) 2007 Charles Kerr <charles@transmissionbt.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __XMISSION_SPEED_STATS_H__
|
||||
#define __XMISSION_SPEED_STATS_H__
|
||||
|
||||
#include <ctime>
|
||||
#include <vector>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/panel.h>
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
struct tr_torrent;
|
||||
}
|
||||
|
||||
class SpeedStats: public wxPanel
|
||||
{
|
||||
public:
|
||||
|
||||
SpeedStats( wxWindow * parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL,
|
||||
const wxString& name = _T("panel"));
|
||||
|
||||
virtual ~SpeedStats();
|
||||
|
||||
public:
|
||||
|
||||
void SetTorrent( struct tr_torrent * );
|
||||
|
||||
void Pulse( tr_session * handle );
|
||||
|
||||
public:
|
||||
|
||||
enum {
|
||||
BACKGROUND,
|
||||
FRAME,
|
||||
TORRENT_UP,
|
||||
TORRENT_DOWN,
|
||||
ALL_UP,
|
||||
ALL_DOWN,
|
||||
N_COLORS
|
||||
};
|
||||
|
||||
void SetColor( int, const wxColour& );
|
||||
|
||||
static wxString GetColorName( int );
|
||||
|
||||
private:
|
||||
|
||||
virtual void OnSize( wxSizeEvent& event );
|
||||
|
||||
void OnPaint( wxPaintEvent& );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
private:
|
||||
|
||||
wxBitmap * myBitmap;
|
||||
|
||||
struct tr_torrent * myTorrent;
|
||||
|
||||
struct Speed
|
||||
{
|
||||
time_t time;
|
||||
double torrentUp;
|
||||
double torrentDown;
|
||||
double allUp;
|
||||
double allDown;
|
||||
Speed(): time(0),
|
||||
torrentUp(0), torrentDown(0),
|
||||
allUp(0), allDown(0) {}
|
||||
};
|
||||
|
||||
typedef std::vector<Speed> stats_t;
|
||||
|
||||
stats_t myStats;
|
||||
|
||||
double myMaxSpeed;
|
||||
|
||||
int myHistory;
|
||||
|
||||
wxColour myColors[N_COLORS];
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,745 +0,0 @@
|
|||
/*
|
||||
* Xmission - a cross-platform bittorrent client
|
||||
* Copyright (C) 2007 Charles Kerr <charles@transmissionbt.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <wx/intl.h>
|
||||
#include <torrent-list.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
typedef std::vector<tr_torrent*> torrents_t;
|
||||
|
||||
enum
|
||||
{
|
||||
COL_POSITION,
|
||||
COL_PERCENT_DONE,
|
||||
COL_DOWNLOAD_SPEED,
|
||||
COL_ETA,
|
||||
COL_HASH,
|
||||
COL_NAME,
|
||||
COL_PEERS,
|
||||
COL_RATIO,
|
||||
COL_RECEIVED,
|
||||
COL_REMAINING,
|
||||
COL_SEEDS,
|
||||
COL_SENT,
|
||||
COL_SIZE,
|
||||
COL_STATE,
|
||||
COL_STATUS,
|
||||
COL_TOTAL,
|
||||
COL_UPLOAD_SPEED,
|
||||
N_COLS
|
||||
};
|
||||
|
||||
const wxString columnKeys[N_COLS] =
|
||||
{
|
||||
_T("position"),
|
||||
_T("done"),
|
||||
_T("download-speed"),
|
||||
_T("eta"),
|
||||
_T("hash"),
|
||||
_T("name"),
|
||||
_T("peers"),
|
||||
_T("ratio"),
|
||||
_T("received"),
|
||||
_T("remaining"),
|
||||
_T("seeds"),
|
||||
_T("sent"),
|
||||
_T("size"),
|
||||
_T("state"),
|
||||
_T("status"),
|
||||
_T("total"),
|
||||
_T("upload-speed")
|
||||
};
|
||||
|
||||
int getTorrentColumn( const wxString& key )
|
||||
{
|
||||
typedef std::map<wxString,int> string2key_t;
|
||||
static string2key_t columns;
|
||||
|
||||
if( columns.empty() )
|
||||
{
|
||||
columns[_T("position")] = COL_POSITION;
|
||||
columns[_T("done")] = COL_PERCENT_DONE;
|
||||
columns[_T("download-speed")] = COL_DOWNLOAD_SPEED;
|
||||
columns[_T("eta")] = COL_ETA;
|
||||
columns[_T("hash")] = COL_HASH;
|
||||
columns[_T("name")] = COL_NAME;
|
||||
columns[_T("peers")] = COL_PEERS;
|
||||
columns[_T("ratio")] = COL_RATIO;
|
||||
columns[_T("received")] = COL_RECEIVED;
|
||||
columns[_T("remaining")] = COL_REMAINING;
|
||||
columns[_T("seeds")] = COL_SEEDS;
|
||||
columns[_T("sent")] = COL_SENT;
|
||||
columns[_T("size")] = COL_SIZE;
|
||||
columns[_T("state")] = COL_STATE;
|
||||
columns[_T("status")] = COL_STATUS;
|
||||
columns[_T("total")] = COL_TOTAL;
|
||||
columns[_T("upload-speed")] = COL_UPLOAD_SPEED;
|
||||
}
|
||||
|
||||
int i = -1;
|
||||
string2key_t::const_iterator it = columns.find( key );
|
||||
if( it != columns.end() )
|
||||
i = it->second;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
typedef std::vector<int> int_v;
|
||||
|
||||
int_v getTorrentColumns( wxConfig * config )
|
||||
{
|
||||
const wxString key = _T("torrent-list-columns");
|
||||
wxString columnStr;
|
||||
if( !config->Read( key, &columnStr, _T("name|download-speed|upload-speed|eta|peers|size|done|status|seeds") ) )
|
||||
config->Write( key, columnStr );
|
||||
|
||||
int_v cols;
|
||||
while( !columnStr.IsEmpty() )
|
||||
{
|
||||
const wxString key = columnStr.BeforeFirst(_T('|'));
|
||||
columnStr.Remove( 0, key.Len() + 1 );
|
||||
cols.push_back( getTorrentColumn( key ) );
|
||||
}
|
||||
return cols;
|
||||
}
|
||||
|
||||
int bestDecimal( double num ) {
|
||||
if ( num < 10 ) return 2;
|
||||
if ( num < 100 ) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
wxString toWxStr( const std::string& s )
|
||||
{
|
||||
return wxString( s.c_str(), wxConvUTF8 );
|
||||
}
|
||||
|
||||
wxString toWxStr( const char * s )
|
||||
{
|
||||
return wxString( s, wxConvUTF8 );
|
||||
}
|
||||
|
||||
wxString getReadableSize( uint64_t size )
|
||||
{
|
||||
int i;
|
||||
static const char *sizestrs[] = { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB" };
|
||||
for ( i=0; size>>10; ++i )
|
||||
size = size >> 10;
|
||||
char buf[512];
|
||||
tr_snprintf( buf, sizeof(buf), "%.*f %s", bestDecimal(size), (double)size, sizestrs[i] );
|
||||
return toWxStr( buf );
|
||||
}
|
||||
|
||||
wxString getReadableSize( float f )
|
||||
{
|
||||
return getReadableSize( (uint64_t)f );
|
||||
}
|
||||
|
||||
wxString getReadableSpeed( float kib_sec )
|
||||
{
|
||||
wxString xstr = getReadableSize(1024*kib_sec);
|
||||
xstr += _T("/s");
|
||||
return xstr;
|
||||
}
|
||||
|
||||
wxString getReadableTime( int i /*seconds*/ ) /*FIXME*/
|
||||
{
|
||||
const int s = i % 60; i /= 60;
|
||||
const int m = i % 60; i /= 60;
|
||||
const int h = i;
|
||||
return wxString::Format( _T("%d:%02d:%02d"), h, m, s );
|
||||
}
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
TORRENT_LIST_CTRL = 1000
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(TorrentListCtrl, wxListCtrl)
|
||||
EVT_LIST_COL_CLICK( TORRENT_LIST_CTRL, TorrentListCtrl::OnSort )
|
||||
EVT_LIST_ITEM_SELECTED( TORRENT_LIST_CTRL, TorrentListCtrl::OnItemSelected )
|
||||
EVT_LIST_ITEM_DESELECTED( TORRENT_LIST_CTRL, TorrentListCtrl::OnItemDeselected )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
|
||||
TorrentListCtrl :: TorrentListCtrl( tr_session * handle,
|
||||
wxConfig * config,
|
||||
wxWindow * parent,
|
||||
const wxPoint & pos,
|
||||
const wxSize & size):
|
||||
wxListCtrl( parent, TORRENT_LIST_CTRL, pos, size, wxLC_REPORT|wxLC_HRULES ),
|
||||
myHandle( handle ),
|
||||
myConfig( config )
|
||||
{
|
||||
wxString sortColStr;
|
||||
myConfig->Read( _T("torrent-sort-column"), &sortColStr, columnKeys[COL_NAME] );
|
||||
prevSortCol = getTorrentColumn( sortColStr );
|
||||
bool descending;
|
||||
myConfig->Read( _T("torrent-sort-is-descending"), &descending, FALSE );
|
||||
if( descending )
|
||||
prevSortCol = -prevSortCol;
|
||||
Rebuild ();
|
||||
}
|
||||
|
||||
TorrentListCtrl :: ~TorrentListCtrl()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
TorrentListCtrl :: SetCell( int item, int column, const wxString& xstr )
|
||||
{
|
||||
wxListItem i;
|
||||
i.SetId( item );
|
||||
i.SetColumn( column );
|
||||
i.SetMask( wxLIST_MASK_TEXT );
|
||||
GetItem( i );
|
||||
if( i.GetText() != xstr )
|
||||
SetItem( item, column, xstr );
|
||||
}
|
||||
|
||||
void
|
||||
TorrentListCtrl :: RefreshTorrent( tr_torrent * tor,
|
||||
int myTorrents_index,
|
||||
const int_v & cols )
|
||||
{
|
||||
int row = -1;
|
||||
int col = 0;
|
||||
char buf[512];
|
||||
std::string str;
|
||||
const tr_stat * s = getStat( tor );
|
||||
const tr_info * info = tr_torrentInfo( tor );
|
||||
|
||||
for( int_v::const_iterator it(cols.begin()), end(cols.end()); it!=end; ++it )
|
||||
{
|
||||
wxString xstr;
|
||||
|
||||
switch( *it )
|
||||
{
|
||||
case COL_POSITION:
|
||||
tr_snprintf( buf, sizeof(buf), "%d", 666 );
|
||||
xstr = toWxStr( buf );
|
||||
break;
|
||||
|
||||
case COL_PERCENT_DONE:
|
||||
tr_snprintf( buf, sizeof(buf), "%d%%", (int)(s->percentDone*100.0) );
|
||||
xstr = toWxStr( buf );
|
||||
break;
|
||||
|
||||
case COL_DOWNLOAD_SPEED:
|
||||
if( s->pieceDownloadSpeed > 0.01 )
|
||||
xstr = getReadableSpeed( s->pieceDownloadSpeed );
|
||||
else
|
||||
xstr.Clear( );
|
||||
break;
|
||||
|
||||
case COL_ETA:
|
||||
if( (int)(s->percentDone*100) >= 100 )
|
||||
xstr.Clear ();
|
||||
else if( s->eta < 0 )
|
||||
xstr = toWxStr( "\xE2\x88\x9E" ); /* infinity, in utf-8 */
|
||||
else
|
||||
xstr = getReadableTime( s->eta );
|
||||
break;
|
||||
|
||||
case COL_HASH:
|
||||
xstr = toWxStr( info->hashString );
|
||||
break;
|
||||
|
||||
case COL_NAME:
|
||||
xstr = toWxStr( info->name );
|
||||
break;
|
||||
|
||||
case COL_PEERS:
|
||||
xstr = wxString::Format( _("%d (%d)"), s->peersConnected, s->leechers );
|
||||
break;
|
||||
|
||||
case COL_RATIO:
|
||||
xstr = wxString::Format( _T("%%%d"), (int)(s->uploadedEver / (double)s->downloadedEver) );
|
||||
break;
|
||||
|
||||
case COL_RECEIVED:
|
||||
xstr = getReadableSize( s->downloadedEver );
|
||||
break;
|
||||
|
||||
case COL_REMAINING:
|
||||
xstr = getReadableSize( s->leftUntilDone );
|
||||
break;
|
||||
|
||||
case COL_SEEDS:
|
||||
if( s->seeders > 0 )
|
||||
xstr = wxString::Format( _T("%d"), s->seeders );
|
||||
else
|
||||
xstr.Clear ();
|
||||
break;
|
||||
|
||||
case COL_SENT:
|
||||
xstr = getReadableSize( s->uploadedEver );
|
||||
break;
|
||||
|
||||
case COL_SIZE:
|
||||
xstr = getReadableSize( info->totalSize );
|
||||
break;
|
||||
|
||||
case COL_STATE: /* FIXME: divine the meaning of these two columns */
|
||||
case COL_STATUS:
|
||||
switch( s->activity ) {
|
||||
case TR_STATUS_STOPPED: xstr = _("Stopped"); break;
|
||||
case TR_STATUS_CHECK: xstr = wxString::Format ( _("Checking Files (%.0f)"), s->recheckProgress ); break;
|
||||
case TR_STATUS_CHECK_WAIT: xstr = _("Waiting to Check"); break;
|
||||
case TR_STATUS_DOWNLOAD: xstr = _("Downloading"); break;
|
||||
case TR_STATUS_SEED: xstr = _("Seeding"); break;
|
||||
default: assert( 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case COL_TOTAL:
|
||||
xstr = _T("Fixme");
|
||||
break;
|
||||
|
||||
case COL_UPLOAD_SPEED:
|
||||
if( s->pieceUploadSpeed > 0.01 )
|
||||
xstr = getReadableSpeed( s->pieceUploadSpeed );
|
||||
else
|
||||
xstr.Clear( );
|
||||
break;
|
||||
|
||||
default:
|
||||
xstr = _T("Fixme");
|
||||
}
|
||||
|
||||
if( col )
|
||||
SetCell( row, col++, xstr );
|
||||
else {
|
||||
// first column... find the right row to put the info in.
|
||||
// if the torrent's in the list already, update that row.
|
||||
// otherwise, add a new row.
|
||||
if( row < 0 ) {
|
||||
str2int_t::const_iterator it = myHashToItem.find( info->hashString );
|
||||
if( it != myHashToItem.end() ) {
|
||||
row = it->second;
|
||||
}
|
||||
}
|
||||
if( row >= 0 ) {
|
||||
SetCell( row, col++, xstr );
|
||||
}
|
||||
else {
|
||||
row = InsertItem( GetItemCount(), xstr );
|
||||
col = 1;
|
||||
myHashToItem[info->hashString] = row;
|
||||
SetItemData( row, myTorrents_index );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
void
|
||||
TorrentListCtrl :: OnSort( wxListEvent& event )
|
||||
{
|
||||
const int_v cols = getTorrentColumns( myConfig );
|
||||
const int key = cols[ event.GetColumn() ];
|
||||
Sort( key );
|
||||
}
|
||||
|
||||
void
|
||||
TorrentListCtrl :: OnItemSelected( wxListEvent& WXUNUSED(event) )
|
||||
{
|
||||
std::set<tr_torrent*> sel;
|
||||
long item = -1;
|
||||
for ( ;; ) {
|
||||
item = GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
||||
if ( item == -1 )
|
||||
break;
|
||||
sel.insert( myTorrents[GetItemData(item)] );
|
||||
}
|
||||
fire_selection_changed( sel );
|
||||
}
|
||||
|
||||
void
|
||||
TorrentListCtrl :: OnItemDeselected( wxListEvent& event )
|
||||
{
|
||||
OnItemSelected( event );
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
static TorrentListCtrl * uglyHack = NULL;
|
||||
|
||||
int wxCALLBACK
|
||||
TorrentListCtrl :: Compare( long item1, long item2, long sortData )
|
||||
{
|
||||
TorrentListCtrl * self = uglyHack;
|
||||
tr_torrent * a = self->myTorrents[item1];
|
||||
tr_torrent * b = self->myTorrents[item2];
|
||||
const tr_info* ia = tr_torrentInfo( a );
|
||||
const tr_info* ib = tr_torrentInfo( b );
|
||||
const tr_stat* sa = self->getStat( a );
|
||||
const tr_stat* sb = self->getStat( b );
|
||||
int ret = 0;
|
||||
|
||||
switch( abs(sortData) )
|
||||
{
|
||||
case COL_POSITION:
|
||||
ret = item1 - item2;
|
||||
break;
|
||||
|
||||
case COL_PERCENT_DONE:
|
||||
if( sa->percentDone < sb->percentDone )
|
||||
ret = -1;
|
||||
else if( sa->percentDone > sb->percentDone )
|
||||
ret = 1;
|
||||
else
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
case COL_DOWNLOAD_SPEED:
|
||||
if( sa->pieceDownloadSpeed < sb->pieceDownloadSpeed )
|
||||
ret = -1;
|
||||
else if( sa->pieceDownloadSpeed > sb->pieceDownloadSpeed )
|
||||
ret = 1;
|
||||
else
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
case COL_ETA:
|
||||
ret = sa->eta - sb->eta;
|
||||
break;
|
||||
|
||||
case COL_HASH:
|
||||
ret = strcmp( ia->hashString, ib->hashString );
|
||||
break;
|
||||
|
||||
case COL_NAME:
|
||||
ret = strcmp( ia->name, ib->name );
|
||||
break;
|
||||
|
||||
case COL_PEERS:
|
||||
/* FIXME: this is all peers, not just leechers
|
||||
tr_snprintf( buf, sizeof(buf), "%d (%d)", s->peersTotal, s->peersConnected );
|
||||
xstr = toWxStr( buf );*/
|
||||
break;
|
||||
|
||||
case COL_RATIO: {
|
||||
const double ra = sa->uploadedEver / (double)(sa->downloadedEver + 0.01);
|
||||
const double rb = sb->uploadedEver / (double)(sb->downloadedEver + 0.01);
|
||||
if( ra < rb )
|
||||
ret = -1;
|
||||
else if( ra > rb )
|
||||
ret = 1;
|
||||
else
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case COL_RECEIVED:
|
||||
if( sa->downloadedEver < sb->downloadedEver )
|
||||
ret = -1;
|
||||
else if( sa->downloadedEver > sb->downloadedEver )
|
||||
ret = 1;
|
||||
else
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
case COL_REMAINING:
|
||||
if( sa->leftUntilDone < sb->leftUntilDone )
|
||||
ret = -1;
|
||||
else if( sa->leftUntilDone > sb->leftUntilDone )
|
||||
ret = 1;
|
||||
else
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
case COL_SEEDS:
|
||||
/*tr_snprintf( buf, sizeof(buf), "%d", s->seeders );
|
||||
xstr = toWxStr( buf );*/
|
||||
break;
|
||||
|
||||
case COL_SENT:
|
||||
if( sa->uploadedEver < sb->uploadedEver )
|
||||
ret = -1;
|
||||
else if( sa->uploadedEver > sb->uploadedEver )
|
||||
ret = 1;
|
||||
else
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
case COL_SIZE:
|
||||
if( ia->totalSize < ib->totalSize ) ret = -1;
|
||||
else if( ia->totalSize > ib->totalSize ) ret = 1;
|
||||
else ret = 0;
|
||||
break;
|
||||
|
||||
case COL_STATE: /* FIXME */
|
||||
case COL_STATUS:
|
||||
ret = sa->activity - sb->activity;
|
||||
break;
|
||||
|
||||
case COL_TOTAL:
|
||||
/*xstr = _T("Fixme");*/
|
||||
break;
|
||||
|
||||
case COL_UPLOAD_SPEED:
|
||||
if( sa->pieceUploadSpeed < sb->pieceUploadSpeed )
|
||||
ret = -1;
|
||||
else if( sa->pieceUploadSpeed > sb->pieceUploadSpeed )
|
||||
ret = 1;
|
||||
else
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
||||
if( sortData < 0 )
|
||||
ret = -ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
TorrentListCtrl :: Sort( int column )
|
||||
{
|
||||
if( column == prevSortCol )
|
||||
column = -column;
|
||||
prevSortCol = column;
|
||||
Resort ();
|
||||
}
|
||||
|
||||
bool
|
||||
TorrentListCtrl :: IsSorted( ) const
|
||||
{
|
||||
bool is_sorted = true;
|
||||
long prevItem=-1, curItem=-1;
|
||||
|
||||
uglyHack = const_cast<TorrentListCtrl*>(this);
|
||||
while( is_sorted )
|
||||
{
|
||||
prevItem = curItem;
|
||||
curItem = GetNextItem( curItem, wxLIST_NEXT_ALL, wxLIST_STATE_DONTCARE );
|
||||
if ( curItem == -1 )
|
||||
break;
|
||||
if( prevItem>=0 && curItem>=0 )
|
||||
if( Compare( prevItem, curItem, prevSortCol ) > 0 )
|
||||
is_sorted = false;
|
||||
}
|
||||
uglyHack = 0;
|
||||
|
||||
return is_sorted;
|
||||
}
|
||||
|
||||
void
|
||||
TorrentListCtrl :: Resort( )
|
||||
{
|
||||
myConfig->Write( _T("torrent-sort-column"), columnKeys[abs(prevSortCol)] );
|
||||
myConfig->Write( _T("torrent-sort-is-descending"), prevSortCol < 0 );
|
||||
|
||||
if( !IsSorted ( ) )
|
||||
{
|
||||
uglyHack = this;
|
||||
SortItems( Compare, prevSortCol );
|
||||
|
||||
const int n = GetItemCount ();
|
||||
str2int_t tmp;
|
||||
for( int i=0; i<n; ++i ) {
|
||||
int idx = GetItemData( i );
|
||||
const tr_info * info = tr_torrentInfo( myTorrents[idx] );
|
||||
tmp[info->hashString] = i;
|
||||
}
|
||||
myHashToItem.swap( tmp );
|
||||
uglyHack = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
void
|
||||
TorrentListCtrl :: Refresh ()
|
||||
{
|
||||
const int_v cols = getTorrentColumns( myConfig );
|
||||
const int rowCount = GetItemCount();
|
||||
for( int row=0; row<rowCount; ++row )
|
||||
{
|
||||
int array_index = GetItemData( row );
|
||||
tr_torrent * tor = myTorrents[array_index];
|
||||
RefreshTorrent( tor, array_index, cols );
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TorrentListCtrl :: Repopulate ()
|
||||
{
|
||||
DeleteAllItems();
|
||||
myHashToItem.clear ();
|
||||
|
||||
const int_v cols = getTorrentColumns( myConfig );
|
||||
int i = 0;
|
||||
for( torrents_t::const_iterator it(myTorrents.begin()),
|
||||
end(myTorrents.end()); it!=end; ++it )
|
||||
RefreshTorrent( *it, i++, cols );
|
||||
|
||||
Resort( );
|
||||
}
|
||||
|
||||
void
|
||||
TorrentListCtrl :: Rebuild()
|
||||
{
|
||||
ClearAll( );
|
||||
myHashToItem.clear ();
|
||||
|
||||
int i = 0;
|
||||
const int_v cols = getTorrentColumns( myConfig );
|
||||
for( int_v ::const_iterator it(cols.begin()), end(cols.end()); it!=end; ++it )
|
||||
{
|
||||
int format = wxLIST_FORMAT_LEFT;
|
||||
int width = -1;
|
||||
wxString h;
|
||||
|
||||
switch( *it )
|
||||
{
|
||||
case COL_POSITION: h = _("#"); format = wxLIST_FORMAT_CENTRE; break;
|
||||
case COL_PERCENT_DONE: h = _("Done"); width = 50; format = wxLIST_FORMAT_RIGHT; break;
|
||||
case COL_DOWNLOAD_SPEED: h = _("Down"); width = 80; format = wxLIST_FORMAT_RIGHT; break;
|
||||
case COL_ETA: h = _("ETA"); format = wxLIST_FORMAT_RIGHT; break;
|
||||
case COL_HASH: h = _("Checksum"); break;
|
||||
case COL_NAME: h = _("Name"); width = 500; break;
|
||||
case COL_PEERS: h = _("Peers"); format = wxLIST_FORMAT_RIGHT; break;
|
||||
case COL_RATIO: h = _("Ratio"); format = wxLIST_FORMAT_RIGHT; break;
|
||||
case COL_RECEIVED: h = _("Received"); format = wxLIST_FORMAT_RIGHT; break;
|
||||
case COL_REMAINING: h = _("Remaining"); format = wxLIST_FORMAT_RIGHT; break;
|
||||
case COL_SEEDS: h = _("Seeds"); format = wxLIST_FORMAT_RIGHT; break;
|
||||
case COL_SENT: h = _("Sent"); format = wxLIST_FORMAT_RIGHT; break;
|
||||
case COL_SIZE: h = _("Size"); format = wxLIST_FORMAT_RIGHT; break;
|
||||
case COL_STATE: h = _("State"); width = 120; break;
|
||||
case COL_STATUS: h = _("Status"); width = 120; break;
|
||||
case COL_TOTAL: h = _("Total"); break;
|
||||
case COL_UPLOAD_SPEED: h = _("Up"); width = 80; format = wxLIST_FORMAT_RIGHT;break;
|
||||
default: h = _("Error"); break;
|
||||
}
|
||||
|
||||
InsertColumn( i++, h, format, width );
|
||||
}
|
||||
|
||||
Repopulate( );
|
||||
}
|
||||
|
||||
typedef std::set<tr_torrent*> torrent_set;
|
||||
|
||||
void
|
||||
TorrentListCtrl :: Assign( const torrents_t& torrents )
|
||||
{
|
||||
torrent_set prev, cur, removed;
|
||||
torrents_v added;
|
||||
prev.insert( myTorrents.begin(), myTorrents.end() );
|
||||
cur.insert( torrents.begin(), torrents.end() );
|
||||
std::set_difference (prev.begin(), prev.end(),
|
||||
cur.begin(), cur.end(), inserter(removed, removed.begin()));
|
||||
std::set_difference (cur.begin(), cur.end(),
|
||||
prev.begin(), prev.end(), inserter(added, added.begin()));
|
||||
Remove( removed );
|
||||
Add( added );
|
||||
Refresh( );
|
||||
Resort( );
|
||||
}
|
||||
|
||||
void
|
||||
TorrentListCtrl :: Add( const torrents_v& add )
|
||||
{
|
||||
const int_v cols = getTorrentColumns( myConfig );
|
||||
int i = myTorrents.size();
|
||||
myTorrents.insert( myTorrents.end(), add.begin(), add.end() );
|
||||
for( torrents_v::const_iterator it(add.begin()), end(add.end()); it!=end; ++it )
|
||||
RefreshTorrent( *it, i++, cols );
|
||||
}
|
||||
|
||||
void
|
||||
TorrentListCtrl :: Remove( const torrent_set& remove )
|
||||
{
|
||||
torrents_v vtmp;
|
||||
str2int_t htmp;
|
||||
|
||||
for( int item=0; item<GetItemCount(); )
|
||||
{
|
||||
tr_torrent * tor = myTorrents[GetItemData(item)];
|
||||
const tr_info * info = tr_torrentInfo( tor );
|
||||
|
||||
if( remove.count( tor ) )
|
||||
{
|
||||
DeleteItem( item );
|
||||
continue;
|
||||
}
|
||||
|
||||
vtmp.push_back( tor );
|
||||
SetItemData( item, vtmp.size()-1 );
|
||||
htmp[ info->hashString ] = item;
|
||||
++item;
|
||||
}
|
||||
|
||||
myHashToItem.swap( htmp );
|
||||
myTorrents.swap( vtmp );
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
const tr_stat*
|
||||
TorrentListCtrl :: getStat( tr_torrent * tor )
|
||||
{
|
||||
const tr_info * info = tr_torrentInfo( tor );
|
||||
const time_t now = time( 0 );
|
||||
TorStat& ts = myHashToStat[ info->hashString ];
|
||||
if( ts.time < now ) {
|
||||
ts.time = now;
|
||||
ts.stat = tr_torrentStat( tor );
|
||||
}
|
||||
return ts.stat;
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
void
|
||||
TorrentListCtrl :: SelectAll( )
|
||||
{
|
||||
for( int i=0, n=GetItemCount(); i<n; ++i )
|
||||
SetItemState( i, ~0, wxLIST_STATE_SELECTED );
|
||||
}
|
||||
|
||||
void
|
||||
TorrentListCtrl :: DeselectAll( )
|
||||
{
|
||||
for( int i=0, n=GetItemCount(); i<n; ++i )
|
||||
SetItemState( i, 0, wxLIST_STATE_SELECTED );
|
||||
}
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
/*
|
||||
* Xmission - a cross-platform bittorrent client
|
||||
* Copyright (C) 2007 Charles Kerr <charles@transmissionbt.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __XMISSION_TORRENT_LIST_H__
|
||||
#define __XMISSION_TORRENT_LIST_H__
|
||||
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/config.h>
|
||||
#include <libtransmission/transmission.h>
|
||||
|
||||
class TorrentListCtrl: public wxListCtrl
|
||||
{
|
||||
public:
|
||||
TorrentListCtrl( tr_session * handle,
|
||||
wxConfig * config,
|
||||
wxWindow * parent,
|
||||
const wxPoint & pos = wxDefaultPosition,
|
||||
const wxSize & size = wxDefaultSize );
|
||||
virtual ~TorrentListCtrl();
|
||||
|
||||
public:
|
||||
|
||||
enum ShowMode
|
||||
{
|
||||
SHOW_ALL,
|
||||
SHOW_DOWNLOADING,
|
||||
SHOW_UPLOADING,
|
||||
SHOW_COMPLETE,
|
||||
SHOW_INCOMPLETE,
|
||||
SHOW_ACTIVE,
|
||||
SHOW_INACTIVE,
|
||||
N_FILTERS
|
||||
};
|
||||
|
||||
void SetShowMode( ShowMode );
|
||||
|
||||
int GetShowModeCounts( ShowMode ) const;
|
||||
|
||||
public:
|
||||
|
||||
struct Listener
|
||||
{
|
||||
Listener() {}
|
||||
|
||||
virtual ~Listener() {}
|
||||
|
||||
virtual void OnTorrentListSelectionChanged(
|
||||
TorrentListCtrl*,
|
||||
const std::set<tr_torrent*>& ) = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
typedef std::set<Listener*> listeners_t;
|
||||
listeners_t myListeners;
|
||||
void fire_selection_changed( const std::set<tr_torrent*>& t ) {
|
||||
for( listeners_t::iterator it(myListeners.begin()), end(myListeners.end()); it!=end; )
|
||||
(*it++)->OnTorrentListSelectionChanged( this, t );
|
||||
}
|
||||
public:
|
||||
void AddListener( Listener* l ) { myListeners.insert(l); }
|
||||
void RemoveListener( Listener* l ) { myListeners.erase(l); }
|
||||
|
||||
public:
|
||||
void Rebuild ();
|
||||
void Repopulate ();
|
||||
void Refresh ();
|
||||
void SelectAll ();
|
||||
void DeselectAll ();
|
||||
|
||||
public:
|
||||
typedef std::vector<tr_torrent*> torrents_v;
|
||||
void Assign( const torrents_v& torrents );
|
||||
|
||||
private:
|
||||
void Add( const torrents_v& torrents );
|
||||
void Sort( int column );
|
||||
void Resort( );
|
||||
void RefreshTorrent( tr_torrent*, int, const std::vector<int>& );
|
||||
void Remove( const std::set<tr_torrent*>& );
|
||||
static int wxCALLBACK Compare( long, long, long );
|
||||
|
||||
/** torrent hash -> the torrent's row in myTorrentList */
|
||||
typedef std::map<std::string,int> str2int_t;
|
||||
str2int_t myHashToItem;
|
||||
|
||||
private:
|
||||
void SetCell( int item, int col, const wxString& xstr );
|
||||
|
||||
private:
|
||||
struct TorStat {
|
||||
time_t time;
|
||||
const tr_stat * stat;
|
||||
TorStat(): time(0), stat(0) {}
|
||||
};
|
||||
typedef std::map<std::string,TorStat> hash2stat_t;
|
||||
hash2stat_t myHashToStat;
|
||||
const tr_stat* getStat( tr_torrent* );
|
||||
|
||||
private:
|
||||
void OnSort( wxListEvent& );
|
||||
void OnItemSelected( wxListEvent& );
|
||||
void OnItemDeselected( wxListEvent& );
|
||||
bool IsSorted( ) const;
|
||||
|
||||
private:
|
||||
tr_session * myHandle;
|
||||
wxConfig * myConfig;
|
||||
torrents_v myTorrents;
|
||||
int prevSortCol;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* Xmission - a cross-platform bittorrent client
|
||||
* Copyright (C) 2007 Charles Kerr <charles@transmissionbt.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/intl.h>
|
||||
#include "torrent-stats.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(TorrentStats, wxPanel)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
namespace
|
||||
{
|
||||
enum
|
||||
{
|
||||
STAT_TIME_ELAPSED,
|
||||
STAT_DOWNLOADED,
|
||||
STAT_UPLOADED,
|
||||
STAT_SHARE_RATIO,
|
||||
STAT_SEEDS,
|
||||
STAT_REMAINING,
|
||||
STAT_DOWNLOAD_SPEED,
|
||||
STAT_DOWNLOAD_SPEED_LIMIT,
|
||||
STAT_UPLOAD_SPEED,
|
||||
STAT_UPLOAD_SPEED_LIMIT,
|
||||
N_STATS
|
||||
};
|
||||
|
||||
wxString getLabelText( int n )
|
||||
{
|
||||
wxString xstr;
|
||||
|
||||
switch( n )
|
||||
{
|
||||
case STAT_TIME_ELAPSED: xstr = _("Time Elapsed"); break;
|
||||
case STAT_DOWNLOADED: xstr = _("Downloaded"); break;
|
||||
case STAT_UPLOADED: xstr = _("Uploaded"); break;
|
||||
case STAT_SHARE_RATIO: xstr = _("Share Ratio"); break;
|
||||
case STAT_SEEDS: xstr = _("Seeds"); break;
|
||||
case STAT_REMAINING: xstr = _("Time Remaining"); break;
|
||||
case STAT_DOWNLOAD_SPEED: xstr = _("Download Speed"); break;
|
||||
case STAT_DOWNLOAD_SPEED_LIMIT: xstr = _("Download Speed Limit"); break;
|
||||
case STAT_UPLOAD_SPEED: xstr = _("Upload Speed"); break;
|
||||
case STAT_UPLOAD_SPEED_LIMIT: xstr = _("Upload Speed Limit"); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
return xstr;
|
||||
}
|
||||
}
|
||||
|
||||
TorrentStats :: TorrentStats( wxWindow * parent,
|
||||
wxWindowID id,
|
||||
const wxPoint & pos,
|
||||
const wxSize & size,
|
||||
long style,
|
||||
const wxString & name ):
|
||||
wxPanel( parent, id, pos, size, style, name )
|
||||
{
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Xmission - a cross-platform bittorrent client
|
||||
* Copyright (C) 2007 Charles Kerr <charles@transmissionbt.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __XMISSION_TORRENT_STATS_H__
|
||||
#define __XMISSION_TORRENT_STATS_H__
|
||||
|
||||
#include <wx/panel.h>
|
||||
|
||||
class TorrentStats: public wxPanel
|
||||
{
|
||||
public:
|
||||
|
||||
TorrentStats( wxWindow * parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL,
|
||||
const wxString& name = _T("panel"));
|
||||
|
||||
virtual ~TorrentStats() {}
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
743
wx/xmission.cc
743
wx/xmission.cc
|
@ -1,743 +0,0 @@
|
|||
/*
|
||||
* Xmission - a cross-platform bittorrent client
|
||||
* Copyright (C) 2007 Charles Kerr <charles@transmissionbt.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/cmdline.h>
|
||||
#include <wx/config.h>
|
||||
#include <wx/dcmemory.h>
|
||||
#include <wx/defs.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/listctrl.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/snglinst.h>
|
||||
#include <wx/splitter.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/taskbar.h>
|
||||
#include <wx/tglbtn.h>
|
||||
#include <wx/toolbar.h>
|
||||
#include <wx/wx.h>
|
||||
#if wxCHECK_VERSION(2,8,0)
|
||||
#include <wx/aboutdlg.h>
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/utils.h>
|
||||
#include <libtransmission/bencode.h>
|
||||
|
||||
#include <images/play.xpm>
|
||||
#include <images/stop.xpm>
|
||||
#include <images/plus.xpm>
|
||||
#include <images/minus.xpm>
|
||||
|
||||
#include <images/systray.xpm>
|
||||
#include <images/transmission.xpm>
|
||||
}
|
||||
|
||||
#include "foreach.h"
|
||||
#include "speed-stats.h"
|
||||
#include "filter.h"
|
||||
#include "torrent-list.h"
|
||||
#include "torrent-stats.h"
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
namespace
|
||||
{
|
||||
int bestDecimal( double num ) {
|
||||
if ( num < 10 ) return 2;
|
||||
if ( num < 100 ) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
wxString toWxStr( const char * s )
|
||||
{
|
||||
return wxString( s, wxConvUTF8 );
|
||||
}
|
||||
|
||||
std::string toStr( const wxString& xstr )
|
||||
{
|
||||
return std::string( xstr.mb_str( *wxConvCurrent ) );
|
||||
}
|
||||
|
||||
wxString getReadableSize( uint64_t size )
|
||||
{
|
||||
int i;
|
||||
static const char *sizestrs[] = { "B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB" };
|
||||
for ( i=0; size>>10; ++i ) size = size>>10;
|
||||
char buf[512];
|
||||
snprintf( buf, sizeof(buf), "%.*f %s", bestDecimal(size), (double)size, sizestrs[i] );
|
||||
return toWxStr( buf );
|
||||
}
|
||||
|
||||
wxString getReadableSize( float f )
|
||||
{
|
||||
return getReadableSize( (uint64_t)f );
|
||||
}
|
||||
|
||||
wxString getReadableSpeed( float kib_sec )
|
||||
{
|
||||
wxString xstr = getReadableSize(1024*kib_sec);
|
||||
xstr += _T("/s");
|
||||
return xstr;
|
||||
}
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
const wxCmdLineEntryDesc cmdLineDesc[] =
|
||||
{
|
||||
{ wxCMD_LINE_SWITCH, _T("p"), _("pause"), _("pauses all the torrents on startup"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
|
||||
{ wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_STRING, 0 }
|
||||
};
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
class MyApp : public wxApp
|
||||
{
|
||||
virtual bool OnInit();
|
||||
virtual ~MyApp();
|
||||
wxSingleInstanceChecker * myChecker;
|
||||
};
|
||||
|
||||
namespace
|
||||
{
|
||||
tr_session * handle = NULL;
|
||||
|
||||
typedef std::vector<tr_torrent*> torrents_v;
|
||||
}
|
||||
|
||||
class MyFrame : public wxFrame, public TorrentListCtrl::Listener
|
||||
{
|
||||
public:
|
||||
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, bool paused);
|
||||
virtual ~MyFrame();
|
||||
|
||||
public:
|
||||
void OnExit( wxCommandEvent& );
|
||||
void OnAbout( wxCommandEvent& );
|
||||
void OnOpen( wxCommandEvent& );
|
||||
|
||||
void OnStart( wxCommandEvent& );
|
||||
void OnStartUpdate( wxUpdateUIEvent& );
|
||||
|
||||
void OnStop( wxCommandEvent& );
|
||||
void OnStopUpdate( wxUpdateUIEvent& );
|
||||
|
||||
void OnRemove( wxCommandEvent& );
|
||||
void OnRemoveUpdate( wxUpdateUIEvent& );
|
||||
|
||||
void OnRecheck( wxCommandEvent& );
|
||||
void OnRecheckUpdate( wxUpdateUIEvent& );
|
||||
|
||||
void OnSelectAll( wxCommandEvent& );
|
||||
void OnSelectAllUpdate( wxUpdateUIEvent& );
|
||||
void OnDeselectAll( wxCommandEvent& );
|
||||
void OnDeselectAllUpdate( wxUpdateUIEvent& );
|
||||
|
||||
void OnFilterChanged( wxCommandEvent& );
|
||||
|
||||
void OnPulse( wxTimerEvent& );
|
||||
|
||||
virtual void OnTorrentListSelectionChanged( TorrentListCtrl*, const std::set<tr_torrent*>& );
|
||||
|
||||
private:
|
||||
void RefreshFilterCounts( );
|
||||
void ApplyCurrentFilter( );
|
||||
|
||||
protected:
|
||||
wxConfig * myConfig;
|
||||
wxTimer myPulseTimer;
|
||||
|
||||
private:
|
||||
TorrentListCtrl * myTorrentList;
|
||||
TorrentStats * myTorrentStats;
|
||||
wxListCtrl * myFilters;
|
||||
wxTaskBarIcon * myTrayIcon;
|
||||
wxIcon myLogoIcon;
|
||||
wxIcon myTrayIconIcon;
|
||||
SpeedStats * mySpeedStats;
|
||||
torrents_v myTorrents;
|
||||
torrents_v mySelectedTorrents;
|
||||
int myFilter;
|
||||
std::string mySavePath;
|
||||
time_t myExitTime;
|
||||
wxToggleButton* myFilterButtons[TorrentFilter::N_FILTERS];
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ID_START,
|
||||
ID_DESELECTALL,
|
||||
ID_EDIT_PREFS,
|
||||
ID_SHOW_DEBUG_WINDOW,
|
||||
ID_Pulse,
|
||||
ID_Filter
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_COMMAND_RANGE( ID_Filter, ID_Filter+TorrentFilter::N_FILTERS, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, MyFrame::OnFilterChanged )
|
||||
EVT_MENU ( wxID_ABOUT, MyFrame::OnAbout )
|
||||
EVT_TIMER ( ID_Pulse, MyFrame::OnPulse )
|
||||
EVT_MENU ( wxID_EXIT, MyFrame::OnExit )
|
||||
EVT_MENU ( wxID_OPEN, MyFrame::OnOpen )
|
||||
EVT_MENU ( ID_START, MyFrame::OnStart )
|
||||
EVT_UPDATE_UI( ID_START, MyFrame::OnStartUpdate )
|
||||
EVT_MENU ( wxID_STOP, MyFrame::OnStop )
|
||||
EVT_UPDATE_UI( wxID_STOP, MyFrame::OnStopUpdate )
|
||||
EVT_MENU ( wxID_REFRESH, MyFrame::OnRecheck )
|
||||
EVT_UPDATE_UI( wxID_REFRESH, MyFrame::OnRecheckUpdate )
|
||||
EVT_MENU ( wxID_REMOVE, MyFrame::OnRemove )
|
||||
EVT_UPDATE_UI( wxID_REMOVE, MyFrame::OnRemoveUpdate )
|
||||
EVT_MENU ( wxID_SELECTALL, MyFrame::OnSelectAll )
|
||||
EVT_UPDATE_UI( wxID_SELECTALL, MyFrame::OnSelectAllUpdate )
|
||||
EVT_MENU ( ID_DESELECTALL, MyFrame::OnDeselectAll )
|
||||
EVT_UPDATE_UI( ID_DESELECTALL, MyFrame::OnDeselectAllUpdate )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_APP(MyApp)
|
||||
|
||||
|
||||
void
|
||||
MyFrame :: OnFilterChanged( wxCommandEvent& e )
|
||||
{
|
||||
static bool ignore = false;
|
||||
|
||||
if( !ignore )
|
||||
{
|
||||
myFilter = e.GetId() - ID_Filter;
|
||||
std::cerr << " OnFilterChanged, myFilter is now " << myFilter << std::endl;
|
||||
ApplyCurrentFilter ( );
|
||||
|
||||
ignore = true;
|
||||
for( int i=0; i<TorrentFilter::N_FILTERS; ++i )
|
||||
myFilterButtons[i]->SetValue( i==myFilter );
|
||||
ignore = false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MyFrame :: OnSelectAll( wxCommandEvent& )
|
||||
{
|
||||
myTorrentList->SelectAll( );
|
||||
}
|
||||
|
||||
void
|
||||
MyFrame :: OnSelectAllUpdate( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Enable( mySelectedTorrents.size() < myTorrents.size() );
|
||||
}
|
||||
|
||||
void
|
||||
MyFrame :: OnDeselectAll( wxCommandEvent& )
|
||||
{
|
||||
myTorrentList->DeselectAll ( );
|
||||
}
|
||||
|
||||
void
|
||||
MyFrame :: OnDeselectAllUpdate( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Enable( !mySelectedTorrents.empty() );
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
void
|
||||
MyFrame :: OnStartUpdate( wxUpdateUIEvent& event )
|
||||
{
|
||||
bool enable = false;
|
||||
foreach( torrents_v, mySelectedTorrents, it )
|
||||
if( tr_torrentStatCached(*it)->activity == TR_STATUS_STOPPED )
|
||||
enable = true;
|
||||
event.Enable( enable );
|
||||
}
|
||||
void
|
||||
MyFrame :: OnStart( wxCommandEvent& WXUNUSED(unused) )
|
||||
{
|
||||
foreach( torrents_v, mySelectedTorrents, it )
|
||||
if( tr_torrentStatCached(*it)->activity == TR_STATUS_STOPPED )
|
||||
tr_torrentStart( *it );
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
void
|
||||
MyFrame :: OnStopUpdate( wxUpdateUIEvent& event )
|
||||
{
|
||||
bool enable = false;
|
||||
foreach( torrents_v, mySelectedTorrents, it )
|
||||
if( tr_torrentStatCached(*it)->activity != TR_STATUS_STOPPED )
|
||||
enable = true;
|
||||
event.Enable( enable );
|
||||
}
|
||||
void
|
||||
MyFrame :: OnStop( wxCommandEvent& WXUNUSED(unused) )
|
||||
{
|
||||
foreach( torrents_v, mySelectedTorrents, it )
|
||||
if( tr_torrentStat(*it)->activity != TR_STATUS_STOPPED )
|
||||
tr_torrentStop( *it );
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
void
|
||||
MyFrame :: OnRemoveUpdate( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Enable( !mySelectedTorrents.empty() );
|
||||
}
|
||||
void
|
||||
MyFrame :: OnRemove( wxCommandEvent& WXUNUSED(unused) )
|
||||
{
|
||||
foreach( torrents_v, mySelectedTorrents, it )
|
||||
tr_torrentRemove( *it );
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
void
|
||||
MyFrame :: OnRecheckUpdate( wxUpdateUIEvent& event )
|
||||
{
|
||||
event.Enable( !mySelectedTorrents.empty() );
|
||||
}
|
||||
void
|
||||
MyFrame :: OnRecheck( wxCommandEvent& WXUNUSED(unused) )
|
||||
{
|
||||
foreach( torrents_v, mySelectedTorrents, it )
|
||||
tr_torrentVerify( *it );
|
||||
}
|
||||
|
||||
/**
|
||||
**/
|
||||
|
||||
void MyFrame :: OnOpen( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
const wxString key = _T("prev-directory");
|
||||
wxString directory;
|
||||
myConfig->Read( key, &directory );
|
||||
wxFileDialog * w = new wxFileDialog( this, _T("message"),
|
||||
directory,
|
||||
_T(""), /* default file */
|
||||
_T("Torrent files|*.torrent"),
|
||||
wxOPEN|wxMULTIPLE );
|
||||
|
||||
if( w->ShowModal() == wxID_OK )
|
||||
{
|
||||
wxArrayString paths;
|
||||
w->GetPaths( paths );
|
||||
size_t nPaths = paths.GetCount();
|
||||
for( size_t i=0; i<nPaths; ++i )
|
||||
{
|
||||
const std::string filename = toStr( paths[i] );
|
||||
tr_ctor * ctor = tr_ctorNew( handle );
|
||||
tr_ctorSetMetainfoFromFile( ctor, filename.c_str() );
|
||||
tr_ctorSetDownloadDir( ctor, TR_FALLBACK, mySavePath.c_str() );
|
||||
tr_torrent * tor = tr_torrentNew( handle, ctor, NULL );
|
||||
tr_ctorFree( ctor );
|
||||
|
||||
if( tor )
|
||||
myTorrents.push_back( tor );
|
||||
}
|
||||
ApplyCurrentFilter( );
|
||||
|
||||
myConfig->Write( key, w->GetDirectory() );
|
||||
}
|
||||
|
||||
delete w;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
MyApp :: OnInit( )
|
||||
{
|
||||
tr_benc settings;
|
||||
const char * configDir;
|
||||
|
||||
tr_bencInitDict( &settings, 0 );
|
||||
tr_sessionGetDefaultSettings( &settings );
|
||||
configDir = tr_getDefaultConfigDir( "xmission" );
|
||||
|
||||
handle = tr_sessionInit( "wx", configDir, true, &settings );
|
||||
|
||||
tr_bencFree( &settings );
|
||||
|
||||
wxCmdLineParser cmdParser( cmdLineDesc, argc, argv );
|
||||
if( cmdParser.Parse ( ) )
|
||||
return false;
|
||||
|
||||
const wxString name = wxString::Format( _T("Xmission-%s"), wxGetUserId().c_str());
|
||||
myChecker = new wxSingleInstanceChecker( name );
|
||||
if ( myChecker->IsAnotherRunning() ) {
|
||||
wxLogError(_("An instance of Xmission is already running."));
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool paused = cmdParser.Found( _("p") );
|
||||
|
||||
MyFrame * frame = new MyFrame( _("Xmission"),
|
||||
wxPoint(50,50),
|
||||
wxSize(900,600),
|
||||
paused);
|
||||
|
||||
frame->Show( true );
|
||||
SetTopWindow( frame );
|
||||
return true;
|
||||
}
|
||||
|
||||
MyApp :: ~MyApp()
|
||||
{
|
||||
delete myChecker;
|
||||
}
|
||||
|
||||
/***
|
||||
****
|
||||
***/
|
||||
|
||||
void
|
||||
MyFrame :: RefreshFilterCounts( )
|
||||
{
|
||||
int hits[ TorrentFilter :: N_FILTERS ];
|
||||
TorrentFilter::CountHits( myTorrents, hits );
|
||||
for( int i=0; i<TorrentFilter::N_FILTERS; ++i )
|
||||
myFilterButtons[i]->SetLabel( TorrentFilter::GetName( i, hits[i] ) );
|
||||
}
|
||||
|
||||
void
|
||||
MyFrame :: ApplyCurrentFilter( )
|
||||
{
|
||||
torrents_v tmp( myTorrents );
|
||||
TorrentFilter :: RemoveFailures( myFilter, tmp );
|
||||
myTorrentList->Assign( tmp );
|
||||
}
|
||||
|
||||
void
|
||||
MyFrame :: OnTorrentListSelectionChanged( TorrentListCtrl* list,
|
||||
const std::set<tr_torrent*>& torrents )
|
||||
{
|
||||
assert( list == myTorrentList );
|
||||
mySelectedTorrents.assign( torrents.begin(), torrents.end() );
|
||||
|
||||
tr_torrent * tor = mySelectedTorrents.empty() ? NULL : mySelectedTorrents.front();
|
||||
mySpeedStats->SetTorrent( tor );
|
||||
}
|
||||
|
||||
void
|
||||
MyFrame :: OnPulse(wxTimerEvent& WXUNUSED(event) )
|
||||
{
|
||||
if( myExitTime ) {
|
||||
if ( !tr_sessionCountTorrents(handle) || myExitTime<time(0) ) {
|
||||
delete myTrayIcon;
|
||||
myTrayIcon = 0;
|
||||
Destroy( );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
RefreshFilterCounts( );
|
||||
ApplyCurrentFilter( );
|
||||
|
||||
mySpeedStats->Pulse( handle );
|
||||
|
||||
const double up = tr_sessionGetPieceSpeed( handle, TR_UP );
|
||||
const double down = tr_sessionGetPieceSpeed( handle, TR_DOWN );
|
||||
wxString xstr = _("Total DL: ");
|
||||
xstr += getReadableSpeed( down );
|
||||
SetStatusText( xstr, 1 );
|
||||
xstr = _("Total UL: ");
|
||||
xstr += getReadableSpeed( up );
|
||||
SetStatusText( xstr, 2 );
|
||||
|
||||
xstr = _("Download: ");
|
||||
xstr += getReadableSpeed( down );
|
||||
xstr += _T("\n");
|
||||
xstr +=_("Upload: ");
|
||||
xstr += getReadableSpeed( up );
|
||||
myTrayIcon->SetIcon( myTrayIconIcon, xstr );
|
||||
|
||||
myTorrentList->Refresh ( );
|
||||
}
|
||||
|
||||
MyFrame::~MyFrame()
|
||||
{
|
||||
myTorrentList->RemoveListener( this );
|
||||
delete myTorrentList;
|
||||
|
||||
delete myConfig;
|
||||
}
|
||||
|
||||
MyFrame :: MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, bool paused):
|
||||
wxFrame((wxFrame*)NULL,-1,title,pos,size),
|
||||
myConfig( new wxConfig( _T("xmission") ) ),
|
||||
myPulseTimer( this, ID_Pulse ),
|
||||
myLogoIcon( transmission_xpm ),
|
||||
myTrayIconIcon( systray_xpm ),
|
||||
mySpeedStats( 0 ),
|
||||
myFilter( TorrentFilter::ALL ),
|
||||
myExitTime( 0 )
|
||||
{
|
||||
myTrayIcon = new wxTaskBarIcon;
|
||||
SetIcon( myLogoIcon );
|
||||
|
||||
/**
|
||||
*** Prefs
|
||||
**/
|
||||
|
||||
long port;
|
||||
wxString key = _T("port");
|
||||
if( !myConfig->Read( key, &port, atoi( TR_DEFAULT_PEER_PORT_STR ) ) )
|
||||
myConfig->Write( key, port );
|
||||
tr_sessionSetPeerPort( handle, port );
|
||||
|
||||
key = _T("save-path");
|
||||
wxString wxstr;
|
||||
if( !myConfig->Read( key, &wxstr, wxFileName::GetHomeDir() ) )
|
||||
myConfig->Write( key, wxstr );
|
||||
mySavePath = toStr( wxstr );
|
||||
|
||||
const wxString default_colors[SpeedStats::N_COLORS] = {
|
||||
_T("#000000"), // background
|
||||
_T("#32cd32"), // frame
|
||||
_T("#ff0000"), // all up
|
||||
_T("#ff00ff"), // all down
|
||||
_T("#ffff00"), // torrent up
|
||||
_T("#00ff88") // torrent down
|
||||
};
|
||||
wxColor speedColors[SpeedStats::N_COLORS];
|
||||
for( int i=0; i<SpeedStats::N_COLORS; ++i )
|
||||
{
|
||||
key = SpeedStats::GetColorName( i );
|
||||
myConfig->Read( key, &wxstr, _T("") );
|
||||
std::string str = toStr( wxstr );
|
||||
if( (str.size()!=7)
|
||||
|| (str[0]!='#')
|
||||
|| !isxdigit(str[1]) || !isxdigit(str[2])
|
||||
|| !isxdigit(str[3]) || !isxdigit(str[4])
|
||||
|| !isxdigit(str[5]) || !isxdigit(str[6]))
|
||||
{
|
||||
myConfig->Write( key, default_colors[i] );
|
||||
str = toStr( default_colors[i] );
|
||||
}
|
||||
int r, g, b;
|
||||
sscanf( str.c_str()+1, "%02x%02x%02x", &r, &g, &b );
|
||||
speedColors[i].Set( r, g, b );
|
||||
}
|
||||
|
||||
/**
|
||||
*** Menu
|
||||
**/
|
||||
|
||||
wxMenuBar *menuBar = new wxMenuBar;
|
||||
|
||||
wxMenu * m = new wxMenu;
|
||||
m->Append( wxID_OPEN, _T("&Open") );
|
||||
m->Append( ID_START, _T("&Start") );
|
||||
m->Append( wxID_STOP, _T("Sto&p") ) ;
|
||||
m->Append( wxID_REFRESH, _T("Re&check") );
|
||||
m->Append( wxID_REMOVE, _T("&Remove") );
|
||||
m->AppendSeparator();
|
||||
m->Append( wxID_NEW, _T("Create &New Torrent") );
|
||||
m->AppendSeparator();
|
||||
m->Append( wxID_CLOSE, _T("&Close") );
|
||||
m->Append( wxID_EXIT, _T("&Exit") );
|
||||
menuBar->Append( m, _T("&File") );
|
||||
|
||||
m = new wxMenu;
|
||||
m->Append( wxID_SELECTALL, _T("Select &All") );
|
||||
m->Append( ID_DESELECTALL, _T("&Deselect All") );
|
||||
m->AppendSeparator();
|
||||
m->Append( wxID_PREFERENCES, _T("Edit &Preferences") );
|
||||
menuBar->Append( m, _T("&Edit") );
|
||||
|
||||
m = new wxMenu;
|
||||
m->Append( ID_SHOW_DEBUG_WINDOW, _T("Show &Debug Window") );
|
||||
m->AppendSeparator();
|
||||
m->Append( wxID_ABOUT, _T("&About Xmission") );
|
||||
menuBar->Append( m, _T("&Help") );
|
||||
|
||||
SetMenuBar(menuBar);
|
||||
|
||||
/**
|
||||
*** Toolbar
|
||||
**/
|
||||
|
||||
wxIcon open_icon( plus_xpm );
|
||||
wxIcon exec_icon( play_xpm );
|
||||
wxIcon stop_icon( stop_xpm );
|
||||
wxIcon drop_icon( minus_xpm );
|
||||
wxBitmap bitmap;
|
||||
|
||||
wxToolBar* toolbar = CreateToolBar( wxTB_FLAT );
|
||||
toolbar->SetToolBitmapSize( wxSize( 24, 24 ) );
|
||||
bitmap.CopyFromIcon( open_icon );
|
||||
toolbar->AddTool( wxID_OPEN, _T("Open"), bitmap );
|
||||
bitmap.CopyFromIcon( exec_icon );
|
||||
toolbar->AddTool( ID_START, _T("Start"), bitmap );
|
||||
bitmap.CopyFromIcon( stop_icon );
|
||||
toolbar->AddTool( wxID_STOP, _T("Stop"), bitmap );
|
||||
bitmap.CopyFromIcon( drop_icon );
|
||||
toolbar->AddTool( wxID_REMOVE, _T("Remove"), bitmap );
|
||||
toolbar->Realize();
|
||||
|
||||
/**
|
||||
*** Row 1
|
||||
**/
|
||||
|
||||
wxSplitterWindow * hsplit = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH );
|
||||
#if wxCHECK_VERSION(2,5,4)
|
||||
hsplit->SetSashGravity( 0.8 );
|
||||
#endif
|
||||
|
||||
wxPanel * panel_1 = new wxPanel( hsplit, wxID_ANY );
|
||||
|
||||
wxBoxSizer * buttonSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
for( int i=0; i<TorrentFilter::N_FILTERS; ++i ) {
|
||||
wxToggleButton * b = new wxToggleButton( panel_1, ID_Filter+i, TorrentFilter::GetName(i), wxDefaultPosition, wxDefaultSize, (i==0)?wxRB_GROUP:0 );
|
||||
b->SetValue( i==0 );
|
||||
myFilterButtons[i] = b;
|
||||
buttonSizer->Add( b, 1, wxGROW, 0 );
|
||||
}
|
||||
|
||||
myTorrentList = new TorrentListCtrl( handle, myConfig, panel_1 );
|
||||
myTorrentList->AddListener( this );
|
||||
|
||||
wxBoxSizer * panelSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
panelSizer->Add( buttonSizer, 0, wxALL, 5 );
|
||||
panelSizer->Add( myTorrentList, 1, wxGROW|wxALL, 5 );
|
||||
|
||||
panel_1->SetSizer( panelSizer );
|
||||
|
||||
|
||||
wxNotebook * notebook = new wxNotebook( hsplit, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNB_TOP );
|
||||
myTorrentStats = new TorrentStats( notebook );
|
||||
notebook->AddPage( myTorrentStats, _T("General"), false );
|
||||
wxButton * tmp = new wxButton( notebook, wxID_ANY, _T("Hello &World"));
|
||||
notebook->AddPage( tmp, _T("Peers") );
|
||||
tmp = new wxButton( notebook, wxID_ANY, _T("&Hello World"));
|
||||
notebook->AddPage( tmp, _T("Pieces") );
|
||||
tmp = new wxButton( notebook, wxID_ANY, _T("Hello World"));
|
||||
notebook->AddPage( tmp, _T("Files") );
|
||||
mySpeedStats = new SpeedStats( notebook, wxID_ANY );
|
||||
for( int i=0; i<SpeedStats::N_COLORS; ++i )
|
||||
mySpeedStats->SetColor( i, speedColors[i] );
|
||||
notebook->AddPage( mySpeedStats, _T("Speed"), true );
|
||||
tmp = new wxButton( notebook, wxID_ANY, _T("Hello World"));
|
||||
notebook->AddPage( tmp, _T("Logger") );
|
||||
|
||||
hsplit->SplitHorizontally( panel_1, notebook );
|
||||
|
||||
/**
|
||||
*** Statusbar
|
||||
**/
|
||||
|
||||
const int widths[] = { -1, 150, 150 };
|
||||
wxStatusBar * statusBar = CreateStatusBar( WXSIZEOF(widths) );
|
||||
SetStatusWidths( WXSIZEOF(widths), widths );
|
||||
const int styles[] = { wxSB_FLAT, wxSB_NORMAL, wxSB_NORMAL };
|
||||
statusBar->SetStatusStyles( WXSIZEOF(widths), styles );
|
||||
|
||||
/**
|
||||
*** Refresh
|
||||
**/
|
||||
|
||||
myPulseTimer.Start( 500 );
|
||||
|
||||
/**
|
||||
*** Load the torrents
|
||||
**/
|
||||
|
||||
int count = 0;
|
||||
tr_ctor * ctor = tr_ctorNew( handle );
|
||||
tr_ctorSetPaused( ctor, TR_FORCE, paused );
|
||||
tr_ctorSetDownloadDir( ctor, TR_FALLBACK, mySavePath.c_str() );
|
||||
tr_torrent ** torrents = tr_sessionLoadTorrents( handle, ctor, &count );
|
||||
myTorrents.insert( myTorrents.end(), torrents, torrents+count );
|
||||
tr_free( torrents );
|
||||
tr_ctorFree( ctor );
|
||||
|
||||
wxTimerEvent dummy;
|
||||
OnPulse( dummy );
|
||||
}
|
||||
|
||||
void
|
||||
MyFrame :: OnExit( wxCommandEvent& WXUNUSED( event ) )
|
||||
{
|
||||
Enable( false );
|
||||
|
||||
myTorrents.clear( );
|
||||
mySelectedTorrents.clear( );
|
||||
ApplyCurrentFilter( );
|
||||
|
||||
tr_sessionClose( handle );
|
||||
|
||||
/* give the connections a max of 10 seconds to shut themselves down */
|
||||
myExitTime = time(0) + 10;
|
||||
}
|
||||
|
||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
wxIcon ico( transmission_xpm );
|
||||
|
||||
#if wxCHECK_VERSION(2,8,0)
|
||||
wxAboutDialogInfo info;
|
||||
info.SetName(_T("Xmission"));
|
||||
info.SetVersion(_T(LONG_VERSION_STRING));
|
||||
info.SetCopyright(_T("Copyright 2005-2007 The Transmission Project"));
|
||||
info.SetDescription(_T("A fast and easy BitTorrent client"));
|
||||
info.SetWebSite( _T( "http://www.transmissionbt.com/" ) );
|
||||
info.SetIcon( ico );
|
||||
info.AddDeveloper( _T("Charles Kerr (Back-end, GTK+, wxWidgets)") );
|
||||
info.AddDeveloper( _T("Mitchell Livingston (Back-end; OS X)") );
|
||||
info.AddDeveloper( _T("Eric Petit (Back-end; OS X)") );
|
||||
info.AddDeveloper( _T("Josh Elsasser (Back-end; GTK+)") );
|
||||
info.AddDeveloper( _T("Bryan Varner (BeOS)") );
|
||||
wxAboutBox( info );
|
||||
#else
|
||||
wxMessageBox(_T("Xmission " LONG_VERSION_STRING "\n"
|
||||
"Copyright 2005-2007 The Transmission Project"),
|
||||
_T("About Xmission"),
|
||||
wxOK|wxICON_INFORMATION, this);
|
||||
#endif
|
||||
|
||||
}
|
Loading…
Reference in New Issue