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

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2010  The Mana Developers
4
 *  Copyright (C) 2011-2017  The ManaPlus Developers
5
 *
6
 *  This file is part of The ManaPlus Client.
7
 *
8
 *  This program is free software; you can redistribute it and/or modify
9
 *  it under the terms of the GNU General Public License as published by
10
 *  the Free Software Foundation; either version 2 of the License, or
11
 *  any later version.
12
 *
13
 *  This program is distributed in the hope that it will be useful,
14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 *  GNU General Public License for more details.
17
 *
18
 *  You should have received a copy of the GNU General Public License
19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
#ifndef GUI_WINDOWS_SOCIALWINDOW_H
23
#define GUI_WINDOWS_SOCIALWINDOW_H
24
25
#include "gui/widgets/window.h"
26
27
#include "listeners/actionlistener.h"
28
#include "listeners/playerrelationslistener.h"
29
30
class Button;
31
class ConfirmDialog;
32
class Guild;
33
class Label;
34
class Map;
35
class Party;
36
class SocialTab;
37
class TabbedArea;
38
class TextDialog;
39
40
/**
41
 * Party window.
42
 *
43
 * \ingroup Interface
44
 */
45
class SocialWindow final : public Window,
46
                           private ActionListener,
47
                           public PlayerRelationsListener
48
{
49
    public:
50
        SocialWindow();
51
52
        A_DELETE_COPY(SocialWindow)
53
54
        ~SocialWindow();
55
56
        void postInit() override final;
57
58
        bool addTab(Guild *const guild);
59
60
        bool removeTab(Guild *const guild);
61
62
        bool addTab(Party *const party);
63
64
        bool removeTab(Party *const party);
65
66
        void action(const ActionEvent &event) override final;
67
68
        void showGuildInvite(const std::string &restrict guildName,
69
                             const int guildId,
70
                             const std::string &restrict inviterName);
71
72
        void showPartyInvite(const std::string &restrict partyName,
73
                             const std::string &restrict inviter,
74
                             const int partyId);
75
76
        void updateActiveList();
77
78
        void updateAvatar(const std::string &name);
79
80
        void resetDamage(const std::string &name);
81
82
        void slowLogic();
83
84
        void updatePortals();
85
86
        void updatePortalNames();
87
88
        void updateParty();
89
90
        int getPortalIndex(const int x, const int y) A_WARN_UNUSED;
91
92
        void addPortal(const int x, const int y);
93
94
        void removePortal(const int x, const int y);
95
96
        void nextTab();
97
98
        void prevTab();
99
100
        const Map* getMap() const noexcept2 A_WARN_UNUSED
101
        { return mMap; }
102
103
        void setMap(Map *const map)
104
        { mMap = map; mProcessedPortals = false; }
105
106
        bool getProcessedPortals() const noexcept2 A_WARN_UNUSED
107
        { return mProcessedPortals; }
108
109
        void setProcessedPortals(const bool n) noexcept2
110
        { mProcessedPortals = n; }
111
112
        void selectPortal(const unsigned num);
113
114
        void updateAttackFilter();
115
116
        void updatePickupFilter();
117
118
        void widgetResized(const Event &event) override final;
119
120
        void updateCounter(const SocialTab *const tab,
121
                           const std::string &count);
122
123
        void updateMenu(const SocialTab *const tab,
124
                        const std::string &menu);
125
126
        void updateGuildCounter(const int online = 0, const int total = 0);
127
128
        void updatedPlayer(const std::string &name) override final;
129
130
        void updateAll() override final;
131
132
#ifdef USE_PROFILER
133
        void logicChildren();
134
#endif  // USE_PROFILER
135
136
    protected:
137
        friend class SocialTab;
138
        typedef std::map<Guild*, SocialTab*> GuildMap;
139
        typedef std::map<Party*, SocialTab*> PartyMap;
140
141
        void updateButtons();
142
143
        int mGuildInvited;
144
        ConfirmDialog *mGuildAcceptDialog;
145
        TextDialog *mGuildCreateDialog;
146
        std::string mPartyInviter;
147
        GuildMap mGuilds;
148
        PartyMap mParties;
149
150
        ConfirmDialog *mPartyAcceptDialog;
151
152
        SocialTab *mAttackFilter;
153
        SocialTab *mPickupFilter;
154
        SocialTab *mPlayers A_NONNULLPOINTER;
155
        SocialTab *mNavigation A_NONNULLPOINTER;
156
        SocialTab *mFriends A_NONNULLPOINTER;
157
158
        Button *mMenuButton A_NONNULLPOINTER;
159
        Label *mCountLabel A_NONNULLPOINTER;
160
        TabbedArea *mTabs A_NONNULLPOINTER;
161
        Map *mMap;
162
163
        time_t mLastUpdateTime;
164
        int mPartyId;
165
        bool mNeedUpdate;
166
        bool mProcessedPortals;
167
};
168
169
extern SocialWindow *socialWindow;
170
171
#endif  // GUI_WINDOWS_SOCIALWINDOW_H