Reset user colors on theme change (in qml timeline)

This commit is contained in:
Nicolas Werner 2020-02-20 20:51:07 +01:00
parent 2895162971
commit 6bdc75d073
12 changed files with 20 additions and 89 deletions

View file

@ -18,6 +18,8 @@ Q_DECLARE_METATYPE(mtx::events::collections::TimelineEvents)
void
TimelineViewManager::updateColorPalette()
{
userColors.clear();
if (settings->theme() == "light") {
QPalette lightActive(/*windowText*/ QColor("#333"),
/*button*/ QColor("#333"),
@ -53,6 +55,15 @@ TimelineViewManager::updateColorPalette()
}
}
QColor
TimelineViewManager::userColor(QString id, QColor background)
{
if (!userColors.contains(id))
userColors.insert(
id, QColor(utils::generateContrastingHexColor(id, background.name())));
return userColors.value(id);
}
TimelineViewManager::TimelineViewManager(QSharedPointer<UserSettings> userSettings, QWidget *parent)
: imgProvider(new MxcImageProvider())
, colorImgProvider(new ColorImageProvider())