ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.61 by root, Tue Jun 6 03:05:16 2006 UTC vs.
Revision 1.62 by root, Tue Jun 6 08:35:22 2006 UTC

846 846
847 utf8::decode $buf if utf8::valid $buf; 847 utf8::decode $buf if utf8::valid $buf;
848 848
849 $table->clear; 849 $table->clear;
850 850
851 my @tip = (
852 "The current number of users logged in on the server.",
853 "The hostname of the server.",
854 "The time this server has been running without being restarted.",
855 "The server software version - a '+' indicates a Crossfire+ server.",
856 "Short information about this server provided by its admins.",
857 );
851 my @col = qw(Use #Users Host Uptime Version Description); 858 my @col = qw(#Users Host Uptime Version Description);
852 $table->add ($_, 0, new CFClient::UI::Label align => 0, fg => [1, 1, 0], text => $col[$_]) 859 $table->add ($_, 0, new CFClient::UI::Label
860 can_hover => 1, can_events => 1,
861 align => 0, fg => [1, 1, 0],
862 text => $col[$_], tooltip => $tip[$_])
853 for 0 .. $#col; 863 for 0 .. $#col;
854 864
855 my @align = qw(1 0 1 1 -1); 865 my @align = qw(1 0 1 1 -1);
856 866
857 my $y = 0; 867 my $y = 0;
858 for my $m (sort { $b->[3] <=> $a->[3] } map [split /\|/], split /\015?\012/, $buf) { 868 for my $m (sort { $b->[3] <=> $a->[3] } map [split /\|/], split /\015?\012/, $buf) {
875 885
876 $m = [$users, $host, $uptime, $version, $desc]; 886 $m = [$users, $host, $uptime, $version, $desc];
877 887
878 $y++; 888 $y++;
879 889
880 $table->add (0, $y, new CFClient::UI::VBox children => [ 890 $table->add (scalar @$m, $y, new CFClient::UI::VBox children => [
881 (new CFClient::UI::Button text => "Use", on_activate => sub { 891 (new CFClient::UI::Button
892 text => "Use",
893 tooltip => "Put this server into the <b>Host:Port</b> field",
894 on_activate => sub {
882 $HOST_ENTRY->set_text ($CFG->{host} = $host); 895 $HOST_ENTRY->set_text ($CFG->{host} = $host);
883 $METASERVER->toggle_visibility; 896 $METASERVER->hide;
897 },
884 }), 898 ),
885 (new CFClient::UI::Empty expand => 1), 899 (new CFClient::UI::Empty expand => 1),
886 ]); 900 ]);
887 901
888 $table->add ($_ + 1, $y, new CFClient::UI::Label 902 $table->add ($_, $y, new CFClient::UI::Label
889 ellipsise => 0, align => $align[$_], text => $m->[$_], fontsize => 0.8) 903 ellipsise => 0,
904 align => $align[$_],
905 text => $m->[$_],
906 tooltip => $tip[$_],
907 can_hover => 1,
908 can_events => 1,
909 fontsize => 0.8)
890 for 0 .. $#$m; 910 for 0 .. $#$m;
891 } 911 }
892 } 912 }
893 }); 913 });
894} 914}
895 915
896sub metaserver_dialog { 916sub metaserver_dialog {
897 my $dialog = new CFClient::UI::FancyFrame 917 my $dialog = new CFClient::UI::FancyFrame
898 title => "Server List", 918 title => "Server List",
899 name => 'metaserver_dialog', 919 name => 'metaserver_dialog',
900 x => 'center', 920 x => 'center',
901 y => 'center', 921 y => 'center',
902 z => 3, 922 z => 3,
923 force_h => $::HEIGHT * 0.4,
903 child => (my $vbox = new CFClient::UI::VBox), 924 child => (my $vbox = new CFClient::UI::VBox),
904 on_visibility_change => sub { 925 on_visibility_change => sub {
905 update_metaserver if $_[1]; 926 update_metaserver if $_[1];
906 }, 927 },
907 ; 928 ;
908 929
909 $vbox->add ($dialog->{table} = new CFClient::UI::Table); 930 $dialog->{table} = new CFClient::UI::Table;
931
932 $vbox->add (new CFClient::UI::ScrolledWindow expand => 1, child => $dialog->{table});
910 933
911 $dialog 934 $dialog
912} 935}
913 936
914sub server_setup { 937sub server_setup {
937 expand => 1, 960 expand => 1,
938 text => "Server List", 961 text => "Server List",
939 other => $METASERVER, 962 other => $METASERVER,
940 tooltip => "Show a list of available crossfire servers", 963 tooltip => "Show a list of available crossfire servers",
941 on_activate => sub { $METASERVER->toggle_visibility }, 964 on_activate => sub { $METASERVER->toggle_visibility },
965 on_visibility_change => sub { $METASERVER->hide unless $_[1] },
942 ); 966 );
943 } 967 }
944 968
945 $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); 969 $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username");
946 $table->add (1, 4, new CFClient::UI::Entry 970 $table->add (1, 4, new CFClient::UI::Entry

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines