GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/gui/widgets/tabs/socialattacktab.h Lines: 13 18 72.2 %
Date: 2017-11-29 Branches: 7 78 9.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_WIDGETS_TABS_SOCIALATTACKTAB_H
22
#define GUI_WIDGETS_TABS_SOCIALATTACKTAB_H
23
24
#include "gui/widgets/tabs/socialtab.h"
25
26
#include "being/localplayer.h"
27
28
#include "gui/models/beingslistmodel.h"
29
30
#include "gui/widgets/tabs/socialtabbase.h"
31
32
#include "utils/delete2.h"
33
#include "utils/gettext.h"
34
35
#include "localconsts.h"
36
37
class SocialAttackTab final : public SocialTab
38
{
39
    public:
40
2
        SocialAttackTab(const Widget2 *const widget,
41
2
                        const Opaque showBackground) :
42
            SocialTab(widget),
43
4
            mBeings(new BeingsListModel)
44
        {
45
2
            createControls(mBeings, showBackground);
46
47
            // TRANSLATORS: Attack filter tab name in social window.
48
            // TRANSLATORS: Should be small
49

8
            setCaption(_("Atk"));
50
4
            mMenuAction = "attack";
51
2
        }
52
53
        A_DELETE_COPY(SocialAttackTab)
54
55
4
        ~SocialAttackTab()
56
4
        {
57
2
            delete2(mList)
58
2
            delete2(mScroll)
59
4
            delete2(mBeings)
60
4
        }
61
62
        void updateList() override final
63
        {
64
            updateAtkListStart();
65
            // TRANSLATORS: mobs group name in social window
66
            addAvatars(PriorityAttackMob, _("Priority mobs"), PRIORITY);
67
            // TRANSLATORS: mobs group name in social window
68
            addAvatars(AttackMob, _("Attack mobs"), ATTACK);
69
            // TRANSLATORS: mobs group name in social window
70
            addAvatars(IgnoreAttackMob, _("Ignore mobs"), IGNORE_);
71
        }
72
73
    private:
74
        BeingsListModel *mBeings;
75
};
76
77
#endif  // GUI_WIDGETS_TABS_SOCIALATTACKTAB_H