1 |
|
|
/* |
2 |
|
|
* The ManaPlus Client |
3 |
|
|
* Copyright (C) 2011-2012 The Mana Developers |
4 |
|
|
* Copyright (C) 2012-2019 The ManaPlus Developers |
5 |
|
|
* Copyright (C) 2019-2021 Andrei Karas |
6 |
|
|
* |
7 |
|
|
* This file is part of The ManaPlus Client. |
8 |
|
|
* |
9 |
|
|
* This program is free software; you can redistribute it and/or modify |
10 |
|
|
* it under the terms of the GNU General Public License as published by |
11 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
12 |
|
|
* any later version. |
13 |
|
|
* |
14 |
|
|
* This program is distributed in the hope that it will be useful, |
15 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 |
|
|
* GNU General Public License for more details. |
18 |
|
|
* |
19 |
|
|
* You should have received a copy of the GNU General Public License |
20 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
#ifndef GUI_MODELS_TYPELISTMODEL_H |
24 |
|
|
#define GUI_MODELS_TYPELISTMODEL_H |
25 |
|
|
|
26 |
|
|
#include "gui/models/listmodel.h" |
27 |
|
|
|
28 |
|
|
/** |
29 |
|
|
* Server Type List Model |
30 |
|
|
*/ |
31 |
|
1 |
class TypeListModel final : public ListModel |
32 |
|
|
{ |
33 |
|
|
public: |
34 |
|
|
TypeListModel() : |
35 |
|
2 |
ListModel() |
36 |
|
|
{ } |
37 |
|
|
|
38 |
|
|
A_DELETE_COPY(TypeListModel) |
39 |
|
|
|
40 |
|
|
/** |
41 |
|
|
* Used to get number of line in the list |
42 |
|
|
*/ |
43 |
|
8 |
int getNumberOfElements() override final A_WARN_UNUSED |
44 |
|
|
#if defined(TMWA_SUPPORT) |
45 |
|
8 |
{ return 3; } |
46 |
|
|
#else // defined(TMWA_SUPPORT) |
47 |
|
|
{ return 2; } |
48 |
|
|
#endif // defined(TMWA_SUPPORT) |
49 |
|
|
|
50 |
|
|
/** |
51 |
|
|
* Used to get an element from the list |
52 |
|
|
*/ |
53 |
|
1 |
std::string getElementAt(int elementIndex) |
54 |
|
|
override final A_WARN_UNUSED |
55 |
|
|
{ |
56 |
|
|
#ifdef TMWA_SUPPORT |
57 |
✓✗ |
1 |
if (elementIndex == 0) |
58 |
|
3 |
return "TmwAthena"; |
59 |
|
|
else if (elementIndex == 1) |
60 |
|
|
return "Hercules"; |
61 |
|
|
else if (elementIndex == 2) |
62 |
|
|
return "Evol2"; |
63 |
|
|
else |
64 |
|
|
#else // TMWA_SUPPORT |
65 |
|
|
if (elementIndex == 0) |
66 |
|
|
return "Hercules"; |
67 |
|
|
else if (elementIndex == 1) |
68 |
|
|
return "Evol2"; |
69 |
|
|
else |
70 |
|
|
#endif // TMWA_SUPPORT |
71 |
|
|
return "Unknown"; |
72 |
|
|
} |
73 |
|
|
}; |
74 |
|
|
|
75 |
|
|
#endif // GUI_MODELS_TYPELISTMODEL_H |