This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/106363/

On September 10th, 2012, 6:58 p.m., Michel Ludwig wrote:

Thanks for changes! Here are a few comments:

1. Instead of using strings, I'd do everything with enums. For example, have the following methods in LaTeXOutputHandler:
   enum BibliograhpyBackendSettings {AUTO_DETECT_BACKEND, BIBTEX_BACKEND, BIBER_BACKEND}
   
   BibliograhpyBackendSettings bibliographyBackendTool();
   void setBibliographyBackendTool(BibliograhpyBackendSettings s);

   void setAutoDetectedBibliographyBackendTool(const QString& s);
   QString autoDetectedBibliographyBackendTool() const;

   Also, I think that BibliograhpyBackendSettings should only be a very light class, only there for reading/storing settings. So, the logic for auto-detecting the tool should go back to the LaTeX tool class.
2. The KSelectAction needs to be added to a action collection (see one of the 'createActions' methods). If you give it a name like "set_bibliography_backend" in the addAction method, you can add it in "kileui.rc" (the version of that file also has to be increased in the 'kpartgui' tag).
3. There is need to access menus directly. This can all be done using KXMLGUI techniques (see 2.).
4. I think it should be enough to use to the "General" group. This will also avoid having to take of varying group names.
5. That's because Kile also works with single documents. It's of course possible to add the backend settings to the project configuration dialog.

It seems a bit complicated at the moment to store the backend settings for single documents. I'll think about how this can be done best.

On September 10th, 2012, 9:30 p.m., Eugene Shalygin wrote:

Dear Michel,

thanks for the review, first of all! 
1. It seems like we have a bit different points of view on this backend question: I would absolutely agree with all of your suggestions about enums and locations of the code if I'd be sure that there will be no other backends. Is it really the case? I was not sure and that is why I use strings (and a map). If one would need to add one more backend (bibtex8? bibtexu?) then that part would need adding new identifier only, but not two new functions. Also, in the current logic of backend selection one needs something to say "no data avaliable". Empty string is easy for that. Enum value "NO_BACKEND_INFORMATION" is ugly for me, exception (logically ideal) is too heavy for that. That is another reason why I choose strings.
Regarding item "2" I'm grateful and will try.
3. Do not understand, sorry.
4. As you wish.
5. I remember Visual Studio was creating projects is memory to make use cases identical... That was quite nice

On September 11th, 2012, 7:21 a.m., Michel Ludwig wrote:

1. Enums are perfect for the use case that exactly one of several options has to be selected. For that purpose, strings require more memory and they cannot be used in "switch" statements, which would also ensures that all possible cases of the enum are covered. Furthermore, strings can hold unintended values, which can lead to strange bugs (and this happened within Kile already ;)).
As far as I can see it, the use case of "no data available" is only relevant for the auto-detection of the bibtool, and for that "autoDetectedBibliographyBackendTool()" returns a string. So, it's still possible to return an empty string there.
If you want, you can also use a QSignalMapper. Then there is no need to add new functions (but even for our handful of bibtools that shouldn't be a problem :))
3. This is basically just the same as 2. The technology to do that is called KXMLGUI.
5. Yes, we can think about introducing "default projects" for Kile 3.1 or so, but at the moment, I don't want to touch that. We have to get version 3 out! :)
1. Then what will be stored in a project file as a tool identifiers? Numbers? I think it is not a good idea: they are unreadable by a human.  If we want strings, then  LaTeXOutputInfo should convert enum values into strings and we came to almost the same sequence plus function to convert enum to a a string. And, in ane case, enum value will be converted to a string on each run of LaTeX. So, efficiency will be more or less the same, because we need string on each LaTeX run to update config value. Sure, that would be good to use "switch" instead of sequence of "if"s. Unintended values, surely, must be taken into account. So far the only source for them - manual editing of a project file (because only one function that generates string values returns one of the constants). And this is possible with enums also. But I understand your point. 

Now I think that just a set of string constants is, indeed, bad. But enum does not make a problem much better. So I would rewrite this part with the following idea. Let us introduce a small class, say, ToolInfo (or ToolDescription) which can hold name of the tool (and configuration name which is needed in case of Bibtex[8u]). Then we will have container of these objects populated manually in the code of from config file. Then all "if"s become enumerations in this container. Just check every object against Biblatex hint. They can have also i18n names and descriptions so actions creation will also be enumeration and signal handling will be direct calls to some dictionary. No more ifs and switches. We will have simple handling of unknown values (if we reached past the enumeration - the value is unsupported). The only one place to check - loading from config. What do You think?

3. Yes, but my problem is that I have very little experience of programming for KDE. I'm reading about KXMLGUI, but still do not understand what did you mean by "There is need to access menus directly".
5. So for now a in-memory storage in LaTeXInfo is OK?

- Eugene


On September 9th, 2012, 11:02 p.m., Eugene Shalygin wrote:

Review request for Kile.
By Eugene Shalygin.

Updated Sept. 9, 2012, 11:02 p.m.

Description

As we can detect what backend is used by Biblatex only when it prints it out, we need to store that information for next updates of bibliography

This patch use dirty approach: it just stores this as dynamic property of TextInfo object and uses it afterwards. I believe we must store this information somewhere or parse \usepackage{biblatex}.
Maybe in the future Biblatex will provide some other setup commands for specifiyng backend which will be needed to parse also.
I understand, that dynamic property is not the best place to store it. From the other hand, it is kind of local information in this approach, because property name is not used outside.

Testing

Manual testing
Bugs: 268047

Diffs

  • src/documentinfo.h (27ad09f)
  • src/documentinfo.cpp (2c3a3bb)
  • src/kile.cpp (8061b54)
  • src/kileproject.h (e77035a)
  • src/kileproject.cpp (dd4087d)
  • src/kilestdtools.h (769e8ca)
  • src/kilestdtools.cpp (0c6e5f0)
  • src/kiletoolmanager.h (86e2258)
  • src/kiletoolmanager.cpp (d06e36f)
  • src/outputinfo.h (096c708)
  • src/outputinfo.cpp (8d18adc)

View Diff