diff --git a/chatterino.pro b/chatterino.pro index c95964c26..a59d2e0b8 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -1,370 +1,371 @@ -#------------------------------------------------- -# -# 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/precompiled_header.hpp -CONFIG += precompile_header - -# 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 - -# 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" -} - -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") -} - -# src -SOURCES += \ - src/main.cpp \ - src/application.cpp \ - src/channel.cpp \ - src/channeldata.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/irc/abstractircserver.cpp \ - src/providers/twitch/ircmessagehandler.cpp \ - src/providers/twitch/twitchaccount.cpp \ - src/providers/twitch/twitchaccountmanager.cpp \ - src/providers/twitch/twitchchannel.cpp \ - src/providers/twitch/twitchmessagebuilder.cpp \ - src/providers/twitch/twitchserver.cpp \ - src/singletons/accountmanager.cpp \ - src/singletons/commandmanager.cpp \ - src/singletons/emotemanager.cpp \ - src/singletons/fontmanager.cpp \ - src/util/completionmodel.cpp \ - src/singletons/helper/loggingchannel.cpp \ - src/singletons/helper/moderationaction.cpp \ - src/singletons/helper/chatterinosetting.cpp \ - src/singletons/loggingmanager.cpp \ - src/singletons/pathmanager.cpp \ - src/singletons/resourcemanager.cpp \ - src/singletons/settingsmanager.cpp \ - src/singletons/thememanager.cpp \ - src/singletons/windowmanager.cpp \ - src/util/networkmanager.cpp \ - src/util/networkrequest.cpp \ - src/widgets/accountpopup.cpp \ - src/widgets/accountswitchpopupwidget.cpp \ - src/widgets/accountswitchwidget.cpp \ - src/widgets/basewidget.cpp \ - src/widgets/basewindow.cpp \ - src/widgets/emotepopup.cpp \ - src/widgets/helper/channelview.cpp \ - src/widgets/helper/droppreview.cpp \ - src/widgets/helper/label.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/splitcolumn.cpp \ - src/widgets/helper/splitheader.cpp \ - src/widgets/helper/splitinput.cpp \ - src/widgets/helper/titlebarbutton.cpp \ - src/widgets/logindialog.cpp \ - src/widgets/notebook.cpp \ - src/widgets/qualitypopup.cpp \ - src/widgets/scrollbar.cpp \ - src/widgets/settingsdialog.cpp \ - src/widgets/settingspages/aboutpage.cpp \ - src/widgets/settingspages/accountspage.cpp \ - src/widgets/settingspages/appearancepage.cpp \ - src/widgets/settingspages/behaviourpage.cpp \ - src/widgets/settingspages/commandpage.cpp \ - src/widgets/settingspages/emotespage.cpp \ - src/widgets/settingspages/highlightingpage.cpp \ - src/widgets/settingspages/ignoremessagespage.cpp \ - src/widgets/settingspages/ignoreuserspage.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/split.cpp \ - src/widgets/splitcontainer.cpp \ - src/widgets/streamview.cpp \ - src/widgets/textinputdialog.cpp \ - src/widgets/tooltipwidget.cpp \ - src/widgets/window.cpp \ - src/providers/irc/ircaccount.cpp \ - src/providers/irc/ircserver.cpp \ - src/providers/irc/ircchannel2.cpp \ - src/util/streamlink.cpp \ - src/providers/twitch/twitchhelpers.cpp \ - src/widgets/helper/signallabel.cpp \ - src/widgets/helper/debugpopup.cpp \ - src/util/debugcount.cpp \ - src/singletons/nativemessagingmanager.cpp \ - src/singletons/pubsubmanager.cpp \ - src/util/rapidjson-helpers.cpp \ - src/singletons/helper/pubsubhelpers.cpp \ - src/singletons/helper/pubsubactions.cpp \ - src/widgets/selectchanneldialog.cpp \ - src/singletons/updatemanager.cpp \ - src/widgets/lastruncrashdialog.cpp \ - src/widgets/attachedwindow.cpp \ - src/widgets/settingspages/externaltoolspage.cpp - -HEADERS += \ - src/precompiled_header.hpp \ - src/channel.hpp \ - src/const.hpp \ - src/debug/log.hpp \ - src/emojis.hpp \ - src/messages/highlightphrase.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/providers/twitch/emotevalue.hpp \ - src/providers/twitch/ircmessagehandler.hpp \ - src/providers/twitch/twitchaccount.hpp \ - src/providers/twitch/twitchaccountmanager.hpp \ - src/providers/twitch/twitchchannel.hpp \ - src/providers/twitch/twitchmessagebuilder.hpp \ - src/providers/twitch/twitchserver.hpp \ - src/singletons/accountmanager.hpp \ - src/singletons/commandmanager.hpp \ - src/singletons/emotemanager.hpp \ - src/singletons/fontmanager.hpp \ - src/singletons/helper/chatterinosetting.hpp \ - src/util/completionmodel.hpp \ - src/singletons/helper/loggingchannel.hpp \ - src/singletons/helper/moderationaction.hpp \ - src/singletons/loggingmanager.hpp \ - src/singletons/pathmanager.hpp \ - src/singletons/resourcemanager.hpp \ - src/singletons/thememanager.hpp \ - src/singletons/windowmanager.hpp \ - src/util/benchmark.hpp \ - src/util/concurrentmap.hpp \ - src/util/distancebetweenpoints.hpp \ - src/util/emotemap.hpp \ - src/util/flagsenum.hpp \ - src/util/helpers.hpp \ - src/util/irchelpers.hpp \ - src/util/layoutcreator.hpp \ - src/util/nativeeventhelper.hpp \ - src/util/networkmanager.hpp \ - src/util/networkrequest.hpp \ - src/util/networkrequester.hpp \ - src/util/networkworker.hpp \ - src/util/posttothread.hpp \ - src/util/property.hpp \ - src/util/serialize-custom.hpp \ - src/util/urlfetch.hpp \ - src/widgets/accountpopup.hpp \ - src/widgets/accountswitchpopupwidget.hpp \ - src/widgets/accountswitchwidget.hpp \ - src/widgets/basewidget.hpp \ - src/widgets/basewindow.hpp \ - src/widgets/emotepopup.hpp \ - src/widgets/helper/channelview.hpp \ - src/widgets/helper/droppreview.hpp \ - src/widgets/helper/label.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/splitcolumn.hpp \ - src/widgets/helper/splitheader.hpp \ - src/widgets/helper/splitinput.hpp \ - src/widgets/helper/titlebarbutton.hpp \ - src/widgets/notebook.hpp \ - src/widgets/qualitypopup.hpp \ - src/widgets/scrollbar.hpp \ - src/widgets/settingsdialog.hpp \ - src/widgets/settingspages/aboutpage.hpp \ - src/widgets/settingspages/accountspage.hpp \ - src/widgets/settingspages/appearancepage.hpp \ - src/widgets/settingspages/behaviourpage.hpp \ - src/widgets/settingspages/commandpage.hpp \ - src/widgets/settingspages/emotespage.hpp \ - src/widgets/settingspages/highlightingpage.hpp \ - src/widgets/settingspages/ignoremessagespage.hpp \ - src/widgets/settingspages/ignoreuserspage.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/split.hpp \ - src/widgets/splitcontainer.hpp \ - src/widgets/streamview.hpp \ - src/widgets/textinputdialog.hpp \ - src/widgets/tooltipwidget.hpp \ - src/widgets/window.hpp \ - src/common.hpp \ - src/providers/irc/abstractircserver.hpp \ - src/providers/irc/ircaccount.hpp \ - src/providers/irc/ircserver.hpp \ - src/providers/irc/ircchannel2.hpp \ - src/util/streamlink.hpp \ - src/providers/twitch/twitchhelpers.hpp \ - src/util/debugcount.hpp \ - src/widgets/helper/debugpopup.hpp \ - src/version.hpp \ - src/singletons/settingsmanager.hpp \ - src/singletons/nativemessagingmanager.hpp \ - src/singletons/pubsubmanager.hpp \ - src/util/rapidjson-helpers.hpp \ - src/singletons/helper/pubsubhelpers.hpp \ - src/singletons/helper/pubsubactions.hpp \ - src/widgets/selectchanneldialog.hpp \ - src/singletons/updatemanager.hpp \ - src/widgets/lastruncrashdialog.hpp \ - src/widgets/attachedwindow.hpp \ - src/widgets/settingspages/externaltoolspage.hpp \ - src/util/removescrollareabackground.hpp \ - src/util/assertinguithread.h - -RESOURCES += \ - resources/resources.qrc - -DISTFILES += - -FORMS += \ - forms/accountpopupform.ui - -# 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 - - # Disabling strict-aliasing warnings for now, although we probably want to re-enable this in the future - QMAKE_CXXFLAGS_WARN_ON += -Wno-strict-aliasing - - equals(QMAKE_CXX, "clang++") { - QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedef - } -} - -# 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/precompiled_header.hpp +CONFIG += precompile_header + +# 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 + +# 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" +} + +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") +} + +# src +SOURCES += \ + src/main.cpp \ + src/application.cpp \ + src/channel.cpp \ + src/channeldata.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/irc/abstractircserver.cpp \ + src/providers/twitch/ircmessagehandler.cpp \ + src/providers/twitch/twitchaccount.cpp \ + src/providers/twitch/twitchaccountmanager.cpp \ + src/providers/twitch/twitchchannel.cpp \ + src/providers/twitch/twitchmessagebuilder.cpp \ + src/providers/twitch/twitchserver.cpp \ + src/singletons/accountmanager.cpp \ + src/singletons/commandmanager.cpp \ + src/singletons/emotemanager.cpp \ + src/singletons/fontmanager.cpp \ + src/util/completionmodel.cpp \ + src/singletons/helper/loggingchannel.cpp \ + src/singletons/helper/moderationaction.cpp \ + src/singletons/helper/chatterinosetting.cpp \ + src/singletons/loggingmanager.cpp \ + src/singletons/pathmanager.cpp \ + src/singletons/resourcemanager.cpp \ + src/singletons/settingsmanager.cpp \ + src/singletons/thememanager.cpp \ + src/singletons/windowmanager.cpp \ + src/util/networkmanager.cpp \ + src/util/networkrequest.cpp \ + src/widgets/accountpopup.cpp \ + src/widgets/accountswitchpopupwidget.cpp \ + src/widgets/accountswitchwidget.cpp \ + src/widgets/basewidget.cpp \ + src/widgets/basewindow.cpp \ + src/widgets/emotepopup.cpp \ + src/widgets/helper/channelview.cpp \ + src/widgets/helper/droppreview.cpp \ + src/widgets/helper/label.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/splitcolumn.cpp \ + src/widgets/helper/splitheader.cpp \ + src/widgets/helper/splitinput.cpp \ + src/widgets/helper/titlebarbutton.cpp \ + src/widgets/logindialog.cpp \ + src/widgets/notebook.cpp \ + src/widgets/qualitypopup.cpp \ + src/widgets/scrollbar.cpp \ + src/widgets/settingsdialog.cpp \ + src/widgets/settingspages/aboutpage.cpp \ + src/widgets/settingspages/accountspage.cpp \ + src/widgets/settingspages/appearancepage.cpp \ + src/widgets/settingspages/behaviourpage.cpp \ + src/widgets/settingspages/commandpage.cpp \ + src/widgets/settingspages/emotespage.cpp \ + src/widgets/settingspages/highlightingpage.cpp \ + src/widgets/settingspages/ignoremessagespage.cpp \ + src/widgets/settingspages/ignoreuserspage.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/split.cpp \ + src/widgets/splitcontainer.cpp \ + src/widgets/streamview.cpp \ + src/widgets/textinputdialog.cpp \ + src/widgets/tooltipwidget.cpp \ + src/widgets/window.cpp \ + src/providers/irc/ircaccount.cpp \ + src/providers/irc/ircserver.cpp \ + src/providers/irc/ircchannel2.cpp \ + src/util/streamlink.cpp \ + src/providers/twitch/twitchhelpers.cpp \ + src/widgets/helper/signallabel.cpp \ + src/widgets/helper/debugpopup.cpp \ + src/util/debugcount.cpp \ + src/singletons/nativemessagingmanager.cpp \ + src/singletons/pubsubmanager.cpp \ + src/util/rapidjson-helpers.cpp \ + src/singletons/helper/pubsubhelpers.cpp \ + src/singletons/helper/pubsubactions.cpp \ + src/widgets/selectchanneldialog.cpp \ + src/singletons/updatemanager.cpp \ + src/widgets/lastruncrashdialog.cpp \ + src/widgets/attachedwindow.cpp \ + src/widgets/settingspages/externaltoolspage.cpp + +HEADERS += \ + src/precompiled_header.hpp \ + src/channel.hpp \ + src/const.hpp \ + src/debug/log.hpp \ + src/emojis.hpp \ + src/messages/highlightphrase.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/providers/twitch/emotevalue.hpp \ + src/providers/twitch/ircmessagehandler.hpp \ + src/providers/twitch/twitchaccount.hpp \ + src/providers/twitch/twitchaccountmanager.hpp \ + src/providers/twitch/twitchchannel.hpp \ + src/providers/twitch/twitchmessagebuilder.hpp \ + src/providers/twitch/twitchserver.hpp \ + src/singletons/accountmanager.hpp \ + src/singletons/commandmanager.hpp \ + src/singletons/emotemanager.hpp \ + src/singletons/fontmanager.hpp \ + src/singletons/helper/chatterinosetting.hpp \ + src/util/completionmodel.hpp \ + src/singletons/helper/loggingchannel.hpp \ + src/singletons/helper/moderationaction.hpp \ + src/singletons/loggingmanager.hpp \ + src/singletons/pathmanager.hpp \ + src/singletons/resourcemanager.hpp \ + src/singletons/thememanager.hpp \ + src/singletons/windowmanager.hpp \ + src/util/benchmark.hpp \ + src/util/concurrentmap.hpp \ + src/util/distancebetweenpoints.hpp \ + src/util/emotemap.hpp \ + src/util/flagsenum.hpp \ + src/util/helpers.hpp \ + src/util/irchelpers.hpp \ + src/util/layoutcreator.hpp \ + src/util/nativeeventhelper.hpp \ + src/util/networkmanager.hpp \ + src/util/networkrequest.hpp \ + src/util/networkrequester.hpp \ + src/util/networkworker.hpp \ + src/util/posttothread.hpp \ + src/util/property.hpp \ + src/util/serialize-custom.hpp \ + src/util/urlfetch.hpp \ + src/widgets/accountpopup.hpp \ + src/widgets/accountswitchpopupwidget.hpp \ + src/widgets/accountswitchwidget.hpp \ + src/widgets/basewidget.hpp \ + src/widgets/basewindow.hpp \ + src/widgets/emotepopup.hpp \ + src/widgets/helper/channelview.hpp \ + src/widgets/helper/droppreview.hpp \ + src/widgets/helper/label.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/splitcolumn.hpp \ + src/widgets/helper/splitheader.hpp \ + src/widgets/helper/splitinput.hpp \ + src/widgets/helper/titlebarbutton.hpp \ + src/widgets/notebook.hpp \ + src/widgets/qualitypopup.hpp \ + src/widgets/scrollbar.hpp \ + src/widgets/settingsdialog.hpp \ + src/widgets/settingspages/aboutpage.hpp \ + src/widgets/settingspages/accountspage.hpp \ + src/widgets/settingspages/appearancepage.hpp \ + src/widgets/settingspages/behaviourpage.hpp \ + src/widgets/settingspages/commandpage.hpp \ + src/widgets/settingspages/emotespage.hpp \ + src/widgets/settingspages/highlightingpage.hpp \ + src/widgets/settingspages/ignoremessagespage.hpp \ + src/widgets/settingspages/ignoreuserspage.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/split.hpp \ + src/widgets/splitcontainer.hpp \ + src/widgets/streamview.hpp \ + src/widgets/textinputdialog.hpp \ + src/widgets/tooltipwidget.hpp \ + src/widgets/window.hpp \ + src/common.hpp \ + src/providers/irc/abstractircserver.hpp \ + src/providers/irc/ircaccount.hpp \ + src/providers/irc/ircserver.hpp \ + src/providers/irc/ircchannel2.hpp \ + src/util/streamlink.hpp \ + src/providers/twitch/twitchhelpers.hpp \ + src/util/debugcount.hpp \ + src/widgets/helper/debugpopup.hpp \ + src/version.hpp \ + src/singletons/settingsmanager.hpp \ + src/singletons/nativemessagingmanager.hpp \ + src/singletons/pubsubmanager.hpp \ + src/util/rapidjson-helpers.hpp \ + src/singletons/helper/pubsubhelpers.hpp \ + src/singletons/helper/pubsubactions.hpp \ + src/widgets/selectchanneldialog.hpp \ + src/singletons/updatemanager.hpp \ + src/widgets/lastruncrashdialog.hpp \ + src/widgets/attachedwindow.hpp \ + src/widgets/settingspages/externaltoolspage.hpp \ + src/util/removescrollareabackground.hpp \ + src/util/assertinguithread.h \ + src/util/standarditemhelper.hpp + +RESOURCES += \ + resources/resources.qrc + +DISTFILES += + +FORMS += \ + forms/accountpopupform.ui + +# 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 + + # Disabling strict-aliasing warnings for now, although we probably want to re-enable this in the future + QMAKE_CXXFLAGS_WARN_ON += -Wno-strict-aliasing + + equals(QMAKE_CXX, "clang++") { + QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedef + } +} + +# 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/util/standarditemhelper.hpp b/src/util/standarditemhelper.hpp new file mode 100644 index 000000000..73eb4ea2b --- /dev/null +++ b/src/util/standarditemhelper.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include + +namespace chatterino { +namespace util { + +QStandardItem *boolItem(bool value, bool userCheckable = true, bool selectable = true) +{ + auto *item = new QStandardItem(); + item->setFlags((Qt::ItemFlags)(Qt::ItemIsEnabled | (selectable ? Qt::ItemIsSelectable : 0) | + (userCheckable ? Qt::ItemIsUserCheckable : 0))); + item->setCheckState(value ? Qt::Checked : Qt::Unchecked); + return item; +} + +QStandardItem *stringItem(const QString &value, bool editable = true, bool selectable = true) +{ + auto *item = new QStandardItem(value); + item->setFlags((Qt::ItemFlags)(Qt::ItemIsEnabled | (selectable ? Qt::ItemIsSelectable : 0) | + (editable ? (Qt::ItemIsEditable) : 0))); + return item; +} + +QStandardItem *emptyItem() +{ + auto *item = new QStandardItem(); + item->setFlags((Qt::ItemFlags)0); + return item; +} + +} // namespace util +} // namespace chatterino diff --git a/src/widgets/settingsdialog.cpp b/src/widgets/settingsdialog.cpp index 491b38713..b34664a09 100644 --- a/src/widgets/settingsdialog.cpp +++ b/src/widgets/settingsdialog.cpp @@ -77,23 +77,23 @@ void SettingsDialog::addTabs() this->addTab(new settingspages::AccountsPage); - this->ui.tabContainer->addStretch(1); + this->ui.tabContainer->addSpacing(16); this->addTab(new settingspages::AppearancePage); this->addTab(new settingspages::BehaviourPage); - this->ui.tabContainer->addStretch(1); + this->ui.tabContainer->addSpacing(16); this->addTab(new settingspages::CommandPage); // this->addTab(new settingspages::EmotesPage); this->addTab(new settingspages::HighlightingPage); - - this->ui.tabContainer->addStretch(1); - - this->addTab(new settingspages::IgnoreMessagesPage); + // this->addTab(new settingspages::IgnoreMessagesPage); this->addTab(new settingspages::IgnoreUsersPage); - this->addTab(new settingspages::KeyboardSettingsPage); - this->addTab(new settingspages::LogsPage); + + this->ui.tabContainer->addSpacing(16); + + // this->addTab(new settingspages::KeyboardSettingsPage); + // this->addTab(new settingspages::LogsPage); this->addTab(new settingspages::ModerationPage); // this->addTab(new settingspages::SpecialChannelsPage); this->addTab(new settingspages::ExternalToolsPage); diff --git a/src/widgets/settingspages/commandpage.cpp b/src/widgets/settingspages/commandpage.cpp index 5355ab848..ff18bd4b6 100644 --- a/src/widgets/settingspages/commandpage.cpp +++ b/src/widgets/settingspages/commandpage.cpp @@ -19,7 +19,7 @@ namespace widgets { namespace settingspages { CommandPage::CommandPage() - : SettingsPage("Macros", ":/images/commands.svg") + : SettingsPage("Commands", ":/images/commands.svg") { util::LayoutCreator layoutCreator(this); auto layout = layoutCreator.emplace().withoutMargin(); diff --git a/src/widgets/settingspages/externaltoolspage.cpp b/src/widgets/settingspages/externaltoolspage.cpp index 475f4ff13..e131565a1 100644 --- a/src/widgets/settingspages/externaltoolspage.cpp +++ b/src/widgets/settingspages/externaltoolspage.cpp @@ -15,7 +15,7 @@ ExternalToolsPage::ExternalToolsPage() { singletons::SettingManager &settings = singletons::SettingManager::getInstance(); util::LayoutCreator layoutCreator(this); - auto layout = layoutCreator.setLayoutType().withoutMargin(); + auto layout = layoutCreator.setLayoutType(); { auto group = layout.emplace("Streamlink"); @@ -25,6 +25,8 @@ ExternalToolsPage::ExternalToolsPage() this->createComboBox({STREAMLINK_QUALITY}, settings.preferredQuality)); groupLayout->addRow("Additional options:", this->createLineEdit(settings.streamlinkOpts)); } + + layout->addStretch(1); } } // namespace settingspages diff --git a/src/widgets/settingspages/highlightingpage.cpp b/src/widgets/settingspages/highlightingpage.cpp index 184a3f2fc..fd4ea856c 100644 --- a/src/widgets/settingspages/highlightingpage.cpp +++ b/src/widgets/settingspages/highlightingpage.cpp @@ -11,6 +11,7 @@ #include "debug/log.hpp" #include "singletons/settingsmanager.hpp" #include "util/layoutcreator.hpp" +#include "util/standarditemhelper.hpp" #define ENABLE_HIGHLIGHTS "Enable Highlighting" #define HIGHLIGHT_MSG "Highlight messages containing your name" @@ -32,23 +33,6 @@ HighlightingPage::HighlightingPage() { // GENERAL layout.append(this->createCheckBox(ENABLE_HIGHLIGHTS, settings.enableHighlights)); - layout.append(this->createCheckBox(HIGHLIGHT_MSG, settings.enableHighlightsSelf)); - layout.append(this->createCheckBox(PLAY_SOUND, settings.enableHighlightSound)); - layout.append(this->createCheckBox(FLASH_TASKBAR, settings.enableHighlightTaskbar)); - - auto customSound = layout.emplace().withoutMargin(); - { - customSound.append(this->createCheckBox("Custom sound", settings.customHighlightSound)); - auto selectFile = customSound.emplace("Select custom sound file"); - QObject::connect(selectFile.getElement(), &QPushButton::clicked, this, - [&settings, this] { - auto fileName = QFileDialog::getOpenFileName( - this, tr("Open Sound"), "", tr("Audio Files (*.mp3 *.wav)")); - settings.pathHighlightSound = fileName; - }); - } - - layout.append(createCheckBox(ALWAYS_PLAY, settings.highlightAlwaysPlaySound)); // TABS auto tabs = layout.emplace(); @@ -58,29 +42,35 @@ HighlightingPage::HighlightingPage() { QTableView *view = *highlights.emplace(); auto *model = new QStandardItemModel(0, 4, view); - // model->setTitles({"Pattern", "Flash taskbar", "Play sound", "Regex"}); + model->setHeaderData(0, Qt::Horizontal, "Pattern"); + model->setHeaderData(1, Qt::Horizontal, "Flash taskbar"); + model->setHeaderData(2, Qt::Horizontal, "Play sound"); + model->setHeaderData(3, Qt::Horizontal, "Regex"); + view->setModel(model); + view->setSelectionMode(QAbstractItemView::ExtendedSelection); + view->setSelectionBehavior(QAbstractItemView::SelectRows); + view->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); + // own name + auto *yourName = util::stringItem("Your name (automatic)", false, false); + yourName->setData(QBrush("#666"), Qt::ForegroundRole); + yourName->setFlags(yourName->flags() | Qt::ItemIsUserCheckable | + Qt::ItemIsUserCheckable); + yourName->setData(settings.enableHighlightsSelf ? 2 : 0, Qt::CheckStateRole); + model->appendRow( + {yourName, + util::boolItem(settings.enableHighlightTaskbar.getValue(), true, false), + util::boolItem(settings.enableHighlightSound.getValue(), true, false), + util::emptyItem()}); + + // highlight phrases // fourtf: could crash for (const messages::HighlightPhrase &phrase : settings.highlightProperties.getValue()) { - auto *item1 = new QStandardItem(phrase.key); - auto *item2 = new QStandardItem(); - item2->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); - item2->setData(phrase.alert, Qt::CheckStateRole); - auto *item3 = new QStandardItem(); - item3->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); - item3->setData(phrase.sound, Qt::CheckStateRole); - auto *item4 = new QStandardItem(); - item4->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); - item4->setData(phrase.regex, Qt::CheckStateRole); - model->appendRow({item1, item2, item3, item4}); + model->appendRow({util::stringItem(phrase.key), util::boolItem(phrase.alert), + util::boolItem(phrase.sound), util::boolItem(phrase.regex)}); } - view->setModel(model); - view->setSelectionMode(QAbstractItemView::SingleSelection); - view->setSelectionBehavior(QAbstractItemView::SelectRows); - view->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); - // fourtf: make class extrend BaseWidget and add this to dpiChanged QTimer::singleShot(1, [view] { view->resizeColumnsToContents(); @@ -89,40 +79,51 @@ HighlightingPage::HighlightingPage() auto buttons = highlights.emplace(); - QObject::connect( - model, &QStandardItemModel::dataChanged, - [model](const QModelIndex &topLeft, const QModelIndex &bottomRight, - const QVector &roles) { - std::vector phrases; - for (int i = 0; i < model->rowCount(); i++) { - phrases.push_back(messages::HighlightPhrase{ - model->item(i, 0)->data(Qt::DisplayRole).toString(), - model->item(i, 1)->data(Qt::CheckStateRole).toBool(), - model->item(i, 2)->data(Qt::CheckStateRole).toBool(), - model->item(i, 3)->data(Qt::CheckStateRole).toBool()}); - } - singletons::SettingManager::getInstance().highlightProperties.setValue( - phrases); - }); + QObject::connect(model, &QStandardItemModel::dataChanged, + [model](const QModelIndex &topLeft, const QModelIndex &bottomRight, + const QVector &roles) { + std::vector phrases; + for (int i = 1; i < model->rowCount(); i++) { + phrases.push_back(messages::HighlightPhrase{ + model->item(i, 0)->data(Qt::DisplayRole).toString(), + model->item(i, 1)->data(Qt::CheckStateRole).toBool(), + model->item(i, 2)->data(Qt::CheckStateRole).toBool(), + model->item(i, 3)->data(Qt::CheckStateRole).toBool()}); + } + auto &settings = singletons::SettingManager::getInstance(); + settings.highlightProperties.setValue(phrases); + settings.enableHighlightsSelf.setValue( + model->item(0, 0)->data(Qt::CheckStateRole).toBool()); + settings.enableHighlightTaskbar.setValue( + model->item(0, 1)->data(Qt::CheckStateRole).toBool()); + settings.enableHighlightSound.setValue( + model->item(0, 2)->data(Qt::CheckStateRole).toBool()); + }); auto add = buttons.emplace("Add"); - QObject::connect(*add, &QPushButton::clicked, [model] { - auto *item1 = new QStandardItem(); - auto *item2 = new QStandardItem(); - item2->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); - item2->setData(true, Qt::CheckStateRole); - auto *item3 = new QStandardItem(); - item3->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); - item3->setData(true, Qt::CheckStateRole); - auto *item4 = new QStandardItem(); - item4->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); - item4->setData(false, Qt::CheckStateRole); - model->appendRow({item1, item2, item3, item4}); + QObject::connect(*add, &QPushButton::clicked, [model, view] { + model->appendRow({util::stringItem(""), + util::boolItem(model->item(model->rowCount() - 1, 1) + ->data(Qt::CheckStateRole) + .toBool()), + util::boolItem(model->item(model->rowCount() - 1, 2) + ->data(Qt::CheckStateRole) + .toBool()), + util::boolItem(false)}); + view->scrollToBottom(); }); auto remove = buttons.emplace("Remove"); QObject::connect(*remove, &QPushButton::clicked, [view, model] { - if (view->selectionModel()->hasSelection()) { - model->removeRow(view->selectionModel()->selectedRows()[0].row()); + std::vector indices; + + for (const QModelIndex &index : view->selectionModel()->selectedRows(0)) { + indices.push_back(index.row()); + } + + std::sort(indices.begin(), indices.end()); + + for (int i = indices.size() - 1; i >= 0; i--) { + model->removeRow(indices[i]); } }); @@ -148,6 +149,21 @@ HighlightingPage::HighlightingPage() }); } } + + // MISC + auto customSound = layout.emplace().withoutMargin(); + { + customSound.append(this->createCheckBox("Custom sound", settings.customHighlightSound)); + auto selectFile = customSound.emplace("Select custom sound file"); + QObject::connect(selectFile.getElement(), &QPushButton::clicked, this, + [&settings, this] { + auto fileName = QFileDialog::getOpenFileName( + this, tr("Open Sound"), "", tr("Audio Files (*.mp3 *.wav)")); + settings.pathHighlightSound = fileName; + }); + } + + layout.append(createCheckBox(ALWAYS_PLAY, settings.highlightAlwaysPlaySound)); } // ---- misc diff --git a/src/widgets/settingspages/ignoreuserspage.cpp b/src/widgets/settingspages/ignoreuserspage.cpp index 4ad63d7a1..1c81d4a5c 100644 --- a/src/widgets/settingspages/ignoreuserspage.cpp +++ b/src/widgets/settingspages/ignoreuserspage.cpp @@ -11,7 +11,7 @@ #include // clang-format off -#define INFO "/ignore in chat ignores a user\n/unignore in chat unignores a user\n\nChatterino uses the twitch api for ignored users so they are shared with the webchat.\nIf you use your own oauth key make sure that it has the correct permissions.\n" +#define INFO "/ignore in chat ignores a user\n/unignore in chat unignores a user" // clang-format on namespace chatterino { @@ -19,16 +19,12 @@ namespace widgets { namespace settingspages { IgnoreUsersPage::IgnoreUsersPage() - : SettingsPage("Ignore Users", "") + : SettingsPage("Ignores", "") { singletons::SettingManager &settings = singletons::SettingManager::getInstance(); util::LayoutCreator layoutCreator(this); auto layout = layoutCreator.setLayoutType(); - auto label = layout.emplace(INFO); - label->setWordWrap(true); - label->setStyleSheet("color: #BBB"); - auto group = layout.emplace("Ignored users").setLayoutType(); { group.append( @@ -53,6 +49,10 @@ IgnoreUsersPage::IgnoreUsersPage() auto userList = group.emplace(); UNUSED(userList); // TODO: Fill this list in with ignored users } + + auto label = layout.emplace(INFO); + label->setWordWrap(true); + label->setStyleSheet("color: #BBB"); } } // namespace settingspages diff --git a/src/widgets/settingspages/moderationpage.cpp b/src/widgets/settingspages/moderationpage.cpp index 5106d95ab..a1587c35b 100644 --- a/src/widgets/settingspages/moderationpage.cpp +++ b/src/widgets/settingspages/moderationpage.cpp @@ -8,20 +8,47 @@ #include #include +#include "singletons/pathmanager.hpp" #include "util/layoutcreator.hpp" namespace chatterino { namespace widgets { namespace settingspages { +inline QString CreateLink(const QString &url, bool file = false) +{ + if (file) { + return QString("" + url + + ""); + } + + return QString("" + url + ""); +} + ModerationPage::ModerationPage() : SettingsPage("Moderation", "") { singletons::SettingManager &settings = singletons::SettingManager::getInstance(); + singletons::PathManager &pathManager = singletons::PathManager::getInstance(); util::LayoutCreator layoutCreator(this); auto layout = layoutCreator.setLayoutType(); { + // Logs (copied from LoggingMananger) + auto logPath = pathManager.logsFolderPath; + + auto created = layout.emplace(); + created->setText("Logs are saved to " + CreateLink(logPath, true)); + created->setTextFormat(Qt::RichText); + created->setTextInteractionFlags(Qt::TextBrowserInteraction | + Qt::LinksAccessibleByKeyboard | + Qt::LinksAccessibleByKeyboard); + created->setOpenExternalLinks(true); + layout.append(this->createCheckBox("Enable logging", settings.enableLogging)); + + layout->addStretch(1); + // Logs end + // clang-format off auto label = layout.emplace("Click the moderation mod button () in a channel that you moderate to enable moderator mode.
"); label->setWordWrap(true);