Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remember Popped-up Chat Size #5635

Merged
merged 16 commits into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/singletons/Settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ class Settings
BoolSetting useCustomFfzVipBadges = {
"/appearance/badges/useCustomFfzVipBadges", true};
BoolSetting showBadgesSevenTV = {"/appearance/badges/seventv", true};
IntSetting lastPopupWidth = {"/appearance/popup/lastWidth", 300};
IntSetting lastPopupHeight = {"/appearance/popup/lastHeight", 500};
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally, this should save a QSize. That would require a specialization for pajlada::[De]Serialize like for HighlightBadge.

Copy link
Member

Choose a reason for hiding this comment

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

If you're up for it, this would be a nice addition


/// Behaviour
BoolSetting allowDuplicateMessages = {"/behaviour/allowDuplicateMessages",
Expand Down
11 changes: 9 additions & 2 deletions src/widgets/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ Window::Window(WindowType type, QWidget *parent)
}
else
{
this->resize(int(300 * this->scale()), int(500 * this->scale()));
this->resize(int(getSettings()->lastPopupWidth.getValue() * this->scale()),
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'int' to 'float' [bugprone-narrowing-conversions]

        this->resize(int(getSettings()->lastPopupWidth.getValue() * this->scale()),
                         ^

int(getSettings()->lastPopupHeight.getValue() * this->scale())
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this shouldn't multiply by the scale, since that affects the size. The scenario would be:

  • Open popup
  • Resize to desired size
  • Close popup again
  • Zoom in/out in main window
  • Open popup
  • [What's the expected size here?] - I'd say it should have the same size as before

Copy link
Contributor

Choose a reason for hiding this comment

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

warning: narrowing conversion from 'int' to 'float' [bugprone-narrowing-conversions]

                     int(getSettings()->lastPopupHeight.getValue() * this->scale())
                         ^

);
}

this->signalHolder_.managedConnect(getApp()->getHotkeys()->onItemsUpdated,
Expand Down Expand Up @@ -148,7 +150,12 @@ void Window::closeEvent(QCloseEvent *)
getApp()->getWindows()->save();
getApp()->getWindows()->closeAll();
}

else
{
QRect rect = this->getBounds();
getSettings()->lastPopupWidth.setValue(rect.width());
getSettings()->lastPopupHeight.setValue(rect.height());
}
// Ensure selectedWindow_ is never an invalid pointer.
// WindowManager will return the main window if no window is pointed to by
// `selectedWindow_`.
Expand Down
Loading