From: Shane Synan Date: Fri, 2 Dec 2016 23:35:32 +0000 (-0600) Subject: New default sender colors! X-Git-Tag: travis-deploy-test~321 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=5f13dd167785d830a851b134863dce231ec450dd New default sender colors! Add a full range of 16 sender colors, loosely readable and distinguishable. This results in less redundant nickname colors and possibly better readability (subjective). All changes can be undone, as expected. Colors generated with an algorithm suggested to to the Pidgin implementation. Credit to 'lobais' for the original algorithm. Bump settings minor version to preserve old sender colors. This only affects those who have used the git master branch, and if desired can be removed. Algorithm code: def genColor (n, startpoint=0): assert n >= 1 # This splits the 0 - 1 segment in the pizza way h = (2*n-1)/(2**ceil(log(n)/log(2)))-1 h = (h + startpoint) % 1 # We set saturation based on the amount of green, in the range 0.6 to 0.8 rgb = colorsys.hsv_to_rgb(h, 1, 1) rgb = colorsys.hsv_to_rgb(h, 1, (1-rgb[1])*0.2+0.6) return rgb See https://developer.pidgin.im/ticket/4534#comment:4 Resolves GH-266. --- diff --git a/src/qtui/qtuiapplication.cpp b/src/qtui/qtuiapplication.cpp index eada318c..2b6b58c8 100644 --- a/src/qtui/qtuiapplication.cpp +++ b/src/qtui/qtuiapplication.cpp @@ -210,7 +210,7 @@ bool QtUiApplication::migrateSettings() // -------- // Check minor settings version, handling upgrades/downgrades as needed // Current minor version - const uint VERSION_MINOR_CURRENT = 5; + const uint VERSION_MINOR_CURRENT = 6; // Stored minor version uint versionMinor = s.versionMinor(); @@ -273,6 +273,57 @@ bool QtUiApplication::applySettingsMigration(QtUiSettings settings, const uint n // // 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 6: + { + // New default changes: sender colors switched around to Tango-ish theme + + // -------- + // QtUiStyle settings + QtUiStyleSettings settingsUiStyleColors("Colors"); + // Preserve the old default values for all variants + const QColor oldDefaultSenderColorSelf = QColor(0, 0, 0); + const QList oldDefaultSenderColors = QList { + QColor(204, 13, 127), /// Sender00 + QColor(142, 85, 233), /// Sender01 + QColor(179, 14, 14), /// Sender02 + QColor( 23, 179, 57), /// Sender03 + QColor( 88, 175, 179), /// Sender04 + QColor(157, 84, 179), /// Sender05 + QColor(179, 151, 117), /// Sender06 + QColor( 49, 118, 179), /// Sender07 + QColor(233, 13, 127), /// Sender08 + QColor(142, 85, 233), /// Sender09 + QColor(179, 14, 14), /// Sender10 + QColor( 23, 179, 57), /// Sender11 + QColor( 88, 175, 179), /// Sender12 + QColor(157, 84, 179), /// Sender13 + QColor(179, 151, 117), /// Sender14 + QColor( 49, 118, 179), /// Sender15 + }; + if (!settingsUiStyleColors.valueExists("SenderSelf")) { + // Preserve the old default sender color if none set + settingsUiStyleColors.setValue("SenderSelf", oldDefaultSenderColorSelf); + } + QString senderColorId; + for (int i = 0; i < oldDefaultSenderColors.count(); i++) { + // Get the sender color ID for each available color + QString dez = QString::number(i); + if (dez.length() == 1) dez.prepend('0'); + senderColorId = QString("Sender" + dez); + if (!settingsUiStyleColors.valueExists(senderColorId)) { + // Preserve the old default sender color if none set + settingsUiStyleColors.setValue(senderColorId, oldDefaultSenderColors[i]); + } + } + + // Update the settings stylesheet with old defaults + QtUiStyle qtUiStyle; + qtUiStyle.generateSettingsQss(); + // -------- + + // Migration complete! + return true; + } case 5: { // New default changes: sender colors apply to nearly all messages with nicks diff --git a/src/qtui/settingspages/chatviewcolorsettingspage.ui b/src/qtui/settingspages/chatviewcolorsettingspage.ui index c5da8b9b..5b878850 100644 --- a/src/qtui/settingspages/chatviewcolorsettingspage.ui +++ b/src/qtui/settingspages/chatviewcolorsettingspage.ui @@ -365,9 +365,26 @@ - 233 - 13 - 127 + 204 + 0 + 0 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender01 + + + + 0 + 108 + 173 @@ -382,9 +399,26 @@ - 179 - 14 - 14 + 77 + 153 + 0 + + + + + + + + ... + + + /QtUiStyle/Colors/Sender03 + + + + 102 + 0 + 204 @@ -399,9 +433,9 @@ - 88 - 175 - 179 + 166 + 125 + 0 @@ -416,9 +450,9 @@ - 157 - 84 - 179 + 0 + 153 + 39 @@ -433,9 +467,9 @@ - 179 - 151 - 117 + 0 + 48 + 192 @@ -450,9 +484,9 @@ - 49 - 118 - 179 + 204 + 0 + 154 @@ -467,9 +501,9 @@ - 233 - 13 - 127 + 185 + 70 + 0 @@ -484,9 +518,9 @@ - 142 - 85 - 233 + 134 + 153 + 0 @@ -501,9 +535,9 @@ - 179 - 14 - 14 + 20 + 153 + 0 @@ -518,9 +552,9 @@ - 23 - 179 - 57 + 0 + 153 + 96 @@ -535,9 +569,9 @@ - 88 - 175 - 179 + 0 + 108 + 173 @@ -552,9 +586,9 @@ - 157 - 84 - 179 + 0 + 153 + 204 @@ -570,8 +604,8 @@ 179 - 151 - 117 + 0 + 204 @@ -586,43 +620,9 @@ - 49 - 118 - 179 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender01 - - - - 142 - 85 - 233 - - - - - - - - ... - - - /QtUiStyle/Colors/Sender03 - - - - 23 - 179 - 57 + 204 + 0 + 77 diff --git a/src/uisupport/uistyle.h b/src/uisupport/uistyle.h index ee78c9b5..030c1ac1 100644 --- a/src/uisupport/uistyle.h +++ b/src/uisupport/uistyle.h @@ -168,22 +168,22 @@ public: * @see UiStyle::ColorRole */ const QList defaultSenderColors = QList { - QColor(233, 13, 127), /// Sender00 - QColor(142, 85, 233), /// Sender01 - QColor(179, 14, 14), /// Sender02 - QColor(23, 179, 57), /// Sender03 - QColor(88, 175, 179), /// Sender04 - QColor(157, 84, 179), /// Sender05 - QColor(179, 151, 117), /// Sender06 - QColor(49, 118, 179), /// Sender07 - QColor(233, 13, 127), /// Sender08 - QColor(142, 85, 233), /// Sender09 - QColor(179, 14, 14), /// Sender10 - QColor(23, 179, 57), /// Sender11 - QColor(88, 175, 179), /// Sender12 - QColor(157, 84, 179), /// Sender13 - QColor(179, 151, 117), /// Sender14 - QColor(49, 118, 179), /// Sender15 + QColor(204, 0, 0), /// Sender00 + QColor( 0, 108, 173), /// Sender01 + QColor( 77, 153, 0), /// Sender02 + QColor(102, 0, 204), /// Sender03 + QColor(166, 125, 0), /// Sender04 + QColor( 0, 153, 39), /// Sender05 + QColor( 0, 48, 192), /// Sender06 + QColor(204, 0, 154), /// Sender07 + QColor(185, 70, 0), /// Sender08 + QColor(134, 153, 0), /// Sender09 + QColor( 20, 153, 0), /// Sender10 + QColor( 0, 153, 96), /// Sender11 + QColor( 0, 108, 173), /// Sender12 + QColor( 0, 153, 204), /// Sender13 + QColor(179, 0, 204), /// Sender14 + QColor(204, 0, 77), /// Sender15 }; // Explicitly declare QList type for defaultSenderColors, otherwise error C2797 // "list initialization inside member initializer list" will occur in Windows builds with Visual