diff --git a/channel.cpp b/channel.cpp index 838ad4f6..b9d0e2e3 100644 --- a/channel.cpp +++ b/channel.cpp @@ -15,9 +15,9 @@ #include -using namespace chatterino::messages; +using namespace chatterino::messages; -namespace chatterino { +namespace chatterino { Channel::Channel(const QString &channel) : _messages() @@ -188,4 +188,4 @@ void Channel::reloadFfzEmotes() }); } -} // namespace chatterino +} // namespace chatterino diff --git a/channel.h b/channel.h index b2499164..d69f935d 100644 --- a/channel.h +++ b/channel.h @@ -13,8 +13,8 @@ #include #include -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { class Message; } @@ -75,6 +75,6 @@ private: void reloadFfzEmotes(); }; -} // namespace chatterino +} // namespace chatterino #endif // CHANNEL_H diff --git a/channelmanager.cpp b/channelmanager.cpp index 7985e357..3d59b377 100644 --- a/channelmanager.cpp +++ b/channelmanager.cpp @@ -1,7 +1,7 @@ #include "channelmanager.h" #include "ircmanager.h" -namespace chatterino { +namespace chatterino { ChannelManager ChannelManager::instance; @@ -119,4 +119,4 @@ void ChannelManager::removeChannel(const QString &channel) } } -} // namespace chatterino +} // namespace chatterino diff --git a/channelmanager.h b/channelmanager.h index 7df13f38..c2c1f7bc 100644 --- a/channelmanager.h +++ b/channelmanager.h @@ -3,7 +3,7 @@ #include "channel.h" -namespace chatterino { +namespace chatterino { class ChannelManager { @@ -36,6 +36,6 @@ private: SharedChannel _empty; }; -} // namespace chatterino +} // namespace chatterino #endif // CHANNELS_H diff --git a/chatterino.pro b/chatterino.pro index f6ba4c88..19b27d45 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -17,7 +17,7 @@ TARGET = chatterino TEMPLATE = app DEFINES += QT_DEPRECATED_WARNINGS -DEFINES += IRC_NAMESPACE=Communi +DEFINES += IRC_namespace =Communi # do not use windows min/max macros win32 { diff --git a/clangformat.txt b/clangformat.txt index ada6c675..a60c5468 100644 --- a/clangformat.txt +++ b/clangformat.txt @@ -26,4 +26,5 @@ BraceWrapping: { AfterFunction: 'true' BeforeCatch: 'false' } -ColumnLimit: 100 \ No newline at end of file +ColumnLimit: 100 +FixNamespaceComments: true \ No newline at end of file diff --git a/colorscheme.cpp b/colorscheme.cpp index 4800b98b..35e4df41 100644 --- a/colorscheme.cpp +++ b/colorscheme.cpp @@ -6,7 +6,7 @@ #include -namespace chatterino { +namespace chatterino { void ColorScheme::init() { @@ -172,4 +172,4 @@ void ColorScheme::normalizeColor(QColor &color) // color.setHslF(color.hueF(), s, newL); } -} // namespace chatterino +} // namespace chatterino diff --git a/colorscheme.h b/colorscheme.h index dfbcf82f..c06463c5 100644 --- a/colorscheme.h +++ b/colorscheme.h @@ -5,7 +5,7 @@ #include #include -namespace chatterino { +namespace chatterino { class ColorScheme { diff --git a/concurrentmap.h b/concurrentmap.h index 1e5fba6f..ae10ab1b 100644 --- a/concurrentmap.h +++ b/concurrentmap.h @@ -65,6 +65,6 @@ private: QMap _map; }; -} // namespace chatterino +} // namespace chatterino #endif // CONCURRENTMAP_H diff --git a/emojis.cpp b/emojis.cpp index 9ad302c8..7e56d629 100644 --- a/emojis.cpp +++ b/emojis.cpp @@ -5,7 +5,7 @@ #include #include -namespace chatterino { +namespace chatterino { QRegularExpression Emojis::findShortCodesRegex(":([-+\\w]+):"); diff --git a/emojis.h b/emojis.h index 6a172a48..05af091f 100644 --- a/emojis.h +++ b/emojis.h @@ -9,7 +9,7 @@ #include #include -namespace chatterino { +namespace chatterino { class Emojis { diff --git a/emotemanager.cpp b/emotemanager.cpp index 4f2e26ad..1d182f37 100644 --- a/emotemanager.cpp +++ b/emotemanager.cpp @@ -13,9 +13,9 @@ #define TWITCH_EMOTE_TEMPLATE "https://static-cdn.jtvnw.net/emoticons/v1/{id}/{scale}.0" -using namespace chatterino::messages; +using namespace chatterino::messages; -namespace chatterino { +namespace chatterino { EmoteManager EmoteManager::instance; diff --git a/emotemanager.h b/emotemanager.h index 3097d395..81fc4e5b 100644 --- a/emotemanager.h +++ b/emotemanager.h @@ -13,7 +13,7 @@ #include #include -namespace chatterino { +namespace chatterino { class EmoteManager { public: @@ -93,6 +93,6 @@ private: void loadFfzEmotes(); void loadBttvEmotes(); }; -} // namespace chatterino +} // namespace chatterino #endif // EMOTES_H diff --git a/fontmanager.cpp b/fontmanager.cpp index ab0ddbdf..c04f7636 100644 --- a/fontmanager.cpp +++ b/fontmanager.cpp @@ -2,7 +2,7 @@ #define DEFAULT_FONT "Arial" -namespace chatterino { +namespace chatterino { FontManager FontManager::instance; diff --git a/fontmanager.h b/fontmanager.h index 2edf2f16..8e3eb796 100644 --- a/fontmanager.h +++ b/fontmanager.h @@ -4,7 +4,7 @@ #include #include -namespace chatterino { +namespace chatterino { class FontManager { diff --git a/ircmanager.cpp b/ircmanager.cpp index 9c37279f..9fea7d8c 100644 --- a/ircmanager.cpp +++ b/ircmanager.cpp @@ -19,9 +19,9 @@ #include -using namespace chatterino::messages; +using namespace chatterino::messages; -namespace chatterino { +namespace chatterino { IrcManager IrcManager::instance; diff --git a/ircmanager.h b/ircmanager.h index dc44e1a7..563ef983 100644 --- a/ircmanager.h +++ b/ircmanager.h @@ -70,6 +70,6 @@ private: void messageReceived(Communi::IrcMessage *message); void privateMessageReceived(Communi::IrcPrivateMessage *message); }; -} +} // namespace chatterino #endif // IRCMANAGER_H diff --git a/ircuser2.cpp b/ircuser2.cpp index 4c221719..0c71469c 100644 --- a/ircuser2.cpp +++ b/ircuser2.cpp @@ -1,6 +1,6 @@ #include "ircuser2.h" -namespace chatterino { +namespace chatterino { IrcUser2::IrcUser2(const QString &userName, const QString &nickName, const QString &realName, const QString &password) diff --git a/ircuser2.h b/ircuser2.h index 210d4f5e..44cf1ab2 100644 --- a/ircuser2.h +++ b/ircuser2.h @@ -22,6 +22,6 @@ private: QString _realName; QString _password; }; -} +} // namespace chatterino #endif // IRCUSER_H diff --git a/logging/loggingchannel.cpp b/logging/loggingchannel.cpp index 8c0f3748..d640646f 100644 --- a/logging/loggingchannel.cpp +++ b/logging/loggingchannel.cpp @@ -5,8 +5,8 @@ #include -namespace chatterino { -namespace logging { +namespace chatterino { +namespace logging { Channel::Channel(const QString &_channelName, const QString &_baseDirectory) : channelName(_channelName) @@ -72,5 +72,5 @@ void Channel::appendLine(const QString &line) this->fileHandle.flush(); } -} // namespace logging -} // namespace chatterino +} // namespace logging +} // namespace chatterino diff --git a/logging/loggingchannel.h b/logging/loggingchannel.h index 1ca7f4ce..d28c7e5c 100644 --- a/logging/loggingchannel.h +++ b/logging/loggingchannel.h @@ -9,8 +9,8 @@ #include -namespace chatterino { -namespace logging { +namespace chatterino { +namespace logging { class Channel { @@ -33,7 +33,7 @@ private: QFile fileHandle; }; -} // namespace logging -} // namespace chatterino +} // namespace logging +} // namespace chatterino #endif // LOGGINGCHANNEL_H diff --git a/logging/loggingmanager.cpp b/logging/loggingmanager.cpp index 750b1038..c9093f3e 100644 --- a/logging/loggingmanager.cpp +++ b/logging/loggingmanager.cpp @@ -5,8 +5,8 @@ #include -namespace chatterino { -namespace logging { +namespace chatterino { +namespace logging { static QString logBasePath; static QString channelBasePath; @@ -96,5 +96,5 @@ std::shared_ptr get(const QString &channelName) return ret; } -} // namespace logging -} // namespace chatterino +} // namespace logging +} // namespace chatterino diff --git a/logging/loggingmanager.h b/logging/loggingmanager.h index e7d7d039..7721181e 100644 --- a/logging/loggingmanager.h +++ b/logging/loggingmanager.h @@ -5,13 +5,13 @@ #include -namespace chatterino { -namespace logging { +namespace chatterino { +namespace logging { void init(); std::shared_ptr get(const QString &channelName); -} // namespace logging -} // namespace chatterino +} // namespace logging +} // namespace chatterino #endif // LOGGINGMANAGER_H diff --git a/main.cpp b/main.cpp index c7847221..27ffa5a4 100644 --- a/main.cpp +++ b/main.cpp @@ -16,8 +16,8 @@ #include #include -using namespace chatterino; -using namespace chatterino::widgets; +using namespace chatterino; +using namespace chatterino::widgets; int main(int argc, char *argv[]) { diff --git a/messages/lazyloadedimage.cpp b/messages/lazyloadedimage.cpp index 1d973467..49b5e489 100644 --- a/messages/lazyloadedimage.cpp +++ b/messages/lazyloadedimage.cpp @@ -103,5 +103,5 @@ void LazyLoadedImage::gifUpdateTimout() _currentPixmap = _allFrames[_currentFrame].image; } -} // namespace messages -} // namespace chatterino +} // namespace messages +} // namespace chatterino diff --git a/messages/lazyloadedimage.h b/messages/lazyloadedimage.h index 54b5bea5..19e8f20f 100644 --- a/messages/lazyloadedimage.h +++ b/messages/lazyloadedimage.h @@ -103,7 +103,7 @@ private: void gifUpdateTimout(); }; -} // namespace messages -} // namespace chatterino +} // namespace messages +} // namespace chatterino #endif // LAZYLOADEDIMAGE_H diff --git a/messages/limitedqueue.h b/messages/limitedqueue.h index 3ea0f17f..90d9fcda 100644 --- a/messages/limitedqueue.h +++ b/messages/limitedqueue.h @@ -7,8 +7,8 @@ #include #include -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { template class LimitedQueue @@ -96,7 +96,7 @@ private: unsigned int buffer; }; -} // namespace messages -} // namespace chatterino +} // namespace messages +} // namespace chatterino #endif // LIMITEDQUEUE_H diff --git a/messages/limitedqueuesnapshot.h b/messages/limitedqueuesnapshot.h index 9bb87b42..97262aae 100644 --- a/messages/limitedqueuesnapshot.h +++ b/messages/limitedqueuesnapshot.h @@ -11,30 +11,30 @@ template class LimitedQueueSnapshot { public: - LimitedQueueSnapshot(std::shared_ptr> ptr, int offset, int length) - : vector(ptr) - , offset(offset) - , length(length) + LimitedQueueSnapshot(std::shared_ptr> vector, int offset, int size) + : _vector(vector) + , _offset(offset) + , _length(size) { } - int getLength() + int getSize() { - return this->length; + return _length; } T const &operator[](int index) const { - return this->vector->at(index + this->offset); + return _vector->at(index + _offset); } private: - std::shared_ptr> vector; + std::shared_ptr> _vector; - int offset; - int length; + int _offset; + int _length; }; -} -} +} // namespace messages +} // namespace chatterino #endif // LIMITEDQUEUESNAPSHOT_H diff --git a/messages/link.cpp b/messages/link.cpp index c41178cb..90e12373 100644 --- a/messages/link.cpp +++ b/messages/link.cpp @@ -1,7 +1,7 @@ #include "messages/link.h" -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { Link::Link() : type(None) diff --git a/messages/link.h b/messages/link.h index 99dfd7ec..89428b21 100644 --- a/messages/link.h +++ b/messages/link.h @@ -3,8 +3,8 @@ #include -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { class Link { diff --git a/messages/message.cpp b/messages/message.cpp index 493509a2..a51e9f58 100644 --- a/messages/message.cpp +++ b/messages/message.cpp @@ -16,8 +16,8 @@ #include #include -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { Message::Message(const QString &text) : _words() @@ -81,5 +81,5 @@ const QString &Message::getId() const return _id; } -} // namespace messages -} // namespace chatterino +} // namespace messages +} // namespace chatterino diff --git a/messages/message.h b/messages/message.h index 89c3c3dc..dbc3f220 100644 --- a/messages/message.h +++ b/messages/message.h @@ -12,11 +12,11 @@ #include #include -namespace chatterino { +namespace chatterino { class Channel; -namespace messages { +namespace messages { class Message; typedef std::shared_ptr SharedMessage; @@ -63,7 +63,7 @@ private: std::vector _words; }; -} // namespace messages -} // namespace chatterino +} // namespace messages +} // namespace chatterino #endif // MESSAGE_H diff --git a/messages/messagebuilder.cpp b/messages/messagebuilder.cpp index e44282ef..27db5541 100644 --- a/messages/messagebuilder.cpp +++ b/messages/messagebuilder.cpp @@ -3,8 +3,8 @@ #include "emotemanager.h" #include "resources.h" -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { MessageBuilder::MessageBuilder() : _words() diff --git a/messages/messagebuilder.h b/messages/messagebuilder.h index f6c38b06..b98d93e8 100644 --- a/messages/messagebuilder.h +++ b/messages/messagebuilder.h @@ -4,8 +4,8 @@ #include "messages/message.h" #include -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { class MessageBuilder { diff --git a/messages/messageparseargs.h b/messages/messageparseargs.h index 8acfab56..eeccd358 100644 --- a/messages/messageparseargs.h +++ b/messages/messageparseargs.h @@ -1,8 +1,8 @@ #ifndef MESSAGEPARSEARGS_H #define MESSAGEPARSEARGS_H -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { struct MessageParseArgs { public: diff --git a/messages/messageref.cpp b/messages/messageref.cpp index 145bc6d4..d32f2f41 100644 --- a/messages/messageref.cpp +++ b/messages/messageref.cpp @@ -9,10 +9,10 @@ #define MARGIN_TOP 8 #define MARGIN_BOTTOM 8 -using namespace chatterino::messages; +using namespace chatterino::messages; -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { MessageRef::MessageRef(SharedMessage message) : _message(message) diff --git a/messages/messageref.h b/messages/messageref.h index 48710047..f1eb99f4 100644 --- a/messages/messageref.h +++ b/messages/messageref.h @@ -6,8 +6,8 @@ #include #include -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { class MessageRef; diff --git a/messages/word.cpp b/messages/word.cpp index 58ef5a75..61461178 100644 --- a/messages/word.cpp +++ b/messages/word.cpp @@ -1,7 +1,7 @@ #include "messages/word.h" -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { // Image word Word::Word(LazyLoadedImage *image, Type type, const QString ©text, const QString &tooltip, @@ -130,5 +130,5 @@ std::vector &Word::getCharacterWidthCache() const { return _characterWidthCache; } -} // namespace messages -} // namespace chatterino +} // namespace messages +} // namespace chatterino diff --git a/messages/word.h b/messages/word.h index d4b72f2a..95976b4d 100644 --- a/messages/word.h +++ b/messages/word.h @@ -9,8 +9,8 @@ #include #include -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { class Word { @@ -114,7 +114,7 @@ private: mutable std::vector _characterWidthCache; }; -} // namespace messages -} // namespace chatterino +} // namespace messages +} // namespace chatterino #endif // WORD_H diff --git a/messages/wordpart.cpp b/messages/wordpart.cpp index 57deade4..7c4bec5f 100644 --- a/messages/wordpart.cpp +++ b/messages/wordpart.cpp @@ -1,8 +1,8 @@ #include "messages/wordpart.h" #include "messages/word.h" -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { WordPart::WordPart(Word &word, int x, int y, int lineNumber, const QString ©Text, bool allowTrailingSpace) diff --git a/messages/wordpart.h b/messages/wordpart.h index 15904c94..2be859bd 100644 --- a/messages/wordpart.h +++ b/messages/wordpart.h @@ -4,8 +4,8 @@ #include #include -namespace chatterino { -namespace messages { +namespace chatterino { +namespace messages { class Word; diff --git a/resources.cpp b/resources.cpp index 762ed733..109fdb8b 100644 --- a/resources.cpp +++ b/resources.cpp @@ -2,7 +2,7 @@ #include -namespace chatterino { +namespace chatterino { messages::LazyLoadedImage *Resources::badgeStaff(NULL); messages::LazyLoadedImage *Resources::badgeAdmin(NULL); diff --git a/resources.h b/resources.h index 4bd16515..5926d9ad 100644 --- a/resources.h +++ b/resources.h @@ -108,6 +108,6 @@ private: static messages::LazyLoadedImage *buttonBan; static messages::LazyLoadedImage *buttonTimeout; }; -} +} // namespace chatterino #endif // RESOURCES_H diff --git a/setting.h b/setting.h index 76eceedb..cdcdb1b3 100644 --- a/setting.h +++ b/setting.h @@ -72,6 +72,6 @@ private: T _value; }; -} // namespace chatterino +} // namespace chatterino #endif // SETTING_H diff --git a/settingsmanager.cpp b/settingsmanager.cpp index 6fdf8d03..6a6f13a6 100644 --- a/settingsmanager.cpp +++ b/settingsmanager.cpp @@ -5,9 +5,9 @@ #include #include -using namespace chatterino::messages; +using namespace chatterino::messages; -namespace chatterino { +namespace chatterino { SettingsManager SettingsManager::instance; @@ -131,4 +131,4 @@ SettingsSnapshot SettingsManager::createSnapshot() return snapshot; } -} // namespace chatterino +} // namespace chatterino diff --git a/settingsmanager.h b/settingsmanager.h index 1b8e09c3..fb45e6f9 100644 --- a/settingsmanager.h +++ b/settingsmanager.h @@ -79,6 +79,6 @@ private: static SettingsManager instance; }; -} // namespace chatterino +} // namespace chatterino #endif // APPSETTINGS_H diff --git a/settingssnapshot.h b/settingssnapshot.h index 7c75d2d2..e0c29621 100644 --- a/settingssnapshot.h +++ b/settingssnapshot.h @@ -28,6 +28,6 @@ public: private: std::vector, QVariant>> _items; }; -} +} // namespace chatterino #endif // SETTINGSSNAPSHOT_H diff --git a/twitch/emotevalue.h b/twitch/emotevalue.h index 9170b713..7e05147d 100644 --- a/twitch/emotevalue.h +++ b/twitch/emotevalue.h @@ -3,8 +3,8 @@ #include "QString" -namespace chatterino { -namespace twitch { +namespace chatterino { +namespace twitch { struct EmoteValue { public: diff --git a/twitch/twitchmessagebuilder.cpp b/twitch/twitchmessagebuilder.cpp index 0835577d..cd08d90c 100644 --- a/twitch/twitchmessagebuilder.cpp +++ b/twitch/twitchmessagebuilder.cpp @@ -5,10 +5,10 @@ #include "ircmanager.h" #include "resources.h" -using namespace chatterino::messages; +using namespace chatterino::messages; -namespace chatterino { -namespace twitch { +namespace chatterino { +namespace twitch { TwitchMessageBuilder::TwitchMessageBuilder() : MessageBuilder() , messageId() diff --git a/twitch/twitchmessagebuilder.h b/twitch/twitchmessagebuilder.h index d8bbfff2..a676131e 100644 --- a/twitch/twitchmessagebuilder.h +++ b/twitch/twitchmessagebuilder.h @@ -6,8 +6,8 @@ #include -namespace chatterino { -namespace twitch { +namespace chatterino { +namespace twitch { class TwitchMessageBuilder : public messages::MessageBuilder { diff --git a/twitch/twitchparsemessage.cpp b/twitch/twitchparsemessage.cpp index 2c677bc3..ad68c267 100644 --- a/twitch/twitchparsemessage.cpp +++ b/twitch/twitchparsemessage.cpp @@ -8,10 +8,10 @@ // //#include // -// using namespace chatterino::messages; +// using namespace chatterino::messages; // -// namespace chatterino { -// namespace twitch { +// namespace chatterino { +// namespace twitch { // SharedMessage // twitchParseMessage(const Communi::IrcPrivateMessage *ircMessage, // Channel *channel, const MessageParseArgs &args) diff --git a/twitch/twitchparsemessage.h b/twitch/twitchparsemessage.h index 23aec2f8..b7c87d1a 100644 --- a/twitch/twitchparsemessage.h +++ b/twitch/twitchparsemessage.h @@ -5,8 +5,8 @@ //#include "messages/messagebuilder.h" //#include "messages/messageparseargs.h" // -// namespace chatterino { -// namespace twitch { +// namespace chatterino { +// namespace twitch { //} //} // diff --git a/twitch/twitchuser.cpp b/twitch/twitchuser.cpp index 4bf9c187..0de10f57 100644 --- a/twitch/twitchuser.cpp +++ b/twitch/twitchuser.cpp @@ -1,7 +1,7 @@ #include "twitchuser.h" -namespace chatterino { -namespace twitch { +namespace chatterino { +namespace twitch { TwitchUser::TwitchUser(const QString &username, const QString &oauthToken, const QString &oauthClient) : IrcUser2(username, username, username, "oauth:" + oauthToken) diff --git a/twitch/twitchuser.h b/twitch/twitchuser.h index ca1f6ab4..2e909d8d 100644 --- a/twitch/twitchuser.h +++ b/twitch/twitchuser.h @@ -5,8 +5,8 @@ #include -namespace chatterino { -namespace twitch { +namespace chatterino { +namespace twitch { class TwitchUser : public IrcUser2 { diff --git a/usermanager.cpp b/usermanager.cpp index 964f15d6..e2ffd1c3 100644 --- a/usermanager.cpp +++ b/usermanager.cpp @@ -1,6 +1,6 @@ #include "usermanager.h" -namespace chatterino { +namespace chatterino { AccountManager AccountManager::instance; @@ -41,4 +41,4 @@ void AccountManager::addTwitchUser(const twitch::TwitchUser &user) _twitchUsers.push_back(user); } -} // namespace chatterino +} // namespace chatterino diff --git a/usermanager.h b/usermanager.h index cb3dab6d..9f97f957 100644 --- a/usermanager.h +++ b/usermanager.h @@ -31,6 +31,6 @@ private: std::vector _twitchUsers; std::mutex _twitchUsersMutex; }; -} // namespace chatterino +} // namespace chatterino #endif // ACCOUNTMANAGER_H diff --git a/util/urlfetch.h b/util/urlfetch.h index 34786c6b..df8030dc 100644 --- a/util/urlfetch.h +++ b/util/urlfetch.h @@ -12,8 +12,8 @@ #include -namespace chatterino { -namespace util { +namespace chatterino { +namespace util { static void urlFetch(const QString &url, std::function successCallback) { diff --git a/widgets/chatwidget.cpp b/widgets/chatwidget.cpp index 529b4c53..a9e098aa 100644 --- a/widgets/chatwidget.cpp +++ b/widgets/chatwidget.cpp @@ -11,10 +11,10 @@ #include #include -using namespace chatterino::messages; +using namespace chatterino::messages; -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { ChatWidget::ChatWidget(QWidget *parent) : QWidget(parent) @@ -116,7 +116,7 @@ ChatWidget::attachChannel(SharedChannel channel) auto snapshot = _channel.get()->getMessageSnapshot(); - for (int i = 0; i < snapshot.getLength(); i++) { + for (int i = 0; i < snapshot.getSize(); i++) { SharedMessageRef deleted; auto messageRef = new MessageRef(snapshot[i]); @@ -198,5 +198,5 @@ ChatWidget::save() return tree; } -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino diff --git a/widgets/chatwidget.h b/widgets/chatwidget.h index 0ae90040..c063b865 100644 --- a/widgets/chatwidget.h +++ b/widgets/chatwidget.h @@ -16,8 +16,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { class ChatWidget : public QWidget { @@ -62,7 +62,7 @@ public: boost::property_tree::ptree save(); }; -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino #endif // CHATWIDGET_H diff --git a/widgets/chatwidgetheader.cpp b/widgets/chatwidgetheader.cpp index 213ee1e4..a2db7a47 100644 --- a/widgets/chatwidgetheader.cpp +++ b/widgets/chatwidgetheader.cpp @@ -8,8 +8,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { ChatWidgetHeader::ChatWidgetHeader(ChatWidget *parent) : QWidget() diff --git a/widgets/chatwidgetheader.h b/widgets/chatwidgetheader.h index eca9cbac..ebf2d902 100644 --- a/widgets/chatwidgetheader.h +++ b/widgets/chatwidgetheader.h @@ -13,8 +13,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { class ChatWidget; class ChatWidgetHeader : public QWidget diff --git a/widgets/chatwidgetheaderbutton.cpp b/widgets/chatwidgetheaderbutton.cpp index c48017fa..625f1506 100644 --- a/widgets/chatwidgetheaderbutton.cpp +++ b/widgets/chatwidgetheaderbutton.cpp @@ -4,8 +4,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { ChatWidgetHeaderButton::ChatWidgetHeaderButton(int spacing) : QWidget() diff --git a/widgets/chatwidgetheaderbutton.h b/widgets/chatwidgetheaderbutton.h index 7f0838c6..6333ee70 100644 --- a/widgets/chatwidgetheaderbutton.h +++ b/widgets/chatwidgetheaderbutton.h @@ -8,8 +8,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { class ChatWidgetHeaderButton : public QWidget { diff --git a/widgets/chatwidgetinput.cpp b/widgets/chatwidgetinput.cpp index a66ad3e1..44226f08 100644 --- a/widgets/chatwidgetinput.cpp +++ b/widgets/chatwidgetinput.cpp @@ -8,8 +8,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { ChatWidgetInput::ChatWidgetInput(ChatWidget *widget) : _chatWidget(widget) diff --git a/widgets/chatwidgetinput.h b/widgets/chatwidgetinput.h index 80203d8a..a53a5535 100644 --- a/widgets/chatwidgetinput.h +++ b/widgets/chatwidgetinput.h @@ -49,7 +49,7 @@ private slots: void editTextChanged(); // void editKeyPressed(QKeyEvent *event); }; -} -} +} // namespace widgets +} // namespace chatterino #endif // CHATWIDGETINPUT_H diff --git a/widgets/chatwidgetview.cpp b/widgets/chatwidgetview.cpp index 4c27d46a..a2dfd4f4 100644 --- a/widgets/chatwidgetview.cpp +++ b/widgets/chatwidgetview.cpp @@ -26,9 +26,9 @@ ChatWidgetView::ChatWidgetView(ChatWidget *parent) , _mouseDown(false) , _lastPressPosition() { - this->setAttribute(Qt::WA_OpaquePaintEvent); + setAttribute(Qt::WA_OpaquePaintEvent); _scrollbar.setSmallChange(5); - this->setMouseTracking(true); + setMouseTracking(true); QObject::connect(&SettingsManager::getInstance(), &SettingsManager::wordTypeMaskChanged, this, &ChatWidgetView::wordTypeMaskChanged); @@ -46,7 +46,7 @@ bool ChatWidgetView::layoutMessages() { auto messages = _chatWidget->getMessagesSnapshot(); - if (messages.getLength() == 0) { + if (messages.getSize() == 0) { _scrollbar.setVisible(false); return false; @@ -57,14 +57,13 @@ bool ChatWidgetView::layoutMessages() int start = _scrollbar.getCurrentValue(); // layout the visible messages in the view - if (messages.getLength() > start) { - int y = -(messages[start].get()->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1))); + if (messages.getSize() > start) { + int y = -(messages[start]->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1))); - for (int i = start; i < messages.getLength(); ++i) { - auto messagePtr = messages[i]; - auto message = messagePtr.get(); + for (int i = start; i < messages.getSize(); ++i) { + auto message = messages[i]; - redraw |= message->layout(this->width(), true); + redraw |= message->layout(width(), true); y += message->getHeight(); @@ -75,17 +74,17 @@ bool ChatWidgetView::layoutMessages() } // layout the messages at the bottom to determine the scrollbar thumb size - int h = this->height() - 8; + int h = height() - 8; - for (int i = messages.getLength() - 1; i >= 0; i--) { + for (int i = messages.getSize() - 1; i >= 0; i--) { auto *message = messages[i].get(); - message->layout(this->width(), true); + message->layout(width(), true); h -= message->getHeight(); if (h < 0) { - _scrollbar.setLargeChange((messages.getLength() - i) + (qreal)h / message->getHeight()); + _scrollbar.setLargeChange((messages.getSize() - i) + (qreal)h / message->getHeight()); _scrollbar.setDesiredValue(_scrollbar.getDesiredValue()); showScrollbar = true; @@ -99,7 +98,7 @@ bool ChatWidgetView::layoutMessages() _scrollbar.setDesiredValue(0); } - _scrollbar.setMaximum(messages.getLength()); + _scrollbar.setMaximum(messages.getSize()); return redraw; } @@ -107,7 +106,7 @@ bool ChatWidgetView::layoutMessages() void ChatWidgetView::updateGifEmotes() { _onlyUpdateEmotes = true; - this->update(); + update(); } ScrollBar *ChatWidgetView::getScrollbar() @@ -188,13 +187,13 @@ void ChatWidgetView::paintEvent(QPaintEvent *event) int start = _scrollbar.getCurrentValue(); - if (start >= messages.getLength()) { + if (start >= messages.getSize()) { return; } int y = -(messages[start].get()->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1))); - for (int i = start; i < messages.getLength(); ++i) { + for (int i = start; i < messages.getSize(); ++i) { messages::MessageRef *messageRef = messages[i].get(); std::shared_ptr bufferPtr = messageRef->buffer; @@ -203,7 +202,7 @@ void ChatWidgetView::paintEvent(QPaintEvent *event) bool updateBuffer = messageRef->updateBuffer; if (buffer == nullptr) { - buffer = new QPixmap(this->width(), messageRef->getHeight()); + buffer = new QPixmap(width(), messageRef->getHeight()); bufferPtr = std::shared_ptr(buffer); updateBuffer = true; } @@ -282,10 +281,10 @@ void ChatWidgetView::paintEvent(QPaintEvent *event) void ChatWidgetView::wheelEvent(QWheelEvent *event) { if (_scrollbar.isVisible()) { + auto mouseMultiplier = SettingsManager::getInstance().mouseScrollMultiplier.get(); + _scrollbar.setDesiredValue( - _scrollbar.getDesiredValue() - - event->delta() / 10.0 * SettingsManager::getInstance().mouseScrollMultiplier.get(), - true); + _scrollbar.getDesiredValue() - event->delta() / 10.0 * mouseMultiplier, true); } } @@ -295,7 +294,7 @@ void ChatWidgetView::mouseMoveEvent(QMouseEvent *event) QPoint relativePos; if (!tryGetMessageAt(event->pos(), message, relativePos)) { - this->setCursor(Qt::ArrowCursor); + setCursor(Qt::ArrowCursor); return; } @@ -305,16 +304,16 @@ void ChatWidgetView::mouseMoveEvent(QMouseEvent *event) messages::Word hoverWord; if (!message->tryGetWordPart(relativePos, hoverWord)) { - this->setCursor(Qt::ArrowCursor); + setCursor(Qt::ArrowCursor); return; } int index = message->getSelectionIndex(relativePos); if (hoverWord.getLink().getIsValid()) { - this->setCursor(Qt::PointingHandCursor); + setCursor(Qt::PointingHandCursor); } else { - this->setCursor(Qt::ArrowCursor); + setCursor(Qt::ArrowCursor); } } @@ -386,13 +385,13 @@ bool ChatWidgetView::tryGetMessageAt(QPoint p, std::shared_ptr= messages.getLength()) { + if (start >= messages.getSize()) { return false; } - int y = -(messages[start].get()->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1))) + 12; + int y = -(messages[start]->getHeight() * (fmod(_scrollbar.getCurrentValue(), 1))) + 12; - for (int i = start; i < messages.getLength(); ++i) { + for (int i = start; i < messages.getSize(); ++i) { auto message = messages[i]; y += message->getHeight(); @@ -406,5 +405,5 @@ bool ChatWidgetView::tryGetMessageAt(QPoint p, std::shared_ptr #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { FancyButton::FancyButton(QWidget *parent) : QWidget(parent) diff --git a/widgets/fancybutton.h b/widgets/fancybutton.h index 736e784d..6b52c8e5 100644 --- a/widgets/fancybutton.h +++ b/widgets/fancybutton.h @@ -7,8 +7,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { class FancyButton : public QWidget { struct ClickEffect { diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 1a506116..9950d744 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -13,8 +13,8 @@ #include "Windows.h" #endif -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { MainWindow::MainWindow(QWidget *parent) : QWidget(parent) @@ -139,5 +139,5 @@ Notebook &MainWindow::getNotebook() { return _notebook; } -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino diff --git a/widgets/mainwindow.h b/widgets/mainwindow.h index 61d00c54..18341429 100644 --- a/widgets/mainwindow.h +++ b/widgets/mainwindow.h @@ -8,8 +8,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { class MainWindow : public QWidget { @@ -37,7 +37,7 @@ private: TitleBar _titleBar; }; -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino #endif // MAINWINDOW_H diff --git a/widgets/notebook.cpp b/widgets/notebook.cpp index ceb348c4..5caab511 100644 --- a/widgets/notebook.cpp +++ b/widgets/notebook.cpp @@ -14,8 +14,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { Notebook::Notebook(QWidget *parent) : QWidget(parent) @@ -242,5 +242,5 @@ void Notebook::loadDefaults() addPage(); } -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino diff --git a/widgets/notebook.h b/widgets/notebook.h index ae334cd0..dfbe5842 100644 --- a/widgets/notebook.h +++ b/widgets/notebook.h @@ -9,8 +9,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { class Notebook : public QWidget { @@ -61,7 +61,7 @@ public: void loadDefaults(); }; -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino #endif // NOTEBOOK_H diff --git a/widgets/notebookbutton.cpp b/widgets/notebookbutton.cpp index 91b32b69..012fc858 100644 --- a/widgets/notebookbutton.cpp +++ b/widgets/notebookbutton.cpp @@ -7,8 +7,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { NotebookButton::NotebookButton(QWidget *parent) : FancyButton(parent) diff --git a/widgets/notebookbutton.h b/widgets/notebookbutton.h index 2e2edf7b..3a3fa618 100644 --- a/widgets/notebookbutton.h +++ b/widgets/notebookbutton.h @@ -33,7 +33,7 @@ private: bool _mouseDown = false; QPoint _mousePos; }; -} -} +} // namespace widgets +} // namespace chatterino #endif // NOTEBOOKBUTTON_H diff --git a/widgets/notebookpage.cpp b/widgets/notebookpage.cpp index 0e7d9472..5264f33c 100644 --- a/widgets/notebookpage.cpp +++ b/widgets/notebookpage.cpp @@ -12,8 +12,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { bool NotebookPage::isDraggingSplit = false; ChatWidget *NotebookPage::draggingSplit = NULL; @@ -334,5 +334,5 @@ boost::property_tree::ptree NotebookPage::save() return tree; } -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino diff --git a/widgets/notebookpage.h b/widgets/notebookpage.h index 713c6a05..f3008067 100644 --- a/widgets/notebookpage.h +++ b/widgets/notebookpage.h @@ -78,7 +78,7 @@ public: boost::property_tree::ptree save(); }; -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino #endif // NOTEBOOKPAGE_H diff --git a/widgets/notebookpagedroppreview.cpp b/widgets/notebookpagedroppreview.cpp index f135bfbd..3a2ff20f 100644 --- a/widgets/notebookpagedroppreview.cpp +++ b/widgets/notebookpagedroppreview.cpp @@ -4,8 +4,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { NotebookPageDropPreview::NotebookPageDropPreview(QWidget *parent) : QWidget(parent) diff --git a/widgets/notebookpagedroppreview.h b/widgets/notebookpagedroppreview.h index 39ade28b..017747da 100644 --- a/widgets/notebookpagedroppreview.h +++ b/widgets/notebookpagedroppreview.h @@ -23,7 +23,7 @@ protected: QRect desiredGeometry; bool animate; }; -} -} +} // namespace widgets +} // namespace chatterino #endif // NOTEBOOKPAGEDROPPREVIEW_H diff --git a/widgets/notebooktab.cpp b/widgets/notebooktab.cpp index acbfac6a..557d9701 100644 --- a/widgets/notebooktab.cpp +++ b/widgets/notebooktab.cpp @@ -5,8 +5,8 @@ #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { NotebookTab::NotebookTab(Notebook *notebook) : QWidget(notebook) @@ -246,5 +246,5 @@ boost::property_tree::ptree NotebookTab::save() return tree; } -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino diff --git a/widgets/notebooktab.h b/widgets/notebooktab.h index acc7bf87..404b22c1 100644 --- a/widgets/notebooktab.h +++ b/widgets/notebooktab.h @@ -81,7 +81,7 @@ public: boost::property_tree::ptree save(); }; -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino #endif // NOTEBOOKTAB_H diff --git a/widgets/scrollbar.cpp b/widgets/scrollbar.cpp index 70e67661..1f88c123 100644 --- a/widgets/scrollbar.cpp +++ b/widgets/scrollbar.cpp @@ -6,8 +6,8 @@ #define MIN_THUMB_HEIGHT 10 -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { ScrollBar::ScrollBar(QWidget *widget) : QWidget(widget) diff --git a/widgets/scrollbar.h b/widgets/scrollbar.h index cebdc358..fa0d1467 100644 --- a/widgets/scrollbar.h +++ b/widgets/scrollbar.h @@ -9,8 +9,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { class ScrollBar : public QWidget { diff --git a/widgets/scrollbarhighlight.cpp b/widgets/scrollbarhighlight.cpp index 96e0b395..8deffe26 100644 --- a/widgets/scrollbarhighlight.cpp +++ b/widgets/scrollbarhighlight.cpp @@ -1,8 +1,8 @@ #include "widgets/scrollbarhighlight.h" #include "colorscheme.h" -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { ScrollBarHighlight::ScrollBarHighlight(float position, int colorIndex, Style style, QString tag) : _position(position) diff --git a/widgets/scrollbarhighlight.h b/widgets/scrollbarhighlight.h index 0fd08a3c..d9101811 100644 --- a/widgets/scrollbarhighlight.h +++ b/widgets/scrollbarhighlight.h @@ -3,8 +3,8 @@ #include "QString" -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { class ScrollBarHighlight { diff --git a/widgets/settingsdialog.cpp b/widgets/settingsdialog.cpp index 7ccb75ef..26e71907 100644 --- a/widgets/settingsdialog.cpp +++ b/widgets/settingsdialog.cpp @@ -13,8 +13,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { SettingsDialog::SettingsDialog() : _snapshot(SettingsManager::getInstance().createSnapshot()) @@ -325,5 +325,5 @@ void SettingsDialog::cancelButtonClicked() this->close(); } -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino diff --git a/widgets/settingsdialog.h b/widgets/settingsdialog.h index edd74b6e..88b7bf2c 100644 --- a/widgets/settingsdialog.h +++ b/widgets/settingsdialog.h @@ -16,8 +16,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { class SettingsDialog : public QWidget { @@ -50,7 +50,7 @@ private: void cancelButtonClicked(); }; -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino #endif // SETTINGSDIALOG_H diff --git a/widgets/settingsdialogtab.cpp b/widgets/settingsdialogtab.cpp index 5732e5ef..0157e4a0 100644 --- a/widgets/settingsdialogtab.cpp +++ b/widgets/settingsdialogtab.cpp @@ -63,12 +63,13 @@ void SettingsDialogTab::paintEvent(QPaintEvent *) QTextOption(Qt::AlignLeft | Qt::AlignVCenter)); } -void SettingsDialogTab::mouseReleaseEvent(QMouseEvent *event) +void SettingsDialogTab::mousePressEvent(QMouseEvent *event) { - if (event->button() != Qt::LeftButton) + if (event->button() != Qt::LeftButton) { return; + } _dialog->select(this); } -} -} +} // namespace widgets +} // namespace chatterino diff --git a/widgets/settingsdialogtab.h b/widgets/settingsdialogtab.h index ac495cbc..863577f7 100644 --- a/widgets/settingsdialogtab.h +++ b/widgets/settingsdialogtab.h @@ -27,7 +27,7 @@ signals: private: void paintEvent(QPaintEvent *); - void mouseReleaseEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event); QWidget *_widget; QString _label; @@ -37,7 +37,7 @@ private: bool _selected; }; -} -} +} // namespace widgets +} // namespace chatterino #endif // SETTINGSNOTEBOOKTAB_H diff --git a/widgets/textinputdialog.cpp b/widgets/textinputdialog.cpp index 9c231913..cb5ebe3b 100644 --- a/widgets/textinputdialog.cpp +++ b/widgets/textinputdialog.cpp @@ -1,8 +1,8 @@ #include "widgets/textinputdialog.h" #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { TextInputDialog::TextInputDialog(QWidget *parent) : QDialog(parent) diff --git a/widgets/textinputdialog.h b/widgets/textinputdialog.h index 9354b9a6..357e6e55 100644 --- a/widgets/textinputdialog.h +++ b/widgets/textinputdialog.h @@ -8,8 +8,8 @@ #include #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { class TextInputDialog : public QDialog { diff --git a/widgets/titlebar.cpp b/widgets/titlebar.cpp index c898ec3b..a5e86518 100644 --- a/widgets/titlebar.cpp +++ b/widgets/titlebar.cpp @@ -1,7 +1,7 @@ #include "titlebar.h" -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { TitleBar::TitleBar(QWidget *parent) : QWidget(parent) { diff --git a/widgets/titlebar.h b/widgets/titlebar.h index ab72d880..8ce06b26 100644 --- a/widgets/titlebar.h +++ b/widgets/titlebar.h @@ -3,8 +3,8 @@ #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { class TitleBar : public QWidget { public: diff --git a/widgets/userpopupwidget.cpp b/widgets/userpopupwidget.cpp index 4cea7877..3ff94b5b 100644 --- a/widgets/userpopupwidget.cpp +++ b/widgets/userpopupwidget.cpp @@ -4,8 +4,8 @@ #include -namespace chatterino { -namespace widgets { +namespace chatterino { +namespace widgets { UserPopupWidget::UserPopupWidget(std::shared_ptr &&channel) : QWidget(nullptr) @@ -37,5 +37,5 @@ void UserPopupWidget::setName(const QString &name) _ui->lblUsername->setText(name); } -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino diff --git a/widgets/userpopupwidget.h b/widgets/userpopupwidget.h index 7979ea99..f427765d 100644 --- a/widgets/userpopupwidget.h +++ b/widgets/userpopupwidget.h @@ -5,15 +5,15 @@ #include -namespace Ui { +namespace Ui { class UserPopup; } -namespace chatterino { +namespace chatterino { class Channel; -namespace widgets { +namespace widgets { class UserPopupWidget : public QWidget { @@ -29,7 +29,7 @@ private: std::shared_ptr _channel; }; -} // namespace widgets -} // namespace chatterino +} // namespace widgets +} // namespace chatterino #endif // USERPOPUPWIDGET_H diff --git a/windowmanager.cpp b/windowmanager.cpp index 8aa2a7b6..ed8f3f9f 100644 --- a/windowmanager.cpp +++ b/windowmanager.cpp @@ -121,4 +121,4 @@ void WindowManager::save() boost::property_tree::write_json(settingsPath, tree); } -} // namespace chatterino +} // namespace chatterino diff --git a/windowmanager.h b/windowmanager.h index 9b4b15da..7b554958 100644 --- a/windowmanager.h +++ b/windowmanager.h @@ -34,6 +34,6 @@ private: widgets::MainWindow *_mainWindow; }; -} // namespace chatterino +} // namespace chatterino #endif // WINDOWS_H