From 21e938c3b613c58fbfda0d77bd28d5456405d42a Mon Sep 17 00:00:00 2001 From: fourtf Date: Wed, 18 Jan 2017 21:52:36 +0100 Subject: [PATCH] fixed namespaces --- channel.cpp | 6 +++--- channel.h | 17 +++++++---------- ircmanager.cpp | 3 ++- widgets/chatwidgetview.cpp | 8 ++++---- windows.cpp | 2 +- windows.h | 8 +++----- 6 files changed, 20 insertions(+), 24 deletions(-) diff --git a/channel.cpp b/channel.cpp index da6cbebb3..cc0dec183 100644 --- a/channel.cpp +++ b/channel.cpp @@ -20,18 +20,18 @@ Channel::Channel(const QString &channel) { } -QVector> +QVector> Channel::getMessagesClone() { this->messageMutex.lock(); - QVector> M(this->messages); + QVector> M(this->messages); M.detach(); this->messageMutex.unlock(); return M; } void -Channel::addMessage(std::shared_ptr message) +Channel::addMessage(std::shared_ptr message) { this->messageMutex.lock(); this->messages.append(message); diff --git a/channel.h b/channel.h index 47c26a12f..832d55f17 100644 --- a/channel.h +++ b/channel.h @@ -10,10 +10,7 @@ #include #include -using namespace chatterino::messages; - namespace chatterino { - namespace messages { class Message; } @@ -24,13 +21,13 @@ public: Channel(const QString &channel); // properties - const ConcurrentMap & + const ConcurrentMap & getBttvChannelEmotes() const { return bttvChannelEmotes; } - const ConcurrentMap & + const ConcurrentMap & getFfzChannelEmotes() const { return ffzChannelEmotes; @@ -92,18 +89,18 @@ public: } // methods - void addMessage(std::shared_ptr message); + void addMessage(std::shared_ptr message); - QVector> getMessagesClone(); + QVector> getMessagesClone(); private: - QVector> messages; + QVector> messages; QString name; int roomID; - ConcurrentMap bttvChannelEmotes; - ConcurrentMap ffzChannelEmotes; + ConcurrentMap bttvChannelEmotes; + ConcurrentMap ffzChannelEmotes; QMutex messageMutex; QString subLink; diff --git a/ircmanager.cpp b/ircmanager.cpp index 9cd4ed3d8..977cd16de 100644 --- a/ircmanager.cpp +++ b/ircmanager.cpp @@ -199,7 +199,8 @@ IrcManager::privateMessageReceived(IrcPrivateMessage *message) auto c = Channels::getChannel(message->target().mid(1)); if (c != NULL) { - c->addMessage(std::shared_ptr(new Message(*message, *c))); + c->addMessage(std::shared_ptr( + new messages::Message(*message, *c))); } } diff --git a/widgets/chatwidgetview.cpp b/widgets/chatwidgetview.cpp index f462efa72..388538965 100644 --- a/widgets/chatwidgetview.cpp +++ b/widgets/chatwidgetview.cpp @@ -36,7 +36,7 @@ ChatWidgetView::layoutMessages() bool redraw = false; - for (std::shared_ptr &message : messages) { + for (std::shared_ptr &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(); diff --git a/windows.cpp b/windows.cpp index 4042fbdb7..063d9ca76 100644 --- a/windows.cpp +++ b/windows.cpp @@ -4,7 +4,7 @@ namespace chatterino { QMutex Windows::windowMutex; -MainWindow *Windows::mainWindow(NULL); +widgets::MainWindow *Windows::mainWindow(NULL); void Windows::layoutVisibleChatWidgets(Channel *channel) diff --git a/windows.h b/windows.h index b832a5f57..74a8e8c7a 100644 --- a/windows.h +++ b/windows.h @@ -5,8 +5,6 @@ #include -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; }; }