-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Pattern pieces grouped in exported SVGs #1195
Conversation
…scenes, each scene being in a different group in the svg
PR Summary 📚Hooray! 👏 We've made some pretty exciting updates to our SVG generation capabilities. Let's dive in and break down how they make our system even better.
Let's celebrate these fantastic updates and keep pushing for excellence. Onwards and upwards, team! 🎉🚀 |
QString QDir::tempPath() QDir QDir::temp() |
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.
Looks great. Can you please add comments for the SvgGenerator class & methods so that they are included in the Doxygen docs during the CI?
As an example I'd like to stick to this format:
// @brief Adds a new piece to the container.
//
// This method adds a new piece to the container and returns its ID.
//
// @param piece The piece to add to the container.
// @return quint32 The ID of the new piece in the container.
//
// @details
// - The method generates a new unique ID for the piece by callinggetNextId()
.
// - It inserts the piece into the internal hash map of pieces using the generated ID.
// - The method returns the ID assigned to the new piece.quint32 VContainer::AddPiece(const VPiece &piece)
I feel so dumb right now 😂 Btw I found a way not to write any temporary files at all lmao, I'll add it to the PR when I have time 😊 (as a memo for myself : I need to use a QBuffer as the output device of the qSvgGenerator, I can then have the SVGs directly into bytearrays and convert them easily into QStrings and / or their corresponding DOM trees) |
Of course ! |
Fixes #716 |
Done. I added comments and I simplified the whole class by not creating temporary files anymore. |
8e0e0c2
to
d2d8254
Compare
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.
For Doxygen to include the @Briefs (as formated) , comment blocks need to go before the Method / function / member declaration.
There's a way to format the comments when positioned after, but it's breaking with the way we're currently placing the comment blocks.
Also since a new translation has been added to the ui, an lupdate should be run.
OK, I'll change that
👌 |
When a SVG is generated from piece or layout mode, each pattern piece is in its own group.
To achieve that, I decided to manually modify the generated xml files manipulating the corresponding DOM trees, because Qt doesn't allow to add groups into exported SVG files.
When a user exports a SVG named
foo.svg
, the software will create atempSvg_foo
directory into the destination directory, create a SVG (tempSVG_foo_xx.svg
) for each pattern piece to be exported, and then merge all the SVG together to group them separately. After the process, all the temporary files and folders are automatically deleted.I'm not super happy about the software creating temporary files into the destination directory though... is there another (better) place where I could generate those temporary files ? @DSCaskey