mirror-chatterino2/src/util/DebugCount.hpp
nerix 7ecbfa0cdb
refactor: debug count and popup (#4921)
* Moved implementation of the methods to the `cpp` file.
* Added `DebugCount::Flag(s)` and `DebugCount::configure(name, flags)`.
* Moved from `QMap` to `std::map` (order is important here).
* Used `QStringBuilder` for concatenations.
* Used `QLocale` for formatting (adds separators).
* Added `DebugCount::Flag::DataSize` for data sizes in bytes (and fixed language to English).
* Used `DataSize` for image sizes (maybe this should be moved somewhere else?).
* Added copy button to popup.
* Fixed Image usage reporting being eight times too large (could be another PR, but honestly it's four characters).
2023-10-28 21:17:32 +02:00

38 lines
815 B
C++

#pragma once
#include "common/FlagsEnum.hpp"
#include <QString>
namespace chatterino {
class DebugCount
{
public:
enum class Flag : uint16_t {
None = 0,
/// The value is a data size in bytes
DataSize = 1 << 0,
};
using Flags = FlagsEnum<Flag>;
static void configure(const QString &name, Flags flags);
static void set(const QString &name, const int64_t &amount);
static void increase(const QString &name, const int64_t &amount);
static void increase(const QString &name)
{
DebugCount::increase(name, 1);
}
static void decrease(const QString &name, const int64_t &amount);
static void decrease(const QString &name)
{
DebugCount::decrease(name, 1);
}
static QString getDebugText();
};
} // namespace chatterino