diff --git a/chatterino.pro b/chatterino.pro index 61f797d0b..88907f6c3 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -1,509 +1,511 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2016-12-28T18:23:35 -# -#------------------------------------------------- - -message(----) - -QT += widgets core gui network multimedia svg -CONFIG += communi -COMMUNI += core model util -CONFIG += c++14 -INCLUDEPATH += src/ -TARGET = chatterino -TEMPLATE = app -DEFINES += QT_DEPRECATED_WARNINGS -PRECOMPILED_HEADER = src/PrecompiledHeader.hpp -CONFIG += precompile_header - -debug { - DEFINES += QT_DEBUG -} - -useBreakpad { - LIBS += -L$$PWD/lib/qBreakpad/handler/build - include(lib/qBreakpad/qBreakpad.pri) - DEFINES += C_USE_BREAKPAD -} - -# https://bugreports.qt.io/browse/QTBUG-27018 -equals(QMAKE_CXX, "clang++")|equals(QMAKE_CXX, "g++") { - TARGET = bin/chatterino -} - -# Icons -macx:ICON = resources/images/chatterino2.icns -win32:RC_FILE = resources/windows.rc - - -macx { - LIBS += -L/usr/local/lib -} - -# Submodules -include(dependencies/rapidjson.pri) -include(dependencies/settings.pri) -include(dependencies/signals.pri) -include(dependencies/humanize.pri) -include(dependencies/fmt.pri) -DEFINES += IRC_NAMESPACE=Communi -include(dependencies/libcommuni.pri) -include(dependencies/websocketpp.pri) -include(dependencies/openssl.pri) -include(dependencies/boost.pri) - -# Optional feature: QtWebEngine -#exists ($(QTDIR)/include/QtWebEngine/QtWebEngine) { -# message(Using QWebEngine) -# QT += webenginewidgets -# DEFINES += "USEWEBENGINE" -#} - -linux { - LIBS += -lrt -} - -win32 { - LIBS += -luser32 -} - -# OSX include directory -macx { - INCLUDEPATH += /usr/local/include -} - -# Optional dependency on Windows SDK 7 -!contains(QMAKE_TARGET.arch, x86_64) { - win32:exists(C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\Windows.h) { - LIBS += -L"C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib" \ - -ldwmapi - - DEFINES += "USEWINSDK" - message(Using Windows SDK 7) - } -} - -# Optional dependency on Windows SDK 10 -contains(QMAKE_TARGET.arch, x86_64) { - WIN_SDK_VERSION = $$(WindowsSDKVersion) - !isEmpty(WIN_SDK_VERSION) { - !equals(WIN_SDK_VERSION, "\\") { - DEFINES += "USEWINSDK" - message(Using Windows SDK 10) - } - } -} - -werr { - QMAKE_CXXFLAGS += -Werror - - message("Enabling error on warning") -} - -SOURCES += \ - src/Application.cpp \ - src/common/Channel.cpp \ - src/common/CompletionModel.cpp \ - src/common/Emotemap.cpp \ - src/common/NetworkData.cpp \ - src/common/NetworkManager.cpp \ - src/common/NetworkRequest.cpp \ - src/common/NetworkResult.cpp \ - src/common/NetworkTimer.cpp \ - src/controllers/accounts/Account.cpp \ - src/controllers/accounts/AccountController.cpp \ - src/controllers/accounts/AccountModel.cpp \ - src/controllers/commands/Command.cpp \ - src/controllers/commands/CommandController.cpp \ - src/controllers/commands/CommandModel.cpp \ - src/controllers/highlights/HighlightController.cpp \ - src/controllers/highlights/HighlightModel.cpp \ - src/controllers/highlights/HighlightBlacklistModel.cpp \ - src/controllers/highlights/UserHighlightModel.cpp \ - src/controllers/ignores/IgnoreController.cpp \ - src/controllers/ignores/IgnoreModel.cpp \ - src/controllers/taggedusers/TaggedUser.cpp \ - src/controllers/taggedusers/TaggedUsersController.cpp \ - src/controllers/taggedusers/TaggedUsersModel.cpp \ - src/main.cpp \ - src/messages/Image.cpp \ - src/messages/layouts/MessageLayout.cpp \ - src/messages/layouts/MessageLayoutContainer.cpp \ - src/messages/layouts/MessageLayoutElement.cpp \ - src/messages/Link.cpp \ - src/messages/Message.cpp \ - src/messages/MessageBuilder.cpp \ - src/messages/MessageColor.cpp \ - src/messages/MessageElement.cpp \ - src/providers/emoji/Emojis.cpp \ - src/providers/irc/AbstractIrcServer.cpp \ - src/providers/irc/IrcAccount.cpp \ - src/providers/irc/IrcChannel2.cpp \ - src/providers/irc/IrcConnection2.cpp \ - src/providers/irc/IrcServer.cpp \ - src/providers/twitch/IrcMessageHandler.cpp \ - src/providers/twitch/PartialTwitchUser.cpp \ - src/providers/twitch/PubsubActions.cpp \ - src/providers/twitch/PubsubHelpers.cpp \ - src/providers/twitch/TwitchAccount.cpp \ - src/providers/twitch/TwitchAccountManager.cpp \ - src/providers/twitch/TwitchChannel.cpp \ - src/providers/twitch/TwitchEmotes.cpp \ - src/providers/twitch/TwitchHelpers.cpp \ - src/providers/twitch/TwitchMessageBuilder.cpp \ - src/providers/twitch/TwitchServer.cpp \ - src/providers/twitch/TwitchUser.cpp \ - src/common/ChatterinoSetting.cpp \ - src/singletons/helper/GifTimer.cpp \ - src/singletons/helper/LoggingChannel.cpp \ - src/controllers/moderationactions/ModerationAction.cpp \ - src/singletons/WindowManager.cpp \ - src/util/DebugCount.cpp \ - src/util/RapidjsonHelpers.cpp \ - src/util/StreamLink.cpp \ - src/util/WindowsHelper.cpp \ - src/widgets/AccountSwitchPopupWidget.cpp \ - src/widgets/AccountSwitchWidget.cpp \ - src/widgets/AttachedWindow.cpp \ - src/widgets/BaseWidget.cpp \ - src/widgets/BaseWindow.cpp \ - src/widgets/dialogs/EmotePopup.cpp \ - src/widgets/dialogs/LastRunCrashDialog.cpp \ - src/widgets/dialogs/LoginDialog.cpp \ - src/widgets/dialogs/LogsPopup.cpp \ - src/widgets/dialogs/NotificationPopup.cpp \ - src/widgets/dialogs/QualityPopup.cpp \ - src/widgets/dialogs/SelectChannelDialog.cpp \ - src/widgets/dialogs/SettingsDialog.cpp \ - src/widgets/dialogs/TextInputDialog.cpp \ - src/widgets/dialogs/UserInfoPopup.cpp \ - src/widgets/dialogs/WelcomeDialog.cpp \ - src/widgets/helper/ChannelView.cpp \ - src/widgets/helper/ComboBoxItemDelegate.cpp \ - src/widgets/helper/DebugPopup.cpp \ - src/widgets/helper/EditableModelView.cpp \ - src/widgets/helper/NotebookButton.cpp \ - src/widgets/helper/NotebookTab.cpp \ - src/widgets/helper/ResizingTextEdit.cpp \ - src/widgets/helper/RippleEffectButton.cpp \ - src/widgets/helper/RippleEffectLabel.cpp \ - src/widgets/helper/ScrollbarHighlight.cpp \ - src/widgets/helper/SearchPopup.cpp \ - src/widgets/helper/SettingsDialogTab.cpp \ - src/widgets/helper/SignalLabel.cpp \ - src/widgets/helper/TitlebarButton.cpp \ - src/widgets/Label.cpp \ - src/widgets/Notebook.cpp \ - src/widgets/Scrollbar.cpp \ - src/widgets/settingspages/AboutPage.cpp \ - src/widgets/settingspages/AccountsPage.cpp \ - src/widgets/settingspages/BrowserExtensionPage.cpp \ - src/widgets/settingspages/CommandPage.cpp \ - src/widgets/settingspages/EmotesPage.cpp \ - src/widgets/settingspages/ExternalToolsPage.cpp \ - src/widgets/settingspages/HighlightingPage.cpp \ - src/widgets/settingspages/KeyboardSettingsPage.cpp \ - src/widgets/settingspages/LogsPage.cpp \ - src/widgets/settingspages/ModerationPage.cpp \ - src/widgets/settingspages/SettingsPage.cpp \ - src/widgets/settingspages/SpecialChannelsPage.cpp \ - src/widgets/splits/Split.cpp \ - src/widgets/splits/SplitContainer.cpp \ - src/widgets/splits/SplitHeader.cpp \ - src/widgets/splits/SplitInput.cpp \ - src/widgets/splits/SplitOverlay.cpp \ - src/widgets/StreamView.cpp \ - src/widgets/TooltipWidget.cpp \ - src/widgets/Window.cpp \ - src/common/LinkParser.cpp \ - src/controllers/moderationactions/ModerationActions.cpp \ - src/singletons/NativeMessaging.cpp \ - src/singletons/Emotes.cpp \ - src/singletons/Fonts.cpp \ - src/singletons/Logging.cpp \ - src/singletons/Paths.cpp \ - src/singletons/Resources.cpp \ - src/singletons/Settings.cpp \ - src/singletons/Updates.cpp \ - src/singletons/Theme.cpp \ - src/controllers/moderationactions/ModerationActionModel.cpp \ - src/widgets/settingspages/LookPage.cpp \ - src/widgets/settingspages/FeelPage.cpp \ - src/util/InitUpdateButton.cpp \ - src/widgets/dialogs/UpdateDialog.cpp \ - src/widgets/settingspages/IgnoresPage.cpp \ - src/providers/twitch/PubsubClient.cpp \ - src/providers/twitch/TwitchApi.cpp \ - src/messages/Emote.cpp \ - src/messages/EmoteMap.cpp \ - src/messages/ImageSet.cpp \ - src/providers/bttv/BttvEmotes.cpp \ - src/providers/ffz/FfzEmotes.cpp \ - src/autogenerated/ResourcesAutogen.cpp \ - src/singletons/Badges.cpp \ - src/providers/twitch/TwitchBadges.cpp \ - src/providers/chatterino/ChatterinoBadges.cpp \ - src/providers/twitch/TwitchParseCheerEmotes.cpp \ - src/providers/bttv/LoadBttvChannelEmote.cpp \ - src/util/JsonQuery.cpp \ - src/RunGui.cpp \ - src/BrowserExtension.cpp - -HEADERS += \ - src/Application.hpp \ - src/common/Channel.hpp \ - src/common/Common.hpp \ - src/common/CompletionModel.hpp \ - src/common/Emotemap.hpp \ - src/common/FlagsEnum.hpp \ - src/common/LockedObject.hpp \ - src/common/MutexValue.hpp \ - src/common/NetworkCommon.hpp \ - src/common/NetworkData.hpp \ - src/common/NetworkManager.hpp \ - src/common/NetworkRequest.hpp \ - src/common/NetworkRequester.hpp \ - src/common/NetworkResult.hpp \ - src/common/NetworkTimer.hpp \ - src/common/NetworkWorker.hpp \ - src/common/NullablePtr.hpp \ - src/common/Property.hpp \ - src/common/ProviderId.hpp \ - src/common/SerializeCustom.hpp \ - src/common/SignalVectorModel.hpp \ - src/common/Version.hpp \ - src/controllers/accounts/Account.hpp \ - src/controllers/accounts/AccountController.hpp \ - src/controllers/accounts/AccountModel.hpp \ - src/controllers/commands/Command.hpp \ - src/controllers/commands/CommandController.hpp \ - src/controllers/commands/CommandModel.hpp \ - src/controllers/highlights/HighlightController.hpp \ - src/controllers/highlights/HighlightModel.hpp \ - src/controllers/highlights/HighlightBlacklistModel.hpp \ - src/controllers/highlights/HighlightPhrase.hpp \ - src/controllers/highlights/HighlightBlacklistUser.hpp \ - src/controllers/highlights/UserHighlightModel.hpp \ - src/controllers/ignores/IgnoreController.hpp \ - src/controllers/ignores/IgnoreModel.hpp \ - src/controllers/ignores/IgnorePhrase.hpp \ - src/controllers/taggedusers/TaggedUser.hpp \ - src/controllers/taggedusers/TaggedUsersController.hpp \ - src/controllers/taggedusers/TaggedUsersModel.hpp \ - src/debug/AssertInGuiThread.hpp \ - src/debug/Benchmark.hpp \ - src/debug/Log.hpp \ - src/messages/Image.hpp \ - src/messages/layouts/MessageLayout.hpp \ - src/messages/layouts/MessageLayoutContainer.hpp \ - src/messages/layouts/MessageLayoutElement.hpp \ - src/messages/LimitedQueue.hpp \ - src/messages/LimitedQueueSnapshot.hpp \ - src/messages/Link.hpp \ - src/messages/Message.hpp \ - src/messages/MessageBuilder.hpp \ - src/messages/MessageColor.hpp \ - src/messages/MessageElement.hpp \ - src/messages/MessageParseArgs.hpp \ - src/messages/Selection.hpp \ - src/PrecompiledHeader.hpp \ - src/providers/emoji/Emojis.hpp \ - src/providers/irc/AbstractIrcServer.hpp \ - src/providers/irc/IrcAccount.hpp \ - src/providers/irc/IrcChannel2.hpp \ - src/providers/irc/IrcConnection2.hpp \ - src/providers/irc/IrcServer.hpp \ - src/providers/twitch/EmoteValue.hpp \ - src/providers/twitch/IrcMessageHandler.hpp \ - src/providers/twitch/PartialTwitchUser.hpp \ - src/providers/twitch/PubsubActions.hpp \ - src/providers/twitch/PubsubHelpers.hpp \ - src/providers/twitch/TwitchAccount.hpp \ - src/providers/twitch/TwitchAccountManager.hpp \ - src/providers/twitch/TwitchChannel.hpp \ - src/providers/twitch/TwitchEmotes.hpp \ - src/providers/twitch/TwitchHelpers.hpp \ - src/providers/twitch/TwitchMessageBuilder.hpp \ - src/providers/twitch/TwitchServer.hpp \ - src/providers/twitch/TwitchUser.hpp \ - src/common/ChatterinoSetting.hpp \ - src/singletons/helper/GifTimer.hpp \ - src/singletons/helper/LoggingChannel.hpp \ - src/controllers/moderationactions/ModerationAction.hpp \ - src/singletons/WindowManager.hpp \ - src/util/Clamp.hpp \ - src/util/CombinePath.hpp \ - src/util/ConcurrentMap.hpp \ - src/util/DebugCount.hpp \ - src/util/DistanceBetweenPoints.hpp \ - src/util/Helpers.hpp \ - src/util/IrcHelpers.hpp \ - src/util/LayoutCreator.hpp \ - src/util/PostToThread.hpp \ - src/util/QStringHash.hpp \ - src/util/RapidjsonHelpers.hpp \ - src/util/RemoveScrollAreaBackground.hpp \ - src/util/SharedPtrElementLess.hpp \ - src/util/StandardItemHelper.hpp \ - src/util/StreamLink.hpp \ - src/util/WindowsHelper.hpp \ - src/widgets/AccountSwitchPopupWidget.hpp \ - src/widgets/AccountSwitchWidget.hpp \ - src/widgets/AttachedWindow.hpp \ - src/widgets/BaseWidget.hpp \ - src/widgets/BaseWindow.hpp \ - src/widgets/dialogs/EmotePopup.hpp \ - src/widgets/dialogs/LastRunCrashDialog.hpp \ - src/widgets/dialogs/LoginDialog.hpp \ - src/widgets/dialogs/LogsPopup.hpp \ - src/widgets/dialogs/NotificationPopup.hpp \ - src/widgets/dialogs/QualityPopup.hpp \ - src/widgets/dialogs/SelectChannelDialog.hpp \ - src/widgets/dialogs/SettingsDialog.hpp \ - src/widgets/dialogs/TextInputDialog.hpp \ - src/widgets/dialogs/UserInfoPopup.hpp \ - src/widgets/dialogs/WelcomeDialog.hpp \ - src/widgets/helper/ChannelView.hpp \ - src/widgets/helper/ComboBoxItemDelegate.hpp \ - src/widgets/helper/DebugPopup.hpp \ - src/widgets/helper/EditableModelView.hpp \ - src/widgets/helper/Line.hpp \ - src/widgets/helper/NotebookButton.hpp \ - src/widgets/helper/NotebookTab.hpp \ - src/widgets/helper/ResizingTextEdit.hpp \ - src/widgets/helper/RippleEffectButton.hpp \ - src/widgets/helper/RippleEffectLabel.hpp \ - src/widgets/helper/ScrollbarHighlight.hpp \ - src/widgets/helper/SearchPopup.hpp \ - src/widgets/helper/SettingsDialogTab.hpp \ - src/widgets/helper/Shortcut.hpp \ - src/widgets/helper/SignalLabel.hpp \ - src/widgets/helper/TitlebarButton.hpp \ - src/widgets/Label.hpp \ - src/widgets/Notebook.hpp \ - src/widgets/Scrollbar.hpp \ - src/widgets/settingspages/AboutPage.hpp \ - src/widgets/settingspages/AccountsPage.hpp \ - src/widgets/settingspages/BrowserExtensionPage.hpp \ - src/widgets/settingspages/CommandPage.hpp \ - src/widgets/settingspages/EmotesPage.hpp \ - src/widgets/settingspages/ExternalToolsPage.hpp \ - src/widgets/settingspages/HighlightingPage.hpp \ - src/widgets/settingspages/KeyboardSettingsPage.hpp \ - src/widgets/settingspages/LogsPage.hpp \ - src/widgets/settingspages/ModerationPage.hpp \ - src/widgets/settingspages/SettingsPage.hpp \ - src/widgets/settingspages/SpecialChannelsPage.hpp \ - src/widgets/splits/Split.hpp \ - src/widgets/splits/SplitContainer.hpp \ - src/widgets/splits/SplitHeader.hpp \ - src/widgets/splits/SplitInput.hpp \ - src/widgets/splits/SplitOverlay.hpp \ - src/widgets/StreamView.hpp \ - src/widgets/TooltipWidget.hpp \ - src/widgets/Window.hpp \ - src/providers/twitch/TwitchCommon.hpp \ - src/util/IsBigEndian.hpp \ - src/common/LinkParser.hpp \ - src/controllers/moderationactions/ModerationActions.hpp \ - src/singletons/Emotes.hpp \ - src/singletons/Fonts.hpp \ - src/singletons/Logging.hpp \ - src/singletons/Paths.hpp \ - src/singletons/Resources.hpp \ - src/singletons/Settings.hpp \ - src/singletons/Updates.hpp \ - src/singletons/NativeMessaging.hpp \ - src/singletons/Theme.hpp \ - src/common/SimpleSignalVector.hpp \ - src/common/SignalVector.hpp \ - src/widgets/dialogs/LogsPopup.hpp \ - src/common/Singleton.hpp \ - src/controllers/moderationactions/ModerationActionModel.hpp \ - src/widgets/settingspages/LookPage.hpp \ - src/widgets/settingspages/FeelPage.hpp \ - src/util/InitUpdateButton.hpp \ - src/widgets/dialogs/UpdateDialog.hpp \ - src/widgets/settingspages/IgnoresPage.hpp \ - src/providers/twitch/PubsubClient.hpp \ - src/providers/twitch/TwitchApi.hpp \ - src/messages/Emote.hpp \ - src/messages/EmoteMap.hpp \ - src/messages/EmoteCache.hpp \ - src/messages/ImageSet.hpp \ - src/common/Outcome.hpp \ - src/providers/bttv/BttvEmotes.hpp \ - src/providers/ffz/FfzEmotes.hpp \ - src/autogenerated/ResourcesAutogen.hpp \ - src/singletons/Badges.hpp \ - src/providers/twitch/TwitchBadges.hpp \ - src/providers/chatterino/ChatterinoBadges.hpp \ - src/common/Aliases.hpp \ - src/providers/twitch/TwitchParseCheerEmotes.hpp \ - src/providers/bttv/LoadBttvChannelEmote.hpp \ - src/util/JsonQuery.hpp \ - src/RunGui.hpp \ - src/BrowserExtension.hpp - -RESOURCES += \ - resources/resources.qrc \ - resources/resources_autogenerated.qrc - -DISTFILES += - -FORMS += - -# Define warning flags for Chatterino -win32-msvc* { - QMAKE_CXXFLAGS_WARN_ON = /W4 - # 4714 - function marked as __forceinline not inlined - # 4996 - occurs when the compiler encounters a function or variable that is marked as deprecated. - # These functions may have a different preferred name, may be insecure or have - # a more secure variant, or may be obsolete. - # 4505 - unreferenced local version has been removed - # 4127 - conditional expression is constant - # 4503 - decorated name length exceeded, name was truncated - # 4100 - unreferences formal parameter - # 4305 - possible truncation of data - # 4267 - possible loss of data in return - QMAKE_CXXFLAGS_WARN_ON += /wd4714 - QMAKE_CXXFLAGS_WARN_ON += /wd4996 - QMAKE_CXXFLAGS_WARN_ON += /wd4505 - QMAKE_CXXFLAGS_WARN_ON += /wd4127 - QMAKE_CXXFLAGS_WARN_ON += /wd4503 - QMAKE_CXXFLAGS_WARN_ON += /wd4100 - QMAKE_CXXFLAGS_WARN_ON += /wd4305 - QMAKE_CXXFLAGS_WARN_ON += /wd4267 - -} else { - QMAKE_CXXFLAGS_WARN_ON = -Wall - QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-function - QMAKE_CXXFLAGS_WARN_ON += -Wno-switch - QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-declarations - QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare - QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-variable - - # Disabling strict-aliasing warnings for now, although we probably want to re-enable this in the future - QMAKE_CXXFLAGS_WARN_ON += -Wno-strict-aliasing - - QMAKE_CXXFLAGS_WARN_ON += -Werror=return-type - - equals(QMAKE_CXX, "clang++") { - QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedef - QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-private-field - } else { - QMAKE_CXXFLAGS_WARN_ON += -Wno-class-memaccess - } -} - -# do not use windows min/max macros -#win32 { -# DEFINES += NOMINMAX -#} - -#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 - -linux { - QMAKE_LFLAGS += -lrt -} +#------------------------------------------------- +# +# Project created by QtCreator 2016-12-28T18:23:35 +# +#------------------------------------------------- + +message(----) + +QT += widgets core gui network multimedia svg +CONFIG += communi +COMMUNI += core model util +CONFIG += c++14 +INCLUDEPATH += src/ +TARGET = chatterino +TEMPLATE = app +DEFINES += QT_DEPRECATED_WARNINGS +PRECOMPILED_HEADER = src/PrecompiledHeader.hpp +CONFIG += precompile_header + +debug { + DEFINES += QT_DEBUG +} + +useBreakpad { + LIBS += -L$$PWD/lib/qBreakpad/handler/build + include(lib/qBreakpad/qBreakpad.pri) + DEFINES += C_USE_BREAKPAD +} + +# https://bugreports.qt.io/browse/QTBUG-27018 +equals(QMAKE_CXX, "clang++")|equals(QMAKE_CXX, "g++") { + TARGET = bin/chatterino +} + +# Icons +macx:ICON = resources/images/chatterino2.icns +win32:RC_FILE = resources/windows.rc + + +macx { + LIBS += -L/usr/local/lib +} + +# Submodules +include(dependencies/rapidjson.pri) +include(dependencies/settings.pri) +include(dependencies/signals.pri) +include(dependencies/humanize.pri) +include(dependencies/fmt.pri) +DEFINES += IRC_NAMESPACE=Communi +include(dependencies/libcommuni.pri) +include(dependencies/websocketpp.pri) +include(dependencies/openssl.pri) +include(dependencies/boost.pri) + +# Optional feature: QtWebEngine +#exists ($(QTDIR)/include/QtWebEngine/QtWebEngine) { +# message(Using QWebEngine) +# QT += webenginewidgets +# DEFINES += "USEWEBENGINE" +#} + +linux { + LIBS += -lrt +} + +win32 { + LIBS += -luser32 +} + +# OSX include directory +macx { + INCLUDEPATH += /usr/local/include +} + +# Optional dependency on Windows SDK 7 +!contains(QMAKE_TARGET.arch, x86_64) { + win32:exists(C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\Windows.h) { + LIBS += -L"C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib" \ + -ldwmapi + + DEFINES += "USEWINSDK" + message(Using Windows SDK 7) + } +} + +# Optional dependency on Windows SDK 10 +contains(QMAKE_TARGET.arch, x86_64) { + WIN_SDK_VERSION = $$(WindowsSDKVersion) + !isEmpty(WIN_SDK_VERSION) { + !equals(WIN_SDK_VERSION, "\\") { + DEFINES += "USEWINSDK" + message(Using Windows SDK 10) + } + } +} + +werr { + QMAKE_CXXFLAGS += -Werror + + message("Enabling error on warning") +} + +SOURCES += \ + src/Application.cpp \ + src/common/Channel.cpp \ + src/common/CompletionModel.cpp \ + src/common/Emotemap.cpp \ + src/common/NetworkData.cpp \ + src/common/NetworkManager.cpp \ + src/common/NetworkRequest.cpp \ + src/common/NetworkResult.cpp \ + src/common/NetworkTimer.cpp \ + src/controllers/accounts/Account.cpp \ + src/controllers/accounts/AccountController.cpp \ + src/controllers/accounts/AccountModel.cpp \ + src/controllers/commands/Command.cpp \ + src/controllers/commands/CommandController.cpp \ + src/controllers/commands/CommandModel.cpp \ + src/controllers/highlights/HighlightController.cpp \ + src/controllers/highlights/HighlightModel.cpp \ + src/controllers/highlights/HighlightBlacklistModel.cpp \ + src/controllers/highlights/UserHighlightModel.cpp \ + src/controllers/ignores/IgnoreController.cpp \ + src/controllers/ignores/IgnoreModel.cpp \ + src/controllers/taggedusers/TaggedUser.cpp \ + src/controllers/taggedusers/TaggedUsersController.cpp \ + src/controllers/taggedusers/TaggedUsersModel.cpp \ + src/main.cpp \ + src/messages/Image.cpp \ + src/messages/layouts/MessageLayout.cpp \ + src/messages/layouts/MessageLayoutContainer.cpp \ + src/messages/layouts/MessageLayoutElement.cpp \ + src/messages/Link.cpp \ + src/messages/Message.cpp \ + src/messages/MessageBuilder.cpp \ + src/messages/MessageColor.cpp \ + src/messages/MessageElement.cpp \ + src/providers/emoji/Emojis.cpp \ + src/providers/irc/AbstractIrcServer.cpp \ + src/providers/irc/IrcAccount.cpp \ + src/providers/irc/IrcChannel2.cpp \ + src/providers/irc/IrcConnection2.cpp \ + src/providers/irc/IrcServer.cpp \ + src/providers/twitch/IrcMessageHandler.cpp \ + src/providers/twitch/PartialTwitchUser.cpp \ + src/providers/twitch/PubsubActions.cpp \ + src/providers/twitch/PubsubHelpers.cpp \ + src/providers/twitch/TwitchAccount.cpp \ + src/providers/twitch/TwitchAccountManager.cpp \ + src/providers/twitch/TwitchChannel.cpp \ + src/providers/twitch/TwitchEmotes.cpp \ + src/providers/twitch/TwitchHelpers.cpp \ + src/providers/twitch/TwitchMessageBuilder.cpp \ + src/providers/twitch/TwitchServer.cpp \ + src/providers/twitch/TwitchUser.cpp \ + src/common/ChatterinoSetting.cpp \ + src/singletons/helper/GifTimer.cpp \ + src/singletons/helper/LoggingChannel.cpp \ + src/controllers/moderationactions/ModerationAction.cpp \ + src/singletons/WindowManager.cpp \ + src/util/DebugCount.cpp \ + src/util/RapidjsonHelpers.cpp \ + src/util/StreamLink.cpp \ + src/util/WindowsHelper.cpp \ + src/widgets/AccountSwitchPopupWidget.cpp \ + src/widgets/AccountSwitchWidget.cpp \ + src/widgets/AttachedWindow.cpp \ + src/widgets/BaseWidget.cpp \ + src/widgets/BaseWindow.cpp \ + src/widgets/dialogs/EmotePopup.cpp \ + src/widgets/dialogs/LastRunCrashDialog.cpp \ + src/widgets/dialogs/LoginDialog.cpp \ + src/widgets/dialogs/LogsPopup.cpp \ + src/widgets/dialogs/NotificationPopup.cpp \ + src/widgets/dialogs/QualityPopup.cpp \ + src/widgets/dialogs/SelectChannelDialog.cpp \ + src/widgets/dialogs/SettingsDialog.cpp \ + src/widgets/dialogs/TextInputDialog.cpp \ + src/widgets/dialogs/UserInfoPopup.cpp \ + src/widgets/dialogs/WelcomeDialog.cpp \ + src/widgets/helper/ChannelView.cpp \ + src/widgets/helper/ComboBoxItemDelegate.cpp \ + src/widgets/helper/DebugPopup.cpp \ + src/widgets/helper/EditableModelView.cpp \ + src/widgets/helper/NotebookButton.cpp \ + src/widgets/helper/NotebookTab.cpp \ + src/widgets/helper/ResizingTextEdit.cpp \ + src/widgets/helper/RippleEffectButton.cpp \ + src/widgets/helper/RippleEffectLabel.cpp \ + src/widgets/helper/ScrollbarHighlight.cpp \ + src/widgets/helper/SearchPopup.cpp \ + src/widgets/helper/SettingsDialogTab.cpp \ + src/widgets/helper/SignalLabel.cpp \ + src/widgets/helper/TitlebarButton.cpp \ + src/widgets/Label.cpp \ + src/widgets/Notebook.cpp \ + src/widgets/Scrollbar.cpp \ + src/widgets/settingspages/AboutPage.cpp \ + src/widgets/settingspages/AccountsPage.cpp \ + src/widgets/settingspages/BrowserExtensionPage.cpp \ + src/widgets/settingspages/CommandPage.cpp \ + src/widgets/settingspages/EmotesPage.cpp \ + src/widgets/settingspages/ExternalToolsPage.cpp \ + src/widgets/settingspages/HighlightingPage.cpp \ + src/widgets/settingspages/KeyboardSettingsPage.cpp \ + src/widgets/settingspages/LogsPage.cpp \ + src/widgets/settingspages/ModerationPage.cpp \ + src/widgets/settingspages/SettingsPage.cpp \ + src/widgets/settingspages/SpecialChannelsPage.cpp \ + src/widgets/splits/Split.cpp \ + src/widgets/splits/SplitContainer.cpp \ + src/widgets/splits/SplitHeader.cpp \ + src/widgets/splits/SplitInput.cpp \ + src/widgets/splits/SplitOverlay.cpp \ + src/widgets/StreamView.cpp \ + src/widgets/TooltipWidget.cpp \ + src/widgets/Window.cpp \ + src/common/LinkParser.cpp \ + src/controllers/moderationactions/ModerationActions.cpp \ + src/singletons/NativeMessaging.cpp \ + src/singletons/Emotes.cpp \ + src/singletons/Fonts.cpp \ + src/singletons/Logging.cpp \ + src/singletons/Paths.cpp \ + src/singletons/Resources.cpp \ + src/singletons/Settings.cpp \ + src/singletons/Updates.cpp \ + src/singletons/Theme.cpp \ + src/controllers/moderationactions/ModerationActionModel.cpp \ + src/widgets/settingspages/LookPage.cpp \ + src/widgets/settingspages/FeelPage.cpp \ + src/util/InitUpdateButton.cpp \ + src/widgets/dialogs/UpdateDialog.cpp \ + src/widgets/settingspages/IgnoresPage.cpp \ + src/providers/twitch/PubsubClient.cpp \ + src/providers/twitch/TwitchApi.cpp \ + src/messages/Emote.cpp \ + src/messages/EmoteMap.cpp \ + src/messages/ImageSet.cpp \ + src/providers/bttv/BttvEmotes.cpp \ + src/providers/ffz/FfzEmotes.cpp \ + src/autogenerated/ResourcesAutogen.cpp \ + src/singletons/Badges.cpp \ + src/providers/twitch/TwitchBadges.cpp \ + src/providers/chatterino/ChatterinoBadges.cpp \ + src/providers/twitch/TwitchParseCheerEmotes.cpp \ + src/providers/bttv/LoadBttvChannelEmote.cpp \ + src/util/JsonQuery.cpp \ + src/RunGui.cpp \ + src/BrowserExtension.cpp \ + src/util/FormatTime.cpp + +HEADERS += \ + src/Application.hpp \ + src/common/Channel.hpp \ + src/common/Common.hpp \ + src/common/CompletionModel.hpp \ + src/common/Emotemap.hpp \ + src/common/FlagsEnum.hpp \ + src/common/LockedObject.hpp \ + src/common/MutexValue.hpp \ + src/common/NetworkCommon.hpp \ + src/common/NetworkData.hpp \ + src/common/NetworkManager.hpp \ + src/common/NetworkRequest.hpp \ + src/common/NetworkRequester.hpp \ + src/common/NetworkResult.hpp \ + src/common/NetworkTimer.hpp \ + src/common/NetworkWorker.hpp \ + src/common/NullablePtr.hpp \ + src/common/Property.hpp \ + src/common/ProviderId.hpp \ + src/common/SerializeCustom.hpp \ + src/common/SignalVectorModel.hpp \ + src/common/Version.hpp \ + src/controllers/accounts/Account.hpp \ + src/controllers/accounts/AccountController.hpp \ + src/controllers/accounts/AccountModel.hpp \ + src/controllers/commands/Command.hpp \ + src/controllers/commands/CommandController.hpp \ + src/controllers/commands/CommandModel.hpp \ + src/controllers/highlights/HighlightController.hpp \ + src/controllers/highlights/HighlightModel.hpp \ + src/controllers/highlights/HighlightBlacklistModel.hpp \ + src/controllers/highlights/HighlightPhrase.hpp \ + src/controllers/highlights/HighlightBlacklistUser.hpp \ + src/controllers/highlights/UserHighlightModel.hpp \ + src/controllers/ignores/IgnoreController.hpp \ + src/controllers/ignores/IgnoreModel.hpp \ + src/controllers/ignores/IgnorePhrase.hpp \ + src/controllers/taggedusers/TaggedUser.hpp \ + src/controllers/taggedusers/TaggedUsersController.hpp \ + src/controllers/taggedusers/TaggedUsersModel.hpp \ + src/debug/AssertInGuiThread.hpp \ + src/debug/Benchmark.hpp \ + src/debug/Log.hpp \ + src/messages/Image.hpp \ + src/messages/layouts/MessageLayout.hpp \ + src/messages/layouts/MessageLayoutContainer.hpp \ + src/messages/layouts/MessageLayoutElement.hpp \ + src/messages/LimitedQueue.hpp \ + src/messages/LimitedQueueSnapshot.hpp \ + src/messages/Link.hpp \ + src/messages/Message.hpp \ + src/messages/MessageBuilder.hpp \ + src/messages/MessageColor.hpp \ + src/messages/MessageElement.hpp \ + src/messages/MessageParseArgs.hpp \ + src/messages/Selection.hpp \ + src/PrecompiledHeader.hpp \ + src/providers/emoji/Emojis.hpp \ + src/providers/irc/AbstractIrcServer.hpp \ + src/providers/irc/IrcAccount.hpp \ + src/providers/irc/IrcChannel2.hpp \ + src/providers/irc/IrcConnection2.hpp \ + src/providers/irc/IrcServer.hpp \ + src/providers/twitch/EmoteValue.hpp \ + src/providers/twitch/IrcMessageHandler.hpp \ + src/providers/twitch/PartialTwitchUser.hpp \ + src/providers/twitch/PubsubActions.hpp \ + src/providers/twitch/PubsubHelpers.hpp \ + src/providers/twitch/TwitchAccount.hpp \ + src/providers/twitch/TwitchAccountManager.hpp \ + src/providers/twitch/TwitchChannel.hpp \ + src/providers/twitch/TwitchEmotes.hpp \ + src/providers/twitch/TwitchHelpers.hpp \ + src/providers/twitch/TwitchMessageBuilder.hpp \ + src/providers/twitch/TwitchServer.hpp \ + src/providers/twitch/TwitchUser.hpp \ + src/common/ChatterinoSetting.hpp \ + src/singletons/helper/GifTimer.hpp \ + src/singletons/helper/LoggingChannel.hpp \ + src/controllers/moderationactions/ModerationAction.hpp \ + src/singletons/WindowManager.hpp \ + src/util/Clamp.hpp \ + src/util/CombinePath.hpp \ + src/util/ConcurrentMap.hpp \ + src/util/DebugCount.hpp \ + src/util/DistanceBetweenPoints.hpp \ + src/util/Helpers.hpp \ + src/util/IrcHelpers.hpp \ + src/util/LayoutCreator.hpp \ + src/util/PostToThread.hpp \ + src/util/QStringHash.hpp \ + src/util/RapidjsonHelpers.hpp \ + src/util/RemoveScrollAreaBackground.hpp \ + src/util/SharedPtrElementLess.hpp \ + src/util/StandardItemHelper.hpp \ + src/util/StreamLink.hpp \ + src/util/WindowsHelper.hpp \ + src/widgets/AccountSwitchPopupWidget.hpp \ + src/widgets/AccountSwitchWidget.hpp \ + src/widgets/AttachedWindow.hpp \ + src/widgets/BaseWidget.hpp \ + src/widgets/BaseWindow.hpp \ + src/widgets/dialogs/EmotePopup.hpp \ + src/widgets/dialogs/LastRunCrashDialog.hpp \ + src/widgets/dialogs/LoginDialog.hpp \ + src/widgets/dialogs/LogsPopup.hpp \ + src/widgets/dialogs/NotificationPopup.hpp \ + src/widgets/dialogs/QualityPopup.hpp \ + src/widgets/dialogs/SelectChannelDialog.hpp \ + src/widgets/dialogs/SettingsDialog.hpp \ + src/widgets/dialogs/TextInputDialog.hpp \ + src/widgets/dialogs/UserInfoPopup.hpp \ + src/widgets/dialogs/WelcomeDialog.hpp \ + src/widgets/helper/ChannelView.hpp \ + src/widgets/helper/ComboBoxItemDelegate.hpp \ + src/widgets/helper/DebugPopup.hpp \ + src/widgets/helper/EditableModelView.hpp \ + src/widgets/helper/Line.hpp \ + src/widgets/helper/NotebookButton.hpp \ + src/widgets/helper/NotebookTab.hpp \ + src/widgets/helper/ResizingTextEdit.hpp \ + src/widgets/helper/RippleEffectButton.hpp \ + src/widgets/helper/RippleEffectLabel.hpp \ + src/widgets/helper/ScrollbarHighlight.hpp \ + src/widgets/helper/SearchPopup.hpp \ + src/widgets/helper/SettingsDialogTab.hpp \ + src/widgets/helper/Shortcut.hpp \ + src/widgets/helper/SignalLabel.hpp \ + src/widgets/helper/TitlebarButton.hpp \ + src/widgets/Label.hpp \ + src/widgets/Notebook.hpp \ + src/widgets/Scrollbar.hpp \ + src/widgets/settingspages/AboutPage.hpp \ + src/widgets/settingspages/AccountsPage.hpp \ + src/widgets/settingspages/BrowserExtensionPage.hpp \ + src/widgets/settingspages/CommandPage.hpp \ + src/widgets/settingspages/EmotesPage.hpp \ + src/widgets/settingspages/ExternalToolsPage.hpp \ + src/widgets/settingspages/HighlightingPage.hpp \ + src/widgets/settingspages/KeyboardSettingsPage.hpp \ + src/widgets/settingspages/LogsPage.hpp \ + src/widgets/settingspages/ModerationPage.hpp \ + src/widgets/settingspages/SettingsPage.hpp \ + src/widgets/settingspages/SpecialChannelsPage.hpp \ + src/widgets/splits/Split.hpp \ + src/widgets/splits/SplitContainer.hpp \ + src/widgets/splits/SplitHeader.hpp \ + src/widgets/splits/SplitInput.hpp \ + src/widgets/splits/SplitOverlay.hpp \ + src/widgets/StreamView.hpp \ + src/widgets/TooltipWidget.hpp \ + src/widgets/Window.hpp \ + src/providers/twitch/TwitchCommon.hpp \ + src/util/IsBigEndian.hpp \ + src/common/LinkParser.hpp \ + src/controllers/moderationactions/ModerationActions.hpp \ + src/singletons/Emotes.hpp \ + src/singletons/Fonts.hpp \ + src/singletons/Logging.hpp \ + src/singletons/Paths.hpp \ + src/singletons/Resources.hpp \ + src/singletons/Settings.hpp \ + src/singletons/Updates.hpp \ + src/singletons/NativeMessaging.hpp \ + src/singletons/Theme.hpp \ + src/common/SimpleSignalVector.hpp \ + src/common/SignalVector.hpp \ + src/widgets/dialogs/LogsPopup.hpp \ + src/common/Singleton.hpp \ + src/controllers/moderationactions/ModerationActionModel.hpp \ + src/widgets/settingspages/LookPage.hpp \ + src/widgets/settingspages/FeelPage.hpp \ + src/util/InitUpdateButton.hpp \ + src/widgets/dialogs/UpdateDialog.hpp \ + src/widgets/settingspages/IgnoresPage.hpp \ + src/providers/twitch/PubsubClient.hpp \ + src/providers/twitch/TwitchApi.hpp \ + src/messages/Emote.hpp \ + src/messages/EmoteMap.hpp \ + src/messages/EmoteCache.hpp \ + src/messages/ImageSet.hpp \ + src/common/Outcome.hpp \ + src/providers/bttv/BttvEmotes.hpp \ + src/providers/ffz/FfzEmotes.hpp \ + src/autogenerated/ResourcesAutogen.hpp \ + src/singletons/Badges.hpp \ + src/providers/twitch/TwitchBadges.hpp \ + src/providers/chatterino/ChatterinoBadges.hpp \ + src/common/Aliases.hpp \ + src/providers/twitch/TwitchParseCheerEmotes.hpp \ + src/providers/bttv/LoadBttvChannelEmote.hpp \ + src/util/JsonQuery.hpp \ + src/RunGui.hpp \ + src/BrowserExtension.hpp \ + src/util/FormatTime.hpp + +RESOURCES += \ + resources/resources.qrc \ + resources/resources_autogenerated.qrc + +DISTFILES += + +FORMS += + +# Define warning flags for Chatterino +win32-msvc* { + QMAKE_CXXFLAGS_WARN_ON = /W4 + # 4714 - function marked as __forceinline not inlined + # 4996 - occurs when the compiler encounters a function or variable that is marked as deprecated. + # These functions may have a different preferred name, may be insecure or have + # a more secure variant, or may be obsolete. + # 4505 - unreferenced local version has been removed + # 4127 - conditional expression is constant + # 4503 - decorated name length exceeded, name was truncated + # 4100 - unreferences formal parameter + # 4305 - possible truncation of data + # 4267 - possible loss of data in return + QMAKE_CXXFLAGS_WARN_ON += /wd4714 + QMAKE_CXXFLAGS_WARN_ON += /wd4996 + QMAKE_CXXFLAGS_WARN_ON += /wd4505 + QMAKE_CXXFLAGS_WARN_ON += /wd4127 + QMAKE_CXXFLAGS_WARN_ON += /wd4503 + QMAKE_CXXFLAGS_WARN_ON += /wd4100 + QMAKE_CXXFLAGS_WARN_ON += /wd4305 + QMAKE_CXXFLAGS_WARN_ON += /wd4267 + +} else { + QMAKE_CXXFLAGS_WARN_ON = -Wall + QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-function + QMAKE_CXXFLAGS_WARN_ON += -Wno-switch + QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-declarations + QMAKE_CXXFLAGS_WARN_ON += -Wno-sign-compare + QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-variable + + # Disabling strict-aliasing warnings for now, although we probably want to re-enable this in the future + QMAKE_CXXFLAGS_WARN_ON += -Wno-strict-aliasing + + QMAKE_CXXFLAGS_WARN_ON += -Werror=return-type + + equals(QMAKE_CXX, "clang++") { + QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedef + QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-private-field + } else { + QMAKE_CXXFLAGS_WARN_ON += -Wno-class-memaccess + } +} + +# do not use windows min/max macros +#win32 { +# DEFINES += NOMINMAX +#} + +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +linux { + QMAKE_LFLAGS += -lrt +} diff --git a/src/Application.cpp b/src/Application.cpp index 414e7c5cf..963951107 100644 --- a/src/Application.cpp +++ b/src/Application.cpp @@ -6,6 +6,7 @@ #include "controllers/ignores/IgnoreController.hpp" #include "controllers/moderationactions/ModerationActions.hpp" #include "controllers/taggedusers/TaggedUsersController.hpp" +#include "messages/MessageBuilder.hpp" #include "providers/bttv/BttvEmotes.hpp" #include "providers/ffz/FfzEmotes.hpp" #include "providers/twitch/PubsubClient.hpp" @@ -130,7 +131,7 @@ void Application::initPubsub() QString text = QString("%1 cleared the chat").arg(action.source.name); - auto msg = Message::createSystemMessage(text); + auto msg = makeSystemMessage(text); postToThread([chan, msg] { chan->addMessage(msg); }); }); @@ -154,7 +155,7 @@ void Application::initPubsub() " seconds)"); } - auto msg = Message::createSystemMessage(text); + auto msg = makeSystemMessage(text); postToThread([chan, msg] { chan->addMessage(msg); }); }); @@ -176,7 +177,7 @@ void Application::initPubsub() .arg(action.source.name, action.target.name); } - auto msg = Message::createSystemMessage(text); + auto msg = makeSystemMessage(text); postToThread([chan, msg] { chan->addMessage(msg); }); }); @@ -189,10 +190,12 @@ void Application::initPubsub() return; } - auto msg = Message::createTimeoutMessage(action); + MessageBuilder msg(action); msg->flags |= Message::PubSub; - postToThread([chan, msg] { chan->addOrReplaceTimeout(msg); }); + postToThread([chan, msg = msg.release()] { + chan->addOrReplaceTimeout(msg); + }); }); this->twitch.pubsub->signals_.moderation.userUnbanned.connect( @@ -204,7 +207,7 @@ void Application::initPubsub() return; } - auto msg = Message::createUntimeoutMessage(action); + auto msg = MessageBuilder(action).release(); postToThread([chan, msg] { chan->addMessage(msg); }); }); diff --git a/src/Application.hpp b/src/Application.hpp index fc7051e43..2a62503bf 100644 --- a/src/Application.hpp +++ b/src/Application.hpp @@ -47,29 +47,29 @@ public: friend void test(); - Settings *const settings = nullptr; - Paths *const paths = nullptr; + Settings *const settings{}; + Paths *const paths{}; Resources2 *const resources; - Theme *const themes = nullptr; - Fonts *const fonts = nullptr; - Emotes *const emotes = nullptr; - WindowManager *const windows = nullptr; + Theme *const themes{}; + Fonts *const fonts{}; + Emotes *const emotes{}; + WindowManager *const windows{}; - AccountController *const accounts = nullptr; - CommandController *const commands = nullptr; - HighlightController *const highlights = nullptr; - IgnoreController *const ignores = nullptr; - TaggedUsersController *const taggedUsers = nullptr; - ModerationActions *const moderationActions = nullptr; - TwitchServer *const twitch2 = nullptr; + AccountController *const accounts{}; + CommandController *const commands{}; + HighlightController *const highlights{}; + IgnoreController *const ignores{}; + TaggedUsersController *const taggedUsers{}; + ModerationActions *const moderationActions{}; + TwitchServer *const twitch2{}; - [[deprecated]] Logging *const logging = nullptr; + /*[[deprecated]]*/ Logging *const logging{}; /// Provider-specific struct { - [[deprecated("use twitch2 instead")]] TwitchServer *server = nullptr; - [[deprecated("use twitch2->pubsub instead")]] PubSub *pubsub = nullptr; + /*[[deprecated("use twitch2 instead")]]*/ TwitchServer *server{}; + /*[[deprecated("use twitch2->pubsub instead")]]*/ PubSub *pubsub{}; } twitch; private: diff --git a/src/common/Channel.cpp b/src/common/Channel.cpp index 364d836d2..ab5ad07e5 100644 --- a/src/common/Channel.cpp +++ b/src/common/Channel.cpp @@ -3,6 +3,7 @@ #include "Application.hpp" #include "debug/Log.hpp" #include "messages/Message.hpp" +#include "messages/MessageBuilder.hpp" #include "singletons/Emotes.hpp" #include "singletons/Logging.hpp" #include "singletons/WindowManager.hpp" @@ -124,15 +125,15 @@ void Channel::addOrReplaceTimeout(MessagePtr message) int count = s->count + 1; - MessagePtr replacement(Message::createSystemMessage( - message->searchText + QString(" (") + QString::number(count) + - " times)")); + MessageBuilder replacement(systemMessage, + message->searchText + QString(" (") + + QString::number(count) + " times)"); replacement->timeoutUser = message->timeoutUser; replacement->count = count; replacement->flags = message->flags; - this->replaceMessage(s, replacement); + this->replaceMessage(s, replacement.release()); return; } @@ -143,7 +144,8 @@ void Channel::addOrReplaceTimeout(MessagePtr message) auto &s = snapshot[i]; if ((s->flags & (Message::Timeout | Message::Untimeout)) == 0 && s->loginName == message->timeoutUser) { - s->flags.EnableFlag(Message::Disabled); + // FOURTF: disabled for now + // s->flags.EnableFlag(Message::Disabled); } } @@ -165,7 +167,8 @@ void Channel::disableAllMessages() continue; } - s->flags.EnableFlag(Message::Disabled); + // FOURTF: disabled for now + // s->flags.EnableFlag(Message::Disabled); } } @@ -188,7 +191,7 @@ void Channel::replaceMessage(MessagePtr message, MessagePtr replacement) } } -void Channel::addRecentChatter(const std::shared_ptr &message) +void Channel::addRecentChatter(const MessagePtr &message) { // Do nothing by default } diff --git a/src/common/Channel.hpp b/src/common/Channel.hpp index 043b33fe8..429123c5a 100644 --- a/src/common/Channel.hpp +++ b/src/common/Channel.hpp @@ -52,7 +52,7 @@ public: void addOrReplaceTimeout(MessagePtr message); void disableAllMessages(); void replaceMessage(MessagePtr message, MessagePtr replacement); - virtual void addRecentChatter(const std::shared_ptr &message); + virtual void addRecentChatter(const MessagePtr &message); QStringList modList; diff --git a/src/common/FlagsEnum.hpp b/src/common/FlagsEnum.hpp index b1113a8c5..bb4e3d57d 100644 --- a/src/common/FlagsEnum.hpp +++ b/src/common/FlagsEnum.hpp @@ -54,6 +54,24 @@ public: reinterpret_cast(this->value) |= static_cast(flag); } + void set(T flag) + { + reinterpret_cast(this->value) |= static_cast(flag); + } + + void unset(T flag) + { + reinterpret_cast(this->value) &= ~static_cast(flag); + } + + void set(T flag, bool value) + { + if (value) + this->set(flag); + else + this->unset(flag); + } + bool HasFlag(Q flag) const { return (this->value & flag) == flag; diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index e3026c1be..25c75429d 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -141,16 +141,17 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, } b.emplace(rest, MessageElement::Text); - b.getMessage()->flags |= Message::DoNotTriggerNotification; + b.message().flags |= Message::DoNotTriggerNotification; + auto messagexD = b.release(); - app->twitch.server->whispersChannel->addMessage(b.getMessage()); + app->twitch.server->whispersChannel->addMessage(messagexD); app->twitch.server->sendMessage("jtv", text); if (getSettings()->inlineWhispers) { app->twitch.server->forEachChannel( - [&b](ChannelPtr _channel) { - _channel->addMessage(b.getMessage()); + [&messagexD](ChannelPtr _channel) { + _channel->addMessage(messagexD); }); } @@ -166,7 +167,7 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, if (commandName == "/debug-args") { QString msg = QApplication::instance()->arguments().join(' '); - channel->addMessage(Message::createSystemMessage(msg)); + channel->addMessage(makeSystemMessage(msg)); return ""; } else if (commandName == "/uptime") { @@ -176,13 +177,13 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, ? streamStatus->uptime : "Channel is not live."; - channel->addMessage(Message::createSystemMessage(messageText)); + channel->addMessage(makeSystemMessage(messageText)); return ""; } else if (commandName == "/ignore") { if (words.size() < 2) { channel->addMessage( - Message::createSystemMessage("Usage: /ignore [user]")); + makeSystemMessage("Usage: /ignore [user]")); return ""; } auto app = getApp(); @@ -191,21 +192,21 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, auto target = words.at(1); if (user->isAnon()) { - channel->addMessage(Message::createSystemMessage( + channel->addMessage(makeSystemMessage( "You must be logged in to ignore someone")); return ""; } - user->ignore(target, [channel](auto resultCode, - const QString &message) { - channel->addMessage(Message::createSystemMessage(message)); - }); + user->ignore( + target, [channel](auto resultCode, const QString &message) { + channel->addMessage(makeSystemMessage(message)); + }); return ""; } else if (commandName == "/unignore") { if (words.size() < 2) { - channel->addMessage(Message::createSystemMessage( - "Usage: /unignore [user]")); + channel->addMessage( + makeSystemMessage("Usage: /unignore [user]")); return ""; } auto app = getApp(); @@ -214,21 +215,21 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, auto target = words.at(1); if (user->isAnon()) { - channel->addMessage(Message::createSystemMessage( + channel->addMessage(makeSystemMessage( "You must be logged in to ignore someone")); return ""; } - user->unignore(target, [channel](auto resultCode, - const QString &message) { - channel->addMessage(Message::createSystemMessage(message)); - }); + user->unignore( + target, [channel](auto resultCode, const QString &message) { + channel->addMessage(makeSystemMessage(message)); + }); return ""; } else if (commandName == "/follow") { if (words.size() < 2) { channel->addMessage( - Message::createSystemMessage("Usage: /follow [user]")); + makeSystemMessage("Usage: /follow [user]")); return ""; } auto app = getApp(); @@ -237,7 +238,7 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, auto target = words.at(1); if (user->isAnon()) { - channel->addMessage(Message::createSystemMessage( + channel->addMessage(makeSystemMessage( "You must be logged in to follow someone")); return ""; } @@ -245,12 +246,12 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, TwitchApi::findUserId( target, [user, channel, target](QString userId) { if (userId.isEmpty()) { - channel->addMessage(Message::createSystemMessage( + channel->addMessage(makeSystemMessage( "User " + target + " could not be followed!")); return; } user->followUser(userId, [channel, target]() { - channel->addMessage(Message::createSystemMessage( + channel->addMessage(makeSystemMessage( "You successfully followed " + target)); }); }); @@ -258,8 +259,8 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, return ""; } else if (commandName == "/unfollow") { if (words.size() < 2) { - channel->addMessage(Message::createSystemMessage( - "Usage: /unfollow [user]")); + channel->addMessage( + makeSystemMessage("Usage: /unfollow [user]")); return ""; } auto app = getApp(); @@ -268,7 +269,7 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, auto target = words.at(1); if (user->isAnon()) { - channel->addMessage(Message::createSystemMessage( + channel->addMessage(makeSystemMessage( "You must be logged in to follow someone")); return ""; } @@ -276,12 +277,12 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, TwitchApi::findUserId( target, [user, channel, target](QString userId) { if (userId.isEmpty()) { - channel->addMessage(Message::createSystemMessage( + channel->addMessage(makeSystemMessage( "User " + target + " could not be followed!")); return; } user->unfollowUser(userId, [channel, target]() { - channel->addMessage(Message::createSystemMessage( + channel->addMessage(makeSystemMessage( "You successfully unfollowed " + target)); }); }); @@ -289,8 +290,8 @@ QString CommandController::execCommand(const QString &text, ChannelPtr channel, return ""; } else if (commandName == "/logs") { if (words.size() < 2) { - channel->addMessage(Message::createSystemMessage( - "Usage: /logs [user] (channel)")); + channel->addMessage( + makeSystemMessage("Usage: /logs [user] (channel)")); return ""; } auto app = getApp(); diff --git a/src/messages/Image.cpp b/src/messages/Image.cpp index e8df96f57..5935c4a01 100644 --- a/src/messages/Image.cpp +++ b/src/messages/Image.cpp @@ -6,6 +6,7 @@ #include "debug/Log.hpp" #include "singletons/Emotes.hpp" #include "singletons/WindowManager.hpp" +#include "util/DebugCount.hpp" #include "util/PostToThread.hpp" #include diff --git a/src/messages/Message.cpp b/src/messages/Message.cpp index 2104dd673..7bb771b23 100644 --- a/src/messages/Message.cpp +++ b/src/messages/Message.cpp @@ -1,20 +1,22 @@ #include "messages/Message.hpp" #include "MessageElement.hpp" #include "providers/twitch/PubsubActions.hpp" +#include "util/DebugCount.hpp" #include "util/IrcHelpers.hpp" using SBHighlight = chatterino::ScrollbarHighlight; namespace chatterino { -void Message::addElement(MessageElement *element) +Message::Message() + : parseTime(QTime::currentTime()) { - this->elements_.push_back(std::unique_ptr(element)); + DebugCount::increase("messages"); } -const std::vector> &Message::getElements() const +Message::~Message() { - return this->elements_; + DebugCount::decrease("messages"); } SBHighlight Message::getScrollBarHighlight() const @@ -28,195 +30,8 @@ SBHighlight Message::getScrollBarHighlight() const } // Static -MessagePtr Message::createSystemMessage(const QString &text) -{ - MessagePtr message(new Message); - - message->addElement(new TimestampElement(QTime::currentTime())); - message->addElement( - new TextElement(text, MessageElement::Text, MessageColor::System)); - message->flags |= MessageFlags::System; - message->flags |= MessageFlags::DoNotTriggerNotification; - message->searchText = text; - - return message; -} - -MessagePtr Message::createMessage(const QString &text) -{ - MessagePtr message(new Message); - - message->addElement(new TimestampElement(QTime::currentTime())); - message->addElement( - new TextElement(text, MessageElement::Text, MessageColor::Text)); - message->searchText = text; - - return message; -} - namespace { -void appendDuration(int count, QChar &&order, QString &outString) -{ - outString.append(QString::number(count)); - outString.append(order); -} - -QString makeDuration(int timeoutSeconds) -{ - QString res; - - int seconds = timeoutSeconds % 60; - int timeoutMinutes = timeoutSeconds / 60; - int minutes = timeoutMinutes % 60; - int timeoutHours = timeoutMinutes / 60; - int hours = timeoutHours % 24; - int days = timeoutHours / 24; - if (days > 0) { - appendDuration(days, 'd', res); - } - if (hours > 0) { - if (!res.isEmpty()) { - res.append(" "); - } - appendDuration(hours, 'h', res); - } - if (minutes > 0) { - if (!res.isEmpty()) { - res.append(" "); - } - appendDuration(minutes, 'm', res); - } - if (seconds > 0) { - if (!res.isEmpty()) { - res.append(" "); - } - appendDuration(seconds, 's', res); - } - return res; -} - } // namespace -MessagePtr Message::createTimeoutMessage(const QString &username, - const QString &durationInSeconds, - const QString &reason, - bool multipleTimes) -{ - QString text; - - text.append(username); - if (!durationInSeconds.isEmpty()) { - text.append(" has been timed out"); - - // TODO: Implement who timed the user out - - text.append(" for "); - bool ok = true; - int timeoutSeconds = durationInSeconds.toInt(&ok); - if (ok) { - text.append(makeDuration(timeoutSeconds)); - } - } else { - text.append(" has been permanently banned"); - } - - if (reason.length() > 0) { - text.append(": \""); - text.append(parseTagString(reason)); - text.append("\""); - } - text.append("."); - - if (multipleTimes) { - text.append(" (multiple times)"); - } - - MessagePtr message = Message::createSystemMessage(text); - message->flags.EnableFlag(MessageFlags::System); - message->flags.EnableFlag(MessageFlags::Timeout); - message->timeoutUser = username; - return message; -} - -MessagePtr Message::createTimeoutMessage(const BanAction &action, - uint32_t count) -{ - MessagePtr msg(new Message); - - msg->addElement(new TimestampElement(QTime::currentTime())); - msg->flags.EnableFlag(MessageFlags::System); - msg->flags.EnableFlag(MessageFlags::Timeout); - - msg->timeoutUser = action.target.name; - msg->count = count; - - QString text; - - if (action.isBan()) { - if (action.reason.isEmpty()) { - text = QString("%1 banned %2.") // - .arg(action.source.name) - .arg(action.target.name); - } else { - text = QString("%1 banned %2: \"%3\".") // - .arg(action.source.name) - .arg(action.target.name) - .arg(action.reason); - } - } else { - if (action.reason.isEmpty()) { - text = QString("%1 timed out %2 for %3.") // - .arg(action.source.name) - .arg(action.target.name) - .arg(makeDuration(action.duration)); - } else { - text = QString("%1 timed out %2 for %3: \"%4\".") // - .arg(action.source.name) - .arg(action.target.name) - .arg(makeDuration(action.duration)) - .arg(action.reason); - } - - if (count > 1) { - text.append(QString(" (%1 times)").arg(count)); - } - } - - msg->addElement( - new TextElement(text, MessageElement::Text, MessageColor::System)); - msg->searchText = text; - - return msg; -} - -MessagePtr Message::createUntimeoutMessage(const UnbanAction &action) -{ - MessagePtr msg(new Message); - - msg->addElement(new TimestampElement(QTime::currentTime())); - msg->flags.EnableFlag(MessageFlags::System); - msg->flags.EnableFlag(MessageFlags::Untimeout); - - msg->timeoutUser = action.target.name; - - QString text; - - if (action.wasBan()) { - text = QString("%1 unbanned %2.") // - .arg(action.source.name) - .arg(action.target.name); - } else { - text = QString("%1 untimedout %2.") // - .arg(action.source.name) - .arg(action.target.name); - } - - msg->addElement( - new TextElement(text, MessageElement::Text, MessageColor::System)); - msg->searchText = text; - - return msg; -} - } // namespace chatterino diff --git a/src/messages/Message.hpp b/src/messages/Message.hpp index 5a2a21074..ba42c9e84 100644 --- a/src/messages/Message.hpp +++ b/src/messages/Message.hpp @@ -6,27 +6,13 @@ #include "widgets/helper/ScrollbarHighlight.hpp" #include - #include #include #include -#include "util/DebugCount.hpp" - namespace chatterino { -struct Message { - Message() - : parseTime(QTime::currentTime()) - { - DebugCount::increase("messages"); - } - - ~Message() - { - DebugCount::decrease("messages"); - } - +struct Message : boost::noncopyable { enum MessageFlags : uint16_t { None = 0, System = (1 << 0), @@ -43,6 +29,9 @@ struct Message { Subscription = (1 << 11), }; + Message(); + ~Message(); + FlagsEnum flags; QTime parseTime; QString id; @@ -51,33 +40,12 @@ struct Message { QString displayName; QString localizedName; QString timeoutUser; - uint32_t count = 1; + std::vector> elements; - // Messages should not be added after the message is done initializing. - void addElement(MessageElement *element); - const std::vector> &getElements() const; - - // Scrollbar ScrollbarHighlight getScrollBarHighlight() const; - -private: - std::vector> elements_; - -public: - static std::shared_ptr createSystemMessage(const QString &text); - static std::shared_ptr createMessage(const QString &text); - - static std::shared_ptr createTimeoutMessage( - const QString &username, const QString &durationInSeconds, - const QString &reason, bool multipleTimes); - - static std::shared_ptr createTimeoutMessage( - const BanAction &action, uint32_t count = 1); - static std::shared_ptr createUntimeoutMessage( - const UnbanAction &action); }; -using MessagePtr = std::shared_ptr; +using MessagePtr = std::shared_ptr; } // namespace chatterino diff --git a/src/messages/MessageBuilder.cpp b/src/messages/MessageBuilder.cpp index 0da3a8445..d86e547d1 100644 --- a/src/messages/MessageBuilder.cpp +++ b/src/messages/MessageBuilder.cpp @@ -4,43 +4,171 @@ #include "singletons/Emotes.hpp" #include "singletons/Resources.hpp" #include "singletons/Theme.hpp" +#include "util/FormatTime.hpp" +#include "util/IrcHelpers.hpp" #include namespace chatterino { +MessagePtr makeSystemMessage(const QString &text) +{ + return MessageBuilder(systemMessage, text).release(); +} + MessageBuilder::MessageBuilder() - : message_(new Message) + : message_(std::make_unique()) { } -MessagePtr MessageBuilder::getMessage() +MessageBuilder::MessageBuilder(const QString &text) + : MessageBuilder() { - return this->message_; + this->emplace(); + this->emplace(text, MessageElement::Text, + MessageColor::System); + this->message().searchText = text; } -void MessageBuilder::append(MessageElement *element) +MessageBuilder::MessageBuilder(SystemMessageTag, const QString &text) + : MessageBuilder() { - this->message_->addElement(element); + this->emplace(); + this->emplace(text, MessageElement::Text, + MessageColor::System); + this->message().flags |= Message::System; + this->message().flags |= Message::DoNotTriggerNotification; + this->message().searchText = text; } -void MessageBuilder::appendTimestamp() +MessageBuilder::MessageBuilder(TimeoutMessageTag, const QString &username, + const QString &durationInSeconds, + const QString &reason, bool multipleTimes) + : MessageBuilder() { - this->appendTimestamp(QTime::currentTime()); -} + QString text; -void MessageBuilder::setHighlight(bool value) -{ - if (value) { - this->message_->flags |= Message::Highlighted; + text.append(username); + if (!durationInSeconds.isEmpty()) { + text.append(" has been timed out"); + + // TODO: Implement who timed the user out + + text.append(" for "); + bool ok = true; + int timeoutSeconds = durationInSeconds.toInt(&ok); + if (ok) { + text.append(formatTime(timeoutSeconds)); + } } else { - this->message_->flags &= ~Message::Highlighted; + text.append(" has been permanently banned"); } + + if (reason.length() > 0) { + text.append(": \""); + text.append(parseTagString(reason)); + text.append("\""); + } + text.append("."); + + if (multipleTimes) { + text.append(" (multiple times)"); + } + + this->message().flags.EnableFlag(Message::System); + this->message().flags.EnableFlag(Message::Timeout); + this->message().flags.EnableFlag(Message::DoNotTriggerNotification); + this->message().timeoutUser = username; } -void MessageBuilder::appendTimestamp(const QTime &time) +MessageBuilder::MessageBuilder(const BanAction &action, uint32_t count) { - this->append(new TimestampElement(time)); + this->emplace(); + this->message().flags.EnableFlag(Message::System); + this->message().flags.EnableFlag(Message::Timeout); + this->message().timeoutUser = action.target.name; + this->message().count = count; + + QString text; + + if (action.isBan()) { + if (action.reason.isEmpty()) { + text = QString("%1 banned %2.") // + .arg(action.source.name) + .arg(action.target.name); + } else { + text = QString("%1 banned %2: \"%3\".") // + .arg(action.source.name) + .arg(action.target.name) + .arg(action.reason); + } + } else { + if (action.reason.isEmpty()) { + text = QString("%1 timed out %2 for %3.") // + .arg(action.source.name) + .arg(action.target.name) + .arg(formatTime(action.duration)); + } else { + text = QString("%1 timed out %2 for %3: \"%4\".") // + .arg(action.source.name) + .arg(action.target.name) + .arg(formatTime(action.duration)) + .arg(action.reason); + } + + if (count > 1) { + text.append(QString(" (%1 times)").arg(count)); + } + } + + this->emplace(text, MessageElement::Text, + MessageColor::System); + this->message().searchText = text; +} + +MessageBuilder::MessageBuilder(const UnbanAction &action) +{ + this->emplace(); + this->message().flags.EnableFlag(Message::System); + this->message().flags.EnableFlag(Message::Untimeout); + + this->message().timeoutUser = action.target.name; + + QString text; + + if (action.wasBan()) { + text = QString("%1 unbanned %2.") // + .arg(action.source.name) + .arg(action.target.name); + } else { + text = QString("%1 untimedout %2.") // + .arg(action.source.name) + .arg(action.target.name); + } + + this->emplace(text, MessageElement::Text, + MessageColor::System); + this->message().searchText = text; +} + +Message *MessageBuilder::operator->() +{ + return this->message_.get(); +} + +Message &MessageBuilder::message() +{ + return *this->message_; +} + +MessagePtr MessageBuilder::release() +{ + return MessagePtr(this->message_.release()); +} + +void MessageBuilder::append(std::unique_ptr element) +{ + this->message().elements.push_back(std::move(element)); } QString MessageBuilder::matchLink(const QString &string) diff --git a/src/messages/MessageBuilder.hpp b/src/messages/MessageBuilder.hpp index 6951f7255..5ae197254 100644 --- a/src/messages/MessageBuilder.hpp +++ b/src/messages/MessageBuilder.hpp @@ -3,21 +3,36 @@ #include "messages/Message.hpp" #include - #include namespace chatterino { -struct MessageBuilder { +struct SystemMessageTag { +}; +struct TimeoutMessageTag { +}; +const SystemMessageTag systemMessage{}; +const TimeoutMessageTag timeoutMessage{}; + +MessagePtr makeSystemMessage(const QString &text); + +class MessageBuilder +{ public: MessageBuilder(); + MessageBuilder(const QString &text); + MessageBuilder(SystemMessageTag, const QString &text); + MessageBuilder(TimeoutMessageTag, const QString &username, + const QString &durationInSeconds, const QString &reason, + bool multipleTimes); + MessageBuilder(const BanAction &action, uint32_t count = 1); + MessageBuilder(const UnbanAction &action); - MessagePtr getMessage(); + Message *operator->(); + Message &message(); + MessagePtr release(); - void setHighlight(bool value); - void append(MessageElement *element); - void appendTimestamp(); - void appendTimestamp(const QTime &time); + void append(std::unique_ptr element); QString matchLink(const QString &string); template @@ -26,13 +41,14 @@ public: static_assert(std::is_base_of::value, "T must extend MessageElement"); - T *element = new T(std::forward(args)...); - this->append(element); - return element; + auto unique = std::make_unique(std::forward(args)...); + auto pointer = unique.get(); + this->append(std::move(unique)); + return pointer; } -protected: - MessagePtr message_; +private: + std::unique_ptr message_; }; } // namespace chatterino diff --git a/src/messages/MessageElement.cpp b/src/messages/MessageElement.cpp index c2bff2f0d..e5e5cd735 100644 --- a/src/messages/MessageElement.cpp +++ b/src/messages/MessageElement.cpp @@ -7,6 +7,7 @@ #include "messages/layouts/MessageLayoutContainer.hpp" #include "messages/layouts/MessageLayoutElement.hpp" #include "singletons/Settings.hpp" +#include "util/DebugCount.hpp" namespace chatterino { diff --git a/src/messages/layouts/MessageLayout.cpp b/src/messages/layouts/MessageLayout.cpp index 376423dea..3f898f0db 100644 --- a/src/messages/layouts/MessageLayout.cpp +++ b/src/messages/layouts/MessageLayout.cpp @@ -5,6 +5,7 @@ #include "singletons/Emotes.hpp" #include "singletons/Settings.hpp" #include "singletons/WindowManager.hpp" +#include "util/DebugCount.hpp" #include #include @@ -32,7 +33,7 @@ MessageLayout::~MessageLayout() DebugCount::decrease("message layout"); } -Message *MessageLayout::getMessage() +const Message *MessageLayout::getMessage() { return this->message_.get(); } @@ -104,8 +105,7 @@ void MessageLayout::actuallyLayout(int width, MessageElement::Flags _flags) this->container_.begin(width, this->scale_, messageFlags); - for (const std::unique_ptr &element : - this->message_->getElements()) { + for (const auto &element : this->message_->elements) { element->addToContainer(this->container_, _flags); } diff --git a/src/messages/layouts/MessageLayout.hpp b/src/messages/layouts/MessageLayout.hpp index fc61c7d42..662bf1d2a 100644 --- a/src/messages/layouts/MessageLayout.hpp +++ b/src/messages/layouts/MessageLayout.hpp @@ -28,7 +28,7 @@ public: MessageLayout(MessagePtr message_); ~MessageLayout(); - Message *getMessage(); + const Message *getMessage(); // Height int getHeight() const; diff --git a/src/providers/irc/AbstractIrcServer.cpp b/src/providers/irc/AbstractIrcServer.cpp index 840291c5f..fc51f6745 100644 --- a/src/providers/irc/AbstractIrcServer.cpp +++ b/src/providers/irc/AbstractIrcServer.cpp @@ -3,6 +3,7 @@ #include "common/Common.hpp" #include "messages/LimitedQueueSnapshot.hpp" #include "messages/Message.hpp" +#include "messages/MessageBuilder.hpp" #include @@ -189,8 +190,8 @@ void AbstractIrcServer::onConnected() { std::lock_guard lock(this->channelMutex); - MessagePtr connMsg = Message::createSystemMessage("connected to chat"); - MessagePtr reconnMsg = Message::createSystemMessage("reconnected to chat"); + auto connected = makeSystemMessage("connected to chat"); + auto reconnected = makeSystemMessage("reconnected to chat"); for (std::weak_ptr &weak : this->channels.values()) { std::shared_ptr chan = weak.lock(); @@ -205,11 +206,12 @@ void AbstractIrcServer::onConnected() Message::DisconnectedMessage; if (replaceMessage) { - chan->replaceMessage(snapshot[snapshot.getLength() - 1], reconnMsg); + chan->replaceMessage(snapshot[snapshot.getLength() - 1], + reconnected); continue; } - chan->addMessage(connMsg); + chan->addMessage(connected); } } @@ -217,8 +219,9 @@ void AbstractIrcServer::onDisconnected() { std::lock_guard lock(this->channelMutex); - MessagePtr msg = Message::createSystemMessage("disconnected from chat"); - msg->flags |= Message::DisconnectedMessage; + MessageBuilder b(systemMessage, "disconnected from chat"); + b->flags |= Message::DisconnectedMessage; + auto disconnected = b.release(); for (std::weak_ptr &weak : this->channels.values()) { std::shared_ptr chan = weak.lock(); @@ -226,7 +229,7 @@ void AbstractIrcServer::onDisconnected() continue; } - chan->addMessage(msg); + chan->addMessage(disconnected); } } diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index 723156bd7..512e6b066 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -60,13 +60,16 @@ void IrcMessageHandler::addMessage(Communi::IrcMessage *_message, TwitchMessageBuilder builder(chan.get(), _message, args, content, isAction); if (isSub || !builder.isIgnored()) { - MessagePtr msg = builder.build(); - if (isSub) { - msg->flags |= Message::Subscription; - msg->flags &= ~Message::Highlighted; - } else { - if (msg->flags & Message::Highlighted) { + builder->flags |= Message::Subscription; + builder->flags &= ~Message::Highlighted; + } + + auto highlighted = bool(builder->flags & Message::Highlighted); + auto msg = builder.build(); + + if (!isSub) { + if (highlighted) { server.mentionsChannel->addMessage(msg); getApp()->highlights->addHighlight(msg); } @@ -151,8 +154,8 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message) // check if the chat has been cleared by a moderator if (message->parameters().length() == 1) { chan->disableAllMessages(); - chan->addMessage(Message::createSystemMessage( - "Chat has been cleared by a moderator.")); + chan->addMessage( + makeSystemMessage("Chat has been cleared by a moderator.")); return; } @@ -170,8 +173,9 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message) reason = v.toString(); } - auto timeoutMsg = Message::createTimeoutMessage(username, durationInSeconds, - reason, false); + auto timeoutMsg = MessageBuilder(timeoutMessage, username, + durationInSeconds, reason, false) + .release(); chan->addOrReplaceTimeout(timeoutMsg); // refresh all @@ -216,17 +220,17 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message) false); if (!builder.isIgnored()) { + app->twitch.server->lastUserThatWhisperedMe.set(builder.userName); + MessagePtr _message = builder.build(); if (_message->flags & Message::Highlighted) { app->twitch.server->mentionsChannel->addMessage(_message); } - app->twitch.server->lastUserThatWhisperedMe.set(builder.userName); - c->addMessage(_message); - _message->flags |= Message::DoNotTriggerNotification; + // _message->flags |= Message::DoNotTriggerNotification; if (app->settings->inlineWhispers) { app->twitch.server->forEachChannel([_message](ChannelPtr channel) { @@ -262,10 +266,11 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message, auto it = tags.find("system-msg"); if (it != tags.end()) { - auto newMessage = - Message::createSystemMessage(parseTagString(it.value().toString())); + auto b = MessageBuilder(systemMessage, + parseTagString(it.value().toString())); - newMessage->flags |= Message::Subscription; + b->flags |= Message::Subscription; + auto newMessage = b.release(); QString channelName; @@ -306,7 +311,7 @@ void IrcMessageHandler::handleModeMessage(Communi::IrcMessage *message) void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message) { auto app = getApp(); - MessagePtr msg = Message::createSystemMessage(message->content()); + MessagePtr msg = makeSystemMessage(message->content()); QString channelName; if (!trimChannelName(message->target(), channelName)) { diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index 274dd4264..6a0289422 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -68,7 +68,7 @@ TwitchChannel::TwitchChannel(const QString &name) // debugging #if 0 for (int i = 0; i < 1000; i++) { - this->addMessage(Message::createSystemMessage("asdf")); + this->addMessage(makeSystemMessage("asdf")); } #endif } @@ -104,9 +104,9 @@ void TwitchChannel::sendMessage(const QString &message) if (!app->accounts->twitch.isLoggedIn()) { // XXX: It would be nice if we could add a link here somehow that opened // the "account manager" dialog - this->addMessage(Message::createSystemMessage( - "You need to log in to send messages. You can " - "link your Twitch account in the settings.")); + this->addMessage( + makeSystemMessage("You need to log in to send messages. You can " + "link your Twitch account in the settings.")); return; } @@ -159,7 +159,7 @@ bool TwitchChannel::isBroadcaster() const return this->getName() == app->accounts->twitch.getCurrent()->getUserName(); } -void TwitchChannel::addRecentChatter(const std::shared_ptr &message) +void TwitchChannel::addRecentChatter(const MessagePtr &message) { assert(!message->loginName.isEmpty()); @@ -183,11 +183,11 @@ void TwitchChannel::addJoinedUser(const QString &user) QTimer::singleShot(500, &this->lifetimeGuard_, [this] { auto joinedUsers = this->joinedUsers_.access(); - auto message = Message::createSystemMessage( - "Users joined: " + joinedUsers->join(", ")); - message->flags |= Message::Collapsed; + MessageBuilder builder(systemMessage, + "Users joined: " + joinedUsers->join(", ")); + builder->flags |= Message::Collapsed; joinedUsers->clear(); - this->addMessage(message); + this->addMessage(builder.release()); this->joinedUsersMergeQueued_ = false; }); } @@ -211,10 +211,10 @@ void TwitchChannel::addPartedUser(const QString &user) QTimer::singleShot(500, &this->lifetimeGuard_, [this] { auto partedUsers = this->partedUsers_.access(); - auto message = Message::createSystemMessage( - "Users parted: " + partedUsers->join(", ")); - message->flags |= Message::Collapsed; - this->addMessage(message); + MessageBuilder builder(systemMessage, + "Users parted: " + partedUsers->join(", ")); + builder->flags |= Message::Collapsed; + this->addMessage(builder.release()); partedUsers->clear(); this->partedUsersMergeQueued_ = false; diff --git a/src/providers/twitch/TwitchChannel.hpp b/src/providers/twitch/TwitchChannel.hpp index 422b1b68a..bc084d73f 100644 --- a/src/providers/twitch/TwitchChannel.hpp +++ b/src/providers/twitch/TwitchChannel.hpp @@ -54,7 +54,7 @@ public: virtual void sendMessage(const QString &message) override; // Auto completion - void addRecentChatter(const std::shared_ptr &message) final; + void addRecentChatter(const MessagePtr &message) final; void addJoinedUser(const QString &user); void addPartedUser(const QString &user); diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index 91c9161fc..9e7e6d2de 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -98,7 +98,7 @@ MessagePtr TwitchMessageBuilder::build() // MessageElement::Collapsed); // } //#endif - this->message_->flags |= Message::Collapsed; + this->message().flags |= Message::Collapsed; // PARSING this->parseMessageID(); @@ -175,9 +175,9 @@ MessagePtr TwitchMessageBuilder::build() this->addWords(splits, twitchEmotes); - this->message_->searchText = this->userName + ": " + this->originalMessage_; + this->message().searchText = this->userName + ": " + this->originalMessage_; - return this->getMessage(); + return this->release(); } void TwitchMessageBuilder::addWords( @@ -376,7 +376,7 @@ void TwitchMessageBuilder::parseUsername() // this->userName + ")"; // } - this->message_->loginName = this->userName; + this->message().loginName = this->userName; } void TwitchMessageBuilder::appendUsername() @@ -384,7 +384,7 @@ void TwitchMessageBuilder::appendUsername() auto app = getApp(); QString username = this->userName; - this->message_->loginName = username; + this->message().loginName = username; QString localizedName; auto iterator = this->tags.find("display-name"); @@ -396,12 +396,12 @@ void TwitchMessageBuilder::appendUsername() Qt::CaseInsensitive) == 0) { username = displayName; - this->message_->displayName = displayName; + this->message().displayName = displayName; } else { localizedName = displayName; - this->message_->displayName = username; - this->message_->localizedName = displayName; + this->message().displayName = username; + this->message().localizedName = displayName; } } @@ -573,7 +573,7 @@ void TwitchMessageBuilder::parseHighlights(bool isPastMsg) } } - this->setHighlight(doHighlight); + this->message().flags.set(Message::Highlighted, doHighlight); if (!isPastMsg) { if (playSound && @@ -586,10 +586,6 @@ void TwitchMessageBuilder::parseHighlights(bool isPastMsg) 2500); } } - - if (doHighlight) { - this->message_->flags |= Message::Highlighted; - } } } @@ -662,7 +658,7 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name) // fourtf: this is ugly // maybe put the individual badges into a map instead of this -//mess +// mess void TwitchMessageBuilder::appendTwitchBadges() { auto app = getApp(); diff --git a/src/providers/twitch/TwitchServer.cpp b/src/providers/twitch/TwitchServer.cpp index 49d24c654..1eb6ff1c5 100644 --- a/src/providers/twitch/TwitchServer.cpp +++ b/src/providers/twitch/TwitchServer.cpp @@ -217,7 +217,7 @@ void TwitchServer::onMessageSendRequested(TwitchChannel *channel, lastMessage.back() + minMessageOffset > now) { if (this->lastErrorTimeSpeed_ + 30s < now) { auto errorMessage = - Message::createSystemMessage("sending messages too fast"); + makeSystemMessage("sending messages too fast"); channel->addMessage(errorMessage); @@ -235,7 +235,7 @@ void TwitchServer::onMessageSendRequested(TwitchChannel *channel, if (lastMessage.size() >= maxMessageCount) { if (this->lastErrorTimeAmount_ + 30s < now) { auto errorMessage = - Message::createSystemMessage("sending too many messages"); + makeSystemMessage("sending too many messages"); channel->addMessage(errorMessage); diff --git a/src/singletons/helper/LoggingChannel.cpp b/src/singletons/helper/LoggingChannel.cpp index 0c33fcf0b..97a0b8478 100644 --- a/src/singletons/helper/LoggingChannel.cpp +++ b/src/singletons/helper/LoggingChannel.cpp @@ -79,7 +79,7 @@ void LoggingChannel::openLogFile() this->appendLine(this->generateOpeningString(now)); } -void LoggingChannel::addMessage(std::shared_ptr message) +void LoggingChannel::addMessage(MessagePtr message) { QDateTime now = QDateTime::currentDateTime(); diff --git a/src/singletons/helper/LoggingChannel.hpp b/src/singletons/helper/LoggingChannel.hpp index 3f327538f..1a29a0c6f 100644 --- a/src/singletons/helper/LoggingChannel.hpp +++ b/src/singletons/helper/LoggingChannel.hpp @@ -19,7 +19,7 @@ class LoggingChannel : boost::noncopyable public: ~LoggingChannel(); - void addMessage(std::shared_ptr message); + void addMessage(MessagePtr message); private: void openLogFile(); diff --git a/src/util/FormatTime.cpp b/src/util/FormatTime.cpp new file mode 100644 index 000000000..2eccca901 --- /dev/null +++ b/src/util/FormatTime.cpp @@ -0,0 +1,46 @@ +#include "FormatTime.hpp" + +namespace chatterino { +namespace { +void appendDuration(int count, QChar &&order, QString &outString) +{ + outString.append(QString::number(count)); + outString.append(order); +} +} // namespace + +QString formatTime(int totalSeconds) +{ + QString res; + + int seconds = totalSeconds % 60; + int timeoutMinutes = totalSeconds / 60; + int minutes = timeoutMinutes % 60; + int timeoutHours = timeoutMinutes / 60; + int hours = timeoutHours % 24; + int days = timeoutHours / 24; + if (days > 0) { + appendDuration(days, 'd', res); + } + if (hours > 0) { + if (!res.isEmpty()) { + res.append(" "); + } + appendDuration(hours, 'h', res); + } + if (minutes > 0) { + if (!res.isEmpty()) { + res.append(" "); + } + appendDuration(minutes, 'm', res); + } + if (seconds > 0) { + if (!res.isEmpty()) { + res.append(" "); + } + appendDuration(seconds, 's', res); + } + return res; +} + +} // namespace chatterino diff --git a/src/util/FormatTime.hpp b/src/util/FormatTime.hpp new file mode 100644 index 000000000..72d45e51f --- /dev/null +++ b/src/util/FormatTime.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include + +namespace chatterino { + +// format: 1h 23m 42s +QString formatTime(int totalSeconds); + +} // namespace chatterino diff --git a/src/widgets/dialogs/EmotePopup.cpp b/src/widgets/dialogs/EmotePopup.cpp index 74ce5951e..fda65a879 100644 --- a/src/widgets/dialogs/EmotePopup.cpp +++ b/src/widgets/dialogs/EmotePopup.cpp @@ -63,24 +63,24 @@ void EmotePopup::loadChannel(ChannelPtr _channel) // TITLE MessageBuilder builder1; - builder1.append(new TextElement(title, MessageElement::Text)); + builder1.emplace(title, MessageElement::Text); - builder1.getMessage()->flags |= Message::Centered; - emoteChannel->addMessage(builder1.getMessage()); + builder1->flags |= Message::Centered; + emoteChannel->addMessage(builder1.release()); // EMOTES MessageBuilder builder2; - builder2.getMessage()->flags |= Message::Centered; - builder2.getMessage()->flags |= Message::DisableCompactEmotes; + builder2->flags |= Message::Centered; + builder2->flags |= Message::DisableCompactEmotes; for (auto emote : map) { - builder2.append( - (new EmoteElement(emote.second, - MessageElement::Flags::AlwaysShow)) - ->setLink(Link(Link::InsertText, emote.first.string))); + builder2 + .emplace(emote.second, + MessageElement::Flags::AlwaysShow) + ->setLink(Link(Link::InsertText, emote.first.string)); } - emoteChannel->addMessage(builder2.getMessage()); + emoteChannel->addMessage(builder2.release()); }; auto app = getApp(); @@ -103,25 +103,25 @@ void EmotePopup::loadChannel(ChannelPtr _channel) setText = set->text; } - builder1.append(new TextElement(setText, MessageElement::Text)); + builder1.emplace(setText, MessageElement::Text); - builder1.getMessage()->flags |= Message::Centered; - emoteChannel->addMessage(builder1.getMessage()); + builder1->flags |= Message::Centered; + emoteChannel->addMessage(builder1.release()); // EMOTES MessageBuilder builder2; - builder2.getMessage()->flags |= Message::Centered; - builder2.getMessage()->flags |= Message::DisableCompactEmotes; + builder2->flags |= Message::Centered; + builder2->flags |= Message::DisableCompactEmotes; for (const auto &emote : set->emotes) { - builder2.append( - (new EmoteElement( - app->emotes->twitch.getOrCreateEmote(emote.id, emote.name), - MessageElement::Flags::AlwaysShow)) - ->setLink(Link(Link::InsertText, emote.name.string))); + builder2 + .emplace( + app->emotes->twitch.getOrCreateEmote(emote.id, emote.name), + MessageElement::Flags::AlwaysShow) + ->setLink(Link(Link::InsertText, emote.name.string)); } - emoteChannel->addMessage(builder2.getMessage()); + emoteChannel->addMessage(builder2.release()); } addEmotes(*app->emotes->bttv.accessGlobalEmotes(), @@ -146,22 +146,23 @@ void EmotePopup::loadEmojis() // title MessageBuilder builder1; - builder1.append(new TextElement("emojis", MessageElement::Text)); - builder1.getMessage()->flags |= Message::Centered; - emojiChannel->addMessage(builder1.getMessage()); + builder1.emplace("emojis", MessageElement::Text); + builder1->flags |= Message::Centered; + emojiChannel->addMessage(builder1.release()); // emojis MessageBuilder builder; - builder.getMessage()->flags |= Message::Centered; - builder.getMessage()->flags |= Message::DisableCompactEmotes; + builder->flags |= Message::Centered; + builder->flags |= Message::DisableCompactEmotes; emojis.each([&builder](const auto &key, const auto &value) { - builder.append( - (new EmoteElement(value->emote, MessageElement::Flags::AlwaysShow)) - ->setLink(Link(Link::Type::InsertText, - ":" + value->shortCodes[0] + ":"))); + builder + .emplace(value->emote, + MessageElement::Flags::AlwaysShow) + ->setLink( + Link(Link::Type::InsertText, ":" + value->shortCodes[0] + ":")); }); - emojiChannel->addMessage(builder.getMessage()); + emojiChannel->addMessage(builder.release()); this->viewEmojis_->setChannel(emojiChannel); } diff --git a/src/widgets/dialogs/LogsPopup.cpp b/src/widgets/dialogs/LogsPopup.cpp index 218505a2d..5171cc756 100644 --- a/src/widgets/dialogs/LogsPopup.cpp +++ b/src/widgets/dialogs/LogsPopup.cpp @@ -170,15 +170,15 @@ void LogsPopup::getOverrustleLogs() singleMessage.value("timestamp").toInt()) .time(); - MessagePtr message(new Message); - message->addElement(new TimestampElement(timeStamp)); - message->addElement(new TextElement(this->userName_, - MessageElement::Username, - MessageColor::System)); - message->addElement( - new TextElement(singleMessage.value("text").toString(), - MessageElement::Text, MessageColor::Text)); - messages.push_back(message); + MessageBuilder builder; + builder.emplace(timeStamp); + builder.emplace(this->userName_, + MessageElement::Username, + MessageColor::System); + builder.emplace( + singleMessage.value("text").toString(), + MessageElement::Text, MessageColor::Text); + messages.push_back(builder.release()); } } this->setMessages(messages); diff --git a/src/widgets/settingspages/LookPage.cpp b/src/widgets/settingspages/LookPage.cpp index c14cb894b..80ce2ebb8 100644 --- a/src/widgets/settingspages/LookPage.cpp +++ b/src/widgets/settingspages/LookPage.cpp @@ -1,6 +1,7 @@ #include "LookPage.hpp" #include "Application.hpp" +#include "messages/MessageBuilder.hpp" #include "singletons/WindowManager.hpp" #include "util/LayoutCreator.hpp" #include "util/RemoveScrollAreaBackground.hpp" @@ -317,55 +318,31 @@ ChannelPtr LookPage::createPreviewChannel() { auto channel = ChannelPtr(new Channel("preview", Channel::Type::Misc)); + // clang-format off { - auto message = MessagePtr(new Message()); - message->addElement(new TimestampElement(QTime(8, 13, 42))); - message->addElement(new ImageElement( - Image::fromNonOwningPixmap(&getApp()->resources->twitch.moderator), - MessageElement::BadgeChannelAuthority)); - message->addElement(new ImageElement( - Image::fromNonOwningPixmap(&getApp()->resources->twitch.subscriber), - MessageElement::BadgeSubscription)); - message->addElement( - new TextElement("username1:", MessageElement::Username, - QColor("#0094FF"), FontStyle::ChatMediumBold)); - message->addElement( - new TextElement("This is a preview message", MessageElement::Text)); - message->addElement(new ImageElement( - Image::fromNonOwningPixmap(&getApp()->resources->pajaDank), - MessageElement::Flags::AlwaysShow)); - message->addElement( - new TextElement("@fourtf", TextElement::BoldUsername, - MessageColor::Text, FontStyle::ChatMediumBold)); - message->addElement( - new TextElement("@fourtf", TextElement::NonBoldUsername)); - channel->addMessage(message); + MessageBuilder builder; + builder.emplace(QTime(8, 13, 42)); + builder.emplace(Image::fromNonOwningPixmap(&getApp()->resources->twitch.moderator), MessageElement::BadgeChannelAuthority); + builder.emplace(Image::fromNonOwningPixmap(&getApp()->resources->twitch.subscriber), MessageElement::BadgeSubscription); + builder.emplace("username1:", MessageElement::Username, QColor("#0094FF"), FontStyle::ChatMediumBold); + builder.emplace("This is a preview message", MessageElement::Text); + builder.emplace(Image::fromNonOwningPixmap(&getApp()->resources->pajaDank), MessageElement::Flags::AlwaysShow); + builder.emplace("@fourtf", TextElement::BoldUsername, MessageColor::Text, FontStyle::ChatMediumBold); + builder.emplace("@fourtf", TextElement::NonBoldUsername); + channel->addMessage(builder.release()); } { - auto message = MessagePtr(new Message()); - message->addElement(new TimestampElement(QTime(8, 15, 21))); - message->addElement( - new ImageElement(Image::fromNonOwningPixmap( - &getApp()->resources->twitch.broadcaster), - MessageElement::BadgeChannelAuthority)); - message->addElement( - new TextElement("username2:", MessageElement::Username, - QColor("#FF6A00"), FontStyle::ChatMediumBold)); - message->addElement( - new TextElement("This is another one", MessageElement::Text)); - // message->addElement(new ImageElement( - // Image::fromNonOwningPixmap(&getApp()->resources->ppHop), - // MessageElement::BttvEmote)); - message->addElement( - (new TextElement("www.fourtf.com", MessageElement::LowercaseLink, - MessageColor::Link)) - ->setLink(Link(Link::Url, "https://www.fourtf.com"))); - message->addElement( - (new TextElement("wWw.FoUrTf.CoM", MessageElement::OriginalLink, - MessageColor::Link)) - ->setLink(Link(Link::Url, "https://www.fourtf.com"))); - channel->addMessage(message); + MessageBuilder message; + message.emplace(QTime(8, 15, 21)); + message.emplace(Image::fromNonOwningPixmap(&getApp()->resources->twitch.broadcaster), MessageElement::BadgeChannelAuthority); + message.emplace("username2:", MessageElement::Username, QColor("#FF6A00"), FontStyle::ChatMediumBold); + message.emplace("This is another one", MessageElement::Text); + // message.emplace(Image::fromNonOwningPixmap(&getApp()->resources->ppHop), MessageElement::BttvEmote); + message.emplace("www.fourtf.com", MessageElement::LowercaseLink, MessageColor::Link)->setLink(Link(Link::Url, "https://www.fourtf.com")); + message.emplace("wWw.FoUrTf.CoM", MessageElement::OriginalLink, MessageColor::Link)->setLink(Link(Link::Url, "https://www.fourtf.com")); + channel->addMessage(message.release()); } + // clang-format on return channel; } diff --git a/weakOf b/weakOf deleted file mode 100644 index e69de29bb..000000000