[patch] Selection stats in statusbar
Daniel
xracoonx at gmx.de
Wed Aug 17 09:28:53 UTC 2022
On 17/08/2022 11:13, Jürgen Spitzmüller wrote:
> Am Mittwoch, dem 17.08.2022 um 11:00 +0200 schrieb Jürgen Spitzmüller:
>> Attached the way I'd recommend to do it:
>>
>> * do not use abbreviations
>> * allow to enable the stats measures individually
>> * left click on stats in status bar opens stats dialog (as in LO and
>> Word)
>>
>> The rationale besides the accessibility argument is that I'd figure
>> that users seldom need all three stats values. The value they need
>> might depend on the editorial instructions they get. These might rely
>> on either of the three. So give the user the choice to see what they
>> need.
>
> Updated patch which accounts for the proper number (1 Word, 2 Words).
If the usage of QStringList is fine, it can also be written a bit more
concise as. Also, chars_with_blanks should probably be inside the second
"if statement":
QStringList stats;
if (word_count_enabled_) {
int const words = buf->wordCount();
if (words == 1)
stats << toqstr(bformat(_("%1$d Word"), words));
else
stats << toqstr(bformat(_("%1$d Words"), words));
}
if (char_count_enabled_)
int const chars_with_blanks = buf->charCount(true);
if (chars_with_blanks == 1)
stats << toqstr(bformat(_("%1$d Character"), chars_with_blanks));
else
stats << toqstr(bformat(_("%1$d Characters"), chars_with_blanks));
if (char_nb_count_enabled_) {
int const chars = buf->charCount(false);
if (chars == 1)
stats << toqstr(bformat(_("%1$d Character (no Blanks)"), chars));
else
stats << toqstr(bformat(_("%1$d Characters (no Blanks)"), chars));
}
stat_counts_->setText(stats.join(qt_(", [[stats separator]]")));
More information about the lyx-devel
mailing list