// --------
// Check minor settings version, handling upgrades/downgrades as needed
// Current minor version
- const uint VERSION_MINOR_CURRENT = 4;
+ const uint VERSION_MINOR_CURRENT = 5;
// Stored minor version
uint versionMinor = s.versionMinor();
//
// In most cases, the goal is to preserve the older default values for keys that haven't been
// saved. Exceptions will be noted below.
+ case 5:
+ {
+ // New default changes: sender colors apply to nearly all messages with nicks
+
+ // --------
+ // QtUiStyle settings
+ QtUiStyleSettings settingsUiStyleColors("Colors");
+ const QString useNickGeneralColorsId = "UseNickGeneralColors";
+ if (!settingsUiStyleColors.valueExists(useNickGeneralColorsId)) {
+ // New default is true, preserve previous behavior by setting to false
+ settingsUiStyleColors.setValue(useNickGeneralColorsId, false);
+ }
+
+ // Update the settings stylesheet with old defaults
+ QtUiStyle qtUiStyle;
+ qtUiStyle.generateSettingsQss();
+ // --------
+
+ // Migration complete!
+ return true;
+ }
case 4:
{
// New default changes: system locale used to generate a timestamp format string, deciding
out << senderQss(i, "action", true);
}
+ // Only color the nicks in CTCP ACTIONs if sender colors are enabled
+ if (s.value("UseNickGeneralColors", true).toBool()) {
+ // For action messages, color the 'sender' column -and- the nick itself
+ out << "\n// Nickname colors for all messages\n"
+ << "ChatLine::nick[sender=\"self\"] { foreground: palette(sender-color-self); }\n\n";
+
+ // Matches qssparser.cpp for any style of message (UiStyle::...)
+ for (int i = 0; i < defaultSenderColors.count(); i++)
+ out << nickQss(i);
+ }
+
}
// ItemViews
}
+QString QtUiStyle::nickQss(int i) const
+{
+ QString dez = QString::number(i);
+ if (dez.length() == 1) dez.prepend('0');
+
+ return QString("ChatLine::nick[sender=\"0%1\"] { foreground: palette(sender-color-0%1); }\n")
+ .arg(QString::number(i, 16));
+}
+
+
QString QtUiStyle::chatListItemQss(const QString &state, const QString &key, UiSettings &settings) const
{
return QString("ChatListItem[state=\"%1\"] { foreground: %2; }\n").arg(state, color(key, settings));
* @return Snippet of Quassel-theme-compatible Qss stylesheet
*/
QString senderQss(int i, const QString &messageType, bool includeNick = false) const;
+
+ /**
+ * Generate a snippet of Qss stylesheet for a given IRC nickname sender-hash index
+ *
+ * This depends on the color palette generated by QtUiStyle::senderPaletteQss()
+ *
+ * @param[in] i Sender hash index from 0 - 15
+ * @return Snippet of Quassel-theme-compatible Qss stylesheet
+ */
+ QString nickQss(int i) const;
+
QString chatListItemQss(const QString &state, const QString &key, UiSettings &settings) const;
};
<x>0</x>
<y>0</y>
<width>486</width>
- <height>428</height>
+ <height>456</height>
</rect>
</property>
<property name="windowTitle">
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="useNicknameGeneralColors">
+ <property name="toolTip">
+ <string>Color nicknames in joins, parts, quits, and other messages, e.g.<br/>--> <span style=" font-style:italic;">Nick</span> joined #quassel</string>
+ </property>
+ <property name="text">
+ <string>Color nicknames in other messages</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="settingsKey" stdset="0">
+ <string notr="true">/QtUiStyle/Colors/UseNickGeneralColors</string>
+ </property>
+ <property name="defaultValue" stdset="0">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
UiStyle::StyledMessage::StyledMessage(const Message &msg)
: Message(msg)
{
- if (type() == Message::Plain || type() == Message::Action)
- _senderHash = 0xff;
- else
- _senderHash = 0x00;
- // This means we never compute the hash for msgs that aren't Plain or Action
+ switch (type()) {
+ // Don't compute the sender hash for message types without a nickname embedded
+ case Message::Server:
+ case Message::Info:
+ case Message::Error:
+ case Message::DayChange:
+ case Message::Topic:
+ case Message::Invite:
+ // Don't compute the sender hash for messages with multiple nicks
+ // Fixing this without breaking themes would be.. complex.
+ case Message::NetsplitJoin:
+ case Message::NetsplitQuit:
+ case Message::Kick:
+ // Don't compute the sender hash for message types that are not yet completed elsewhere
+ case Message::Kill:
+ _senderHash = 0x00;
+ break;
+ default:
+ // Compute the sender hash for all other message types
+ _senderHash = 0xff;
+ break;
+ }
}