removed the old user info popup

This commit is contained in:
fourtf 2018-06-06 16:29:35 +02:00
parent 7a515355e4
commit 00fb25d9a7
8 changed files with 447 additions and 1333 deletions

View file

@ -1,439 +1,436 @@
#-------------------------------------------------
#
# 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
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")
}
# 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/providers/twitch/pubsub.cpp \
src/providers/twitch/twitchemotes.cpp \
src/providers/bttv/bttvemotes.cpp \
src/providers/ffz/ffzemotes.cpp \
src/providers/emoji/emojis.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/helper/giftimer.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/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/util/rapidjson-helpers.cpp \
src/providers/twitch/pubsubhelpers.cpp \
src/providers/twitch/pubsubactions.cpp \
src/providers/twitch/twitchuser.cpp \
src/widgets/selectchanneldialog.cpp \
src/singletons/updatemanager.cpp \
src/widgets/lastruncrashdialog.cpp \
src/widgets/attachedwindow.cpp \
src/widgets/settingspages/externaltoolspage.cpp \
src/widgets/helper/comboboxitemdelegate.cpp \
src/controllers/commands/command.cpp \
src/controllers/commands/commandmodel.cpp \
src/controllers/commands/commandcontroller.cpp \
src/controllers/highlights/highlightcontroller.cpp \
src/controllers/highlights/highlightmodel.cpp \
src/controllers/ignores/ignorecontroller.cpp \
src/controllers/ignores/ignoremodel.cpp \
src/widgets/helper/editablemodelview.cpp \
src/controllers/accounts/accountcontroller.cpp \
src/controllers/accounts/accountmodel.cpp \
src/controllers/accounts/account.cpp \
src/widgets/helper/splitoverlay.cpp \
src/widgets/helper/dropoverlay.cpp \
src/widgets/helper/splitnode.cpp \
src/widgets/notificationpopup.cpp \
src/controllers/taggedusers/taggeduserscontroller.cpp \
src/controllers/taggedusers/taggeduser.cpp \
src/controllers/taggedusers/taggedusersmodel.cpp \
src/util/emotemap.cpp \
src/providers/irc/ircconnection2.cpp \
src/widgets/userinfopopup.cpp
HEADERS += \
src/precompiled_header.hpp \
src/channel.hpp \
src/const.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/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/providers/twitch/pubsub.hpp \
src/providers/twitch/twitchemotes.hpp \
src/providers/bttv/bttvemotes.hpp \
src/providers/ffz/ffzemotes.hpp \
src/providers/emoji/emojis.hpp \
src/singletons/emotemanager.hpp \
src/singletons/fontmanager.hpp \
src/singletons/helper/chatterinosetting.hpp \
src/singletons/helper/giftimer.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/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/util/rapidjson-helpers.hpp \
src/providers/twitch/pubsubhelpers.hpp \
src/providers/twitch/pubsubactions.hpp \
src/providers/twitch/twitchuser.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/standarditemhelper.hpp \
src/widgets/helper/comboboxitemdelegate.hpp \
src/util/assertinguithread.hpp \
src/util/signalvector2.hpp \
src/util/signalvectormodel.hpp \
src/controllers/commands/command.hpp \
src/controllers/commands/commandmodel.hpp \
src/controllers/commands/commandcontroller.hpp \
src/controllers/highlights/highlightcontroller.hpp \
src/controllers/highlights/highlightphrase.hpp \
src/controllers/highlights/highlightmodel.hpp \
src/controllers/ignores/ignorecontroller.hpp \
src/controllers/ignores/ignorephrase.hpp \
src/controllers/ignores/ignoremodel.hpp \
src/widgets/helper/editablemodelview.hpp \
src/controllers/accounts/accountcontroller.hpp \
src/controllers/accounts/accountmodel.hpp \
src/controllers/accounts/account.hpp \
src/util/sharedptrelementless.hpp \
src/widgets/helper/splitoverlay.hpp \
src/widgets/helper/dropoverlay.hpp \
src/widgets/helper/splitnode.hpp \
src/widgets/notificationpopup.hpp \
src/controllers/taggedusers/taggeduserscontroller.hpp \
src/controllers/taggedusers/taggeduser.hpp \
src/providerid.hpp \
src/controllers/taggedusers/taggedusersmodel.hpp \
src/util/qstringhash.hpp \
src/util/mutexvalue.hpp \
src/providers/irc/ircconnection2.hpp \
src/widgets/helper/line.hpp \
src/widgets/userinfopopup.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
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
equals(QMAKE_CXX, "clang++") {
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedef
} 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/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
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")
}
# 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/providers/twitch/pubsub.cpp \
src/providers/twitch/twitchemotes.cpp \
src/providers/bttv/bttvemotes.cpp \
src/providers/ffz/ffzemotes.cpp \
src/providers/emoji/emojis.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/helper/giftimer.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/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/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/util/rapidjson-helpers.cpp \
src/providers/twitch/pubsubhelpers.cpp \
src/providers/twitch/pubsubactions.cpp \
src/providers/twitch/twitchuser.cpp \
src/widgets/selectchanneldialog.cpp \
src/singletons/updatemanager.cpp \
src/widgets/lastruncrashdialog.cpp \
src/widgets/attachedwindow.cpp \
src/widgets/settingspages/externaltoolspage.cpp \
src/widgets/helper/comboboxitemdelegate.cpp \
src/controllers/commands/command.cpp \
src/controllers/commands/commandmodel.cpp \
src/controllers/commands/commandcontroller.cpp \
src/controllers/highlights/highlightcontroller.cpp \
src/controllers/highlights/highlightmodel.cpp \
src/controllers/ignores/ignorecontroller.cpp \
src/controllers/ignores/ignoremodel.cpp \
src/widgets/helper/editablemodelview.cpp \
src/controllers/accounts/accountcontroller.cpp \
src/controllers/accounts/accountmodel.cpp \
src/controllers/accounts/account.cpp \
src/widgets/helper/splitoverlay.cpp \
src/widgets/helper/dropoverlay.cpp \
src/widgets/helper/splitnode.cpp \
src/widgets/notificationpopup.cpp \
src/controllers/taggedusers/taggeduserscontroller.cpp \
src/controllers/taggedusers/taggeduser.cpp \
src/controllers/taggedusers/taggedusersmodel.cpp \
src/util/emotemap.cpp \
src/providers/irc/ircconnection2.cpp \
src/widgets/userinfopopup.cpp
HEADERS += \
src/precompiled_header.hpp \
src/channel.hpp \
src/const.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/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/providers/twitch/pubsub.hpp \
src/providers/twitch/twitchemotes.hpp \
src/providers/bttv/bttvemotes.hpp \
src/providers/ffz/ffzemotes.hpp \
src/providers/emoji/emojis.hpp \
src/singletons/emotemanager.hpp \
src/singletons/fontmanager.hpp \
src/singletons/helper/chatterinosetting.hpp \
src/singletons/helper/giftimer.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/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/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/util/rapidjson-helpers.hpp \
src/providers/twitch/pubsubhelpers.hpp \
src/providers/twitch/pubsubactions.hpp \
src/providers/twitch/twitchuser.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/standarditemhelper.hpp \
src/widgets/helper/comboboxitemdelegate.hpp \
src/util/assertinguithread.hpp \
src/util/signalvector2.hpp \
src/util/signalvectormodel.hpp \
src/controllers/commands/command.hpp \
src/controllers/commands/commandmodel.hpp \
src/controllers/commands/commandcontroller.hpp \
src/controllers/highlights/highlightcontroller.hpp \
src/controllers/highlights/highlightphrase.hpp \
src/controllers/highlights/highlightmodel.hpp \
src/controllers/ignores/ignorecontroller.hpp \
src/controllers/ignores/ignorephrase.hpp \
src/controllers/ignores/ignoremodel.hpp \
src/widgets/helper/editablemodelview.hpp \
src/controllers/accounts/accountcontroller.hpp \
src/controllers/accounts/accountmodel.hpp \
src/controllers/accounts/account.hpp \
src/util/sharedptrelementless.hpp \
src/widgets/helper/splitoverlay.hpp \
src/widgets/helper/dropoverlay.hpp \
src/widgets/helper/splitnode.hpp \
src/widgets/notificationpopup.hpp \
src/controllers/taggedusers/taggeduserscontroller.hpp \
src/controllers/taggedusers/taggeduser.hpp \
src/providerid.hpp \
src/controllers/taggedusers/taggedusersmodel.hpp \
src/util/qstringhash.hpp \
src/util/mutexvalue.hpp \
src/providers/irc/ircconnection2.hpp \
src/widgets/helper/line.hpp \
src/widgets/userinfopopup.hpp
RESOURCES += \
resources/resources.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
equals(QMAKE_CXX, "clang++") {
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedef
} 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
}

