-
-
Notifications
You must be signed in to change notification settings - Fork 437
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
General settings #365
General settings #365
Conversation
`iced::Color` doesn't implement `serde::Deserialize` nor `serde::Serialize`. I need `Deserialize` so that custom color schemes can be deserialized into the palette type used in Sniffnet. I implemented ser/de to deserialize from a hex string into the float colors used by `iced`. My reasoning is that hexadecimal colors are easier for color scheme artists. Anecdotally, I've also noticed hex colors are the most prevalent for color schemes. Some schemes also provide RGB, but I haven't encountered float colors yet. For example: * [Catppuccin](https://github.com/catppuccin/catppuccin) * [Dracula](https://draculatheme.com/contribute) * [gruvbox](https://github.com/morhetz/gruvbox) * [Nord](https://github.com/nordtheme/nord) * [Tokyo Night](https://github.com/folke/tokyonight.nvim)
Merge branch 'main' of github.com:joshuamegnauth54/sniffnet into add_themes
Previously, I implemented a remote type to serialize and deserialize `iced::Color`. That implementation caused some problems when writing the unit tests because `serde_test` expected the `iced::Color` struct. I didn't want to overhaul the tests from their concise and more direct implementations - especially considering I don't really understand the problem. Anyway, using `deserialize_with` and `serialize_with` is cleaner than remote derive so this is overall a win. I implemented `PartialEq` for the custom style's palette's to account for floating point's imprecision. I also fixed an incorrectly copied number that caused the unit tests to fail. With that, deserializing custom styles from TOML seems to work and all unit tests pass.
- Add support for descriptions in other languages. - Use the latest `toml` crate because `confy`'s version had a bug that my code is hitting. Deserializing the `Language` enum in a TOML table failed with an error that claimed that the enum isn't a key. Upgrading the `toml` crate solved that problem. - Clean up TOML theme spec.
Primarily to keep parity with the types that derived Hash before these patches.
`StyleType` is no longer `Copy` because the enum holds `CustomStyle`.
Iced doesn't provide a file dialog to use because that should be handled natively or something. See [iced-rs/iced#347].
(Also, remove a debug line).
I previously wrote PartialEq implementations for `Color` and structs that used it, but deriving it seems to work fine now.
`StyleType` should serialize as a TOML table to account for `StyleType::Custom` taking a value. I added two attributes to `StyleType` to hint that the `toml` crate should serialize it as a table instead of a simple key = value.
This adds a unit test to ensure that every built in custom theme successfully deserializes.
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.
🚢
Hey @joshuamegnauth54 I finally merged to |
As the application is growing, more and more configurations are needed.
The current settings are not enough to cover more advanced customisations: for this reason, advanced settings are being introduced with this PR.
custom path for the output report, to find the file more easily or reduce the number of disk writes in case of SSDs(this will be implemented while adding support for PCAP generation)Moreover, this PR introduces the ability to remember the size and position of the application window so that it will reopen with the same window properties.