KCharSelect: Show LaTeX commands for Unicode characters

Review Request #112068 - Created Aug. 13, 2013 and updated

Information
Thomas Fischer
kdelibs
head
Reviewers
kdelibs, kdeutils
laidig
Attached patch tries to determine the LaTeX command sequence for a given Unicode character. Right now, the most common latin-based characters and selected symbols are covered.
The translation table is based on the source code used in KBibTeX (BibTeX editor) and corrections/updates can be easily shared between both projects.

  

Issues

  • 2
  • 0
  • 0
  • 2
Description From Last Updated
@since 5.0 David Faure David Faure
Qt5's QString::toHtmlEscaped() does all this, doesn't it? David Faure David Faure
Thiago Macieira
Thomas Fischer
Christoph Feck
Thomas Fischer
Review request changed

Change Summary:

Adding Daniel Laidig to this review request as per suggestion by Christoph Feck.

People:

+laidig
Daniel Laidig
Sorry that i reply that late. :/

I would be very happy to see that feature in KCharSelect.

Christoph was right, my first thought was that this should be in the data file and not in the C++ code. However, after thinking a while about it, I'm not so sure any more. The problem is not that the other data comes from unicode.org -- there is no reason to not add other sources. But I assume that this will make the syncing with KBibTeX more difficult (because it means porting it to Python). Additionally, there are not too many LaTeX characters and putting it in the data file will cause overhead for every Unicode character, so it might not be worth it.

So from my side, I think it looks good and keeping it as C++ seems to be a good option. I don't have a development setup right now and I don't want to say "Ship it" without being able to compile and test, but from me there are no objections. :)
David Faure
I'm not sure how kcharselect (the program) differs from KCharSelect (the kdelibs class), but is there any way this could go into the program only? There isn't much usefulness in showing latex commands when bringing up KCharSelect (the class) in e.g. calligra.
Or is kile a target use case, hence the need to have it in the kdelibs class?

Other than that, the patch looks ok to me - provided that the target branch is frameworks, not master (which is frozen for large changes).
  1. It is kdelibs which provides the widget (KCharSelect class), so it cannot be directly changed in the kcharselect program. Maybe the best option is to provide a virtual function in the KCharSelect class which returns an empty string in its default implementation. This function's return value is pasted where the LaTeX code is shown now (below the XML code, which BTW is irrelevant for Calligra users, too). The kcharselect program could have its own class which inherits KCharSelect and re-implements this virtual function to return LaTeX codes.
    
    To spin this idea further, KCharSelect could get refactored to have a simple plugin architecture, which would load the XML code or LaTeX code implemenation upon the user's request ...
    
    About the port to KF5, unfortunately I don't have the resources (time, ...) to compile it locally. Maybe someone else could take the step of porting my KDE 4.11+ code to KF5.
kdeui/widgets/kcharselect.h (Diff revision 3)
 
 
@since 5.0
kdeui/widgets/kcharselect.cpp (Diff revision 3)
 
 
Qt5's QString::toHtmlEscaped() does all this, doesn't it?
Loading...