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.60 by root, Tue Jun 6 02:55:50 2006 UTC vs.
Revision 1.63 by root, Wed Jun 7 05:54:09 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
1172 $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); 1196 $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1);
1173 $table->add ($x+1, $y, new CFClient::UI::CheckBox 1197 $table->add ($x+1, $y, new CFClient::UI::CheckBox
1174 state => $CFG->{pickup} & $mask, 1198 state => $CFG->{pickup} & $mask,
1175 on_changed => sub { 1199 on_changed => sub {
1176 my ($box, $value) = @_; 1200 my ($box, $value) = @_;
1201
1177 if ($value) { 1202 if ($value) {
1178 $::CFG->{pickup} |= $mask; 1203 $::CFG->{pickup} |= $mask;
1179 } else { 1204 } else {
1180 $::CFG->{pickup} = $::CFG->{pickup} & ~$mask; 1205 $::CFG->{pickup} &= ~$mask;
1181 } 1206 }
1207
1182 $::CONN->send (sprintf "command pickup %u", $::CFG->{pickup}) 1208 $::CONN->send_command ("pickup $::CFG->{pickup}")
1183 if defined $::CONN; 1209 if defined $::CONN;
1184 }); 1210 });
1185 } 1211 }
1186 } 1212 }
1187 1213
1439 1465
1440 $LOGVIEW = new CFClient::UI::TextView 1466 $LOGVIEW = new CFClient::UI::TextView
1441 expand => 1, 1467 expand => 1,
1442 font => $FONT_FIXED, 1468 font => $FONT_FIXED,
1443 fontsize => $::CFG->{log_fontsize}, 1469 fontsize => $::CFG->{log_fontsize},
1470 indent => -4,
1444 can_hover => 1, 1471 can_hover => 1,
1445 can_events => 1, 1472 can_events => 1,
1446 tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.", 1473 tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.",
1447 ; 1474 ;
1448 1475
1772 bgm_enable => 1, 1799 bgm_enable => 1,
1773 bgm_volume => 0.25, 1800 bgm_volume => 0.25,
1774 face_prefetch => 0, 1801 face_prefetch => 0,
1775 output_sync => 1, 1802 output_sync => 1,
1776 output_count => 1, 1803 output_count => 1,
1804 pickup => 0,
1777 ); 1805 );
1778 1806
1779 while (my ($k, $v) = each %DEF_CFG) { 1807 while (my ($k, $v) = each %DEF_CFG) {
1780 $CFG->{$k} = $v unless exists $CFG->{$k}; 1808 $CFG->{$k} = $v unless exists $CFG->{$k};
1781 } 1809 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines