fix: Fixed some compiler warnings (#5028)
* fix(C4101): unreferenced local variable * fix(C4189): variable initialized but not referenced * fix(C4305): narrowing from double to float * fix(C4457): declaration hiding function parameter * fix(C4456): shadowing declaration * fix(C4996): remove deprecations * chore: add changelog entry * fix: Remove more unused variables * fix: removed unused lambda captures * Update changelog entry --------- Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -88,6 +88,7 @@
|
|||||||
- Dev: Refactored the Image Uploader feature. (#4971)
|
- Dev: Refactored the Image Uploader feature. (#4971)
|
||||||
- Dev: Fixed deadlock and use-after-free in tests. (#4981)
|
- Dev: Fixed deadlock and use-after-free in tests. (#4981)
|
||||||
- Dev: Load less message history upon reconnects. (#5001)
|
- Dev: Load less message history upon reconnects. (#5001)
|
||||||
|
- Dev: Fixed most compiler warnings. (#5028)
|
||||||
|
|
||||||
## 2.4.6
|
## 2.4.6
|
||||||
|
|
||||||
|
|||||||
@@ -1067,7 +1067,6 @@ else ()
|
|||||||
-Wno-switch
|
-Wno-switch
|
||||||
-Wno-deprecated-declarations
|
-Wno-deprecated-declarations
|
||||||
-Wno-sign-compare
|
-Wno-sign-compare
|
||||||
-Wno-unused-variable
|
|
||||||
|
|
||||||
# Disabling strict-aliasing warnings for now, although we probably want to re-enable this in the future
|
# Disabling strict-aliasing warnings for now, although we probably want to re-enable this in the future
|
||||||
-Wno-strict-aliasing
|
-Wno-strict-aliasing
|
||||||
|
|||||||
+1
-1
@@ -77,7 +77,7 @@ namespace {
|
|||||||
{
|
{
|
||||||
// set up the QApplication flags
|
// set up the QApplication flags
|
||||||
QApplication::setAttribute(Qt::AA_Use96Dpi, true);
|
QApplication::setAttribute(Qt::AA_Use96Dpi, true);
|
||||||
#ifdef Q_OS_WIN32
|
#if defined(Q_OS_WIN32) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
|
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+21
-41
@@ -3,6 +3,7 @@
|
|||||||
#include "common/QLogging.hpp"
|
#include "common/QLogging.hpp"
|
||||||
#include "util/TypeName.hpp"
|
#include "util/TypeName.hpp"
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
@@ -10,16 +11,8 @@ namespace chatterino {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void warn(const char *envName, T defaultValue)
|
void warn(const char *envName, const QString &envString, T defaultValue)
|
||||||
{
|
{
|
||||||
auto *envString = std::getenv(envName);
|
|
||||||
if (!envString)
|
|
||||||
{
|
|
||||||
// This function is not supposed to be used for non-existant
|
|
||||||
// environment variables.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto typeName = QString::fromStdString(
|
const auto typeName = QString::fromStdString(
|
||||||
std::string(type_name<decltype(defaultValue)>()));
|
std::string(type_name<decltype(defaultValue)>()));
|
||||||
|
|
||||||
@@ -33,23 +26,12 @@ namespace {
|
|||||||
.arg(defaultValue);
|
.arg(defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString readStringEnv(const char *envName, QString defaultValue)
|
|
||||||
{
|
|
||||||
auto envString = std::getenv(envName);
|
|
||||||
if (envString != nullptr)
|
|
||||||
{
|
|
||||||
return QString(envString);
|
|
||||||
}
|
|
||||||
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::optional<QString> readOptionalStringEnv(const char *envName)
|
std::optional<QString> readOptionalStringEnv(const char *envName)
|
||||||
{
|
{
|
||||||
auto envString = std::getenv(envName);
|
auto envString = qEnvironmentVariable(envName);
|
||||||
if (envString != nullptr)
|
if (!envString.isEmpty())
|
||||||
{
|
{
|
||||||
return QString(envString);
|
return envString;
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
@@ -57,30 +39,28 @@ namespace {
|
|||||||
|
|
||||||
uint16_t readPortEnv(const char *envName, uint16_t defaultValue)
|
uint16_t readPortEnv(const char *envName, uint16_t defaultValue)
|
||||||
{
|
{
|
||||||
auto envString = std::getenv(envName);
|
auto envString = qEnvironmentVariable(envName);
|
||||||
if (envString != nullptr)
|
if (!envString.isEmpty())
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok = false;
|
||||||
auto val = QString(envString).toUShort(&ok);
|
auto val = envString.toUShort(&ok);
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
warn(envName, envString, defaultValue);
|
||||||
warn(envName, defaultValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t readBoolEnv(const char *envName, bool defaultValue)
|
bool readBoolEnv(const char *envName, bool defaultValue)
|
||||||
{
|
{
|
||||||
auto envString = std::getenv(envName);
|
auto envString = qEnvironmentVariable(envName);
|
||||||
if (envString != nullptr)
|
if (!envString.isEmpty())
|
||||||
{
|
{
|
||||||
return QVariant(QString(envString)).toBool();
|
return QVariant(envString).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
@@ -90,14 +70,14 @@ namespace {
|
|||||||
|
|
||||||
Env::Env()
|
Env::Env()
|
||||||
: recentMessagesApiUrl(
|
: recentMessagesApiUrl(
|
||||||
readStringEnv("CHATTERINO2_RECENT_MESSAGES_URL",
|
qEnvironmentVariable("CHATTERINO2_RECENT_MESSAGES_URL",
|
||||||
"https://recent-messages.robotty.de/api/v2/"
|
"https://recent-messages.robotty.de/api/v2/"
|
||||||
"recent-messages/%1"))
|
"recent-messages/%1"))
|
||||||
, linkResolverUrl(readStringEnv(
|
, linkResolverUrl(qEnvironmentVariable(
|
||||||
"CHATTERINO2_LINK_RESOLVER_URL",
|
"CHATTERINO2_LINK_RESOLVER_URL",
|
||||||
"https://braize.pajlada.com/chatterino/link_resolver/%1"))
|
"https://braize.pajlada.com/chatterino/link_resolver/%1"))
|
||||||
, twitchServerHost(
|
, twitchServerHost(qEnvironmentVariable("CHATTERINO2_TWITCH_SERVER_HOST",
|
||||||
readStringEnv("CHATTERINO2_TWITCH_SERVER_HOST", "irc.chat.twitch.tv"))
|
"irc.chat.twitch.tv"))
|
||||||
, twitchServerPort(readPortEnv("CHATTERINO2_TWITCH_SERVER_PORT", 443))
|
, twitchServerPort(readPortEnv("CHATTERINO2_TWITCH_SERVER_PORT", 443))
|
||||||
, twitchServerSecure(readBoolEnv("CHATTERINO2_TWITCH_SERVER_SECURE", true))
|
, twitchServerSecure(readBoolEnv("CHATTERINO2_TWITCH_SERVER_SECURE", true))
|
||||||
, proxyUrl(readOptionalStringEnv("CHATTERINO2_PROXY_URL"))
|
, proxyUrl(readOptionalStringEnv("CHATTERINO2_PROXY_URL"))
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ QString sendShoutout(const CommandContext &ctx)
|
|||||||
|
|
||||||
getHelix()->getUserByName(
|
getHelix()->getUserByName(
|
||||||
target,
|
target,
|
||||||
[twitchChannel, channel, currentUser, &target](const auto targetUser) {
|
[twitchChannel, channel, currentUser](const auto targetUser) {
|
||||||
getHelix()->sendShoutout(
|
getHelix()->sendShoutout(
|
||||||
twitchChannel->roomId(), targetUser.id,
|
twitchChannel->roomId(), targetUser.id,
|
||||||
currentUser->getUserId(),
|
currentUser->getUserId(),
|
||||||
|
|||||||
@@ -208,11 +208,11 @@ void NotificationController::checkStream(bool live, QString channelName)
|
|||||||
|
|
||||||
void NotificationController::removeFakeChannel(const QString channelName)
|
void NotificationController::removeFakeChannel(const QString channelName)
|
||||||
{
|
{
|
||||||
auto i = std::find(fakeTwitchChannels.begin(), fakeTwitchChannels.end(),
|
auto it = std::find(fakeTwitchChannels.begin(), fakeTwitchChannels.end(),
|
||||||
channelName);
|
channelName);
|
||||||
if (i != fakeTwitchChannels.end())
|
if (it != fakeTwitchChannels.end())
|
||||||
{
|
{
|
||||||
fakeTwitchChannels.erase(i);
|
fakeTwitchChannels.erase(it);
|
||||||
// "delete" old 'CHANNEL is live' message
|
// "delete" old 'CHANNEL is live' message
|
||||||
LimitedQueueSnapshot<MessagePtr> snapshot =
|
LimitedQueueSnapshot<MessagePtr> snapshot =
|
||||||
getApp()->twitch->liveChannel->getMessageSnapshot();
|
getApp()->twitch->liveChannel->getMessageSnapshot();
|
||||||
|
|||||||
@@ -256,8 +256,8 @@ void MiniaudioBackend::play(const QUrl &sound)
|
|||||||
if (sound.isLocalFile())
|
if (sound.isLocalFile())
|
||||||
{
|
{
|
||||||
auto soundPath = sound.toLocalFile();
|
auto soundPath = sound.toLocalFile();
|
||||||
auto result = ma_engine_play_sound(this->engine.get(),
|
result = ma_engine_play_sound(this->engine.get(),
|
||||||
qPrintable(soundPath), nullptr);
|
qPrintable(soundPath), nullptr);
|
||||||
if (result != MA_SUCCESS)
|
if (result != MA_SUCCESS)
|
||||||
{
|
{
|
||||||
qCWarning(chatterinoSound) << "Failed to play sound" << sound
|
qCWarning(chatterinoSound) << "Failed to play sound" << sound
|
||||||
|
|||||||
@@ -11,10 +11,6 @@
|
|||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
const int RECONNECT_BASE_INTERVAL = 2000;
|
|
||||||
// 60 falloff counter means it will try to reconnect at most every 60*2 seconds
|
|
||||||
const int MAX_FALLOFF_COUNTER = 60;
|
|
||||||
|
|
||||||
// Ratelimits for joinBucket_
|
// Ratelimits for joinBucket_
|
||||||
const int JOIN_RATELIMIT_BUDGET = 18;
|
const int JOIN_RATELIMIT_BUDGET = 18;
|
||||||
const int JOIN_RATELIMIT_COOLDOWN = 12500;
|
const int JOIN_RATELIMIT_COOLDOWN = 12500;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ IrcConnection::IrcConnection(QObject *parent)
|
|||||||
{
|
{
|
||||||
// Log connection errors for ease-of-debugging
|
// Log connection errors for ease-of-debugging
|
||||||
QObject::connect(this, &Communi::IrcConnection::socketError, this,
|
QObject::connect(this, &Communi::IrcConnection::socketError, this,
|
||||||
[this](QAbstractSocket::SocketError error) {
|
[](QAbstractSocket::SocketError error) {
|
||||||
qCDebug(chatterinoIrc) << "Connection error:" << error;
|
qCDebug(chatterinoIrc) << "Connection error:" << error;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -210,7 +210,6 @@ PubSub::PubSub(const QString &host, std::chrono::seconds pingInterval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
action.target.login = args[0].toString();
|
action.target.login = args[0].toString();
|
||||||
bool ok;
|
|
||||||
action.messageText = args[1].toString();
|
action.messageText = args[1].toString();
|
||||||
action.messageId = args[2].toString();
|
action.messageId = args[2].toString();
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ namespace {
|
|||||||
#else
|
#else
|
||||||
const QString MAGIC_MESSAGE_SUFFIX = QString::fromUtf8(u8" \U000E0000");
|
const QString MAGIC_MESSAGE_SUFFIX = QString::fromUtf8(u8" \U000E0000");
|
||||||
#endif
|
#endif
|
||||||
constexpr int TITLE_REFRESH_PERIOD = 10000;
|
|
||||||
constexpr int CLIP_CREATION_COOLDOWN = 5000;
|
constexpr int CLIP_CREATION_COOLDOWN = 5000;
|
||||||
const QString CLIPS_LINK("https://clips.twitch.tv/%1");
|
const QString CLIPS_LINK("https://clips.twitch.tv/%1");
|
||||||
const QString CLIPS_FAILURE_CLIPS_DISABLED_TEXT(
|
const QString CLIPS_FAILURE_CLIPS_DISABLED_TEXT(
|
||||||
|
|||||||
@@ -1729,7 +1729,7 @@ void TwitchMessageBuilder::listOfUsersSystemMessage(
|
|||||||
MessagePtr TwitchMessageBuilder::buildHypeChatMessage(
|
MessagePtr TwitchMessageBuilder::buildHypeChatMessage(
|
||||||
Communi::IrcPrivateMessage *message)
|
Communi::IrcPrivateMessage *message)
|
||||||
{
|
{
|
||||||
auto level = message->tag(u"pinned-chat-paid-level"_s).toString();
|
auto levelID = message->tag(u"pinned-chat-paid-level"_s).toString();
|
||||||
auto currency = message->tag(u"pinned-chat-paid-currency"_s).toString();
|
auto currency = message->tag(u"pinned-chat-paid-currency"_s).toString();
|
||||||
bool okAmount = false;
|
bool okAmount = false;
|
||||||
auto amount = message->tag(u"pinned-chat-paid-amount"_s).toInt(&okAmount);
|
auto amount = message->tag(u"pinned-chat-paid-amount"_s).toInt(&okAmount);
|
||||||
@@ -1743,7 +1743,7 @@ MessagePtr TwitchMessageBuilder::buildHypeChatMessage(
|
|||||||
// additionally, there's `pinned-chat-paid-is-system-message` which isn't used by Chatterino.
|
// additionally, there's `pinned-chat-paid-is-system-message` which isn't used by Chatterino.
|
||||||
|
|
||||||
QString subtitle;
|
QString subtitle;
|
||||||
auto levelIt = HYPE_CHAT_PAID_LEVEL.find(level);
|
auto levelIt = HYPE_CHAT_PAID_LEVEL.find(levelID);
|
||||||
if (levelIt != HYPE_CHAT_PAID_LEVEL.end())
|
if (levelIt != HYPE_CHAT_PAID_LEVEL.end())
|
||||||
{
|
{
|
||||||
const auto &level = levelIt->second;
|
const auto &level = levelIt->second;
|
||||||
|
|||||||
@@ -750,7 +750,7 @@ void WindowManager::applyWindowLayout(const WindowLayout &layout)
|
|||||||
// out of bounds windows
|
// out of bounds windows
|
||||||
auto screens = qApp->screens();
|
auto screens = qApp->screens();
|
||||||
bool outOfBounds =
|
bool outOfBounds =
|
||||||
!getenv("I3SOCK") &&
|
!qEnvironmentVariableIsSet("I3SOCK") &&
|
||||||
std::none_of(screens.begin(), screens.end(),
|
std::none_of(screens.begin(), screens.end(),
|
||||||
[&](QScreen *screen) {
|
[&](QScreen *screen) {
|
||||||
return screen->availableGeometry().intersects(
|
return screen->availableGeometry().intersects(
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#ifdef USEWINSDK
|
#ifdef USEWINSDK
|
||||||
# include <Windows.h>
|
# include <Windows.h>
|
||||||
|
|
||||||
# include <iostream>
|
# include <tuple>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
@@ -13,8 +13,8 @@ void attachToConsole()
|
|||||||
#ifdef USEWINSDK
|
#ifdef USEWINSDK
|
||||||
if (AttachConsole(ATTACH_PARENT_PROCESS))
|
if (AttachConsole(ATTACH_PARENT_PROCESS))
|
||||||
{
|
{
|
||||||
freopen("CONOUT$", "w", stdout);
|
std::ignore = freopen_s(nullptr, "CONOUT$", "w", stdout);
|
||||||
freopen("CONOUT$", "w", stderr);
|
std::ignore = freopen_s(nullptr, "CONOUT$", "w", stderr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ float BaseWindow::scale() const
|
|||||||
|
|
||||||
float BaseWindow::qtFontScale() const
|
float BaseWindow::qtFontScale() const
|
||||||
{
|
{
|
||||||
return this->scale() / std::max<float>(0.01, this->nativeScale_);
|
return this->scale() / std::max<float>(0.01F, this->nativeScale_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseWindow::init()
|
void BaseWindow::init()
|
||||||
|
|||||||
@@ -95,11 +95,13 @@ void Label::paintEvent(QPaintEvent *)
|
|||||||
QFontMetrics metrics = getFonts()->getFontMetrics(
|
QFontMetrics metrics = getFonts()->getFontMetrics(
|
||||||
this->getFontStyle(),
|
this->getFontStyle(),
|
||||||
this->scale() * 96.f /
|
this->scale() * 96.f /
|
||||||
std::max<float>(0.01, this->logicalDpiX() * deviceDpi));
|
std::max<float>(
|
||||||
|
0.01F, static_cast<float>(this->logicalDpiX() * deviceDpi)));
|
||||||
painter.setFont(getFonts()->getFont(
|
painter.setFont(getFonts()->getFont(
|
||||||
this->getFontStyle(),
|
this->getFontStyle(),
|
||||||
this->scale() * 96.f /
|
this->scale() * 96.f /
|
||||||
std::max<float>(0.02, this->logicalDpiX() * deviceDpi)));
|
std::max<float>(
|
||||||
|
0.02F, static_cast<float>(this->logicalDpiX() * deviceDpi))));
|
||||||
|
|
||||||
int offset = this->getOffset();
|
int offset = this->getOffset();
|
||||||
|
|
||||||
|
|||||||
@@ -238,11 +238,11 @@ void ReplyThreadPopup::addMessagesFromThread()
|
|||||||
this->ui_.threadView->setChannel(this->virtualChannel_);
|
this->ui_.threadView->setChannel(this->virtualChannel_);
|
||||||
this->ui_.threadView->setSourceChannel(sourceChannel);
|
this->ui_.threadView->setSourceChannel(sourceChannel);
|
||||||
|
|
||||||
auto overrideFlags =
|
auto rootOverrideFlags =
|
||||||
std::optional<MessageFlags>(this->thread_->root()->flags);
|
std::optional<MessageFlags>(this->thread_->root()->flags);
|
||||||
overrideFlags->set(MessageFlag::DoNotLog);
|
rootOverrideFlags->set(MessageFlag::DoNotLog);
|
||||||
|
|
||||||
this->virtualChannel_->addMessage(this->thread_->root(), overrideFlags);
|
this->virtualChannel_->addMessage(this->thread_->root(), rootOverrideFlags);
|
||||||
for (const auto &msgRef : this->thread_->replies())
|
for (const auto &msgRef : this->thread_->replies())
|
||||||
{
|
{
|
||||||
if (auto msg = msgRef.lock())
|
if (auto msg = msgRef.lock())
|
||||||
|
|||||||
@@ -992,43 +992,11 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget()
|
|||||||
.setLayoutType<QHBoxLayout>()
|
.setLayoutType<QHBoxLayout>()
|
||||||
.withoutMargin();
|
.withoutMargin();
|
||||||
|
|
||||||
QColor color1(255, 255, 255, 80);
|
|
||||||
QColor color2(255, 255, 255, 0);
|
|
||||||
|
|
||||||
int buttonWidth = 40;
|
int buttonWidth = 40;
|
||||||
// int buttonWidth = 24;
|
|
||||||
int buttonWidth2 = 32;
|
|
||||||
int buttonHeight = 32;
|
int buttonHeight = 32;
|
||||||
|
|
||||||
layout->setSpacing(16);
|
layout->setSpacing(16);
|
||||||
|
|
||||||
//auto addButton = [&](Action action, const QString &text,
|
|
||||||
// const QPixmap &pixmap) {
|
|
||||||
// auto vbox = layout.emplace<QVBoxLayout>().withoutMargin();
|
|
||||||
// {
|
|
||||||
// auto title = vbox.emplace<QHBoxLayout>().withoutMargin();
|
|
||||||
// title->addStretch(1);
|
|
||||||
// auto label = title.emplace<Label>(text);
|
|
||||||
// label->setHasOffset(false);
|
|
||||||
// label->setStyleSheet("color: #BBB");
|
|
||||||
// title->addStretch(1);
|
|
||||||
|
|
||||||
// auto hbox = vbox.emplace<QHBoxLayout>().withoutMargin();
|
|
||||||
// hbox->setSpacing(0);
|
|
||||||
// {
|
|
||||||
// auto button = hbox.emplace<Button>(nullptr);
|
|
||||||
// button->setPixmap(pixmap);
|
|
||||||
// button->setScaleIndependantSize(buttonHeight, buttonHeight);
|
|
||||||
// button->setBorderColor(QColor(255, 255, 255, 127));
|
|
||||||
|
|
||||||
// QObject::connect(
|
|
||||||
// button.getElement(), &Button::leftClicked, [this, action] {
|
|
||||||
// this->buttonClicked.invoke(std::make_pair(action, -1));
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//};
|
|
||||||
|
|
||||||
const auto addLayout = [&](const QString &text) {
|
const auto addLayout = [&](const QString &text) {
|
||||||
auto vbox = layout.emplace<QVBoxLayout>().withoutMargin();
|
auto vbox = layout.emplace<QVBoxLayout>().withoutMargin();
|
||||||
auto title = vbox.emplace<QHBoxLayout>().withoutMargin();
|
auto title = vbox.emplace<QHBoxLayout>().withoutMargin();
|
||||||
|
|||||||
@@ -2888,12 +2888,14 @@ void ChannelView::setInputReply(const MessagePtr &message)
|
|||||||
if (!message->replyThread)
|
if (!message->replyThread)
|
||||||
{
|
{
|
||||||
// Message did not already have a thread attached, try to find or create one
|
// Message did not already have a thread attached, try to find or create one
|
||||||
if (auto *tc =
|
auto *tc =
|
||||||
dynamic_cast<TwitchChannel *>(this->underlyingChannel_.get()))
|
dynamic_cast<TwitchChannel *>(this->underlyingChannel_.get());
|
||||||
|
if (!tc)
|
||||||
{
|
{
|
||||||
tc->getOrCreateThread(message);
|
tc = dynamic_cast<TwitchChannel *>(this->channel_.get());
|
||||||
}
|
}
|
||||||
else if (auto *tc = dynamic_cast<TwitchChannel *>(this->channel_.get()))
|
|
||||||
|
if (tc)
|
||||||
{
|
{
|
||||||
tc->getOrCreateThread(message);
|
tc->getOrCreateThread(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -424,7 +424,6 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
|||||||
|
|
||||||
// select the right tab colors
|
// select the right tab colors
|
||||||
Theme::TabColors colors;
|
Theme::TabColors colors;
|
||||||
Theme::TabColors regular = this->theme->tabs.regular;
|
|
||||||
|
|
||||||
if (this->selected_)
|
if (this->selected_)
|
||||||
colors = this->theme->tabs.selected;
|
colors = this->theme->tabs.selected;
|
||||||
|
|||||||
@@ -161,7 +161,6 @@ void GenericListView::refreshTheme(const Theme &theme)
|
|||||||
bool GenericListView::acceptCompletion()
|
bool GenericListView::acceptCompletion()
|
||||||
{
|
{
|
||||||
const QModelIndex &curIdx = this->currentIndex();
|
const QModelIndex &curIdx = this->currentIndex();
|
||||||
const int curRow = curIdx.row();
|
|
||||||
const int count = this->model_->rowCount(curIdx);
|
const int count = this->model_->rowCount(curIdx);
|
||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -256,9 +256,9 @@ public:
|
|||||||
{
|
{
|
||||||
auto *combo = this->addDropdown(text, {}, std::move(toolTipText));
|
auto *combo = this->addDropdown(text, {}, std::move(toolTipText));
|
||||||
|
|
||||||
for (const auto &text : items)
|
for (const auto &item : items)
|
||||||
{
|
{
|
||||||
combo->addItem(QString::fromStdString(std::string(text)));
|
combo->addItem(QString::fromStdString(std::string(item)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defaultValueText.isEmpty())
|
if (!defaultValueText.isEmpty())
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ void tableCellClicked(const QModelIndex &clicked, EditableModelView *view,
|
|||||||
if (wasAccepted)
|
if (wasAccepted)
|
||||||
{
|
{
|
||||||
auto newHotkey = dialog.data();
|
auto newHotkey = dialog.data();
|
||||||
auto vectorIndex =
|
getApp()->hotkeys->replaceHotkey(hotkey->name(), newHotkey);
|
||||||
getApp()->hotkeys->replaceHotkey(hotkey->name(), newHotkey);
|
|
||||||
getApp()->hotkeys->save();
|
getApp()->hotkeys->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +68,7 @@ KeyboardSettingsPage::KeyboardSettingsPage()
|
|||||||
if (wasAccepted)
|
if (wasAccepted)
|
||||||
{
|
{
|
||||||
auto newHotkey = dialog.data();
|
auto newHotkey = dialog.data();
|
||||||
int vectorIndex = getApp()->hotkeys->hotkeys_.append(newHotkey);
|
getApp()->hotkeys->hotkeys_.append(newHotkey);
|
||||||
getApp()->hotkeys->save();
|
getApp()->hotkeys->save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -21,36 +21,40 @@ bool filterItemsRec(QObject *object, const QString &query)
|
|||||||
widget->update();
|
widget->update();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (auto x = dynamic_cast<SCheckBox *>(child); x)
|
if (auto *checkBox = dynamic_cast<SCheckBox *>(child))
|
||||||
{
|
{
|
||||||
setOpacity(x, x->text().contains(query, Qt::CaseInsensitive));
|
setOpacity(checkBox,
|
||||||
|
checkBox->text().contains(query, Qt::CaseInsensitive));
|
||||||
}
|
}
|
||||||
else if (auto x = dynamic_cast<SLabel *>(child); x)
|
else if (auto *lbl = dynamic_cast<SLabel *>(child))
|
||||||
{
|
{
|
||||||
setOpacity(x, x->text().contains(query, Qt::CaseInsensitive));
|
setOpacity(lbl, lbl->text().contains(query, Qt::CaseInsensitive));
|
||||||
}
|
}
|
||||||
else if (auto x = dynamic_cast<SComboBox *>(child); x)
|
else if (auto *comboBox = dynamic_cast<SComboBox *>(child))
|
||||||
{
|
{
|
||||||
setOpacity(x, [=]() {
|
setOpacity(comboBox, [=]() {
|
||||||
for (int i = 0; i < x->count(); i++)
|
for (int i = 0; i < comboBox->count(); i++)
|
||||||
{
|
{
|
||||||
if (x->itemText(i).contains(query, Qt::CaseInsensitive))
|
if (comboBox->itemText(i).contains(query,
|
||||||
|
Qt::CaseInsensitive))
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}());
|
}());
|
||||||
}
|
}
|
||||||
else if (auto x = dynamic_cast<QTabWidget *>(child); x)
|
else if (auto *tabs = dynamic_cast<QTabWidget *>(child))
|
||||||
{
|
{
|
||||||
for (int i = 0; i < x->count(); i++)
|
for (int i = 0; i < tabs->count(); i++)
|
||||||
{
|
{
|
||||||
bool tabAny{};
|
bool tabAny{};
|
||||||
|
|
||||||
if (x->tabText(i).contains(query, Qt::CaseInsensitive))
|
if (tabs->tabText(i).contains(query, Qt::CaseInsensitive))
|
||||||
{
|
{
|
||||||
tabAny = true;
|
tabAny = true;
|
||||||
}
|
}
|
||||||
auto widget = x->widget(i);
|
auto *widget = tabs->widget(i);
|
||||||
tabAny |= filterItemsRec(widget, query);
|
tabAny |= filterItemsRec(widget, query);
|
||||||
|
|
||||||
any |= tabAny;
|
any |= tabAny;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
{ \
|
{ \
|
||||||
QPainter painter(this); \
|
QPainter painter(this); \
|
||||||
QColor color = QColor("#222222"); \
|
QColor color = QColor("#222222"); \
|
||||||
color.setAlphaF(0.7); \
|
color.setAlphaF(0.7F); \
|
||||||
painter.fillRect(this->rect(), color); \
|
painter.fillRect(this->rect(), color); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
|||||||
@@ -842,12 +842,12 @@ void SplitContainer::applyFromDescriptorRecursively(
|
|||||||
{
|
{
|
||||||
if (std::holds_alternative<SplitNodeDescriptor>(item))
|
if (std::holds_alternative<SplitNodeDescriptor>(item))
|
||||||
{
|
{
|
||||||
const auto *n = std::get_if<SplitNodeDescriptor>(&item);
|
const auto *inner = std::get_if<SplitNodeDescriptor>(&item);
|
||||||
if (!n)
|
if (!inner)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto &splitNode = *n;
|
const auto &splitNode = *inner;
|
||||||
auto *split = new Split(this);
|
auto *split = new Split(this);
|
||||||
split->setChannel(WindowManager::decodeChannel(splitNode));
|
split->setChannel(WindowManager::decodeChannel(splitNode));
|
||||||
split->setModerationMode(splitNode.moderationMode_);
|
split->setModerationMode(splitNode.moderationMode_);
|
||||||
|
|||||||
@@ -947,8 +947,6 @@ void SplitHeader::enterEvent(QEvent *event)
|
|||||||
{
|
{
|
||||||
if (!this->tooltipText_.isEmpty())
|
if (!this->tooltipText_.isEmpty())
|
||||||
{
|
{
|
||||||
auto *channel = this->split_->getChannel().get();
|
|
||||||
|
|
||||||
this->tooltipWidget_->setOne({nullptr, this->tooltipText_});
|
this->tooltipWidget_->setOne({nullptr, this->tooltipText_});
|
||||||
this->tooltipWidget_->setWordWrap(true);
|
this->tooltipWidget_->setWordWrap(true);
|
||||||
this->tooltipWidget_->adjustSize();
|
this->tooltipWidget_->adjustSize();
|
||||||
|
|||||||
Reference in New Issue
Block a user