1 #include "dialog_termsofservice.qh"
4 #include "mainwindow.qh"
5 #include "dialog_firstrun.qh"
7 #include "textlabel.qh"
11 void Close_Clicked(entity btn, entity me)
13 LOG_INFOF("Accepted ToS version %d", _Nex_ExtResponseSystem_NewToS);
14 cvar_set("_termsofservice_accepted", ftos(_Nex_ExtResponseSystem_NewToS));
15 localcmd("saveconfig\n");
16 if (main.firstRunDialog.shouldShow())
17 main.firstDraw = true;
18 Dialog_Close(btn, me);
21 void DontAccept_Clicked(entity btn, entity me)
26 void XonoticToSDialog_loadXonoticToS(entity me)
28 url_single_fopen(termsofservice_url, FILE_READ, XonoticToS_OnGet, me);
31 void XonoticToS_OnGet(entity fh, entity me, int status)
34 case URL_READY_CLOSED:
40 me.textBox.setText(me.textBox, "Error reading ToS");
43 case URL_READY_CANREAD:
46 for (string s; (s = url_fgets(fh)); )
49 temp = strcat(temp, "\n", s);
54 me.textBox.setText(me.textBox, temp);
64 bool XonoticToSDialog_shouldShow()
66 return (_Nex_ExtResponseSystem_NewToS && _Nex_ExtResponseSystem_NewToS > autocvar__termsofservice_accepted);
69 void XonoticToSDialog_fill(entity me)
74 if (autocvar__termsofservice_accepted > 0)
75 subtitle = _("Terms of Service have been updated. Please read them before continuing:");
77 subtitle = _("Welcome to Xonotic! Please read the following Terms of Service:");
80 me.TD(me, 1, 5, e = makeXonoticTextLabel(0, subtitle));
85 me.TD(me, me.rows - 4, me.columns, me.textBox = makeXonoticTextBox());
86 me.textBox.allowColors = true;
89 me.gotoRC(me, me.rows - 1, 0);
91 me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Accept"), '0 1 0'));
92 e.onClick = Close_Clicked;
95 me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Don't accept (quit the game)"), '1 0 0'));
96 e.onClick = DontAccept_Clicked;