-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
FEAT(client): Adding Save Image Functionality to View Comment (other users) and change comment (self) #6794
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
base: master
Are you sure you want to change the base?
Conversation
…nd change comment (self)
|
Where would make sense for adding a test for this feature (if at all)? @davidebeatrici @Hartmnt ... I have ensured it works locally but am curious if I can do anything more! |
There are only very few unit tests in Mumble. No need to do anything on that front.
We need some time to review your change For the time being, you can squash both commits into one. No need to have a separate commit for the formatting changes. |
Hartmnt
left a comment
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.
I have tested your changes. When opening the "Save as" file dialog, there is this checkbox:

When this is checked, saving the image will not work. I assume the reason is that you encoded the file filters with a , which does not seem to be how Qt wants this handled. When I uncheck the box, it seems to work. Please take a closer look at that. This will need to be fixed.
Other than that, please consider:
…users) and change comment (self)" This reverts commit 83c23d1.
Hartmnt
left a comment
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.
Nice work, removing the , seems to have fixed the remaining usability issues. So this is now working as intended.
I still have some things for you to tackle:
-
Your commits are not associated with a GitHub account. This is probably because you used a different Email here on GitHub than in your
git config user.email. We can still merge this without your commits being associated with your GitHub account, but then your GitHub Account will not be listed as a contributor to Mumble.
If you want to fix this, you need to make sure yourgit config user.emailis the same as your GitHub Email address and re-author your commits. -
Please make sure that your changes are within one commit. To do that you could squash the existing commits into one. If you don't know how to do that, lookup some online tutorials. You probably want to use something like
git rebase -ior something similar. -
When everything works and there is only one commit in this MR, we can fix the translation CI pipeline with out updateTranslations script
-
Also some code refactors:
| #include <QtWidgets/QInputDialog> | ||
| #include <QtWidgets/QMessageBox> | ||
| #include <QtWidgets/QScrollBar> | ||
| #include <QtWidgets/QTextEdit> |
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.
This is now unused
| QTextEdit *RichTextEditor::getRichTextEdit() { | ||
| return qteRichText; | ||
| } |
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.
getRichTextEdit is now unused
| RichTextEditor(QWidget *p = nullptr); | ||
| QString text(); | ||
| bool isModified() const; | ||
| QTextEdit *getRichTextEdit(); |
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.
getRichTextEdit is now unused
| if (!fileName.isEmpty()) { | ||
| if (QFileInfo(fileName).suffix().isEmpty()) | ||
| fileName += ".png"; // default to PNG if no extension | ||
| image.save(fileName); | ||
| } |
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.
{ and } for single line ifs
| if (!fileName.isEmpty()) { | |
| if (QFileInfo(fileName).suffix().isEmpty()) | |
| fileName += ".png"; // default to PNG if no extension | |
| image.save(fileName); | |
| } | |
| if (!fileName.isEmpty()) { | |
| if (QFileInfo(fileName).suffix().isEmpty()) { | |
| fileName += ".png"; // default to PNG if no extension | |
| } | |
| image.save(fileName); | |
| } |
|
|
||
| if (format.isImageFormat()) { | ||
| menu->addSeparator(); | ||
| menu->addAction(saveText, [=]() { |
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.
Don't know what your thinking was behind this, but I would rather still have this inline with the action creation
| menu->addAction(saveText, [=]() { | |
| menu->addAction(tr("Save Image As…"), [=]() { |
|
|
||
| void RichTextEditor::addContextMenuToSaveImages() { | ||
| qteRichText->setContextMenuPolicy(Qt::CustomContextMenu); | ||
| QString saveText = tr("Save Image As…"); |
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.
Don't know what your thinking was behind this, but I would rather still have this inline with the action creation
| } | ||
|
|
||
| void RichTextEditor::addContextMenuToSaveImages() { | ||
| qteRichText->setContextMenuPolicy(Qt::CustomContextMenu); |
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.
I think it would be nice, if you move the setContextMenuPolicy initialization bit into the constructor.
Then move the connect to the constructor as well, referencing your new method. Something like this:
connect(qteRichText, &QTextEdit::customContextMenuRequested, this, addContextMenuToSaveImages)
and rename addContextMenuToSaveImages to something like addCustomContextMenuActions. That way we can add more actions in this method in the future.
Implements #1935
Checks