From 4546be7778864e6c8568a9f6089cf532c99f7ff7 Mon Sep 17 00:00:00 2001 From: drbob Date: Wed, 9 Sep 2009 21:17:03 +0000 Subject: [PATCH] GUI mods for new Forum sorting method. (Last Post) git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1629 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/ForumsDialog.cpp | 53 ++++++++++++++++++++++--- retroshare-gui/src/gui/ForumsDialog.ui | 5 +++ retroshare-gui/src/rsiface/rsforums.h | 3 +- 3 files changed, 54 insertions(+), 7 deletions(-) diff --git a/retroshare-gui/src/gui/ForumsDialog.cpp b/retroshare-gui/src/gui/ForumsDialog.cpp index 0ef1f3632..afec8f03e 100644 --- a/retroshare-gui/src/gui/ForumsDialog.cpp +++ b/retroshare-gui/src/gui/ForumsDialog.cpp @@ -553,10 +553,23 @@ void ForumsDialog::insertThreads() mCurrPostId = ""; std::string fId = mCurrForumId; +#define VIEW_LAST_POST 0 +#define VIEW_THREADED 1 +#define VIEW_FLAT 2 + bool flatView = false; - if (ui.viewBox->currentIndex() == 1) + bool useChildTS = false; + switch(ui.viewBox->currentIndex()) { - flatView = true; + case VIEW_LAST_POST: + useChildTS = true; + break; + case VIEW_FLAT: + flatView = true; + break; + default: + case VIEW_THREADED: + break; } std::list threads; @@ -587,9 +600,23 @@ void ForumsDialog::insertThreads() { QDateTime qtime; - qtime.setTime_t(tit->ts); + if (useChildTS) + qtime.setTime_t(tit->childTS); + else + qtime.setTime_t(tit->ts); + QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss"); - item -> setText(0, timestamp); + + QString txt = timestamp; + if (useChildTS) + { + QDateTime qtime2; + qtime2.setTime_t(tit->ts); + QString timestamp2 = qtime2.toString("yyyy-MM-dd hh:mm:ss"); + txt += " / "; + txt += timestamp2; + } + item -> setText(0, txt); } ForumMsgInfo msginfo ; rsForums->getForumMessage(fId,tit->msgId,msginfo) ; @@ -639,9 +666,23 @@ void ForumsDialog::insertThreads() { QDateTime qtime; - qtime.setTime_t(mit->ts); + if (useChildTS) + qtime.setTime_t(mit->childTS); + else + qtime.setTime_t(mit->ts); + QString timestamp = qtime.toString("yyyy-MM-dd hh:mm:ss"); - child -> setText(0, timestamp); + + QString txt = timestamp; + if (useChildTS) + { + QDateTime qtime2; + qtime2.setTime_t(mit->ts); + QString timestamp2 = qtime2.toString("yyyy-MM-dd hh:mm:ss"); + txt += " / "; + txt += timestamp2; + } + child -> setText(0, txt); } ForumMsgInfo msginfo ; rsForums->getForumMessage(fId,mit->msgId,msginfo) ; diff --git a/retroshare-gui/src/gui/ForumsDialog.ui b/retroshare-gui/src/gui/ForumsDialog.ui index 5d5caebfb..f7d82c108 100644 --- a/retroshare-gui/src/gui/ForumsDialog.ui +++ b/retroshare-gui/src/gui/ForumsDialog.ui @@ -642,6 +642,11 @@ + + + Last Post + + Threaded View diff --git a/retroshare-gui/src/rsiface/rsforums.h b/retroshare-gui/src/rsiface/rsforums.h index 8504ab4e9..4e83ccd1e 100644 --- a/retroshare-gui/src/rsiface/rsforums.h +++ b/retroshare-gui/src/rsiface/rsforums.h @@ -69,6 +69,7 @@ class ForumMsgInfo std::wstring title; std::wstring msg; time_t ts; + time_t childTS; }; @@ -87,7 +88,7 @@ class ThreadInfoSummary std::wstring msg; int count; /* file count */ time_t ts; - + time_t childTS; }; std::ostream &operator<<(std::ostream &out, const ForumInfo &info);