Xonotic
dialog_termsofservice.qc
Go to the documentation of this file.
2 
3 #include "../menu.qh"
4 #include "mainwindow.qh"
5 #include "dialog_firstrun.qh"
6 #include "textbox.qh"
7 #include "textlabel.qh"
8 #include "button.qh"
9 #include "util.qh"
10 
12 {
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);
19 }
20 
22 {
23  localcmd("quit\n");
24 }
25 
27 {
29 }
30 
31 void XonoticToS_OnGet(entity fh, entity me, int status)
32 {
33  switch (status) {
34  case URL_READY_CLOSED:
35  {
36  break;
37  }
38  case URL_READY_ERROR:
39  {
40  me.text = strzone("Error reading ToS");
41  me.textBox.setText(me.textBox, me.text);
42  break;
43  }
44  case URL_READY_CANREAD:
45  {
46  strfree(me.text);
47  string temp = "";
48  for (string s; (s = url_fgets(fh)); )
49  {
50  if (temp != "")
51  temp = strcat(temp, "\n", s);
52  else
53  temp = s;
54  }
55  url_fclose(fh);
56  me.text = strzone(temp);
57  me.textBox.setText(me.textBox, me.text);
58  break;
59  }
60  default:
61  {
62  break;
63  }
64  }
65 }
66 
68 {
70 }
71 
73 {
74  entity e;
75  string subtitle;
76 
78  subtitle = _("Terms of Service have been updated. Please read them before continuing:");
79  else
80  subtitle = _("Welcome to Xonotic! Please read the following Terms of Service:");
81 
82  me.TR(me);
83  me.TD(me, 1, 5, e = makeXonoticTextLabel(0, subtitle));
84  e.allowWrap = 1;
85 
86  me.TR(me);
87  me.TR(me);
88  me.TD(me, me.rows - 4, me.columns, me.textBox = makeXonoticTextBox());
89 
90  me.TR(me);
91  me.gotoRC(me, me.rows - 1, 0);
92 
93  me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Accept"), '0 1 0'));
94  e.onClick = Close_Clicked;
95  e.onClickEntity = me;
96 
97  me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Don't accept (quit the game)"), '1 0 0'));
98  e.onClick = DontAccept_Clicked;
99  e.onClickEntity = me;
100 }
101 
const float URL_READY_CANREAD
Definition: urllib.qh:17
const float URL_READY_CLOSED
Definition: urllib.qh:15
void DontAccept_Clicked(entity btn, entity me)
entity() spawn
entity makeXonoticTextLabel(float theAlign, string theText)
Definition: textlabel.qc:3
const float FILE_READ
Definition: csprogsdefs.qc:231
bool XonoticToSDialog_shouldShow()
void Close_Clicked(entity btn, entity me)
void XonoticToS_OnGet(entity fh, entity me, int status)
#define LOG_INFOF(...)
Definition: log.qh:71
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
entity makeXonoticTextBox()
Definition: textbox.qc:4
ERASEABLE void url_fclose(entity e)
Definition: urllib.qc:207
void XonoticToSDialog_fill(entity me)
ERASEABLE void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
Definition: urllib.qc:87
const float URL_READY_ERROR
Definition: urllib.qh:14
#define strfree(this)
Definition: string.qh:56
const string termsofservice_url
int autocvar__termsofservice_accepted
ERASEABLE string url_fgets(entity e)
Definition: urllib.qc:287
void XonoticToSDialog_loadXonoticToS(entity me)