From 5b2b2e3e19faefa161adc8671cb9dcae1ce2fc63 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Wed, 7 Jun 2017 10:09:24 +0200 Subject: [PATCH] refactor/reformat. remove useless common.h --- chatterino.pro | 1 - src/accountmanager.h | 5 +---- src/appdatapath.h | 7 ++----- src/asyncexec.h | 11 +++++------ src/channel.h | 6 ++---- src/channelmanager.h | 5 +---- src/colorscheme.cpp | 1 + src/colorscheme.h | 6 ++---- src/common.h | 17 ----------------- src/concurrentmap.h | 5 +---- src/emojis.cpp | 3 ++- src/emojis.h | 7 +++---- src/emotemanager.cpp | 1 + src/emotemanager.h | 5 +---- src/fontmanager.cpp | 3 ++- src/fontmanager.h | 6 ++---- src/ircaccount.cpp | 3 ++- src/ircaccount.h | 5 +---- src/ircmanager.cpp | 1 - src/logging/loggingchannel.h | 5 +---- src/logging/loggingmanager.h | 5 +---- src/main.cpp | 1 - src/messages/limitedqueue.h | 5 +---- src/messages/limitedqueuesnapshot.h | 6 ++---- src/messages/link.cpp | 5 +++-- src/messages/link.h | 8 +++----- src/messages/message.cpp | 1 + src/messages/message.h | 5 +---- src/messages/messageparseargs.h | 8 +++----- src/messages/messageref.h | 6 ++---- src/messages/word.cpp | 1 + src/messages/word.h | 5 +---- src/messages/wordpart.cpp | 5 +++-- src/messages/wordpart.h | 8 +++----- src/resources.cpp | 3 ++- src/resources.h | 6 ++---- src/setting.h | 5 +---- src/settingsmanager.h | 5 +---- src/settingssnapshot.h | 6 ++---- src/twitch/emotevalue.h | 8 +++----- src/twitch/twitchmessagebuilder.cpp | 6 ++++-- src/twitch/twitchmessagebuilder.h | 9 ++++----- src/twitch/twitchuser.cpp | 6 ++++-- src/twitch/twitchuser.h | 5 +---- src/util/distancebetweenpoints.h | 8 +++----- src/widgets/accountpopup.h | 5 +---- src/widgets/chatwidget.h | 5 +---- src/widgets/chatwidgetheader.cpp | 5 +++-- src/widgets/chatwidgetheader.h | 10 ++++------ src/widgets/chatwidgetheaderbutton.cpp | 8 ++++---- src/widgets/chatwidgetheaderbutton.h | 8 +++----- src/widgets/chatwidgetinput.cpp | 7 ++++--- src/widgets/chatwidgetinput.h | 6 ++---- src/widgets/fancybutton.cpp | 5 +++-- src/widgets/fancybutton.h | 9 ++++----- src/widgets/mainwindow.cpp | 1 + src/widgets/mainwindow.h | 5 +---- src/widgets/notebook.h | 5 +---- src/widgets/notebookbutton.cpp | 5 +++-- src/widgets/notebookbutton.h | 5 +---- src/widgets/notebookpage.cpp | 3 +-- src/widgets/notebookpage.h | 5 +---- src/widgets/notebookpagedroppreview.cpp | 5 +++-- src/widgets/notebookpagedroppreview.h | 6 ++---- src/widgets/notebooktab.h | 5 +---- src/widgets/resizingtextedit.h | 5 +---- src/widgets/scrollbarhighlight.h | 5 +---- src/widgets/settingsdialog.h | 5 +---- src/widgets/settingsdialogtab.cpp | 1 + src/widgets/settingsdialogtab.h | 6 ++---- src/widgets/signallabel.h | 5 +---- src/widgets/textinputdialog.cpp | 5 +++-- src/widgets/textinputdialog.h | 8 +++----- src/widgets/titlebar.cpp | 6 ++++-- src/widgets/titlebar.h | 9 ++++----- src/windowmanager.h | 5 +---- 76 files changed, 148 insertions(+), 264 deletions(-) delete mode 100644 src/common.h diff --git a/chatterino.pro b/chatterino.pro index b1aae5cfe..536856f2e 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -96,7 +96,6 @@ HEADERS += \ src/asyncexec.h \ src/channel.h \ src/colorscheme.h \ - src/common.h \ src/concurrentmap.h \ src/emojis.h \ src/ircmanager.h \ diff --git a/src/accountmanager.h b/src/accountmanager.h index e706d1c5a..ec8e578a4 100644 --- a/src/accountmanager.h +++ b/src/accountmanager.h @@ -1,5 +1,4 @@ -#ifndef ACCOUNTMANAGER_H -#define ACCOUNTMANAGER_H +#pragma once #include "twitch/twitchuser.h" @@ -35,5 +34,3 @@ private: }; } // namespace chatterino - -#endif // ACCOUNTMANAGER_H diff --git a/src/appdatapath.h b/src/appdatapath.h index 5cac1f66a..0a56fc120 100644 --- a/src/appdatapath.h +++ b/src/appdatapath.h @@ -1,8 +1,7 @@ -#ifndef APPDATAPATH_H -#define APPDATAPATH_H +#pragma once #include -#include + #include class Path @@ -14,5 +13,3 @@ private: static QString appdataPath; static std::mutex appdataPathMutex; }; - -#endif // APPDATAPATH_H diff --git a/src/asyncexec.h b/src/asyncexec.h index 5696c3bd3..ba36b2682 100644 --- a/src/asyncexec.h +++ b/src/asyncexec.h @@ -1,15 +1,16 @@ -#ifndef ASYNCEXEC_H -#define ASYNCEXEC_H +#pragma once -#include "qcoreapplication.h" +#include #include #include + #include #define async_exec(a) QThreadPool::globalInstance()->start(new LambdaRunnable(a)); -class LambdaRunnable : public QRunnable { +class LambdaRunnable : public QRunnable +{ public: LambdaRunnable(std::function action) { @@ -24,5 +25,3 @@ public: private: std::function action; }; - -#endif // ASYNCEXEC_H diff --git a/src/channel.h b/src/channel.h index 97c9d4fb2..b364485be 100644 --- a/src/channel.h +++ b/src/channel.h @@ -1,5 +1,4 @@ -#ifndef CHANNEL_H -#define CHANNEL_H +#pragma once #include "concurrentmap.h" #include "logging/loggingchannel.h" @@ -11,6 +10,7 @@ #include #include #include + #include namespace chatterino { @@ -78,5 +78,3 @@ private: }; } // namespace chatterino - -#endif // CHANNEL_H diff --git a/src/channelmanager.h b/src/channelmanager.h index 7df13f38f..8b1048dbf 100644 --- a/src/channelmanager.h +++ b/src/channelmanager.h @@ -1,5 +1,4 @@ -#ifndef CHANNELS_H -#define CHANNELS_H +#pragma once #include "channel.h" @@ -37,5 +36,3 @@ private: }; } // namespace chatterino - -#endif // CHANNELS_H diff --git a/src/colorscheme.cpp b/src/colorscheme.cpp index 2769a37bb..7e631db76 100644 --- a/src/colorscheme.cpp +++ b/src/colorscheme.cpp @@ -171,4 +171,5 @@ void ColorScheme::normalizeColor(QColor &color) // color.setHslF(color.hueF(), s, newL); } + } // namespace chatterino diff --git a/src/colorscheme.h b/src/colorscheme.h index dfbcf82fa..7b95d437a 100644 --- a/src/colorscheme.h +++ b/src/colorscheme.h @@ -1,5 +1,4 @@ -#ifndef COLORSCHEME_H -#define COLORSCHEME_H +#pragma once #include #include @@ -89,6 +88,5 @@ private: void fillLookupTableValues(qreal (&array)[360], qreal from, qreal to, qreal fromValue, qreal toValue); }; -} -#endif // COLORSCHEME_H +} // namespace chatterino diff --git a/src/common.h b/src/common.h deleted file mode 100644 index c2911a848..000000000 --- a/src/common.h +++ /dev/null @@ -1,17 +0,0 @@ -#include - -#ifndef COMMON_H -#define COMMON_H - -#define STRINGISE_IMPL(x) #x -#define STRINGISE(x) STRINGISE_IMPL(x) - -// Use: #pragma message WARN("My message") -#if _MSC_VER -#define FILE_LINE_LINK __FILE__ "(" STRINGISE(__LINE__) ") : " -#define WARN(exp) (FILE_LINE_LINK "WARNING: " exp) -#else //__GNUC__ - may need other defines for different compilers -#define WARN(exp) ("WARNING: " exp) -#endif - -#endif // COMMON_H diff --git a/src/concurrentmap.h b/src/concurrentmap.h index 1e5fba6f8..18086e14a 100644 --- a/src/concurrentmap.h +++ b/src/concurrentmap.h @@ -1,5 +1,4 @@ -#ifndef CONCURRENTMAP_H -#define CONCURRENTMAP_H +#pragma once #include #include @@ -66,5 +65,3 @@ private: }; } // namespace chatterino - -#endif // CONCURRENTMAP_H diff --git a/src/emojis.cpp b/src/emojis.cpp index 9ad302c8d..954b43aec 100644 --- a/src/emojis.cpp +++ b/src/emojis.cpp @@ -114,4 +114,5 @@ void Emojis::loadEmojis() QMap{{emoji.second.value, emoji.second.code}}); } } -} + +} // namespace chatterino diff --git a/src/emojis.h b/src/emojis.h index 6a172a486..c5551a102 100644 --- a/src/emojis.h +++ b/src/emojis.h @@ -1,5 +1,4 @@ -#ifndef EMOJIS_H -#define EMOJIS_H +#pragma once #include "concurrentmap.h" #include "messages/lazyloadedimage.h" @@ -7,6 +6,7 @@ #include #include #include + #include namespace chatterino { @@ -39,6 +39,5 @@ private: { } }; -} -#endif // EMOJIS_H +} // namespace chatterino diff --git a/src/emotemanager.cpp b/src/emotemanager.cpp index 912229ec4..6a43fa5ec 100644 --- a/src/emotemanager.cpp +++ b/src/emotemanager.cpp @@ -9,6 +9,7 @@ #include #include #include + #include #define TWITCH_EMOTE_TEMPLATE "https://static-cdn.jtvnw.net/emoticons/v1/{id}/{scale}.0" diff --git a/src/emotemanager.h b/src/emotemanager.h index f8f8e88f3..4302c6f22 100644 --- a/src/emotemanager.h +++ b/src/emotemanager.h @@ -1,5 +1,4 @@ -#ifndef EMOTES_H -#define EMOTES_H +#pragma once #define GIF_FRAME_LENGTH 33 @@ -94,5 +93,3 @@ private: }; } // namespace chatterino - -#endif // EMOTES_H diff --git a/src/fontmanager.cpp b/src/fontmanager.cpp index ab0ddbdf6..932cab3e1 100644 --- a/src/fontmanager.cpp +++ b/src/fontmanager.cpp @@ -59,4 +59,5 @@ QFontMetrics &FontManager::getFontMetrics(Type type) return *_metricsMedium; } -} + +} // namespace chatterino diff --git a/src/fontmanager.h b/src/fontmanager.h index 2edf2f16a..2ca41e4a3 100644 --- a/src/fontmanager.h +++ b/src/fontmanager.h @@ -1,5 +1,4 @@ -#ifndef FONTS_H -#define FONTS_H +#pragma once #include #include @@ -50,6 +49,5 @@ private: int _generation; }; -} -#endif // FONTS_H +} // namespace chatterino diff --git a/src/ircaccount.cpp b/src/ircaccount.cpp index 02a781cbc..e2222219e 100644 --- a/src/ircaccount.cpp +++ b/src/ircaccount.cpp @@ -30,4 +30,5 @@ const QString &IrcUser2::getPassword() const { return _password; } -} + +} // namespace chatterino diff --git a/src/ircaccount.h b/src/ircaccount.h index 727bbe9cf..37d8ee0da 100644 --- a/src/ircaccount.h +++ b/src/ircaccount.h @@ -1,5 +1,4 @@ -#ifndef IRCUSER_H -#define IRCUSER_H +#pragma once #include @@ -24,5 +23,3 @@ private: }; } // namespace chatterino - -#endif // IRCUSER_H diff --git a/src/ircmanager.cpp b/src/ircmanager.cpp index fcf6ddedd..73ee7bc1a 100644 --- a/src/ircmanager.cpp +++ b/src/ircmanager.cpp @@ -217,7 +217,6 @@ void IrcManager::joinChannel(const QString &channelName) this->connectionMutex.unlock(); } - void IrcManager::partChannel(const QString &channelName) { this->connectionMutex.lock(); diff --git a/src/logging/loggingchannel.h b/src/logging/loggingchannel.h index 1ca7f4ce5..a422a6d13 100644 --- a/src/logging/loggingchannel.h +++ b/src/logging/loggingchannel.h @@ -1,5 +1,4 @@ -#ifndef LOGGINGCHANNEL_H -#define LOGGINGCHANNEL_H +#pragma once #include "messages/message.h" @@ -35,5 +34,3 @@ private: } // namespace logging } // namespace chatterino - -#endif // LOGGINGCHANNEL_H diff --git a/src/logging/loggingmanager.h b/src/logging/loggingmanager.h index e7d7d0399..438a9c36b 100644 --- a/src/logging/loggingmanager.h +++ b/src/logging/loggingmanager.h @@ -1,5 +1,4 @@ -#ifndef LOGGINGMANAGER_H -#define LOGGINGMANAGER_H +#pragma once #include "loggingchannel.h" @@ -13,5 +12,3 @@ std::shared_ptr get(const QString &channelName); } // namespace logging } // namespace chatterino - -#endif // LOGGINGMANAGER_H diff --git a/src/main.cpp b/src/main.cpp index e5950784b..8f6b5e107 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,5 @@ #include "channelmanager.h" #include "colorscheme.h" -#include "common.h" #include "emojis.h" #include "emotemanager.h" #include "ircmanager.h" diff --git a/src/messages/limitedqueue.h b/src/messages/limitedqueue.h index d32f94ffc..18c36458a 100644 --- a/src/messages/limitedqueue.h +++ b/src/messages/limitedqueue.h @@ -1,5 +1,4 @@ -#ifndef LIMITEDQUEUE_H -#define LIMITEDQUEUE_H +#pragma once #include "messages/limitedqueuesnapshot.h" @@ -96,5 +95,3 @@ private: } // namespace messages } // namespace chatterino - -#endif // LIMITEDQUEUE_H diff --git a/src/messages/limitedqueuesnapshot.h b/src/messages/limitedqueuesnapshot.h index b137b66a2..479161cbc 100644 --- a/src/messages/limitedqueuesnapshot.h +++ b/src/messages/limitedqueuesnapshot.h @@ -1,5 +1,4 @@ -#ifndef LIMITEDQUEUESNAPSHOT_H -#define LIMITEDQUEUESNAPSHOT_H +#pragma once #include #include @@ -34,7 +33,6 @@ private: int _offset; int _length; }; + } // namespace messages } // namespace chatterino - -#endif // LIMITEDQUEUESNAPSHOT_H diff --git a/src/messages/link.cpp b/src/messages/link.cpp index c41178cbc..dfbfb6a21 100644 --- a/src/messages/link.cpp +++ b/src/messages/link.cpp @@ -14,5 +14,6 @@ Link::Link(Type type, const QString &value) , value(value) { } -} -} + +} // namespace messages +} // namespace chatterino diff --git a/src/messages/link.h b/src/messages/link.h index a74b2235b..b271ec13e 100644 --- a/src/messages/link.h +++ b/src/messages/link.h @@ -1,5 +1,4 @@ -#ifndef LINK_H -#define LINK_H +#pragma once #include @@ -42,7 +41,6 @@ private: Type type; QString value; }; -} -} -#endif // LINK_H +} // namespace messages +} // namespace chatterino diff --git a/src/messages/message.cpp b/src/messages/message.cpp index c80eb2cea..af878433f 100644 --- a/src/messages/message.cpp +++ b/src/messages/message.cpp @@ -12,6 +12,7 @@ #include #include + #include #include #include diff --git a/src/messages/message.h b/src/messages/message.h index 2b1ee3c81..200840bce 100644 --- a/src/messages/message.h +++ b/src/messages/message.h @@ -1,5 +1,4 @@ -#ifndef MESSAGE_H -#define MESSAGE_H +#pragma once #include "messages/message.h" #include "messages/messageparseargs.h" @@ -67,5 +66,3 @@ private: } // namespace messages } // namespace chatterino - -#endif // MESSAGE_H diff --git a/src/messages/messageparseargs.h b/src/messages/messageparseargs.h index 8acfab565..f02f64415 100644 --- a/src/messages/messageparseargs.h +++ b/src/messages/messageparseargs.h @@ -1,5 +1,4 @@ -#ifndef MESSAGEPARSEARGS_H -#define MESSAGEPARSEARGS_H +#pragma once namespace chatterino { namespace messages { @@ -11,7 +10,6 @@ public: bool isSentWhisper = false; bool includeChannelName = false; }; -} -} -#endif // MESSAGEPARSEARGS_H +} // namespace messages +} // namespace chatterino diff --git a/src/messages/messageref.h b/src/messages/messageref.h index c0fe12cc4..c25754b6b 100644 --- a/src/messages/messageref.h +++ b/src/messages/messageref.h @@ -1,9 +1,9 @@ -#ifndef MESSAGEREF_H -#define MESSAGEREF_H +#pragma once #include "messages/message.h" #include + #include namespace chatterino { @@ -50,5 +50,3 @@ private: } // namespace messages } // namespace chatterino - -#endif // MESSAGEREF_H diff --git a/src/messages/word.cpp b/src/messages/word.cpp index 58ef5a75d..f1d06ebea 100644 --- a/src/messages/word.cpp +++ b/src/messages/word.cpp @@ -130,5 +130,6 @@ std::vector &Word::getCharacterWidthCache() const { return _characterWidthCache; } + } // namespace messages } // namespace chatterino diff --git a/src/messages/word.h b/src/messages/word.h index d4b72f2aa..01baa0c14 100644 --- a/src/messages/word.h +++ b/src/messages/word.h @@ -1,5 +1,4 @@ -#ifndef WORD_H -#define WORD_H +#pragma once #include "fontmanager.h" #include "messages/lazyloadedimage.h" @@ -116,5 +115,3 @@ private: } // namespace messages } // namespace chatterino - -#endif // WORD_H diff --git a/src/messages/wordpart.cpp b/src/messages/wordpart.cpp index 57deade4c..8b77e536e 100644 --- a/src/messages/wordpart.cpp +++ b/src/messages/wordpart.cpp @@ -102,5 +102,6 @@ int WordPart::getLineNumber() { return _lineNumber; } -} -} + +} // namespace messages +} // namespace chatterino diff --git a/src/messages/wordpart.h b/src/messages/wordpart.h index 15904c94c..65c6a7e45 100644 --- a/src/messages/wordpart.h +++ b/src/messages/wordpart.h @@ -1,5 +1,4 @@ -#ifndef WORDPART_H -#define WORDPART_H +#pragma once #include #include @@ -48,7 +47,6 @@ private: bool _trailingSpace; }; -} -} -#endif // WORDPART_H +} // namespace messages +} // namespace chatterino diff --git a/src/resources.cpp b/src/resources.cpp index 762ed7336..a4aa35f0a 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -56,4 +56,5 @@ void Resources::load() Resources::buttonTimeout = new messages::LazyLoadedImage(new QPixmap(":/images/button_timeout.png"), 0.25); } -} + +} // namespace chatterino diff --git a/src/resources.h b/src/resources.h index 0a0c7ee28..b57f34391 100644 --- a/src/resources.h +++ b/src/resources.h @@ -1,5 +1,4 @@ -#ifndef RESOURCES_H -#define RESOURCES_H +#pragma once #include "messages/lazyloadedimage.h" @@ -108,6 +107,5 @@ private: static messages::LazyLoadedImage *buttonBan; static messages::LazyLoadedImage *buttonTimeout; }; -} // namespace chatterino -#endif // RESOURCES_H +} // namespace chatterino diff --git a/src/setting.h b/src/setting.h index 76eceedb7..e69bfa1dd 100644 --- a/src/setting.h +++ b/src/setting.h @@ -1,5 +1,4 @@ -#ifndef SETTING_H -#define SETTING_H +#pragma once #include #include @@ -73,5 +72,3 @@ private: }; } // namespace chatterino - -#endif // SETTING_H diff --git a/src/settingsmanager.h b/src/settingsmanager.h index fc5c7bb99..710fc0888 100644 --- a/src/settingsmanager.h +++ b/src/settingsmanager.h @@ -1,5 +1,4 @@ -#ifndef APPSETTINGS_H -#define APPSETTINGS_H +#pragma once #include "messages/word.h" #include "setting.h" @@ -82,5 +81,3 @@ private: }; } // namespace chatterino - -#endif // APPSETTINGS_H diff --git a/src/settingssnapshot.h b/src/settingssnapshot.h index bf0fcd37d..858026d15 100644 --- a/src/settingssnapshot.h +++ b/src/settingssnapshot.h @@ -1,5 +1,4 @@ -#ifndef SETTINGSSNAPSHOT_H -#define SETTINGSSNAPSHOT_H +#pragma once #include "setting.h" @@ -28,6 +27,5 @@ public: private: std::vector, QVariant>> _items; }; -} // namespace chatterino -#endif // SETTINGSSNAPSHOT_H +} // namespace chatterino diff --git a/src/twitch/emotevalue.h b/src/twitch/emotevalue.h index 9170b713c..7d4763823 100644 --- a/src/twitch/emotevalue.h +++ b/src/twitch/emotevalue.h @@ -1,5 +1,4 @@ -#ifndef TWITCHEMOTEVALUE_H -#define TWITCHEMOTEVALUE_H +#pragma once #include "QString" @@ -28,7 +27,6 @@ private: int _id; QString _channelName; }; -} -} -#endif // TWITCHEMOTEVALUE_H +} // namespace twitch +} // namespace chatterino diff --git a/src/twitch/twitchmessagebuilder.cpp b/src/twitch/twitchmessagebuilder.cpp index 9b004537c..6a9338d28 100644 --- a/src/twitch/twitchmessagebuilder.cpp +++ b/src/twitch/twitchmessagebuilder.cpp @@ -9,6 +9,7 @@ using namespace chatterino::messages; namespace chatterino { namespace twitch { + TwitchMessageBuilder::TwitchMessageBuilder() : MessageBuilder() , messageId() @@ -345,5 +346,6 @@ SharedMessage TwitchMessageBuilder::parse(const Communi::IrcPrivateMessage *ircM //{ // return a.first < b.first; //} -} -} + +} // namespace twitch +} // namespace chatterino diff --git a/src/twitch/twitchmessagebuilder.h b/src/twitch/twitchmessagebuilder.h index d8bbfff2d..52d87261e 100644 --- a/src/twitch/twitchmessagebuilder.h +++ b/src/twitch/twitchmessagebuilder.h @@ -1,5 +1,4 @@ -#ifndef TWITCHMESSAGEBUILDER_H -#define TWITCHMESSAGEBUILDER_H +#pragma once #include "channel.h" #include "messages/messagebuilder.h" @@ -26,6 +25,6 @@ public: // const std::pair &a, // const std::pair &b); }; -} -} -#endif // TWITCHMESSAGEBUILDER_H + +} // namespace twitch +} // namespace chatterino diff --git a/src/twitch/twitchuser.cpp b/src/twitch/twitchuser.cpp index cb7ecda28..250d65cbe 100644 --- a/src/twitch/twitchuser.cpp +++ b/src/twitch/twitchuser.cpp @@ -2,6 +2,7 @@ namespace chatterino { namespace twitch { + TwitchUser::TwitchUser(const QString &username, const QString &oauthToken, const QString &oauthClient) : IrcUser2(username, username, username, "oauth:" + oauthToken) @@ -24,5 +25,6 @@ bool TwitchUser::isAnon() const { return IrcUser2::getNickName().startsWith("justinfan"); } -} -} + +} // namespace twitch +} // namespace chatterino diff --git a/src/twitch/twitchuser.h b/src/twitch/twitchuser.h index 29630ee8e..9746bd8f5 100644 --- a/src/twitch/twitchuser.h +++ b/src/twitch/twitchuser.h @@ -1,5 +1,4 @@ -#ifndef ACCOUNT_H -#define ACCOUNT_H +#pragma once #include "ircaccount.h" @@ -25,5 +24,3 @@ private: } // namespace twitch } // namespace chatterino - -#endif // ACCOUNT_H diff --git a/src/util/distancebetweenpoints.h b/src/util/distancebetweenpoints.h index f4513d352..2c7fd49fc 100644 --- a/src/util/distancebetweenpoints.h +++ b/src/util/distancebetweenpoints.h @@ -1,5 +1,4 @@ -#ifndef DISTANCEBETWEENPOINTS_H -#define DISTANCEBETWEENPOINTS_H +#pragma once #include @@ -16,7 +15,6 @@ static float distanceBetweenPoints(const QPointF &p1, const QPointF &p2) return sqrt(distance); } -} -} -#endif // DISTANCEBETWEENPOINTS_H +} // namespace util +} // namespace chatterino diff --git a/src/widgets/accountpopup.h b/src/widgets/accountpopup.h index 7276c2455..b5f177107 100644 --- a/src/widgets/accountpopup.h +++ b/src/widgets/accountpopup.h @@ -1,5 +1,4 @@ -#ifndef USERPOPUPWIDGET_H -#define USERPOPUPWIDGET_H +#pragma once #include @@ -31,5 +30,3 @@ private: } // namespace widgets } // namespace chatterino - -#endif // USERPOPUPWIDGET_H diff --git a/src/widgets/chatwidget.h b/src/widgets/chatwidget.h index 35bed5b5d..e3fc1d709 100644 --- a/src/widgets/chatwidget.h +++ b/src/widgets/chatwidget.h @@ -1,5 +1,4 @@ -#ifndef CHATWIDGET_H -#define CHATWIDGET_H +#pragma once #include "channel.h" #include "messages/limitedqueuesnapshot.h" @@ -65,5 +64,3 @@ public: } // namespace widgets } // namespace chatterino - -#endif // CHATWIDGET_H diff --git a/src/widgets/chatwidgetheader.cpp b/src/widgets/chatwidgetheader.cpp index 88b42b260..5f6eb1256 100644 --- a/src/widgets/chatwidgetheader.cpp +++ b/src/widgets/chatwidgetheader.cpp @@ -195,5 +195,6 @@ void ChatWidgetHeader::menuManualReconnect() void ChatWidgetHeader::menuShowChangelog() { } -} -} + +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/chatwidgetheader.h b/src/widgets/chatwidgetheader.h index cd9e69db1..77a27629a 100644 --- a/src/widgets/chatwidgetheader.h +++ b/src/widgets/chatwidgetheader.h @@ -1,5 +1,4 @@ -#ifndef CHATWIDGETHEADER_H -#define CHATWIDGETHEADER_H +#pragma once #include "signallabel.h" #include "widgets/chatwidgetheaderbutton.h" @@ -39,7 +38,7 @@ protected: void mouseDoubleClickEvent(QMouseEvent *event); private: - ChatWidget * const _chatWidget; + ChatWidget *const _chatWidget; QPoint _dragStart; bool _dragging; @@ -69,7 +68,6 @@ private slots: void menuManualReconnect(); void menuShowChangelog(); }; -} -} -#endif // CHATWIDGETHEADER_H +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/chatwidgetheaderbutton.cpp b/src/widgets/chatwidgetheaderbutton.cpp index c48017fad..6bd78a3b7 100644 --- a/src/widgets/chatwidgetheaderbutton.cpp +++ b/src/widgets/chatwidgetheaderbutton.cpp @@ -23,8 +23,7 @@ ChatWidgetHeaderButton::ChatWidgetHeaderButton(int spacing) _hbox.addWidget(&_label); _hbox.addSpacing(spacing); - QObject::connect(&_label, &SignalLabel::mouseUp, this, - &ChatWidgetHeaderButton::labelMouseUp); + QObject::connect(&_label, &SignalLabel::mouseUp, this, &ChatWidgetHeaderButton::labelMouseUp); QObject::connect(&_label, &SignalLabel::mouseDown, this, &ChatWidgetHeaderButton::labelMouseDown); } @@ -94,5 +93,6 @@ void ChatWidgetHeaderButton::labelMouseDown() update(); } -} -} + +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/chatwidgetheaderbutton.h b/src/widgets/chatwidgetheaderbutton.h index 7f0838c63..845b7a19d 100644 --- a/src/widgets/chatwidgetheaderbutton.h +++ b/src/widgets/chatwidgetheaderbutton.h @@ -1,5 +1,4 @@ -#ifndef CHATWIDGETHEADERBUTTON_H -#define CHATWIDGETHEADERBUTTON_H +#pragma once #include "widgets/signallabel.h" @@ -45,7 +44,6 @@ private: void labelMouseUp(); void labelMouseDown(); }; -} -} -#endif // CHATWIDGETHEADERBUTTON_H +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/chatwidgetinput.cpp b/src/widgets/chatwidgetinput.cpp index 9a1aedd6f..f72359a1c 100644 --- a/src/widgets/chatwidgetinput.cpp +++ b/src/widgets/chatwidgetinput.cpp @@ -60,7 +60,7 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *widget) completer->setWidget(&_edit); - _edit.keyPressed.connect([this/*, completer*/](QKeyEvent *event) { + _edit.keyPressed.connect([this /*, completer*/](QKeyEvent *event) { if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) { auto c = _chatWidget->getChannel(); if (c == nullptr) { @@ -137,5 +137,6 @@ void ChatWidgetInput::resizeEvent(QResizeEvent *) _edit.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); } } -} -} + +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/chatwidgetinput.h b/src/widgets/chatwidgetinput.h index dd1a21109..33852c161 100644 --- a/src/widgets/chatwidgetinput.h +++ b/src/widgets/chatwidgetinput.h @@ -1,5 +1,4 @@ -#ifndef CHATWIDGETINPUT_H -#define CHATWIDGETINPUT_H +#pragma once #include "resizingtextedit.h" #include "widgets/chatwidgetheaderbutton.h" @@ -49,7 +48,6 @@ private slots: void editTextChanged(); // void editKeyPressed(QKeyEvent *event); }; + } // namespace widgets } // namespace chatterino - -#endif // CHATWIDGETINPUT_H diff --git a/src/widgets/fancybutton.cpp b/src/widgets/fancybutton.cpp index dc70feae0..49ec38b9c 100644 --- a/src/widgets/fancybutton.cpp +++ b/src/widgets/fancybutton.cpp @@ -137,5 +137,6 @@ void FancyButton::onMouseEffectTimeout() update(); } } -} -} + +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/fancybutton.h b/src/widgets/fancybutton.h index 736e784d4..6d21b3f22 100644 --- a/src/widgets/fancybutton.h +++ b/src/widgets/fancybutton.h @@ -1,5 +1,4 @@ -#ifndef FANCYBUTTON_H -#define FANCYBUTTON_H +#pragma once #include #include @@ -9,6 +8,7 @@ namespace chatterino { namespace widgets { + class FancyButton : public QWidget { struct ClickEffect { @@ -49,7 +49,6 @@ private: void onMouseEffectTimeout(); }; -} -} -#endif // FANCYBUTTON_H +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/mainwindow.cpp b/src/widgets/mainwindow.cpp index b3923959f..c17c28995 100644 --- a/src/widgets/mainwindow.cpp +++ b/src/widgets/mainwindow.cpp @@ -150,5 +150,6 @@ Notebook &MainWindow::getNotebook() { return _notebook; } + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/mainwindow.h b/src/widgets/mainwindow.h index 490640527..799f631ab 100644 --- a/src/widgets/mainwindow.h +++ b/src/widgets/mainwindow.h @@ -1,5 +1,4 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H +#pragma once #include "widgets/notebook.h" #include "widgets/titlebar.h" @@ -42,5 +41,3 @@ private: } // namespace widgets } // namespace chatterino - -#endif // MAINWINDOW_H diff --git a/src/widgets/notebook.h b/src/widgets/notebook.h index ae334cd07..d6e2bd68d 100644 --- a/src/widgets/notebook.h +++ b/src/widgets/notebook.h @@ -1,5 +1,4 @@ -#ifndef NOTEBOOK_H -#define NOTEBOOK_H +#pragma once #include "widgets/notebookbutton.h" #include "widgets/notebookpage.h" @@ -63,5 +62,3 @@ public: } // namespace widgets } // namespace chatterino - -#endif // NOTEBOOK_H diff --git a/src/widgets/notebookbutton.cpp b/src/widgets/notebookbutton.cpp index 91b32b699..b130aa469 100644 --- a/src/widgets/notebookbutton.cpp +++ b/src/widgets/notebookbutton.cpp @@ -102,5 +102,6 @@ void NotebookButton::mouseReleaseEvent(QMouseEvent *event) FancyButton::mouseReleaseEvent(event); } -} -} + +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/notebookbutton.h b/src/widgets/notebookbutton.h index 22ecb86e0..7ec762857 100644 --- a/src/widgets/notebookbutton.h +++ b/src/widgets/notebookbutton.h @@ -1,5 +1,4 @@ -#ifndef NOTEBOOKBUTTON_H -#define NOTEBOOKBUTTON_H +#pragma once #include "fancybutton.h" @@ -36,5 +35,3 @@ private: } // namespace widgets } // namespace chatterino - -#endif // NOTEBOOKBUTTON_H diff --git a/src/widgets/notebookpage.cpp b/src/widgets/notebookpage.cpp index 94f891234..0ea50c017 100644 --- a/src/widgets/notebookpage.cpp +++ b/src/widgets/notebookpage.cpp @@ -49,8 +49,7 @@ NotebookTab *NotebookPage::getTab() const return _tab; } -void -NotebookPage::addChat(bool openChannelNameDialog) +void NotebookPage::addChat(bool openChannelNameDialog) { ChatWidget *w = new ChatWidget(); diff --git a/src/widgets/notebookpage.h b/src/widgets/notebookpage.h index b03b0c191..c69746c41 100644 --- a/src/widgets/notebookpage.h +++ b/src/widgets/notebookpage.h @@ -1,5 +1,4 @@ -#ifndef NOTEBOOKPAGE_H -#define NOTEBOOKPAGE_H +#pragma once #include "widgets/chatwidget.h" #include "widgets/notebookpage.h" @@ -82,5 +81,3 @@ public: } // namespace widgets } // namespace chatterino - -#endif // NOTEBOOKPAGE_H diff --git a/src/widgets/notebookpagedroppreview.cpp b/src/widgets/notebookpagedroppreview.cpp index f135bfbd0..1611d198c 100644 --- a/src/widgets/notebookpagedroppreview.cpp +++ b/src/widgets/notebookpagedroppreview.cpp @@ -50,5 +50,6 @@ void NotebookPageDropPreview::setBounds(const QRect &rect) animate = true; } -} -} + +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/notebookpagedroppreview.h b/src/widgets/notebookpagedroppreview.h index 017747da7..98a6a0383 100644 --- a/src/widgets/notebookpagedroppreview.h +++ b/src/widgets/notebookpagedroppreview.h @@ -1,5 +1,4 @@ -#ifndef NOTEBOOKPAGEDROPPREVIEW_H -#define NOTEBOOKPAGEDROPPREVIEW_H +#pragma once #include #include @@ -23,7 +22,6 @@ protected: QRect desiredGeometry; bool animate; }; + } // namespace widgets } // namespace chatterino - -#endif // NOTEBOOKPAGEDROPPREVIEW_H diff --git a/src/widgets/notebooktab.h b/src/widgets/notebooktab.h index acc7bf87e..cc4d90319 100644 --- a/src/widgets/notebooktab.h +++ b/src/widgets/notebooktab.h @@ -1,5 +1,4 @@ -#ifndef NOTEBOOKTAB_H -#define NOTEBOOKTAB_H +#pragma once #include #include @@ -83,5 +82,3 @@ public: } // namespace widgets } // namespace chatterino - -#endif // NOTEBOOKTAB_H diff --git a/src/widgets/resizingtextedit.h b/src/widgets/resizingtextedit.h index 64e9466e3..24279c0c8 100644 --- a/src/widgets/resizingtextedit.h +++ b/src/widgets/resizingtextedit.h @@ -1,5 +1,4 @@ -#ifndef RESIZINGTEXTEDIT_H -#define RESIZINGTEXTEDIT_H +#pragma once #include #include @@ -50,5 +49,3 @@ protected: } } }; - -#endif // RESIZINGTEXTEDIT_H diff --git a/src/widgets/scrollbarhighlight.h b/src/widgets/scrollbarhighlight.h index 7d59a7165..53ecd3e85 100644 --- a/src/widgets/scrollbarhighlight.h +++ b/src/widgets/scrollbarhighlight.h @@ -1,5 +1,4 @@ -#ifndef SCROLLBARHIGHLIGHT_H -#define SCROLLBARHIGHLIGHT_H +#pragma once #include "QString" @@ -45,5 +44,3 @@ private: } // namespace widgets } // namespace chatterino - -#endif // SCROLLBARHIGHLIGHT_H diff --git a/src/widgets/settingsdialog.h b/src/widgets/settingsdialog.h index 4ad7e4649..b65d6cc2d 100644 --- a/src/widgets/settingsdialog.h +++ b/src/widgets/settingsdialog.h @@ -1,5 +1,4 @@ -#ifndef SETTINGSDIALOG_H -#define SETTINGSDIALOG_H +#pragma once #include "settingsmanager.h" #include "settingssnapshot.h" @@ -54,5 +53,3 @@ private: } // namespace widgets } // namespace chatterino - -#endif // SETTINGSDIALOG_H diff --git a/src/widgets/settingsdialogtab.cpp b/src/widgets/settingsdialogtab.cpp index a21622cf0..302715598 100644 --- a/src/widgets/settingsdialogtab.cpp +++ b/src/widgets/settingsdialogtab.cpp @@ -71,5 +71,6 @@ void SettingsDialogTab::mousePressEvent(QMouseEvent *event) _dialog->select(this); } + } // namespace widgets } // namespace chatterino diff --git a/src/widgets/settingsdialogtab.h b/src/widgets/settingsdialogtab.h index a1bd13c04..f6a720f4c 100644 --- a/src/widgets/settingsdialogtab.h +++ b/src/widgets/settingsdialogtab.h @@ -1,5 +1,4 @@ -#ifndef SETTINGSNOTEBOOKTAB_H -#define SETTINGSNOTEBOOKTAB_H +#pragma once #include #include @@ -37,7 +36,6 @@ private: bool _selected; }; + } // namespace widgets } // namespace chatterino - -#endif // SETTINGSNOTEBOOKTAB_H diff --git a/src/widgets/signallabel.h b/src/widgets/signallabel.h index 849383641..e479b5695 100644 --- a/src/widgets/signallabel.h +++ b/src/widgets/signallabel.h @@ -1,5 +1,4 @@ -#ifndef SIGNALLABEL_H -#define SIGNALLABEL_H +#pragma once #include #include @@ -52,5 +51,3 @@ protected: event->ignore(); } }; - -#endif // SIGNALLABEL_H diff --git a/src/widgets/textinputdialog.cpp b/src/widgets/textinputdialog.cpp index 9c2319130..18b3270a5 100644 --- a/src/widgets/textinputdialog.cpp +++ b/src/widgets/textinputdialog.cpp @@ -38,5 +38,6 @@ void TextInputDialog::cancelButtonClicked() reject(); close(); } -} -} + +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/textinputdialog.h b/src/widgets/textinputdialog.h index 9354b9a6f..1e62ac41e 100644 --- a/src/widgets/textinputdialog.h +++ b/src/widgets/textinputdialog.h @@ -1,5 +1,4 @@ -#ifndef TEXTINPUTDIALOG_H -#define TEXTINPUTDIALOG_H +#pragma once #include #include @@ -39,7 +38,6 @@ private slots: void okButtonClicked(); void cancelButtonClicked(); }; -} -} -#endif // TEXTINPUTDIALOG_H +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/titlebar.cpp b/src/widgets/titlebar.cpp index c898ec3b5..150d2fd64 100644 --- a/src/widgets/titlebar.cpp +++ b/src/widgets/titlebar.cpp @@ -2,10 +2,12 @@ namespace chatterino { namespace widgets { + TitleBar::TitleBar(QWidget *parent) : QWidget(parent) { setFixedHeight(32); } -} -} + +} // namespace widgets +} // namespace chatterino diff --git a/src/widgets/titlebar.h b/src/widgets/titlebar.h index ab72d8803..43e068719 100644 --- a/src/widgets/titlebar.h +++ b/src/widgets/titlebar.h @@ -1,16 +1,15 @@ -#ifndef TITLEBAR_H -#define TITLEBAR_H +#pragma once #include namespace chatterino { namespace widgets { + class TitleBar : public QWidget { public: TitleBar(QWidget *parent = nullptr); }; -} -} -#endif // TITLEBAR_H +} // namespace widgets +} // namespace chatterino diff --git a/src/windowmanager.h b/src/windowmanager.h index 9b4b15da3..9681b20f2 100644 --- a/src/windowmanager.h +++ b/src/windowmanager.h @@ -1,5 +1,4 @@ -#ifndef WINDOWS_H -#define WINDOWS_H +#pragma once #include "widgets/mainwindow.h" @@ -35,5 +34,3 @@ private: }; } // namespace chatterino - -#endif // WINDOWS_H