View file

@ -1,337 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AccountPopup</class>
<widget class="QWidget" name="AccountPopup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>469</width>
<height>301</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>AccountPopup</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="3">
<widget class="QLabel" name="lblAvatar">
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="text">
<string>Loading...</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lblUsername">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnClose">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1" rowspan="2" colspan="2">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Views:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lblViews">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Followers:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lblFollowers">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Created at:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="lblAccountAge">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QWidget" name="profileLayout" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="copy">
<property name="maximumSize">
<size>
<width>25</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Copy Username</string>
</property>
<property name="styleSheet">
<string notr="true">qproperty-icon: url(:/images/CopyLongTextToClipboard_16x.png)</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="profile">
<property name="text">
<string>Profile</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QWidget" name="userLayout" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="follow">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Follow</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="ignore">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Ignore</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="disableHighlights">
<property name="text">
<string>Disable Highlights</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="enableHighlights">
<property name="text">
<string>Enable Highlights</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="sendMessage">
<property name="text">
<string>Message</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0" colspan="3">
<widget class="QWidget" name="modLayout" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="1">
<widget class="QPushButton" name="ban">
<property name="text">
<string>Ban</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="purge">
<property name="text">
<string>Purge</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="unBan">
<property name="text">
<string>Unban</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="min10">
<property name="text">
<string>10 Mins</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="hour24">
<property name="text">
<string>24 Hours</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="min1">
<property name="text">
<string>1 Min</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="hour1">
<property name="text">
<string>1 Hour</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QWidget" name="ownerLayout" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="mod">
<property name="text">
<string>Mod</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="unMod">
<property name="text">
<string>Unmod</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View file

