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:
@@ -118,7 +118,7 @@ float BaseWindow::scale() 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()
|
||||
|
||||
@@ -95,11 +95,13 @@ void Label::paintEvent(QPaintEvent *)
|
||||
QFontMetrics metrics = getFonts()->getFontMetrics(
|
||||
this->getFontStyle(),
|
||||
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(
|
||||
this->getFontStyle(),
|
||||
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();
|
||||
|
||||
|
||||
@@ -238,11 +238,11 @@ void ReplyThreadPopup::addMessagesFromThread()
|
||||
this->ui_.threadView->setChannel(this->virtualChannel_);
|
||||
this->ui_.threadView->setSourceChannel(sourceChannel);
|
||||
|
||||
auto overrideFlags =
|
||||
auto rootOverrideFlags =
|
||||
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())
|
||||
{
|
||||
if (auto msg = msgRef.lock())
|
||||
|
||||
@@ -992,43 +992,11 @@ UserInfoPopup::TimeoutWidget::TimeoutWidget()
|
||||
.setLayoutType<QHBoxLayout>()
|
||||
.withoutMargin();
|
||||
|
||||
QColor color1(255, 255, 255, 80);
|
||||
QColor color2(255, 255, 255, 0);
|
||||
|
||||
int buttonWidth = 40;
|
||||
// int buttonWidth = 24;
|
||||
int buttonWidth2 = 32;
|
||||
int buttonHeight = 32;
|
||||
|
||||
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) {
|
||||
auto vbox = layout.emplace<QVBoxLayout>().withoutMargin();
|
||||
auto title = vbox.emplace<QHBoxLayout>().withoutMargin();
|
||||
|
||||
@@ -2888,12 +2888,14 @@ void ChannelView::setInputReply(const MessagePtr &message)
|
||||
if (!message->replyThread)
|
||||
{
|
||||
// Message did not already have a thread attached, try to find or create one
|
||||
if (auto *tc =
|
||||
dynamic_cast<TwitchChannel *>(this->underlyingChannel_.get()))
|
||||
auto *tc =
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -424,7 +424,6 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
||||
|
||||
// select the right tab colors
|
||||
Theme::TabColors colors;
|
||||
Theme::TabColors regular = this->theme->tabs.regular;
|
||||
|
||||
if (this->selected_)
|
||||
colors = this->theme->tabs.selected;
|
||||
|
||||
@@ -161,7 +161,6 @@ void GenericListView::refreshTheme(const Theme &theme)
|
||||
bool GenericListView::acceptCompletion()
|
||||
{
|
||||
const QModelIndex &curIdx = this->currentIndex();
|
||||
const int curRow = curIdx.row();
|
||||
const int count = this->model_->rowCount(curIdx);
|
||||
if (count <= 0)
|
||||
{
|
||||
|
||||
@@ -256,9 +256,9 @@ public:
|
||||
{
|
||||
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())
|
||||
|
||||
@@ -34,8 +34,7 @@ void tableCellClicked(const QModelIndex &clicked, EditableModelView *view,
|
||||
if (wasAccepted)
|
||||
{
|
||||
auto newHotkey = dialog.data();
|
||||
auto vectorIndex =
|
||||
getApp()->hotkeys->replaceHotkey(hotkey->name(), newHotkey);
|
||||
getApp()->hotkeys->replaceHotkey(hotkey->name(), newHotkey);
|
||||
getApp()->hotkeys->save();
|
||||
}
|
||||
}
|
||||
@@ -69,7 +68,7 @@ KeyboardSettingsPage::KeyboardSettingsPage()
|
||||
if (wasAccepted)
|
||||
{
|
||||
auto newHotkey = dialog.data();
|
||||
int vectorIndex = getApp()->hotkeys->hotkeys_.append(newHotkey);
|
||||
getApp()->hotkeys->hotkeys_.append(newHotkey);
|
||||
getApp()->hotkeys->save();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -21,36 +21,40 @@ bool filterItemsRec(QObject *object, const QString &query)
|
||||
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, [=]() {
|
||||
for (int i = 0; i < x->count(); i++)
|
||||
setOpacity(comboBox, [=]() {
|
||||
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 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{};
|
||||
|
||||
if (x->tabText(i).contains(query, Qt::CaseInsensitive))
|
||||
if (tabs->tabText(i).contains(query, Qt::CaseInsensitive))
|
||||
{
|
||||
tabAny = true;
|
||||
}
|
||||
auto widget = x->widget(i);
|
||||
auto *widget = tabs->widget(i);
|
||||
tabAny |= filterItemsRec(widget, query);
|
||||
|
||||
any |= tabAny;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
{ \
|
||||
QPainter painter(this); \
|
||||
QColor color = QColor("#222222"); \
|
||||
color.setAlphaF(0.7); \
|
||||
color.setAlphaF(0.7F); \
|
||||
painter.fillRect(this->rect(), color); \
|
||||
} \
|
||||
} \
|
||||
|
||||
@@ -842,12 +842,12 @@ void SplitContainer::applyFromDescriptorRecursively(
|
||||
{
|
||||
if (std::holds_alternative<SplitNodeDescriptor>(item))
|
||||
{
|
||||
const auto *n = std::get_if<SplitNodeDescriptor>(&item);
|
||||
if (!n)
|
||||
const auto *inner = std::get_if<SplitNodeDescriptor>(&item);
|
||||
if (!inner)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const auto &splitNode = *n;
|
||||
const auto &splitNode = *inner;
|
||||
auto *split = new Split(this);
|
||||
split->setChannel(WindowManager::decodeChannel(splitNode));
|
||||
split->setModerationMode(splitNode.moderationMode_);
|
||||
|
||||
@@ -947,8 +947,6 @@ void SplitHeader::enterEvent(QEvent *event)
|
||||
{
|
||||
if (!this->tooltipText_.isEmpty())
|
||||
{
|
||||
auto *channel = this->split_->getChannel().get();
|
||||
|
||||
this->tooltipWidget_->setOne({nullptr, this->tooltipText_});
|
||||
this->tooltipWidget_->setWordWrap(true);
|
||||
this->tooltipWidget_->adjustSize();
|
||||
|
||||
Reference in New Issue
Block a user