From 8736380bfe15d39679e0ec3a9440eee8f5a476ab Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 2 Dec 2018 16:45:16 +0100 Subject: [PATCH] added license, removed debug info --- .../src/gui/gxsforums/GxsForumModel.cpp | 133 +++--------------- .../src/gui/gxsforums/GxsForumModel.h | 37 ----- .../gui/gxsforums/GxsForumThreadWidget.cpp | 1 - 3 files changed, 23 insertions(+), 148 deletions(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp index adadbf5bf..8ba1b9639 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp @@ -1,3 +1,23 @@ +/******************************************************************************* + * retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp * + * * + * Copyright 2018 by Cyril Soler * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 of the * + * License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + * * + *******************************************************************************/ + #include #include #include @@ -675,7 +695,7 @@ void RsGxsForumModel::setPosts(const RsGxsForumGroup& group, const std::vector= model.mPosts.size()) - { - std::cerr << "(EE) constructed a RsGxsForumModel::const_iterator from invalid index " << i << std::endl; - kid = -1; - return; - } - // create a stack or parents - parent_stack.clear(); - - if(i==0) - { - current_parent = 0; - kid =0; - return; - } - current_parent = model.mPosts[i].mParent; - ForumModelIndex j(i); - kid = model.mPosts[i].prow; - - while(j != 0) - { - parent_stack.push_front(model.mPosts[j].prow); - j = model.mPosts[i].mParent; - } -} - -ForumModelIndex RsGxsForumModel::const_iterator::operator*() const -{ - if(current_parent >= model.mPosts.size() || kid < 0 || kid >= (int)model.mPosts[current_parent].mChildren.size()) - { - std::cerr << "(EE) operator* on an invalid RsGxsForumModel::const_iterator"<< std::endl; - return 0; - } - - return model.mPosts[current_parent].mChildren[kid]; -} - -void RsGxsForumModel::const_iterator::operator++() -{ - kid++; - while(kid >= (int)model.mPosts[current_parent].mChildren.size()) - { - current_parent = model.mPosts[current_parent].mParent; - kid = parent_stack.back()+1; - - parent_stack.pop_back(); - - } - - if(current_parent == 0 && kid >= (int)model.mPosts[current_parent].mChildren.size()) - { - kid = -1; - return; - } - - while(!model.mPosts[model.mPosts[current_parent].mChildren[kid]].mChildren.empty()) - { - parent_stack.push_back(kid); - current_parent = model.mPosts[current_parent].mChildren[kid]; - kid = 0; - } -} - -RsGxsForumModel::const_iterator::operator bool() const -{ - return kid >= 0; -} -#endif - static void recursPrintModel(const std::vector& entries,ForumModelIndex index,int depth) { const ForumModelPostEntry& e(entries[index]); @@ -1340,7 +1253,7 @@ static void recursPrintModel(const std::vector& entries,For recursPrintModel(entries,e.mChildren[i],depth+1); } - +#ifdef DEBUG_FORUMMODEL void RsGxsForumModel::debug_dump() { std::cerr << "Model data dump:" << std::endl; @@ -1369,6 +1282,6 @@ void RsGxsForumModel::debug_dump() // recursive print recursPrintModel(mPosts,ForumModelIndex(0),0); } - +#endif diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumModel.h b/retroshare-gui/src/gui/gxsforums/GxsForumModel.h index 8c258a826..dec3bad51 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumModel.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumModel.h @@ -1,18 +1,3 @@ -#ifndef SUSPENDED_CODE -#else -#include -#include - -struct RsMsgMetaData -{ - std::string mMsgName ; - time_t mPublishTs; - uint32_t mMsgStatus; - QString mAuthorId; -}; - -#endif - #include "retroshare/rsgxsforums.h" #include "retroshare/rsgxsifacetypes.h" #include @@ -99,28 +84,6 @@ public: std::vector > getPostVersions(const RsGxsMessageId& mid) const; -#ifdef TO_REMOVE - QModelIndex getNextIndex(const QModelIndex& i,bool unread_only) const; - - class const_iterator - { - public: - const_iterator(const RsGxsForumModel& Model,ForumModelIndex = 0) ; - - ForumModelIndex operator*() const ; - void operator++(); - - inline operator bool() const ; - - private: - std::list parent_stack; - int kid; - ForumModelIndex current_parent; - const RsGxsForumModel& model; - }; - void test_iterator() const; -#endif - // This method will asynchroneously update the data void setForum(const RsGxsGroupId& forumGroup); void setTreeMode(TreeMode mode) ; diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index a83d3d590..8de231439 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -28,7 +28,6 @@ #include "util/misc.h" #include "GxsForumThreadWidget.h" #include "ui_GxsForumThreadWidget.h" -#include "GxsForumsFillThread.h" #include "GxsForumModel.h" #include "GxsForumsDialog.h" #include "gui/RetroShareLink.h"