From 9b0dc8d98fb232cabb683d5681dc0252b9532c32 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 19 Jan 2012 09:32:07 +0100 Subject: Krazy fixes - QL1S/QL1C - single-char QString efficiency - explicit ctors - normalized signals & slots --- src/history/historymodels.cpp | 54 +++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/history/historymodels.cpp') diff --git a/src/history/historymodels.cpp b/src/history/historymodels.cpp index cb8ee20c..f31d90d3 100644 --- a/src/history/historymodels.cpp +++ b/src/history/historymodels.cpp @@ -4,7 +4,7 @@ * * Copyright (C) 2007-2008 Trolltech ASA. All rights reserved * Copyright (C) 2008 Benjamin C. Meyer -* Copyright (C) 2008-2011 by Andrea Diamantini +* Copyright (C) 2008-2012 by Andrea Diamantini * * * This program is free software; you can redistribute it and/or @@ -64,8 +64,8 @@ HistoryModel::HistoryModel(HistoryManager *history, QObject *parent) { Q_ASSERT(m_historyManager); connect(m_historyManager, SIGNAL(historyReset()), this, SLOT(historyReset())); - connect(m_historyManager, SIGNAL(entryRemoved(const HistoryItem &)), this, SLOT(historyReset())); - connect(m_historyManager, SIGNAL(entryAdded(const HistoryItem &)), this, SLOT(entryAdded())); + connect(m_historyManager, SIGNAL(entryRemoved(HistoryItem)), this, SLOT(historyReset())); + connect(m_historyManager, SIGNAL(entryAdded(HistoryItem)), this, SLOT(entryAdded())); connect(m_historyManager, SIGNAL(entryUpdated(int)), this, SLOT(entryUpdated(int))); } @@ -230,12 +230,12 @@ void HistoryFilterModel::setSourceModel(QAbstractItemModel *newSourceModel) if (sourceModel()) { disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset())); - disconnect(sourceModel(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), - this, SLOT(dataChanged(const QModelIndex &, const QModelIndex &))); - disconnect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(sourceRowsInserted(const QModelIndex &, int, int))); - disconnect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); + disconnect(sourceModel(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), + this, SLOT(dataChanged(QModelIndex, QModelIndex))); + disconnect(sourceModel(), SIGNAL(rowsInserted(QModelIndex, int, int)), + this, SLOT(sourceRowsInserted(QModelIndex, int, int))); + disconnect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), + this, SLOT(sourceRowsRemoved(QModelIndex, int, int))); } QAbstractProxyModel::setSourceModel(newSourceModel); @@ -244,12 +244,12 @@ void HistoryFilterModel::setSourceModel(QAbstractItemModel *newSourceModel) { m_loaded = false; connect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset())); - connect(sourceModel(), SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), - this, SLOT(sourceDataChanged(const QModelIndex &, const QModelIndex &))); - connect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(sourceRowsInserted(const QModelIndex &, int, int))); - connect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); + connect(sourceModel(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), + this, SLOT(sourceDataChanged(QModelIndex, QModelIndex))); + connect(sourceModel(), SIGNAL(rowsInserted(QModelIndex, int, int)), + this, SLOT(sourceRowsInserted(QModelIndex, int, int))); + connect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), + this, SLOT(sourceRowsRemoved(QModelIndex, int, int))); } } @@ -411,16 +411,16 @@ bool HistoryFilterModel::removeRows(int row, int count, const QModelIndex &paren if (row < 0 || count <= 0 || row + count > rowCount(parent) || parent.isValid()) return false; int lastRow = row + count - 1; - disconnect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); + disconnect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), + this, SLOT(sourceRowsRemoved(QModelIndex, int, int))); beginRemoveRows(parent, row, lastRow); int oldCount = rowCount(); int start = sourceModel()->rowCount() - m_sourceRow.value(row); int end = sourceModel()->rowCount() - m_sourceRow.value(lastRow); sourceModel()->removeRows(start, end - start + 1); endRemoveRows(); - connect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); + connect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), + this, SLOT(sourceRowsRemoved(QModelIndex, int, int))); m_loaded = false; if (oldCount - count != rowCount()) reset(); @@ -631,10 +631,10 @@ void HistoryTreeModel::setSourceModel(QAbstractItemModel *newSourceModel) { disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset())); disconnect(sourceModel(), SIGNAL(layoutChanged()), this, SLOT(sourceReset())); - disconnect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(sourceRowsInserted(const QModelIndex &, int, int))); - disconnect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); + disconnect(sourceModel(), SIGNAL(rowsInserted(QModelIndex, int, int)), + this, SLOT(sourceRowsInserted(QModelIndex, int, int))); + disconnect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), + this, SLOT(sourceRowsRemoved(QModelIndex, int, int))); } QAbstractProxyModel::setSourceModel(newSourceModel); @@ -643,10 +643,10 @@ void HistoryTreeModel::setSourceModel(QAbstractItemModel *newSourceModel) { connect(sourceModel(), SIGNAL(modelReset()), this, SLOT(sourceReset())); connect(sourceModel(), SIGNAL(layoutChanged()), this, SLOT(sourceReset())); - connect(sourceModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(sourceRowsInserted(const QModelIndex &, int, int))); - connect(sourceModel(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); + connect(sourceModel(), SIGNAL(rowsInserted(QModelIndex, int, int)), + this, SLOT(sourceRowsInserted(QModelIndex, int, int))); + connect(sourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), + this, SLOT(sourceRowsRemoved(QModelIndex, int, int))); } reset(); -- cgit v1.2.1