added debug information on F10
This commit is contained in:
+6
-2
@@ -178,7 +178,9 @@ SOURCES += \
|
|||||||
src/providers/irc/ircchannel2.cpp \
|
src/providers/irc/ircchannel2.cpp \
|
||||||
src/util/streamlink.cpp \
|
src/util/streamlink.cpp \
|
||||||
src/providers/twitch/twitchhelpers.cpp \
|
src/providers/twitch/twitchhelpers.cpp \
|
||||||
src/widgets/helper/signallabel.cpp
|
src/widgets/helper/signallabel.cpp \
|
||||||
|
src/widgets/helper/debugpopup.cpp \
|
||||||
|
src/util/debugcount.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
src/precompiled_header.hpp \
|
src/precompiled_header.hpp \
|
||||||
@@ -292,7 +294,9 @@ HEADERS += \
|
|||||||
src/providers/irc/ircserver.hpp \
|
src/providers/irc/ircserver.hpp \
|
||||||
src/providers/irc/ircchannel2.hpp \
|
src/providers/irc/ircchannel2.hpp \
|
||||||
src/util/streamlink.hpp \
|
src/util/streamlink.hpp \
|
||||||
src/providers/twitch/twitchhelpers.hpp
|
src/providers/twitch/twitchhelpers.hpp \
|
||||||
|
src/util/debugcount.hpp \
|
||||||
|
src/widgets/helper/debugpopup.hpp
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources/resources.qrc
|
resources/resources.qrc
|
||||||
|
|||||||
+1
-1
Submodule lib/settings updated: ad31b38866...2fa3adf42d
@@ -30,6 +30,7 @@ Image::Image(const QString &url, qreal scale, const QString &name, const QString
|
|||||||
, scale(scale)
|
, scale(scale)
|
||||||
, isLoading(false)
|
, isLoading(false)
|
||||||
{
|
{
|
||||||
|
util::DebugCount::increase("images");
|
||||||
}
|
}
|
||||||
|
|
||||||
Image::Image(QPixmap *image, qreal scale, const QString &name, const QString &tooltip,
|
Image::Image(QPixmap *image, qreal scale, const QString &name, const QString &tooltip,
|
||||||
@@ -43,6 +44,20 @@ Image::Image(QPixmap *image, qreal scale, const QString &name, const QString &to
|
|||||||
, isLoading(true)
|
, isLoading(true)
|
||||||
, isLoaded(true)
|
, isLoaded(true)
|
||||||
{
|
{
|
||||||
|
util::DebugCount::increase("images");
|
||||||
|
}
|
||||||
|
|
||||||
|
Image::~Image()
|
||||||
|
{
|
||||||
|
util::DebugCount::decrease("images");
|
||||||
|
|
||||||
|
if (this->isAnimated()) {
|
||||||
|
util::DebugCount::decrease("animated images");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->isLoaded) {
|
||||||
|
util::DebugCount::decrease("loaded images");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image::loadImage()
|
void Image::loadImage()
|
||||||
@@ -79,11 +94,14 @@ void Image::loadImage()
|
|||||||
|
|
||||||
if (lli->allFrames.size() > 1) {
|
if (lli->allFrames.size() > 1) {
|
||||||
lli->animated = true;
|
lli->animated = true;
|
||||||
|
|
||||||
|
util::DebugCount::increase("animated images");
|
||||||
}
|
}
|
||||||
|
|
||||||
lli->currentPixmap = lli->loadedPixmap;
|
lli->currentPixmap = lli->loadedPixmap;
|
||||||
|
|
||||||
lli->isLoaded = true;
|
lli->isLoaded = true;
|
||||||
|
util::DebugCount::increase("loaded images");
|
||||||
|
|
||||||
singletons::EmoteManager::getInstance().incGeneration();
|
singletons::EmoteManager::getInstance().incGeneration();
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ namespace messages {
|
|||||||
class Image : public QObject, boost::noncopyable
|
class Image : public QObject, boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Image() = delete;
|
|
||||||
|
|
||||||
explicit Image(const QString &_url, qreal _scale = 1, const QString &_name = "",
|
explicit Image(const QString &_url, qreal _scale = 1, const QString &_name = "",
|
||||||
const QString &_tooltip = "", const QMargins &_margin = QMargins(),
|
const QString &_tooltip = "", const QMargins &_margin = QMargins(),
|
||||||
bool isHat = false);
|
bool isHat = false);
|
||||||
@@ -21,6 +19,7 @@ public:
|
|||||||
explicit Image(QPixmap *_currentPixmap, qreal _scale = 1, const QString &_name = "",
|
explicit Image(QPixmap *_currentPixmap, qreal _scale = 1, const QString &_name = "",
|
||||||
const QString &_tooltip = "", const QMargins &_margin = QMargins(),
|
const QString &_tooltip = "", const QMargins &_margin = QMargins(),
|
||||||
bool isHat = false);
|
bool isHat = false);
|
||||||
|
~Image();
|
||||||
|
|
||||||
const QPixmap *getPixmap();
|
const QPixmap *getPixmap();
|
||||||
qreal getScale() const;
|
qreal getScale() const;
|
||||||
|
|||||||
@@ -25,6 +25,12 @@ MessageLayout::MessageLayout(MessagePtr _message)
|
|||||||
if (_message->flags & Message::Collapsed) {
|
if (_message->flags & Message::Collapsed) {
|
||||||
this->flags &= MessageLayout::Collapsed;
|
this->flags &= MessageLayout::Collapsed;
|
||||||
}
|
}
|
||||||
|
util::DebugCount::increase("message layout");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageLayout::~MessageLayout()
|
||||||
|
{
|
||||||
|
util::DebugCount::decrease("message layout");
|
||||||
}
|
}
|
||||||
|
|
||||||
Message *MessageLayout::getMessage()
|
Message *MessageLayout::getMessage()
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public:
|
|||||||
enum Flags : uint8_t { Collapsed, RequiresBufferUpdate, RequiresLayout };
|
enum Flags : uint8_t { Collapsed, RequiresBufferUpdate, RequiresLayout };
|
||||||
|
|
||||||
MessageLayout(MessagePtr message);
|
MessageLayout(MessagePtr message);
|
||||||
|
~MessageLayout();
|
||||||
|
|
||||||
Message *getMessage();
|
Message *getMessage();
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "messages/layouts/messagelayoutelement.hpp"
|
#include "messages/layouts/messagelayoutelement.hpp"
|
||||||
#include "messages/messageelement.hpp"
|
#include "messages/messageelement.hpp"
|
||||||
|
#include "util/debugcount.hpp"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
@@ -17,6 +18,12 @@ MessageLayoutElement::MessageLayoutElement(MessageElement &_creator, const QSize
|
|||||||
: creator(_creator)
|
: creator(_creator)
|
||||||
{
|
{
|
||||||
this->rect.setSize(size);
|
this->rect.setSize(size);
|
||||||
|
util::DebugCount::increase("message layout elements");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageLayoutElement::~MessageLayoutElement()
|
||||||
|
{
|
||||||
|
util::DebugCount::decrease("message layout elements");
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageElement &MessageLayoutElement::getCreator() const
|
MessageElement &MessageLayoutElement::getCreator() const
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class MessageLayoutElement : boost::noncopyable
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MessageLayoutElement(MessageElement &creator, const QSize &size);
|
MessageLayoutElement(MessageElement &creator, const QSize &size);
|
||||||
virtual ~MessageLayoutElement() = default;
|
virtual ~MessageLayoutElement();
|
||||||
|
|
||||||
const QRect &getRect() const;
|
const QRect &getRect() const;
|
||||||
MessageElement &getCreator() const;
|
MessageElement &getCreator() const;
|
||||||
|
|||||||
@@ -10,10 +10,22 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "util/debugcount.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace messages {
|
namespace messages {
|
||||||
|
|
||||||
struct Message {
|
struct Message {
|
||||||
|
Message()
|
||||||
|
{
|
||||||
|
util::DebugCount::increase("messages");
|
||||||
|
}
|
||||||
|
|
||||||
|
~Message()
|
||||||
|
{
|
||||||
|
util::DebugCount::decrease("messages");
|
||||||
|
}
|
||||||
|
|
||||||
enum MessageFlags : uint16_t {
|
enum MessageFlags : uint16_t {
|
||||||
None = 0,
|
None = 0,
|
||||||
System = (1 << 0),
|
System = (1 << 0),
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ namespace messages {
|
|||||||
MessageElement::MessageElement(Flags _flags)
|
MessageElement::MessageElement(Flags _flags)
|
||||||
: flags(_flags)
|
: flags(_flags)
|
||||||
{
|
{
|
||||||
|
util::DebugCount::increase("message elements");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageElement::~MessageElement()
|
||||||
|
{
|
||||||
|
util::DebugCount::decrease("message elements");
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageElement *MessageElement::setLink(const Link &_link)
|
MessageElement *MessageElement::setLink(const Link &_link)
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ public:
|
|||||||
Update_All = Update_Text | Update_Emotes | Update_Images
|
Update_All = Update_Text | Update_Emotes | Update_Images
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~MessageElement() = default;
|
virtual ~MessageElement();
|
||||||
|
|
||||||
MessageElement *setLink(const Link &link);
|
MessageElement *setLink(const Link &link);
|
||||||
MessageElement *setTooltip(const QString &tooltip);
|
MessageElement *setTooltip(const QString &tooltip);
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#include "debugcount.hpp"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace util {
|
||||||
|
|
||||||
|
QMap<QString, int64_t> DebugCount::counts;
|
||||||
|
std::mutex DebugCount::mut;
|
||||||
|
|
||||||
|
} // namespace util
|
||||||
|
} // namespace chatterino
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace util {
|
||||||
|
|
||||||
|
class DebugCount
|
||||||
|
{
|
||||||
|
static QMap<QString, int64_t> counts;
|
||||||
|
static std::mutex mut;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static void increase(const QString &name)
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(mut);
|
||||||
|
|
||||||
|
auto it = counts.find(name);
|
||||||
|
if (it == counts.end()) {
|
||||||
|
counts.insert(name, 1);
|
||||||
|
} else {
|
||||||
|
reinterpret_cast<int64_t &>(it.value())++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void decrease(const QString &name)
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(mut);
|
||||||
|
|
||||||
|
auto it = counts.find(name);
|
||||||
|
if (it == counts.end()) {
|
||||||
|
counts.insert(name, -1);
|
||||||
|
} else {
|
||||||
|
reinterpret_cast<int64_t &>(it.value())--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static QString getDebugText()
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(mut);
|
||||||
|
|
||||||
|
QString text;
|
||||||
|
for (auto it = counts.begin(); it != counts.end(); it++) {
|
||||||
|
text += it.key() + ": " + QString::number(it.value()) + "\n";
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString toString()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace util
|
||||||
|
} // namespace chatterino
|
||||||
@@ -95,9 +95,11 @@ ChannelView::ChannelView(BaseWidget *parent)
|
|||||||
|
|
||||||
this->pauseTimeout.setSingleShot(true);
|
this->pauseTimeout.setSingleShot(true);
|
||||||
|
|
||||||
auto e = new QResizeEvent(this->size(), this->size());
|
// auto e = new QResizeEvent(this->size(), this->size());
|
||||||
this->resizeEvent(e);
|
// this->resizeEvent(e);
|
||||||
delete e;
|
// delete e;
|
||||||
|
|
||||||
|
this->scrollBar.resize(this->scrollBar.width(), height());
|
||||||
|
|
||||||
singletons::SettingManager::getInstance().showLastMessageIndicator.connect(
|
singletons::SettingManager::getInstance().showLastMessageIndicator.connect(
|
||||||
[this](auto, auto) { this->update(); }, this->managedConnections);
|
[this](auto, auto) { this->update(); }, this->managedConnections);
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#include "debugpopup.hpp"
|
||||||
|
|
||||||
|
#include "util/debugcount.hpp"
|
||||||
|
|
||||||
|
#include <QFontDatabase>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
|
DebugPopup::DebugPopup()
|
||||||
|
{
|
||||||
|
auto *layout = new QHBoxLayout(this);
|
||||||
|
auto *text = new QLabel(this);
|
||||||
|
auto *timer = new QTimer(this);
|
||||||
|
|
||||||
|
timer->setInterval(1000);
|
||||||
|
QObject::connect(timer, &QTimer::timeout,
|
||||||
|
[text] { text->setText(util::DebugCount::getDebugText()); });
|
||||||
|
timer->start();
|
||||||
|
|
||||||
|
text->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
|
||||||
|
|
||||||
|
layout->addWidget(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace widgets
|
||||||
|
} // namespace chatterino
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QWindow>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace widgets {
|
||||||
|
|
||||||
|
class DebugPopup : public QWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DebugPopup();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace widgets
|
||||||
|
} // namespace chatterino
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "singletons/windowmanager.hpp"
|
#include "singletons/windowmanager.hpp"
|
||||||
#include "util/streamlink.hpp"
|
#include "util/streamlink.hpp"
|
||||||
#include "util/urlfetch.hpp"
|
#include "util/urlfetch.hpp"
|
||||||
|
#include "widgets/helper/debugpopup.hpp"
|
||||||
#include "widgets/helper/searchpopup.hpp"
|
#include "widgets/helper/searchpopup.hpp"
|
||||||
#include "widgets/helper/shortcut.hpp"
|
#include "widgets/helper/shortcut.hpp"
|
||||||
#include "widgets/qualitypopup.hpp"
|
#include "widgets/qualitypopup.hpp"
|
||||||
@@ -72,6 +73,13 @@ Split::Split(SplitContainer *parent, const std::string &_uuid)
|
|||||||
// CTRL+F: Search
|
// CTRL+F: Search
|
||||||
CreateShortcut(this, "CTRL+F", &Split::doSearch);
|
CreateShortcut(this, "CTRL+F", &Split::doSearch);
|
||||||
|
|
||||||
|
// F12
|
||||||
|
CreateShortcut(this, "F10", [] {
|
||||||
|
auto *popup = new DebugPopup;
|
||||||
|
popup->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
popup->show();
|
||||||
|
});
|
||||||
|
|
||||||
// xd
|
// xd
|
||||||
// CreateShortcut(this, "ALT+SHIFT+RIGHT", &Split::doIncFlexX);
|
// CreateShortcut(this, "ALT+SHIFT+RIGHT", &Split::doIncFlexX);
|
||||||
// CreateShortcut(this, "ALT+SHIFT+LEFT", &Split::doDecFlexX);
|
// CreateShortcut(this, "ALT+SHIFT+LEFT", &Split::doDecFlexX);
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ namespace widgets {
|
|||||||
|
|
||||||
class SplitContainer;
|
class SplitContainer;
|
||||||
|
|
||||||
|
class xD
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
// Each ChatWidget consists of three sub-elements that handle their own part of the chat widget:
|
// Each ChatWidget consists of three sub-elements that handle their own part of the chat widget:
|
||||||
// ChatWidgetHeader
|
// ChatWidgetHeader
|
||||||
// - Responsible for rendering which channel the ChatWidget is in, and the menu in the top-left of
|
// - Responsible for rendering which channel the ChatWidget is in, and the menu in the top-left of
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ SplitContainer::SplitContainer(Notebook *parent, NotebookTab *_tab, const std::s
|
|||||||
this->setHidden(true);
|
this->setHidden(true);
|
||||||
this->setAcceptDrops(true);
|
this->setAcceptDrops(true);
|
||||||
|
|
||||||
this->ui.parentLayout.addSpacing(2);
|
this->ui.parentLayout.addSpacing(1);
|
||||||
this->ui.parentLayout.addLayout(&this->ui.hbox);
|
this->ui.parentLayout.addLayout(&this->ui.hbox);
|
||||||
this->ui.parentLayout.setMargin(0);
|
this->ui.parentLayout.setMargin(0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user