categorized emtotepopup
This commit is contained in:
+7
-55
@@ -15,61 +15,13 @@ bool operator!=(const Emote &a, const Emote &b)
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
// EmotePtr Emote::create(const EmoteData2 &data)
|
||||
//{
|
||||
//}
|
||||
EmotePtr cachedOrMakeEmotePtr(Emote &&emote, const EmoteMap &cache)
|
||||
{
|
||||
// reuse old shared_ptr if nothing changed
|
||||
auto it = cache.find(emote.name);
|
||||
if (it != cache.end() && *it->second == emote) return it->second;
|
||||
|
||||
// EmotePtr Emote::create(EmoteData2 &&data)
|
||||
//{
|
||||
//}
|
||||
|
||||
// Emote::Emote(EmoteData2 &&data)
|
||||
// : data_(data)
|
||||
//{
|
||||
//}
|
||||
//
|
||||
// Emote::Emote(const EmoteData2 &data)
|
||||
// : data_(data)
|
||||
//{
|
||||
//}
|
||||
//
|
||||
// const Url &Emote::getHomePage() const
|
||||
//{
|
||||
// return this->data_.homePage;
|
||||
//}
|
||||
//
|
||||
// const EmoteName &Emote::getName() const
|
||||
//{
|
||||
// return this->data_.name;
|
||||
//}
|
||||
//
|
||||
// const Tooltip &Emote::getTooltip() const
|
||||
//{
|
||||
// return this->data_.tooltip;
|
||||
//}
|
||||
//
|
||||
// const ImageSet &Emote::getImages() const
|
||||
//{
|
||||
// return this->data_.images;
|
||||
//}
|
||||
//
|
||||
// const QString &Emote::getCopyString() const
|
||||
//{
|
||||
// return this->data_.name.string;
|
||||
//}
|
||||
//
|
||||
// bool Emote::operator==(const Emote &other) const
|
||||
//{
|
||||
// auto &a = this->data_;
|
||||
// auto &b = other.data_;
|
||||
//
|
||||
// return std::tie(a.homePage, a.name, a.tooltip, a.images) ==
|
||||
// std::tie(b.homePage, b.name, b.tooltip, b.images);
|
||||
//}
|
||||
//
|
||||
// bool Emote::operator!=(const Emote &other) const
|
||||
//{
|
||||
// return !this->operator==(other);
|
||||
//}
|
||||
return std::make_shared<Emote>(std::move(emote));
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -37,4 +37,6 @@ using EmoteIdMap = std::unordered_map<EmoteId, EmotePtr>;
|
||||
using WeakEmoteMap = std::unordered_map<EmoteName, std::weak_ptr<const Emote>>;
|
||||
using WeakEmoteIdMap = std::unordered_map<EmoteId, std::weak_ptr<const Emote>>;
|
||||
|
||||
EmotePtr cachedOrMakeEmotePtr(Emote &&emote, const EmoteMap &cache);
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#include "EmoteMap.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
// EmoteData::EmoteData(Image *image)
|
||||
// : image1x(image)
|
||||
//{
|
||||
//}
|
||||
|
||||
//// Emotes must have a 1x image to be valid
|
||||
// bool EmoteData::isValid() const
|
||||
//{
|
||||
// return this->image1x != nullptr;
|
||||
//}
|
||||
|
||||
// Image *EmoteData::getImage(float scale) const
|
||||
//{
|
||||
// int quality = getApp()->settings->preferredEmoteQuality;
|
||||
|
||||
// if (quality == 0) {
|
||||
// scale *= getApp()->settings->emoteScale.getValue();
|
||||
// quality = [&] {
|
||||
// if (scale <= 1) return 1;
|
||||
// if (scale <= 2) return 2;
|
||||
// return 3;
|
||||
// }();
|
||||
// }
|
||||
|
||||
// Image *_image;
|
||||
// if (quality == 3 && this->image3x != nullptr) {
|
||||
// _image = this->image3x;
|
||||
// } else if (quality >= 2 && this->image2x != nullptr) {
|
||||
// _image = this->image2x;
|
||||
// } else {
|
||||
// _image = this->image1x;
|
||||
// }
|
||||
|
||||
// return _image;
|
||||
//}
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "boost/optional.hpp"
|
||||
#include "messages/Emote.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
// class EmoteMap
|
||||
//{
|
||||
// public:
|
||||
// void add(Emote emote);
|
||||
// void remove(const Emote &emote);
|
||||
// void remove(const QString &name);
|
||||
|
||||
// private:
|
||||
//};
|
||||
|
||||
// using EmoteMap = ConcurrentMap<QString, EmoteData>;
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -78,7 +78,7 @@ QVector<Frame<QImage>> readFrames(QImageReader &reader, const Url &url)
|
||||
QVector<Frame<QImage>> frames;
|
||||
|
||||
if (reader.imageCount() == 0) {
|
||||
Log("Error while reading image {}: '{}'", url.string,
|
||||
log("Error while reading image {}: '{}'", url.string,
|
||||
reader.errorString());
|
||||
return frames;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ QVector<Frame<QImage>> readFrames(QImageReader &reader, const Url &url)
|
||||
}
|
||||
|
||||
if (frames.size() == 0) {
|
||||
Log("Error while reading image {}: '{}'", url.string,
|
||||
log("Error while reading image {}: '{}'", url.string,
|
||||
reader.errorString());
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ Image::Image(const Url &url, qreal scale)
|
||||
|
||||
Image::Image(const QPixmap &pixmap, qreal scale)
|
||||
: scale_(scale)
|
||||
, frames_(QVector<Frame<QPixmap>>{Frame<QPixmap>{pixmap}})
|
||||
, frames_(QVector<Frame<QPixmap>>{Frame<QPixmap>{pixmap, 1}})
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,14 @@ const TimeoutMessageTag timeoutMessage{};
|
||||
|
||||
MessagePtr makeSystemMessage(const QString &text);
|
||||
|
||||
struct MessageParseArgs {
|
||||
bool disablePingSounds = false;
|
||||
bool isReceivedWhisper = false;
|
||||
bool isSentWhisper = false;
|
||||
bool trimSubscriberUsername = false;
|
||||
bool isStaffOrBroadcaster = false;
|
||||
};
|
||||
|
||||
class MessageBuilder
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -2,12 +2,5 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
struct MessageParseArgs {
|
||||
bool disablePingSounds = false;
|
||||
bool isReceivedWhisper = false;
|
||||
bool isSentWhisper = false;
|
||||
bool trimSubscriberUsername = false;
|
||||
bool isStaffOrBroadcaster = false;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -35,7 +35,7 @@ struct SelectionItem {
|
||||
|
||||
bool operator>(const SelectionItem &b) const
|
||||
{
|
||||
return b.operator<(*this);
|
||||
return this->operator!=(b) && b.operator<(*this);
|
||||
}
|
||||
|
||||
bool operator==(const SelectionItem &b) const
|
||||
|
||||
@@ -31,13 +31,10 @@ public:
|
||||
|
||||
const Message *getMessage();
|
||||
|
||||
// Height
|
||||
int getHeight() const;
|
||||
|
||||
// Flags
|
||||
MessageLayoutFlags flags;
|
||||
|
||||
// Layout
|
||||
bool layout(int width, float scale_, MessageElementFlags flags);
|
||||
|
||||
// Painting
|
||||
|
||||
@@ -126,9 +126,10 @@ void MessageLayoutContainer::breakLine()
|
||||
int xOffset = 0;
|
||||
|
||||
if (this->flags_.has(MessageFlag::Centered) && this->elements_.size() > 0) {
|
||||
xOffset = (width_ - this->elements_.at(this->elements_.size() - 1)
|
||||
->getRect()
|
||||
.right()) /
|
||||
xOffset = (width_ - this->elements_.at(0)->getRect().left() -
|
||||
this->elements_.at(this->elements_.size() - 1)
|
||||
->getRect()
|
||||
.right()) /
|
||||
2;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user