@ -1,409 +0,0 @@
#include "widgets/accountpopup.hpp"
#include "application.hpp"
#include "channel.hpp"
#include "credentials.hpp"
#include "singletons/settingsmanager.hpp"
#include "ui_accountpopupform.h"
#include "util/urlfetch.hpp"
#include <QClipboard>
#include <QDesktopServices>
#include <QJsonArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QPixmap>
namespace chatterino {
namespace widgets {
AccountPopupWidget::AccountPopupWidget(ChannelPtr _channel)
: BaseWindow()
, ui(new Ui::AccountPopup)
, channel(_channel)
{
auto app = getApp();
this->ui->setupUi(this);
this->setStayInScreenRect(true);
this->layout()->setSizeConstraint(QLayout::SetFixedSize);
this->setWindowFlags(Qt::FramelessWindowHint);
this->resize(0, 0);
connect(this, &AccountPopupWidget::refreshButtons, this,
&AccountPopupWidget::actuallyRefreshButtons, Qt::QueuedConnection);
app->accounts->twitch.currentUserChanged.connect([this] {
auto currentTwitchUser = getApp()->accounts->twitch.getCurrent();
if (!currentTwitchUser) {
// No twitch user set (should never happen)
return;
}
this->loggedInUser.username = currentTwitchUser->getUserName();
this->loggedInUser.userID = currentTwitchUser->getUserId();
this->loggedInUser.refreshUserType(this->channel, true);
});
for (auto button : this->ui->profileLayout->findChildren<QPushButton *>()) {
button->setFocusProxy(this);
}
for (auto button : this->ui->userLayout->findChildren<QPushButton *>()) {
button->setFocusProxy(this);
}
for (auto button : this->ui->modLayout->findChildren<QPushButton *>()) {
button->setFocusProxy(this);
}
for (auto button : this->ui->ownerLayout->findChildren<QPushButton *>()) {
button->setFocusProxy(this);
}
this->timeout(this->ui->purge, 1);
this->timeout(this->ui->min1, 60);
this->timeout(this->ui->min10, 600);
this->timeout(this->ui->hour1, 3600);
this->timeout(this->ui->hour24, 86400);
this->sendCommand(this->ui->ban, "/ban ");
this->sendCommand(this->ui->unBan, "/unban ");
this->sendCommand(this->ui->mod, "/mod ");
this->sendCommand(this->ui->unMod, "/unmod ");
QObject::connect(this->ui->profile, &QPushButton::clicked, this, [=]() {
QDesktopServices::openUrl(QUrl("https://twitch.tv/" + this->popupWidgetUser.username));
});
QObject::connect(this->ui->sendMessage, &QPushButton::clicked, this, [=]() {
QDesktopServices::openUrl(
QUrl("https://www.twitch.tv/message/compose?to=" + this->ui->lblUsername->text()));
});
QObject::connect(this->ui->copy, &QPushButton::clicked, this,
[=]() { QApplication::clipboard()->setText(this->ui->lblUsername->text()); });
QObject::connect(this->ui->follow, &QPushButton::clicked, this, [=]() {
debug::Log("Attempt to toggle follow user {}({}) as user {}({})",
this->popupWidgetUser.username, this->popupWidgetUser.userID,
this->loggedInUser.username, this->loggedInUser.userID);
QUrl requestUrl("https://api.twitch.tv/kraken/users/" + this->loggedInUser.userID +
"/follows/channels/" + this->popupWidgetUser.userID);
this->ui->follow->setEnabled(false);
if (!this->relationship.isFollowing()) {
util::twitch::put(requestUrl, [this](QJsonObject obj) {
qDebug() << "follows channel: " << obj;
this->relationship.setFollowing(true);
emit refreshButtons();
});
} else {
util::twitch::sendDelete(requestUrl, [this] {
this->relationship.setFollowing(false);
emit refreshButtons();
});
}
});
QObject::connect(this->ui->ignore, &QPushButton::clicked, this, [=]() {
auto currentUser = getApp()->accounts->twitch.getCurrent();
if (!this->relationship.isIgnoring()) {
currentUser->ignoreByID(this->popupWidgetUser.userID, this->popupWidgetUser.username,
[=](auto result, const auto &message) {
switch (result) {
case IgnoreResult_Success: {
this->relationship.setIgnoring(true);
emit this->refreshButtons();
} break;
case IgnoreResult_AlreadyIgnored: {
this->relationship.setIgnoring(true);
emit this->refreshButtons();
} break;
case IgnoreResult_Failed: {
} break;
}
});
} else {
currentUser->unignoreByID(this->popupWidgetUser.userID, this->popupWidgetUser.username,
[=](auto result, const auto &message) {
switch (result) {
case UnignoreResult_Success: {
this->relationship.setIgnoring(false);
emit this->refreshButtons();
} break;
case UnignoreResult_Failed: {
} break;
}
});
}
});
QObject::connect(this->ui->disableHighlights, &QPushButton::clicked, this, [=]() {
QString str = app->settings->highlightUserBlacklist;
str.append(this->ui->lblUsername->text() + "\n");
app->settings->highlightUserBlacklist = str;
this->ui->disableHighlights->hide();
this->ui->enableHighlights->show();
});
QObject::connect(this->ui->enableHighlights, &QPushButton::clicked, this, [=]() {
QString str = app->settings->highlightUserBlacklist;
QStringList list = str.split("\n");
list.removeAll(this->ui->lblUsername->text());
app->settings->highlightUserBlacklist = list.join("\n");
this->ui->enableHighlights->hide();
this->ui->disableHighlights->show();
});
this->updateButtons(this->ui->userLayout, false);
this->updateButtons(this->ui->modLayout, false);
this->updateButtons(this->ui->ownerLayout, false);
// Close button
QObject::connect(this->ui->btnClose, &QPushButton::clicked, [this] {
this->hide(); //
});
this->scaleChangedEvent(this->getScale());
}
void AccountPopupWidget::setName(const QString &name)
{
this->relationship.reset();
this->popupWidgetUser.username = name;
this->ui->lblUsername->setText(name);
this->getUserId();
// Refresh popup widget users type
this->popupWidgetUser.refreshUserType(this->channel, false);
}
void AccountPopupWidget::User::refreshUserType(const ChannelPtr &channel, bool loggedInUser)
{
if (channel->name == this->username) {
this->userType = UserType::Owner;
} else if ((loggedInUser && channel->isMod()) || channel->modList.contains(this->username)) {
this->userType = UserType::Mod;
} else {
this->userType = UserType::User;
}
}
void AccountPopupWidget::setChannel(ChannelPtr _channel)
{
this->channel = _channel;
}
void AccountPopupWidget::getUserId()
{
util::twitch::getUserID(this->popupWidgetUser.username, this, [=](const QString &id) {
this->popupWidgetUser.userID = id;
this->getUserData();
});
}
void AccountPopupWidget::getUserData()
{
util::twitch::get(
"https://api.twitch.tv/kraken/channels/" + this->popupWidgetUser.userID, this,
[=](const QJsonObject &obj) {
this->ui->lblFollowers->setText(QString::number(obj.value("followers").toInt()));
this->ui->lblViews->setText(QString::number(obj.value("views").toInt()));
this->ui->lblAccountAge->setText(obj.value("created_at").toString().section("T", 0, 0));
this->loadAvatar(QUrl(obj.value("logo").toString()));
});
auto app = getApp();
auto currentUser = app->accounts->twitch.getCurrent();
currentUser->checkFollow(this->popupWidgetUser.userID, [=](auto result) {
this->relationship.setFollowing(result == FollowResult_Following);
emit this->refreshButtons();
});
bool isIgnoring = false;
for (const auto &ignoredUser : currentUser->getIgnores()) {
if (this->popupWidgetUser.userID == ignoredUser.id) {
isIgnoring = true;
break;
}
}
this->relationship.setIgnoring(isIgnoring);
emit refreshButtons();
}
void AccountPopupWidget::loadAvatar(const QUrl &avatarUrl)
{
if (!this->avatarMap.tryGet(this->popupWidgetUser.userID, this->avatar)) {
if (!avatarUrl.isEmpty()) {
QNetworkRequest req(avatarUrl);
static auto manager = new QNetworkAccessManager();
auto *reply = manager->get(req);
QObject::connect(reply, &QNetworkReply::finished, this, [=] {
if (reply->error() == QNetworkReply::NoError) {
const auto data = reply->readAll();
this->avatar.loadFromData(data);
this->avatarMap.insert(this->popupWidgetUser.userID, this->avatar);
this->ui->lblAvatar->setPixmap(this->avatar);
} else {
this->ui->lblAvatar->setText("ERROR");
}
});
} else {
this->ui->lblAvatar->setText("No Avatar");
}
} else {
this->ui->lblAvatar->setPixmap(this->avatar);
}
}
void AccountPopupWidget::scaleChangedEvent(float newDpi)
{
this->setStyleSheet(QString("* { font-size: <font-size>px; }")
.replace("<font-size>", QString::number(int(12 * newDpi))));
this->ui->lblAvatar->setFixedSize(int(100 * newDpi), int(100 * newDpi));
}
void AccountPopupWidget::updateButtons(QWidget *layout, bool state)
{
for (auto button : layout->findChildren<QPushButton *>()) {
button->setVisible(state);
}
}
void AccountPopupWidget::timeout(QPushButton *button, int time)
{
QObject::connect(button, &QPushButton::clicked, this, [=]() {
this->channel->sendMessage("/timeout " + this->ui->lblUsername->text() + " " +
QString::number(time));
});
}
void AccountPopupWidget::sendCommand(QPushButton *button, QString command)
{
QObject::connect(button, &QPushButton::clicked, this, [=]() {
this->channel->sendMessage(command + this->ui->lblUsername->text());
});
}
void AccountPopupWidget::refreshLayouts()
{
auto currentTwitchUser = getApp()->accounts->twitch.getCurrent();
if (!currentTwitchUser) {
// No twitch user set (should never happen)
return;
}
QString loggedInUsername = currentTwitchUser->getUserName();
QString popupUsername = this->ui->lblUsername->text();
bool showModLayout = false;
bool showUserLayout = false;
bool showOwnerLayout = false;
if (loggedInUsername == popupUsername) {
// Clicked user is the same as the logged in user
showModLayout = false;
showUserLayout = false;
showOwnerLayout = false;
} else {
showUserLayout = true;
switch (this->loggedInUser.userType) {
case UserType::Mod: {
showModLayout = true;
} break;
case UserType::Owner: {
showModLayout = true;
showOwnerLayout = true;
} break;
}
}
if (this->popupWidgetUser.userType == UserType::Owner) {
showModLayout = false;
showOwnerLayout = false;
}
if (this->popupWidgetUser.userType == UserType::Mod &&
this->loggedInUser.userType != UserType::Owner) {
showModLayout = false;
}
this->updateButtons(this->ui->modLayout, showModLayout);
this->updateButtons(this->ui->userLayout, showUserLayout);
this->updateButtons(this->ui->ownerLayout, showOwnerLayout);
}
void AccountPopupWidget::actuallyRefreshButtons()
{
if (this->relationship.isFollowingSet()) {
if (this->relationship.isFollowing()) {
this->ui->follow->setText("Unfollow");
} else {
this->ui->follow->setText("Follow");
}
this->ui->follow->setEnabled(true);
}
if (this->relationship.isIgnoringSet()) {
if (this->relationship.isIgnoring()) {
this->ui->ignore->setText("Unignore");
} else {
this->ui->ignore->setText("Ignore");
}
this->ui->ignore->setEnabled(true);
}
}
void AccountPopupWidget::focusOutEvent(QFocusEvent *)
{
this->hide();
this->ui->lblFollowers->setText("Loading...");
this->ui->lblViews->setText("Loading...");
this->ui->lblAccountAge->setText("Loading...");
this->ui->lblUsername->setText("Loading...");
this->ui->lblAvatar->setText("Loading...");
}
void AccountPopupWidget::showEvent(QShowEvent *)
{
this->loggedInUser.refreshUserType(this->channel, true);
this->popupWidgetUser.refreshUserType(this->channel, false);
this->ui->follow->setEnabled(false);
this->ui->ignore->setEnabled(false);
this->refreshButtons();
this->refreshLayouts();
QString blacklisted = getApp()->settings->highlightUserBlacklist;
QStringList list = blacklisted.split("\n", QString::SkipEmptyParts);
if (list.contains(this->ui->lblUsername->text(), Qt::CaseInsensitive)) {
this->ui->disableHighlights->hide();
this->ui->enableHighlights->show();
} else {
this->ui->disableHighlights->show();
this->ui->enableHighlights->hide();
}
}
} // namespace widgets
} // namespace chatterino

