Hi Timothy! Thanks for the comments.
On Wed, Sep 18, 2013 at 7:21 AM, Reaves, Timothy <trea...@silverfieldstech.com> wrote: > - For the statement " the change in the property will automatically change > the state of the StelAction. I think this has the potential to fix a few > tricky issues with the synchronisation of GUI buttons and module states." As > this is the way QActions work, how would your change be any different in > this regard? With the current code, we need to be careful in the way we connect the QAction to the actual module slots. Usually, what is done is : 1/ set the QAction checked state from the module flag value. 2/ connect the action toggled signal to the proper module slot 3/ If the module defines a notification signal for the value, we connect this to a special method that will set the QAction checked state, only if necessary (cause if we just connect the objects directly we might run into circular connections). If we look, for example, at the way the action "actionShow_Cardinal_Points" is connected to the landscape manager, we have the following steps: (real code in file StelGui.cpp, line 690): 1/ action->setChecked(landscapeMgr->getFlagCardinalsPoints()); 2/ connect(action, toggled(bool), landscapeMgr, setFlagCardinalsPoints(bool)) 3/ connect(landscapeMgr, cardinalsPointsDisplayedChanged, StelGui, cardinalsPointsDisplayedUpdated) and then the StelGui::cardinalsPointsDisplayedUpdated slot is defined like that: if (getGuiAction("actionShow_Atmosphere")->isChecked() != displayed) { getGuiAction("actionShow_Atmosphere")->setChecked(displayed); } I call it tricky in the sense that this is tempting to ignore the step 3, or instead just directly connect the module signal to the action toggle slot, leading to potential bugs. And in fact, currently, many QAction are not updated when the module changes, that is the step 3 is missing for many actions. This means that in many cases, calling a module setSomething(bool) method will not reflect on the associated QAction. In the simplegles-qml-noqaction branch, there is one function to create and connect an action, the last argument being the name of a property or slot. If this is a property, then all the previously explained steps are automatically done, and there is no need to create a separate slot. Also simply adding a NOTIFY handler to an existing module property will make the action aware of external change to it without adding any other line of code. The downside is that I wasn't able to find a way to do it without having to store the QObject and property name in the StelAction. This means we can only link a StelAction to a single object property. > > - As for the manor in which the key binding are stored, JSON may not be > ideal, but it is better than 1980's data formats. I understand that some > people like what they perceive as the simplisity of a plan text file, but > there are down-sides to it as well. JSON is a very widly recognized data > format, and unless there is something better that Qt itself likes, I'd stick > to the JSON. In this day-and-age, people have no business editing an > applications configuration files outside of the application itself; they're > just likely to mess them up. I like JSON too. I was just realizing that since the only data needed to be stored will be a list of key / value, and since we already have config.ini, we could use the same format (or even put the shortcuts into config.ini). If we only save the redefined shortcuts, this might be just a few lines of config data. Of course if we want to keep the possibility to have scripts defined directly in the shortcut config file, then an .ini file would not do. But is there any real use for this? Best regards, guillaume -- Guillaume guillaume.cher...@gmail.com +886 970422910 ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk _______________________________________________ Stellarium-pubdevel mailing list Stellarium-pubdevel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/stellarium-pubdevel