mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
fixed namespaces
This commit is contained in:
parent
2e8dc63a95
commit
21e938c3b6
6 changed files with 20 additions and 24 deletions
|
@ -20,18 +20,18 @@ Channel::Channel(const QString &channel)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QVector<std::shared_ptr<Message>>
|
QVector<std::shared_ptr<messages::Message>>
|
||||||
Channel::getMessagesClone()
|
Channel::getMessagesClone()
|
||||||
{
|
{
|
||||||
this->messageMutex.lock();
|
this->messageMutex.lock();
|
||||||
QVector<std::shared_ptr<Message>> M(this->messages);
|
QVector<std::shared_ptr<messages::Message>> M(this->messages);
|
||||||
M.detach();
|
M.detach();
|
||||||
this->messageMutex.unlock();
|
this->messageMutex.unlock();
|
||||||
return M;
|
return M;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Channel::addMessage(std::shared_ptr<Message> message)
|
Channel::addMessage(std::shared_ptr<messages::Message> message)
|
||||||
{
|
{
|
||||||
this->messageMutex.lock();
|
this->messageMutex.lock();
|
||||||
this->messages.append(message);
|
this->messages.append(message);
|
||||||
|
|
17
channel.h
17
channel.h
|
@ -10,10 +10,7 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace chatterino::messages;
|
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
namespace messages {
|
namespace messages {
|
||||||
class Message;
|
class Message;
|
||||||
}
|
}
|
||||||
|
@ -24,13 +21,13 @@ public:
|
||||||
Channel(const QString &channel);
|
Channel(const QString &channel);
|
||||||
|
|
||||||
// properties
|
// properties
|
||||||
const ConcurrentMap<QString, LazyLoadedImage *> &
|
const ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||||
getBttvChannelEmotes() const
|
getBttvChannelEmotes() const
|
||||||
{
|
{
|
||||||
return bttvChannelEmotes;
|
return bttvChannelEmotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ConcurrentMap<QString, LazyLoadedImage *> &
|
const ConcurrentMap<QString, messages::LazyLoadedImage *> &
|
||||||
getFfzChannelEmotes() const
|
getFfzChannelEmotes() const
|
||||||
{
|
{
|
||||||
return ffzChannelEmotes;
|
return ffzChannelEmotes;
|
||||||
|
@ -92,18 +89,18 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
void addMessage(std::shared_ptr<Message> message);
|
void addMessage(std::shared_ptr<messages::Message> message);
|
||||||
|
|
||||||
QVector<std::shared_ptr<Message>> getMessagesClone();
|
QVector<std::shared_ptr<messages::Message>> getMessagesClone();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<std::shared_ptr<Message>> messages;
|
QVector<std::shared_ptr<messages::Message>> messages;
|
||||||
|
|
||||||
QString name;
|
QString name;
|
||||||
int roomID;
|
int roomID;
|
||||||
|
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> bttvChannelEmotes;
|
ConcurrentMap<QString, messages::LazyLoadedImage *> bttvChannelEmotes;
|
||||||
ConcurrentMap<QString, LazyLoadedImage *> ffzChannelEmotes;
|
ConcurrentMap<QString, messages::LazyLoadedImage *> ffzChannelEmotes;
|
||||||
QMutex messageMutex;
|
QMutex messageMutex;
|
||||||
|
|
||||||
QString subLink;
|
QString subLink;
|
||||||
|
|
|
@ -199,7 +199,8 @@ IrcManager::privateMessageReceived(IrcPrivateMessage *message)
|
||||||
auto c = Channels::getChannel(message->target().mid(1));
|
auto c = Channels::getChannel(message->target().mid(1));
|
||||||
|
|
||||||
if (c != NULL) {
|
if (c != NULL) {
|
||||||
c->addMessage(std::shared_ptr<Message>(new Message(*message, *c)));
|
c->addMessage(std::shared_ptr<messages::Message>(
|
||||||
|
new messages::Message(*message, *c)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ ChatWidgetView::layoutMessages()
|
||||||
|
|
||||||
bool redraw = false;
|
bool redraw = false;
|
||||||
|
|
||||||
for (std::shared_ptr<Message> &message : messages) {
|
for (std::shared_ptr<messages::Message> &message : messages) {
|
||||||
redraw |= message.get()->layout(this->width(), true);
|
redraw |= message.get()->layout(this->width(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,16 +112,16 @@ ChatWidgetView::paintEvent(QPaintEvent *)
|
||||||
(fmod(this->scrollbar.getValue(), 1)));
|
(fmod(this->scrollbar.getValue(), 1)));
|
||||||
|
|
||||||
for (int i = start; i < messages.size(); ++i) {
|
for (int i = start; i < messages.size(); ++i) {
|
||||||
Message *message = messages[i].get();
|
messages::Message *message = messages[i].get();
|
||||||
|
|
||||||
for (WordPart const &wordPart : message->getWordParts()) {
|
for (messages::WordPart const &wordPart : message->getWordParts()) {
|
||||||
painter.setPen(QColor(255, 0, 0));
|
painter.setPen(QColor(255, 0, 0));
|
||||||
painter.drawRect(wordPart.getX(), wordPart.getY() + y,
|
painter.drawRect(wordPart.getX(), wordPart.getY() + y,
|
||||||
wordPart.getWidth(), wordPart.getHeight());
|
wordPart.getWidth(), wordPart.getHeight());
|
||||||
|
|
||||||
// image
|
// image
|
||||||
if (wordPart.getWord().isImage()) {
|
if (wordPart.getWord().isImage()) {
|
||||||
LazyLoadedImage &lli = wordPart.getWord().getImage();
|
messages::LazyLoadedImage &lli = wordPart.getWord().getImage();
|
||||||
|
|
||||||
const QPixmap *image = lli.getPixmap();
|
const QPixmap *image = lli.getPixmap();
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace chatterino {
|
||||||
|
|
||||||
QMutex Windows::windowMutex;
|
QMutex Windows::windowMutex;
|
||||||
|
|
||||||
MainWindow *Windows::mainWindow(NULL);
|
widgets::MainWindow *Windows::mainWindow(NULL);
|
||||||
|
|
||||||
void
|
void
|
||||||
Windows::layoutVisibleChatWidgets(Channel *channel)
|
Windows::layoutVisibleChatWidgets(Channel *channel)
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
|
||||||
using namespace chatterino::widgets;
|
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
class Windows
|
class Windows
|
||||||
|
@ -15,12 +13,12 @@ public:
|
||||||
static void layoutVisibleChatWidgets(Channel *channel = NULL);
|
static void layoutVisibleChatWidgets(Channel *channel = NULL);
|
||||||
static void repaintVisibleChatWidgets(Channel *channel = NULL);
|
static void repaintVisibleChatWidgets(Channel *channel = NULL);
|
||||||
|
|
||||||
static MainWindow &
|
static widgets::MainWindow &
|
||||||
getMainWindow()
|
getMainWindow()
|
||||||
{
|
{
|
||||||
windowMutex.lock();
|
windowMutex.lock();
|
||||||
if (mainWindow == NULL) {
|
if (mainWindow == NULL) {
|
||||||
mainWindow = new MainWindow();
|
mainWindow = new widgets::MainWindow();
|
||||||
}
|
}
|
||||||
windowMutex.unlock();
|
windowMutex.unlock();
|
||||||
|
|
||||||
|
@ -34,7 +32,7 @@ private:
|
||||||
|
|
||||||
static QMutex windowMutex;
|
static QMutex windowMutex;
|
||||||
|
|
||||||
static MainWindow *mainWindow;
|
static widgets::MainWindow *mainWindow;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue