X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fbuffermodel.cpp;h=594dc83db7c8616bacb53c1f30f32de12c6d915d;hb=fd90abd3f3baa4fc98fa7e3df0e22e9bd3d77d95;hp=3dfdc6da9064f3d9591c1a41bbb8c75762ee566f;hpb=e190d576540cf5dfb2e63d33a69662083f3db210;p=quassel.git diff --git a/src/client/buffermodel.cpp b/src/client/buffermodel.cpp index 3dfdc6da..594dc83d 100644 --- a/src/client/buffermodel.cpp +++ b/src/client/buffermodel.cpp @@ -23,6 +23,8 @@ #include "networkmodel.h" #include "mappedselectionmodel.h" #include "buffer.h" +#include "global.h" + #include BufferModel::BufferModel(NetworkModel *parent) @@ -30,6 +32,10 @@ BufferModel::BufferModel(NetworkModel *parent) _selectionModelSynchronizer(this) { setSourceModel(parent); + if(Global::parser.isSet("debugbufferswitches")) { + connect(_selectionModelSynchronizer.selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), + this, SLOT(debug_currentChanged(const QModelIndex &, const QModelIndex &))); + } } bool BufferModel::filterAcceptsRow(int sourceRow, const QModelIndex &parent) const { @@ -55,19 +61,12 @@ void BufferModel::synchronizeView(QAbstractItemView *view) { view->setSelectionModel(mappedSelectionModel); } -QModelIndex BufferModel::currentIndex() { - return standardSelectionModel()->currentIndex(); -} - void BufferModel::setCurrentIndex(const QModelIndex &newCurrent) { - _selectionModelSynchronizer.selectionModel()->setCurrentIndex(newCurrent, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); - _selectionModelSynchronizer.selectionModel()->select(newCurrent, QItemSelectionModel::Current); + _selectionModelSynchronizer.selectionModel()->setCurrentIndex(newCurrent, QItemSelectionModel::Current); + _selectionModelSynchronizer.selectionModel()->select(newCurrent, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); } void BufferModel::debug_currentChanged(QModelIndex current, QModelIndex previous) { - qDebug() << "New current:" << current << "(previous:" << previous << ")"; -} - -void BufferModel::debug_selectionChanged(QItemSelection current , QItemSelection previous) { - qDebug() << "new selection:" << current << "(previoius:" << previous << ")"; + Q_UNUSED(previous); + qDebug() << "Switched current Buffer: " << current << current.data().toString() << "Buffer:" << current.data(NetworkModel::BufferIdRole).value(); }