Add transparent overlay window (#4746)
This commit is contained in:
@@ -183,6 +183,18 @@ public:
|
||||
// BoolSetting useCustomWindowFrame = {"/appearance/useCustomWindowFrame",
|
||||
// false};
|
||||
|
||||
IntSetting overlayBackgroundOpacity = {
|
||||
"/appearance/overlay/backgroundOpacity", 50};
|
||||
BoolSetting enableOverlayShadow = {"/appearance/overlay/shadow", true};
|
||||
IntSetting overlayShadowOpacity = {"/appearance/overlay/shadowOpacity",
|
||||
255};
|
||||
QStringSetting overlayShadowColor = {"/appearance/overlay/shadowColor",
|
||||
"#000"};
|
||||
// These should be floats, but there's no good input UI for them
|
||||
IntSetting overlayShadowOffsetX = {"/appearance/overlay/shadowOffsetX", 2};
|
||||
IntSetting overlayShadowOffsetY = {"/appearance/overlay/shadowOffsetY", 2};
|
||||
IntSetting overlayShadowRadius = {"/appearance/overlay/shadowRadius", 8};
|
||||
|
||||
// Badges
|
||||
BoolSetting showBadgesGlobalAuthority = {
|
||||
"/appearance/badges/GlobalAuthority", true};
|
||||
@@ -523,6 +535,7 @@ public:
|
||||
|
||||
IntSetting startUpNotification = {"/misc/startUpNotification", 0};
|
||||
QStringSetting currentVersion = {"/misc/currentVersion", ""};
|
||||
IntSetting overlayKnowledgeLevel = {"/misc/overlayKnowledgeLevel", 0};
|
||||
|
||||
BoolSetting loadTwitchMessageHistoryOnConnect = {
|
||||
"/misc/twitch/loadMessageHistoryOnConnect", true};
|
||||
|
||||
+44
-17
@@ -11,6 +11,7 @@
|
||||
#include <QDir>
|
||||
#include <QElapsedTimer>
|
||||
#include <QFile>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QSet>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
@@ -118,33 +119,56 @@ void parseTabs(const QJsonObject &tabs, const QJsonObject &tabsFallback,
|
||||
tabsFallback["selected"_L1].toObject(), theme.tabs.selected);
|
||||
}
|
||||
|
||||
void parseTextColors(const QJsonObject &textColors,
|
||||
const QJsonObject &textColorsFallback, auto &messages)
|
||||
{
|
||||
parseColor(messages, textColors, regular);
|
||||
parseColor(messages, textColors, caret);
|
||||
parseColor(messages, textColors, link);
|
||||
parseColor(messages, textColors, system);
|
||||
parseColor(messages, textColors, chatPlaceholder);
|
||||
}
|
||||
|
||||
void parseMessageBackgrounds(const QJsonObject &backgrounds,
|
||||
const QJsonObject &backgroundsFallback,
|
||||
auto &messages)
|
||||
{
|
||||
parseColor(messages, backgrounds, regular);
|
||||
parseColor(messages, backgrounds, alternate);
|
||||
}
|
||||
|
||||
void parseMessages(const QJsonObject &messages,
|
||||
const QJsonObject &messagesFallback,
|
||||
chatterino::Theme &theme)
|
||||
{
|
||||
{
|
||||
const auto textColors = messages["textColors"_L1].toObject();
|
||||
const auto textColorsFallback =
|
||||
messagesFallback["textColors"_L1].toObject();
|
||||
parseColor(theme.messages, textColors, regular);
|
||||
parseColor(theme.messages, textColors, caret);
|
||||
parseColor(theme.messages, textColors, link);
|
||||
parseColor(theme.messages, textColors, system);
|
||||
parseColor(theme.messages, textColors, chatPlaceholder);
|
||||
}
|
||||
{
|
||||
const auto backgrounds = messages["backgrounds"_L1].toObject();
|
||||
const auto backgroundsFallback =
|
||||
messagesFallback["backgrounds"_L1].toObject();
|
||||
parseColor(theme.messages, backgrounds, regular);
|
||||
parseColor(theme.messages, backgrounds, alternate);
|
||||
}
|
||||
parseTextColors(messages["textColors"_L1].toObject(),
|
||||
messagesFallback["textColors"_L1].toObject(),
|
||||
theme.messages);
|
||||
parseMessageBackgrounds(messages["backgrounds"_L1].toObject(),
|
||||
messagesFallback["backgrounds"_L1].toObject(),
|
||||
theme.messages);
|
||||
parseColor(theme, messages, disabled);
|
||||
parseColor(theme, messages, selection);
|
||||
parseColor(theme, messages, highlightAnimationStart);
|
||||
parseColor(theme, messages, highlightAnimationEnd);
|
||||
}
|
||||
|
||||
void parseOverlayMessages(const QJsonObject &overlayMessages,
|
||||
const QJsonObject &overlayMessagesFallback,
|
||||
chatterino::Theme &theme)
|
||||
{
|
||||
parseTextColors(overlayMessages["textColors"_L1].toObject(),
|
||||
overlayMessagesFallback["textColors"_L1].toObject(),
|
||||
theme.overlayMessages);
|
||||
parseMessageBackgrounds(
|
||||
overlayMessages["backgrounds"_L1].toObject(),
|
||||
overlayMessagesFallback["backgrounds"_L1].toObject(),
|
||||
theme.overlayMessages);
|
||||
parseColor(theme, overlayMessages, disabled);
|
||||
parseColor(theme, overlayMessages, selection);
|
||||
parseColor(theme, overlayMessages, background);
|
||||
}
|
||||
|
||||
void parseScrollbars(const QJsonObject &scrollbars,
|
||||
const QJsonObject &scrollbarsFallback,
|
||||
chatterino::Theme &theme)
|
||||
@@ -198,6 +222,9 @@ void parseColors(const QJsonObject &root, const QJsonObject &fallbackTheme,
|
||||
fallbackColors["tabs"_L1].toObject(), theme);
|
||||
parseMessages(colors["messages"_L1].toObject(),
|
||||
fallbackColors["messages"_L1].toObject(), theme);
|
||||
parseOverlayMessages(colors["overlayMessages"_L1].toObject(),
|
||||
fallbackColors["overlayMessages"_L1].toObject(),
|
||||
theme);
|
||||
parseScrollbars(colors["scrollbars"_L1].toObject(),
|
||||
fallbackColors["scrollbars"_L1].toObject(), theme);
|
||||
parseSplits(colors["splits"_L1].toObject(),
|
||||
|
||||
+24
-12
@@ -62,6 +62,19 @@ public:
|
||||
} line;
|
||||
};
|
||||
|
||||
struct TextColors {
|
||||
QColor regular;
|
||||
QColor caret;
|
||||
QColor link;
|
||||
QColor system;
|
||||
QColor chatPlaceholder;
|
||||
};
|
||||
|
||||
struct MessageBackgrounds {
|
||||
QColor regular;
|
||||
QColor alternate;
|
||||
};
|
||||
|
||||
QColor accent{"#00aeef"};
|
||||
|
||||
/// WINDOW
|
||||
@@ -84,18 +97,8 @@ public:
|
||||
|
||||
/// MESSAGES
|
||||
struct {
|
||||
struct {
|
||||
QColor regular;
|
||||
QColor caret;
|
||||
QColor link;
|
||||
QColor system;
|
||||
QColor chatPlaceholder;
|
||||
} textColors;
|
||||
|
||||
struct {
|
||||
QColor regular;
|
||||
QColor alternate;
|
||||
} backgrounds;
|
||||
TextColors textColors;
|
||||
MessageBackgrounds backgrounds;
|
||||
|
||||
QColor disabled;
|
||||
QColor selection;
|
||||
@@ -104,6 +107,15 @@ public:
|
||||
QColor highlightAnimationEnd;
|
||||
} messages;
|
||||
|
||||
struct {
|
||||
TextColors textColors;
|
||||
MessageBackgrounds backgrounds;
|
||||
|
||||
QColor disabled;
|
||||
QColor selection;
|
||||
QColor background;
|
||||
} overlayMessages;
|
||||
|
||||
/// SCROLLBAR
|
||||
struct {
|
||||
QColor background;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "widgets/FramelessEmbedWindow.hpp"
|
||||
#include "widgets/helper/NotebookTab.hpp"
|
||||
#include "widgets/Notebook.hpp"
|
||||
#include "widgets/OverlayWindow.hpp"
|
||||
#include "widgets/splits/Split.hpp"
|
||||
#include "widgets/splits/SplitContainer.hpp"
|
||||
#include "widgets/Window.hpp"
|
||||
@@ -544,6 +545,37 @@ void WindowManager::queueSave()
|
||||
this->saveTimer->start(10s);
|
||||
}
|
||||
|
||||
void WindowManager::toggleAllOverlayInertia()
|
||||
{
|
||||
// check if any window is not inert
|
||||
bool anyNonInert = false;
|
||||
for (auto *window : this->windows_)
|
||||
{
|
||||
if (anyNonInert)
|
||||
{
|
||||
break;
|
||||
}
|
||||
window->getNotebook().forEachSplit([&](auto *split) {
|
||||
auto *overlay = split->overlayWindow();
|
||||
if (overlay)
|
||||
{
|
||||
anyNonInert = anyNonInert || !overlay->isInert();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (auto *window : this->windows_)
|
||||
{
|
||||
window->getNotebook().forEachSplit([&](auto *split) {
|
||||
auto *overlay = split->overlayWindow();
|
||||
if (overlay)
|
||||
{
|
||||
overlay->setInert(anyNonInert);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void WindowManager::encodeTab(SplitContainer *tab, bool isSelected,
|
||||
QJsonObject &obj)
|
||||
{
|
||||
|
||||
@@ -128,6 +128,9 @@ public:
|
||||
// again
|
||||
void queueSave();
|
||||
|
||||
/// Toggles the inertia in all open overlay windows
|
||||
void toggleAllOverlayInertia();
|
||||
|
||||
/// Signals
|
||||
pajlada::Signals::NoArgSignal gifRepaintRequested;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user