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 missing getters/setters for most of the properties in AS::Component #117
Conversation
| /** | ||
| * \returns the internally stored AsBundle | ||
| */ | ||
| _AsBundle *asBundle() const; |
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.
Are these really necessary? I would argue that this is only needed in case the Qt/C++ interface is incomplete and someone therefore wants to use the C library directly. In that case, we should rather fix the Qt binding to include the missing stuff, and not give library users the means to hack around it and not report the issue.
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 use these internally, i.e. in as_component_add_icon() or as_component_add_screenshot() and so on, because those methods takes AsIcon or AsScreenshot only.
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.
Then we should make the symbols internal and hide them from the public API... The tricky bit is that they're class members...
(I will take a look on whether it's possible to even have them as internal members, probably the only way to do that is to make them private and use friend classes for access. - in any case, just leave this as it is for now :-) )
|
Looks good on a first quick look at it, except for the obvious CI failure (which hints at an actual bug ^^). Thank you for working on this, this is great help! |
qt/component.h
Outdated
| bool insertCustomValue(const QString& key, const QString& value); | ||
|
|
||
| /** | ||
| * TODO contentRating, launchable and languages |
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.
Adding launchable to the Qt interface is actually a must-be-present feature for the next release, as that's a key new feature and using desktopId is deprecated in favor of it.
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.
Ok, I will add them later on. I'm now working on AS::Metadata class needed for parsing.
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.
OK, awesome! I was going to do this when I'm done with the parser refactoring, but it looks like that will still tle.
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've implemented above mentioned missing getters/setters including new classes needed for that.
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! Now, fixing the CI failure would be useful, otherwise a lot of code won't work ^^
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.
Fixed, sorry, I haven't seen the error before. I saw CI failure at the beginning but there was a different problem (something with downloading or so) and I ignored it since then.
qt/component.cpp
Outdated
|
|
||
| QStringList AppStream::Component::searchTokens() const | ||
| { | ||
| valueWrap(as_component_get_search_tokens(m_cpt)); |
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.
The CI complains about a missing return statement here...
And I was also surprised that this thing is public API, but looking at AsComponent it indeed is...
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.
Fixed that one too, I wonder why I don't get a compilation error here while CI obviously reports that.
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.
Configure AppStream with -DMAINTAINER=ON, that will enable (almost) all compile-time maintainer checks.
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.
Probably useful to do that locally, as the CI still isn't happy :P
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.
CI is now happy, want me to squeeze all these commit into one or later on once you are happy about that?
|
Looks good to me! Can you maybe fold in the two return-fix commits, and prefix the changes with "qt"? I am not really happy about exposing the raw GObjects in the Qt bindings in a public interface, but we can find a solution for that after merge, if there is one. |
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.
LGTM in general. Just nitpicking.
qt/contentrating.cpp
Outdated
|
|
||
| AppStream::ContentRating::RatingValue AppStream::ContentRating::stringToRatingValue(const QString& ratingValue) | ||
| { | ||
| if (ratingValue == QLatin1String("none")) { |
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.
Why not a hash here?
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.
Fixed to use hash even here.
| AsContentRating* m_contentRating; | ||
| }; | ||
|
|
||
| typedef QHash<ContentRating::RatingValue, QString> RatingMap; |
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.
A vector should be enough?
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.
Not sure if this would make any difference, QHash is used accross appstream same way so I used it here as well.
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.
What's the overhead of a QHash? Would using a vector be much better? If not, keeping the QHash is fine, I guess.
| #include "appstream.h" | ||
| #include "launchable.h" | ||
|
|
||
| #include <QDebug> |
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.
include possibly not needed?
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.
Removed.
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.
Taking back, it's needed.
Also implement missing classes like AS::Launchable, AS:Translation or AS:ContentRating.
|
Okay, merged - it's one massive commit now, maybe breaking this down would have been nicer, but well, too late... Thank you for your patch! |
Note: only two of them should be missing (launchables and languages), because
we don't have wrappers for them yet