Add brackets to timestamp when copying if hidden
authorShane Synan <digitalcircuit36939@gmail.com>
Tue, 28 Jun 2016 02:33:35 +0000 (22:33 -0400)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 6 Sep 2016 20:14:48 +0000 (22:14 +0200)
commitfaa66f7e00aeeea661b46f01bdfc715567eef669
treeee783260dc0d0dda7bee91038e7d3aac14f21582
parentb82e9603ab7ce1164e8f550132f0c649653ad8ab
Add brackets to timestamp when copying if hidden

Add brackets around timestamp if ShowSenderBrackets is disabled -and-
the timestamp format does not contain brackets.  This matches all
common types of brackets using a regular expression.

Remove any leading and trailing space from timestamp format before
copying if above conditions met, to avoid having [ 11:04:32] or some
such.  This might be unexpected, but if someone has specific needs
for the bracket arrangement, they can toggle to always show sender
brackets.

Examples with show sender brackets disabled:
" hh:mm:ss"     -> "[hh:mm:ss]"
" h:mm:ss ap"   -> "[h:mm:ss ap]"
"<hh mm ss"     -> "[<hh mm ss]"
"[hh:mm:ss]"    -> unchanged
"<hh mm ss>"    -> unchanged
"{hh:mm:ss:ss>" -> unchanged (and I won't ask why you're doing this)

For regular expression debugging and explanations,
See: https://regex101.com/
src/qtui/chatscene.cpp
src/qtui/chatscene.h