mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 09:26:18 -05:00
Fix clang warnings for
../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 106:53: warning: unused parameter 'parent' [-Wunused-parameter] int RsGxsForumModel::columnCount(const QModelIndex &parent) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp:245:3: warning: add explicit braces to avoid dangling else [-Wdangling-else] else ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 248:12: warning: comparison of integers of different signs: 'int' and 'std::vector::size_type' (aka 'unsigned long') [-Wsign-compare] if(row >= mPosts[entry].mChildren.size()) ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 299:67: warning: unused parameter 'orientation' [-Wunused-parameter] QVariant RsGxsForumModel::headerData(int section, Qt::Orientation orientation, int role) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 398:77: warning: unused parameter 'column' [-Wunused-parameter] QVariant RsGxsForumModel::textColorRole(const ForumModelPostEntry& fmpe,int column) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 419:74: warning: unused parameter 'column' [-Wunused-parameter] QVariant RsGxsForumModel::filterRole(const ForumModelPostEntry& fmpe,int column) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 498:75: warning: unused parameter 'column' [-Wunused-parameter] QVariant RsGxsForumModel::missingRole(const ForumModelPostEntry& fmpe,int column) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 540:74: warning: unused parameter 'column' [-Wunused-parameter] QVariant RsGxsForumModel::pinnedRole(const ForumModelPostEntry& fmpe,int column) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 548:78: warning: unused parameter 'column' [-Wunused-parameter] QVariant RsGxsForumModel::backgroundRole(const ForumModelPostEntry& fmpe,int column) const ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 806:111: warning: unused parameter 'useChildTS' [-Wunused-parameter] void RsGxsForumModel::convertMsgToPostEntry(const RsGxsForumGroup& mForumGroup,const RsMsgMetaData& msg, bool useChildTS, ForumModelPostEntry& fentry) ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp:828:7: warning: unused variable 'redacted' [-Wunused-variable] bool redacted = false; ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp:880:6: warning: unused variable 'pos' [-Wunused-variable] int pos = 0; ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp:879:6: warning: unused variable 'count' [-Wunused-variable] int count = msgs.size(); ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp:882:6: warning: unused variable 'step' [-Wunused-variable] int step = 0; ^ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 949:26: warning: comparison of integers of different signs: 'int32_t' (aka 'int') and 'std::vector::size_type' (aka 'unsigned long') [-Wsign- compare] for(int32_t i=0;i<v.size();++i) ~^~~~~~~~~ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 959:23: warning: comparison of integers of different signs: 'int32_t' (aka 'int') and 'std::vector::size_type' (aka 'unsigned long') [-Wsign- compare] for(int32_t j=0;j<it2- >second.size();++j) ~^~~~~~~~~~~~~~~~~~~ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 991:26: warning: comparison of integers of different signs: 'int32_t' (aka 'int') and 'std::vector::size_type' (aka 'unsigned long') [-Wsign- compare] for(int32_t i=1;i<it->second.size();++i) ~^~~~~~~~~~~~~~~~~~ ../../../trunk/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp: 1005:22: warning: comparison of integers of different signs: 'int' and 'std::vector::size_type' (aka 'unsigned long') [-Wsign-compare] for(int i=1;i<it->second.size();++i) ~^~~~~~~~~~~~~~~~~~ ../../../trunk/retroshare-gui/src/gui/gxsforums/ GxsForumThreadWidget.cpp:1038:13: warning: unused function 'cleanupItems' [-Wunused-function] static void cleanupItems (QList<QTreeWidgetItem *> &items) ^
This commit is contained in:
parent
07a31ee5f5
commit
d96b9b054b
@ -103,7 +103,7 @@ int RsGxsForumModel::rowCount(const QModelIndex& parent) const
|
|||||||
return getChildrenCount(parent.internalPointer());
|
return getChildrenCount(parent.internalPointer());
|
||||||
}
|
}
|
||||||
|
|
||||||
int RsGxsForumModel::columnCount(const QModelIndex &parent) const
|
int RsGxsForumModel::columnCount(const QModelIndex &/*parent*/) const
|
||||||
{
|
{
|
||||||
return COLUMN_THREAD_NB_COLUMNS ;
|
return COLUMN_THREAD_NB_COLUMNS ;
|
||||||
}
|
}
|
||||||
@ -229,6 +229,9 @@ Qt::ItemFlags RsGxsForumModel::flags(const QModelIndex& index) const
|
|||||||
|
|
||||||
void *RsGxsForumModel::getChildRef(void *ref,int row) const
|
void *RsGxsForumModel::getChildRef(void *ref,int row) const
|
||||||
{
|
{
|
||||||
|
if (row < 0)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
ForumModelIndex entry ;
|
ForumModelIndex entry ;
|
||||||
|
|
||||||
if(!convertRefPointerToTabEntry(ref,entry) || entry >= mPosts.size())
|
if(!convertRefPointerToTabEntry(ref,entry) || entry >= mPosts.size())
|
||||||
@ -237,15 +240,19 @@ void *RsGxsForumModel::getChildRef(void *ref,int row) const
|
|||||||
void *new_ref;
|
void *new_ref;
|
||||||
|
|
||||||
if(mTreeMode == TREE_MODE_FLAT)
|
if(mTreeMode == TREE_MODE_FLAT)
|
||||||
|
{
|
||||||
if(entry == 0)
|
if(entry == 0)
|
||||||
{
|
{
|
||||||
convertTabEntryToRefPointer(row+1,new_ref);
|
convertTabEntryToRefPointer(row+1,new_ref);
|
||||||
return new_ref;
|
return new_ref;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return NULL ;
|
return NULL ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(row >= mPosts[entry].mChildren.size())
|
if(static_cast<size_t>(row) >= mPosts[entry].mChildren.size())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
convertTabEntryToRefPointer(mPosts[entry].mChildren[row],new_ref);
|
convertTabEntryToRefPointer(mPosts[entry].mChildren[row],new_ref);
|
||||||
@ -296,7 +303,7 @@ int RsGxsForumModel::getChildrenCount(void *ref) const
|
|||||||
return mPosts[entry].mChildren.size();
|
return mPosts[entry].mChildren.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant RsGxsForumModel::headerData(int section, Qt::Orientation orientation, int role) const
|
QVariant RsGxsForumModel::headerData(int section, Qt::Orientation /*orientation*/, int role) const
|
||||||
{
|
{
|
||||||
if(role == Qt::DisplayRole)
|
if(role == Qt::DisplayRole)
|
||||||
switch(section)
|
switch(section)
|
||||||
@ -395,7 +402,7 @@ QVariant RsGxsForumModel::data(const QModelIndex &index, int role) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant RsGxsForumModel::textColorRole(const ForumModelPostEntry& fmpe,int column) const
|
QVariant RsGxsForumModel::textColorRole(const ForumModelPostEntry& fmpe,int /*column*/) const
|
||||||
{
|
{
|
||||||
if( (fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_MISSING))
|
if( (fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_MISSING))
|
||||||
return QVariant(mTextColorMissing);
|
return QVariant(mTextColorMissing);
|
||||||
@ -416,7 +423,7 @@ QVariant RsGxsForumModel::statusRole(const ForumModelPostEntry& fmpe,int column)
|
|||||||
return QVariant(fmpe.mMsgStatus);
|
return QVariant(fmpe.mMsgStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant RsGxsForumModel::filterRole(const ForumModelPostEntry& fmpe,int column) const
|
QVariant RsGxsForumModel::filterRole(const ForumModelPostEntry& fmpe,int /*column*/) const
|
||||||
{
|
{
|
||||||
if(!mFilteringEnabled || (fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_CHILDREN_PASSES_FILTER))
|
if(!mFilteringEnabled || (fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_CHILDREN_PASSES_FILTER))
|
||||||
return QVariant(FilterString);
|
return QVariant(FilterString);
|
||||||
@ -495,7 +502,7 @@ void RsGxsForumModel::setFilter(int column,const QStringList& strings,uint32_t&
|
|||||||
postMods();
|
postMods();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant RsGxsForumModel::missingRole(const ForumModelPostEntry& fmpe,int column) const
|
QVariant RsGxsForumModel::missingRole(const ForumModelPostEntry& fmpe,int /*column*/) const
|
||||||
{
|
{
|
||||||
if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_MISSING)
|
if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_MISSING)
|
||||||
return QVariant(true);
|
return QVariant(true);
|
||||||
@ -537,7 +544,7 @@ QVariant RsGxsForumModel::toolTipRole(const ForumModelPostEntry& fmpe,int column
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant RsGxsForumModel::pinnedRole(const ForumModelPostEntry& fmpe,int column) const
|
QVariant RsGxsForumModel::pinnedRole(const ForumModelPostEntry& fmpe,int /*column*/) const
|
||||||
{
|
{
|
||||||
if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_PINNED)
|
if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_PINNED)
|
||||||
return QVariant(true);
|
return QVariant(true);
|
||||||
@ -545,7 +552,7 @@ QVariant RsGxsForumModel::pinnedRole(const ForumModelPostEntry& fmpe,int column)
|
|||||||
return QVariant(false);
|
return QVariant(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant RsGxsForumModel::backgroundRole(const ForumModelPostEntry& fmpe,int column) const
|
QVariant RsGxsForumModel::backgroundRole(const ForumModelPostEntry& fmpe,int /*column*/) const
|
||||||
{
|
{
|
||||||
if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_PINNED)
|
if(fmpe.mPostFlags & ForumModelPostEntry::FLAG_POST_IS_PINNED)
|
||||||
return QVariant(QBrush(QColor(255,200,180)));
|
return QVariant(QBrush(QColor(255,200,180)));
|
||||||
@ -803,7 +810,7 @@ void RsGxsForumModel::generateMissingItem(const RsGxsMessageId &msgId,ForumModel
|
|||||||
entry.mReputationWarningLevel = 3;
|
entry.mReputationWarningLevel = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsGxsForumModel::convertMsgToPostEntry(const RsGxsForumGroup& mForumGroup,const RsMsgMetaData& msg, bool useChildTS, ForumModelPostEntry& fentry)
|
void RsGxsForumModel::convertMsgToPostEntry(const RsGxsForumGroup& mForumGroup,const RsMsgMetaData& msg, bool /*useChildTS*/, ForumModelPostEntry& fentry)
|
||||||
{
|
{
|
||||||
fentry.mTitle = msg.mMsgName;
|
fentry.mTitle = msg.mMsgName;
|
||||||
fentry.mAuthorId = msg.mAuthorId;
|
fentry.mAuthorId = msg.mAuthorId;
|
||||||
@ -877,10 +884,12 @@ void RsGxsForumModel::computeMessagesHierarchy(const RsGxsForumGroup& forum_grou
|
|||||||
msgs[msgs_metas_array[i].mMsgId] = msgs_metas_array[i] ;
|
msgs[msgs_metas_array[i].mMsgId] = msgs_metas_array[i] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = msgs.size();
|
#ifdef DEBUG_FORUMS
|
||||||
int pos = 0;
|
size_t count = msgs.size();
|
||||||
|
#endif
|
||||||
|
// int pos = 0;
|
||||||
// int steps = count / PROGRESSBAR_MAX;
|
// int steps = count / PROGRESSBAR_MAX;
|
||||||
int step = 0;
|
// int step = 0;
|
||||||
|
|
||||||
initEmptyHierarchy(posts);
|
initEmptyHierarchy(posts);
|
||||||
|
|
||||||
@ -947,7 +956,7 @@ void RsGxsForumModel::computeMessagesHierarchy(const RsGxsForumGroup& forum_grou
|
|||||||
{
|
{
|
||||||
auto& v(it->second) ;
|
auto& v(it->second) ;
|
||||||
|
|
||||||
for(int32_t i=0;i<v.size();++i)
|
for(size_t i=0;i<v.size();++i)
|
||||||
{
|
{
|
||||||
if(v[i].second != it->first)
|
if(v[i].second != it->first)
|
||||||
{
|
{
|
||||||
@ -957,7 +966,7 @@ void RsGxsForumModel::computeMessagesHierarchy(const RsGxsForumGroup& forum_grou
|
|||||||
|
|
||||||
if(it2 != mPostVersions.end())
|
if(it2 != mPostVersions.end())
|
||||||
{
|
{
|
||||||
for(int32_t j=0;j<it2->second.size();++j)
|
for(size_t j=0;j<it2->second.size();++j)
|
||||||
if(it2->second[j].second != sub_msg_id) // dont copy it, since it is already present at slot i
|
if(it2->second[j].second != sub_msg_id) // dont copy it, since it is already present at slot i
|
||||||
v.push_back(it2->second[j]) ;
|
v.push_back(it2->second[j]) ;
|
||||||
|
|
||||||
@ -989,7 +998,7 @@ void RsGxsForumModel::computeMessagesHierarchy(const RsGxsForumGroup& forum_grou
|
|||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << " most recent version " << (*it)[0].first << " " << (*it)[0].second << std::endl;
|
std::cerr << " most recent version " << (*it)[0].first << " " << (*it)[0].second << std::endl;
|
||||||
#endif
|
#endif
|
||||||
for(int32_t i=1;i<it->second.size();++i)
|
for(size_t i=1;i<it->second.size();++i)
|
||||||
{
|
{
|
||||||
msgs.erase(it->second[i].second) ;
|
msgs.erase(it->second[i].second) ;
|
||||||
|
|
||||||
@ -1003,7 +1012,7 @@ void RsGxsForumModel::computeMessagesHierarchy(const RsGxsForumGroup& forum_grou
|
|||||||
// Now make sure that message parents are consistent. Indeed, an old post may have the old version of a post as parent. So we need to change that parent
|
// Now make sure that message parents are consistent. Indeed, an old post may have the old version of a post as parent. So we need to change that parent
|
||||||
// to the newest version. So we create a map of which is the most recent version of each message, so that parent messages can be searched in it.
|
// to the newest version. So we create a map of which is the most recent version of each message, so that parent messages can be searched in it.
|
||||||
|
|
||||||
for(int i=1;i<it->second.size();++i)
|
for(size_t i=1;i<it->second.size();++i)
|
||||||
most_recent_versions[it->second[i].second] = it->second[0].second ;
|
most_recent_versions[it->second[i].second] = it->second[0].second ;
|
||||||
}
|
}
|
||||||
mPostVersions = mTmp ;
|
mPostVersions = mTmp ;
|
||||||
|
@ -1035,17 +1035,6 @@ void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cleanupItems (QList<QTreeWidgetItem *> &items)
|
|
||||||
{
|
|
||||||
QList<QTreeWidgetItem *>::iterator item;
|
|
||||||
for (item = items.begin (); item != items.end (); ++item) {
|
|
||||||
if (*item) {
|
|
||||||
delete (*item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
items.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString getDurationString(uint32_t days)
|
static QString getDurationString(uint32_t days)
|
||||||
{
|
{
|
||||||
switch(days)
|
switch(days)
|
||||||
|
Loading…
Reference in New Issue
Block a user