-
Notifications
You must be signed in to change notification settings - Fork 29
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
Implement experimental option for custom main menu icon on 4.23.15505+ #98
Conversation
Done, but I haven't actually tested it yet. |
Might not be directly related to this PR, but, I botched the syntax (forgot the Except, even if I fix it, NM tries to re-parse it (e.g., the ts change is detected, revision incremented and all that jazz), but it still fails to parse, and prints the line numbers from the old, broken file? |
Okay, have now tried with random giant (as in, Forma-sized) PNGs (e.g., KOReader's icon), and it's quite likely crashing right after:
|
|
Good news: it's 100% less explode-y when using smaller icons. New problem, though: the scaling ^^. (From 144x icons pilfered from koreader/koreader#6937 ;p). Also: the active variant is never displayed. |
Note that this also applies to the default icon ^^ |
Unless I'm misunderstanding nickel, MainNavView.qss is expecting the icon to be a certain size:
|
Thanks for testing this!
Ooh, I like that icon. It fits well with the rest (I should have thought of the new material icons earlier). I might even make it the default in the future.
That's why I set the defaults for it as I did :) .
I guess I could parse the scale from MainNavView.qss or one of the existing icons, then dynamically resize the pixmap. This would also allow me to easily add an option for SVG icons in the future, which would be a requirement for me to add a custom icon since I try to keep NM as forward-compatible as possible.
I'll have to look into that crash to ensure I understand the requirements properly.
Huh. That shouldn't be possible unless there's a bug somewhere or one of my assumptions with menu behaviour was incorrect. Do the logs shown NM re-injecting the config error after the updated config files are parsed, or is it staying with the old one? |
Just FYI... MainNavView doesn't contain the exact icon size it contains a min-/max-height value of 2.5 x icon height (for model), to also include height of label (plus some vertical padding???). So taking size from existing icons might be more reliable in the long run. |
Here's the full log:
|
The stupid workaround I can think of is simply load the default one, and ask Qt about its size ;p. |
What did you do to attempt to fix the broken file? |
I started by commenting out the not-supported-in-this-build stuff (e.g., the two selection menu items that it was tripping on @ L19). Then I fixed the actual Then I just added LFs a couple of times to try to see if that would help :D. (aka. muppet flail ^^) FWIW, the config was untouched between that log, and the next Nickel restart, where it imploded (#98 (comment)). |
Ready for testing. |
Code looks ok, once I figured out what it was doing. Just a minor comment. |
The giant PNGs test still implodes Nickel (but I do get the scaling notification from NM first). At a quick glance, GDB was fairly unhelpful, but it probably had a bit of trouble tracking threads properly. The sane PNG test was successful, and it does indeed get scaled properly ;). |
I wonder if this bug report is applicable here? The safer thing to do might be to load the image file using QImage, scale it down and save it. Then it can be sure that QPixmap is never opening a large image. |
They're not that big, but, who knows, I did see mention of the pixmap cache in one of the least useless tracebacks...
|
Everything should be fixed now. |
Alas, giant PNGs still implode Nickel ;/. |
Not that it should matter, but this is what's generated by QImage:
e.g., a standard PNG24. It displays just fine via FBInk FWIW. Trying to only set a single icon instead of both (normal + active) doesn't help either. |
I'm going to look into this more myself tomorrow. If I can't figure out the cause, I'll probably leave this feature for after v0.5.0. |
Good news: I'm an idiot. Of course, if I'm pointing to icons that are being watched by KFMon... it'll trip their watch. So by using the KOReader icon, I was actually launching KOReader in the middle of Nickel's boot... -_-". Suffice it to say, if I copy the icons elsewhere, everything's peachy :). |
That would probably do it. 🤣 How did that cause it to crash instead of terminating cleanly, though?
So this is ready to be merged? |
Because nickel doesn't have a SIGTERM handler ;).
Yep! |
One last question: did the failsafe trip properly, or did you need to manually remove NM? I'm asking since if it was too late for the failsafe, I'll add another for critical operations like this. |
No, it tripped just fine ;). |
Done. I'll make a release sometime before the end of this week. |
closes #84