MainWindow/PaletteWidget: Move palette/translation handling to PaletteWidget #155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So, when I've added a new button for clearing whole combobox of palettes or translation palettes, etc. I've found out
we have a lot of duplicated logic for handling our color palettes, and almost all of that logic is the same between MainWindow
and PaletteWidget. I think I've seen it previously as well, but now adding a new button required me to update it in 3 places, for Palette, Translation and UniqTranslation in MainWindow, instead of having all of that stuff in one place, and as it pained me to do so, I've decided for a small refactor.
Basically,
Currently we are splitting the palette/translation handling between
MainWindow
class andPaletteWidget
, so this patch changes that by moving the whole logic for handling color palettes that was contained in MainWindow to PaletteWidget and unifies it, so all of the handling happens here, instead of MainWindow.I also found a lot of duplicated logic in MainWindow for translation palletes, uniq translation and normal palettes, I've tried to unify it as much as I could.
Note: I'd not name it full refactor, but just part of it, I wanted to at least move 90% of the logic to PaletteWidget. Fixed a couple of potential segfaults, as it seems in some places we were deleting non-existent memory but somehow
QPointer
didn't throw segfault on that.