mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed icons and buttons in forums
This commit is contained in:
parent
a6ed2b26ec
commit
27264cea0a
@ -1216,10 +1216,19 @@ void RsGxsForumModel::recursUpdateReadStatusAndTimes(ForumModelIndex i,bool& has
|
|||||||
|
|
||||||
QModelIndex RsGxsForumModel::getIndexOfMessage(const RsGxsMessageId& mid) const
|
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;i<it->second.size();++i)
|
||||||
|
if(it->second[i].second == mid)
|
||||||
|
postId = it->first;
|
||||||
|
|
||||||
for(uint32_t i=0;i<mPosts.size();++i)
|
for(uint32_t i=0;i<mPosts.size();++i)
|
||||||
if(mPosts[i].mMsgId == mid)
|
if(mPosts[i].mMsgId == postId)
|
||||||
{
|
{
|
||||||
void *ref ;
|
void *ref ;
|
||||||
convertTabEntryToRefPointer(i,ref);
|
convertTabEntryToRefPointer(i,ref);
|
||||||
|
@ -95,6 +95,13 @@
|
|||||||
|
|
||||||
#define ROLE_THREAD_COUNT 4
|
#define ROLE_THREAD_COUNT 4
|
||||||
|
|
||||||
|
#ifdef DEBUG_FORUMS
|
||||||
|
static std::ostream& operator<<(std::ostream& o,const QModelIndex& q)
|
||||||
|
{
|
||||||
|
return o << "(" << q.row() << "," << q.column() << "," << (void*)q.internalPointer() << ")" ;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
class DistributionItemDelegate: public QStyledItemDelegate
|
class DistributionItemDelegate: public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -990,15 +997,26 @@ void GxsForumThreadWidget::changedThread(QModelIndex index)
|
|||||||
|
|
||||||
void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_FORUMS
|
||||||
|
std::cerr << "Clicked on message ID " << mThreadId << ", index=" << index << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(mUpdating)
|
if(mUpdating)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_FORUMS
|
||||||
|
std::cerr << " early return because mUpdating=true" << std::endl;
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(!index.isValid())
|
if(!index.isValid())
|
||||||
return;
|
{
|
||||||
|
|
||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << "Clicked on message ID " << mThreadId << std::endl;
|
std::cerr << " early return because index is invalid" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (index.column() == RsGxsForumModel::COLUMN_THREAD_READ)
|
if (index.column() == RsGxsForumModel::COLUMN_THREAD_READ)
|
||||||
{
|
{
|
||||||
@ -1313,8 +1331,8 @@ void GxsForumThreadWidget::nextUnreadMessage()
|
|||||||
while(index.isValid() && !IS_MSG_UNREAD(index.sibling(index.row(),RsGxsForumModel::COLUMN_THREAD_DATA).data(RsGxsForumModel::StatusRole).toUInt()));
|
while(index.isValid() && !IS_MSG_UNREAD(index.sibling(index.row(),RsGxsForumModel::COLUMN_THREAD_DATA).data(RsGxsForumModel::StatusRole).toUInt()));
|
||||||
|
|
||||||
ui->threadTreeWidget->setCurrentIndex(index);
|
ui->threadTreeWidget->setCurrentIndex(index);
|
||||||
ui->threadTreeWidget->scrollTo(index);
|
ui->threadTreeWidget->scrollTo(index,QAbstractItemView::PositionAtCenter);
|
||||||
ui->threadTreeWidget->setFocus();
|
//ui->threadTreeWidget->setFocus();
|
||||||
changedThread(index);
|
changedThread(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1366,15 +1384,17 @@ void GxsForumThreadWidget::setAllMessagesReadDo(bool read, uint32_t &/*token*/)
|
|||||||
|
|
||||||
bool GxsForumThreadWidget::navigate(const RsGxsMessageId &msgId)
|
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;
|
return false;
|
||||||
|
|
||||||
ui->threadTreeWidget->setCurrentIndex(index);
|
QModelIndex indx = mThreadProxyModel->mapFromSource(source_index);
|
||||||
ui->threadTreeWidget->scrollTo(index);
|
|
||||||
|
ui->threadTreeWidget->setCurrentIndex(indx);
|
||||||
|
ui->threadTreeWidget->scrollTo(indx,QAbstractItemView::PositionAtCenter);
|
||||||
ui->threadTreeWidget->setFocus();
|
ui->threadTreeWidget->setFocus();
|
||||||
changedThread(index);
|
changedThread(indx);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1720,15 +1740,15 @@ void GxsForumThreadWidget::postForumLoading()
|
|||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << "Post forum loading..." << std::endl;
|
std::cerr << "Post forum loading..." << std::endl;
|
||||||
#endif
|
#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->selectionModel()->setCurrentIndex(index,QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
||||||
ui->threadTreeWidget->scrollTo(index);
|
ui->threadTreeWidget->scrollTo(index,QAbstractItemView::PositionAtCenter);
|
||||||
#ifdef DEBUG_FORUMS
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -253,28 +253,18 @@
|
|||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Download all files</string>
|
<string>Download all files</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset resource="../icons.qrc">
|
||||||
<normaloff>:/images/down.png</normaloff>:/images/down.png</iconset>
|
<normaloff>:/icons/global_switch_on_128.png</normaloff>:/icons/global_switch_on_128.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoRaise">
|
<property name="autoRaise">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="13">
|
|
||||||
<widget class="QPushButton" name="nextUnreadButton">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Next unread</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QToolButton" name="newmessageButton">
|
<widget class="QToolButton" name="newmessageButton">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -290,14 +280,14 @@
|
|||||||
<string>Reply Message</string>
|
<string>Reply Message</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Reply</string>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../images.qrc">
|
<iconset resource="../images.qrc">
|
||||||
<normaloff>:/images/mail_reply.png</normaloff>:/images/mail_reply.png</iconset>
|
<normaloff>:/images/replymailall24-hover.png</normaloff>:/images/replymailall24-hover.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolButtonStyle">
|
<property name="toolButtonStyle">
|
||||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
<enum>Qt::ToolButtonIconOnly</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoRaise">
|
<property name="autoRaise">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -460,6 +450,26 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="13">
|
||||||
|
<widget class="QToolButton" name="nextUnreadButton">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Next unread message</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../WikiPoos/Wiki_images.qrc">
|
||||||
|
<normaloff>:/images/arrow-right.png</normaloff>:/images/arrow-right.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -540,6 +550,7 @@
|
|||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../icons.qrc"/>
|
<include location="../icons.qrc"/>
|
||||||
|
<include location="../WikiPoos/Wiki_images.qrc"/>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
Loading…
Reference in New Issue
Block a user