*****************************************/
BufferViewFilter::BufferViewFilter(QAbstractItemModel *model, BufferViewConfig *config)
: QSortFilterProxyModel(model),
*****************************************/
BufferViewFilter::BufferViewFilter(QAbstractItemModel *model, BufferViewConfig *config)
: QSortFilterProxyModel(model),
connect(config(), SIGNAL(bufferAdded(const BufferId &, int)), this, SLOT(invalidate()));
connect(config(), SIGNAL(bufferMoved(const BufferId &, int)), this, SLOT(invalidate()));
connect(config(), SIGNAL(bufferRemoved(const BufferId &)), this, SLOT(invalidate()));
connect(config(), SIGNAL(bufferAdded(const BufferId &, int)), this, SLOT(invalidate()));
connect(config(), SIGNAL(bufferMoved(const BufferId &, int)), this, SLOT(invalidate()));
connect(config(), SIGNAL(bufferRemoved(const BufferId &)), this, SLOT(invalidate()));
disconnect(config(), SIGNAL(initDone()), this, SLOT(configInitialized()));
invalidate();
disconnect(config(), SIGNAL(initDone()), this, SLOT(configInitialized()));
invalidate();
}
Qt::ItemFlags BufferViewFilter::flags(const QModelIndex &index) const {
Qt::ItemFlags flags = mapToSource(index).flags();
}
Qt::ItemFlags BufferViewFilter::flags(const QModelIndex &index) const {
Qt::ItemFlags flags = mapToSource(index).flags();
if(row < rowCount(parent)) {
BufferId beforeBufferId = parent.child(row, 0).data(NetworkModel::BufferIdRole).value<BufferId>();
pos = config()->bufferList().indexOf(beforeBufferId);
if(row < rowCount(parent)) {
BufferId beforeBufferId = parent.child(row, 0).data(NetworkModel::BufferIdRole).value<BufferId>();
pos = config()->bufferList().indexOf(beforeBufferId);
void BufferViewFilter::addBuffer(const BufferId &bufferId) const {
if(!config() || config()->bufferList().contains(bufferId))
return;
void BufferViewFilter::addBuffer(const BufferId &bufferId) const {
if(!config() || config()->bufferList().contains(bufferId))
return;
// add the buffer if...
if(config()->isInitialized() && !config()->removedBuffers().contains(bufferId) // it hasn't been manually removed and either
&& ((config()->addNewBuffersAutomatically() && !config()->temporarilyRemovedBuffers().contains(bufferId)) // is totally unknown to us (a new buffer)...
// add the buffer if...
if(config()->isInitialized() && !config()->removedBuffers().contains(bufferId) // it hasn't been manually removed and either
&& ((config()->addNewBuffersAutomatically() && !config()->temporarilyRemovedBuffers().contains(bufferId)) // is totally unknown to us (a new buffer)...