WIP: Super-rough structure-only per-screen refactor #219
No reviewers
Labels
No labels
bug
conflicts
documentation
DO NOT MERGE
duplicate
enhancement
good first issue
hardware
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
greg/info-orbs!219
Loading…
Reference in a new issue
No description provided.
Delete branch "sjoerdverweij/dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -0,0 +1,21 @@#ifndef FEED_HI would suggest not to use a
dynamic_cast.A
static_cast+ a check on the correct type (id) would be a lot faster.A
dynamic_castis a very slow function, that requires a certain amount of debug info to be present in the binary.Is the name required?
I'd say that 'id' would be enough.
and a nit: this is indented with 3 spaces.
No need to make it virtual, just have a
const FeedId Idin the class, and create a constructor that you need to pass theFeedIdinto:publicis not needed in a struct as first item, everything in a struct is public by default@ -0,0 +1,28 @@#ifndef FEEDS_Hstd::maporstd::unordered_mapwould be better here,since it does not force you to pre-size it.
You need to use forward slashes, linux chokes on the backslash, windows does not care so both work there.
@ -0,0 +17,4 @@_Feeds.insert(std::make_pair(feedId, newFeed));}return *_Feeds[feedId];}You should return something here, or remove the return type
@ -0,0 +20,4 @@}Feed& getFeed(const FeedId feedId) {assert(_Feeds[feedId]);This suggests that all feeds are always created, I would advice against that.
Anything that is not needed, does not have to be loaded.
@ -0,0 +13,4 @@OrbWeatherIcon = 3,OrbTemperatureHighLow = 4,OrbWeather3DayForecast = 5};Something like this allows to mix and match the orbs, which is a long-standing feature request:
I like the overall design direction. I have a couple logical model recommendations.
A Gadget represents 5 Orbs but as I see it it needs to support both pre-defined Orb sets like clock and also mix/match user defined Orb sets. I'd recommend abstracting out a ContentSet class. Then maybe rename Gadget to ContentManager. So the ContentManager manages a collection of ContentSets and allow switching between them. So the ContentManager manages both predefined and user-defined ContentSets, handle button interations to cycle through the ContentSets and provides methods for creating, updating, and saving user-defined ContentSets.
Feeds - The ContentManager (Gadget) should manage the lifecycle of the Feeds, ensure that Feeds are shared across all Orbs to reduce redundant data fetching, and dynamically load Feeds when needed by one or more Orbs. Also Feeds should make use of TaskManager/TaskFactory when getting data from external APIs
Button Handling - ContentManager (Gadget) should specifically manage cycling of ContentSets via left/right button clicks.
Renderer - The ContentManager (gadget) should coordinate with the Renderer to draw the active ContentSet on the 5 displays. Each Orb in the active ContentSet should use the Renderer to draw its content on the appropriate display.
Need support for persistence for User-Defined ContentSets? to non-volatile storage? then would need methods for loading saved ContentSets on startup
Gadget only needs to support configurable mix/match orb sets, because there really no longer is such a thing as a predefined widget; those are just default mix/match configurations. You'd start out with a configuration for a Gadget that has 4 instances of a ClockDigit orb, and one ClockSeconds orb. If we want to prevent users from changing the default settings, we can make them read-only -- but they will still work the exact same way.
Lifecycle and deduplication of Feeds is in the Feeds class. It should be a singleton, which it currently is not properly set up and referenced as.
Button handling etc.; I think Gadgets is what you want ContentManager to be.
Agreed, it will, the draw code isn't fleshed out yet.
I'm open to the best way to save settings. My current thinking is Serialize/Deserialize methods on the top of the settings hierarchy (Settings) which (de)serializes the global settings, then calls all its GadgetSettings, which then calls all its OrbSettings. (GadgetSettings holds which orbs a gadget shows, OrbSettings has the specific settings for that instance of the orb).
@ -0,0 +1,28 @@#ifndef FEEDS_HWhen I wrote that bit I didn't know std:: was in play! Huzzah!
@ -0,0 +20,4 @@}Feed& getFeed(const FeedId feedId) {assert(_Feeds[feedId]);No, it asserts only if someone asks for a feed from the collection that was not added. For example, someone writing a custom Orb that asks for a feed that it didn't register for. Should be a compile-time oopsie only, hence the assert.
@ -0,0 +1,21 @@#ifndef FEED_HI forget that all the time, so I like to be explicit. If we decide it's an enforced style thing, no problem, I'll take it out.
@ -0,0 +1,21 @@#ifndef FEED_HWe'll need some kind of name to show in the config UI. Whether this is the best way to do it is debatable, I am open to suggestions.
(Alternately, we could have a big switch somewhere that names Ids, but that makes it easy for Orb authors to forget...)
@ -0,0 +13,4 @@OrbWeatherIcon = 3,OrbTemperatureHighLow = 4,OrbWeather3DayForecast = 5};Yes, that's the point of it, I just started with the weather widget -- are you saying you don't like the naming of the enum members?
@ -0,0 +1,21 @@#ifndef FEED_HGood point, done.
@ -0,0 +1,21 @@#ifndef FEED_HGood point, done. Not even going to check on type, this would be very much caught during dev.
@ -0,0 +13,4 @@OrbWeatherIcon = 3,OrbTemperatureHighLow = 4,OrbWeather3DayForecast = 5};I guess so.
In cases like this, having a consistent style in naming pays off imo.
Sorry I broke this PR merging #218
@ -0,0 +13,4 @@OrbWeatherIcon = 3,OrbTemperatureHighLow = 4,OrbWeather3DayForecast = 5};Why would we need an enum? Why not a list of list-of instances? (with constuctor/factory parameters as required). Totally value pseudo-code
I guess we need something in the UI, ya
@ -0,0 +13,4 @@OrbWeatherIcon = 3,OrbTemperatureHighLow = 4,OrbWeather3DayForecast = 5};In the UI, and in the config files / web editor / whatever is used to configure this thing.
You can't really transmit class instances over the web ;)
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.