-
-
Notifications
You must be signed in to change notification settings - Fork 455
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(discussion): Should we only save the dimensions? I feel like it would be nice to save the position as well (QSize
⇾ QRect
). We have functions to do bounds-checking already, so I don't see why not.
src/widgets/Window.cpp
Outdated
this->resize(int(getSettings()->lastPopupWidth.getValue() * this->scale()), | ||
int(getSettings()->lastPopupHeight.getValue() * this->scale()) |
There was a problem hiding this comment.
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
src/singletons/Settings.hpp
Outdated
IntSetting lastPopupWidth = {"/appearance/popup/lastWidth", 300}; | ||
IntSetting lastPopupHeight = {"/appearance/popup/lastHeight", 500}; |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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
imo yeah, at least as part of this change. keeping it simple |
Sure, but then it should be "forwards" compatible with settings that save the position as well (i.e. save the stuff in an object with "width" and "height" - I think it should be enough to rename the keys to |
Thank you @maliByatzes! Two open things:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
src/widgets/Window.cpp
Outdated
@@ -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()), |
There was a problem hiding this comment.
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()),
^
src/widgets/Window.cpp
Outdated
@@ -75,7 +75,9 @@ | |||
} | |||
else | |||
{ | |||
this->resize(int(300 * this->scale()), int(500 * this->scale())); | |||
this->resize(int(getSettings()->lastPopupWidth.getValue() * this->scale()), | |||
int(getSettings()->lastPopupHeight.getValue() * this->scale()) |
There was a problem hiding this comment.
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())
^
Thank you for your feedback, I'll look into these suggested changes, I will scream for help if I can't figure it out. |
@pajlada I wrote the below Serialize and Deserialize for QSize, I'm wondering if it's corrects?
|
That looks correct at a glance yeah! |
@pajlada Im having a problem with the changes I made above, the |
Yeah you're right - |
@pajlada A call to
with the below snippet using
|
@maliByatzes Any place that sets lastPopupSetting will need to include the new file you made ( It could be included in there's a chance we have to include it in |
@pajlada Submitted the last commit for this PR, but I was thinking I could also add the position tracking as @/Nerixyz said earlier. Just to keep it simple. |
I'd prefer to not do position tracking for now, since I'm not sure it's something we want |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! As a first-time contributor, you are now eligible to be listed in the About page in Chatterino.
If you want this, you can open a new PR where you modify the resources/contributors.txt
file and add yourself to the list. Read the comments at the top for instructions.
Let me know if you have any questions about the follow-up commits I made to your code
Fixes #1788
Adedd two new values in the
Settings.hpp
file to keep track of the last popup window's width and height. On closing a popup window, while the main window is still active, bothlastPopupWidth
andlastPopupHeight
are updated with the last window's dimensions. When a new popup window is created it uses those same dimensions to be same width and height as the last window.