mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
renamed a bunch of files and classes
This commit is contained in:
parent
ad8ee97de9
commit
7f18cefee4
455
chatterino.pro
455
chatterino.pro
|
@ -1,225 +1,230 @@
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
#
|
#
|
||||||
# Project created by QtCreator 2016-12-28T18:23:35
|
# Project created by QtCreator 2016-12-28T18:23:35
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui network multimedia
|
QT += core gui network multimedia
|
||||||
CONFIG += communi
|
CONFIG += communi
|
||||||
COMMUNI += core model util
|
COMMUNI += core model util
|
||||||
CONFIG += c++14
|
CONFIG += c++14
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
# Include ourself
|
# Include ourself
|
||||||
INCLUDEPATH += src/
|
INCLUDEPATH += src/
|
||||||
|
|
||||||
TARGET = chatterino
|
TARGET = chatterino
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
# Define warning flags for Chatterino
|
# Define warning flags for Chatterino
|
||||||
win32-msvc* {
|
win32-msvc* {
|
||||||
QMAKE_CXXFLAGS_WARN_ON = -W4
|
QMAKE_CXXFLAGS_WARN_ON = -W4
|
||||||
# 4714 - function marked as __forceinline not inlined
|
# 4714 - function marked as __forceinline not inlined
|
||||||
# 4996 - occurs when the compiler encounters a function or variable that is marked as deprecated.
|
# 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
|
# These functions may have a different preferred name, may be insecure or have
|
||||||
# a more secure variant, or may be obsolete.
|
# a more secure variant, or may be obsolete.
|
||||||
QMAKE_CXXFLAGS_WARN_ON += /wd4714
|
QMAKE_CXXFLAGS_WARN_ON += /wd4714
|
||||||
QMAKE_CXXFLAGS_WARN_ON += /wd4996
|
QMAKE_CXXFLAGS_WARN_ON += /wd4996
|
||||||
} else {
|
} else {
|
||||||
QMAKE_CXXFLAGS_WARN_ON = -Wall
|
QMAKE_CXXFLAGS_WARN_ON = -Wall
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-function
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-function
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-switch
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-switch
|
||||||
QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-declarations
|
QMAKE_CXXFLAGS_WARN_ON += -Wno-deprecated-declarations
|
||||||
}
|
}
|
||||||
|
|
||||||
# do not use windows min/max macros
|
# do not use windows min/max macros
|
||||||
win32 {
|
win32 {
|
||||||
DEFINES += NOMINMAX
|
DEFINES += NOMINMAX
|
||||||
}
|
}
|
||||||
|
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
src/main.cpp \
|
src/main.cpp \
|
||||||
src/application.cpp \
|
src/application.cpp \
|
||||||
src/channel.cpp \
|
src/channel.cpp \
|
||||||
src/channeldata.cpp \
|
src/channeldata.cpp \
|
||||||
src/colorscheme.cpp \
|
src/colorscheme.cpp \
|
||||||
src/ircmanager.cpp \
|
src/ircmanager.cpp \
|
||||||
src/messages/lazyloadedimage.cpp \
|
src/messages/lazyloadedimage.cpp \
|
||||||
src/messages/link.cpp \
|
src/messages/link.cpp \
|
||||||
src/messages/message.cpp \
|
src/messages/message.cpp \
|
||||||
src/messages/word.cpp \
|
src/messages/word.cpp \
|
||||||
src/messages/wordpart.cpp \
|
src/messages/wordpart.cpp \
|
||||||
src/resources.cpp \
|
src/resources.cpp \
|
||||||
src/widgets/chatwidget.cpp \
|
src/widgets/notebook.cpp \
|
||||||
src/widgets/chatwidgetheader.cpp \
|
src/widgets/helper/notebookbutton.cpp \
|
||||||
src/widgets/chatwidgetinput.cpp \
|
src/widgets/helper/notebooktab.cpp \
|
||||||
src/widgets/mainwindow.cpp \
|
src/widgets/scrollbar.cpp \
|
||||||
src/widgets/notebook.cpp \
|
src/widgets/helper/scrollbarhighlight.cpp \
|
||||||
src/widgets/notebookbutton.cpp \
|
src/widgets/settingsdialog.cpp \
|
||||||
src/widgets/notebookpage.cpp \
|
src/widgets/helper/settingsdialogtab.cpp \
|
||||||
src/widgets/notebookpagedroppreview.cpp \
|
src/widgets/textinputdialog.cpp \
|
||||||
src/widgets/notebooktab.cpp \
|
src/messages/messageref.cpp \
|
||||||
src/widgets/scrollbar.cpp \
|
src/logging/loggingmanager.cpp \
|
||||||
src/widgets/scrollbarhighlight.cpp \
|
src/logging/loggingchannel.cpp \
|
||||||
src/widgets/settingsdialog.cpp \
|
src/windowmanager.cpp \
|
||||||
src/widgets/settingsdialogtab.cpp \
|
src/channelmanager.cpp \
|
||||||
src/widgets/textinputdialog.cpp \
|
src/fontmanager.cpp \
|
||||||
src/messages/messageref.cpp \
|
src/settingsmanager.cpp \
|
||||||
src/logging/loggingmanager.cpp \
|
src/emotemanager.cpp \
|
||||||
src/logging/loggingchannel.cpp \
|
src/messages/messagebuilder.cpp \
|
||||||
src/windowmanager.cpp \
|
src/twitch/twitchmessagebuilder.cpp \
|
||||||
src/channelmanager.cpp \
|
src/twitch/twitchparsemessage.cpp \
|
||||||
src/fontmanager.cpp \
|
src/widgets/titlebar.cpp \
|
||||||
src/settingsmanager.cpp \
|
src/appdatapath.cpp \
|
||||||
src/emotemanager.cpp \
|
src/accountmanager.cpp \
|
||||||
src/messages/messagebuilder.cpp \
|
src/twitch/twitchuser.cpp \
|
||||||
src/twitch/twitchmessagebuilder.cpp \
|
src/ircaccount.cpp \
|
||||||
src/twitch/twitchparsemessage.cpp \
|
src/widgets/accountpopup.cpp \
|
||||||
src/widgets/titlebar.cpp \
|
src/widgets/basewidget.cpp \
|
||||||
src/appdatapath.cpp \
|
src/widgets/helper/resizingtextedit.cpp \
|
||||||
src/accountmanager.cpp \
|
src/completionmanager.cpp \
|
||||||
src/twitch/twitchuser.cpp \
|
src/widgets/logindialog.cpp \
|
||||||
src/ircaccount.cpp \
|
src/widgets/qualitypopup.cpp \
|
||||||
src/widgets/accountpopup.cpp \
|
src/widgets/emotepopup.cpp \
|
||||||
src/widgets/basewidget.cpp \
|
src/widgets/helper/channelview.cpp \
|
||||||
src/widgets/resizingtextedit.cpp \
|
src/twitch/twitchchannel.cpp \
|
||||||
src/completionmanager.cpp \
|
src/widgets/helper/rippleeffectlabel.cpp \
|
||||||
src/widgets/logindialog.cpp \
|
src/widgets/helper/rippleeffectbutton.cpp \
|
||||||
src/widgets/qualitypopup.cpp \
|
src/messages/messagecolor.cpp \
|
||||||
src/widgets/emotepopup.cpp \
|
src/util/networkmanager.cpp \
|
||||||
src/widgets/channelview.cpp \
|
src/commandmanager.cpp \
|
||||||
src/twitch/twitchchannel.cpp \
|
src/widgets/split.cpp \
|
||||||
src/widgets/rippleeffectlabel.cpp \
|
src/widgets/helper/splitinput.cpp \
|
||||||
src/widgets/rippleeffectbutton.cpp \
|
src/widgets/helper/splitheader.cpp \
|
||||||
src/messages/messagecolor.cpp \
|
src/widgets/splitcontainer.cpp \
|
||||||
src/util/networkmanager.cpp
|
src/widgets/helper/droppreview.cpp \
|
||||||
|
src/widgets/window.cpp \
|
||||||
HEADERS += \
|
src/widgets/helper/splitcolumn.cpp
|
||||||
src/asyncexec.hpp \
|
|
||||||
src/channel.hpp \
|
HEADERS += \
|
||||||
src/colorscheme.hpp \
|
src/asyncexec.hpp \
|
||||||
src/concurrentmap.hpp \
|
src/channel.hpp \
|
||||||
src/emojis.hpp \
|
src/colorscheme.hpp \
|
||||||
src/ircmanager.hpp \
|
src/concurrentmap.hpp \
|
||||||
src/messages/lazyloadedimage.hpp \
|
src/emojis.hpp \
|
||||||
src/messages/link.hpp \
|
src/ircmanager.hpp \
|
||||||
src/messages/message.hpp \
|
src/messages/lazyloadedimage.hpp \
|
||||||
src/messages/word.hpp \
|
src/messages/link.hpp \
|
||||||
src/messages/wordpart.hpp \
|
src/messages/message.hpp \
|
||||||
src/resources.hpp \
|
src/messages/word.hpp \
|
||||||
src/setting.hpp \
|
src/messages/wordpart.hpp \
|
||||||
src/twitch/emotevalue.hpp \
|
src/resources.hpp \
|
||||||
src/widgets/chatwidget.hpp \
|
src/setting.hpp \
|
||||||
src/widgets/chatwidgetheader.hpp \
|
src/twitch/emotevalue.hpp \
|
||||||
src/widgets/chatwidgetinput.hpp \
|
src/widgets/notebook.hpp \
|
||||||
src/widgets/mainwindow.hpp \
|
src/widgets/helper/notebookbutton.hpp \
|
||||||
src/widgets/notebook.hpp \
|
src/widgets/helper/notebooktab.hpp \
|
||||||
src/widgets/notebookbutton.hpp \
|
src/widgets/scrollbar.hpp \
|
||||||
src/widgets/notebookpage.hpp \
|
src/widgets/helper/scrollbarhighlight.hpp \
|
||||||
src/widgets/notebookpagedroppreview.hpp \
|
src/widgets/settingsdialog.hpp \
|
||||||
src/widgets/notebooktab.hpp \
|
src/widgets/helper/settingsdialogtab.hpp \
|
||||||
src/widgets/scrollbar.hpp \
|
src/widgets/helper/signallabel.hpp \
|
||||||
src/widgets/scrollbarhighlight.hpp \
|
src/widgets/textinputdialog.hpp \
|
||||||
src/widgets/settingsdialog.hpp \
|
src/widgets/helper/resizingtextedit.hpp \
|
||||||
src/widgets/settingsdialogtab.hpp \
|
src/settingssnapshot.hpp \
|
||||||
src/widgets/signallabel.hpp \
|
src/messages/limitedqueue.hpp \
|
||||||
src/widgets/textinputdialog.hpp \
|
src/messages/limitedqueuesnapshot.hpp \
|
||||||
src/widgets/resizingtextedit.hpp \
|
src/messages/messageref.hpp \
|
||||||
src/settingssnapshot.hpp \
|
src/logging/loggingmanager.hpp \
|
||||||
src/messages/limitedqueue.hpp \
|
src/logging/loggingchannel.hpp \
|
||||||
src/messages/limitedqueuesnapshot.hpp \
|
src/channelmanager.hpp \
|
||||||
src/messages/messageref.hpp \
|
src/windowmanager.hpp \
|
||||||
src/logging/loggingmanager.hpp \
|
src/settingsmanager.hpp \
|
||||||
src/logging/loggingchannel.hpp \
|
src/fontmanager.hpp \
|
||||||
src/channelmanager.hpp \
|
src/emotemanager.hpp \
|
||||||
src/windowmanager.hpp \
|
src/util/urlfetch.hpp \
|
||||||
src/settingsmanager.hpp \
|
src/messages/messageparseargs.hpp \
|
||||||
src/fontmanager.hpp \
|
src/messages/messagebuilder.hpp \
|
||||||
src/emotemanager.hpp \
|
src/twitch/twitchmessagebuilder.hpp \
|
||||||
src/util/urlfetch.hpp \
|
src/twitch/twitchparsemessage.hpp \
|
||||||
src/messages/messageparseargs.hpp \
|
src/widgets/titlebar.hpp \
|
||||||
src/messages/messagebuilder.hpp \
|
src/appdatapath.hpp \
|
||||||
src/twitch/twitchmessagebuilder.hpp \
|
src/accountmanager.hpp \
|
||||||
src/twitch/twitchparsemessage.hpp \
|
src/twitch/twitchuser.hpp \
|
||||||
src/widgets/titlebar.hpp \
|
src/ircaccount.hpp \
|
||||||
src/appdatapath.hpp \
|
src/widgets/accountpopup.hpp \
|
||||||
src/accountmanager.hpp \
|
src/util/distancebetweenpoints.hpp \
|
||||||
src/twitch/twitchuser.hpp \
|
src/widgets/basewidget.hpp \
|
||||||
src/ircaccount.hpp \
|
src/completionmanager.hpp \
|
||||||
src/widgets/accountpopup.hpp \
|
src/widgets/helper/channelview.hpp \
|
||||||
src/util/distancebetweenpoints.hpp \
|
src/twitch/twitchchannel.hpp \
|
||||||
src/widgets/basewidget.hpp \
|
src/widgets/helper/rippleeffectbutton.hpp \
|
||||||
src/completionmanager.hpp \
|
src/widgets/helper/rippleeffectlabel.hpp \
|
||||||
src/widgets/channelview.hpp \
|
src/widgets/qualitypopup.hpp \
|
||||||
src/twitch/twitchchannel.hpp \
|
src/widgets/emotepopup.hpp \
|
||||||
src/widgets/rippleeffectbutton.hpp \
|
src/messages/messagecolor.hpp \
|
||||||
src/widgets/rippleeffectlabel.hpp \
|
src/util/nativeeventhelper.hpp \
|
||||||
src/widgets/qualitypopup.hpp \
|
src/debug/log.hpp \
|
||||||
src/widgets/emotepopup.hpp \
|
src/util/benchmark.hpp \
|
||||||
src/messages/messagecolor.hpp \
|
src/util/networkmanager.hpp \
|
||||||
src/util/nativeeventhelper.hpp \
|
src/commandmanager.hpp \
|
||||||
src/debug/log.hpp \
|
src/widgets/split.hpp \
|
||||||
src/util/benchmark.hpp \
|
src/widgets/helper/splitheader.hpp \
|
||||||
src/util/networkmanager.hpp
|
src/widgets/helper/splitinput.hpp \
|
||||||
|
src/widgets/window.hpp \
|
||||||
PRECOMPILED_HEADER =
|
src/widgets/splitcontainer.hpp \
|
||||||
|
src/widgets/helper/droppreview.hpp \
|
||||||
RESOURCES += \
|
src/widgets/helper/splitcolumn.hpp
|
||||||
resources/resources.qrc
|
|
||||||
|
|
||||||
DISTFILES +=
|
PRECOMPILED_HEADER =
|
||||||
|
|
||||||
# Include boost
|
RESOURCES += \
|
||||||
win32 {
|
resources/resources.qrc
|
||||||
INCLUDEPATH += C:\local\boost\
|
|
||||||
}
|
DISTFILES +=
|
||||||
|
|
||||||
win32 {
|
# Include boost
|
||||||
LIBS += -luser32
|
win32 {
|
||||||
LIBS += -lgdi32
|
INCLUDEPATH += C:\local\boost\
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optional dependency on windows sdk 7.1
|
win32 {
|
||||||
win32:exists(C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\Windows.h) {
|
LIBS += -luser32
|
||||||
LIBS += -L"C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib" \
|
LIBS += -lgdi32
|
||||||
-ldwmapi \
|
}
|
||||||
-lgdi32
|
|
||||||
|
# Optional dependency on windows sdk 7.1
|
||||||
# SOURCES += platform/borderless/qwinwidget.cpp \
|
win32:exists(C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\Windows.h) {
|
||||||
# platform/borderless/winnativewindow.cpp \
|
LIBS += -L"C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib" \
|
||||||
# platform/borderless/widget.cpp
|
-ldwmapi \
|
||||||
|
-lgdi32
|
||||||
# HEADERS += platform/borderless/qwinwidget.h \
|
|
||||||
# platform/borderless/winnativewindow.h \
|
# SOURCES += platform/borderless/qwinwidget.cpp \
|
||||||
# platform/borderless/widget.h
|
# platform/borderless/winnativewindow.cpp \
|
||||||
|
# platform/borderless/widget.cpp
|
||||||
DEFINES += "USEWINSDK"
|
|
||||||
}
|
# HEADERS += platform/borderless/qwinwidget.h \
|
||||||
|
# platform/borderless/winnativewindow.h \
|
||||||
macx {
|
# platform/borderless/widget.h
|
||||||
INCLUDEPATH += /usr/local/include
|
|
||||||
}
|
DEFINES += "USEWINSDK"
|
||||||
|
}
|
||||||
FORMS += \
|
|
||||||
forms/accountpopupform.ui
|
macx {
|
||||||
|
INCLUDEPATH += /usr/local/include
|
||||||
werr {
|
}
|
||||||
QMAKE_CXXFLAGS += -Werror
|
|
||||||
|
FORMS += \
|
||||||
message("Enabling error on warning")
|
forms/accountpopupform.ui
|
||||||
}
|
|
||||||
|
werr {
|
||||||
# External dependencies
|
QMAKE_CXXFLAGS += -Werror
|
||||||
include(dependencies/rapidjson.pri)
|
|
||||||
include(dependencies/settings.pri)
|
message("Enabling error on warning")
|
||||||
include(dependencies/signals.pri)
|
}
|
||||||
include(dependencies/humanize.pri)
|
|
||||||
include(dependencies/fmt.pri)
|
# External dependencies
|
||||||
DEFINES += IRC_NAMESPACE=Communi
|
include(dependencies/rapidjson.pri)
|
||||||
include(dependencies/libcommuni.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)
|
||||||
|
|
||||||
|
|
42
src/commandmanager.cpp
Normal file
42
src/commandmanager.cpp
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
#include "commandmanager.hpp"
|
||||||
|
#include "windowmanager.hpp"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
void CommandManager::execCommand(QString command)
|
||||||
|
{
|
||||||
|
if (command == "selectr") {
|
||||||
|
selectSplitRelative(1, 0);
|
||||||
|
}
|
||||||
|
if (command == "selectl") {
|
||||||
|
selectSplitRelative(-1, 0);
|
||||||
|
}
|
||||||
|
if (command == "selectu") {
|
||||||
|
selectSplitRelative(0, -1);
|
||||||
|
}
|
||||||
|
if (command == "selectd") {
|
||||||
|
selectSplitRelative(0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (command == "mover") {
|
||||||
|
moveSplitRelative(1, 0);
|
||||||
|
}
|
||||||
|
if (command == "movel") {
|
||||||
|
moveSplitRelative(-1, 0);
|
||||||
|
}
|
||||||
|
if (command == "moveu") {
|
||||||
|
moveSplitRelative(0, -1);
|
||||||
|
}
|
||||||
|
if (command == "moved") {
|
||||||
|
moveSplitRelative(0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommandManager::selectSplitRelative(int dx, int dy)
|
||||||
|
{
|
||||||
|
WindowManager::instance->getCurrentWindow().getNotebook().getSelectedPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommandManager::moveSplitRelative(int dx, int dy)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
15
src/commandmanager.hpp
Normal file
15
src/commandmanager.hpp
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
class CommandManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CommandManager() = delete;
|
||||||
|
|
||||||
|
void execCommand(QString command);
|
||||||
|
void selectSplitRelative(int dx, int dy);
|
||||||
|
void moveSplitRelative(int dx, int dy);
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,7 +3,7 @@
|
||||||
#include "channel.hpp"
|
#include "channel.hpp"
|
||||||
#include "emotemanager.hpp"
|
#include "emotemanager.hpp"
|
||||||
#include "widgets/basewidget.hpp"
|
#include "widgets/basewidget.hpp"
|
||||||
#include "widgets/channelview.hpp"
|
#include "widgets/helper/channelview.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
1
src/widgets/helper/.clang-format
Normal file
1
src/widgets/helper/.clang-format
Normal file
|
@ -0,0 +1 @@
|
||||||
|
../.clang-format
|
|
@ -1,4 +1,4 @@
|
||||||
#include "widgets/channelview.hpp"
|
#include "widgets/helper/channelview.hpp"
|
||||||
#include "channelmanager.hpp"
|
#include "channelmanager.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "debug/log.hpp"
|
#include "debug/log.hpp"
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
#include "ui_accountpopupform.h"
|
#include "ui_accountpopupform.h"
|
||||||
#include "util/benchmark.hpp"
|
#include "util/benchmark.hpp"
|
||||||
#include "util/distancebetweenpoints.hpp"
|
#include "util/distancebetweenpoints.hpp"
|
||||||
#include "widgets/chatwidget.hpp"
|
#include "widgets/split.hpp"
|
||||||
#include "windowmanager.hpp"
|
#include "windowmanager.hpp"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -240,8 +240,9 @@ QString ChannelView::getSelectedText()
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
first = false;
|
first = false;
|
||||||
bool isSingleWord = isSingleMessage && this->selection.max.charIndex - charIndex <
|
bool isSingleWord =
|
||||||
part.getCharacterLength();
|
isSingleMessage &&
|
||||||
|
this->selection.max.charIndex - charIndex < part.getCharacterLength();
|
||||||
|
|
||||||
if (isSingleWord) {
|
if (isSingleWord) {
|
||||||
// return single word
|
// return single word
|
||||||
|
@ -518,9 +519,10 @@ void ChannelView::updateMessageBuffer(messages::MessageRef *messageRef, QPixmap
|
||||||
// this->selectionMax.messageIndex >= messageIndex) {
|
// this->selectionMax.messageIndex >= messageIndex) {
|
||||||
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
// painter.fillRect(buffer->rect(), QColor(24, 55, 25));
|
||||||
//} else {
|
//} else {
|
||||||
painter.fillRect(buffer->rect(), (messageRef->getMessage()->getCanHighlightTab())
|
painter.fillRect(buffer->rect(),
|
||||||
? this->colorScheme.ChatBackgroundHighlighted
|
(messageRef->getMessage()->getCanHighlightTab())
|
||||||
: this->colorScheme.ChatBackground);
|
? this->colorScheme.ChatBackgroundHighlighted
|
||||||
|
: this->colorScheme.ChatBackground);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// draw selection
|
// draw selection
|
|
@ -7,7 +7,7 @@
|
||||||
#include "messages/word.hpp"
|
#include "messages/word.hpp"
|
||||||
#include "widgets/accountpopup.hpp"
|
#include "widgets/accountpopup.hpp"
|
||||||
#include "widgets/basewidget.hpp"
|
#include "widgets/basewidget.hpp"
|
||||||
#include "widgets/rippleeffectlabel.hpp"
|
#include "widgets/helper/rippleeffectlabel.hpp"
|
||||||
#include "widgets/scrollbar.hpp"
|
#include "widgets/scrollbar.hpp"
|
||||||
|
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
|
@ -1,4 +1,4 @@
|
||||||
#include "widgets/notebookpagedroppreview.hpp"
|
#include "widgets/helper/droppreview.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
|
@ -1,6 +1,6 @@
|
||||||
#include "widgets/notebookbutton.hpp"
|
#include "widgets/helper/notebookbutton.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "widgets/rippleeffectbutton.hpp"
|
#include "widgets/helper/rippleeffectbutton.hpp"
|
||||||
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
|
@ -1,4 +1,4 @@
|
||||||
#include "widgets/notebooktab.hpp"
|
#include "widgets/helper/notebooktab.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "settingsmanager.hpp"
|
#include "settingsmanager.hpp"
|
||||||
#include "widgets/notebook.hpp"
|
#include "widgets/notebook.hpp"
|
||||||
|
@ -279,7 +279,7 @@ void NotebookTab::mouseMoveEvent(QMouseEvent *event)
|
||||||
QPoint relPoint = this->mapToParent(event->pos());
|
QPoint relPoint = this->mapToParent(event->pos());
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
NotebookPage *clickedPage = notebook->tabAt(relPoint, index);
|
SplitContainer *clickedPage = notebook->tabAt(relPoint, index);
|
||||||
|
|
||||||
if (clickedPage != nullptr && clickedPage != this->page) {
|
if (clickedPage != nullptr && clickedPage != this->page) {
|
||||||
this->notebook->rearrangePage(clickedPage, index);
|
this->notebook->rearrangePage(clickedPage, index);
|
|
@ -15,7 +15,7 @@ class ColorScheme;
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
class Notebook;
|
class Notebook;
|
||||||
class NotebookPage;
|
class SplitContainer;
|
||||||
|
|
||||||
class NotebookTab : public BaseWidget
|
class NotebookTab : public BaseWidget
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ public:
|
||||||
|
|
||||||
void calcSize();
|
void calcSize();
|
||||||
|
|
||||||
NotebookPage *page;
|
SplitContainer *page;
|
||||||
|
|
||||||
const QString &getTitle() const;
|
const QString &getTitle() const;
|
||||||
void setTitle(const QString &newTitle);
|
void setTitle(const QString &newTitle);
|
|
@ -1,4 +1,4 @@
|
||||||
#include "widgets/resizingtextedit.hpp"
|
#include "widgets/helper/resizingtextedit.hpp"
|
||||||
|
|
||||||
ResizingTextEdit::ResizingTextEdit()
|
ResizingTextEdit::ResizingTextEdit()
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
#include "widgets/rippleeffectlabel.hpp"
|
#include "widgets/helper/rippleeffectlabel.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "widgets/chatwidgetheader.hpp"
|
#include "widgets/helper/splitheader.hpp"
|
||||||
|
|
||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
|
@ -1,8 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "widgets/basewidget.hpp"
|
#include "widgets/basewidget.hpp"
|
||||||
#include "widgets/rippleeffectbutton.hpp"
|
#include "widgets/helper/rippleeffectbutton.hpp"
|
||||||
#include "widgets/signallabel.hpp"
|
#include "widgets/helper/signallabel.hpp"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
|
@ -1,4 +1,4 @@
|
||||||
#include "widgets/scrollbarhighlight.hpp"
|
#include "widgets/helper/scrollbarhighlight.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "widgets/scrollbar.hpp"
|
#include "widgets/scrollbar.hpp"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "widgets/settingsdialogtab.hpp"
|
#include "widgets/helper/settingsdialogtab.hpp"
|
||||||
#include "widgets/settingsdialog.hpp"
|
#include "widgets/settingsdialog.hpp"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
9
src/widgets/helper/splitcolumn.cpp
Normal file
9
src/widgets/helper/splitcolumn.cpp
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#include "splitcolumn.hpp"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace helper {
|
||||||
|
SplitColumn::SplitColumn()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
23
src/widgets/helper/splitcolumn.hpp
Normal file
23
src/widgets/helper/splitcolumn.hpp
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "widgets/split.hpp"
|
||||||
|
|
||||||
|
namespace chatterino {
|
||||||
|
namespace helper {
|
||||||
|
class SplitColumn
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SplitColumn();
|
||||||
|
|
||||||
|
void insert(widgets::Split *split, int index = -1);
|
||||||
|
void remove(int index);
|
||||||
|
double getFlex();
|
||||||
|
void setFlex(double flex);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<widgets::Split> items;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
#include "widgets/chatwidgetheader.hpp"
|
#include "widgets/helper/splitheader.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "twitch/twitchchannel.hpp"
|
#include "twitch/twitchchannel.hpp"
|
||||||
#include "util/urlfetch.hpp"
|
#include "util/urlfetch.hpp"
|
||||||
#include "widgets/chatwidget.hpp"
|
#include "widgets/split.hpp"
|
||||||
#include "widgets/notebookpage.hpp"
|
#include "widgets/splitcontainer.hpp"
|
||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
ChatWidgetHeader::ChatWidgetHeader(ChatWidget *_chatWidget)
|
SplitHeader::SplitHeader(Split *_chatWidget)
|
||||||
: BaseWidget(_chatWidget)
|
: BaseWidget(_chatWidget)
|
||||||
, chatWidget(_chatWidget)
|
, chatWidget(_chatWidget)
|
||||||
, leftLabel(this)
|
, leftLabel(this)
|
||||||
|
@ -35,23 +35,22 @@ ChatWidgetHeader::ChatWidgetHeader(ChatWidget *_chatWidget)
|
||||||
this->leftLabel.getLabel().setTextFormat(Qt::RichText);
|
this->leftLabel.getLabel().setTextFormat(Qt::RichText);
|
||||||
this->leftLabel.getLabel().setText("<img src=':/images/tool_moreCollapser_off16.png' />");
|
this->leftLabel.getLabel().setText("<img src=':/images/tool_moreCollapser_off16.png' />");
|
||||||
|
|
||||||
connect(&this->leftLabel, &RippleEffectLabel::clicked, this,
|
connect(&this->leftLabel, &RippleEffectLabel::clicked, this, &SplitHeader::leftButtonClicked);
|
||||||
&ChatWidgetHeader::leftButtonClicked);
|
|
||||||
|
|
||||||
this->leftMenu.addAction("Add new split", this->chatWidget, &ChatWidget::doAddSplit,
|
this->leftMenu.addAction("Add new split", this->chatWidget, &Split::doAddSplit,
|
||||||
QKeySequence(tr("Ctrl+T")));
|
QKeySequence(tr("Ctrl+T")));
|
||||||
this->leftMenu.addAction("Close split", this->chatWidget, &ChatWidget::doCloseSplit,
|
this->leftMenu.addAction("Close split", this->chatWidget, &Split::doCloseSplit,
|
||||||
QKeySequence(tr("Ctrl+W")));
|
QKeySequence(tr("Ctrl+W")));
|
||||||
this->leftMenu.addAction("Move split", this, SLOT(menuMoveSplit()));
|
this->leftMenu.addAction("Move split", this, SLOT(menuMoveSplit()));
|
||||||
this->leftMenu.addAction("Popup", this->chatWidget, &ChatWidget::doPopup);
|
this->leftMenu.addAction("Popup", this->chatWidget, &Split::doPopup);
|
||||||
this->leftMenu.addAction("Open viewer list", this->chatWidget, &ChatWidget::doOpenViewerList);
|
this->leftMenu.addAction("Open viewer list", this->chatWidget, &Split::doOpenViewerList);
|
||||||
this->leftMenu.addSeparator();
|
this->leftMenu.addSeparator();
|
||||||
this->leftMenu.addAction("Change channel", this->chatWidget, &ChatWidget::doChangeChannel,
|
this->leftMenu.addAction("Change channel", this->chatWidget, &Split::doChangeChannel,
|
||||||
QKeySequence(tr("Ctrl+R")));
|
QKeySequence(tr("Ctrl+R")));
|
||||||
this->leftMenu.addAction("Clear chat", this->chatWidget, &ChatWidget::doClearChat);
|
this->leftMenu.addAction("Clear chat", this->chatWidget, &Split::doClearChat);
|
||||||
this->leftMenu.addAction("Open channel", this->chatWidget, &ChatWidget::doOpenChannel);
|
this->leftMenu.addAction("Open channel", this->chatWidget, &Split::doOpenChannel);
|
||||||
this->leftMenu.addAction("Open popup player", this->chatWidget, &ChatWidget::doOpenPopupPlayer);
|
this->leftMenu.addAction("Open popup player", this->chatWidget, &Split::doOpenPopupPlayer);
|
||||||
this->leftMenu.addAction("Open in Streamlink", this->chatWidget, &ChatWidget::doOpenStreamlink);
|
this->leftMenu.addAction("Open in Streamlink", this->chatWidget, &Split::doOpenStreamlink);
|
||||||
this->leftMenu.addSeparator();
|
this->leftMenu.addSeparator();
|
||||||
this->leftMenu.addAction("Reload channel emotes", this, SLOT(menuReloadChannelEmotes()));
|
this->leftMenu.addAction("Reload channel emotes", this, SLOT(menuReloadChannelEmotes()));
|
||||||
this->leftMenu.addAction("Manual reconnect", this, SLOT(menuManualReconnect()));
|
this->leftMenu.addAction("Manual reconnect", this, SLOT(menuManualReconnect()));
|
||||||
|
@ -62,7 +61,7 @@ ChatWidgetHeader::ChatWidgetHeader(ChatWidget *_chatWidget)
|
||||||
this->channelNameLabel.setAlignment(Qt::AlignCenter);
|
this->channelNameLabel.setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
connect(&this->channelNameLabel, &SignalLabel::mouseDoubleClick, this,
|
connect(&this->channelNameLabel, &SignalLabel::mouseDoubleClick, this,
|
||||||
&ChatWidgetHeader::mouseDoubleClickEvent);
|
&SplitHeader::mouseDoubleClickEvent);
|
||||||
|
|
||||||
// right
|
// right
|
||||||
this->rightLabel.setMinimumWidth(this->height());
|
this->rightLabel.setMinimumWidth(this->height());
|
||||||
|
@ -76,7 +75,7 @@ ChatWidgetHeader::ChatWidgetHeader(ChatWidget *_chatWidget)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::initializeChannelSignals()
|
void SplitHeader::initializeChannelSignals()
|
||||||
{
|
{
|
||||||
// Disconnect any previous signal first
|
// Disconnect any previous signal first
|
||||||
this->onlineStatusChangedConnection.disconnect();
|
this->onlineStatusChangedConnection.disconnect();
|
||||||
|
@ -91,12 +90,12 @@ void ChatWidgetHeader::initializeChannelSignals()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::resizeEvent(QResizeEvent *event)
|
void SplitHeader::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
this->setFixedHeight(static_cast<float>(32 * getDpiMultiplier()));
|
this->setFixedHeight(static_cast<float>(28 * getDpiMultiplier()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::updateChannelText()
|
void SplitHeader::updateChannelText()
|
||||||
{
|
{
|
||||||
const std::string channelName = this->chatWidget->channelName;
|
const std::string channelName = this->chatWidget->channelName;
|
||||||
if (channelName.empty()) {
|
if (channelName.empty()) {
|
||||||
|
@ -114,9 +113,8 @@ void ChatWidgetHeader::updateChannelText()
|
||||||
"<br>"
|
"<br>"
|
||||||
"Live for " +
|
"Live for " +
|
||||||
twitchChannel->streamUptime + " with " +
|
twitchChannel->streamUptime + " with " +
|
||||||
twitchChannel->streamViewerCount +
|
twitchChannel->streamViewerCount + " viewers"
|
||||||
" viewers"
|
"</p>");
|
||||||
"</p>");
|
|
||||||
} else {
|
} else {
|
||||||
this->channelNameLabel.setText(QString::fromStdString(channelName));
|
this->channelNameLabel.setText(QString::fromStdString(channelName));
|
||||||
this->setToolTip("");
|
this->setToolTip("");
|
||||||
|
@ -124,7 +122,7 @@ void ChatWidgetHeader::updateChannelText()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::paintEvent(QPaintEvent *)
|
void SplitHeader::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
|
@ -133,23 +131,23 @@ void ChatWidgetHeader::paintEvent(QPaintEvent *)
|
||||||
painter.drawRect(0, 0, width() - 1, height() - 1);
|
painter.drawRect(0, 0, width() - 1, height() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::mousePressEvent(QMouseEvent *event)
|
void SplitHeader::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
this->dragging = true;
|
this->dragging = true;
|
||||||
|
|
||||||
this->dragStart = event->pos();
|
this->dragStart = event->pos();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::mouseMoveEvent(QMouseEvent *event)
|
void SplitHeader::mouseMoveEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (this->dragging) {
|
if (this->dragging) {
|
||||||
if (std::abs(this->dragStart.x() - event->pos().x()) > 12 ||
|
if (std::abs(this->dragStart.x() - event->pos().x()) > 12 ||
|
||||||
std::abs(this->dragStart.y() - event->pos().y()) > 12) {
|
std::abs(this->dragStart.y() - event->pos().y()) > 12) {
|
||||||
auto page = static_cast<NotebookPage *>(this->chatWidget->parentWidget());
|
auto page = static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||||
|
|
||||||
if (page != nullptr) {
|
if (page != nullptr) {
|
||||||
NotebookPage::isDraggingSplit = true;
|
SplitContainer::isDraggingSplit = true;
|
||||||
NotebookPage::draggingSplit = this->chatWidget;
|
SplitContainer::draggingSplit = this->chatWidget;
|
||||||
|
|
||||||
auto originalLocation = page->removeFromLayout(this->chatWidget);
|
auto originalLocation = page->removeFromLayout(this->chatWidget);
|
||||||
|
|
||||||
|
@ -168,20 +166,20 @@ void ChatWidgetHeader::mouseMoveEvent(QMouseEvent *event)
|
||||||
page->addToLayout(this->chatWidget, originalLocation);
|
page->addToLayout(this->chatWidget, originalLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
NotebookPage::isDraggingSplit = false;
|
SplitContainer::isDraggingSplit = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::mouseDoubleClickEvent(QMouseEvent *event)
|
void SplitHeader::mouseDoubleClickEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (event->button() == Qt::LeftButton) {
|
if (event->button() == Qt::LeftButton) {
|
||||||
this->chatWidget->doChangeChannel();
|
this->chatWidget->doChangeChannel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::leftButtonClicked()
|
void SplitHeader::leftButtonClicked()
|
||||||
{
|
{
|
||||||
QTimer::singleShot(80, [&] {
|
QTimer::singleShot(80, [&] {
|
||||||
this->leftMenu.move(this->leftLabel.mapToGlobal(QPoint(0, this->leftLabel.height())));
|
this->leftMenu.move(this->leftLabel.mapToGlobal(QPoint(0, this->leftLabel.height())));
|
||||||
|
@ -189,11 +187,11 @@ void ChatWidgetHeader::leftButtonClicked()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::rightButtonClicked()
|
void SplitHeader::rightButtonClicked()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::refreshTheme()
|
void SplitHeader::refreshTheme()
|
||||||
{
|
{
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
palette.setColor(QPalette::Foreground, this->colorScheme.Text);
|
palette.setColor(QPalette::Foreground, this->colorScheme.Text);
|
||||||
|
@ -203,19 +201,19 @@ void ChatWidgetHeader::refreshTheme()
|
||||||
this->rightLabel.setPalette(palette);
|
this->rightLabel.setPalette(palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::menuMoveSplit()
|
void SplitHeader::menuMoveSplit()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::menuReloadChannelEmotes()
|
void SplitHeader::menuReloadChannelEmotes()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::menuManualReconnect()
|
void SplitHeader::menuManualReconnect()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetHeader::menuShowChangelog()
|
void SplitHeader::menuShowChangelog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "signallabel.hpp"
|
|
||||||
#include "widgets/basewidget.hpp"
|
#include "widgets/basewidget.hpp"
|
||||||
#include "widgets/rippleeffectlabel.hpp"
|
#include "widgets/helper/rippleeffectlabel.hpp"
|
||||||
|
#include "widgets/helper/signallabel.hpp"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
@ -20,14 +20,14 @@ class ColorScheme;
|
||||||
|
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
class ChatWidget;
|
class Split;
|
||||||
|
|
||||||
class ChatWidgetHeader : public BaseWidget
|
class SplitHeader : public BaseWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ChatWidgetHeader(ChatWidget *_chatWidget);
|
explicit SplitHeader(Split *_chatWidget);
|
||||||
// Update channel text from chat widget
|
// Update channel text from chat widget
|
||||||
void updateChannelText();
|
void updateChannelText();
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ protected:
|
||||||
virtual void resizeEvent(QResizeEvent *event) override;
|
virtual void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ChatWidget *const chatWidget;
|
Split *const chatWidget;
|
||||||
|
|
||||||
QPoint dragStart;
|
QPoint dragStart;
|
||||||
bool dragging = false;
|
bool dragging = false;
|
|
@ -1,11 +1,11 @@
|
||||||
#include "widgets/chatwidgetinput.hpp"
|
#include "widgets/helper/splitinput.hpp"
|
||||||
#include "chatwidget.hpp"
|
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "completionmanager.hpp"
|
#include "completionmanager.hpp"
|
||||||
#include "ircmanager.hpp"
|
#include "ircmanager.hpp"
|
||||||
#include "notebook.hpp"
|
|
||||||
#include "notebookpage.hpp"
|
|
||||||
#include "settingsmanager.hpp"
|
#include "settingsmanager.hpp"
|
||||||
|
#include "widgets/notebook.hpp"
|
||||||
|
#include "widgets/split.hpp"
|
||||||
|
#include "widgets/splitcontainer.hpp"
|
||||||
|
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
@ -13,8 +13,7 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget, EmoteManager &emoteManager,
|
SplitInput::SplitInput(Split *_chatWidget, EmoteManager &emoteManager, WindowManager &windowManager)
|
||||||
WindowManager &windowManager)
|
|
||||||
: BaseWidget(_chatWidget)
|
: BaseWidget(_chatWidget)
|
||||||
, chatWidget(_chatWidget)
|
, chatWidget(_chatWidget)
|
||||||
, emoteManager(emoteManager)
|
, emoteManager(emoteManager)
|
||||||
|
@ -65,7 +64,7 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget, EmoteManager &emoteMan
|
||||||
this->emotePopup->show();
|
this->emotePopup->show();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(&textInput, &ResizingTextEdit::textChanged, this, &ChatWidgetInput::editTextChanged);
|
connect(&textInput, &ResizingTextEdit::textChanged, this, &SplitInput::editTextChanged);
|
||||||
|
|
||||||
this->refreshTheme();
|
this->refreshTheme();
|
||||||
textLengthLabel.setHidden(!SettingsManager::getInstance().showMessageLength.get());
|
textLengthLabel.setHidden(!SettingsManager::getInstance().showMessageLength.get());
|
||||||
|
@ -96,7 +95,8 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget, EmoteManager &emoteMan
|
||||||
prevIndex = prevMsg.size();
|
prevIndex = prevMsg.size();
|
||||||
} else if (event->key() == Qt::Key_Up) {
|
} else if (event->key() == Qt::Key_Up) {
|
||||||
if (event->modifiers() == Qt::AltModifier) {
|
if (event->modifiers() == Qt::AltModifier) {
|
||||||
NotebookPage *page = static_cast<NotebookPage *>(this->chatWidget->parentWidget());
|
SplitContainer *page =
|
||||||
|
static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||||
|
|
||||||
int reqX = page->currentX;
|
int reqX = page->currentX;
|
||||||
int reqY = page->lastRequestedY[reqX] - 1;
|
int reqY = page->lastRequestedY[reqX] - 1;
|
||||||
|
@ -112,7 +112,8 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget, EmoteManager &emoteMan
|
||||||
}
|
}
|
||||||
} else if (event->key() == Qt::Key_Down) {
|
} else if (event->key() == Qt::Key_Down) {
|
||||||
if (event->modifiers() == Qt::AltModifier) {
|
if (event->modifiers() == Qt::AltModifier) {
|
||||||
NotebookPage *page = static_cast<NotebookPage *>(this->chatWidget->parentWidget());
|
SplitContainer *page =
|
||||||
|
static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||||
|
|
||||||
int reqX = page->currentX;
|
int reqX = page->currentX;
|
||||||
int reqY = page->lastRequestedY[reqX] + 1;
|
int reqY = page->lastRequestedY[reqX] + 1;
|
||||||
|
@ -131,7 +132,8 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget, EmoteManager &emoteMan
|
||||||
}
|
}
|
||||||
} else if (event->key() == Qt::Key_Left) {
|
} else if (event->key() == Qt::Key_Left) {
|
||||||
if (event->modifiers() == Qt::AltModifier) {
|
if (event->modifiers() == Qt::AltModifier) {
|
||||||
NotebookPage *page = static_cast<NotebookPage *>(this->chatWidget->parentWidget());
|
SplitContainer *page =
|
||||||
|
static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||||
|
|
||||||
int reqX = page->currentX - 1;
|
int reqX = page->currentX - 1;
|
||||||
int reqY = page->lastRequestedY[reqX];
|
int reqY = page->lastRequestedY[reqX];
|
||||||
|
@ -142,7 +144,8 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget, EmoteManager &emoteMan
|
||||||
}
|
}
|
||||||
} else if (event->key() == Qt::Key_Right) {
|
} else if (event->key() == Qt::Key_Right) {
|
||||||
if (event->modifiers() == Qt::AltModifier) {
|
if (event->modifiers() == Qt::AltModifier) {
|
||||||
NotebookPage *page = static_cast<NotebookPage *>(this->chatWidget->parentWidget());
|
SplitContainer *page =
|
||||||
|
static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||||
|
|
||||||
int reqX = page->currentX + 1;
|
int reqX = page->currentX + 1;
|
||||||
int reqY = page->lastRequestedY[reqX];
|
int reqY = page->lastRequestedY[reqX];
|
||||||
|
@ -153,7 +156,8 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget, EmoteManager &emoteMan
|
||||||
}
|
}
|
||||||
} else if (event->key() == Qt::Key_Tab) {
|
} else if (event->key() == Qt::Key_Tab) {
|
||||||
if (event->modifiers() == Qt::ControlModifier) {
|
if (event->modifiers() == Qt::ControlModifier) {
|
||||||
NotebookPage *page = static_cast<NotebookPage *>(this->chatWidget->parentWidget());
|
SplitContainer *page =
|
||||||
|
static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||||
|
|
||||||
Notebook *notebook = static_cast<Notebook *>(page->parentWidget());
|
Notebook *notebook = static_cast<Notebook *>(page->parentWidget());
|
||||||
|
|
||||||
|
@ -161,7 +165,8 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget, EmoteManager &emoteMan
|
||||||
}
|
}
|
||||||
} else if (event->key() == Qt::Key_Backtab) {
|
} else if (event->key() == Qt::Key_Backtab) {
|
||||||
if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)) {
|
if (event->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)) {
|
||||||
NotebookPage *page = static_cast<NotebookPage *>(this->chatWidget->parentWidget());
|
SplitContainer *page =
|
||||||
|
static_cast<SplitContainer *>(this->chatWidget->parentWidget());
|
||||||
|
|
||||||
Notebook *notebook = static_cast<Notebook *>(page->parentWidget());
|
Notebook *notebook = static_cast<Notebook *>(page->parentWidget());
|
||||||
|
|
||||||
|
@ -186,12 +191,12 @@ ChatWidgetInput::ChatWidgetInput(ChatWidget *_chatWidget, EmoteManager &emoteMan
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatWidgetInput::~ChatWidgetInput()
|
SplitInput::~SplitInput()
|
||||||
{
|
{
|
||||||
this->textLengthVisibleChangedConnection.disconnect();
|
this->textLengthVisibleChangedConnection.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetInput::clearSelection()
|
void SplitInput::clearSelection()
|
||||||
{
|
{
|
||||||
QTextCursor c = this->textInput.textCursor();
|
QTextCursor c = this->textInput.textCursor();
|
||||||
|
|
||||||
|
@ -201,7 +206,7 @@ void ChatWidgetInput::clearSelection()
|
||||||
this->textInput.setTextCursor(c);
|
this->textInput.setTextCursor(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetInput::refreshTheme()
|
void SplitInput::refreshTheme()
|
||||||
{
|
{
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
|
|
||||||
|
@ -212,11 +217,11 @@ void ChatWidgetInput::refreshTheme()
|
||||||
this->textInput.setStyleSheet(this->colorScheme.InputStyleSheet);
|
this->textInput.setStyleSheet(this->colorScheme.InputStyleSheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetInput::editTextChanged()
|
void SplitInput::editTextChanged()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetInput::paintEvent(QPaintEvent *)
|
void SplitInput::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
|
@ -225,7 +230,7 @@ void ChatWidgetInput::paintEvent(QPaintEvent *)
|
||||||
painter.drawRect(0, 0, this->width() - 1, this->height() - 1);
|
painter.drawRect(0, 0, this->width() - 1, this->height() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetInput::resizeEvent(QResizeEvent *)
|
void SplitInput::resizeEvent(QResizeEvent *)
|
||||||
{
|
{
|
||||||
if (this->height() == this->maximumHeight()) {
|
if (this->height() == this->maximumHeight()) {
|
||||||
this->textInput.setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
this->textInput.setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
@ -234,7 +239,7 @@ void ChatWidgetInput::resizeEvent(QResizeEvent *)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidgetInput::mousePressEvent(QMouseEvent *)
|
void SplitInput::mousePressEvent(QMouseEvent *)
|
||||||
{
|
{
|
||||||
this->chatWidget->giveFocus(Qt::MouseFocusReason);
|
this->chatWidget->giveFocus(Qt::MouseFocusReason);
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@
|
||||||
#include "resizingtextedit.hpp"
|
#include "resizingtextedit.hpp"
|
||||||
#include "widgets/basewidget.hpp"
|
#include "widgets/basewidget.hpp"
|
||||||
#include "widgets/emotepopup.hpp"
|
#include "widgets/emotepopup.hpp"
|
||||||
#include "widgets/rippleeffectlabel.hpp"
|
#include "widgets/helper/rippleeffectlabel.hpp"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -19,15 +19,15 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
class ChatWidget;
|
class Split;
|
||||||
|
|
||||||
class ChatWidgetInput : public BaseWidget
|
class SplitInput : public BaseWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChatWidgetInput(ChatWidget *_chatWidget, EmoteManager &, WindowManager &);
|
SplitInput(Split *_chatWidget, EmoteManager &, WindowManager &);
|
||||||
~ChatWidgetInput();
|
~SplitInput();
|
||||||
|
|
||||||
void clearSelection();
|
void clearSelection();
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ protected:
|
||||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ChatWidget *const chatWidget;
|
Split *const chatWidget;
|
||||||
EmotePopup *emotePopup = nullptr;
|
EmotePopup *emotePopup = nullptr;
|
||||||
EmoteManager &emoteManager;
|
EmoteManager &emoteManager;
|
||||||
WindowManager &windowManager;
|
WindowManager &windowManager;
|
||||||
|
@ -57,7 +57,7 @@ private:
|
||||||
private slots:
|
private slots:
|
||||||
void editTextChanged();
|
void editTextChanged();
|
||||||
|
|
||||||
friend class ChatWidget;
|
friend class Split;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
|
@ -1,10 +1,10 @@
|
||||||
#include "widgets/notebook.hpp"
|
#include "widgets/notebook.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "widgets/mainwindow.hpp"
|
#include "widgets/helper/notebookbutton.hpp"
|
||||||
#include "widgets/notebookbutton.hpp"
|
#include "widgets/helper/notebooktab.hpp"
|
||||||
#include "widgets/notebookpage.hpp"
|
|
||||||
#include "widgets/notebooktab.hpp"
|
|
||||||
#include "widgets/settingsdialog.hpp"
|
#include "widgets/settingsdialog.hpp"
|
||||||
|
#include "widgets/splitcontainer.hpp"
|
||||||
|
#include "widgets/window.hpp"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
@ -19,13 +19,14 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
Notebook::Notebook(ChannelManager &_channelManager, MainWindow *parent)
|
Notebook::Notebook(ChannelManager &_channelManager, Window *parent, bool _showButtons)
|
||||||
: BaseWidget(parent)
|
: BaseWidget(parent)
|
||||||
, channelManager(_channelManager)
|
, channelManager(_channelManager)
|
||||||
, completionManager(parent->completionManager)
|
, completionManager(parent->completionManager)
|
||||||
, addButton(this)
|
, addButton(this)
|
||||||
, settingsButton(this)
|
, settingsButton(this)
|
||||||
, userButton(this)
|
, userButton(this)
|
||||||
|
, showButtons(_showButtons)
|
||||||
{
|
{
|
||||||
this->connect(&this->settingsButton, SIGNAL(clicked()), this, SLOT(settingsButtonClicked()));
|
this->connect(&this->settingsButton, SIGNAL(clicked()), this, SLOT(settingsButtonClicked()));
|
||||||
this->connect(&this->userButton, SIGNAL(clicked()), this, SLOT(usersButtonClicked()));
|
this->connect(&this->userButton, SIGNAL(clicked()), this, SLOT(usersButtonClicked()));
|
||||||
|
@ -42,10 +43,10 @@ Notebook::Notebook(ChannelManager &_channelManager, MainWindow *parent)
|
||||||
[this](const bool &) { this->performLayout(); });
|
[this](const bool &) { this->performLayout(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
NotebookPage *Notebook::addPage(bool select)
|
SplitContainer *Notebook::addPage(bool select)
|
||||||
{
|
{
|
||||||
auto tab = new NotebookTab(this);
|
auto tab = new NotebookTab(this);
|
||||||
auto page = new NotebookPage(this->channelManager, this, tab);
|
auto page = new SplitContainer(this->channelManager, this, tab);
|
||||||
|
|
||||||
tab->show();
|
tab->show();
|
||||||
|
|
||||||
|
@ -60,7 +61,7 @@ NotebookPage *Notebook::addPage(bool select)
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notebook::removePage(NotebookPage *page)
|
void Notebook::removePage(SplitContainer *page)
|
||||||
{
|
{
|
||||||
int index = this->pages.indexOf(page);
|
int index = this->pages.indexOf(page);
|
||||||
|
|
||||||
|
@ -84,7 +85,7 @@ void Notebook::removePage(NotebookPage *page)
|
||||||
this->performLayout();
|
this->performLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notebook::select(NotebookPage *page)
|
void Notebook::select(SplitContainer *page)
|
||||||
{
|
{
|
||||||
if (page == this->selectedPage) {
|
if (page == this->selectedPage) {
|
||||||
return;
|
return;
|
||||||
|
@ -106,7 +107,7 @@ void Notebook::select(NotebookPage *page)
|
||||||
this->performLayout();
|
this->performLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
NotebookPage *Notebook::tabAt(QPoint point, int &index)
|
SplitContainer *Notebook::tabAt(QPoint point, int &index)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
@ -123,7 +124,7 @@ NotebookPage *Notebook::tabAt(QPoint point, int &index)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Notebook::rearrangePage(NotebookPage *page, int index)
|
void Notebook::rearrangePage(SplitContainer *page, int index)
|
||||||
{
|
{
|
||||||
this->pages.move(this->pages.indexOf(page), index);
|
this->pages.move(this->pages.indexOf(page), index);
|
||||||
|
|
||||||
|
@ -161,13 +162,13 @@ void Notebook::performLayout(bool animated)
|
||||||
int x = 0, y = 0;
|
int x = 0, y = 0;
|
||||||
float scale = this->getDpiMultiplier();
|
float scale = this->getDpiMultiplier();
|
||||||
|
|
||||||
if (SettingsManager::getInstance().hidePreferencesButton.get()) {
|
if (!showButtons || SettingsManager::getInstance().hidePreferencesButton.get()) {
|
||||||
this->settingsButton.hide();
|
this->settingsButton.hide();
|
||||||
} else {
|
} else {
|
||||||
this->settingsButton.show();
|
this->settingsButton.show();
|
||||||
x += settingsButton.width();
|
x += settingsButton.width();
|
||||||
}
|
}
|
||||||
if (SettingsManager::getInstance().hideUserButton.get()) {
|
if (!showButtons || SettingsManager::getInstance().hideUserButton.get()) {
|
||||||
this->userButton.hide();
|
this->userButton.hide();
|
||||||
} else {
|
} else {
|
||||||
this->userButton.move(x, 0);
|
this->userButton.move(x, 0);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "widgets/basewidget.hpp"
|
#include "widgets/basewidget.hpp"
|
||||||
#include "widgets/notebookbutton.hpp"
|
#include "widgets/helper/notebookbutton.hpp"
|
||||||
#include "widgets/notebookpage.hpp"
|
#include "widgets/helper/notebooktab.hpp"
|
||||||
#include "widgets/notebooktab.hpp"
|
#include "widgets/splitcontainer.hpp"
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
@ -16,7 +16,7 @@ class CompletionManager;
|
||||||
|
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
class MainWindow;
|
class Window;
|
||||||
|
|
||||||
class Notebook : public BaseWidget
|
class Notebook : public BaseWidget
|
||||||
{
|
{
|
||||||
|
@ -25,22 +25,22 @@ class Notebook : public BaseWidget
|
||||||
public:
|
public:
|
||||||
enum HighlightType { none, highlighted, newMessage };
|
enum HighlightType { none, highlighted, newMessage };
|
||||||
|
|
||||||
explicit Notebook(ChannelManager &_channelManager, MainWindow *parent);
|
explicit Notebook(ChannelManager &_channelManager, Window *parent, bool showButtons);
|
||||||
|
|
||||||
NotebookPage *addPage(bool select = false);
|
SplitContainer *addPage(bool select = false);
|
||||||
|
|
||||||
void removePage(NotebookPage *page);
|
void removePage(SplitContainer *page);
|
||||||
void select(NotebookPage *page);
|
void select(SplitContainer *page);
|
||||||
|
|
||||||
NotebookPage *getSelectedPage() const
|
SplitContainer *getSelectedPage() const
|
||||||
{
|
{
|
||||||
return selectedPage;
|
return selectedPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void performLayout(bool animate = true);
|
void performLayout(bool animate = true);
|
||||||
|
|
||||||
NotebookPage *tabAt(QPoint point, int &index);
|
SplitContainer *tabAt(QPoint point, int &index);
|
||||||
void rearrangePage(NotebookPage *page, int index);
|
void rearrangePage(SplitContainer *page, int index);
|
||||||
|
|
||||||
void nextTab();
|
void nextTab();
|
||||||
void previousTab();
|
void previousTab();
|
||||||
|
@ -60,13 +60,15 @@ public:
|
||||||
CompletionManager &completionManager;
|
CompletionManager &completionManager;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<NotebookPage *> pages;
|
QList<SplitContainer *> pages;
|
||||||
|
|
||||||
NotebookButton addButton;
|
NotebookButton addButton;
|
||||||
NotebookButton settingsButton;
|
NotebookButton settingsButton;
|
||||||
NotebookButton userButton;
|
NotebookButton userButton;
|
||||||
|
|
||||||
NotebookPage *selectedPage = nullptr;
|
SplitContainer *selectedPage = nullptr;
|
||||||
|
|
||||||
|
bool showButtons;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void load(const boost::property_tree::ptree &tree);
|
void load(const boost::property_tree::ptree &tree);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "widgets/scrollbar.hpp"
|
#include "widgets/scrollbar.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "widgets/channelview.hpp"
|
#include "widgets/helper/channelview.hpp"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "widgets/basewidget.hpp"
|
#include "widgets/basewidget.hpp"
|
||||||
#include "widgets/scrollbarhighlight.hpp"
|
#include "widgets/helper/scrollbarhighlight.hpp"
|
||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#include "accountmanager.hpp"
|
#include "accountmanager.hpp"
|
||||||
#include "twitch/twitchmessagebuilder.hpp"
|
#include "twitch/twitchmessagebuilder.hpp"
|
||||||
#include "twitch/twitchuser.hpp"
|
#include "twitch/twitchuser.hpp"
|
||||||
|
#include "widgets/helper/settingsdialogtab.hpp"
|
||||||
#include "widgets/logindialog.hpp"
|
#include "widgets/logindialog.hpp"
|
||||||
#include "widgets/settingsdialogtab.hpp"
|
|
||||||
#include "windowmanager.hpp"
|
#include "windowmanager.hpp"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
@ -176,7 +176,6 @@ QVBoxLayout *SettingsDialog::createAppearanceTab()
|
||||||
fontLayout->addWidget(fontFamilyLabel);
|
fontLayout->addWidget(fontFamilyLabel);
|
||||||
fontLayout->addWidget(fontSizeLabel);
|
fontLayout->addWidget(fontSizeLabel);
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto &fontManager = FontManager::getInstance();
|
auto &fontManager = FontManager::getInstance();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "settingsmanager.hpp"
|
#include "settingsmanager.hpp"
|
||||||
#include "settingssnapshot.hpp"
|
#include "settingssnapshot.hpp"
|
||||||
#include "widgets/settingsdialogtab.hpp"
|
#include "widgets/helper/settingsdialogtab.hpp"
|
||||||
|
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
#include "widgets/chatwidget.hpp"
|
#include "widgets/split.hpp"
|
||||||
#include "channelmanager.hpp"
|
#include "channelmanager.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "notebookpage.hpp"
|
|
||||||
#include "settingsmanager.hpp"
|
#include "settingsmanager.hpp"
|
||||||
#include "twitch/twitchmessagebuilder.hpp"
|
#include "twitch/twitchmessagebuilder.hpp"
|
||||||
#include "util/urlfetch.hpp"
|
#include "util/urlfetch.hpp"
|
||||||
#include "widgets/qualitypopup.hpp"
|
#include "widgets/qualitypopup.hpp"
|
||||||
|
#include "widgets/splitcontainer.hpp"
|
||||||
#include "widgets/textinputdialog.hpp"
|
#include "widgets/textinputdialog.hpp"
|
||||||
|
#include "widgets/window.hpp"
|
||||||
|
#include "windowmanager.hpp"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
@ -34,7 +36,7 @@ namespace widgets {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void ezShortcut(ChatWidget *w, const char *key, T t)
|
inline void ezShortcut(Split *w, const char *key, T t)
|
||||||
{
|
{
|
||||||
auto s = new QShortcut(QKeySequence(key), w);
|
auto s = new QShortcut(QKeySequence(key), w);
|
||||||
s->setContext(Qt::WidgetWithChildrenShortcut);
|
s->setContext(Qt::WidgetWithChildrenShortcut);
|
||||||
|
@ -45,17 +47,19 @@ inline void ezShortcut(ChatWidget *w, const char *key, T t)
|
||||||
|
|
||||||
static int index = 0;
|
static int index = 0;
|
||||||
|
|
||||||
ChatWidget::ChatWidget(ChannelManager &_channelManager, NotebookPage *parent)
|
Split::Split(ChannelManager &_channelManager, SplitContainer *parent)
|
||||||
: BaseWidget(parent)
|
: BaseWidget(parent)
|
||||||
|
, channelName("/chatWidgets/" + std::to_string(index++) + "/channelName")
|
||||||
, parentPage(*parent)
|
, parentPage(*parent)
|
||||||
, channelManager(_channelManager)
|
, channelManager(_channelManager)
|
||||||
, completionManager(parent->completionManager)
|
, completionManager(parent->completionManager)
|
||||||
, channelName("/chatWidgets/" + std::to_string(index++) + "/channelName")
|
|
||||||
, channel(_channelManager.emptyChannel)
|
, channel(_channelManager.emptyChannel)
|
||||||
, vbox(this)
|
, vbox(this)
|
||||||
, header(this)
|
, header(this)
|
||||||
, view(_channelManager.getWindowManager(), this)
|
, view(_channelManager.getWindowManager(), this)
|
||||||
, input(this, _channelManager.getEmoteManager(), _channelManager.getWindowManager())
|
, input(this, _channelManager.getEmoteManager(), _channelManager.getWindowManager())
|
||||||
|
, flexSizeX(1)
|
||||||
|
, flexSizeY(1)
|
||||||
{
|
{
|
||||||
this->vbox.setSpacing(0);
|
this->vbox.setSpacing(0);
|
||||||
this->vbox.setMargin(1);
|
this->vbox.setMargin(1);
|
||||||
|
@ -66,21 +70,27 @@ ChatWidget::ChatWidget(ChannelManager &_channelManager, NotebookPage *parent)
|
||||||
|
|
||||||
// Initialize chat widget-wide hotkeys
|
// Initialize chat widget-wide hotkeys
|
||||||
// CTRL+T: Create new split (Add page)
|
// CTRL+T: Create new split (Add page)
|
||||||
ezShortcut(this, "CTRL+T", &ChatWidget::doAddSplit);
|
ezShortcut(this, "CTRL+T", &Split::doAddSplit);
|
||||||
|
|
||||||
// CTRL+W: Close Split
|
// CTRL+W: Close Split
|
||||||
ezShortcut(this, "CTRL+W", &ChatWidget::doCloseSplit);
|
ezShortcut(this, "CTRL+W", &Split::doCloseSplit);
|
||||||
|
|
||||||
// CTRL+R: Change Channel
|
// CTRL+R: Change Channel
|
||||||
ezShortcut(this, "CTRL+R", &ChatWidget::doChangeChannel);
|
ezShortcut(this, "CTRL+R", &Split::doChangeChannel);
|
||||||
|
|
||||||
|
// xd
|
||||||
|
//ezShortcut(this, "ALT+SHIFT+RIGHT", &Split::doIncFlexX);
|
||||||
|
//ezShortcut(this, "ALT+SHIFT+LEFT", &Split::doDecFlexX);
|
||||||
|
//ezShortcut(this, "ALT+SHIFT+UP", &Split::doIncFlexY);
|
||||||
|
//ezShortcut(this, "ALT+SHIFT+DOWN", &Split::doDecFlexY);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
// F12: Toggle message spawning
|
// F12: Toggle message spawning
|
||||||
ezShortcut(this, "ALT+Q", &ChatWidget::doToggleMessageSpawning);
|
ezShortcut(this, "ALT+Q", &Split::doToggleMessageSpawning);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
this->channelName.getValueChangedSignal().connect(
|
this->channelName.getValueChangedSignal().connect(
|
||||||
std::bind(&ChatWidget::channelNameUpdated, this, std::placeholders::_1));
|
std::bind(&Split::channelNameUpdated, this, std::placeholders::_1));
|
||||||
|
|
||||||
this->channelNameUpdated(this->channelName.getValue());
|
this->channelNameUpdated(this->channelName.getValue());
|
||||||
|
|
||||||
|
@ -94,26 +104,26 @@ ChatWidget::ChatWidget(ChannelManager &_channelManager, NotebookPage *parent)
|
||||||
});
|
});
|
||||||
|
|
||||||
QTimer *timer = new QTimer(this);
|
QTimer *timer = new QTimer(this);
|
||||||
connect(timer, &QTimer::timeout, this, &ChatWidget::test);
|
connect(timer, &QTimer::timeout, this, &Split::test);
|
||||||
timer->start(1000);
|
timer->start(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatWidget::~ChatWidget()
|
Split::~Split()
|
||||||
{
|
{
|
||||||
this->channelNameUpdated("");
|
this->channelNameUpdated("");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Channel> ChatWidget::getChannel() const
|
std::shared_ptr<Channel> Split::getChannel() const
|
||||||
{
|
{
|
||||||
return this->channel;
|
return this->channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Channel> &ChatWidget::getChannelRef()
|
std::shared_ptr<Channel> &Split::getChannelRef()
|
||||||
{
|
{
|
||||||
return this->channel;
|
return this->channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::setChannel(std::shared_ptr<Channel> _newChannel)
|
void Split::setChannel(std::shared_ptr<Channel> _newChannel)
|
||||||
{
|
{
|
||||||
this->view.setChannel(_newChannel);
|
this->view.setChannel(_newChannel);
|
||||||
|
|
||||||
|
@ -122,7 +132,29 @@ void ChatWidget::setChannel(std::shared_ptr<Channel> _newChannel)
|
||||||
this->channelChanged();
|
this->channelChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::channelNameUpdated(const std::string &newChannelName)
|
void Split::setFlexSizeX(double x)
|
||||||
|
{
|
||||||
|
this->flexSizeX = x;
|
||||||
|
this->parentPage.updateFlexValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
double Split::getFlexSizeX()
|
||||||
|
{
|
||||||
|
return this->flexSizeX;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Split::setFlexSizeY(double y)
|
||||||
|
{
|
||||||
|
this->flexSizeY = y;
|
||||||
|
this->parentPage.updateFlexValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
double Split::getFlexSizeY()
|
||||||
|
{
|
||||||
|
return this->flexSizeY;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Split::channelNameUpdated(const std::string &newChannelName)
|
||||||
{
|
{
|
||||||
// remove current channel
|
// remove current channel
|
||||||
if (!this->channel->isEmpty()) {
|
if (!this->channel->isEmpty()) {
|
||||||
|
@ -141,7 +173,7 @@ void ChatWidget::channelNameUpdated(const std::string &newChannelName)
|
||||||
this->header.updateChannelText();
|
this->header.updateChannelText();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatWidget::showChangeChannelPopup(const char *dialogTitle, bool empty)
|
bool Split::showChangeChannelPopup(const char *dialogTitle, bool empty)
|
||||||
{
|
{
|
||||||
// create new input dialog and execute it
|
// create new input dialog and execute it
|
||||||
TextInputDialog dialog(this);
|
TextInputDialog dialog(this);
|
||||||
|
@ -164,27 +196,27 @@ bool ChatWidget::showChangeChannelPopup(const char *dialogTitle, bool empty)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::layoutMessages()
|
void Split::layoutMessages()
|
||||||
{
|
{
|
||||||
this->view.layoutMessages();
|
this->view.layoutMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::updateGifEmotes()
|
void Split::updateGifEmotes()
|
||||||
{
|
{
|
||||||
this->view.updateGifEmotes();
|
this->view.updateGifEmotes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::giveFocus(Qt::FocusReason reason)
|
void Split::giveFocus(Qt::FocusReason reason)
|
||||||
{
|
{
|
||||||
this->input.textInput.setFocus(reason);
|
this->input.textInput.setFocus(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatWidget::hasFocus() const
|
bool Split::hasFocus() const
|
||||||
{
|
{
|
||||||
return this->input.textInput.hasFocus();
|
return this->input.textInput.hasFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::paintEvent(QPaintEvent *)
|
void Split::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
// color the background of the chat
|
// color the background of the chat
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
@ -192,7 +224,7 @@ void ChatWidget::paintEvent(QPaintEvent *)
|
||||||
painter.fillRect(this->rect(), this->colorScheme.ChatBackground);
|
painter.fillRect(this->rect(), this->colorScheme.ChatBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::load(const boost::property_tree::ptree &tree)
|
void Split::load(const boost::property_tree::ptree &tree)
|
||||||
{
|
{
|
||||||
// load tab text
|
// load tab text
|
||||||
try {
|
try {
|
||||||
|
@ -201,7 +233,7 @@ void ChatWidget::load(const boost::property_tree::ptree &tree)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::property_tree::ptree ChatWidget::save()
|
boost::property_tree::ptree Split::save()
|
||||||
{
|
{
|
||||||
boost::property_tree::ptree tree;
|
boost::property_tree::ptree tree;
|
||||||
|
|
||||||
|
@ -211,19 +243,19 @@ boost::property_tree::ptree ChatWidget::save()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Slots
|
/// Slots
|
||||||
void ChatWidget::doAddSplit()
|
void Split::doAddSplit()
|
||||||
{
|
{
|
||||||
NotebookPage *page = static_cast<NotebookPage *>(this->parentWidget());
|
SplitContainer *page = static_cast<SplitContainer *>(this->parentWidget());
|
||||||
page->addChat(true);
|
page->addChat(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::doCloseSplit()
|
void Split::doCloseSplit()
|
||||||
{
|
{
|
||||||
NotebookPage *page = static_cast<NotebookPage *>(this->parentWidget());
|
SplitContainer *page = static_cast<SplitContainer *>(this->parentWidget());
|
||||||
page->removeFromLayout(this);
|
page->removeFromLayout(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::doChangeChannel()
|
void Split::doChangeChannel()
|
||||||
{
|
{
|
||||||
this->showChangeChannelPopup("Change channel");
|
this->showChangeChannelPopup("Change channel");
|
||||||
auto popup = this->findChildren<QDockWidget *>();
|
auto popup = this->findChildren<QDockWidget *>();
|
||||||
|
@ -233,33 +265,37 @@ void ChatWidget::doChangeChannel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::doPopup()
|
void Split::doPopup()
|
||||||
{
|
{
|
||||||
// TODO: Copy signals and stuff too
|
Window &window = WindowManager::instance->createWindow();
|
||||||
auto widget =
|
|
||||||
new ChatWidget(this->channelManager, static_cast<NotebookPage *>(this->parentWidget()));
|
Split *split = new Split(this->channelManager,
|
||||||
widget->channelName = this->channelName;
|
static_cast<SplitContainer *>(window.getNotebook().getSelectedPage()));
|
||||||
widget->show();
|
split->channelName = this->channelName.getValue();
|
||||||
|
|
||||||
|
window.getNotebook().getSelectedPage()->addToLayout(split);
|
||||||
|
|
||||||
|
window.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::doClearChat()
|
void Split::doClearChat()
|
||||||
{
|
{
|
||||||
view.clearMessages();
|
view.clearMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::doOpenChannel()
|
void Split::doOpenChannel()
|
||||||
{
|
{
|
||||||
qDebug() << "[UNIMPLEMENTED] Open twitch.tv/"
|
qDebug() << "[UNIMPLEMENTED] Open twitch.tv/"
|
||||||
<< QString::fromStdString(this->channelName.getValue());
|
<< QString::fromStdString(this->channelName.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::doOpenPopupPlayer()
|
void Split::doOpenPopupPlayer()
|
||||||
{
|
{
|
||||||
qDebug() << "[UNIMPLEMENTED] Open twitch.tv/"
|
qDebug() << "[UNIMPLEMENTED] Open twitch.tv/"
|
||||||
<< QString::fromStdString(this->channelName.getValue()) << "/popout";
|
<< QString::fromStdString(this->channelName.getValue()) << "/popout";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::doOpenStreamlink()
|
void Split::doOpenStreamlink()
|
||||||
{
|
{
|
||||||
SettingsManager &settings = SettingsManager::getInstance();
|
SettingsManager &settings = SettingsManager::getInstance();
|
||||||
QString preferredQuality =
|
QString preferredQuality =
|
||||||
|
@ -326,7 +362,7 @@ void ChatWidget::doOpenStreamlink()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::doOpenViewerList()
|
void Split::doOpenViewerList()
|
||||||
{
|
{
|
||||||
auto viewerDock = new QDockWidget("Viewer List", this);
|
auto viewerDock = new QDockWidget("Viewer List", this);
|
||||||
viewerDock->setAllowedAreas(Qt::LeftDockWidgetArea);
|
viewerDock->setAllowedAreas(Qt::LeftDockWidgetArea);
|
||||||
|
@ -412,7 +448,7 @@ void ChatWidget::doOpenViewerList()
|
||||||
viewerDock->show();
|
viewerDock->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::doOpenAccountPopupWidget(AccountPopupWidget *widget, QString user)
|
void Split::doOpenAccountPopupWidget(AccountPopupWidget *widget, QString user)
|
||||||
{
|
{
|
||||||
widget->setName(user);
|
widget->setName(user);
|
||||||
widget->move(QCursor::pos());
|
widget->move(QCursor::pos());
|
||||||
|
@ -421,7 +457,7 @@ void ChatWidget::doOpenAccountPopupWidget(AccountPopupWidget *widget, QString us
|
||||||
widget->setFocus();
|
widget->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::doCopy()
|
void Split::doCopy()
|
||||||
{
|
{
|
||||||
QApplication::clipboard()->setText(this->view.getSelectedText());
|
QApplication::clipboard()->setText(this->view.getSelectedText());
|
||||||
}
|
}
|
||||||
|
@ -466,7 +502,7 @@ static Iter select_randomly(Iter start, Iter end)
|
||||||
return select_randomly(start, end, gen);
|
return select_randomly(start, end, gen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::test()
|
void Split::test()
|
||||||
{
|
{
|
||||||
if (this->testEnabled) {
|
if (this->testEnabled) {
|
||||||
messages::MessageParseArgs args;
|
messages::MessageParseArgs args;
|
||||||
|
@ -496,10 +532,29 @@ void ChatWidget::test()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatWidget::doToggleMessageSpawning()
|
void Split::doToggleMessageSpawning()
|
||||||
{
|
{
|
||||||
this->testEnabled = !this->testEnabled;
|
this->testEnabled = !this->testEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Split::doIncFlexX()
|
||||||
|
{
|
||||||
|
this->setFlexSizeX(this->getFlexSizeX() * 1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Split::doDecFlexX()
|
||||||
|
{
|
||||||
|
this->setFlexSizeX(this->getFlexSizeX() * (1 / 1.2));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Split::doIncFlexY()
|
||||||
|
{
|
||||||
|
this->setFlexSizeY(this->getFlexSizeY() * 1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Split::doDecFlexY()
|
||||||
|
{
|
||||||
|
this->setFlexSizeY(this->getFlexSizeY() * (1 / 1.2));
|
||||||
|
}
|
||||||
} // namespace widgets
|
} // namespace widgets
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
|
@ -6,10 +6,10 @@
|
||||||
#include "messages/word.hpp"
|
#include "messages/word.hpp"
|
||||||
#include "messages/wordpart.hpp"
|
#include "messages/wordpart.hpp"
|
||||||
#include "widgets/basewidget.hpp"
|
#include "widgets/basewidget.hpp"
|
||||||
#include "widgets/channelview.hpp"
|
#include "widgets/helper/channelview.hpp"
|
||||||
#include "widgets/chatwidgetheader.hpp"
|
#include "widgets/helper/rippleeffectlabel.hpp"
|
||||||
#include "widgets/chatwidgetinput.hpp"
|
#include "widgets/helper/splitheader.hpp"
|
||||||
#include "widgets/rippleeffectlabel.hpp"
|
#include "widgets/helper/splitinput.hpp"
|
||||||
|
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
|
@ -26,7 +26,7 @@ class CompletionManager;
|
||||||
|
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
class NotebookPage;
|
class SplitContainer;
|
||||||
|
|
||||||
// Each ChatWidget consists of three sub-elements that handle their own part of the chat widget:
|
// Each ChatWidget consists of three sub-elements that handle their own part of the chat widget:
|
||||||
// ChatWidgetHeader
|
// ChatWidgetHeader
|
||||||
|
@ -38,59 +38,56 @@ class NotebookPage;
|
||||||
// - Responsible for rendering and handling user text input
|
// - Responsible for rendering and handling user text input
|
||||||
//
|
//
|
||||||
// Each sub-element has a reference to the parent Chat Widget
|
// Each sub-element has a reference to the parent Chat Widget
|
||||||
class ChatWidget : public BaseWidget
|
class Split : public BaseWidget
|
||||||
{
|
{
|
||||||
friend class ChatWidgetInput;
|
friend class SplitInput;
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChatWidget(ChannelManager &_channelManager, NotebookPage *parent);
|
Split(ChannelManager &_channelManager, SplitContainer *parent);
|
||||||
~ChatWidget();
|
~Split();
|
||||||
|
|
||||||
|
ChannelManager &channelManager;
|
||||||
|
CompletionManager &completionManager;
|
||||||
|
pajlada::Settings::Setting<std::string> channelName;
|
||||||
|
boost::signals2::signal<void()> channelChanged;
|
||||||
|
bool testEnabled = false;
|
||||||
|
|
||||||
std::shared_ptr<Channel> getChannel() const;
|
std::shared_ptr<Channel> getChannel() const;
|
||||||
std::shared_ptr<Channel> &getChannelRef();
|
std::shared_ptr<Channel> &getChannelRef();
|
||||||
|
void setFlexSizeX(double x);
|
||||||
|
double getFlexSizeX();
|
||||||
|
void setFlexSizeY(double y);
|
||||||
|
double getFlexSizeY();
|
||||||
|
|
||||||
bool showChangeChannelPopup(const char *dialogTitle, bool empty = false);
|
bool showChangeChannelPopup(const char *dialogTitle, bool empty = false);
|
||||||
|
|
||||||
void giveFocus(Qt::FocusReason reason);
|
void giveFocus(Qt::FocusReason reason);
|
||||||
bool hasFocus() const;
|
bool hasFocus() const;
|
||||||
|
|
||||||
void layoutMessages();
|
void layoutMessages();
|
||||||
void updateGifEmotes();
|
void updateGifEmotes();
|
||||||
|
void load(const boost::property_tree::ptree &tree);
|
||||||
boost::signals2::signal<void()> channelChanged;
|
boost::property_tree::ptree save();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void paintEvent(QPaintEvent *) override;
|
virtual void paintEvent(QPaintEvent *) override;
|
||||||
|
|
||||||
public:
|
|
||||||
ChannelManager &channelManager;
|
|
||||||
CompletionManager &completionManager;
|
|
||||||
|
|
||||||
pajlada::Settings::Setting<std::string> channelName;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setChannel(std::shared_ptr<Channel> newChannel);
|
SplitContainer &parentPage;
|
||||||
void doOpenAccountPopupWidget(AccountPopupWidget *widget, QString user);
|
|
||||||
|
|
||||||
void channelNameUpdated(const std::string &newChannelName);
|
|
||||||
|
|
||||||
NotebookPage &parentPage;
|
|
||||||
|
|
||||||
std::shared_ptr<Channel> channel;
|
std::shared_ptr<Channel> channel;
|
||||||
|
|
||||||
QVBoxLayout vbox;
|
QVBoxLayout vbox;
|
||||||
ChatWidgetHeader header;
|
SplitHeader header;
|
||||||
ChannelView view;
|
ChannelView view;
|
||||||
ChatWidgetInput input;
|
SplitInput input;
|
||||||
|
double flexSizeX;
|
||||||
|
double flexSizeY;
|
||||||
|
|
||||||
boost::signals2::connection channelIDChangedConnection;
|
boost::signals2::connection channelIDChangedConnection;
|
||||||
|
|
||||||
public:
|
void setChannel(std::shared_ptr<Channel> newChannel);
|
||||||
void load(const boost::property_tree::ptree &tree);
|
void doOpenAccountPopupWidget(AccountPopupWidget *widget, QString user);
|
||||||
boost::property_tree::ptree save();
|
void channelNameUpdated(const std::string &newChannelName);
|
||||||
bool testEnabled = false;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Add new split to the notebook page that this chat widget is in
|
// Add new split to the notebook page that this chat widget is in
|
||||||
|
@ -127,6 +124,10 @@ public slots:
|
||||||
|
|
||||||
void doToggleMessageSpawning();
|
void doToggleMessageSpawning();
|
||||||
void test();
|
void test();
|
||||||
|
void doIncFlexX();
|
||||||
|
void doDecFlexX();
|
||||||
|
void doIncFlexY();
|
||||||
|
void doDecFlexY();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace widgets
|
} // namespace widgets
|
|
@ -1,8 +1,8 @@
|
||||||
#include "widgets/notebookpage.hpp"
|
#include "widgets/splitcontainer.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "widgets/chatwidget.hpp"
|
#include "widgets/helper/notebooktab.hpp"
|
||||||
#include "widgets/notebook.hpp"
|
#include "widgets/notebook.hpp"
|
||||||
#include "widgets/notebooktab.hpp"
|
#include "widgets/split.hpp"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -19,16 +19,17 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
bool NotebookPage::isDraggingSplit = false;
|
bool SplitContainer::isDraggingSplit = false;
|
||||||
ChatWidget *NotebookPage::draggingSplit = nullptr;
|
Split *SplitContainer::draggingSplit = nullptr;
|
||||||
std::pair<int, int> NotebookPage::dropPosition = std::pair<int, int>(-1, -1);
|
std::pair<int, int> SplitContainer::dropPosition = std::pair<int, int>(-1, -1);
|
||||||
|
|
||||||
NotebookPage::NotebookPage(ChannelManager &_channelManager, Notebook *parent, NotebookTab *_tab)
|
SplitContainer::SplitContainer(ChannelManager &_channelManager, Notebook *parent, NotebookTab *_tab)
|
||||||
: BaseWidget(parent->colorScheme, parent)
|
: BaseWidget(parent->colorScheme, parent)
|
||||||
, channelManager(_channelManager)
|
, channelManager(_channelManager)
|
||||||
, completionManager(parent->completionManager)
|
, completionManager(parent->completionManager)
|
||||||
, tab(_tab)
|
, tab(_tab)
|
||||||
, dropPreview(this)
|
, dropPreview(this)
|
||||||
|
, chatWidgets()
|
||||||
{
|
{
|
||||||
this->tab->page = this;
|
this->tab->page = this;
|
||||||
|
|
||||||
|
@ -47,7 +48,18 @@ NotebookPage::NotebookPage(ChannelManager &_channelManager, Notebook *parent, No
|
||||||
this->refreshTitle();
|
this->refreshTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<int, int> NotebookPage::removeFromLayout(ChatWidget *widget)
|
void SplitContainer::updateFlexValues()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < this->ui.hbox.count(); i++) {
|
||||||
|
QVBoxLayout *vbox = (QVBoxLayout *)ui.hbox.itemAt(i)->layout();
|
||||||
|
|
||||||
|
if (vbox->count() != 0) {
|
||||||
|
ui.hbox.setStretch(i, (int)(1000 * ((Split *)vbox->itemAt(0))->getFlexSizeX()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::pair<int, int> SplitContainer::removeFromLayout(Split *widget)
|
||||||
{
|
{
|
||||||
// remove reference to chat widget from chatWidgets vector
|
// remove reference to chat widget from chatWidgets vector
|
||||||
auto it = std::find(std::begin(this->chatWidgets), std::end(this->chatWidgets), widget);
|
auto it = std::find(std::begin(this->chatWidgets), std::end(this->chatWidgets), widget);
|
||||||
|
@ -83,8 +95,7 @@ std::pair<int, int> NotebookPage::removeFromLayout(ChatWidget *widget)
|
||||||
return std::pair<int, int>(-1, -1);
|
return std::pair<int, int>(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::addToLayout(ChatWidget *widget,
|
void SplitContainer::addToLayout(Split *widget, std::pair<int, int> position)
|
||||||
std::pair<int, int> position = std::pair<int, int>(-1, -1))
|
|
||||||
{
|
{
|
||||||
this->chatWidgets.push_back(widget);
|
this->chatWidgets.push_back(widget);
|
||||||
|
|
||||||
|
@ -120,19 +131,19 @@ void NotebookPage::addToLayout(ChatWidget *widget,
|
||||||
this->refreshCurrentFocusCoordinates();
|
this->refreshCurrentFocusCoordinates();
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<ChatWidget *> &NotebookPage::getChatWidgets() const
|
const std::vector<Split *> &SplitContainer::getChatWidgets() const
|
||||||
{
|
{
|
||||||
return this->chatWidgets;
|
return this->chatWidgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
NotebookTab *NotebookPage::getTab() const
|
NotebookTab *SplitContainer::getTab() const
|
||||||
{
|
{
|
||||||
return this->tab;
|
return this->tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::addChat(bool openChannelNameDialog)
|
void SplitContainer::addChat(bool openChannelNameDialog)
|
||||||
{
|
{
|
||||||
ChatWidget *w = this->createChatWidget();
|
Split *w = this->createChatWidget();
|
||||||
|
|
||||||
if (openChannelNameDialog) {
|
if (openChannelNameDialog) {
|
||||||
bool ret = w->showChangeChannelPopup("Open channel", true);
|
bool ret = w->showChangeChannelPopup("Open channel", true);
|
||||||
|
@ -146,7 +157,7 @@ void NotebookPage::addChat(bool openChannelNameDialog)
|
||||||
this->addToLayout(w, std::pair<int, int>(-1, -1));
|
this->addToLayout(w, std::pair<int, int>(-1, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::refreshCurrentFocusCoordinates(bool alsoSetLastRequested)
|
void SplitContainer::refreshCurrentFocusCoordinates(bool alsoSetLastRequested)
|
||||||
{
|
{
|
||||||
int setX = -1;
|
int setX = -1;
|
||||||
int setY = -1;
|
int setY = -1;
|
||||||
|
@ -171,7 +182,7 @@ void NotebookPage::refreshCurrentFocusCoordinates(bool alsoSetLastRequested)
|
||||||
|
|
||||||
QWidget *w = innerItem->widget();
|
QWidget *w = innerItem->widget();
|
||||||
if (w) {
|
if (w) {
|
||||||
ChatWidget *chatWidget = static_cast<ChatWidget *>(w);
|
Split *chatWidget = static_cast<Split *>(w);
|
||||||
if (chatWidget->hasFocus()) {
|
if (chatWidget->hasFocus()) {
|
||||||
setX = x;
|
setX = x;
|
||||||
setY = y;
|
setY = y;
|
||||||
|
@ -199,7 +210,7 @@ void NotebookPage::refreshCurrentFocusCoordinates(bool alsoSetLastRequested)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::requestFocus(int requestedX, int requestedY)
|
void SplitContainer::requestFocus(int requestedX, int requestedY)
|
||||||
{
|
{
|
||||||
// XXX: Perhaps if we request an Y coordinate out of bounds, we shuold set all previously set
|
// XXX: Perhaps if we request an Y coordinate out of bounds, we shuold set all previously set
|
||||||
// requestedYs to 0 (if -1 is requested) or that x-coordinates vbox count (if requestedY >=
|
// requestedYs to 0 (if -1 is requested) or that x-coordinates vbox count (if requestedY >=
|
||||||
|
@ -238,12 +249,12 @@ void NotebookPage::requestFocus(int requestedX, int requestedY)
|
||||||
|
|
||||||
QWidget *w = innerItem->widget();
|
QWidget *w = innerItem->widget();
|
||||||
if (w) {
|
if (w) {
|
||||||
ChatWidget *chatWidget = static_cast<ChatWidget *>(w);
|
Split *chatWidget = static_cast<Split *>(w);
|
||||||
chatWidget->giveFocus(Qt::OtherFocusReason);
|
chatWidget->giveFocus(Qt::OtherFocusReason);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::enterEvent(QEvent *)
|
void SplitContainer::enterEvent(QEvent *)
|
||||||
{
|
{
|
||||||
if (this->ui.hbox.count() == 0) {
|
if (this->ui.hbox.count() == 0) {
|
||||||
this->setCursor(QCursor(Qt::PointingHandCursor));
|
this->setCursor(QCursor(Qt::PointingHandCursor));
|
||||||
|
@ -252,11 +263,11 @@ void NotebookPage::enterEvent(QEvent *)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::leaveEvent(QEvent *)
|
void SplitContainer::leaveEvent(QEvent *)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::mouseReleaseEvent(QMouseEvent *event)
|
void SplitContainer::mouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if (this->ui.hbox.count() == 0 && event->button() == Qt::LeftButton) {
|
if (this->ui.hbox.count() == 0 && event->button() == Qt::LeftButton) {
|
||||||
// "Add Chat" was clicked
|
// "Add Chat" was clicked
|
||||||
|
@ -266,7 +277,7 @@ void NotebookPage::mouseReleaseEvent(QMouseEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::dragEnterEvent(QDragEnterEvent *event)
|
void SplitContainer::dragEnterEvent(QDragEnterEvent *event)
|
||||||
{
|
{
|
||||||
if (!event->mimeData()->hasFormat("chatterino/split"))
|
if (!event->mimeData()->hasFormat("chatterino/split"))
|
||||||
return;
|
return;
|
||||||
|
@ -306,12 +317,12 @@ void NotebookPage::dragEnterEvent(QDragEnterEvent *event)
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::dragMoveEvent(QDragMoveEvent *event)
|
void SplitContainer::dragMoveEvent(QDragMoveEvent *event)
|
||||||
{
|
{
|
||||||
setPreviewRect(event->pos());
|
setPreviewRect(event->pos());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::setPreviewRect(QPoint mousePos)
|
void SplitContainer::setPreviewRect(QPoint mousePos)
|
||||||
{
|
{
|
||||||
for (DropRegion region : this->dropRegions) {
|
for (DropRegion region : this->dropRegions) {
|
||||||
if (region.rect.contains(mousePos)) {
|
if (region.rect.contains(mousePos)) {
|
||||||
|
@ -331,25 +342,25 @@ void NotebookPage::setPreviewRect(QPoint mousePos)
|
||||||
this->dropPreview.hide();
|
this->dropPreview.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::dragLeaveEvent(QDragLeaveEvent *event)
|
void SplitContainer::dragLeaveEvent(QDragLeaveEvent *event)
|
||||||
{
|
{
|
||||||
this->dropPreview.hide();
|
this->dropPreview.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::dropEvent(QDropEvent *event)
|
void SplitContainer::dropEvent(QDropEvent *event)
|
||||||
{
|
{
|
||||||
if (isDraggingSplit) {
|
if (isDraggingSplit) {
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
|
|
||||||
NotebookPage::draggingSplit->setParent(this);
|
SplitContainer::draggingSplit->setParent(this);
|
||||||
|
|
||||||
addToLayout(NotebookPage::draggingSplit, dropPosition);
|
addToLayout(SplitContainer::draggingSplit, dropPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->dropPreview.hide();
|
this->dropPreview.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotebookPage::eventFilter(QObject *object, QEvent *event)
|
bool SplitContainer::eventFilter(QObject *object, QEvent *event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::FocusIn) {
|
if (event->type() == QEvent::FocusIn) {
|
||||||
QFocusEvent *focusEvent = static_cast<QFocusEvent *>(event);
|
QFocusEvent *focusEvent = static_cast<QFocusEvent *>(event);
|
||||||
|
@ -360,7 +371,7 @@ bool NotebookPage::eventFilter(QObject *object, QEvent *event)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::paintEvent(QPaintEvent *)
|
void SplitContainer::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
|
|
||||||
|
@ -380,7 +391,7 @@ void NotebookPage::paintEvent(QPaintEvent *)
|
||||||
painter.fillRect(0, 0, width(), 2, accentColor);
|
painter.fillRect(0, 0, width(), 2, accentColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::showEvent(QShowEvent *event)
|
void SplitContainer::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
// Whenever this notebook page is shown, give focus to the last focused chat widget
|
// Whenever this notebook page is shown, give focus to the last focused chat widget
|
||||||
// If this is the first time this notebook page is shown, it will give focus to the top-left
|
// If this is the first time this notebook page is shown, it will give focus to the top-left
|
||||||
|
@ -388,7 +399,7 @@ void NotebookPage::showEvent(QShowEvent *event)
|
||||||
this->requestFocus(this->currentX, this->currentY);
|
this->requestFocus(this->currentX, this->currentY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::pair<int, int> getWidgetPositionInLayout(QLayout *layout, const ChatWidget *chatWidget)
|
static std::pair<int, int> getWidgetPositionInLayout(QLayout *layout, const Split *chatWidget)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < layout->count(); ++i) {
|
for (int i = 0; i < layout->count(); ++i) {
|
||||||
printf("xD\n");
|
printf("xD\n");
|
||||||
|
@ -397,7 +408,7 @@ static std::pair<int, int> getWidgetPositionInLayout(QLayout *layout, const Chat
|
||||||
return std::make_pair(-1, -1);
|
return std::make_pair(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<int, int> NotebookPage::getChatPosition(const ChatWidget *chatWidget)
|
std::pair<int, int> SplitContainer::getChatPosition(const Split *chatWidget)
|
||||||
{
|
{
|
||||||
auto layout = this->ui.hbox.layout();
|
auto layout = this->ui.hbox.layout();
|
||||||
|
|
||||||
|
@ -408,12 +419,12 @@ std::pair<int, int> NotebookPage::getChatPosition(const ChatWidget *chatWidget)
|
||||||
return getWidgetPositionInLayout(layout, chatWidget);
|
return getWidgetPositionInLayout(layout, chatWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatWidget *NotebookPage::createChatWidget()
|
Split *SplitContainer::createChatWidget()
|
||||||
{
|
{
|
||||||
return new ChatWidget(this->channelManager, this);
|
return new Split(this->channelManager, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::refreshTitle()
|
void SplitContainer::refreshTitle()
|
||||||
{
|
{
|
||||||
if (!this->tab->useDefaultBehaviour) {
|
if (!this->tab->useDefaultBehaviour) {
|
||||||
return;
|
return;
|
||||||
|
@ -444,7 +455,7 @@ void NotebookPage::refreshTitle()
|
||||||
this->tab->setTitle(newTitle);
|
this->tab->setTitle(newTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookPage::load(const boost::property_tree::ptree &tree)
|
void SplitContainer::load(const boost::property_tree::ptree &tree)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
int column = 0;
|
int column = 0;
|
||||||
|
@ -488,7 +499,7 @@ static void saveFromLayout(QLayout *layout, boost::property_tree::ptree &tree)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatWidget *chatWidget = qobject_cast<ChatWidget *>(widget);
|
Split *chatWidget = qobject_cast<Split *>(widget);
|
||||||
|
|
||||||
if (chatWidget != nullptr) {
|
if (chatWidget != nullptr) {
|
||||||
boost::property_tree::ptree chat = chatWidget->save();
|
boost::property_tree::ptree chat = chatWidget->save();
|
||||||
|
@ -499,7 +510,7 @@ static void saveFromLayout(QLayout *layout, boost::property_tree::ptree &tree)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::property_tree::ptree NotebookPage::save()
|
boost::property_tree::ptree SplitContainer::save()
|
||||||
{
|
{
|
||||||
boost::property_tree::ptree tree;
|
boost::property_tree::ptree tree;
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "widgets/basewidget.hpp"
|
#include "widgets/basewidget.hpp"
|
||||||
#include "widgets/chatwidget.hpp"
|
#include "widgets/helper/droppreview.hpp"
|
||||||
#include "widgets/notebookpage.hpp"
|
#include "widgets/helper/notebooktab.hpp"
|
||||||
#include "widgets/notebookpagedroppreview.hpp"
|
#include "widgets/split.hpp"
|
||||||
#include "widgets/notebooktab.hpp"
|
|
||||||
|
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
@ -22,26 +21,26 @@ class CompletionManager;
|
||||||
|
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
class NotebookPage : public BaseWidget
|
class SplitContainer : public BaseWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NotebookPage(ChannelManager &_channelManager, Notebook *parent, NotebookTab *_tab);
|
SplitContainer(ChannelManager &_channelManager, Notebook *parent, NotebookTab *_tab);
|
||||||
|
|
||||||
ChannelManager &channelManager;
|
ChannelManager &channelManager;
|
||||||
CompletionManager &completionManager;
|
CompletionManager &completionManager;
|
||||||
|
|
||||||
std::pair<int, int> removeFromLayout(ChatWidget *widget);
|
std::pair<int, int> removeFromLayout(Split *widget);
|
||||||
void addToLayout(ChatWidget *widget, std::pair<int, int> position);
|
void addToLayout(Split *widget, std::pair<int, int> position = std::pair<int, int>(-1, -1));
|
||||||
|
|
||||||
const std::vector<ChatWidget *> &getChatWidgets() const;
|
const std::vector<Split *> &getChatWidgets() const;
|
||||||
NotebookTab *getTab() const;
|
NotebookTab *getTab() const;
|
||||||
|
|
||||||
void addChat(bool openChannelNameDialog = false);
|
void addChat(bool openChannelNameDialog = false);
|
||||||
|
|
||||||
static bool isDraggingSplit;
|
static bool isDraggingSplit;
|
||||||
static ChatWidget *draggingSplit;
|
static Split *draggingSplit;
|
||||||
static std::pair<int, int> dropPosition;
|
static std::pair<int, int> dropPosition;
|
||||||
|
|
||||||
int currentX = 0;
|
int currentX = 0;
|
||||||
|
@ -51,6 +50,8 @@ public:
|
||||||
void refreshCurrentFocusCoordinates(bool alsoSetLastRequested = false);
|
void refreshCurrentFocusCoordinates(bool alsoSetLastRequested = false);
|
||||||
void requestFocus(int x, int y);
|
void requestFocus(int x, int y);
|
||||||
|
|
||||||
|
void updateFlexValues();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool eventFilter(QObject *object, QEvent *event) override;
|
virtual bool eventFilter(QObject *object, QEvent *event) override;
|
||||||
virtual void paintEvent(QPaintEvent *) override;
|
virtual void paintEvent(QPaintEvent *) override;
|
||||||
|
@ -86,16 +87,16 @@ private:
|
||||||
QHBoxLayout hbox;
|
QHBoxLayout hbox;
|
||||||
} ui;
|
} ui;
|
||||||
|
|
||||||
std::vector<ChatWidget *> chatWidgets;
|
std::vector<Split *> chatWidgets;
|
||||||
std::vector<DropRegion> dropRegions;
|
std::vector<DropRegion> dropRegions;
|
||||||
|
|
||||||
NotebookPageDropPreview dropPreview;
|
NotebookPageDropPreview dropPreview;
|
||||||
|
|
||||||
void setPreviewRect(QPoint mousePos);
|
void setPreviewRect(QPoint mousePos);
|
||||||
|
|
||||||
std::pair<int, int> getChatPosition(const ChatWidget *chatWidget);
|
std::pair<int, int> getChatPosition(const Split *chatWidget);
|
||||||
|
|
||||||
ChatWidget *createChatWidget();
|
Split *createChatWidget();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void refreshTitle();
|
void refreshTitle();
|
|
@ -1,8 +1,8 @@
|
||||||
#include "widgets/mainwindow.hpp"
|
#include "widgets/window.hpp"
|
||||||
#include "channelmanager.hpp"
|
#include "channelmanager.hpp"
|
||||||
#include "colorscheme.hpp"
|
#include "colorscheme.hpp"
|
||||||
#include "settingsmanager.hpp"
|
#include "settingsmanager.hpp"
|
||||||
#include "widgets/chatwidget.hpp"
|
#include "widgets/split.hpp"
|
||||||
#include "widgets/notebook.hpp"
|
#include "widgets/notebook.hpp"
|
||||||
#include "widgets/settingsdialog.hpp"
|
#include "widgets/settingsdialog.hpp"
|
||||||
|
|
||||||
|
@ -16,13 +16,13 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
MainWindow::MainWindow(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
Window::Window(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
||||||
CompletionManager &_completionManager)
|
CompletionManager &_completionManager, bool _isMainWindow)
|
||||||
: BaseWidget(_colorScheme, nullptr)
|
: BaseWidget(_colorScheme, nullptr)
|
||||||
, channelManager(_channelManager)
|
, channelManager(_channelManager)
|
||||||
, colorScheme(_colorScheme)
|
, colorScheme(_colorScheme)
|
||||||
, completionManager(_completionManager)
|
, completionManager(_completionManager)
|
||||||
, notebook(this->channelManager, this)
|
, notebook(this->channelManager, this, _isMainWindow)
|
||||||
, dpi(this->getDpiMultiplier())
|
, dpi(this->getDpiMultiplier())
|
||||||
// , windowGeometry("/windows/0/geometry")
|
// , windowGeometry("/windows/0/geometry")
|
||||||
{
|
{
|
||||||
|
@ -66,11 +66,11 @@ MainWindow::MainWindow(ChannelManager &_channelManager, ColorScheme &_colorSchem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
Window::~Window()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::repaintVisibleChatWidgets(Channel *channel)
|
void Window::repaintVisibleChatWidgets(Channel *channel)
|
||||||
{
|
{
|
||||||
auto *page = this->notebook.getSelectedPage();
|
auto *page = this->notebook.getSelectedPage();
|
||||||
|
|
||||||
|
@ -78,10 +78,10 @@ void MainWindow::repaintVisibleChatWidgets(Channel *channel)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<ChatWidget *> &widgets = page->getChatWidgets();
|
const std::vector<Split *> &widgets = page->getChatWidgets();
|
||||||
|
|
||||||
for (auto it = widgets.begin(); it != widgets.end(); ++it) {
|
for (auto it = widgets.begin(); it != widgets.end(); ++it) {
|
||||||
ChatWidget *widget = *it;
|
Split *widget = *it;
|
||||||
|
|
||||||
if (channel == nullptr || channel == widget->getChannel().get()) {
|
if (channel == nullptr || channel == widget->getChannel().get()) {
|
||||||
widget->layoutMessages();
|
widget->layoutMessages();
|
||||||
|
@ -89,14 +89,14 @@ void MainWindow::repaintVisibleChatWidgets(Channel *channel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::load(const boost::property_tree::ptree &tree)
|
void Window::load(const boost::property_tree::ptree &tree)
|
||||||
{
|
{
|
||||||
this->notebook.load(tree);
|
this->notebook.load(tree);
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::property_tree::ptree MainWindow::save()
|
boost::property_tree::ptree Window::save()
|
||||||
{
|
{
|
||||||
boost::property_tree::ptree child;
|
boost::property_tree::ptree child;
|
||||||
|
|
||||||
|
@ -107,30 +107,30 @@ boost::property_tree::ptree MainWindow::save()
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::loadDefaults()
|
void Window::loadDefaults()
|
||||||
{
|
{
|
||||||
this->notebook.loadDefaults();
|
this->notebook.loadDefaults();
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::isLoaded() const
|
bool Window::isLoaded() const
|
||||||
{
|
{
|
||||||
return loaded;
|
return loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
Notebook &MainWindow::getNotebook()
|
Notebook &Window::getNotebook()
|
||||||
{
|
{
|
||||||
return this->notebook;
|
return this->notebook;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *)
|
void Window::closeEvent(QCloseEvent *)
|
||||||
{
|
{
|
||||||
// Save closing window position
|
// Save closing window position
|
||||||
// this->windowGeometry = this->geometry();
|
// this->windowGeometry = this->geometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::refreshTheme()
|
void Window::refreshTheme()
|
||||||
{
|
{
|
||||||
QPalette palette;
|
QPalette palette;
|
||||||
palette.setColor(QPalette::Background, this->colorScheme.TabBackground);
|
palette.setColor(QPalette::Background, this->colorScheme.TabBackground);
|
|
@ -8,7 +8,6 @@
|
||||||
//#include <platform/borderless/qwinwidget.h>
|
//#include <platform/borderless/qwinwidget.h>
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree.hpp>
|
||||||
#include <pajlada/settings/serialize.hpp>
|
#include <pajlada/settings/serialize.hpp>
|
||||||
#include <pajlada/settings/settingdata.hpp>
|
#include <pajlada/settings/settingdata.hpp>
|
||||||
|
@ -21,14 +20,14 @@ class CompletionManager;
|
||||||
|
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
class MainWindow : public BaseWidget
|
class Window : public BaseWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
explicit Window(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
||||||
CompletionManager &_completionManager);
|
CompletionManager &_completionManager, bool isMainWindow);
|
||||||
~MainWindow();
|
~Window();
|
||||||
|
|
||||||
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
void repaintVisibleChatWidgets(Channel *channel = nullptr);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <boost/property_tree/json_parser.hpp>
|
#include <boost/property_tree/json_parser.hpp>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
WindowManager *WindowManager::instance = nullptr;
|
||||||
|
|
||||||
WindowManager::WindowManager(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
WindowManager::WindowManager(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
||||||
CompletionManager &_completionManager)
|
CompletionManager &_completionManager)
|
||||||
|
@ -16,6 +17,7 @@ WindowManager::WindowManager(ChannelManager &_channelManager, ColorScheme &_colo
|
||||||
, colorScheme(_colorScheme)
|
, colorScheme(_colorScheme)
|
||||||
, completionManager(_completionManager)
|
, completionManager(_completionManager)
|
||||||
{
|
{
|
||||||
|
WindowManager::instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const std::string &getSettingsPath()
|
static const std::string &getSettingsPath()
|
||||||
|
@ -49,18 +51,35 @@ void WindowManager::repaintGifEmotes()
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
widgets::MainWindow &WindowManager::getMainWindow()
|
widgets::Window &WindowManager::getMainWindow()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(this->windowMutex);
|
std::lock_guard<std::mutex> lock(this->windowMutex);
|
||||||
|
|
||||||
if (this->mainWindow == nullptr) {
|
if (this->mainWindow == nullptr) {
|
||||||
this->mainWindow = new widgets::MainWindow(this->channelManager, this->colorScheme,
|
this->mainWindow = new widgets::Window(this->channelManager, this->colorScheme,
|
||||||
this->completionManager);
|
this->completionManager, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this->mainWindow;
|
return *this->mainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
widgets::Window &WindowManager::getCurrentWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
widgets::Window &WindowManager::createWindow()
|
||||||
|
{
|
||||||
|
auto *window = new widgets::Window(this->channelManager, this->colorScheme,
|
||||||
|
this->completionManager, false);
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(this->windowMutex);
|
||||||
|
window->loadDefaults();
|
||||||
|
|
||||||
|
this->windows.push_back(window);
|
||||||
|
|
||||||
|
return *window;
|
||||||
|
}
|
||||||
|
|
||||||
void WindowManager::load()
|
void WindowManager::load()
|
||||||
{
|
{
|
||||||
const auto &settingsPath = getSettingsPath();
|
const auto &settingsPath = getSettingsPath();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "widgets/mainwindow.hpp"
|
#include "widgets/window.hpp"
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ public:
|
||||||
explicit WindowManager(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
explicit WindowManager(ChannelManager &_channelManager, ColorScheme &_colorScheme,
|
||||||
CompletionManager &_completionManager);
|
CompletionManager &_completionManager);
|
||||||
|
|
||||||
|
static WindowManager *instance;
|
||||||
|
|
||||||
ChannelManager &channelManager;
|
ChannelManager &channelManager;
|
||||||
ColorScheme &colorScheme;
|
ColorScheme &colorScheme;
|
||||||
CompletionManager &completionManager;
|
CompletionManager &completionManager;
|
||||||
|
@ -25,7 +27,10 @@ public:
|
||||||
void repaintGifEmotes();
|
void repaintGifEmotes();
|
||||||
// void updateAll();
|
// void updateAll();
|
||||||
|
|
||||||
widgets::MainWindow &getMainWindow();
|
widgets::Window &getMainWindow();
|
||||||
|
widgets::Window &getCurrentWindow();
|
||||||
|
|
||||||
|
widgets::Window &createWindow();
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
|
@ -35,9 +40,10 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::mutex windowMutex;
|
std::mutex windowMutex;
|
||||||
|
std::vector<widgets::Window *> windows;
|
||||||
|
|
||||||
// TODO(pajlada): Store as a value instead of a pointer
|
// TODO(pajlada): Store as a value instead of a pointer
|
||||||
widgets::MainWindow *mainWindow = nullptr;
|
widgets::Window *mainWindow = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
Loading…
Reference in a new issue