out << "\n// Sender Colors\n"
<< "ChatLine::sender#plain[sender=\"self\"] { foreground: " << color("SenderSelf", s) << "; }\n\n";
+ // Matches qssparser.cpp for UiStyle::PlainMsg
for (int i = 0; i < 16; i++)
- out << senderQss(i, s);
+ out << senderQss(i, s, "plain");
+
+ // Only color the nicks in CTCP ACTIONs if sender colors are enabled
+ if (s.value("UseSenderActionColors").toBool()) {
+ // For action messages, color the 'sender' column -and- the nick itself
+ out << "\n// Sender Nickname Colors for action messages\n"
+ << "ChatLine::sender#action[sender=\"self\"] { foreground: " << color("SenderSelf", s) << "; }\n"
+ << "ChatLine::nick#action[sender=\"self\"] { foreground: " << color("SenderSelf", s) << "; }\n\n";
+
+ // Matches qssparser.cpp for UiStyle::ActionMsg
+ for (int i = 0; i < 16; i++)
+ out << senderQss(i, s, "action", true);
+ }
}
// ItemViews
}
-QString QtUiStyle::senderQss(int i, UiSettings &settings) const
+QString QtUiStyle::senderQss(int i, UiSettings &settings, const QString &messageType, bool includeNick) const
{
QString dez = QString::number(i);
if (dez.length() == 1) dez.prepend('0');
- return QString("ChatLine::sender#plain[sender=\"0%1\"] { foreground: %2; }\n").arg(QString::number(i, 16), color("Sender"+dez, settings));
+ if (includeNick) {
+ // Include the nickname in the color rules
+ return QString("ChatLine::sender#%1[sender=\"0%2\"] { foreground: %3; }\n"
+ "ChatLine::nick#%1[sender=\"0%2\"] { foreground: %3; }\n")
+ .arg(messageType, QString::number(i, 16), color("Sender"+dez, settings));
+ } else {
+ return QString("ChatLine::sender#%1[sender=\"0%2\"] { foreground: %3; }\n")
+ .arg(messageType, QString::number(i, 16), color("Sender"+dez, settings));
+ }
}
QString color(const QString &key, UiSettings &settings) const;
QString msgTypeQss(const QString &msgType, const QString &key, UiSettings &settings) const;
- QString senderQss(int i, UiSettings &settings) const;
+
+ /**
+ * Generate a snippet of Qss stylesheet for a given sender-hash index
+ *
+ * @param[in] i Sender hash index from 0 - 15
+ * @param[in] settings Reference to current UI settings, used for loading color values
+ * @param[in] messageType Type of message to filter, e.g. 'plain' or 'action'
+ * @param[in] includeNick Also apply foreground color to Nick
+ * @return Snippet of Quassel-theme-compatible Qss stylesheet
+ */
+ QString senderQss(int i, UiSettings &settings, const QString &messageType,
+ bool includeNick = false) const;
QString chatListItemQss(const QString &state, const QString &key, UiSettings &settings) const;
};
<x>0</x>
<y>0</y>
<width>486</width>
- <height>582</height>
+ <height>610</height>
</rect>
</property>
<property name="windowTitle">
</item>
</layout>
</item>
+ <item>
+ <widget class="QCheckBox" name="useSenderActionColors">
+ <property name="toolTip">
+ <string>Color sender nicknames in action messages, e.g.<br/>-*- <span style=" font-style:italic;">Nick</span> does an action</string>
+ </property>
+ <property name="text">
+ <string>Color senders in action messages</string>
+ </property>
+ <property name="checked">
+ <bool>false</bool>
+ </property>
+ <property name="settingsKey" stdset="0">
+ <string notr="true">/QtUiStyle/Colors/UseSenderActionColors</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
<tabstop>senderColor14</tabstop>
<tabstop>senderColor15</tabstop>
<tabstop>senderColorSelf</tabstop>
+ <tabstop>useSenderActionColors</tabstop>
</tabstops>
<resources/>
<connections>