removed namespaces
This commit is contained in:
+18
-18
@@ -1,13 +1,13 @@
|
||||
#include "messages/Image.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/NetworkManager.hpp"
|
||||
#include "common/UrlFetch.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "singletons/EmoteManager.hpp"
|
||||
#include "singletons/IrcManager.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
#include "common/NetworkManager.hpp"
|
||||
#include "util/PostToThread.hpp"
|
||||
#include "common/UrlFetch.hpp"
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QImageReader>
|
||||
@@ -32,7 +32,7 @@ Image::Image(const QString &url, qreal scale, const QString &name, const QString
|
||||
, ishat(isHat)
|
||||
, scale(scale)
|
||||
{
|
||||
util::DebugCount::increase("images");
|
||||
DebugCount::increase("images");
|
||||
}
|
||||
|
||||
Image::Image(QPixmap *image, qreal scale, const QString &name, const QString &tooltip,
|
||||
@@ -46,25 +46,25 @@ Image::Image(QPixmap *image, qreal scale, const QString &name, const QString &to
|
||||
, isLoading(true)
|
||||
, isLoaded(true)
|
||||
{
|
||||
util::DebugCount::increase("images");
|
||||
DebugCount::increase("images");
|
||||
}
|
||||
|
||||
Image::~Image()
|
||||
{
|
||||
util::DebugCount::decrease("images");
|
||||
DebugCount::decrease("images");
|
||||
|
||||
if (this->isAnimated()) {
|
||||
util::DebugCount::decrease("animated images");
|
||||
DebugCount::decrease("animated images");
|
||||
}
|
||||
|
||||
if (this->isLoaded) {
|
||||
util::DebugCount::decrease("loaded images");
|
||||
DebugCount::decrease("loaded images");
|
||||
}
|
||||
}
|
||||
|
||||
void Image::loadImage()
|
||||
{
|
||||
util::NetworkRequest req(this->getUrl());
|
||||
NetworkRequest req(this->getUrl());
|
||||
req.setCaller(this);
|
||||
req.setUseQuickLoadCache(true);
|
||||
req.get([this](QByteArray bytes) -> bool {
|
||||
@@ -80,21 +80,21 @@ void Image::loadImage()
|
||||
// clear stuff before loading the image again
|
||||
this->allFrames.clear();
|
||||
if (this->isAnimated()) {
|
||||
util::DebugCount::decrease("animated images");
|
||||
DebugCount::decrease("animated images");
|
||||
}
|
||||
if (this->isLoaded) {
|
||||
util::DebugCount::decrease("loaded images");
|
||||
DebugCount::decrease("loaded images");
|
||||
}
|
||||
|
||||
if (reader.imageCount() == -1) {
|
||||
// An error occured in the reader
|
||||
debug::Log("An error occured reading the image: '{}'", reader.errorString());
|
||||
debug::Log("Image url: {}", this->url);
|
||||
Log("An error occured reading the image: '{}'", reader.errorString());
|
||||
Log("Image url: {}", this->url);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (reader.imageCount() == 0) {
|
||||
debug::Log("Error: No images read in the buffer");
|
||||
Log("Error: No images read in the buffer");
|
||||
// No images read in the buffer. maybe a cache error?
|
||||
return false;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ void Image::loadImage()
|
||||
this->loadedPixmap = pixmap;
|
||||
}
|
||||
|
||||
chatterino::messages::Image::FrameData data;
|
||||
chatterino::Image::FrameData data;
|
||||
data.duration = std::max(20, reader.nextImageDelay());
|
||||
data.image = pixmap;
|
||||
|
||||
@@ -117,14 +117,14 @@ void Image::loadImage()
|
||||
}
|
||||
|
||||
if (this->allFrames.size() != reader.imageCount()) {
|
||||
// debug::Log("Error: Wrong amount of images read");
|
||||
// Log("Error: Wrong amount of images read");
|
||||
// One or more images failed to load from the buffer
|
||||
// return false;
|
||||
}
|
||||
|
||||
if (this->allFrames.size() > 1) {
|
||||
if (!this->animated) {
|
||||
util::postToThread([this] {
|
||||
postToThread([this] {
|
||||
getApp()->emotes->gifTimer.signal.connect([=]() {
|
||||
this->gifUpdateTimout();
|
||||
}); // For some reason when Boost signal is in
|
||||
@@ -135,13 +135,13 @@ void Image::loadImage()
|
||||
|
||||
this->animated = true;
|
||||
|
||||
util::DebugCount::increase("animated images");
|
||||
DebugCount::increase("animated images");
|
||||
}
|
||||
|
||||
this->currentPixmap = this->loadedPixmap;
|
||||
|
||||
this->isLoaded = true;
|
||||
util::DebugCount::increase("loaded images");
|
||||
DebugCount::increase("loaded images");
|
||||
|
||||
if (!loadedEventQueued) {
|
||||
loadedEventQueued = true;
|
||||
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
|
||||
// void insertAfter(const std::vector<T> &items, const T &index)
|
||||
|
||||
messages::LimitedQueueSnapshot<T> getSnapshot()
|
||||
chatterino::LimitedQueueSnapshot<T> getSnapshot()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(this->mutex);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "providers/twitch/PubsubActions.hpp"
|
||||
#include "util/IrcHelpers.hpp"
|
||||
|
||||
using SBHighlight = chatterino::widgets::ScrollbarHighlight;
|
||||
using SBHighlight = chatterino::ScrollbarHighlight;
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
@@ -116,7 +116,7 @@ MessagePtr Message::createTimeoutMessage(const QString &username, const QString
|
||||
|
||||
if (reason.length() > 0) {
|
||||
text.append(": \"");
|
||||
text.append(util::parseTagString(reason));
|
||||
text.append(parseTagString(reason));
|
||||
text.append("\"");
|
||||
}
|
||||
text.append(".");
|
||||
@@ -132,7 +132,7 @@ MessagePtr Message::createTimeoutMessage(const QString &username, const QString
|
||||
return message;
|
||||
}
|
||||
|
||||
MessagePtr Message::createTimeoutMessage(const providers::twitch::BanAction &action, uint32_t count)
|
||||
MessagePtr Message::createTimeoutMessage(const BanAction &action, uint32_t count)
|
||||
{
|
||||
MessagePtr msg(new Message);
|
||||
|
||||
@@ -175,14 +175,14 @@ MessagePtr Message::createTimeoutMessage(const providers::twitch::BanAction &act
|
||||
}
|
||||
}
|
||||
|
||||
msg->addElement(new messages::TextElement(text, messages::MessageElement::Text,
|
||||
messages::MessageColor::System));
|
||||
msg->addElement(new chatterino::TextElement(text, chatterino::MessageElement::Text,
|
||||
chatterino::MessageColor::System));
|
||||
msg->searchText = text;
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
MessagePtr Message::createUntimeoutMessage(const providers::twitch::UnbanAction &action)
|
||||
MessagePtr Message::createUntimeoutMessage(const UnbanAction &action)
|
||||
{
|
||||
MessagePtr msg(new Message);
|
||||
|
||||
@@ -204,8 +204,8 @@ MessagePtr Message::createUntimeoutMessage(const providers::twitch::UnbanAction
|
||||
.arg(action.target.name);
|
||||
}
|
||||
|
||||
msg->addElement(new messages::TextElement(text, messages::MessageElement::Text,
|
||||
messages::MessageColor::System));
|
||||
msg->addElement(new chatterino::TextElement(text, chatterino::MessageElement::Text,
|
||||
chatterino::MessageColor::System));
|
||||
msg->searchText = text;
|
||||
|
||||
return msg;
|
||||
|
||||
@@ -19,12 +19,12 @@ struct Message {
|
||||
Message()
|
||||
: parseTime(QTime::currentTime())
|
||||
{
|
||||
util::DebugCount::increase("messages");
|
||||
DebugCount::increase("messages");
|
||||
}
|
||||
|
||||
~Message()
|
||||
{
|
||||
util::DebugCount::decrease("messages");
|
||||
DebugCount::decrease("messages");
|
||||
}
|
||||
|
||||
enum MessageFlags : uint16_t {
|
||||
@@ -43,7 +43,7 @@ struct Message {
|
||||
Subscription = (1 << 11),
|
||||
};
|
||||
|
||||
util::FlagsEnum<MessageFlags> flags;
|
||||
FlagsEnum<MessageFlags> flags;
|
||||
QTime parseTime;
|
||||
QString id;
|
||||
QString searchText;
|
||||
@@ -59,7 +59,7 @@ struct Message {
|
||||
const std::vector<std::unique_ptr<MessageElement>> &getElements() const;
|
||||
|
||||
// Scrollbar
|
||||
widgets::ScrollbarHighlight getScrollBarHighlight() const;
|
||||
ScrollbarHighlight getScrollBarHighlight() const;
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<MessageElement>> elements;
|
||||
@@ -72,10 +72,10 @@ public:
|
||||
const QString &durationInSeconds,
|
||||
const QString &reason, bool multipleTimes);
|
||||
|
||||
static std::shared_ptr<Message> createTimeoutMessage(const providers::twitch::BanAction &action,
|
||||
static std::shared_ptr<Message> createTimeoutMessage(const BanAction &action,
|
||||
uint32_t count = 1);
|
||||
static std::shared_ptr<Message> createUntimeoutMessage(
|
||||
const providers::twitch::UnbanAction &action);
|
||||
const UnbanAction &action);
|
||||
};
|
||||
|
||||
using MessagePtr = std::shared_ptr<Message>;
|
||||
|
||||
@@ -13,7 +13,7 @@ MessageColor::MessageColor(Type _type)
|
||||
{
|
||||
}
|
||||
|
||||
const QColor &MessageColor::getColor(singletons::ThemeManager &themeManager) const
|
||||
const QColor &MessageColor::getColor(chatterino::ThemeManager &themeManager) const
|
||||
{
|
||||
switch (this->type) {
|
||||
case Type::Custom:
|
||||
|
||||
@@ -12,7 +12,7 @@ struct MessageColor {
|
||||
MessageColor(const QColor &color);
|
||||
MessageColor(Type type = Text);
|
||||
|
||||
const QColor &getColor(singletons::ThemeManager &themeManager) const;
|
||||
const QColor &getColor(chatterino::ThemeManager &themeManager) const;
|
||||
|
||||
private:
|
||||
Type type;
|
||||
|
||||
@@ -12,12 +12,12 @@ namespace chatterino {
|
||||
MessageElement::MessageElement(Flags _flags)
|
||||
: flags(_flags)
|
||||
{
|
||||
util::DebugCount::increase("message elements");
|
||||
DebugCount::increase("message elements");
|
||||
}
|
||||
|
||||
MessageElement::~MessageElement()
|
||||
{
|
||||
util::DebugCount::decrease("message elements");
|
||||
DebugCount::decrease("message elements");
|
||||
}
|
||||
|
||||
MessageElement *MessageElement::setLink(const Link &_link)
|
||||
@@ -78,7 +78,7 @@ void ImageElement::addToContainer(MessageLayoutContainer &container, MessageElem
|
||||
}
|
||||
|
||||
// EMOTE
|
||||
EmoteElement::EmoteElement(const util::EmoteData &_data, MessageElement::Flags flags)
|
||||
EmoteElement::EmoteElement(const EmoteData &_data, MessageElement::Flags flags)
|
||||
: MessageElement(flags)
|
||||
, data(_data)
|
||||
{
|
||||
@@ -248,7 +248,7 @@ void TwitchModerationElement::addToContainer(MessageLayoutContainer &container,
|
||||
if (_flags & MessageElement::ModeratorTools) {
|
||||
QSize size((int)(container.getScale() * 16), (int)(container.getScale() * 16));
|
||||
|
||||
for (const singletons::ModerationAction &m : getApp()->settings->getModerationActions()) {
|
||||
for (const chatterino::ModerationAction &m : getApp()->settings->getModerationActions()) {
|
||||
if (m.isImage()) {
|
||||
container.addElement((new ImageLayoutElement(*this, m.getImage(), size))
|
||||
->setLink(Link(Link::UserAction, m.getAction())));
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/Emotemap.hpp"
|
||||
#include "messages/Image.hpp"
|
||||
#include "messages/Link.hpp"
|
||||
#include "messages/MessageColor.hpp"
|
||||
#include "singletons/FontManager.hpp"
|
||||
#include "common/Emotemap.hpp"
|
||||
|
||||
#include <QRect>
|
||||
#include <QString>
|
||||
@@ -19,8 +19,6 @@ class Channel;
|
||||
struct EmoteData;
|
||||
struct MessageLayoutContainer;
|
||||
|
||||
using namespace chatterino::messages::layouts;
|
||||
|
||||
class MessageElement : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
@@ -167,12 +165,12 @@ class EmoteElement : public MessageElement
|
||||
std::unique_ptr<TextElement> textElement;
|
||||
|
||||
public:
|
||||
EmoteElement(const util::EmoteData &data, MessageElement::Flags flags);
|
||||
EmoteElement(const EmoteData &data, MessageElement::Flags flags);
|
||||
~EmoteElement() override = default;
|
||||
|
||||
void addToContainer(MessageLayoutContainer &container, MessageElement::Flags flags) override;
|
||||
|
||||
const util::EmoteData data;
|
||||
const EmoteData data;
|
||||
};
|
||||
|
||||
// contains a text, formated depending on the preferences
|
||||
|
||||
@@ -24,12 +24,12 @@ MessageLayout::MessageLayout(MessagePtr message)
|
||||
: message_(message)
|
||||
, buffer_(nullptr)
|
||||
{
|
||||
util::DebugCount::increase("message layout");
|
||||
DebugCount::increase("message layout");
|
||||
}
|
||||
|
||||
MessageLayout::~MessageLayout()
|
||||
{
|
||||
util::DebugCount::decrease("message layout");
|
||||
DebugCount::decrease("message layout");
|
||||
}
|
||||
|
||||
Message *MessageLayout::getMessage()
|
||||
@@ -140,7 +140,7 @@ void MessageLayout::paint(QPainter &painter, int width, int y, int messageIndex,
|
||||
|
||||
this->buffer_ = std::shared_ptr<QPixmap>(pixmap);
|
||||
this->bufferValid_ = false;
|
||||
util::DebugCount::increase("message drawing buffers");
|
||||
DebugCount::increase("message drawing buffers");
|
||||
}
|
||||
|
||||
if (!this->bufferValid_ || !selection.isEmpty()) {
|
||||
@@ -230,7 +230,7 @@ void MessageLayout::invalidateBuffer()
|
||||
void MessageLayout::deleteBuffer()
|
||||
{
|
||||
if (this->buffer_ != nullptr) {
|
||||
util::DebugCount::decrease("message drawing buffers");
|
||||
DebugCount::decrease("message drawing buffers");
|
||||
|
||||
this->buffer_ = nullptr;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
int getHeight() const;
|
||||
|
||||
// Flags
|
||||
util::FlagsEnum<Flags> flags;
|
||||
FlagsEnum<Flags> flags;
|
||||
|
||||
// Layout
|
||||
bool layout(int width, float scale_, MessageElement::Flags flags);
|
||||
|
||||
@@ -18,12 +18,12 @@ MessageLayoutElement::MessageLayoutElement(MessageElement &_creator, const QSize
|
||||
: creator(_creator)
|
||||
{
|
||||
this->rect.setSize(size);
|
||||
util::DebugCount::increase("message layout elements");
|
||||
DebugCount::increase("message layout elements");
|
||||
}
|
||||
|
||||
MessageLayoutElement::~MessageLayoutElement()
|
||||
{
|
||||
util::DebugCount::decrease("message layout elements");
|
||||
DebugCount::decrease("message layout elements");
|
||||
}
|
||||
|
||||
MessageElement &MessageLayoutElement::getCreator() const
|
||||
|
||||
Reference in New Issue
Block a user