Add and use ItemViewSettings
[quassel.git] / src / uisupport / uistyle.cpp
index 1626c01..555f877 100644 (file)
@@ -68,9 +68,9 @@ UiStyle::UiStyle(QObject *parent)
   setTimestampFormatString("[hh:mm:ss]");
 
   // BufferView / NickView settings
-  BufferSettings bufferSettings;
-  _showBufferViewIcons = _showNickViewIcons = bufferSettings.showUserStateIcons();
-  bufferSettings.notify("ShowUserStateIcons", this, SLOT(showUserStateIconsChanged()));
+  UiStyleSettings s;
+  _showBufferViewIcons = _showNickViewIcons = s.value("ShowItemViewIcons", true).toBool();
+  s.notify("ShowItemViewIcons", this, SLOT(showItemViewIconsChanged()));
 
   loadStyleSheet();
 }
@@ -87,6 +87,7 @@ void UiStyle::loadStyleSheet() {
   qDeleteAll(_metricsCache);
   _metricsCache.clear();
   _formatCache.clear();
+  _formats.clear();
 
   UiStyleSettings s;
 
@@ -147,9 +148,9 @@ void UiStyle::setTimestampFormatString(const QString &format) {
 
 /******** ItemView Styling *******/
 
-void UiStyle::showUserStateIconsChanged() {
-  BufferSettings bufferSettings;
-  _showBufferViewIcons = _showNickViewIcons = bufferSettings.showUserStateIcons();
+void UiStyle::showItemViewIconsChanged() {
+  UiStyleSettings s;
+  _showBufferViewIcons = _showNickViewIcons = s.value("ShowItemViewIcons").toBool();
 }
 
 QVariant UiStyle::bufferViewItemData(const QModelIndex &index, int role) const {
@@ -335,7 +336,7 @@ void UiStyle::mergeFormat(QTextCharFormat &fmt, quint32 ftype, quint64 label) {
   if((ftype & 0xfff00)) { // element format
     for(quint32 mask = 0x00100; mask <= 0x40000; mask <<= 1) {
       if(ftype & mask) {
-        mergeSubElementFormat(fmt, mask | 0xff, label);
+        mergeSubElementFormat(fmt, ftype & (mask | 0xff), label);
       }
     }
   }