From: Manuel Nickschas Date: Sat, 21 Jan 2012 19:01:51 +0000 (+0100) Subject: Fix compiler warnings X-Git-Tag: 0.8-beta1~53 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=b3cf44aa5773bb6a6e0a1ba8d0c1add841281b4b Fix compiler warnings New gcc seems to be better at finding issues like unused (but set) variables, so fix those. --- diff --git a/src/client/clientsettings.cpp b/src/client/clientsettings.cpp index b968406d..045c8e43 100644 --- a/src/client/clientsettings.cpp +++ b/src/client/clientsettings.cpp @@ -178,7 +178,6 @@ void CoreAccountSettings::setBufferViewOverlay(const QSet &viewIds) { QSet CoreAccountSettings::bufferViewOverlay() { QSet viewIds; QVariantList variants = accountValue("BufferViewOverlay").toList(); - QVariantList::const_iterator iter = variants.constBegin(); for(QVariantList::const_iterator iter = variants.constBegin(); iter != variants.constEnd(); iter++) { viewIds << iter->toInt(); } diff --git a/src/client/messagefilter.cpp b/src/client/messagefilter.cpp index 39fd3eb7..55f609c7 100644 --- a/src/client/messagefilter.cpp +++ b/src/client/messagefilter.cpp @@ -135,7 +135,7 @@ bool MessageFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourcePar return true; } - MsgId msgId = sourceIdx.data(MessageModel::MsgIdRole).value(); + // MsgId msgId = sourceIdx.data(MessageModel::MsgIdRole).value(); Message::Flags flags = (Message::Flags)sourceIdx.data(MessageModel::FlagsRole).toInt(); NetworkId myNetworkId = networkId(); @@ -154,12 +154,12 @@ bool MessageFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourcePar switch(messageType) { case Message::Notice: if(Client::networkModel()->bufferType(bufferId) != BufferInfo::ChannelBuffer) { - if(flags & Message::ServerMsg) { - // server notice - redirectionTarget = _serverNoticesTarget; - } else { - redirectionTarget = _userNoticesTarget; - } + if(flags & Message::ServerMsg) { + // server notice + redirectionTarget = _serverNoticesTarget; + } else { + redirectionTarget = _userNoticesTarget; + } } break; case Message::Error: @@ -175,21 +175,21 @@ bool MessageFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourcePar if(redirectionTarget & BufferSettings::CurrentBuffer && !(flags & Message::Backlog)) { BufferId redirectedTo = sourceModel()->data(sourceIdx, MessageModel::RedirectedToRole).value(); if(!redirectedTo.isValid()) { - BufferId redirectedTo = Client::bufferModel()->currentIndex().data(NetworkModel::BufferIdRole).value(); - if(redirectedTo.isValid()) - sourceModel()->setData(sourceIdx, QVariant::fromValue(redirectedTo), MessageModel::RedirectedToRole); + BufferId redirectedTo = Client::bufferModel()->currentIndex().data(NetworkModel::BufferIdRole).value(); + if(redirectedTo.isValid()) + sourceModel()->setData(sourceIdx, QVariant::fromValue(redirectedTo), MessageModel::RedirectedToRole); } if(_validBuffers.contains(redirectedTo)) - return true; + return true; } if(redirectionTarget & BufferSettings::StatusBuffer) { QSet::const_iterator idIter = _validBuffers.constBegin(); while(idIter != _validBuffers.constEnd()) { - if(Client::networkModel()->bufferType(*idIter) == BufferInfo::StatusBuffer) - return true; - idIter++; + if(Client::networkModel()->bufferType(*idIter) == BufferInfo::StatusBuffer) + return true; + idIter++; } } diff --git a/src/client/treemodel.cpp b/src/client/treemodel.cpp index 6ab70e62..b3f2613c 100644 --- a/src/client/treemodel.cpp +++ b/src/client/treemodel.cpp @@ -550,11 +550,9 @@ void TreeModel::debug_rowsAboutToBeRemoved(const QModelIndex &parent, int start, qDebug() << "debug_rowsAboutToBeRemoved" << parent << parentItem << parent.data().toString() << rowCount(parent) << start << end; QModelIndex child; - AbstractTreeItem *childItem; for(int i = end; i >= start; i--) { child = parent.child(i, 0); - childItem = parentItem->child(i); - Q_ASSERT(childItem); + Q_ASSERT(parentItem->child(i)); qDebug() << ">>>" << i << child << child.data().toString(); } } @@ -567,11 +565,9 @@ void TreeModel::debug_rowsInserted(const QModelIndex &parent, int start, int end qDebug() << "debug_rowsInserted:" << parent << parentItem << parent.data().toString() << rowCount(parent) << start << end; QModelIndex child; - AbstractTreeItem *childItem; for(int i = start; i <= end; i++) { child = parent.child(i, 0); - childItem = parentItem->child(i); - Q_ASSERT(childItem); + Q_ASSERT(parentItem->child(i)); qDebug() << "<<<" << i << child << child.data().toString(); } } diff --git a/src/qtui/chatscene.cpp b/src/qtui/chatscene.cpp index e5537a05..ef300497 100644 --- a/src/qtui/chatscene.cpp +++ b/src/qtui/chatscene.cpp @@ -429,7 +429,6 @@ void ChatScene::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int e bool atTop = (start == 0); bool atBottom = (end == _lines.count() - 1); - bool moveTop = false; // clear selection if(_selectingItem) { @@ -459,7 +458,7 @@ void ChatScene::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int e if(_selectionStart >= 0) { int offset = end - start + 1; if(_selectionStart >= start) - _selectionStart = qMax(_selectionStart -= offset, start); + _selectionStart = qMax(_selectionStart - offset, start); if(_selectionEnd >= start) _selectionEnd -= offset; if(_firstSelectionRow >= start) @@ -478,7 +477,6 @@ void ChatScene::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int e int moveEnd = _lines.count() - 1; if(start < _lines.count() - start) { // move top part - moveTop = true; moveEnd = start - 1; } else { // move bottom part diff --git a/src/qtui/qtuiapplication.cpp b/src/qtui/qtuiapplication.cpp index c2157a05..d860e745 100644 --- a/src/qtui/qtuiapplication.cpp +++ b/src/qtui/qtuiapplication.cpp @@ -139,7 +139,7 @@ void QtUiApplication::commitData(QSessionManager &manager) { void QtUiApplication::saveState(QSessionManager & manager) { //qDebug() << QString("saving session state to id %1").arg(manager.sessionId()); - AccountId activeCore = Client::currentCoreAccount().accountId(); // FIXME store this! + // AccountId activeCore = Client::currentCoreAccount().accountId(); // FIXME store this! SessionSettings s(manager.sessionId()); s.setSessionAge(0); QtUi::mainWindow()->saveStateToSettings(s); diff --git a/src/qtui/settingspages/networkssettingspage.cpp b/src/qtui/settingspages/networkssettingspage.cpp index 15ee3af9..0f252e32 100644 --- a/src/qtui/settingspages/networkssettingspage.cpp +++ b/src/qtui/settingspages/networkssettingspage.cpp @@ -192,13 +192,13 @@ bool NetworksSettingsPage::testHasChanged() { void NetworksSettingsPage::setWidgetStates() { // network list if(ui.networkList->selectedItems().count()) { - NetworkId id = ui.networkList->selectedItems()[0]->data(Qt::UserRole).value(); - const Network *net = 0; - if(id > 0) net = Client::network(id); ui.detailsBox->setEnabled(true); ui.renameNetwork->setEnabled(true); ui.deleteNetwork->setEnabled(true); + /* button disabled for now + NetworkId id = ui.networkList->selectedItems()[0]->data(Qt::UserRole).value(); + const Network *net = id > 0 ? Client::network(id) : 0; ui.connectNow->setEnabled(net); // && (Client::network(id)->connectionState() == Network::Initialized // || Client::network(id)->connectionState() == Network::Disconnected)); diff --git a/src/uisupport/bufferviewfilter.cpp b/src/uisupport/bufferviewfilter.cpp index 6bd65653..3732d2d2 100644 --- a/src/uisupport/bufferviewfilter.cpp +++ b/src/uisupport/bufferviewfilter.cpp @@ -57,7 +57,7 @@ BufferViewFilter::BufferViewFilter(QAbstractItemModel *model, BufferViewConfig * setDynamicSortFilter(true); connect(this, SIGNAL(_dataChanged(const QModelIndex &, const QModelIndex &)), - this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex))); + this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex))); _enableEditMode.setCheckable(true); _enableEditMode.setChecked(_editMode); @@ -151,12 +151,12 @@ void BufferViewFilter::enableEditMode(bool enable) { QSet::const_iterator iter; for(iter = _toTempRemove.constBegin(); iter != _toTempRemove.constEnd(); iter++) { if(config()->temporarilyRemovedBuffers().contains(*iter)) - continue; + continue; config()->requestRemoveBuffer(*iter); } for(iter = _toRemove.constBegin(); iter != _toRemove.constEnd(); iter++) { if(config()->removedBuffers().contains(*iter)) - continue; + continue; config()->requestRemoveBufferPermanently(*iter); } } @@ -185,7 +185,7 @@ Qt::ItemFlags BufferViewFilter::flags(const QModelIndex &index) const { if(bufferType != BufferInfo::QueryBuffer) { ClientBufferViewConfig *clientConf = qobject_cast(config()); if(clientConf && clientConf->isLocked()) { - flags &= ~(Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled); + flags &= ~(Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled); } } } @@ -210,29 +210,29 @@ bool BufferViewFilter::dropMimeData(const QMimeData *data, Qt::DropAction action bufferId = bufferList[i].second; if(droppedNetworkId == networkId) { if(row < 0) - row = 0; + row = 0; if(row < rowCount(parent)) { - QModelIndex source_child = mapToSource(index(row, 0, parent)); - BufferId beforeBufferId = sourceModel()->data(source_child, NetworkModel::BufferIdRole).value(); - pos = config()->bufferList().indexOf(beforeBufferId); - if(_sortOrder == Qt::DescendingOrder) - pos++; + QModelIndex source_child = mapToSource(index(row, 0, parent)); + BufferId beforeBufferId = sourceModel()->data(source_child, NetworkModel::BufferIdRole).value(); + pos = config()->bufferList().indexOf(beforeBufferId); + if(_sortOrder == Qt::DescendingOrder) + pos++; } else { - if(_sortOrder == Qt::AscendingOrder) - pos = config()->bufferList().count(); - else - pos = 0; + if(_sortOrder == Qt::AscendingOrder) + pos = config()->bufferList().count(); + else + pos = 0; } if(config()->bufferList().contains(bufferId) && !config()->sortAlphabetically()) { - if(config()->bufferList().indexOf(bufferId) < pos) - pos--; - ClientBufferViewConfig *clientConf = qobject_cast(config()); - if(!clientConf || !clientConf->isLocked()) - config()->requestMoveBuffer(bufferId, pos); + if(config()->bufferList().indexOf(bufferId) < pos) + pos--; + ClientBufferViewConfig *clientConf = qobject_cast(config()); + if(!clientConf || !clientConf->isLocked()) + config()->requestMoveBuffer(bufferId, pos); } else { - config()->requestAddBuffer(bufferId, pos); + config()->requestAddBuffer(bufferId, pos); } } else { @@ -280,14 +280,14 @@ void BufferViewFilter::addBuffers(const QList &bufferIds) const { bool lt; for(int i = 0; i < bufferList.count(); i++) { if(config() && config()->sortAlphabetically()) - lt = bufferIdLessThan(bufferId, bufferList[i]); + lt = bufferIdLessThan(bufferId, bufferList[i]); else - lt = bufferId < config()->bufferList()[i]; + lt = bufferId < config()->bufferList()[i]; if(lt) { - pos = i; - bufferList.insert(pos, bufferId); - break; + pos = i; + bufferList.insert(pos, bufferId); + break; } } config()->requestAddBuffer(bufferId, pos); @@ -309,7 +309,7 @@ bool BufferViewFilter::filterAcceptBuffer(const QModelIndex &source_bufferIndex) 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)... - || (config()->temporarilyRemovedBuffers().contains(bufferId) && activityLevel > BufferInfo::OtherActivity))) { // or was just temporarily hidden and has a new message waiting for us. + || (config()->temporarilyRemovedBuffers().contains(bufferId) && activityLevel > BufferInfo::OtherActivity))) { // or was just temporarily hidden and has a new message waiting for us. addBuffer(bufferId); } // note: adding the buffer to the valid list does not temper with the following filters ("show only channels" and stuff) @@ -404,8 +404,8 @@ bool BufferViewFilter::bufferLessThan(const QModelIndex &source_left, const QMod } bool BufferViewFilter::networkLessThan(const QModelIndex &source_left, const QModelIndex &source_right) const { - NetworkId leftNetworkId = sourceModel()->data(source_left, NetworkModel::NetworkIdRole).value(); - NetworkId rightNetworkId = sourceModel()->data(source_right, NetworkModel::NetworkIdRole).value(); + // NetworkId leftNetworkId = sourceModel()->data(source_left, NetworkModel::NetworkIdRole).value(); + // NetworkId rightNetworkId = sourceModel()->data(source_right, NetworkModel::NetworkIdRole).value(); return QSortFilterProxyModel::lessThan(source_left, source_right); }