Skip to content
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

Add transparency option to PDF export #25407 #25688

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

LeoTaoeee
Copy link

@LeoTaoeee LeoTaoeee commented Nov 29, 2024

Resolves: #25407

  • I signed the CLA
  • The title of the PR describes the problem it addresses
  • Each commit's message describes its purpose and effects, and references the issue it resolves
  • If changes are extensive, there is a sequence of easily reviewable commits
  • The code in the PR follows the coding rules
  • There are no unnecessary changes
  • The code compiles and runs on my machine, preferably after each commit individually
  • I created a unit test or vtest to verify the changes I made (if applicable)

@cbjeukendrup cbjeukendrup changed the title Ads transparency option to PDF export #25407 Add transparency option to PDF export #25407 Nov 29, 2024
Copy link
Contributor

@cbjeukendrup cbjeukendrup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR, it looks generally good! A few minor remarks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure that there are no unnecessary whitespace changes in this file (and other files)

@@ -51,6 +52,18 @@ void ImagesExportConfiguration::setExportPdfDpiResolution(int dpi)
settings()->setSharedValue(EXPORT_PDF_DPI_RESOLUTION_KEY, Val(dpi));
}

//pdf with transparency
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not necessary, since the name of the method is already meaningful enough

@@ -33,6 +33,10 @@ class ImagesExportConfiguration : public IImagesExportConfiguration
int exportPdfDpiResolution() const override;
void setExportPdfDpiResolution(int dpi) override;

//pdf with transparent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Same here)

@@ -65,9 +65,15 @@ Ret PdfWriter::write(INotationPtr notation, io::IODevice& destinationDevice, con
return false;
}

//transparency handling
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment doesn't add much information either; we prefer only writing comments when they contain information that cannot (easily) be deduced from the code itself.

Comment on lines +69 to +71
const bool TRANSPARENT_BACKGROUND = options.find(OptionKey::TRANSPARENT_BACKGROUND) != options.end()
? options.at(OptionKey::TRANSPARENT_BACKGROUND).toBool()
: configuration()->exportPdfWithTransparentBackground();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PngWriter uses muse::value for this; might be good to use that here too, for consistency.

Comment on lines +117 to +119
const bool TRANSPARENT_BACKGROUND = options.find(OptionKey::TRANSPARENT_BACKGROUND) != options.end()
? options.at(OptionKey::TRANSPARENT_BACKGROUND).toBool()
: configuration()->exportPdfWithTransparentBackground();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Same here)

Comment on lines +89 to +90
Q_PROPERTY(bool pdfTransparentBackground READ pdfTransparentBackground
WRITE setPdfTransparentBackground NOTIFY pdfTransparentBackgroundChanged)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to keep the order of the Q_PROPERTIES consistent, so this one should come after Q_PROPERTY(int pdfResolution …

@@ -55,4 +55,25 @@ ExportSettingsPage {
}
}
}

// Add transparency option
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is not necessary

Comment on lines +74 to +78

StyledTextLabel {
width: parent.width
text: qsTrc("project/export", "Each page of the selected parts will be exported as a separate %1 file.").arg("PDF")
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this label shouldn't be here; the text is not accurate, and for PDF there are already those radio buttons to select how parts should be exported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option to export PDFs with transparent background
2 participants