Fitting the SyncableObjects to the new Style
[quassel.git] / src / common / bufferviewconfig.cpp
index 27d3297..14e4d04 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-08 by the Quassel Project                          *
+ *   Copyright (C) 2005-09 by the Quassel Project                          *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
 
 #include "bufferinfo.h"
 
+INIT_SYNCABLE_OBJECT(BufferViewConfig)
 BufferViewConfig::BufferViewConfig(int bufferViewId, QObject *parent)
   : SyncableObject(parent),
     _bufferViewId(bufferViewId),
     _addNewBuffersAutomatically(true),
     _sortAlphabetically(true),
     _hideInactiveBuffers(false),
+    _disableDecoration(false),
     _allowedBufferTypes(BufferInfo::StatusBuffer | BufferInfo::ChannelBuffer | BufferInfo::QueryBuffer | BufferInfo::GroupBuffer),
     _minimumActivity(0)
 {
@@ -47,6 +49,7 @@ void BufferViewConfig::setBufferViewName(const QString &bufferViewName) {
     return;
 
   _bufferViewName = bufferViewName;
+  SYNC(ARG(bufferViewName))
   emit bufferViewNameSet(bufferViewName);
 }
 
@@ -55,7 +58,9 @@ void BufferViewConfig::setNetworkId(const NetworkId &networkId) {
     return;
 
   _networkId = networkId;
+  SYNC(ARG(networkId))
   emit networkIdSet(networkId);
+  emit configChanged();
 }
 
 void BufferViewConfig::setAddNewBuffersAutomatically(bool addNewBuffersAutomatically) {
@@ -63,7 +68,8 @@ void BufferViewConfig::setAddNewBuffersAutomatically(bool addNewBuffersAutomatic
     return;
 
   _addNewBuffersAutomatically = addNewBuffersAutomatically;
-  emit addNewBuffersAutomaticallySet(addNewBuffersAutomatically);
+  SYNC(ARG(addNewBuffersAutomatically))
+  emit configChanged();
 }
 
 void BufferViewConfig::setSortAlphabetically(bool sortAlphabetically) {
@@ -71,7 +77,16 @@ void BufferViewConfig::setSortAlphabetically(bool sortAlphabetically) {
     return;
 
   _sortAlphabetically = sortAlphabetically;
-  emit sortAlphabeticallySet(sortAlphabetically);
+  SYNC(ARG(sortAlphabetically))
+  emit configChanged();
+}
+
+void BufferViewConfig::setDisableDecoration(bool disableDecoration) {
+  if(_disableDecoration == disableDecoration)
+    return;
+
+  _disableDecoration = disableDecoration;
+  SYNC(ARG(disableDecoration))
 }
 
 void BufferViewConfig::setAllowedBufferTypes(int bufferTypes) {
@@ -79,7 +94,8 @@ void BufferViewConfig::setAllowedBufferTypes(int bufferTypes) {
     return;
 
   _allowedBufferTypes = bufferTypes;
-  emit allowedBufferTypesSet(bufferTypes);
+  SYNC(ARG(bufferTypes))
+  emit configChanged();
 }
 
 void BufferViewConfig::setMinimumActivity(int activity) {
@@ -87,7 +103,8 @@ void BufferViewConfig::setMinimumActivity(int activity) {
     return;
 
   _minimumActivity = activity;
-  emit minimumActivitySet(activity);
+  SYNC(ARG(activity))
+  emit configChanged();
 }
 
 void BufferViewConfig::setHideInactiveBuffers(bool hideInactiveBuffers) {
@@ -95,7 +112,8 @@ void BufferViewConfig::setHideInactiveBuffers(bool hideInactiveBuffers) {
     return;
 
   _hideInactiveBuffers = hideInactiveBuffers;
-  emit hideInactiveBuffersSet(hideInactiveBuffers);
+  SYNC(ARG(hideInactiveBuffers))
+  emit configChanged();
 }
 
 QVariantList BufferViewConfig::initBufferList() const {
@@ -115,8 +133,7 @@ void BufferViewConfig::initSetBufferList(const QVariantList &buffers) {
     _buffers << buffer.value<BufferId>();
   }
 
-  // normaly initSeters don't need an emit. this one is to track changes in the settingspage
-  emit bufferListSet();
+  emit configChanged(); // used to track changes in the settingspage
 }
 
 void BufferViewConfig::initSetBufferList(const QList<BufferId> &buffers) {
@@ -126,8 +143,7 @@ void BufferViewConfig::initSetBufferList(const QList<BufferId> &buffers) {
     _buffers << bufferId;
   }
 
-  // normaly initSeters don't need an emit. this one is to track changes in the settingspage
-  emit bufferListSet();
+  emit configChanged(); // used to track changes in the settingspage
 }
 
 QVariantList BufferViewConfig::initRemovedBuffers() const {
@@ -177,12 +193,13 @@ void BufferViewConfig::addBuffer(const BufferId &bufferId, int pos) {
 
   if(_removedBuffers.contains(bufferId))
     _removedBuffers.remove(bufferId);
-  
+
   if(_temporarilyRemovedBuffers.contains(bufferId))
     _temporarilyRemovedBuffers.remove(bufferId);
-  
+
   _buffers.insert(pos, bufferId);
   emit bufferAdded(bufferId, pos);
+  emit configChanged();
 }
 
 void BufferViewConfig::moveBuffer(const BufferId &bufferId, int pos) {
@@ -196,18 +213,20 @@ void BufferViewConfig::moveBuffer(const BufferId &bufferId, int pos) {
 
   _buffers.move(_buffers.indexOf(bufferId), pos);
   emit bufferMoved(bufferId, pos);
+  emit configChanged();
 }
 
 void BufferViewConfig::removeBuffer(const BufferId &bufferId) {
   if(_buffers.contains(bufferId))
     _buffers.removeAt(_buffers.indexOf(bufferId));
-  
+
   if(_removedBuffers.contains(bufferId))
     _removedBuffers.remove(bufferId);
 
   _temporarilyRemovedBuffers << bufferId;
 
   emit bufferRemoved(bufferId);
+  emit configChanged();
 }
 
 void BufferViewConfig::removeBufferPermanently(const BufferId &bufferId) {
@@ -216,8 +235,9 @@ void BufferViewConfig::removeBufferPermanently(const BufferId &bufferId) {
 
   if(_temporarilyRemovedBuffers.contains(bufferId))
     _temporarilyRemovedBuffers.remove(bufferId);
-  
+
   _removedBuffers << bufferId;
 
   emit bufferPermanentlyRemoved(bufferId);
+  emit configChanged();
 }