Skip to content

Extract the words statistics logic to its own class

Pierre Ducroquet requested to merge work/ducroquet/kwdocumentstatistics into master

Words statistics were calculated and stored in KWStatisticsWidget. This situation was known and needed a fix in order to allow any interface (QML, QWidget…) to access the document statistics. This proposed solution creates a KWDocumentStatistics, attached to KWDocument, that will store and compute the statistics. KWStatisticsWidget has obviously been modified to use this new class.

I would like a review of the trickery I used to prevent useless computations. The code compute the statistics only if somebody listens to the KWDocumentStatistics::refreshed signal. This way, no computation is done if no widget is created. This new design also has the benefit of centralizing computation if several are displayed at the same time (docker widget + status bar word/sentence count for instance)

Merge request reports