modernize: Require member function pointers for Settings::notify()
[quassel.git] / src / uisupport / uistyle.cpp
index f7edcbc..8a1655b 100644 (file)
@@ -105,11 +105,8 @@ UiStyle::UiStyle(QObject *parent)
 
     // BufferView / NickView settings
     UiStyleSettings s;
-    _showBufferViewIcons = _showNickViewIcons = s.value("ShowItemViewIcons", true).toBool();
-    s.notify("ShowItemViewIcons", this, SLOT(showItemViewIconsChanged(QVariant)));
-
-    _allowMircColors = s.value("AllowMircColors", true).toBool();
-    s.notify("AllowMircColors", this, SLOT(allowMircColorsChanged(QVariant)));
+    s.initAndNotify("ShowItemViewIcons", this, &UiStyle::showItemViewIconsChanged, true);
+    s.initAndNotify("AllowMircColors", this, &UiStyle::allowMircColorsChanged, true);
 
     loadStyleSheet();
 }
@@ -709,7 +706,7 @@ UiStyle::StyledString UiStyle::styleString(const QString &s_, FormatType baseFor
         }
         else if (s[pos+1] == 'R') { // Reverse colors
             fgChar = (fgChar == 'f' ? 'b' : 'f');
-            quint32 orig = static_cast<quint32>(curfmt.type & 0xffc00000);
+            auto orig = static_cast<quint32>(curfmt.type & 0xffc00000);
             curfmt.type &= 0x003fffff;
             curfmt.type |= (orig & 0x00400000) <<1;
             curfmt.type |= (orig & 0x0f000000) <<4;
@@ -1264,8 +1261,8 @@ UiStyle::ItemFormatType& operator|=(UiStyle::ItemFormatType &lhs, UiStyle::ItemF
 QDataStream &operator<<(QDataStream &out, const UiStyle::FormatList &formatList)
 {
     out << static_cast<quint16>(formatList.size());
-    UiStyle::FormatList::const_iterator it = formatList.begin();
-    while (it != formatList.end()) {
+    auto it = formatList.cbegin();
+    while (it != formatList.cend()) {
         out << it->first
             << static_cast<quint32>(it->second.type)
             << it->second.foreground