View file

@ -1,130 +0,0 @@
#pragma once
#include "basewindow.hpp"
#include "providers/twitch/twitchchannel.hpp"
#include "util/concurrentmap.hpp"
#include <QPushButton>
#include <QWidget>
#include <memory>
namespace Ui {
class AccountPopup;
} // namespace Ui
namespace chatterino {
class Channel;
namespace widgets {
class AccountPopupWidget final : public BaseWindow
{
Q_OBJECT
public:
AccountPopupWidget(ChannelPtr _channel);
void setName(const QString &name);
void setChannel(ChannelPtr _channel);
public slots:
void actuallyRefreshButtons();
signals:
void refreshButtons();
protected:
void scaleChangedEvent(float newDpi) override;
private:
Ui::AccountPopup *ui;
void getUserId();
void getUserData();
void loadAvatar(const QUrl &avatarUrl);
void updateButtons(QWidget *layout, bool state);
void timeout(QPushButton *button, int time);
void sendCommand(QPushButton *button, QString command);
void refreshLayouts();
enum class UserType { User, Mod, Owner };
ChannelPtr channel;
QPixmap avatar;
util::ConcurrentMap<QString, QPixmap> avatarMap;
struct User {
QString username;
QString userID;
UserType userType = UserType::User;
void refreshUserType(const ChannelPtr &channel, bool loggedInUser);
};
User loggedInUser;
User popupWidgetUser;
struct {
void reset()
{
this->following = -1;
this->ignoring = -1;
}
bool isFollowing() const
{
return this->following == 1;
}
bool isFollowingSet() const
{
return this->following != -1;
}
void setFollowing(bool newVal)
{
if (newVal) {
this->following = 1;
} else {
this->following = 0;
}
}
bool isIgnoring() const
{
return this->ignoring == 1;
}
bool isIgnoringSet() const
{
return this->ignoring != -1;
}
void setIgnoring(bool newVal)
{
if (newVal) {
this->ignoring = 1;
} else {
this->ignoring = 0;
}
}
private:
int following = -1;
int ignoring = -1;
} relationship;
protected:
void focusOutEvent(QFocusEvent *event) override;
void showEvent(QShowEvent *event) override;
};
} // namespace widgets
} // namespace chatterino

