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");
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 string downloadurl = "http://maria.omaera.org/tos.txt";
29 url_single_fopen(downloadurl, FILE_READ, XonoticToS_OnGet, me);
32 void XonoticToS_OnGet(entity fh, entity me, int status)
35 case URL_READY_CLOSED:
41 me.text = strzone("Error reading ToS");
42 me.textBox.setText(me.textBox, me.text);
45 case URL_READY_CANREAD:
49 for (string s; (s = url_fgets(fh)); )
52 temp = strcat(temp, "\n", s);
57 me.text = strzone(temp);
58 me.textBox.setText(me.textBox, me.text);
68 bool XonoticToSDialog_shouldShow()
70 return (_Nex_ExtResponseSystem_NewToS && _Nex_ExtResponseSystem_NewToS > autocvar__termsofservice_accepted);
73 void XonoticToSDialog_fill(entity me)
78 if (autocvar__termsofservice_accepted > 0)
79 subtitle = _("Terms of Service have been updated. Please read them before continuing:");
81 subtitle = _("Welcome to Xonotic! Please read the following Terms of Service:");
84 me.TD(me, 1, 5, e = makeXonoticTextLabel(0, subtitle));
89 me.TD(me, me.rows - 4, me.columns, me.textBox = makeXonoticTextBox());
90 me.loadXonoticToS(me);
93 me.gotoRC(me, me.rows - 1, 0);
95 me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Accept"), '0 0 0'));
96 e.onClick = Close_Clicked;
99 me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Don't accept (quit the game)"), '0 0 0'));
100 e.onClick = DontAccept_Clicked;
101 e.onClickEntity = me;