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.text = strzone("Error reading ToS");
41 me.textBox.setText(me.textBox, me.text);
44 case URL_READY_CANREAD:
48 for (string s; (s = url_fgets(fh)); )
51 temp = strcat(temp, "\n", s);
56 me.text = strzone(temp);
57 me.textBox.setText(me.textBox, me.text);
67 bool XonoticToSDialog_shouldShow()
69 return (_Nex_ExtResponseSystem_NewToS && _Nex_ExtResponseSystem_NewToS > autocvar__termsofservice_accepted);
72 void XonoticToSDialog_fill(entity me)
77 if (autocvar__termsofservice_accepted > 0)
78 subtitle = _("Terms of Service have been updated. Please read them before continuing:");
80 subtitle = _("Welcome to Xonotic! Please read the following Terms of Service:");
83 me.TD(me, 1, 5, e = makeXonoticTextLabel(0, subtitle));
88 me.TD(me, me.rows - 4, me.columns, me.textBox = makeXonoticTextBox());
89 me.textBox.allowColors = true;
92 me.gotoRC(me, me.rows - 1, 0);
94 me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Accept"), '0 1 0'));
95 e.onClick = Close_Clicked;
98 me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Don't accept (quit the game)"), '1 0 0'));
99 e.onClick = DontAccept_Clicked;
100 e.onClickEntity = me;