projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Snapcraft packaging for quasselcore
[quassel.git]
/
src
/
uisupport
/
uistyle.cpp
diff --git
a/src/uisupport/uistyle.cpp
b/src/uisupport/uistyle.cpp
index
169f5cd
..
f55b183
100644
(file)
--- a/
src/uisupport/uistyle.cpp
+++ b/
src/uisupport/uistyle.cpp
@@
-29,7
+29,8
@@
#include "util.h"
QHash<QString, UiStyle::FormatType> UiStyle::_formatCodes;
#include "util.h"
QHash<QString, UiStyle::FormatType> UiStyle::_formatCodes;
-QString UiStyle::_timestampFormatString;
+QString UiStyle::_timestampFormatString; /// Timestamp format
+bool UiStyle::_showSenderBrackets; /// If true, show brackets around sender names
UiStyle::UiStyle(QObject *parent)
: QObject(parent),
UiStyle::UiStyle(QObject *parent)
: QObject(parent),
@@
-66,7
+67,11
@@
UiStyle::UiStyle(QObject *parent)
_formatCodes["%DM"] = ModeFlags;
_formatCodes["%DU"] = Url;
_formatCodes["%DM"] = ModeFlags;
_formatCodes["%DU"] = Url;
- setTimestampFormatString("[hh:mm:ss]");
+ // Initialize fallback defaults
+ // NOTE: If you change this, update qtui/chatviewsettings.h, too. More explanations available
+ // in there.
+ setTimestampFormatString(" hh:mm:ss");
+ enableSenderBrackets(true);
// BufferView / NickView settings
UiStyleSettings s;
// BufferView / NickView settings
UiStyleSettings s;
@@
-163,12
+168,18
@@
QString UiStyle::loadStyleSheet(const QString &styleSheet, bool shouldExist)
return ss;
}
return ss;
}
-
+// FIXME The following should trigger a reload/refresh of the chat view.
void UiStyle::setTimestampFormatString(const QString &format)
{
if (_timestampFormatString != format) {
_timestampFormatString = format;
void UiStyle::setTimestampFormatString(const QString &format)
{
if (_timestampFormatString != format) {
_timestampFormatString = format;
- // FIXME reload
+ }
+}
+
+void UiStyle::enableSenderBrackets(bool enabled)
+{
+ if (_showSenderBrackets != enabled) {
+ _showSenderBrackets = enabled;
}
}
}
}
@@
-656,10
+667,11
@@
QString UiStyle::mircToInternal(const QString &mirc_)
UiStyle::StyledMessage::StyledMessage(const Message &msg)
: Message(msg)
{
UiStyle::StyledMessage::StyledMessage(const Message &msg)
: Message(msg)
{
- if (type() == Message::Plain)
+ if (type() == Message::Plain
|| type() == Message::Action
)
_senderHash = 0xff;
else
_senderHash = 0xff;
else
- _senderHash = 0x00; // this means we never compute the hash for msgs that aren't plain
+ _senderHash = 0x00;
+ // This means we never compute the hash for msgs that aren't Plain or Action
}
}
@@
-813,7
+825,11
@@
QString UiStyle::StyledMessage::decoratedSender() const
{
switch (type()) {
case Message::Plain:
{
switch (type()) {
case Message::Plain:
- return QString("<%1>").arg(plainSender()); break;
+ if (_showSenderBrackets)
+ return QString("<%1>").arg(plainSender());
+ else
+ return QString("%1").arg(plainSender());
+ break;
case Message::Notice:
return QString("[%1]").arg(plainSender()); break;
case Message::Action:
case Message::Notice:
return QString("[%1]").arg(plainSender()); break;
case Message::Action: