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

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2009  The Mana World Development Team
4
 *  Copyright (C) 2009-2010  Andrei Karas
5
 *  Copyright (C) 2011-2017  The ManaPlus Developers
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_WINDOWS_KILLSTATS_H
24
#define GUI_WINDOWS_KILLSTATS_H
25
26
#include "listeners/actionlistener.h"
27
#include "listeners/attributelistener.h"
28
29
#include "gui/widgets/window.h"
30
31
class Label;
32
class Button;
33
34
class KillStats final : public Window,
35
                        public ActionListener,
36
                        public AttributeListener
37
{
38
    public:
39
        /**
40
         * Constructor.
41
         */
42
        KillStats();
43
44
        A_DELETE_COPY(KillStats)
45
46
        /**
47
         * Destructor.
48
         */
49
2
        ~KillStats()
50
6
        { }
51
52
        /**
53
         * Stuff.
54
         */
55
        void action(const ActionEvent &event) override final;
56
57
        void gainXp(int64_t Xp);
58
59
        /**
60
         * Recalc stats if needed
61
         */
62
        void recalcStats();
63
64
        /**
65
         * Updates this dialog
66
         */
67
        void update();
68
69
        void resetTimes();
70
71
        void attributeChanged(const AttributesT id,
72
                              const int64_t oldVal,
73
                              const int64_t newVal) override final;
74
75
    private:
76
        time_t mKillTimer;  /**< Timer for kill stats. */
77
        Button *mResetButton A_NONNULLPOINTER;
78
        Button *mTimerButton A_NONNULLPOINTER;
79
        Label *mLine1;
80
        Label *mLine2;
81
        Label *mLine3;
82
        Label *mLine4 A_NONNULLPOINTER;
83
        Label *mLine5 A_NONNULLPOINTER;
84
        Label *mLine6 A_NONNULLPOINTER;
85
        Label *mLine7 A_NONNULLPOINTER;
86
87
        Label *mExpSpeed1Label A_NONNULLPOINTER;
88
        Label *mExpTime1Label A_NONNULLPOINTER;
89
        Label *mExpSpeed5Label A_NONNULLPOINTER;
90
        Label *mExpTime5Label A_NONNULLPOINTER;
91
        Label *mExpSpeed15Label A_NONNULLPOINTER;
92
        Label *mExpTime15Label A_NONNULLPOINTER;
93
94
        Label *mLastKillExpLabel A_NONNULLPOINTER;
95
96
        int mKillCounter;   /**< Session Kill counter. */
97
        int64_t mExpCounter;  /**< Session Exp counter. */
98
        int mKillTCounter;   /**< Timer Kill counter. */
99
        int64_t mExpTCounter;    /**< Timer Exp counter. */
100
101
        time_t m1minExpTime;
102
        int64_t m1minExpNum;
103
        int m1minSpeed;
104
105
        time_t m5minExpTime;
106
        int64_t m5minExpNum;
107
        int m5minSpeed;
108
109
        time_t m15minExpTime;
110
        int64_t m15minExpNum;
111
        int m15minSpeed;
112
};
113
114
extern KillStats *killStats;
115
116
#endif  // GUI_WINDOWS_KILLSTATS_H