dflemstr
It's a ball.
Haven't had too much time to look at it, but first impressions:B-ZaR said:Let me know what you think
I like the way you managed to make a model out of the configuration plugins, but maybe one could expose more roles somehow. The dynamic dispatch pattern would be good here (Think: double visitor pattern, or ad-hoc polymorphism, à la Haskell type classes).
So, each configuration item would have a set of "capabilities" that it supports. To name a few well-defined examples from the Haskell typeclass world:
- Bounded (Upper and lower limit defined (clockspeed, BT amplitude))
- Ordered (You can compare two items for order)
- Enumerable (You can produce a list of all items (Screen states, Wifi modes), or if you have an item, you know its successor and predecessor (int, FM radio frequencies, etc...))
- Readable (The value can be set via a String, and has a validation method to see if the input value is valid (host name, IP address, email, usernames, whatever))
- Etc... getting the idea?
The widget would then adapt depending on what the configurationitem supports (Both Int and Float items are Ordered and probably Bounded, so they can basically use the same widget; if the Int item's upper and lower bounds are close, the widget might become a drop-down thing instead, since Int is also Enumerable; if there's a configuration item for cycling through WiFi modes, it too is Ordered, Bounded, and Enumerable, so the widget might make a drop-down, or, if the list is REALLY short, a cycle-button).
This might sound complex to implement, but dynamic dispatch and ad-hoc polymorphism are well-defined problems that people have already figured out (See Haskell, Java Interfaces (not really but...), Scheme, Lisp, etc) so its easy to do... Q_INTERFACES is abusable.
I'll look into this on the weekend; meanwhile, please say what you think about it.
Last edited by a moderator: