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).
This commit is contained in:
@@ -108,7 +108,7 @@ namespace detail {
|
||||
{
|
||||
auto sz = frame.image.size();
|
||||
auto area = sz.width() * sz.height();
|
||||
auto memory = area * frame.image.depth();
|
||||
auto memory = area * frame.image.depth() / 8;
|
||||
|
||||
usage += memory;
|
||||
}
|
||||
@@ -608,6 +608,13 @@ ImageExpirationPool::ImageExpirationPool()
|
||||
this->freeTimer_->start(
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(
|
||||
IMAGE_POOL_CLEANUP_INTERVAL));
|
||||
|
||||
// configure all debug counts used by images
|
||||
DebugCount::configure("image bytes", DebugCount::Flag::DataSize);
|
||||
DebugCount::configure("image bytes (ever loaded)",
|
||||
DebugCount::Flag::DataSize);
|
||||
DebugCount::configure("image bytes (ever unloaded)",
|
||||
DebugCount::Flag::DataSize);
|
||||
}
|
||||
|
||||
ImageExpirationPool &ImageExpirationPool::instance()
|
||||
|
||||
Reference in New Issue
Block a user