Freeciv-3.2
Loading...
Searching...
No Matches
connectdlg.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14/***********************************************************************
15 connectdlg.c - description
16 -------------------
17 begin : Mon Jul 1 2002
18 copyright : (C) 2002 by Rafał Bursig
19 email : Rafał Bursig <bursig@poczta.fm>
20***********************************************************************/
21
22#ifdef HAVE_CONFIG_H
23#include <fc_config.h>
24#endif
25
26#include <stdlib.h>
27
28/* SDL3 */
29#include <SDL3/SDL.h>
30
31/* utility */
32#include "fcintl.h"
33#include "log.h"
34
35/* client */
36#include "client_main.h"
37#include "clinet.h" /* connect_to_server() */
38#include "packhand.h"
39#include "servers.h"
40
41/* gui-sdl3 */
42#include "chatline.h"
43#include "colors.h"
44#include "graphics.h"
45#include "gui_id.h"
46#include "gui_main.h"
47#include "gui_tilespec.h"
48#include "mapview.h"
49#include "messagewin.h"
50#include "optiondlg.h"
51#include "pages.h"
52#include "themespec.h"
53#include "widget.h"
54
55#include "connectdlg.h"
56
57static struct server_list *server_list = NULL;
58static struct server_scan *server_scan = NULL;
59
61static struct small_dialog *connect_dlg = NULL;
62
63static int connect_callback(struct widget *pwidget);
64static int convert_portnr_callback(struct widget *pwidget);
65static int convert_playername_callback(struct widget *pwidget);
66static int convert_servername_callback(struct widget *pwidget);
67static void popup_new_user_passwd_dialog(const char *message);
68
69/*
70 THESE FUNCTIONS ARE ONE BIG TMP SOLUTION AND SHOULD BE FULLY REWRITTEN !!
71*/
72
73/**********************************************************************/
76void handle_game_load(bool load_successful, const char *filename)
77{
78 /* PORTME */
79}
80
81/**********************************************************************/
84static int connect_callback(struct widget *pwidget)
85{
87 char errbuf[512];
88
90 errbuf, sizeof(errbuf)) != -1) {
91 } else {
93
94 /* button up */
96 set_wstate(pwidget, FC_WS_SELECTED);
97 selected_widget = pwidget;
98 widget_redraw(pwidget);
99 widget_flush(pwidget);
100 }
101 }
102
103 return -1;
104}
105/* ======================================================== */
106
107
108/**********************************************************************/
111static int meta_server_window_callback(struct widget *pwindow)
112{
113 return -1;
114}
115
116/**********************************************************************/
119static int exit_meta_server_dlg_callback(struct widget *pwidget)
120{
122 queue_flush();
123
127
130 }
131
132 return -1;
133}
134
135/**********************************************************************/
138static int select_meta_servers_callback(struct widget *pwidget)
139{
141 struct server *server = (struct server *)pwidget->data.ptr;
142
145
147 }
148
149 return -1;
150}
151
152/**********************************************************************/
155static void server_scan_error(struct server_scan *scan,
156 const char *message)
157{
159 log_normal("%s", message);
160
161 switch (server_scan_get_type(scan)) {
166 break;
171 break;
172 case SERVER_SCAN_LAST:
173 break;
174 }
175}
176
177/**********************************************************************/
184{
185 struct srv_list *list = NULL;
186 int i;
187
188 if (lan) {
190 } else {
192 }
193
194 if (!server_scan) {
195 return NULL;
196 }
197
198 SDL_Delay(5000);
199
200 for (i = 0; i < 100; i++) {
203 if (list) {
204 break;
205 }
206 SDL_Delay(100);
207 }
208
209 return list;
210}
211
212/**********************************************************************/
216{
217 SDL_Color bg_color = {255, 255, 255, 128};
218 char cbuf[512];
219 int w = 0, h = 0, count = 0, meta_h;
220 struct widget *new_widget, *pwindow, *label_window;
221 utf8_str *pstr;
224 struct srv_list *srvrs;
225
226 queue_flush();
229
230 /* Text Label */
233
234 area = label_window->area;
235
236 fc_snprintf(cbuf, sizeof(cbuf), _("Creating Server List..."));
238 pstr->style = TTF_STYLE_BOLD;
239 pstr->bgcol = (SDL_Color) {0, 0, 0, 0};
243
244 area.w = MAX(area.w, new_widget->size.w + (adj_size(60) -
245 (label_window->size.w - label_window->area.w)));
246 area.h += new_widget->size.h + (adj_size(30) -
247 (label_window->size.w - label_window->area.w));
248
250 (label_window->size.w - label_window->area.w) + area.w,
251 (label_window->size.h - label_window->area.h) + area.h);
252
253 area = label_window->area;
254
256 (main_window_width() - label_window->size.w) / 2,
257 (main_window_height() - label_window->size.h) / 2);
258
261 area.x + (area.w - new_widget->size.w) / 2,
262 area.y + (area.h - new_widget->size.h) / 2);
263
265 flush_dirty();
266
267 /* Create server list */
269
270 /* Copy list */
272 fc_mutex_allocate(&srvrs->mutex);
276 fc_mutex_release(&srvrs->mutex);
277
278 /* Clear label */
280
282
283 if (!server_list) {
284 if (lan_scan) {
285 output_window_append(ftc_client, _("No LAN servers found"));
286 } else {
287 output_window_append(ftc_client, _("No public servers found"));
288 }
290 return;
291 }
292
293 /* Server list window */
294 meta_server = fc_calloc(1, sizeof(struct advanced_dialog));
295
296 pwindow = create_window_skeleton(NULL, NULL, 0);
298 set_wstate(pwindow, FC_WS_NORMAL);
300 if (lan_scan) {
302 } else {
304 }
305 meta_server->end_widget_list = pwindow;
306
307 /* Cancel button */
310 pwindow->dst, _("Cancel"),
311 FONTO_HEADING, 0);
315
316 /* Servers */
318
319 /* TRANS: "host.example.com Port 5556 Ver: 3.1.0 Running Players 3\n
320 * [server message]" */
321 fc_snprintf(cbuf, sizeof(cbuf), _("%s Port %d Ver: %s %s %s %d\n%s"),
323 Q_("?header:Players"), server->nplayers, server->message);
324
328
329 new_widget->string_utf8->style |= SF_CENTER;
330 new_widget->string_utf8->bgcol = (SDL_Color) {0, 0, 0, 0};
331
334 new_widget->data.ptr = (void *)server;
335
337
338 w = MAX(w, new_widget->size.w);
339 h = MAX(h, new_widget->size.h);
340 count++;
341
342 if (count > 10) {
344 }
345
347
348 if (!count) {
349 if (lan_scan) {
350 output_window_append(ftc_client, _("No LAN servers found"));
351 } else {
352 output_window_append(ftc_client, _("No public servers found"));
353 }
355 return;
356 }
357
362
363 if (count > 10) {
364 meta_h = 10 * h;
365
367 w += count;
368 } else {
369 meta_h = count * h;
370 }
371
372 w += adj_size(20);
373 area2.h = meta_h;
374
376
378 if (resize_window(pwindow, logo, NULL, w, meta_h)) {
380 }
381
382 area = pwindow->area;
383
384 widget_set_position(pwindow,
385 (main_window_width() - w) / 2,
386 (main_window_height() - meta_h) / 2);
387
388 w -= adj_size(20);
389
390 area2.w = w + 1;
391
392 if (meta_server->scroll) {
393 w -= count;
394 }
395
396 /* Exit button */
397 new_widget = pwindow->prev;
398 new_widget->size.x = area.x + area.w - new_widget->size.w - adj_size(10);
399 new_widget->size.y = area.y + area.h - new_widget->size.h - adj_size(10);
400
401 /* Meta labels */
402 new_widget = new_widget->prev;
403
404 new_widget->size.x = area.x + adj_size(10);
405 new_widget->size.y = area.y + adj_size(10);
406 new_widget->size.w = w;
407 new_widget->size.h = h;
409
410 new_widget = new_widget->prev;
411
412 while (new_widget != NULL) {
413 new_widget->size.w = w;
414 new_widget->size.h = h;
415 new_widget->size.x = new_widget->next->size.x;
416 new_widget->size.y = new_widget->next->size.y + new_widget->next->size.h;
418
420 break;
421 }
422 new_widget = new_widget->prev;
423 }
424
425 if (meta_server->scroll) {
427 area.x + area.w - adj_size(6),
429 area.h - adj_size(24) - pwindow->prev->size.h, TRUE);
430 }
431
432 /* -------------------- */
433 /* Redraw */
434
435 widget_redraw(pwindow);
436
439
441
442 create_frame(pwindow->dst->surface,
443 area2.x - 1, area2.y - 1, area2.w, area2.h,
445
447
448 create_frame(pwindow->dst->surface,
449 pwindow->size.x, pwindow->size.y,
450 area.w - 1, area.h - 1,
452
453 widget_flush(pwindow);
454}
455
456/**********************************************************************/
459static int convert_playername_callback(struct widget *pwidget)
460{
462 if (pwidget->string_utf8->text != NULL) {
464 } else {
465 /* empty input -> restore previous content */
467 widget_redraw(pwidget);
468 widget_mark_dirty(pwidget);
469 flush_dirty();
470 }
471 }
472
473 return -1;
474}
475
476/**********************************************************************/
479static int convert_servername_callback(struct widget *pwidget)
480{
482 if (pwidget->string_utf8->text != NULL) {
484 } else {
485 /* empty input -> restore previous content */
487 widget_redraw(pwidget);
488 widget_mark_dirty(pwidget);
489 flush_dirty();
490 }
491 }
492
493 return -1;
494}
495
496/**********************************************************************/
499static int convert_portnr_callback(struct widget *pwidget)
500{
502 char port_str[6];
503
504 if (pwidget->string_utf8->text != NULL) {
505 sscanf(pwidget->string_utf8->text, "%d", &server_port);
506 } else {
507 /* empty input -> restore previous content */
508 fc_snprintf(port_str, sizeof(port_str), "%d", server_port);
510 widget_redraw(pwidget);
511 widget_mark_dirty(pwidget);
512 flush_dirty();
513 }
514 }
515
516 return -1;
517}
518
519/**********************************************************************/
522static int cancel_connect_dlg_callback(struct widget *pwidget)
523{
527 }
528
529 return -1;
530}
531
532/**********************************************************************/
536{
537 char port_str[6];
538 struct widget *buf, *pwindow;
544 int start_x;
545 int pos_y;
546 int dialog_w, dialog_h;
547
548 queue_flush();
550
551 connect_dlg = fc_calloc(1, sizeof(struct small_dialog));
552
553 /* Window */
554 pwindow = create_window_skeleton(NULL, NULL, 0);
555 add_to_gui_list(ID_WINDOW, pwindow);
556 connect_dlg->end_widget_list = pwindow;
557
558 area = pwindow->area;
559
560 /* Player name label */
563 buf = create_iconlabel(NULL, pwindow->dst, plrname,
566 area.h += buf->size.h + adj_size(20);
567
568 /* Player name edit */
571 adj_size(210),
576 area.h += buf->size.h + adj_size(5);
577
578 /* Server name label */
579 srvname = create_utf8_from_char_fonto(_("Freeciv Server :"), FONTO_DEFAULT);
581 buf = create_iconlabel(NULL, pwindow->dst, srvname,
584 area.h += buf->size.h + adj_size(5);
585
586 /* Server name edit */
590
594 area.h += buf->size.h + adj_size(5);
595
596 /* Port label */
599 buf = create_iconlabel(NULL, pwindow->dst, port_nr,
602 area.h += buf->size.h + adj_size(5);
603
604 /* Port edit */
605 fc_snprintf(port_str, sizeof(port_str), "%d", server_port);
606
609 adj_size(210),
611
615 area.h += buf->size.h + adj_size(20);
616
617 /* Connect button */
619 pwindow->dst,
620 _("Connect"),
621 FONTO_HEADING, 0);
622 buf->action = connect_callback;
624 buf->key = SDLK_RETURN;
626
627 /* Cancel button */
629 pwindow->dst, _("Cancel"),
630 FONTO_HEADING, 0);
633 buf->key = SDLK_ESCAPE;
635 buf->size.w = MAX(buf->size.w, buf->next->size.w);
636 buf->next->size.w = buf->size.w;
637 area.h += buf->size.h + adj_size(10);
638 /* ------------------------------ */
639
641
642 dialog_w = MAX(adj_size(40) + buf->size.w * 2, adj_size(210)) + adj_size(80);
643
644#ifdef SMALL_SCREEN
645 dialog_h = area.h + (pwindow->size.h - pwindow->area.h);
646#else
647 dialog_h = area.h + (pwindow->size.h - pwindow->area.h);
648#endif
649
651 if (resize_window(pwindow, logo, NULL, dialog_w, dialog_h)) {
653 }
654
655 area = pwindow->area;
656
657 widget_set_position(pwindow,
658 (main_window_width() - pwindow->size.w) / 2,
659 (main_window_height() - pwindow->size.h) / 2 + adj_size(40));
660
661 /* player name label */
663
664 start_x = area.x + (area.w - buf->prev->size.w) / 2;
665 pos_y = area.y + adj_size(20);
666
667 buf->size.x = start_x + adj_size(5);
668 buf->size.y = pos_y;
669
670 pos_y += buf->size.h;
671
672 buf = buf->prev;
673 buf->size.x = start_x;
674 buf->size.y = pos_y;
675
676 pos_y += buf->size.h + adj_size(5);
677
678 /* server name label */
679 buf = buf->prev;
680 buf->size.x = start_x + adj_size(5);
681 buf->size.y = pos_y;
682
683 pos_y += buf->size.h;
684
685 /* server name edit */
686 buf = buf->prev;
687 buf->size.x = start_x;
688 buf->size.y = pos_y;
689
690 pos_y += buf->size.h + adj_size(5);
691
692 /* port label */
693 buf = buf->prev;
694 buf->size.x = start_x + adj_size(5);
695 buf->size.y = pos_y;
696
697 pos_y += buf->size.h;
698
699 /* port edit */
700 buf = buf->prev;
701 buf->size.x = start_x;
702 buf->size.y = pos_y;
703
704 pos_y += buf->size.h + adj_size(20);
705
706 /* connect button */
707 buf = buf->prev;
708 buf->size.x = area.x + (dialog_w - (adj_size(40) + buf->size.w * 2)) / 2;
709 buf->size.y = pos_y;
710
711 /* cancel button */
712 buf = buf->prev;
713 buf->size.x = buf->next->size.x + buf->size.w + adj_size(40);
714 buf->size.y = pos_y;
715
717 FALSE);
718
719 flush_all();
720}
721
722/**********************************************************************/
725static int convert_passwd_callback(struct widget *pwidget)
726{
728 if (pwidget->string_utf8->text != NULL) {
730 }
731 }
732
733 return -1;
734}
735
736/**********************************************************************/
739static int send_passwd_callback(struct widget *pwidget)
740{
743
744 sz_strlcpy(reply.password, fc_password);
745
747 fc_password[0] = '\0';
748
749 set_wstate(pwidget, FC_WS_DISABLED);
750
751 widget_redraw(pwidget);
752
753 widget_mark_dirty(pwidget);
754
755 flush_dirty();
756
758 }
759
760 return -1;
761}
762
763/**********************************************************************/
766static int cancel_passwd_callback(struct widget *pwidget)
767{
769 fc_password[0] = '\0';
771
772 return cancel_connect_dlg_callback(pwidget);
773}
774
775/**********************************************************************/
778static void popup_user_passwd_dialog(const char *message)
779{
780 struct widget *buf, *pwindow;
782 SDL_Surface *background;
783 int start_x, start_y;
784 int start_button_y;
786
787 queue_flush();
789
790 connect_dlg = fc_calloc(1, sizeof(struct small_dialog));
791
792 pwindow = create_window_skeleton(NULL, NULL, 0);
793 add_to_gui_list(ID_WINDOW, pwindow);
794 connect_dlg->end_widget_list = pwindow;
795
796 area = pwindow->area;
797
798 /* Text label */
804 area.h += adj_size(10) + buf->size.h + adj_size(5);
805
806 /* Password edit */
807 buf = create_edit(NULL, pwindow->dst,
809 adj_size(210),
814 area.h += buf->size.h + adj_size(10);
815
816 /* Next button */
818 pwindow->dst,
819 _("Next"),
820 FONTO_HEADING, 0);
821 buf->action = send_passwd_callback;
823 buf->key = SDLK_RETURN;
825
826 /* Cancel button */
828 pwindow->dst,
829 _("Cancel"),
830 FONTO_HEADING, 0);
831 buf->action = cancel_passwd_callback;
833 buf->key = SDLK_ESCAPE;
835 buf->size.w = MAX(buf->size.w, buf->next->size.w);
836 buf->next->size.w = buf->size.w;
837 area.h += buf->size.h + adj_size(10);
838
839 /* ------------------------------ */
840
842
843 area.w = MAX(area.w, buf->size.w * 2 + adj_size(40));
844 area.w = MAX(area.w, adj_size(210) - (pwindow->size.w - pwindow->area.w));
845 area.w = MAX(area.w, pwindow->prev->size.w);
846 area.w += adj_size(80);
847
849 if (resize_window(pwindow, background, NULL,
850 (pwindow->size.w - pwindow->area.w) + area.w,
851 (pwindow->size.h - pwindow->area.h) + area.h)) {
852 FREESURFACE(background);
853 }
854
855 area = pwindow->area;
856
857 widget_set_position(pwindow,
858 (main_window_width() - pwindow->size.w) / 2,
859 (main_window_height() - pwindow->size.h) / 2);
860
861 /* Text label */
863
864 start_x = area.x + (area.w - buf->size.w) / 2;
865 start_y = area.y + adj_size(10);
866
869
870 start_y += buf->size.h + adj_size(5);
871
872 /* Password edit */
873 buf = buf->prev;
874 start_x = area.x + (area.w - buf->size.w) / 2;
875
878
879 /* --------------------------------- */
880 start_button_y = buf->size.y + buf->size.h + adj_size(10);
881
882 /* connect button */
883 buf = buf->prev;
886 area.x + (area.w - (adj_size(40) + buf->size.w * 2)) / 2,
888
889 /* cancel button */
890 buf = buf->prev;
893 buf->next->size.x + buf->size.w + adj_size(40),
895
897 FALSE);
898
899 flush_all();
900}
901
902/**********************************************************************/
905static int convert_first_passwd_callback(struct widget *pwidget)
906{
908 if (pwidget->string_utf8->text != NULL) {
910 set_wstate(pwidget->prev, FC_WS_NORMAL);
911 widget_redraw(pwidget->prev);
912 widget_flush(pwidget->prev);
913 }
914 }
915
916 return -1;
917}
918
919/**********************************************************************/
922static int convert_second_passwd_callback(struct widget *pwidget)
923{
925 if (pwidget->string_utf8->text != NULL
926 && !fc_strncmp(fc_password, pwidget->string_utf8->text,
927 MAX_LEN_NAME)) {
928 set_wstate(pwidget->prev, FC_WS_NORMAL); /* Next button */
929 widget_redraw(pwidget->prev);
930 widget_flush(pwidget->prev);
931 } else {
933 fc_password[0] = '\0';
934
935 FC_FREE(pwidget->next->string_utf8->text);/* First edit */
936 FC_FREE(pwidget->string_utf8->text); /* Second edit */
937
938 popup_new_user_passwd_dialog(_("Passwords don't match, enter password."));
939 }
940 }
941
942 return -1;
943}
944
945/**********************************************************************/
948static void popup_new_user_passwd_dialog(const char *message)
949{
950 struct widget *buf, *pwindow;
952 SDL_Surface *background;
953 int start_x, start_y;
954 int start_button_y;
956
957 queue_flush();
959
960 connect_dlg = fc_calloc(1, sizeof(struct small_dialog));
961
962 pwindow = create_window_skeleton(NULL, NULL, 0);
963 add_to_gui_list(ID_WINDOW, pwindow);
964 connect_dlg->end_widget_list = pwindow;
965
966 area = pwindow->area;
967
968 /* Text label */
974 area.h += adj_size(10) + buf->size.h + adj_size(5);
975
976 /* Password edit */
977 buf = create_edit(NULL, pwindow->dst,
979 adj_size(210),
984 area.h += buf->size.h + adj_size(5);
985
986 /* Second password edit */
987 buf = create_edit(NULL, pwindow->dst,
989 adj_size(210),
993 area.h += buf->size.h + adj_size(10);
994
995 /* Next button */
997 pwindow->dst,
998 _("Next"),
999 FONTO_HEADING, 0);
1000 buf->action = send_passwd_callback;
1001 buf->key = SDLK_RETURN;
1003
1004 /* Cancel button */
1006 pwindow->dst, _("Cancel"),
1007 FONTO_HEADING, 0);
1008 buf->action = cancel_passwd_callback;
1010 buf->key = SDLK_ESCAPE;
1012 buf->size.w = MAX(buf->size.w, buf->next->size.w);
1013 buf->next->size.w = buf->size.w;
1014 area.h += buf->size.h + adj_size(10);
1015
1016 /* ------------------------------ */
1017
1019
1020 area.w = buf->size.w * 2 + adj_size(40);
1021 area.w = MAX(area.w, adj_size(210) - (pwindow->size.w - pwindow->area.w));
1022 area.w = MAX(area.w, pwindow->prev->size.w);
1023 area.w += adj_size(80);
1024
1026 if (resize_window(pwindow, background, NULL,
1027 (pwindow->size.w - pwindow->area.w) + area.w,
1028 (pwindow->size.h - pwindow->area.h) + area.h)) {
1029 FREESURFACE(background);
1030 }
1031
1032 area = pwindow->area;
1033
1034 widget_set_position(pwindow,
1035 (main_window_width() - pwindow->size.w) / 2,
1036 (main_window_height() - pwindow->size.h) / 2);
1037
1038 /* text label */
1040
1041 start_x = area.x + (area.w - buf->size.w) / 2;
1042 start_y = area.y + adj_size(10);
1043
1045 widget_set_position(buf, start_x, start_y);
1046
1047 start_y += buf->size.h + adj_size(5);
1048
1049 /* passwd edit */
1050 buf = buf->prev;
1051 start_x = area.x + (area.w - buf->size.w) / 2;
1052
1054 widget_set_position(buf, start_x, start_y);
1055
1056 start_y += buf->size.h + adj_size(5);
1057
1058 /* retype passwd */
1059 buf = buf->prev;
1061 widget_set_position(buf, start_x, start_y);
1062
1063 start_button_y = buf->size.y + buf->size.h + adj_size(10);
1064
1065 /* connect button */
1066 buf = buf->prev;
1069 area.x + (area.w - (adj_size(40) + buf->size.w * 2)) / 2,
1071
1072 /* cancel button */
1073 buf = buf->prev;
1076 buf->next->size.x + buf->size.w + adj_size(40),
1078
1080 FALSE);
1081
1082 flush_all();
1083}
1084
1085/* ======================================================================== */
1086
1087/**********************************************************************/
1110
1111/**********************************************************************/
1116 const char *message)
1117{
1118 switch (type) {
1119 case AUTH_NEWUSER_FIRST:
1120 case AUTH_NEWUSER_RETRY:
1122 return;
1123 case AUTH_LOGIN_FIRST:
1124 /* if we magically have a password already present in 'fc_password'
1125 * then, use that and skip the password entry dialog */
1126 if (fc_password[0] != '\0') {
1128
1129 sz_strlcpy(reply.password, fc_password);
1131
1132 return;
1133 } else {
1135 }
1136
1137 return;
1138 case AUTH_LOGIN_RETRY:
1140
1141 return;
1142 }
1143
1144 log_error("Not supported authentication type %d: %s.", type, message);
1145}
1146
1147/**********************************************************************/
1152{
1153}
void output_window_append(const struct ft_color color, const char *featured_text)
char user_name[512]
char server_host[512]
struct civclient client
char fc_password[MAX_LEN_PASSWORD]
int server_port
static struct fc_sockaddr_list * list
Definition clinet.c:102
int connect_to_server(const char *username, const char *hostname, int port, char *errbuf, int errbufsize)
Definition clinet.c:249
void disconnect_from_server(bool leaving_sound)
Definition clinet.c:306
char * incite_cost
Definition comments.c:75
authentication_type
Definition conn_types.h:41
@ AUTH_NEWUSER_RETRY
Definition conn_types.h:45
@ AUTH_NEWUSER_FIRST
Definition conn_types.h:43
@ AUTH_LOGIN_RETRY
Definition conn_types.h:44
@ AUTH_LOGIN_FIRST
Definition conn_types.h:42
QString current_theme
Definition fc_client.cpp:65
#define MAX_LEN_NAME
Definition fc_types.h:66
#define Q_(String)
Definition fcintl.h:70
#define _(String)
Definition fcintl.h:67
void fc_mutex_allocate(fc_mutex *mutex)
void fc_mutex_release(fc_mutex *mutex)
const struct ft_color ftc_client
const struct ft_color ftc_any
void server_connect(void)
Definition connectdlg.c:60
void close_connection_dialog(void)
Definition connectdlg.c:52
void flush_dirty(void)
Definition mapview.c:468
void meswin_dialog_popdown(void)
Definition messagewin.c:432
void meswin_dialog_popup(bool raise)
Definition messagewin.c:417
static struct server_scan_timer_data lan_scan
Definition pages.c:87
GType type
Definition repodlgs.c:1313
SDL_Color * get_theme_color(enum theme_color themecolor)
Definition colors.c:47
static int convert_first_passwd_callback(struct widget *pwidget)
Definition connectdlg.c:909
void handle_game_load(bool load_successful, const char *filename)
Definition connectdlg.c:80
static int cancel_connect_dlg_callback(struct widget *pwidget)
Definition connectdlg.c:526
static struct small_dialog * connect_dlg
Definition connectdlg.c:65
static int convert_playername_callback(struct widget *pwidget)
Definition connectdlg.c:463
static int exit_meta_server_dlg_callback(struct widget *pwidget)
Definition connectdlg.c:123
static int send_passwd_callback(struct widget *pwidget)
Definition connectdlg.c:743
static void popup_new_user_passwd_dialog(const char *message)
Definition connectdlg.c:952
static void server_scan_error(struct server_scan *scan, const char *message)
Definition connectdlg.c:159
static int meta_server_window_callback(struct widget *pwindow)
Definition connectdlg.c:115
static int connect_callback(struct widget *pwidget)
Definition connectdlg.c:88
static int select_meta_servers_callback(struct widget *pwidget)
Definition connectdlg.c:142
void popup_join_game_dialog(void)
Definition connectdlg.c:539
static void popup_user_passwd_dialog(const char *message)
Definition connectdlg.c:782
static struct srv_list * sdl_create_server_list(bool lan)
Definition connectdlg.c:187
static int convert_second_passwd_callback(struct widget *pwidget)
Definition connectdlg.c:926
void handle_authentication_req(enum authentication_type type, const char *message)
void popup_connection_dialog(bool lan_scan)
Definition connectdlg.c:219
static int convert_servername_callback(struct widget *pwidget)
Definition connectdlg.c:483
static int cancel_passwd_callback(struct widget *pwidget)
Definition connectdlg.c:770
static struct server_list * server_list
Definition connectdlg.c:61
static struct advanced_dialog * meta_server
Definition connectdlg.c:64
static int convert_portnr_callback(struct widget *pwidget)
Definition connectdlg.c:503
static int convert_passwd_callback(struct widget *pwidget)
Definition connectdlg.c:729
int main_window_width(void)
Definition graphics.c:685
int fill_rect_alpha(SDL_Surface *surf, SDL_Rect *prect, SDL_Color *pcolor)
Definition graphics.c:865
struct sdl2_data main_data
Definition graphics.c:57
void create_frame(SDL_Surface *dest, Sint16 left, Sint16 top, Sint16 width, Sint16 height, SDL_Color *pcolor)
Definition graphics.c:1348
int main_window_height(void)
Definition graphics.c:693
#define FREESURFACE(ptr)
Definition graphics.h:322
@ ID_CANCEL_BUTTON
Definition gui_id.h:53
@ ID_LAN_SERVERS_WINDOW
Definition gui_id.h:52
@ ID_PORT_EDIT
Definition gui_id.h:48
@ ID_BUTTON
Definition gui_id.h:29
@ ID_PLAYER_NAME_EDIT
Definition gui_id.h:46
@ ID_EDIT
Definition gui_id.h:34
@ ID_SERVER_NAME_EDIT
Definition gui_id.h:47
@ ID_CONNECT_BUTTON
Definition gui_id.h:49
@ ID_LABEL
Definition gui_id.h:27
@ ID_META_SERVERS_WINDOW
Definition gui_id.h:51
@ ID_WINDOW
Definition gui_id.h:30
struct widget * selected_widget
Definition widget.c:48
#define adj_size(size)
Definition gui_main.h:141
#define PRESSED_EVENT(event)
Definition gui_main.h:71
utf8_str * copy_chars_to_utf8_str(utf8_str *pstr, const char *pchars)
Definition gui_string.c:251
utf8_str * create_utf8_str_fonto(char *in_text, size_t n_alloc, enum font_origin origin)
Definition gui_string.c:241
#define SF_CENTER
Definition gui_string.h:40
@ FONTO_HEADING
Definition gui_string.h:69
@ FONTO_DEFAULT
Definition gui_string.h:65
@ FONTO_BIG
Definition gui_string.h:70
@ FONTO_ATTENTION
Definition gui_string.h:67
#define create_utf8_from_char_fonto(string_in, fonto)
Definition gui_string.h:108
void queue_flush(void)
Definition mapview.c:152
void flush_all(void)
Definition mapview.c:201
SDL_Surface * theme_get_background(const struct theme *t, enum theme_background background)
@ BACKGROUND_CONNECTDLG
@ BACKGROUND_JOINGAMEDLG
@ BACKGROUND_USERPASSWDDLG
@ COLOR_THEME_CONNECTDLG_INNERFRAME
Definition themecolors.h:77
@ COLOR_THEME_JOINGAMEDLG_TEXT
Definition themecolors.h:92
@ COLOR_THEME_CONNECTDLG_FRAME
Definition themecolors.h:76
@ COLOR_THEME_USERPASSWDDLG_TEXT
struct theme * active_theme
Definition themespec.c:154
void add_to_gui_list(Uint16 id, struct widget *gui)
Definition widget.c:586
void unselect_widget_action(void)
Definition widget.c:418
Uint16 redraw_group(const struct widget *begin_group_widget_list, const struct widget *end_group_widget_list, int add_to_update)
Definition widget.c:720
void popdown_window_group_dialog(struct widget *begin_group_widget_list, struct widget *end_group_widget_list)
Definition widget.c:983
static void widget_set_position(struct widget *pwidget, int x, int y)
Definition widget.h:266
@ FC_WS_DISABLED
Definition widget.h:99
@ FC_WS_NORMAL
Definition widget.h:96
@ FC_WS_SELECTED
Definition widget.h:97
void clear_wflag(struct widget *pwidget, enum widget_flag flag)
Definition widget_core.c:62
static void widget_mark_dirty(struct widget *pwidget)
Definition widget.h:286
static void widget_flush(struct widget *pwidget)
Definition widget.h:291
void set_wstate(struct widget *pwidget, enum widget_state state)
Definition widget_core.c:36
@ WF_PASSWD_EDIT
Definition widget.h:90
@ WF_DRAW_FRAME_AROUND_WIDGET
Definition widget.h:86
@ WF_FREE_DATA
Definition widget.h:78
@ WF_FREE_STRING
Definition widget.h:76
@ WF_RESTORE_BACKGROUND
Definition widget.h:85
@ WF_HIDDEN
Definition widget.h:68
@ WF_DRAW_TEXT_LABEL_WITH_SPACE
Definition widget.h:87
static int widget_redraw(struct widget *pwidget)
Definition widget.h:276
static void widget_set_area(struct widget *pwidget, SDL_Rect area)
Definition widget.h:261
void set_wflag(struct widget *pwidget, enum widget_flag flag)
Definition widget_core.c:54
#define create_themeicon_button_from_chars_fonto(icon_theme, pdest, char_string, fonto, flags)
struct widget * create_edit(SDL_Surface *background, struct gui_layer *pdest, utf8_str *pstr, int length, Uint32 flags)
#define create_edit_from_chars_fonto(background, pdest, char_string, fonto, length, flags)
Definition widget_edit.h:29
struct widget * convert_iconlabel_to_themeiconlabel2(struct widget *icon_label)
struct widget * create_iconlabel(SDL_Surface *icon, struct gui_layer *pdest, utf8_str *pstr, Uint32 flags)
#define create_iconlabel_from_chars_fonto(picon, pdest, chars, fonto, flags)
void setup_vertical_scrollbar_area(struct scroll_bar *scroll, Sint16 start_x, Sint16 start_y, Uint16 height, bool swap_start_x)
Uint32 create_vertical_scrollbar(struct advanced_dialog *dlg, Uint8 step, Uint8 active, bool create_scrollbar, bool create_buttons)
bool resize_window(struct widget *pwindow, SDL_Surface *bcgd, SDL_Color *pcolor, Uint16 new_w, Uint16 new_h)
struct widget * create_window_skeleton(struct gui_layer *pdest, utf8_str *title, Uint32 flags)
#define log_normal(message,...)
Definition log.h:107
#define log_error(message,...)
Definition log.h:103
#define fc_calloc(n, esz)
Definition mem.h:38
#define FC_FREE(ptr)
Definition mem.h:41
int send_packet_authentication_reply(struct connection *pc, const struct packet_authentication_reply *packet)
void set_client_page(enum client_pages page)
struct srv_list * server_scan_get_list(struct server_scan *scan)
Definition servers.c:866
void server_scan_finish(struct server_scan *scan)
Definition servers.c:879
struct server_scan * server_scan_begin(enum server_scan_type type, ServerScanErrorFunc error_func)
Definition servers.c:755
enum server_scan_type server_scan_get_type(const struct server_scan *scan)
Definition servers.c:809
enum server_scan_status server_scan_poll(struct server_scan *scan)
Definition servers.c:832
#define server_list_iterate_end
Definition servers.h:57
#define server_list_iterate(serverlist, pserver)
Definition servers.h:55
@ SERVER_SCAN_LOCAL
Definition servers.h:68
@ SERVER_SCAN_LAST
Definition servers.h:70
@ SERVER_SCAN_GLOBAL
Definition servers.h:69
#define MAX(x, y)
Definition shared.h:54
struct widget * begin_active_widget_list
Definition widget.h:184
struct widget * end_widget_list
Definition widget.h:182
struct widget * end_active_widget_list
Definition widget.h:185
struct widget * active_widget_list
Definition widget.h:186
struct scroll_bar * scroll
Definition widget.h:187
struct widget * begin_widget_list
Definition widget.h:181
struct connection conn
Definition client_main.h:96
SDL_Surface * surface
Definition graphics.h:229
SDL_Event event
Definition graphics.h:217
char * host
Definition servers.h:30
char * version
Definition servers.h:34
char * message
Definition servers.h:37
char * state
Definition servers.h:35
int port
Definition servers.h:31
int nplayers
Definition servers.h:47
struct widget * begin_widget_list
Definition widget.h:175
struct widget * end_widget_list
Definition widget.h:176
fc_mutex mutex
Definition servers.h:64
struct server_list * servers
Definition servers.h:63
char * text
Definition gui_string.h:60
void * ptr
Definition widget.h:133
union widget::@194 data
struct widget * prev
Definition widget.h:114
struct gui_layer * dst
Definition widget.h:116
utf8_str * string_utf8
Definition widget.h:121
int(* action)(struct widget *)
Definition widget.h:157
SDL_Rect area
Definition widget.h:149
struct widget * next
Definition widget.h:113
SDL_Rect size
Definition widget.h:145
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:974
#define sz_strlcpy(dest, src)
Definition support.h:195
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
#define fc_strncmp(_s1_, _s2_, _len_)
Definition support.h:160