tooltipgenerator.cpp
1 //------------------------------------------------------------------------------
2 // tooltipgenerator.cpp
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2010 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #include "tooltipgenerator.h"
24 
25 #include "serverapi/tooltips/dmflagshtmlgenerator.h"
26 #include "serverapi/tooltips/gameinfotip.h"
27 #include "serverapi/tooltips/generalinfotip.h"
28 #include "serverapi/tooltips/playertable.h"
29 #include "serverapi/server.h"
30 
31 DClass<TooltipGenerator>
32 {
33  public:
34  ServerCPtr server;
35 };
36 
37 DPointered(TooltipGenerator)
38 
39 TooltipGenerator::TooltipGenerator(const ServerCPtr &server)
40 {
41  d->server = server;
42 }
43 
44 TooltipGenerator::~TooltipGenerator()
45 {
46 }
47 
49 {
50  DmflagsHtmlGenerator generator(server());
51  return generator.generate();
52 }
53 
55 {
56  GameInfoTip tip(server());
57  return tip.generateHTML();
58 }
59 
61 {
62  GeneralInfoTip tip(server());
63  return tip.generateHTML();
64 }
65 
67 {
68  PlayerTable table(server());
69  return table.generateHTML();
70 }
71 
72 ServerCPtr TooltipGenerator::server() const
73 {
74  return d->server;
75 }
virtual QString generalInfoHTML()
General info about server, like server name, version, email, etc.
virtual QString gameInfoTableHTML()
General info about current game (fraglimit, team scores, etc.)
virtual QString dmflagsHTML()
DMFLAGS listing for the current server.
virtual QString playerTableHTML()
Player table that is created when cursor hovers over players column.