fixed namespaces

This commit is contained in:
fourtf 2017-01-18 21:52:36 +01:00
parent 2e8dc63a95
commit 21e938c3b6
6 changed files with 20 additions and 24 deletions

View file

@ -20,18 +20,18 @@ Channel::Channel(const QString &channel)
{
}
QVector<std::shared_ptr<Message>>
QVector<std::shared_ptr<messages::Message>>
Channel::getMessagesClone()
{
this->messageMutex.lock();
QVector<std::shared_ptr<Message>> M(this->messages);
QVector<std::shared_ptr<messages::Message>> M(this->messages);
M.detach();
this->messageMutex.unlock();
return M;
}
void
Channel::addMessage(std::shared_ptr<Message> message)
Channel::addMessage(std::shared_ptr<messages::Message> message)
{
this->messageMutex.lock();
this->messages.append(message);

View file

@ -10,10 +10,7 @@
#include <QVector>
#include <memory>
using namespace chatterino::messages;
namespace chatterino {
namespace messages {
class Message;
}
@ -24,13 +21,13 @@ public:
Channel(const QString &channel);
// properties
const ConcurrentMap<QString, LazyLoadedImage *> &
const ConcurrentMap<QString, messages::LazyLoadedImage *> &
getBttvChannelEmotes() const
{
return bttvChannelEmotes;
}
const ConcurrentMap<QString, LazyLoadedImage *> &
const ConcurrentMap<QString, messages::LazyLoadedImage *> &
getFfzChannelEmotes() const
{
return ffzChannelEmotes;
@ -92,18 +89,18 @@ public:
}
// 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:
QVector<std::shared_ptr<Message>> messages;
QVector<std::shared_ptr<messages::Message>> messages;
QString name;
int roomID;
ConcurrentMap<QString, LazyLoadedImage *> bttvChannelEmotes;
ConcurrentMap<QString, LazyLoadedImage *> ffzChannelEmotes;
ConcurrentMap<QString, messages::LazyLoadedImage *> bttvChannelEmotes;
ConcurrentMap<QString, messages::LazyLoadedImage *> ffzChannelEmotes;
QMutex messageMutex;
QString subLink;

View file

@ -199,7 +199,8 @@ IrcManager::privateMessageReceived(IrcPrivateMessage *message)
auto c = Channels::getChannel(message->target().mid(1));
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)));
}
}

View file

@ -36,7 +36,7 @@ ChatWidgetView::layoutMessages()
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);
}
@ -112,16 +112,16 @@ ChatWidgetView::paintEvent(QPaintEvent *)
(fmod(this->scrollbar.getValue(), 1)));
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.drawRect(wordPart.getX(), wordPart.getY() + y,
wordPart.getWidth(), wordPart.getHeight());
// image
if (wordPart.getWord().isImage()) {
LazyLoadedImage &lli = wordPart.getWord().getImage();
messages::LazyLoadedImage &lli = wordPart.getWord().getImage();
const QPixmap *image = lli.getPixmap();

View file

@ -4,7 +4,7 @@ namespace chatterino {
QMutex Windows::windowMutex;
MainWindow *Windows::mainWindow(NULL);
widgets::MainWindow *Windows::mainWindow(NULL);
void
Windows::layoutVisibleChatWidgets(Channel *channel)

View file

@ -5,8 +5,6 @@
#include <QMutex>
using namespace chatterino::widgets;
namespace chatterino {
class Windows
@ -15,12 +13,12 @@ public:
static void layoutVisibleChatWidgets(Channel *channel = NULL);
static void repaintVisibleChatWidgets(Channel *channel = NULL);
static MainWindow &
static widgets::MainWindow &
getMainWindow()
{
windowMutex.lock();
if (mainWindow == NULL) {
mainWindow = new MainWindow();
mainWindow = new widgets::MainWindow();
}
windowMutex.unlock();
@ -34,7 +32,7 @@ private:
static QMutex windowMutex;
static MainWindow *mainWindow;
static widgets::MainWindow *mainWindow;
};
}