From: Marcus Eggenberger Date: Mon, 14 Apr 2008 11:01:37 +0000 (+0000) Subject: fixes to the new buffer views. also disabled the min-activity as it results in nasty... X-Git-Tag: 0.2.0-beta1~54 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=8db1c0298b0b9baf3af072a5ef368b2f2d14169d fixes to the new buffer views. also disabled the min-activity as it results in nasty side effects... :( --- diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index cf283e48..a4a33b8f 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -217,7 +217,7 @@ void MainWin::removeBufferView(int bufferViewConfigId) { break; dock = qobject_cast(action->parent()); - if(dock && actionData.toInt() != bufferViewConfigId) { + if(dock && actionData.toInt() == bufferViewConfigId) { removeAction(action); dock->deleteLater(); } diff --git a/src/qtui/settingspages/bufferviewsettingspage.cpp b/src/qtui/settingspages/bufferviewsettingspage.cpp index 9e959960..5710bd70 100644 --- a/src/qtui/settingspages/bufferviewsettingspage.cpp +++ b/src/qtui/settingspages/bufferviewsettingspage.cpp @@ -54,6 +54,9 @@ BufferViewSettingsPage::BufferViewSettingsPage(QWidget *parent) connect(ui.hideInactiveBuffers, SIGNAL(clicked(bool)), this, SLOT(widgetHasChanged())); connect(ui.networkSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); connect(ui.minimumActivitySelector, SIGNAL(currentIndexChanged(int)), this, SLOT(widgetHasChanged())); + + // FIXME: (see FIXME in BufferViewFilter::filterAcceptBuffer()) + ui.minimumActivitySelector->setEnabled(false); } BufferViewSettingsPage::~BufferViewSettingsPage() { @@ -425,6 +428,12 @@ BufferViewConfig *BufferViewSettingsPage::cloneConfig(BufferViewConfig *config) BufferViewConfig *changedConfig = new BufferViewConfig(-1, this); changedConfig->fromVariantMap(config->toVariantMap()); _changedBufferViews[config] = changedConfig; + connect(config, SIGNAL(bufferAdded(const BufferId &, int)), changedConfig, SLOT(addBuffer(const BufferId &, int))); + connect(config, SIGNAL(bufferMoved(const BufferId &, int)), changedConfig, SLOT(moveBuffer(const BufferId &, int))); + connect(config, SIGNAL(bufferRemoved(const BufferId &)), changedConfig, SLOT(removeBuffer(const BufferId &))); + connect(config, SIGNAL(addBufferRequested(const BufferId &, int)), changedConfig, SLOT(addBuffer(const BufferId &, int))); + connect(config, SIGNAL(moveBufferRequested(const BufferId &, int)), changedConfig, SLOT(moveBuffer(const BufferId &, int))); + connect(config, SIGNAL(removeBufferRequested(const BufferId &)), changedConfig, SLOT(removeBuffer(const BufferId &))); // if this is the currently displayed view we have to change the config of the preview filter BufferViewFilter *filter = qobject_cast(ui.bufferViewPreview->model()); diff --git a/src/uisupport/bufferviewfilter.cpp b/src/uisupport/bufferviewfilter.cpp index 896bd116..a1744f62 100644 --- a/src/uisupport/bufferviewfilter.cpp +++ b/src/uisupport/bufferviewfilter.cpp @@ -36,6 +36,8 @@ BufferViewFilter::BufferViewFilter(QAbstractItemModel *model, BufferViewConfig * { setConfig(config); setSourceModel(model); + connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(source_rowsInserted(const QModelIndex &, int, int))); + // setSortCaseSensitivity(Qt::CaseInsensitive); setDynamicSortFilter(true); } @@ -88,6 +90,8 @@ bool BufferViewFilter::dropMimeData(const QMimeData *data, Qt::DropAction action networkId = bufferList[i].first; bufferId = bufferList[i].second; if(droppedNetworkId == networkId) { + if(row < 0) + row = 0; if(row < rowCount(parent)) { BufferId beforeBufferId = parent.child(row, 0).data(NetworkModel::BufferIdRole).value(); pos = config()->bufferList().indexOf(beforeBufferId); @@ -149,11 +153,12 @@ bool BufferViewFilter::filterAcceptBuffer(const QModelIndex &source_bufferIndex) if(_config->hideInactiveBuffers() && !source_bufferIndex.data(NetworkModel::ItemActiveRole).toBool()) return false; - if(_config->minimumActivity() > source_bufferIndex.data(NetworkModel::BufferActivityRole).toInt()) - return false; + // FIXME: this can result in bad loops :( + // if(_config->minimumActivity() > source_bufferIndex.data(NetworkModel::BufferActivityRole).toInt()) + // return false; - BufferId bufferId = sourceModel()->data(source_bufferIndex, NetworkModel::BufferIdRole).value(); - return _config->bufferList().contains(bufferId); + BufferId bufferId = sourceModel()->data(source_bufferIndex, NetworkModel::BufferIdRole).value(); + return _config->bufferList().contains(bufferId); } bool BufferViewFilter::filterAcceptNetwork(const QModelIndex &source_index) const { @@ -243,6 +248,17 @@ QVariant BufferViewFilter::foreground(const QModelIndex &index) const { } +void BufferViewFilter::source_rowsInserted(const QModelIndex &parent, int start, int end) { + if(parent.data(NetworkModel::ItemTypeRole) != NetworkModel::NetworkItemType) + return; + + if(!config() || !config()->addNewBuffersAutomatically()) + return; + + for(int row = start; row <= end; row++) { + addBuffer(parent.child(row, 0).data(NetworkModel::BufferIdRole).value()); + } +} // ****************************** // Helper diff --git a/src/uisupport/bufferviewfilter.h b/src/uisupport/bufferviewfilter.h index 581cd6c9..07fec1bf 100644 --- a/src/uisupport/bufferviewfilter.h +++ b/src/uisupport/bufferviewfilter.h @@ -62,6 +62,7 @@ public: public slots: void removeBuffer(const QModelIndex &); + void source_rowsInserted(const QModelIndex &parent, int start, int end); protected: bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; diff --git a/version.inc b/version.inc index 7b7b91ea..865ef7b8 100644 --- a/version.inc +++ b/version.inc @@ -4,8 +4,8 @@ { using namespace Global; quasselVersion = "0.2.0-beta1-pre"; - quasselDate = "2008-04-13"; - quasselBuild = 731; + quasselDate = "2008-04-14"; + quasselBuild = 735; //! Minimum client build number the core needs clientBuildNeeded = 731;