Conversation
|
|
||
| BView* | ||
| extern "C" _EXPORT BView* | ||
| instantiate_deskbar_item() |
There was a problem hiding this comment.
There's a instantiate_deskbar_item(float maxWidth, float maxHeight) that avoids hard-coding the icon size. The Deskbar tray and its icons are resized with the set system font size. Compare with, e.g. https://cgit.haiku-os.org/haiku/tree/src/apps/powerstatus/PowerStatusView.cpp#n929
There was a problem hiding this comment.
That makes sense, I'm trying to adapt the code but I'm struggling with this part:
BArchivable*
ForecastDeskbarView::Instantiate(BMessage* archive)
{
if (!validate_instantiation(archive, "ForecastDeskbarView"))
return NULL;
return reinterpret_cast<BArchivable*>(instantiate_deskbar_item());
}
How can I include maxWidth and maxHeight in instantiate_deskbar_item()?
There was a problem hiding this comment.
Keep in mind that I don't really know what I'm doing, esp. when it comes to replicants...
The Instantiate() should return a ForecastDeskbarView*, not a BArchivable*.
There was a problem hiding this comment.
Keep in mind that I don't really know what I'm doing, esp. when it comes to replicants...
Hard to believe...
The Instantiate() should return a ForecastDeskbarView*, not a BArchivable*.
I noticed that from the examples, however with the current code this caused the app to crash. As it is now (with my latest update), the code works and the icon will resize according to the system font size.
|
|
||
| BString weatherDetailsText; | ||
| weatherDetailsText << "Temperature: " | ||
| weatherDetailsText << B_TRANSLATE("Temperature: ") |
There was a problem hiding this comment.
Here, and for rhe strings below, I suggest to remove the space at the end of the string and append it separately. A space at the end can easily be overlooked by the translators, so:
| weatherDetailsText << B_TRANSLATE("Temperature: ") | |
| weatherDetailsText << B_TRANSLATE("Temperature:") << " " |
Or go with one long translatable string that contains variables ("%temperature%" etc.) that get replaced using BString's SetToFormat() etc.
There was a problem hiding this comment.
Added a single, translatable string that inserts the variables with SetToFormat() as suggested.
007d4d1 to
acd0672
Compare
acd0672 to
61157f4
Compare
This pull request enables the Deskbar Replicant menu item. The replicant will show an icon with the curren weather, and a tooltip with details about the condition, temperature and location.
The tooltip is translatable, new
en.catkeysgenerated but not added to Polyglot.I also removed a few header files that didn't seem necessary, please correct me if I'm wrong.