From ea7fcf260c06d06c5734238d2b708feecf9ee21d Mon Sep 17 00:00:00 2001 From: fourtf Date: Thu, 26 Apr 2018 20:58:32 +0200 Subject: [PATCH] fixed issues for gcc --- chatterino.pro | 742 +++++++++--------- src/singletons/nativemessagingmanager.cpp | 4 + src/util/tupletablemodel.cpp | 7 - src/util/tupletablemodel.hpp | 211 ----- src/widgets/attachedwindow.cpp | 4 + .../settingspages/highlightingpage.cpp | 58 +- 6 files changed, 420 insertions(+), 606 deletions(-) delete mode 100644 src/util/tupletablemodel.cpp delete mode 100644 src/util/tupletablemodel.hpp diff --git a/chatterino.pro b/chatterino.pro index 9cb48cafb..c95964c26 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -1,372 +1,370 @@ -#------------------------------------------------- -# -# 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/util/tupletablemodel.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/util/tupletablemodel.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 + +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/singletons/nativemessagingmanager.cpp b/src/singletons/nativemessagingmanager.cpp index c0e0dbdd9..aaca038e9 100644 --- a/src/singletons/nativemessagingmanager.cpp +++ b/src/singletons/nativemessagingmanager.cpp @@ -161,10 +161,12 @@ void NativeMessagingManager::ReceiverThread::handleMessage(const QJsonObject &ro ts.watchingChannel.update(ts.getOrAddChannel(name)); if (attach) { +#ifdef USEWINSDK auto *window = widgets::AttachedWindow::get(::GetForegroundWindow(), winId, yOffset); window->setChannel(ts.getOrAddChannel(name)); window->show(); +#endif } }); @@ -179,7 +181,9 @@ void NativeMessagingManager::ReceiverThread::handleMessage(const QJsonObject &ro return; } +#ifdef USEWINSDK util::postToThread([winId] { widgets::AttachedWindow::detach(winId); }); +#endif } else { qDebug() << "NM unknown action " + action; } diff --git a/src/util/tupletablemodel.cpp b/src/util/tupletablemodel.cpp deleted file mode 100644 index ee804e5c1..000000000 --- a/src/util/tupletablemodel.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "tupletablemodel.hpp" - -namespace chatterino { -namespace util { - -} // namespace util -} // namespace chatterino diff --git a/src/util/tupletablemodel.hpp b/src/util/tupletablemodel.hpp deleted file mode 100644 index 5b7dd2906..000000000 --- a/src/util/tupletablemodel.hpp +++ /dev/null @@ -1,211 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include - -namespace chatterino { -namespace util { - -namespace { - -template -struct TupleConverter { - template - static void tupleToVariants(const std::tuple &t, std::vector &row) - { - row[I - 1] = QVariant(std::get(t)); - TupleConverter::tupleToVariants(t, row); - } - - template - static void variantsToTuple(std::vector &row, std::tuple &t) - { - std::get(t) = (decltype(std::get(t))) row[I - 1]; - TupleConverter::variantsToTuple(row, t); - } -}; - -template <> -struct TupleConverter<0> { - template - static void tupleToVariants(const std::tuple &t, std::vector &row) - { - } - - template - static void variantsToTuple(std::vector &row, std::tuple &t) - { - } -}; - -} // namespace - -template -class TupleTableModel : public QAbstractTableModel -{ - std::vector> rows; - std::vector> titleData; - -public: - pajlada::Signals::NoArgSignal itemsChanged; - - TupleTableModel() - { - titleData.resize(sizeof...(Args)); - } - - void addRow(const std::tuple &row) - { - this->beginInsertRows(QModelIndex(), this->rows.size(), this->rows.size()); - std::vector variants; - variants.resize(sizeof...(Args)); - TupleConverter::tupleToVariants(row, variants); - this->rows.push_back(variants); - this->endInsertRows(); - this->itemsChanged.invoke(); - } - - void addRow(Args... args) - { - this->beginInsertRows(QModelIndex(), this->rows.size(), this->rows.size()); - std::vector variants; - variants.resize(sizeof...(Args)); - TupleConverter::tupleToVariants(std::tuple(args...), - variants); - this->rows.push_back(variants); - this->endInsertRows(); - this->itemsChanged.invoke(); - } - - std::tuple getRow(int index) - { - std::tuple row; - TupleConverter::variantsToTuple(this->rows[index], row); - return row; - } - - void removeRow(int index) - { - this->beginRemoveRows(QModelIndex(), index, index); - this->rows.erase(this->rows.begin() + index); - this->endRemoveRows(); - this->itemsChanged.invoke(); - } - - void setTitles(std::initializer_list titles) - { - int i = 0; - - for (const QString &title : titles) { - this->setHeaderData(i++, Qt::Horizontal, title, Qt::DisplayRole); - - if (i >= sizeof...(Args)) - break; - } - } - - int getRowCount() const - { - return this->rows.size(); - } - -protected: - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override - { - return this->rows.size(); - } - - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override - { - return sizeof...(Args); - } - - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override - { - QVariant data = this->rows[index.row()][index.column()]; - - switch (role) { - case Qt::DisplayRole: { - if (data.type() == QVariant::Bool) - return QVariant(); - else - return data; - } break; - case Qt::EditRole: { - return data; - } break; - case Qt::CheckStateRole: { - if (data.type() == QVariant::Bool) - return data; - else - return QVariant(); - } break; - } - return QVariant(); - } - - virtual bool setData(const QModelIndex &index, const QVariant &value, - int role = Qt::EditRole) override - { - QVariant data = this->rows[index.row()][index.column()]; - - switch (role) { - case (Qt::EditRole): { - this->rows[index.row()][index.column()] = value; - this->itemsChanged.invoke(); - return true; - } break; - case (Qt::CheckStateRole): { - if (data.type() == QVariant::Bool) { - this->rows[index.row()][index.column()] = !data.toBool(); - this->itemsChanged.invoke(); - return true; - } - } break; - } - - return false; - } - - virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const - { - if (orientation != Qt::Horizontal) - return QVariant(); - if (section < 0 || section >= sizeof...(Args)) - return QVariant(); - - auto it = this->titleData[section].find(role); - return it == this->titleData[section].end() ? QVariant() : it.value(); - } - - virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, - int role) - { - if (orientation != Qt::Horizontal) - return false; - if (section < 0 || section >= sizeof...(Args)) - return false; - - this->titleData[section][role] = value; - return true; - } - - virtual Qt::ItemFlags flags(const QModelIndex &index) const - { - QVariant data = this->rows[index.row()][index.column()]; - - if (data.type() == QVariant::Bool) { - return Qt::ItemIsUserCheckable | Qt::ItemIsEditable | Qt::ItemIsEnabled | - Qt::ItemIsSelectable; - } - - return Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable; - } -}; - -} // namespace util -} // namespace chatterino diff --git a/src/widgets/attachedwindow.cpp b/src/widgets/attachedwindow.cpp index d6c0110fb..a2f3f76f3 100644 --- a/src/widgets/attachedwindow.cpp +++ b/src/widgets/attachedwindow.cpp @@ -5,8 +5,10 @@ #include "widgets/split.hpp" +#ifdef USEWINSDK #include "Windows.h" #pragma comment(lib, "Dwmapi.lib") +#endif namespace chatterino { namespace widgets { @@ -70,6 +72,7 @@ void AttachedWindow::showEvent(QShowEvent *) void AttachedWindow::attachToHwnd(void *_hwnd) { +#ifdef USEWINSDK QTimer *timer = new QTimer(this); timer->setInterval(1); @@ -96,6 +99,7 @@ void AttachedWindow::attachToHwnd(void *_hwnd) // false); }); timer->start(); +#endif } // void AttachedWindow::nativeEvent(const QByteArray &eventType, void *message, long *result) diff --git a/src/widgets/settingspages/highlightingpage.cpp b/src/widgets/settingspages/highlightingpage.cpp index 9bc366126..184a3f2fc 100644 --- a/src/widgets/settingspages/highlightingpage.cpp +++ b/src/widgets/settingspages/highlightingpage.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -10,7 +11,6 @@ #include "debug/log.hpp" #include "singletons/settingsmanager.hpp" #include "util/layoutcreator.hpp" -#include "util/tupletablemodel.hpp" #define ENABLE_HIGHLIGHTS "Enable Highlighting" #define HIGHLIGHT_MSG "Highlight messages containing your name" @@ -57,13 +57,23 @@ HighlightingPage::HighlightingPage() auto highlights = tabs.appendTab(new QVBoxLayout, "Highlights"); { QTableView *view = *highlights.emplace(); - auto *model = new util::TupleTableModel; - model->setTitles({"Pattern", "Flash taskbar", "Play sound", "Regex"}); + auto *model = new QStandardItemModel(0, 4, view); + // model->setTitles({"Pattern", "Flash taskbar", "Play sound", "Regex"}); // fourtf: could crash for (const messages::HighlightPhrase &phrase : settings.highlightProperties.getValue()) { - model->addRow(phrase.key, phrase.alert, phrase.sound, phrase.regex); + 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}); } view->setModel(model); @@ -79,20 +89,36 @@ HighlightingPage::HighlightingPage() auto buttons = highlights.emplace(); - model->itemsChanged.connect([model] { - std::vector phrases; - for (int i = 0; i < model->getRowCount(); i++) { - auto t = model->getRow(i); - phrases.push_back(messages::HighlightPhrase{ - std::get<0>(t), std::get<1>(t), std::get<2>(t), std::get<3>(t), - }); - } - 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 = 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); + }); auto add = buttons.emplace("Add"); - QObject::connect(*add, &QPushButton::clicked, - [model] { model->addRow("", true, false, false); }); + 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}); + }); auto remove = buttons.emplace("Remove"); QObject::connect(*remove, &QPushButton::clicked, [view, model] { if (view->selectionModel()->hasSelection()) {