GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/models/fontsizechoicelistmodel.h Lines: 4 9 44.4 %
Date: 2017-11-29 Branches: 0 4 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2011-2017  The ManaPlus Developers
4
 *
5
 *  This file is part of The ManaPlus Client.
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  any later version.
11
 *
12
 *  This program is distributed in the hope that it will be useful,
13
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 *  GNU General Public License for more details.
16
 *
17
 *  You should have received a copy of the GNU General Public License
18
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 */
20
21
#ifndef GUI_MODELS_FONTSIZECHOICELISTMODEL_H
22
#define GUI_MODELS_FONTSIZECHOICELISTMODEL_H
23
24
#include "gui/models/listmodel.h"
25
26
#include "utils/gettext.h"
27
28
#include "localconsts.h"
29
30
const int maxFontSizes = 16;
31
32
const char *SIZE_NAME[maxFontSizes] =
33
{
34
    // TRANSLATORS: font size
35
    N_("Very small (8)"),
36
    // TRANSLATORS: font size
37
    N_("Very small (9)"),
38
    // TRANSLATORS: font size
39
    N_("Tiny (10)"),
40
    // TRANSLATORS: font size
41
    N_("Small (11)"),
42
    // TRANSLATORS: font size
43
    N_("Medium (12)"),
44
    // TRANSLATORS: font size
45
    N_("Normal (13)"),
46
    // TRANSLATORS: font size
47
    N_("Large (14)"),
48
    // TRANSLATORS: font size
49
    N_("Large (15)"),
50
    // TRANSLATORS: font size
51
    N_("Large (16)"),
52
    // TRANSLATORS: font size
53
    N_("Big (17)"),
54
    // TRANSLATORS: font size
55
    N_("Big (18)"),
56
    // TRANSLATORS: font size
57
    N_("Big (19)"),
58
    // TRANSLATORS: font size
59
    N_("Very big (20)"),
60
    // TRANSLATORS: font size
61
    N_("Very big (21)"),
62
    // TRANSLATORS: font size
63
    N_("Very big (22)"),
64
    // TRANSLATORS: font size
65
    N_("Huge (23)")
66
};
67
68
class FontSizeChoiceListModel final : public ListModel
69
{
70
    public:
71
        FontSizeChoiceListModel() :
72
16
            ListModel()
73
        { }
74
75
        A_DELETE_COPY(FontSizeChoiceListModel)
76
77
        ~FontSizeChoiceListModel()
78
8
        { }
79
80
56
        int getNumberOfElements() override final A_WARN_UNUSED
81
56
        { return maxFontSizes; }
82
83
        std::string getElementAt(int i) override final A_WARN_UNUSED
84
        {
85
            if (i >= getNumberOfElements() || i < 0)
86
                return "???";
87
88
            return gettext(SIZE_NAME[i]);
89
        }
90
};
91
92
#endif  // GUI_MODELS_FONTSIZECHOICELISTMODEL_H