Xonotic
dialog_termsofservice.qc File Reference
#include "dialog_termsofservice.qh"
#include "../menu.qh"
#include "mainwindow.qh"
#include "dialog_firstrun.qh"
#include "textbox.qh"
#include "textlabel.qh"
#include "button.qh"
#include "util.qh"
+ Include dependency graph for dialog_termsofservice.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void Close_Clicked (entity btn, entity me)
 
void DontAccept_Clicked (entity btn, entity me)
 
void XonoticToS_OnGet (entity fh, entity me, int status)
 
void XonoticToSDialog_fill (entity me)
 
void XonoticToSDialog_loadXonoticToS (entity me)
 
bool XonoticToSDialog_shouldShow ()
 

Function Documentation

◆ Close_Clicked()

void Close_Clicked ( entity  btn,
entity  me 
)

Definition at line 11 of file dialog_termsofservice.qc.

References _Nex_ExtResponseSystem_NewToS, cvar_set(), Dialog_Close(), ftos(), localcmd, LOG_INFOF, and main.

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 }
#define LOG_INFOF(...)
Definition: log.qh:71
+ Here is the call graph for this function:

◆ DontAccept_Clicked()

void DontAccept_Clicked ( entity  btn,
entity  me 
)

Definition at line 21 of file dialog_termsofservice.qc.

References localcmd.

22 {
23  localcmd("quit\n");
24 }

◆ XonoticToS_OnGet()

void XonoticToS_OnGet ( entity  fh,
entity  me,
int  status 
)

Definition at line 31 of file dialog_termsofservice.qc.

References strcat(), strfree, strzone(), url_fclose(), url_fgets(), URL_READY_CANREAD, URL_READY_CLOSED, and URL_READY_ERROR.

Referenced by XonoticToSDialog_loadXonoticToS().

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 }
const float URL_READY_CANREAD
Definition: urllib.qh:17
const float URL_READY_CLOSED
Definition: urllib.qh:15
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"))
ERASEABLE void url_fclose(entity e)
Definition: urllib.qc:207
const float URL_READY_ERROR
Definition: urllib.qh:14
#define strfree(this)
Definition: string.qh:56
ERASEABLE string url_fgets(entity e)
Definition: urllib.qc:287
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XonoticToSDialog_fill()

void XonoticToSDialog_fill ( entity  me)

Definition at line 72 of file dialog_termsofservice.qc.

References autocvar__termsofservice_accepted, and entity().

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 }
void DontAccept_Clicked(entity btn, entity me)
entity() spawn
entity makeXonoticTextLabel(float theAlign, string theText)
Definition: textlabel.qc:3
void Close_Clicked(entity btn, entity me)
entity makeXonoticTextBox()
Definition: textbox.qc:4
int autocvar__termsofservice_accepted
+ Here is the call graph for this function:

◆ XonoticToSDialog_loadXonoticToS()

void XonoticToSDialog_loadXonoticToS ( entity  me)

Definition at line 26 of file dialog_termsofservice.qc.

References FILE_READ, termsofservice_url, url_single_fopen(), and XonoticToS_OnGet().

27 {
29 }
const float FILE_READ
Definition: csprogsdefs.qc:231
void XonoticToS_OnGet(entity fh, entity me, int status)
ERASEABLE void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
Definition: urllib.qc:87
const string termsofservice_url
+ Here is the call graph for this function:

◆ XonoticToSDialog_shouldShow()

bool XonoticToSDialog_shouldShow ( )