Skip to content

feat(appearance): reimplement snow#194

Open
kaeeraa wants to merge 2 commits into
FreesmTeam:developfrom
kaeeraa:develop
Open

feat(appearance): reimplement snow#194
kaeeraa wants to merge 2 commits into
FreesmTeam:developfrom
kaeeraa:develop

Conversation

@kaeeraa

@kaeeraa kaeeraa commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

yeah, go on. steal this +2000 feature

@kaeeraa
kaeeraa force-pushed the develop branch 2 times, most recently from e893f22 to b220656 Compare June 13, 2026 13:53
@kaeeraa
kaeeraa marked this pull request as ready for review June 13, 2026 13:53
Signed-off-by: kaeeraa <kaeeraa@nebula-nook.ru>
@so5iso4ka
so5iso4ka self-requested a review July 17, 2026 18:54

@so5iso4ka so5iso4ka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some or all files: fix header includes and use correct license headers.

QAbstractItemView::currentChanged(current, previous);
// TODO: for accessibility support, implement+register a factory, steal QAccessibleTable from Qt and return an instance of it for
// InstanceView.
#ifndef QT_NO_ACCESSIBILITY

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's up with this TODO?

void generateSnow();
void reflowSnowflakes();
void drawSnow(QPainter& painter);
static QColor getSnowColor();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should move both of these functions to an anonymous namespace? Since they aren't directly related to InstanceView.

return;
}

QTimer::singleShot(0, this, [this] { generateSnow(); });

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is called from the constructor, and the QTimer documentation states: "As a special case, a QTimer with a timeout of 0 will time out as soon as possible, though the ordering between zero-timeout timers and other sources of events is unspecified." If I understand correctly, it may call generateSnow() before the widget reaches its normal size, in which case it won’t generate any snowflakes. I think it would be better to move this call to resizeEvent, based on the normal size and the missing snowflakes.

SnowflakePack* targetPack = nullptr;
bool isGif = false;

for (auto* pack : packs) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary code; no snow from multiple snowpacks. It's also too heavy for frequent calls from paintEvent.

if (m_snowVisible) {
const QSize newSize = viewport()->size();

if (m_lastViewportSize.isValid()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QSize::isValid(): "Returns true if both the width and height are equal to or greater than 0; otherwise returns false." This will allow a zero size, which will result in division by zero. QSize::isEmpty() would be more appropriate here.

}
m_ui->snowColorComboBox->setCurrentIndex(snowColorIndex);

applySnow(m_ui->snowBox->isChecked());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here?

APPLICATION->currentSnowChanged(visible);
}

void AppearanceWidget::applySnowColor(const QString& color)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary wrapping of a single line.

}
}

if (m_ui->snowflakePackComboBox->currentIndex() < 0 && defaultSnowflakeIndex >= 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QComboBox::currentIndex() will not be -1 after the very first item is added on line 404.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setMinimum(int) and setMaximum(int) do not handle cases where the minimum is greater than the maximum, which causes undefined behavior in std::clamp.

return;
}

if (event->key() == Qt::Key_Tab || event->key() == Qt::Key_Backtab) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary code, this is handled in RangeSlider::event().

@arthursimao

Copy link
Copy Markdown
Contributor
image this sounds scary lol

imagine someone just goes to you and says

this guy requested changes NOW

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants