Lots of features. See the changelog.
git-svn-id: http://svn.code.sf.net/p/xqf/code/trunk@21 d2ac09be-c843-0410-8b1f-f8a84130e0ec
This commit is contained in:
parent
1f119837b8
commit
47f874442e
@ -1,3 +1,19 @@
|
||||
Dec 22, 2000: Bill Adams <bill@evil.inetarena.com>
|
||||
-New column in the server list to show if you need a password or not. If
|
||||
you do a lock icon appears.
|
||||
-If a Q3A server has all non private-client slots filled, a yellow man
|
||||
appears next to the map. The icon is slightly different for color blind
|
||||
people so don't tell me about it unless you are color blind and need the
|
||||
difference greater.
|
||||
-You can press "Insert" and "Delete" to add and delete servers, "Enter"
|
||||
or "Return" will connect you to the server.
|
||||
-Moved the filter selection to the "Server" menu pulldown.
|
||||
-It still dumps core. :(. There seems to be a reference counting bug
|
||||
with the server lists. If you want to watch it happen, set up a
|
||||
"mod contains wfa" filter, update the Q3A ID list, apply the filter, and
|
||||
press refresh repeatedly.
|
||||
|
||||
|
||||
Dec 20th 2000: Bill Adams <bill@evil.inetarena.com>
|
||||
--The filter name now appears in the status bar.
|
||||
--Version changed to 0.9.6b-beta
|
||||
|
@ -822,6 +822,11 @@ static void q3_analyze_serverinfo (struct server *s) {
|
||||
else if (strcmp (*info_ptr, "cheats") == 0) {
|
||||
s->flags |= SERVER_CHEATS;
|
||||
}
|
||||
else if (strcmp (*info_ptr, "sv_privateClients") == 0) {
|
||||
s->private_client = strtol (info_ptr[1], NULL, 10);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ static void create_menu_recursive (GtkWidget *menu,
|
||||
NULL);
|
||||
|
||||
ac_key = gtk_label_parse_uline (GTK_LABEL (label), items->label);
|
||||
|
||||
|
||||
if (accel_group && ac_key != GDK_VoidSymbol) {
|
||||
if (GTK_IS_MENU_BAR (menu)) {
|
||||
gtk_widget_add_accelerator (menu_item, "activate_item", accel_group,
|
||||
|
@ -54,6 +54,7 @@
|
||||
|
||||
#include "xpm/man-black.xpm"
|
||||
#include "xpm/man-red.xpm"
|
||||
#include "xpm/man-yellow.xpm"
|
||||
|
||||
#include "xpm/group-red.xpm"
|
||||
#include "xpm/group-green.xpm"
|
||||
@ -70,7 +71,7 @@
|
||||
#include "xpm/server-down.xpm"
|
||||
#include "xpm/server-to.xpm"
|
||||
#include "xpm/server-error.xpm"
|
||||
|
||||
#include "xpm/locked.xpm"
|
||||
|
||||
struct pixmap update_pix;
|
||||
struct pixmap refresh_pix;
|
||||
@ -102,6 +103,7 @@ struct pixmap rminus_pix;
|
||||
|
||||
struct pixmap man_black_pix;
|
||||
struct pixmap man_red_pix;
|
||||
struct pixmap man_yellow_pix;
|
||||
|
||||
struct pixmap group_pix[3];
|
||||
struct pixmap buddy_pix[9];
|
||||
@ -109,6 +111,7 @@ struct pixmap buddy_pix[9];
|
||||
struct pixmap error_pix;
|
||||
|
||||
struct pixmap server_status[5];
|
||||
struct pixmap locked_pix;
|
||||
|
||||
static GdkGC *pixmaps_gc;
|
||||
static GdkGC *masks_gc;
|
||||
@ -197,6 +200,7 @@ void free_pixmaps (void) {
|
||||
|
||||
free_pixmap (&man_black_pix);
|
||||
free_pixmap (&man_red_pix);
|
||||
free_pixmap (&man_yellow_pix);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
free_pixmap (&group_pix[i]);
|
||||
@ -209,6 +213,8 @@ void free_pixmaps (void) {
|
||||
for (i = 0; i < 5; i++)
|
||||
free_pixmap (&server_status[i]);
|
||||
|
||||
free_pixmap (&locked_pix);
|
||||
|
||||
if (pixmaps_gc) {
|
||||
gdk_gc_destroy (pixmaps_gc);
|
||||
pixmaps_gc = NULL;
|
||||
@ -260,6 +266,7 @@ void init_pixmaps (GtkWidget *window) {
|
||||
|
||||
create_pixmap (window, &man_black_pix, man_black_xpm);
|
||||
create_pixmap (window, &man_red_pix, man_red_xpm);
|
||||
create_pixmap (window, &man_yellow_pix, man_yellow_xpm);
|
||||
|
||||
create_pixmap (window, &group_pix[0], group_red_xpm);
|
||||
create_pixmap (window, &group_pix[1], group_green_xpm);
|
||||
@ -276,6 +283,7 @@ void init_pixmaps (GtkWidget *window) {
|
||||
create_pixmap (window, &server_status[4], server_error_xpm);
|
||||
|
||||
create_pixmap (window, &error_pix, error_xpm);
|
||||
create_pixmap (window, &locked_pix, locked_xpm);
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,6 +64,7 @@ extern struct pixmap rminus_pix;
|
||||
|
||||
extern struct pixmap man_black_pix;
|
||||
extern struct pixmap man_red_pix;
|
||||
extern struct pixmap man_yellow_pix;
|
||||
|
||||
extern struct pixmap group_pix[];
|
||||
extern struct pixmap buddy_pix[];
|
||||
@ -72,6 +73,8 @@ extern struct pixmap error_pix;
|
||||
|
||||
extern struct pixmap server_status[];
|
||||
|
||||
extern struct pixmap locked_pix;
|
||||
|
||||
extern int pixmap_height (GdkPixmap *pixmap);
|
||||
extern int pixmap_width (GdkPixmap *pixmap);
|
||||
|
||||
|
@ -102,7 +102,18 @@ int compare_servers (const struct server *s1, const struct server *s2,
|
||||
case SORT_SERVER_MOD:
|
||||
res = compare_strings (s1->mod, s2->mod);
|
||||
break;
|
||||
|
||||
|
||||
case SORT_SERVER_PRIVATE:
|
||||
if( (s1->flags & SERVER_PASSWORD ) && ( s2->flags & SERVER_PASSWORD ))
|
||||
res = 0;
|
||||
else if (s1->flags & SERVER_PASSWORD )
|
||||
res = 1;
|
||||
else if (s2->flags & SERVER_PASSWORD )
|
||||
res = -1;
|
||||
else
|
||||
res = 0;
|
||||
break;
|
||||
|
||||
case SORT_SERVER_PLAYERS:
|
||||
res = s1->curplayers - s2->curplayers;
|
||||
if (!res) {
|
||||
|
@ -27,6 +27,7 @@ enum ssort_mode {
|
||||
SORT_SERVER_ADDRESS,
|
||||
SORT_SERVER_PING,
|
||||
SORT_SERVER_TO,
|
||||
SORT_SERVER_PRIVATE,
|
||||
SORT_SERVER_PLAYERS,
|
||||
SORT_SERVER_MAP,
|
||||
SORT_SERVER_GAME,
|
||||
|
@ -90,7 +90,7 @@ void assemble_server_address (char *buf, int size, struct server *s) {
|
||||
static int server_clist_refresh_row (struct server *s, int row) {
|
||||
GdkPixmap *server_pixmap;
|
||||
GdkBitmap *server_pixmask;
|
||||
char *text[8];
|
||||
char *text[9];
|
||||
char buf1[256], buf2[32], buf3[32], buf4[32];
|
||||
char *retries;
|
||||
struct pixmap *retries_pix = NULL;
|
||||
@ -134,32 +134,54 @@ static int server_clist_refresh_row (struct server *s, int row) {
|
||||
if (xqf_start_time > s->refreshed)
|
||||
retries_pix = &server_status[0];
|
||||
|
||||
text[3] = NULL;
|
||||
text[3] = text[4] = NULL;
|
||||
|
||||
g_snprintf (buf4, 32, "%d/%d", s->curplayers, s->maxplayers);
|
||||
text[4] = (!s->curplayers)? buf4 : NULL;
|
||||
text[5] = (!s->curplayers)? buf4 : NULL;
|
||||
|
||||
text[5] = (s->map) ? s->map : NULL;
|
||||
text[6] = (s->game)? s->game : NULL;
|
||||
text[7] = (s->mod) ? s->mod : NULL;
|
||||
text[6] = (s->map) ? s->map : NULL;
|
||||
text[7] = (s->game)? s->game : NULL;
|
||||
text[8] = (s->mod) ? s->mod : NULL;
|
||||
|
||||
if (row < 0) {
|
||||
row = gtk_clist_append (server_clist, text);
|
||||
}
|
||||
else {
|
||||
for (col = 1; col < 7; col++) {
|
||||
for (col = 1; col < 8; col++) {
|
||||
gtk_clist_set_text (server_clist, row, col, text[col]);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_clist_set_pixtext (server_clist, row, 3, retries, 2,
|
||||
retries_pix->pix, retries_pix->mask);
|
||||
|
||||
#if 0
|
||||
if (s->curplayers) {
|
||||
gtk_clist_set_pixtext (server_clist, row, 4, buf4, 2,
|
||||
(s->curplayers >= s->maxplayers)? man_red_pix.pix : man_black_pix.pix,
|
||||
(s->curplayers >= s->maxplayers)? man_red_pix.mask : man_black_pix.mask);
|
||||
}
|
||||
#endif
|
||||
if (s->curplayers >= s->maxplayers)
|
||||
gtk_clist_set_pixtext (server_clist, row, 5, buf4, 2,
|
||||
man_red_pix.pix, man_red_pix.mask );
|
||||
|
||||
else if ( (s->curplayers + s->private_client ) >= s->maxplayers)
|
||||
gtk_clist_set_pixtext (server_clist, row, 5, buf4, 2,
|
||||
man_yellow_pix.pix, man_yellow_pix.mask );
|
||||
|
||||
else if (s->curplayers)
|
||||
gtk_clist_set_pixtext (server_clist, row, 5, buf4, 2,
|
||||
man_black_pix.pix, man_black_pix.mask );
|
||||
|
||||
|
||||
|
||||
/* Show if the server is private or not */
|
||||
if (s->flags & SERVER_PASSWORD ) {
|
||||
gtk_clist_set_pixtext (server_clist, row, 4, "", 0,
|
||||
locked_pix.pix, locked_pix.mask );
|
||||
} else {
|
||||
gtk_clist_set_text (server_clist, row, 4, "" );
|
||||
}
|
||||
|
||||
get_server_pixmap (main_window, s, &server_pixmap_cache, &server_pixmap,
|
||||
&server_pixmask);
|
||||
|
23
xqf/src/xpm/locked.xpm
Normal file
23
xqf/src/xpm/locked.xpm
Normal file
@ -0,0 +1,23 @@
|
||||
/* XPM */
|
||||
static char * locked_xpm[] = {
|
||||
"17 17 3 1",
|
||||
" c None",
|
||||
". c #7F0000",
|
||||
"+ c #FF0000",
|
||||
" ",
|
||||
" ",
|
||||
" +++ ",
|
||||
" +...+ ",
|
||||
" .+. .+. ",
|
||||
" .+. .+. ",
|
||||
" .+. .+. ",
|
||||
" ........... ",
|
||||
" .+++++++++. ",
|
||||
" .+ +. ",
|
||||
" .+++++++++. ",
|
||||
" .+ +. ",
|
||||
" .+++++++++. ",
|
||||
" ........... ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
22
xqf/src/xpm/man-yellow.xpm
Normal file
22
xqf/src/xpm/man-yellow.xpm
Normal file
@ -0,0 +1,22 @@
|
||||
/* XPM */
|
||||
static char * man_yellow_xpm[] = {
|
||||
"9 17 2 1",
|
||||
" c None",
|
||||
". c #00FF00",
|
||||
" ",
|
||||
" ",
|
||||
" ... ",
|
||||
" . . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" ..... ",
|
||||
" . ... . ",
|
||||
" . ... . ",
|
||||
" . ... . ",
|
||||
" . ... . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" ",
|
||||
" "};
|
@ -38,11 +38,15 @@ GtkWidget *pane1_widget;
|
||||
GtkWidget *pane2_widget;
|
||||
GtkWidget *pane3_widget;
|
||||
|
||||
static struct clist_column server_columns[8] = {
|
||||
/* If you add a column here to appear in the server
|
||||
list, you need to also add an entry in sort.h and sort.c
|
||||
*/
|
||||
static struct clist_column server_columns[9] = {
|
||||
{ "Name", 180, GTK_JUSTIFY_LEFT, NULL },
|
||||
{ "Address", 140, GTK_JUSTIFY_LEFT, NULL },
|
||||
{ "Ping", 45, GTK_JUSTIFY_RIGHT, NULL },
|
||||
{ "TO", 35, GTK_JUSTIFY_RIGHT, NULL },
|
||||
{ "Priv", 20, GTK_JUSTIFY_RIGHT, NULL },
|
||||
{ "Players", 65, GTK_JUSTIFY_RIGHT, NULL },
|
||||
{ "Map", 55, GTK_JUSTIFY_LEFT, NULL },
|
||||
{ "Game", 55, GTK_JUSTIFY_LEFT, NULL },
|
||||
@ -53,7 +57,7 @@ struct clist_def server_clist_def = {
|
||||
CWIDGET_CLIST,
|
||||
"Server List",
|
||||
server_columns,
|
||||
8,
|
||||
9,
|
||||
GTK_SELECTION_EXTENDED,
|
||||
630, 270,
|
||||
SORT_SERVER_PING, GTK_SORT_ASCENDING
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <string.h> /* strlen */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
#include "xqf.h"
|
||||
#include "xqf-ui.h"
|
||||
@ -1320,11 +1321,27 @@ static void server_clist_unselect_callback (GtkWidget *widget, int row,
|
||||
}
|
||||
|
||||
|
||||
/* Deal with key-presses in the server pane */
|
||||
static void server_clist_keypress_callback (GtkWidget *widget, GdkEventKey *event)
|
||||
|
||||
{
|
||||
|
||||
/* printf( "CLIST Key %x\n", event->keyval ); */
|
||||
if (event->keyval == GDK_Delete) {
|
||||
del_server_callback( widget, event );
|
||||
} else if (event->keyval == GDK_Insert ) {
|
||||
add_to_favorites_callback( widget, event );
|
||||
} else if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter ) {
|
||||
launch_callback( widget, LAUNCH_NORMAL );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int server_clist_event_callback (GtkWidget *widget, GdkEvent *event) {
|
||||
GdkEventButton *bevent = (GdkEventButton *) event;
|
||||
GList *selection;
|
||||
int row;
|
||||
|
||||
|
||||
if (event->type == GDK_BUTTON_PRESS &&
|
||||
bevent->window == server_clist->clist_window) {
|
||||
|
||||
@ -1546,26 +1563,9 @@ struct __menuitem {
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
baa -- Oh, this is kind of bad. In order to allow
|
||||
the number of menus to be changed at compile (and in
|
||||
the future, run) time, I have to allocate and set
|
||||
up each of the filter menu items. But that makes
|
||||
it no longer a const.
|
||||
*/
|
||||
|
||||
struct menuitem *server_filter_menu_items;
|
||||
|
||||
/* Bad Bill! The const has been removed from the next line. */
|
||||
static struct menuitem srvopt_menu_items[] = {
|
||||
{
|
||||
MENU_BRANCH, "_Server Filters", 0, 0,
|
||||
NULL,
|
||||
NULL, /* <-- This gets set to the addres
|
||||
of server_filter_menu_items after
|
||||
we g_malloc the memory. */
|
||||
NULL
|
||||
},
|
||||
static const struct menuitem srvopt_menu_items[] = {
|
||||
{
|
||||
MENU_ITEM, "Connect", 0, 0,
|
||||
GTK_SIGNAL_FUNC (launch_callback), (gpointer) LAUNCH_NORMAL,
|
||||
@ -1749,7 +1749,27 @@ static const struct menuitem view_menu_items[] = {
|
||||
{ MENU_END, NULL, 0, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
static const struct menuitem server_menu_items[] = {
|
||||
|
||||
/*
|
||||
baa -- Oh, this is kind of bad. In order to allow
|
||||
the number of menus to be changed at compile (and in
|
||||
the future, run) time, I have to allocate and set
|
||||
up each of the filter menu items. But that makes
|
||||
it no longer a const.
|
||||
*/
|
||||
|
||||
struct menuitem *server_filter_menu_items;
|
||||
|
||||
/* Bad Bill! The const has been removed from the next line. */
|
||||
static struct menuitem server_menu_items[] = {
|
||||
{
|
||||
MENU_BRANCH, "_Server Filters", 0, 0,
|
||||
NULL,
|
||||
NULL, /* <-- This gets set to the addres
|
||||
of server_filter_menu_items after
|
||||
we g_malloc the memory. */
|
||||
NULL
|
||||
},
|
||||
{
|
||||
MENU_ITEM, "_Connect", 0, 0,
|
||||
GTK_SIGNAL_FUNC (launch_callback), (gpointer) LAUNCH_NORMAL,
|
||||
@ -1769,10 +1789,16 @@ static const struct menuitem server_menu_items[] = {
|
||||
{ MENU_SEPARATOR, NULL, 0, 0, NULL, NULL, NULL },
|
||||
|
||||
{
|
||||
MENU_ITEM, "Add to _Favorites", 0, 0,
|
||||
MENU_ITEM, "Add to _Favorites", 0, 0,
|
||||
GTK_SIGNAL_FUNC (add_to_favorites_callback), NULL,
|
||||
&server_favadd_menu_item
|
||||
},
|
||||
{
|
||||
MENU_ITEM, "Delete", 0, 0,
|
||||
GTK_SIGNAL_FUNC (del_server_callback), NULL,
|
||||
&delete_menu_item
|
||||
},
|
||||
|
||||
{
|
||||
MENU_ITEM, "DNS _Lookup", 'L', GDK_CONTROL_MASK,
|
||||
GTK_SIGNAL_FUNC (resolve_callback), NULL,
|
||||
@ -2063,6 +2089,8 @@ static void populate_main_toolbar (void) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void create_main_window (void) {
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *vbox;
|
||||
@ -2159,7 +2187,13 @@ void create_main_window (void) {
|
||||
server_filter_menu_items[i].user_data = NULL;
|
||||
server_filter_menu_items[i].widget = NULL;
|
||||
}
|
||||
|
||||
/* Depeding on where you want the filters to appear... */
|
||||
#if 0
|
||||
srvopt_menu_items[0].user_data = &server_filter_menu_items[0];
|
||||
#else
|
||||
server_menu_items[0].user_data = &server_filter_menu_items[0];
|
||||
#endif
|
||||
|
||||
server_menu = create_menu (srvopt_menu_items, accel_group);
|
||||
|
||||
@ -2251,6 +2285,10 @@ void create_main_window (void) {
|
||||
gtk_signal_connect (GTK_OBJECT (server_clist), "unselect_row",
|
||||
GTK_SIGNAL_FUNC (server_clist_unselect_callback), NULL);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (server_clist), "key_press_event",
|
||||
GTK_SIGNAL_FUNC (server_clist_keypress_callback), NULL);
|
||||
|
||||
|
||||
gtk_clist_set_compare_func (server_clist,
|
||||
(GtkCListCompareFunc) server_clist_compare_func);
|
||||
|
||||
|
@ -147,6 +147,7 @@ struct server {
|
||||
unsigned char filters;
|
||||
unsigned char flt_mask;
|
||||
unsigned flt_last; /* time of the last filtering */
|
||||
unsigned private_client; /* number of private clients */
|
||||
|
||||
time_t refreshed;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user