From 27264cea0a65319331f3c6e67fef7e218a14bae2 Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 9 Dec 2018 17:35:31 +0100 Subject: [PATCH] fixed icons and buttons in forums --- .../src/gui/gxsforums/GxsForumModel.cpp | 13 ++++- .../gui/gxsforums/GxsForumThreadWidget.cpp | 50 +++++++++++++------ .../src/gui/gxsforums/GxsForumThreadWidget.ui | 47 ++++++++++------- 3 files changed, 75 insertions(+), 35 deletions(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp index dceb91ecb..975944d2a 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp @@ -1216,10 +1216,19 @@ void RsGxsForumModel::recursUpdateReadStatusAndTimes(ForumModelIndex i,bool& has QModelIndex RsGxsForumModel::getIndexOfMessage(const RsGxsMessageId& mid) const { - // brutal search. This is not so nice, so dont call that in a loop! + // Brutal search. This is not so nice, so dont call that in a loop! If too costly, we'll use a map. + + RsGxsMessageId postId = mid; + + // First look into msg versions, in case the msg is a version of an existing message + + for(auto it(mPostVersions.begin());it!=mPostVersions.end();++it) + for(uint32_t i=0;isecond.size();++i) + if(it->second[i].second == mid) + postId = it->first; for(uint32_t i=0;ithreadTreeWidget->setCurrentIndex(index); - ui->threadTreeWidget->scrollTo(index); - ui->threadTreeWidget->setFocus(); + ui->threadTreeWidget->scrollTo(index,QAbstractItemView::PositionAtCenter); + //ui->threadTreeWidget->setFocus(); changedThread(index); } @@ -1366,15 +1384,17 @@ void GxsForumThreadWidget::setAllMessagesReadDo(bool read, uint32_t &/*token*/) bool GxsForumThreadWidget::navigate(const RsGxsMessageId &msgId) { - QModelIndex index = mThreadModel->getIndexOfMessage(msgId); + QModelIndex source_index = mThreadModel->getIndexOfMessage(msgId); - if(!index.isValid()) + if(!source_index.isValid()) return false; - ui->threadTreeWidget->setCurrentIndex(index); - ui->threadTreeWidget->scrollTo(index); + QModelIndex indx = mThreadProxyModel->mapFromSource(source_index); + + ui->threadTreeWidget->setCurrentIndex(indx); + ui->threadTreeWidget->scrollTo(indx,QAbstractItemView::PositionAtCenter); ui->threadTreeWidget->setFocus(); - changedThread(index); + changedThread(indx); return true; } @@ -1720,15 +1740,15 @@ void GxsForumThreadWidget::postForumLoading() #ifdef DEBUG_FORUMS std::cerr << "Post forum loading..." << std::endl; #endif - QModelIndex indx = mThreadModel->getIndexOfMessage(mThreadId); + QModelIndex source_index = mThreadModel->getIndexOfMessage(mThreadId); - if(!mThreadId.isNull() && indx.isValid()) + if(!mThreadId.isNull() && source_index.isValid()) { - QModelIndex index = mThreadProxyModel->mapFromSource(indx); + QModelIndex index = mThreadProxyModel->mapFromSource(source_index); ui->threadTreeWidget->selectionModel()->setCurrentIndex(index,QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); - ui->threadTreeWidget->scrollTo(index); + ui->threadTreeWidget->scrollTo(index,QAbstractItemView::PositionAtCenter); #ifdef DEBUG_FORUMS - std::cerr << " re-selecting index of message " << mThreadId << " to " << indx.row() << "," << indx.column() << " " << (void*)indx.internalPointer() << std::endl; + std::cerr << " re-selecting index of message " << mThreadId << " to " << source_index.row() << "," << source_index.column() << " " << (void*)source_index.internalPointer() << std::endl; #endif } else diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.ui b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.ui index ae79bd607..122372207 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.ui +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.ui @@ -253,28 +253,18 @@ Download all files + + Qt::LeftToRight + - - :/images/down.png:/images/down.png + + :/icons/global_switch_on_128.png:/icons/global_switch_on_128.png true - - - - - 0 - 0 - - - - Next unread - - - @@ -290,14 +280,14 @@ Reply Message - Reply + - :/images/mail_reply.png:/images/mail_reply.png + :/images/replymailall24-hover.png:/images/replymailall24-hover.png - Qt::ToolButtonTextBesideIcon + Qt::ToolButtonIconOnly true @@ -460,6 +450,26 @@ + + + + + 0 + 0 + + + + Next unread message + + + + + + + :/images/arrow-right.png:/images/arrow-right.png + + + @@ -540,6 +550,7 @@ +