View file

@ -9,7 +9,6 @@
#include "singletons/settingsmanager.hpp"
#include "singletons/thememanager.hpp"
#include "singletons/windowmanager.hpp"
#include "ui_accountpopupform.h"
#include "util/benchmark.hpp"
#include "util/distancebetweenpoints.hpp"
#include "widgets/split.hpp"
@ -42,13 +41,12 @@ namespace widgets {
ChannelView::ChannelView(BaseWidget *parent)
: BaseWidget(parent)
, scrollBar(this)
, userPopupWidget(std::shared_ptr<TwitchChannel>())
{
auto app = getApp();
this->setMouseTracking(true);
this->managedConnections.emplace_back(app->settings->wordFlagsChanged.connect([=] {
this->managedConnections.emplace_back(app->settings->wordFlagsChanged.connect([this] {
this->layoutMessages();
this->update();
}));
@ -478,7 +476,6 @@ void ChannelView::setChannel(ChannelPtr newChannel)
this->channel = newChannel;
this->userPopupWidget.setChannel(newChannel);
this->layoutMessages();
this->queueUpdate();
}
@ -911,7 +908,6 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
// no message found
if (!tryGetMessageAt(event->pos(), layout, relativePos, messageIndex)) {
// No message at clicked position
this->userPopupWidget.hide();
return;
}
@ -1109,7 +1105,6 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const messages::Link &link
userPopup->setData(user, this->channel);
userPopup->setAttribute(Qt::WA_DeleteOnClose);
userPopup->move(event->globalPos());
userPopup->setFocus();
userPopup->show();
// this->userPopupWidget.setName(user);

View file

@ -6,7 +6,6 @@
#include "messages/limitedqueuesnapshot.hpp"
#include "messages/messageelement.hpp"
#include "messages/selection.hpp"
#include "widgets/accountpopup.hpp"
#include "widgets/basewidget.hpp"
#include "widgets/helper/rippleeffectlabel.hpp"
#include "widgets/scrollbar.hpp"
@ -124,7 +123,6 @@ private:
bool showingLatestMessages = true;
bool enableScrollingToBottom = true;
AccountPopupWidget userPopupWidget;
bool onlyUpdateEmotes = false;
// Mouse event variables

View file

@ -19,6 +19,7 @@
#include "widgets/selectchanneldialog.hpp"
#include "widgets/splitcontainer.hpp"
#include "widgets/textinputdialog.hpp"
#include "widgets/userinfopopup.hpp"
#include "widgets/window.hpp"
#include <QApplication>
@ -425,8 +426,6 @@ void Split::doOpenViewerList()
this->height() - this->header.height() - this->input.height());
viewerDock->move(0, this->header.height());
auto accountPopup = new AccountPopupWidget(this->getChannel());
accountPopup->setAttribute(Qt::WA_DeleteOnClose);
auto multiWidget = new QWidget(viewerDock);
auto dockVbox = new QVBoxLayout(viewerDock);
auto searchBar = new QLineEdit(viewerDock);
@ -480,13 +479,13 @@ void Split::doOpenViewerList()
QObject::connect(chattersList, &QListWidget::doubleClicked, this, [=]() {
if (!labels.contains(chattersList->currentItem()->text())) {
doOpenAccountPopupWidget(accountPopup, chattersList->currentItem()->text());
doOpenUserInfoPopup(chattersList->currentItem()->text());
}
});
QObject::connect(resultList, &QListWidget::doubleClicked, this, [=]() {
if (!labels.contains(resultList->currentItem()->text())) {
doOpenAccountPopupWidget(accountPopup, resultList->currentItem()->text());
doOpenUserInfoPopup(resultList->currentItem()->text());
}
});
@ -502,12 +501,13 @@ void Split::doOpenViewerList()
viewerDock->show();
}
void Split::doOpenAccountPopupWidget(AccountPopupWidget *widget, QString user)
void Split::doOpenUserInfoPopup(const QString &user)
{
widget->setName(user);
widget->show();
widget->setFocus();
widget->moveTo(this, QCursor::pos());
auto *userPopup = new UserInfoPopup;
userPopup->setData(user, this->getChannel());
userPopup->setAttribute(Qt::WA_DeleteOnClose);
userPopup->move(QCursor::pos());
userPopup->show();
}
void Split::doCopy()

View file

@ -108,7 +108,7 @@ private:
std::vector<pajlada::Signals::ScopedConnection> managedConnections;
void doOpenAccountPopupWidget(AccountPopupWidget *widget, QString user);
void doOpenUserInfoPopup(const QString &user);
void channelNameUpdated(const QString &newChannelName);
void handleModifiers(Qt::KeyboardModifiers modifiers);