optim: changed postfixed ++ into prefix++ for non trivial operators, replaced test on std::list::size() by std::list::empty() (Patch from Phenom, modified)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7627 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-10-21 22:33:02 +00:00
parent 491a655889
commit b593a918a0
99 changed files with 571 additions and 571 deletions

View file

@ -76,7 +76,7 @@ void AvatarDefs::getAvatarFromGpgId(const std::string& gpgId, QPixmap &avatar, c
std::list<RsPeerId> sslIds;
if (rsPeers->getAssociatedSSLIds(RsPgpId(gpgId), sslIds)) {
std::list<RsPeerId>::iterator sslId;
for (sslId = sslIds.begin(); sslId != sslIds.end(); sslId++) {
for (sslId = sslIds.begin(); sslId != sslIds.end(); ++sslId) {
rsMsgs->getAvatarData(*sslId, data, size);
if (size) {
break;

View file

@ -75,7 +75,7 @@ void Emoticons::load()
QString smfile;
while(sm_codes[i] != '{')
{
i++;
++i;
}
while (i < sm_codes.length()-2)
{
@ -84,27 +84,27 @@ void Emoticons::load()
while(sm_codes[i] != '\"')
{
i++;
++i;
}
i++;
++i;
while (sm_codes[i] != '\"')
{
smcode += sm_codes[i];
i++;
++i;
}
i++;
++i;
while(sm_codes[i] != '\"')
{
i++;
++i;
}
i++;
++i;
while(sm_codes[i] != '\"' && sm_codes[i+1] != ';')
{
smfile += sm_codes[i];
i++;
++i;
}
i++;
++i;
if(!smcode.isEmpty() && !smfile.isEmpty()) {
while (smcode.right(1) == "|") {
smcode.remove(smcode.length() - 1, 1);
@ -189,7 +189,7 @@ void Emoticons::showSmileyWidget(QWidget *parent, QWidget *button, const char *s
if(x >= countPerLine)
{
x = 0;
y++;
++y;
}
QObject::connect(smButton, SIGNAL(clicked()), parent, slotAddMethod);
QObject::connect(smButton, SIGNAL(clicked()), smWidget, SLOT(close()));

View file

@ -227,7 +227,7 @@ void FriendList::processSettings(bool bLoad)
// open groups
int arrayIndex = Settings->beginReadArray("Groups");
for (int index = 0; index < arrayIndex; index++) {
for (int index = 0; index < arrayIndex; ++index) {
Settings->setArrayIndex(index);
addGroupToExpand(Settings->value("open").toString().toStdString());
}
@ -435,7 +435,7 @@ void FriendList::peerTreeWidgetCostumPopupMenu()
bool foundGroup = false;
// add action for all groups, except the own group
for (std::list<RsGroupInfo>::iterator groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); groupIt++) {
for (std::list<RsGroupInfo>::iterator groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) {
if (std::find(groupIt->peerIds.begin(), groupIt->peerIds.end(), gpgId) == groupIt->peerIds.end()) {
if (parent) {
if (addToGroupMenu == NULL) {
@ -625,7 +625,7 @@ void FriendList::insertPeers()
QTreeWidgetItemIterator itemIterator(peerTreeWidget);
QTreeWidgetItem *item;
while ((item = *itemIterator) != NULL) {
itemIterator++;
++itemIterator;
switch (item->type()) {
case TYPE_GPG:
{
@ -648,7 +648,7 @@ void FriendList::insertPeers()
std::string groupId = getRsId(parent);
// the parent is a group, check if the gpg id is assigned to the group
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); groupIt++) {
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) {
if (groupIt->id == groupId) {
if (std::find(groupIt->peerIds.begin(), groupIt->peerIds.end(), gpg_widget_id) == groupIt->peerIds.end()) {
delete(parent->takeChild(parent->indexOfChild(item)));
@ -659,7 +659,7 @@ void FriendList::insertPeers()
}
} else {
// gpg item without group, check if the gpg id is assigned to a group
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); groupIt++) {
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) {
if (std::find(groupIt->peerIds.begin(), groupIt->peerIds.end(), gpg_widget_id) != groupIt->peerIds.end()) {
delete(peerTreeWidget->takeTopLevelItem(peerTreeWidget->indexOfTopLevelItem(item)));
break;
@ -680,12 +680,12 @@ void FriendList::insertPeers()
} else if (groupsHasChanged) {
// remove deleted groups
std::string groupId = getRsId(item);
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); groupIt++) {
for (groupIt = groupInfoList.begin(); groupIt != groupInfoList.end(); ++groupIt) {
if (groupIt->id == groupId) {
break;
}
}
if (groupIt == groupInfoList.end() || groupIt->peerIds.size() == 0) {
if (groupIt == groupInfoList.end() || groupIt->peerIds.empty()) {
if (item->parent()) {
delete(item->parent()->takeChild(item->parent()->indexOfChild(item)));
} else {
@ -710,15 +710,15 @@ void FriendList::insertPeers()
if (mShowGroups && groupIt != groupInfoList.end()) {
groupInfo = &(*groupIt);
if ((groupInfo->flag & RS_GROUP_FLAG_STANDARD) && groupInfo->peerIds.size() == 0) {
if ((groupInfo->flag & RS_GROUP_FLAG_STANDARD) && groupInfo->peerIds.empty()) {
// don't show empty standard groups
groupIt++;
++groupIt;
continue;
}
// search existing group item
int itemCount = peerTreeWidget->topLevelItemCount();
for (int index = 0; index < itemCount; index++) {
for (int index = 0; index < itemCount; ++index) {
QTreeWidgetItem *groupItemLoop = peerTreeWidget->topLevelItem(index);
if (groupItemLoop->type() == TYPE_GROUP && getRsId(groupItemLoop) == groupInfo->id) {
groupItem = groupItemLoop;
@ -756,7 +756,7 @@ void FriendList::insertPeers()
continue;
}
}
childIndex++;
++childIndex;
}
}
@ -768,7 +768,7 @@ void FriendList::insertPeers()
}
// iterate through gpg friends
for (gpgIt = gpgFriends.begin(); gpgIt != gpgFriends.end(); gpgIt++) {
for (gpgIt = gpgFriends.begin(); gpgIt != gpgFriends.end(); ++gpgIt) {
RsPgpId gpgId = *gpgIt;
if (mShowGroups) {
@ -799,7 +799,7 @@ void FriendList::insertPeers()
// search existing gpg item
int itemCount = groupItem ? groupItem->childCount() : peerTreeWidget->topLevelItemCount();
for (int index = 0; index < itemCount; index++) {
for (int index = 0; index < itemCount; ++index) {
gpgItemLoop = groupItem ? groupItem->child(index) : peerTreeWidget->topLevelItem(index);
if (gpgItemLoop->type() == TYPE_GPG && getRsId(gpgItemLoop) == gpgId.toStdString()) {
gpgItem = gpgItemLoop;
@ -844,7 +844,7 @@ void FriendList::insertPeers()
gpgItem->setSizeHint(COLUMN_NAME, QSize(26, 26));
}
availableCount++;
++availableCount;
QString gpgItemText = QString::fromUtf8(detail.name.c_str());
@ -858,7 +858,7 @@ void FriendList::insertPeers()
// count again
childCount = gpgItem->childCount();
} else {
childIndex++;
++childIndex;
}
}
@ -875,14 +875,14 @@ void FriendList::insertPeers()
QString itemIP;
rsPeers->getAssociatedSSLIds(detail.gpg_id, sslContacts);
for (std::list<RsPeerId>::iterator sslIt = sslContacts.begin(); sslIt != sslContacts.end(); sslIt++) {
for (std::list<RsPeerId>::iterator sslIt = sslContacts.begin(); sslIt != sslContacts.end(); ++sslIt) {
QTreeWidgetItem *sslItem = NULL;
RsPeerId sslId = *sslIt;
//find the corresponding sslItem child item of the gpg item
bool newChild = true;
childCount = gpgItem->childCount();
for (int childIndex = 0; childIndex < childCount; childIndex++) {
for (int childIndex = 0; childIndex < childCount; ++childIndex) {
// we assume, that only ssl items are child of the gpg item, so we don't need to test the type
if (getRsId(gpgItem->child(childIndex)) == sslId.toStdString()) {
sslItem = gpgItem->child(childIndex);
@ -972,7 +972,7 @@ void FriendList::insertPeers()
int peerState = 0;
int rsState = 0;
std::list<StatusInfo>::iterator it;
for(it = statusInfo.begin(); it != statusInfo.end(); it++) {
for(it = statusInfo.begin(); it != statusInfo.end(); ++it) {
if(it->id == sslId){
rsState = it->status;
switch (rsState) {
@ -1058,7 +1058,7 @@ void FriendList::insertPeers()
}
sslItem -> setIcon(COLUMN_NAME, sslIcon);
for (int i = 0; i < COLUMN_COUNT; i++) {
for (int i = 0; i < COLUMN_COUNT; ++i) {
sslItem -> setTextColor(i, sslColor);
sslItem -> setFont(i, sslFont);
}
@ -1068,7 +1068,7 @@ void FriendList::insertPeers()
if (gpg_connected) {
gpgItem->setHidden(false);
onlineCount++;
++onlineCount;
if (bestPeerState == 0) {
// show as online
@ -1078,7 +1078,7 @@ void FriendList::insertPeers()
QColor textColor = mTextColorStatus[bestRSState];
QFont font = StatusDefs::font(bestRSState);
for(int i = 0; i < COLUMN_COUNT; i++) {
for(int i = 0; i < COLUMN_COUNT; ++i) {
gpgItem->setTextColor(i, textColor);
gpgItem->setFont(i, font);
}
@ -1106,14 +1106,14 @@ void FriendList::insertPeers()
}
bestPeerState = PEER_STATE_AVAILABLE;
onlineCount++;
++onlineCount;
gpgItem->setHidden(mHideUnconnected);
gpgIcon = QIcon(IMAGE_AVAILABLE);
QFont font;
font.setBold(true);
QColor textColor = mTextColorStatus[RS_STATUS_ONLINE];
for(int i = 0; i < COLUMN_COUNT; i++) {
for(int i = 0; i < COLUMN_COUNT; ++i) {
gpgItem->setTextColor(i, textColor);
gpgItem->setFont(i,font);
}
@ -1130,7 +1130,7 @@ void FriendList::insertPeers()
QColor textColor = mTextColorStatus[RS_STATUS_OFFLINE];
QFont font = StatusDefs::font(RS_STATUS_OFFLINE);
for(int i = 0; i < COLUMN_COUNT; i++) {
for(int i = 0; i < COLUMN_COUNT; ++i) {
gpgItem->setTextColor(i, textColor);
gpgItem->setFont(i, font);
}
@ -1177,7 +1177,7 @@ void FriendList::insertPeers()
}
if (mShowGroups && groupIt != groupInfoList.end()) {
groupIt++;
++groupIt;
} else {
// all done
break;
@ -1211,7 +1211,7 @@ void FriendList::insertPeers()
bool FriendList::getExpandedGroups(std::set<std::string> &groups) const
{
int itemCount = ui->peerTreeWidget->topLevelItemCount();
for (int index = 0; index < itemCount; index++) {
for (int index = 0; index < itemCount; ++index) {
QTreeWidgetItem *item = ui->peerTreeWidget->topLevelItem(index);
if (item->type() == TYPE_GROUP && item->isExpanded()) {
groups.insert(item->data(COLUMN_DATA, ROLE_ID).toString().toStdString());
@ -1405,7 +1405,7 @@ QTreeWidgetItem *FriendList::getCurrentPeer() const
/* Display the columns of this item. */
QString out = "CurrentPeerItem: \n";
for(int i = 1; i < COLUMN_COUNT; i++)
for(int i = 1; i < COLUMN_COUNT; ++i)
{
QString txt = item -> text(i);
out += QString("\t%1:%2\n").arg(i).arg(txt);
@ -1493,7 +1493,7 @@ void FriendList::connectfriend()
{
if (c->type() == TYPE_GPG) {
int childCount = c->childCount();
for (int childIndex = 0; childIndex < childCount; childIndex++) {
for (int childIndex = 0; childIndex < childCount; ++childIndex) {
QTreeWidgetItem *item = c->child(childIndex);
if (item->type() == TYPE_SSL) {
rsPeers->connectAttempt(RsPeerId(getRsId(item)));
@ -1840,7 +1840,7 @@ void FriendList::setShowGroups(bool show)
childCount = ui->peerTreeWidget->topLevelItemCount();
continue;
}
childIndex++;
++childIndex;
}
}
insertPeers();
@ -1871,7 +1871,7 @@ void FriendList::setBigName(bool bigName)
if ((*it)->type() == TYPE_GPG) {
(*it)->setSizeHint(COLUMN_NAME, newSize);
}
it++;
++it;
}
}
}
@ -1883,7 +1883,7 @@ void FriendList::filterItems(const QString &text)
{
filterText = text;
int count = ui->peerTreeWidget->topLevelItemCount();
for (int index = 0; index < count; index++) {
for (int index = 0; index < count; ++index) {
FriendList::filterItem(ui->peerTreeWidget->topLevelItem(index), filterText);
}
@ -1906,9 +1906,9 @@ bool FriendList::filterItem(QTreeWidgetItem *item, const QString &text)
int visibleChildCount = 0;
int count = item->childCount();
for (int index = 0; index < count; index++) {
for (int index = 0; index < count; ++index) {
if (FriendList::filterItem(item->child(index), text)) {
visibleChildCount++;
++visibleChildCount;
}
}

View file

@ -202,7 +202,7 @@ static void initSslItem(QTreeWidgetItem *item, const RsPeerDetails &detail, cons
int state = RS_STATUS_OFFLINE;
if (detail.state & RS_PEER_STATE_CONNECTED) {
std::list<StatusInfo>::const_iterator it;
for (it = statusInfo.begin(); it != statusInfo.end() ; it++) {
for (it = statusInfo.begin(); it != statusInfo.end() ; ++it) {
if (it->id == detail.id) {
state = it->status;
break;
@ -325,9 +325,9 @@ void FriendSelectionWidget::secured_fillList()
{
groupInfo = &(*groupIt);
if (groupInfo->peerIds.size() == 0) {
if (groupInfo->peerIds.empty()) {
// don't show empty groups
groupIt++;
++groupIt;
continue;
}
@ -364,7 +364,7 @@ void FriendSelectionWidget::secured_fillList()
if (mShowTypes & (SHOW_GPG | SHOW_NON_FRIEND_GPG))
{
// iterate through gpg ids
for (gpgIt = gpgIds.begin(); gpgIt != gpgIds.end(); gpgIt++) {
for (gpgIt = gpgIds.begin(); gpgIt != gpgIds.end(); ++gpgIt) {
if (groupInfo) {
// we fill a group, check if gpg id is assigned
if (std::find(groupInfo->peerIds.begin(), groupInfo->peerIds.end(), *gpgIt) == groupInfo->peerIds.end()) {
@ -395,7 +395,7 @@ void FriendSelectionWidget::secured_fillList()
rsPeers->getAssociatedSSLIds(*gpgIt, sslIds);
int state = RS_STATUS_OFFLINE;
for (statusIt = statusInfo.begin(); statusIt != statusInfo.end() ; statusIt++) {
for (statusIt = statusInfo.begin(); statusIt != statusInfo.end() ; ++statusIt) {
if (std::find(sslIds.begin(), sslIds.end(), statusIt->id) != sslIds.end()) {
if (statusIt->status != RS_STATUS_OFFLINE) {
state = RS_STATUS_ONLINE;
@ -430,7 +430,7 @@ void FriendSelectionWidget::secured_fillList()
if (mShowTypes & SHOW_SSL) {
// iterate through associated ssl ids
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); sslIt++) {
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); ++sslIt) {
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(*sslIt, detail)) {
continue; /* BAD */
@ -465,7 +465,7 @@ void FriendSelectionWidget::secured_fillList()
else
{
// iterate through ssl ids
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); sslIt++) {
for (sslIt = sslIds.begin(); sslIt != sslIds.end(); ++sslIt) {
RsPeerDetails detail;
if (!rsPeers->getPeerDetails(*sslIt, detail)) {
continue; /* BAD */
@ -514,7 +514,7 @@ void FriendSelectionWidget::secured_fillList()
if(mShowTypes & SHOW_GXS)
{
// iterate through gpg ids
for (std::vector<RsGxsGroupId>::const_iterator gxsIt = gxsIds.begin(); gxsIt != gxsIds.end(); gxsIt++)
for (std::vector<RsGxsGroupId>::const_iterator gxsIt = gxsIds.begin(); gxsIt != gxsIds.end(); ++gxsIt)
{
// we fill the not assigned gpg ids
if (std::find(filledIds.begin(), filledIds.end(), (*gxsIt).toStdString()) != filledIds.end())
@ -553,7 +553,7 @@ void FriendSelectionWidget::secured_fillList()
}
}
if (groupIt != groupInfoList.end()) {
groupIt++;
++groupIt;
} else {
// all done
break;
@ -628,7 +628,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
std::list<StatusInfo>::iterator statusIt;
rsStatus->getStatusList(statusInfo);
for (statusIt = statusInfo.begin(); statusIt != statusInfo.end() ; statusIt++) {
for (statusIt = statusInfo.begin(); statusIt != statusInfo.end() ; ++statusIt) {
if (std::find(sslIds.begin(), sslIds.end(), statusIt->id) != sslIds.end()) {
if (statusIt->status != RS_STATUS_OFFLINE) {
gpgStatus = RS_STATUS_ONLINE;
@ -645,7 +645,7 @@ void FriendSelectionWidget::peerStatusChanged(const QString& peerId, int status)
QTreeWidgetItemIterator itemIterator(ui->friendList);
QTreeWidgetItem *item;
while ((item = *itemIterator) != NULL) {
itemIterator++;
++itemIterator;
bool bFoundGPG = false;
bool bFoundSSL = false;
@ -827,7 +827,7 @@ void FriendSelectionWidget::itemChanged(QTreeWidgetItem *item, int column)
void FriendSelectionWidget::filterItems(const QString& text)
{
int count = ui->friendList->topLevelItemCount();
for (int index = 0; index < count; index++) {
for (int index = 0; index < count; ++index) {
filterItem(ui->friendList->topLevelItem(index), text);
}
}
@ -844,9 +844,9 @@ bool FriendSelectionWidget::filterItem(QTreeWidgetItem *item, const QString &tex
int visibleChildCount = 0;
int count = item->childCount();
for (int index = 0; index < count; index++) {
for (int index = 0; index < count; ++index) {
if (filterItem(item->child(index), text)) {
visibleChildCount++;
++visibleChildCount;
}
}
@ -881,7 +881,7 @@ void FriendSelectionWidget::selectedIds(IdType idType, std::list<std::string> &i
QTreeWidgetItemIterator itemIterator(ui->friendList);
QTreeWidgetItem *item;
while ((item = *itemIterator) != NULL) {
itemIterator++;
++itemIterator;
std::string id;
@ -955,7 +955,7 @@ void FriendSelectionWidget::setSelectedIds(IdType idType, const std::list<std::s
QTreeWidgetItemIterator itemIterator(ui->friendList);
QTreeWidgetItem *item;
while ((item = *itemIterator) != NULL) {
itemIterator++;
++itemIterator;
std::string id = idFromItem(item);
IdType itemType = idTypeFromItem(item);
@ -986,7 +986,7 @@ void FriendSelectionWidget::itemsFromId(IdType idType, const std::string &id, QL
QTreeWidgetItemIterator itemIterator(ui->friendList);
QTreeWidgetItem *item;
while ((item = *itemIterator) != NULL) {
itemIterator++;
++itemIterator;
if (idType == idTypeFromItem(item) && idFromItem(item) == id) {
items.push_back(item);
@ -999,7 +999,7 @@ void FriendSelectionWidget::items(QList<QTreeWidgetItem*> &_items, IdType idType
QTreeWidgetItemIterator itemIterator(ui->friendList);
QTreeWidgetItem *item;
while ((item = *itemIterator) != NULL) {
itemIterator++;
++itemIterator;
if (idType == IDTYPE_NONE || idType == idTypeFromItem(item)) {
_items.push_back(item);

View file

@ -225,7 +225,7 @@ void GroupTreeWidget::updateColors()
QTreeWidgetItemIterator itemIterator(ui->treeWidget);
QTreeWidgetItem *item;
while ((item = *itemIterator) != NULL) {
itemIterator++;
++itemIterator;
int color = item->data(COLUMN_DATA, ROLE_COLOR).toInt();
if (color >= 0) {
@ -320,14 +320,14 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
/* Iterate all items */
QList<GroupItemInfo>::const_iterator it;
for (it = itemList.begin(); it != itemList.end(); it++) {
for (it = itemList.begin(); it != itemList.end(); ++it) {
const GroupItemInfo &itemInfo = *it;
QTreeWidgetItem *item = NULL;
/* Search exisiting item */
int childCount = categoryItem->childCount();
for (int child = 0; child < childCount; child++) {
for (int child = 0; child < childCount; ++child) {
QTreeWidgetItem *childItem = categoryItem->child(child);
if (childItem->data(COLUMN_DATA, ROLE_ID).toString() == itemInfo.id) {
/* Found child */
@ -388,7 +388,7 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
while (child < childCount) {
QString id = categoryItem->child(child)->data(COLUMN_DATA, ROLE_ID).toString();
for (it = itemList.begin(); it != itemList.end(); it++) {
for (it = itemList.begin(); it != itemList.end(); ++it) {
if (it->id == id) {
break;
}
@ -398,7 +398,7 @@ void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<
delete(categoryItem->takeChild(child));
childCount = categoryItem->childCount();
} else {
child++;
++child;
}
}
@ -435,7 +435,7 @@ QTreeWidgetItem *GroupTreeWidget::getItemFromId(const QString &id)
QTreeWidgetItemIterator itemIterator(ui->treeWidget);
QTreeWidgetItem *item;
while ((item = *itemIterator) != NULL) {
itemIterator++;
++itemIterator;
if (item->parent() == NULL) {
continue;
@ -526,7 +526,7 @@ void GroupTreeWidget::calculateScore(QTreeWidgetItem *item, const QString &filte
QTreeWidgetItemIterator itemIterator(ui->treeWidget);
QTreeWidgetItem *tmpItem;
while ((tmpItem = *itemIterator) != NULL) {
itemIterator++;
++itemIterator;
if (tmpItem->data(COLUMN_DATA, ROLE_ID).toString().isEmpty()) {
continue;
@ -563,7 +563,7 @@ void GroupTreeWidget::resort(QTreeWidgetItem *categoryItem)
categoryItem->sortChildren(COLUMN_DATA, order);
} else {
int count = ui->treeWidget->topLevelItemCount();
for (int child = 0; child < count; child++) {
for (int child = 0; child < count; ++child) {
ui->treeWidget->topLevelItem(child)->sortChildren(COLUMN_DATA, order);
}
}

View file

@ -293,7 +293,7 @@ PictureFlowState::PictureFlowState():
PictureFlowState::~PictureFlowState()
{
for(int i = 0; i < (int)slideImages.count(); i++)
for(int i = 0; i < (int)slideImages.count(); ++i)
delete slideImages[i];
}
@ -317,7 +317,7 @@ void PictureFlowState::reset()
centerSlide.slideIndex = centerIndex;
centerSlide.blend = 256;
for(int i = 0; i < (int)leftSlides.count(); i++) {
for(int i = 0; i < (int)leftSlides.count(); ++i) {
SlideInfo& si = leftSlides[i];
si.angle = angle;
si.cx = -(offsetX + spacing*i*PFREAL_ONE);
@ -326,14 +326,14 @@ void PictureFlowState::reset()
si.blend = 256 * (((int)leftSlides.count()-i)/(float)leftSlides.count());
}//for(int i = 0; i < (int)leftSlides.count(); i++)
for(int i = 0; i < (int)rightSlides.count(); i++) {
for(int i = 0; i < (int)rightSlides.count(); ++i) {
SlideInfo& si = rightSlides[i];
si.angle = -angle;
si.cx = offsetX + spacing*i*PFREAL_ONE;
si.cy = offsetY;
si.slideIndex = centerIndex+1+i;
si.blend = 256 * (((int)rightSlides.count()-i)/(float)rightSlides.count());
}//for(int i = 0; i < (int)rightSlides.count(); i++
}//for(int i = 0; i < (int)rightSlides.count(); ++i
}
// ------------- PictureFlowAnimator ---------------------------------------
@ -394,15 +394,15 @@ void PictureFlowAnimator::update()
PFreal ftick = (tick * PFREAL_ONE) >> 16;
if(step < 0)
index++;
++index;
if(state->centerIndex != index) {
state->centerIndex = index;
frame = index << 16;
state->centerSlide.slideIndex = state->centerIndex;
for(int i = 0; i < (int)state->leftSlides.count(); i++)
for(int i = 0; i < (int)state->leftSlides.count(); ++i)
state->leftSlides[i].slideIndex = state->centerIndex-1-i;
for(int i = 0; i < (int)state->rightSlides.count(); i++)
for(int i = 0; i < (int)state->rightSlides.count(); ++i)
state->rightSlides[i].slideIndex = state->centerIndex+1+i;
}//if(state->centerIndex != index)
@ -416,19 +416,19 @@ void PictureFlowAnimator::update()
return;
}//if(state->centerIndex == target)
for(int i = 0; i < (int)state->leftSlides.count(); i++) {
for(int i = 0; i < (int)state->leftSlides.count(); ++i) {
SlideInfo& si = state->leftSlides[i];
si.angle = state->angle;
si.cx = -(state->offsetX + state->spacing*i*PFREAL_ONE + step*state->spacing*ftick);
si.cy = state->offsetY;
}//for(int i = 0; i < (int)state->leftSlides.count(); i++)
}//for(int i = 0; i < (int)state->leftSlides.count(); ++i)
for(int i = 0; i < (int)state->rightSlides.count(); i++) {
for(int i = 0; i < (int)state->rightSlides.count(); ++i) {
SlideInfo& si = state->rightSlides[i];
si.angle = -state->angle;
si.cx = state->offsetX + state->spacing*i*PFREAL_ONE - step*state->spacing*ftick;
si.cy = state->offsetY;
}//for(int i = 0; i < (int)state->rightSlides.count(); i++)
}//for(int i = 0; i < (int)state->rightSlides.count(); ++i)
if(step > 0) {
PFreal ftick = (neg * PFREAL_ONE) >> 16;
@ -452,20 +452,20 @@ void PictureFlowAnimator::update()
int nleft = state->leftSlides.count();
int nright = state->rightSlides.count();
for(int index = 0; index < nleft; index++) {
for(int index = 0; index < nleft; ++index) {
int startBlend = 256 * ((nleft-index)/(float)nleft);
int stopBlend = 256 * ((nleft-index-step)/(float)nleft);
int blend = startBlend + ((stopBlend-startBlend) * (tick/65535.0)) ;
if ((index==0) && (step<0)) blend = 256;//Is center
state->leftSlides[index].blend = blend;
}//for(int index = 0; index < nleft; index++)
for(int index = 0; index < nright; index++) {
}//for(int index = 0; index < nleft; ++index)
for(int index = 0; index < nright; ++index) {
int startBlend = 256 * ((nright-index)/(float)nright);
int stopBlend = 256 * ((nright-index+step)/(float)nright);
int blend = startBlend + ((stopBlend-startBlend) * (tick/65535.0)) ;
if ((index==0) && (step>0)) blend = 256;//Is center
state->rightSlides[index].blend = blend;
}//for(int index = 0; index < nright; index++)
}//for(int index = 0; index < nright; ++index)
}
// ------------- PictureFlowSoftwareRenderer ---------------------------------------
@ -533,11 +533,11 @@ void PictureFlowSoftwareRenderer::init()
buffer.fill(bgcolor);
rays.resize(w*2);
for(int i = 0; i < w; i++) {
for(int i = 0; i < w; ++i) {
PFreal gg = ((PFREAL_ONE >> 1) + i * PFREAL_ONE) / (2*h);
rays[w-i-1] = -gg;
rays[w+i] = gg;
}//for(int i = 0; i < w; i++)
}//for(int i = 0; i < w; ++i)
dirty = true;
}
@ -580,19 +580,19 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol
// transpose the image, this is to speed-up the rendering
// because we process one column at a time
// (and much better and faster to work row-wise, i.e in one scanline)
for(int x = 0; x < w; x++)
for(int y = 0; y < h; y++)
for(int x = 0; x < w; ++x)
for(int y = 0; y < h; ++y)
result->setPixel(hofs + y, x, img.pixel(x, y));
if(reflectionEffect != PictureFlow::NoReflection) {
// create the reflection
int ht = hs - h - hofs;
int hte = ht;
for(int x = 0; x < w; x++)
for(int y = 0; y < ht; y++) {
for(int x = 0; x < w; ++x)
for(int y = 0; y < ht; ++y) {
QRgb color = img.pixel(x, img.height()-y-1);
result->setPixel(h+hofs+y, x, blendColor(color,bgcolor,128*(hte-y)/hte));
}//for(int y = 0; y < ht; y++)
}//for(int y = 0; y < ht; ++y)
if(reflectionEffect == PictureFlow::BlurredReflection) {
// blur the reflection everything first
@ -611,55 +611,55 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol
// how many times blur is applied?
// for low-end system, limit this to only 1 loop
for(int loop = 0; loop < 2; loop++) {
for(int col = c1; col <= c2; col++) {
for(int loop = 0; loop < 2; ++loop) {
for(int col = c1; col <= c2; ++col) {
p = result->scanLine(r1) + col*4;
for(int i = 0; i < 3; i++)
for(int i = 0; i < 3; ++i)
rgba[i] = p[i] << 4;
p += bpl;
for(int j = r1; j < r2; j++, p += bpl)
for(int i = 0; i < 3; i++)
for(int j = r1; j < r2; ++j, p += bpl)
for(int i = 0; i < 3; ++i)
p[i] = (rgba[i] += (((p[i]<<4)-rgba[i])) >> 1) >> 4;
}//for(int col = c1; col <= c2; col++)
}//for(int col = c1; col <= c2; ++col)
for(int row = r1; row <= r2; row++) {
for(int row = r1; row <= r2; ++row) {
p = result->scanLine(row) + c1*4;
for(int i = 0; i < 3; i++)
for(int i = 0; i < 3; ++i)
rgba[i] = p[i] << 4;
p += 4;
for(int j = c1; j < c2; j++, p+=4)
for(int i = 0; i < 3; i++)
for(int j = c1; j < c2; ++j, p+=4)
for(int i = 0; i < 3; ++i)
p[i] = (rgba[i] += (((p[i]<<4)-rgba[i])) >> 1) >> 4;
}//for(int row = r1; row <= r2; row++)
}//for(int row = r1; row <= r2; ++row)
for(int col = c1; col <= c2; col++) {
for(int col = c1; col <= c2; ++col) {
p = result->scanLine(r2) + col*4;
for(int i = 0; i < 3; i++)
for(int i = 0; i < 3; ++i)
rgba[i] = p[i] << 4;
p -= bpl;
for(int j = r1; j < r2; j++, p -= bpl)
for(int i = 0; i < 3; i++)
for(int j = r1; j < r2; ++j, p -= bpl)
for(int i = 0; i < 3; ++i)
p[i] = (rgba[i] += (((p[i]<<4)-rgba[i])) >> 1) >> 4;
}//for(int col = c1; col <= c2; col++)
}//for(int col = c1; col <= c2; ++col)
for(int row = r1; row <= r2; row++) {
for(int row = r1; row <= r2; ++row) {
p = result->scanLine(row) + c2*4;
for(int i = 0; i < 3; i++)
for(int i = 0; i < 3; ++i)
rgba[i] = p[i] << 4;
p -= 4;
for(int j = c1; j < c2; j++, p-=4)
for(int i = 0; i < 3; i++)
for(int j = c1; j < c2; ++j, p-=4)
for(int i = 0; i < 3; ++i)
p[i] = (rgba[i] += (((p[i]<<4)-rgba[i])) >> 1) >> 4;
}//for(int row = r1; row <= r2; row++)
}//for(int loop = 0; loop < 2; loop++)
}//for(int row = r1; row <= r2; ++row)
}//for(int loop = 0; loop < 2; ++loop)
// overdraw to leave only the reflection blurred (but not the actual image)
for(int x = 0; x < w; x++)
for(int y = 0; y < h; y++)
for(int x = 0; x < w; ++x)
for(int y = 0; y < h; ++y)
result->setPixel(hofs + y, x, img.pixel(x, y));
}//if(reflectionEffect == PictureFlow::BlurredReflection)
}//if(reflectionEffect != PictureFlow::NoReflection)
@ -790,7 +790,7 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
bool flag = false;
rect.setLeft(xi);
for(int x = qMax(xi, col1); x <= col2; x++) {
for(int x = qMax(xi, col1); x <= col2; ++x) {
PFreal hity = 0;
PFreal fk = rays[x];
if(sdy) {
@ -834,8 +834,8 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
*pixel2 = ptr[p2 >> PFREAL_SHIFT];
p1 -= dy;
p2 += dy;
y1--;
y2++;
--y1;
++y2;
pixel1 -= pixelstep;
pixel2 += pixelstep;
}//while((y1 >= 0) && (y2 < h) && (p1 >= 0))
@ -847,12 +847,12 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
*pixel2 = blendColor(c2, bgcolor, blend);
p1 -= dy;
p2 += dy;
y1--;
y2++;
--y1;
++y2;
pixel1 -= pixelstep;
pixel2 += pixelstep;
}//while((y1 >= 0) && (y2 < h) && (p1 >= 0))
}//for(int x = qMax(xi, col1); x <= col2; x++)
}//for(int x = qMax(xi, col1); x <= col2; ++x)
rect.setTop(0);
rect.setBottom(h-1);
@ -870,23 +870,23 @@ void PictureFlowSoftwareRenderer::renderSlides()
state->centerSlide.left=c1;
state->centerSlide.right=c2;
for(int index = 0; index < nleft; index++) {
for(int index = 0; index < nleft; ++index) {
QRect rs = renderSlide(state->leftSlides[index], 0, c1-1);
if(!rs.isEmpty()) {
state->leftSlides[index].left=rs.left();
state->leftSlides[index].right=rs.right();
c1 = rs.left();
}//if(!rs.isEmpty())
}//for(int index = 0; index < nleft; index++)
}//for(int index = 0; index < nleft; ++index)
for(int index = 0; index < nright; index++) {
for(int index = 0; index < nright; ++index) {
QRect rs = renderSlide(state->rightSlides[index], c2+1, buffer.width());
if(!rs.isEmpty()){
state->rightSlides[index].left=rs.left();
state->rightSlides[index].right=rs.right();
c2 = rs.right();
}//if(!rs.isEmpty())
}//for(int index = 0; index < nright; index++)
}//for(int index = 0; index < nright; ++index)
}
// Render the slides. Updates only the offscreen buffer.
@ -1101,7 +1101,7 @@ void PictureFlow::setCenterIndex(int index)
void PictureFlow::clear()
{
int c = d->state->slideImages.count();
for(int i = 0; i < c; i++)
for(int i = 0; i < c; ++i)
delete d->state->slideImages[i];
d->state->slideImages.resize(0);

View file

@ -135,7 +135,7 @@ bool RSTreeWidgetItem::operator<(const QTreeWidgetItem &other) const
}
QList<int>::iterator role;
for (role = roles.begin(); role != roles.end(); role++) {
for (role = roles.begin(); role != roles.end(); ++role) {
// taken from "bool QTreeWidgetItem::operator<(const QTreeWidgetItem &other) const"
const QVariant v1 = data(column, *role);
const QVariant v2 = other.data(column, *role);

View file

@ -1077,7 +1077,7 @@ void RsCollectionDialog::download()
QTreeWidgetItemIterator itemIterator(ui._fileEntriesTW);
QTreeWidgetItem *item;
while ((item = *itemIterator) != NULL) {
itemIterator++;
++itemIterator;
if (item->checkState(COLUMN_FILE) == Qt::Checked) {
std::cerr << item->data(COLUMN_HASH,ROLE_NAME).toString().toStdString()
@ -1144,7 +1144,7 @@ void RsCollectionDialog::saveChild(QTreeWidgetItem *parentItem, ColFileInfo *par
parentInfo->type = parentItem->data(COLUMN_HASH,ROLE_TYPE).toUInt();
parentInfo->size = parentItem->data(COLUMN_SIZE,ROLE_SELSIZE).toULongLong();
for (int i=0; i<parentItem->childCount(); i++) {
for (int i=0; i<parentItem->childCount(); ++i) {
ColFileInfo child;
saveChild(parentItem->child(i), &child);
if (parentInfo->name != "") {

View file

@ -157,7 +157,7 @@ void RsCollectionFile::recursAddElements(QDomDocument& doc,const DirDetails& det
d.setAttribute(QString("name"),QString::fromUtf8(details.name.c_str())) ;
for (std::list<DirStub>::const_iterator it = details.children.begin(); it != details.children.end(); it++)
for (std::list<DirStub>::const_iterator it = details.children.begin(); it != details.children.end(); ++it)
{
if (!it->ref)
continue;
@ -193,7 +193,7 @@ void RsCollectionFile::recursAddElements(QDomDocument& doc,const ColFileInfo& co
d.setAttribute(QString("name"),colFileInfo.name) ;
for (std::vector<ColFileInfo>::const_iterator it = colFileInfo.children.begin(); it != colFileInfo.children.end(); it++)
for (std::vector<ColFileInfo>::const_iterator it = colFileInfo.children.begin(); it != colFileInfo.children.end(); ++it)
{
recursAddElements(doc,(*it),d) ;
}
@ -298,7 +298,7 @@ bool RsCollectionFile::checkFile(const QString& fileName, bool showError)
if(file.atEnd())
n-- ;
else if(n < max_size)
n++ ;
++n ;
}
file.close();
return true;