put singletons into their namespace
This commit is contained in:
@@ -79,12 +79,12 @@ void LazyLoadedImage::loadImage()
|
||||
lli->animated = true;
|
||||
}
|
||||
|
||||
EmoteManager::getInstance().incGeneration();
|
||||
singletons::EmoteManager::getInstance().incGeneration();
|
||||
|
||||
WindowManager::getInstance().layoutVisibleChatWidgets();
|
||||
singletons::WindowManager::getInstance().layoutVisibleChatWidgets();
|
||||
});
|
||||
|
||||
EmoteManager::getInstance().getGifUpdateSignal().connect([=]() {
|
||||
singletons::EmoteManager::getInstance().getGifUpdateSignal().connect([=]() {
|
||||
this->gifUpdateTimout();
|
||||
}); // For some reason when Boost signal is in thread scope and thread deletes the signal
|
||||
// doesn't work, so this is the fix.
|
||||
|
||||
@@ -83,14 +83,14 @@ void AddCurrentTimestamp(Message *message)
|
||||
strftime(timeStampBuffer, 69, "%H:%M", localtime(&t));
|
||||
QString timestampNoSeconds(timeStampBuffer);
|
||||
message->getWords().push_back(Word(timestampNoSeconds, Word::TimestampNoSeconds,
|
||||
MessageColor(MessageColor::System), FontManager::Medium,
|
||||
MessageColor(MessageColor::System), singletons::FontManager::Medium,
|
||||
QString(), QString()));
|
||||
|
||||
// Add word for timestamp with seconds
|
||||
strftime(timeStampBuffer, 69, "%H:%M:%S", localtime(&t));
|
||||
QString timestampWithSeconds(timeStampBuffer);
|
||||
message->getWords().push_back(Word(timestampWithSeconds, Word::TimestampWithSeconds,
|
||||
MessageColor(MessageColor::System), FontManager::Medium,
|
||||
MessageColor(MessageColor::System), singletons::FontManager::Medium,
|
||||
QString(), QString()));
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ Message *Message::createSystemMessage(const QString &text)
|
||||
for (QString word : words) {
|
||||
message->getWords().push_back(Word(word, Word::Flags::Default,
|
||||
MessageColor(MessageColor::Type::System),
|
||||
FontManager::Medium, word, QString()));
|
||||
singletons::FontManager::Medium, word, QString()));
|
||||
}
|
||||
|
||||
return message;
|
||||
@@ -149,7 +149,7 @@ Message *Message::createTimeoutMessage(const QString &username, const QString &d
|
||||
text.append(".");
|
||||
|
||||
Word word(text, Word::Flags::Default, MessageColor(MessageColor::Type::System),
|
||||
FontManager::Medium, text, QString());
|
||||
singletons::FontManager::Medium, text, QString());
|
||||
|
||||
message->getWords().push_back(word);
|
||||
|
||||
|
||||
@@ -40,13 +40,13 @@ void MessageBuilder::appendTimestamp(QDateTime &time)
|
||||
// Add word for timestamp with no seconds
|
||||
QString timestampNoSeconds(time.toString("hh:mm"));
|
||||
this->appendWord(Word(timestampNoSeconds, Word::TimestampNoSeconds,
|
||||
MessageColor(MessageColor::System), FontManager::Medium, QString(),
|
||||
MessageColor(MessageColor::System), singletons::FontManager::Medium, QString(),
|
||||
QString()));
|
||||
|
||||
// Add word for timestamp with seconds
|
||||
QString timestampWithSeconds(time.toString("hh:mm:ss"));
|
||||
this->appendWord(Word(timestampWithSeconds, Word::TimestampWithSeconds,
|
||||
MessageColor(MessageColor::System), FontManager::Medium, QString(),
|
||||
MessageColor(MessageColor::System), singletons::FontManager::Medium, QString(),
|
||||
QString()));
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ MessageColor::Type MessageColor::getType() const
|
||||
return this->type;
|
||||
}
|
||||
|
||||
const QColor &MessageColor::getColor(ThemeManager &themeManager) const
|
||||
const QColor &MessageColor::getColor(singletons::ThemeManager &themeManager) const
|
||||
{
|
||||
switch (this->type) {
|
||||
case Type::Custom:
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
explicit MessageColor(Type type = Text);
|
||||
|
||||
Type getType() const;
|
||||
const QColor &getColor(ThemeManager &themeManager) const;
|
||||
const QColor &getColor(singletons::ThemeManager &themeManager) const;
|
||||
|
||||
private:
|
||||
Type type;
|
||||
|
||||
@@ -35,7 +35,7 @@ int MessageRef::getHeight() const
|
||||
// return true if redraw is required
|
||||
bool MessageRef::layout(int width, float scale)
|
||||
{
|
||||
auto &emoteManager = EmoteManager::getInstance();
|
||||
auto &emoteManager = singletons::EmoteManager::getInstance();
|
||||
|
||||
bool rebuildRequired = false, layoutRequired = false;
|
||||
|
||||
@@ -50,15 +50,15 @@ bool MessageRef::layout(int width, float scale)
|
||||
this->emoteGeneration = emoteManager.getGeneration();
|
||||
|
||||
// check if text changed
|
||||
bool textChanged = this->fontGeneration != FontManager::getInstance().getGeneration();
|
||||
bool textChanged = this->fontGeneration != singletons::FontManager::getInstance().getGeneration();
|
||||
layoutRequired |= textChanged;
|
||||
this->fontGeneration = FontManager::getInstance().getGeneration();
|
||||
this->fontGeneration = singletons::FontManager::getInstance().getGeneration();
|
||||
|
||||
// check if work mask changed
|
||||
bool wordMaskChanged =
|
||||
this->currentWordTypes != SettingsManager::getInstance().getWordTypeMask();
|
||||
this->currentWordTypes != singletons::SettingManager::getInstance().getWordTypeMask();
|
||||
layoutRequired |= wordMaskChanged;
|
||||
this->currentWordTypes = SettingsManager::getInstance().getWordTypeMask();
|
||||
this->currentWordTypes = singletons::SettingManager::getInstance().getWordTypeMask();
|
||||
|
||||
// check if dpi changed
|
||||
bool scaleChanged = this->scale != scale;
|
||||
@@ -92,7 +92,7 @@ bool MessageRef::layout(int width, float scale)
|
||||
|
||||
void MessageRef::actuallyLayout(int width)
|
||||
{
|
||||
auto &settings = SettingsManager::getInstance();
|
||||
auto &settings = singletons::SettingManager::getInstance();
|
||||
|
||||
const int spaceWidth = 4;
|
||||
const int right = width - MARGIN_RIGHT;
|
||||
|
||||
@@ -18,8 +18,9 @@ Word::Word(LazyLoadedImage *image, Flags type, const QString ©text, const QS
|
||||
}
|
||||
|
||||
// Text word
|
||||
Word::Word(const QString &text, Flags type, const MessageColor &color, FontManager::Type font,
|
||||
const QString ©text, const QString &tooltip, const Link &link)
|
||||
Word::Word(const QString &text, Flags type, const MessageColor &color,
|
||||
singletons::FontManager::Type font, const QString ©text, const QString &tooltip,
|
||||
const Link &link)
|
||||
: image(nullptr)
|
||||
, text(text)
|
||||
, color(color)
|
||||
@@ -64,10 +65,11 @@ QSize Word::getSize(float scale) const
|
||||
data.size.setHeight((int)(metrics.height()));
|
||||
} else {
|
||||
const int mediumTextLineHeight =
|
||||
FontManager::getInstance().getFontMetrics(this->font, scale).height();
|
||||
const qreal emoteScale = SettingsManager::getInstance().emoteScale.get() * scale;
|
||||
singletons::FontManager::getInstance().getFontMetrics(this->font, scale).height();
|
||||
const qreal emoteScale =
|
||||
singletons::SettingManager::getInstance().emoteScale.get() * scale;
|
||||
const bool scaleEmotesByLineHeight =
|
||||
SettingsManager::getInstance().scaleEmotesByLineHeight;
|
||||
singletons::SettingManager::getInstance().scaleEmotesByLineHeight;
|
||||
|
||||
auto &image = this->getImage();
|
||||
|
||||
@@ -114,12 +116,12 @@ bool Word::hasTrailingSpace() const
|
||||
|
||||
QFont &Word::getFont(float scale) const
|
||||
{
|
||||
return FontManager::getInstance().getFont(this->font, scale);
|
||||
return singletons::FontManager::getInstance().getFont(this->font, scale);
|
||||
}
|
||||
|
||||
QFontMetrics &Word::getFontMetrics(float scale) const
|
||||
{
|
||||
return FontManager::getInstance().getFontMetrics(this->font, scale);
|
||||
return singletons::FontManager::getInstance().getFontMetrics(this->font, scale);
|
||||
}
|
||||
|
||||
Word::Flags Word::getFlags() const
|
||||
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
explicit Word(LazyLoadedImage *_image, Flags getFlags, const QString ©text,
|
||||
const QString &tooltip, const Link &getLink = Link());
|
||||
explicit Word(const QString &_text, Flags getFlags, const MessageColor &textColor,
|
||||
FontManager::Type font, const QString ©text, const QString &tooltip,
|
||||
singletons::FontManager::Type font, const QString ©text, const QString &tooltip,
|
||||
const Link &getLink = Link());
|
||||
|
||||
bool isImage() const;
|
||||
@@ -138,7 +138,7 @@ private:
|
||||
int yOffset = 0;
|
||||
|
||||
bool _hasTrailingSpace = true;
|
||||
FontManager::Type font = FontManager::Medium;
|
||||
singletons::FontManager::Type font = singletons::FontManager::Medium;
|
||||
Link link;
|
||||
|
||||
struct ScaleDependantData {
|
||||
|
||||
Reference in New Issue
Block a user