mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 16:09:37 -05:00
fixed display 10-posts chunks
This commit is contained in:
parent
6e07ead572
commit
b7a9962400
@ -122,9 +122,12 @@ private slots:
|
|||||||
void subscribeGroup(bool subscribe);
|
void subscribeGroup(bool subscribe);
|
||||||
void setViewMode(int viewMode);
|
void setViewMode(int viewMode);
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
void postChannelPostLoad();
|
void postPostLoad();
|
||||||
void postContextMenu(const QPoint&);
|
void postContextMenu(const QPoint&);
|
||||||
void copyMessageLink();
|
void copyMessageLink();
|
||||||
|
void next10Posts();
|
||||||
|
void prev10Posts();
|
||||||
|
void filterItems(QString s);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void handlePostsTreeSizeChange(QSize size);
|
void handlePostsTreeSizeChange(QSize size);
|
||||||
|
@ -385,6 +385,13 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="LineEditClear" name="filter_LE">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Search</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -542,6 +549,11 @@ p, li { white-space: pre-wrap; }
|
|||||||
<extends>QTreeView</extends>
|
<extends>QTreeView</extends>
|
||||||
<header>gui/common/RSTreeView.h</header>
|
<header>gui/common/RSTreeView.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>LineEditClear</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header>gui/common/LineEditClear.h</header>
|
||||||
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>GxsIdChooser</class>
|
<class>GxsIdChooser</class>
|
||||||
<extends>QComboBox</extends>
|
<extends>QComboBox</extends>
|
||||||
|
@ -137,7 +137,7 @@ void RsPostedPostsModel::postMods()
|
|||||||
{
|
{
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
|
||||||
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mFilteredPosts.size(),0,(void*)NULL));
|
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mDisplayedNbPosts,0,(void*)NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsPostedPostsModel::setFilter(const QStringList& strings, uint32_t& count)
|
void RsPostedPostsModel::setFilter(const QStringList& strings, uint32_t& count)
|
||||||
@ -171,8 +171,10 @@ void RsPostedPostsModel::setFilter(const QStringList& strings, uint32_t& count)
|
|||||||
}
|
}
|
||||||
count = mFilteredPosts.size();
|
count = mFilteredPosts.size();
|
||||||
|
|
||||||
|
mDisplayedStartIndex = 0;
|
||||||
|
|
||||||
if(mDisplayedNbPosts > count)
|
if(mDisplayedNbPosts > count)
|
||||||
mDisplayedNbPosts = count;
|
mDisplayedNbPosts = count ;
|
||||||
|
|
||||||
std::cerr << "After filtering: " << count << " posts remain." << std::endl;
|
std::cerr << "After filtering: " << count << " posts remain." << std::endl;
|
||||||
|
|
||||||
@ -210,7 +212,7 @@ bool RsPostedPostsModel::getPostData(const QModelIndex& i,RsPostedPost& fmpe) co
|
|||||||
quintptr ref = i.internalId();
|
quintptr ref = i.internalId();
|
||||||
uint32_t entry = 0;
|
uint32_t entry = 0;
|
||||||
|
|
||||||
if(!convertRefPointerToTabEntry(ref,entry) || entry >= mFilteredPosts.size())
|
if(!convertRefPointerToTabEntry(ref,entry))
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
fmpe = mPosts[mFilteredPosts[entry]];
|
fmpe = mPosts[mFilteredPosts[entry]];
|
||||||
@ -290,7 +292,7 @@ quintptr RsPostedPostsModel::getChildRef(quintptr ref,int index) const
|
|||||||
if(ref == quintptr(0))
|
if(ref == quintptr(0))
|
||||||
{
|
{
|
||||||
quintptr new_ref;
|
quintptr new_ref;
|
||||||
convertTabEntryToRefPointer(index,new_ref);
|
convertTabEntryToRefPointer(index+mDisplayedStartIndex,new_ref);
|
||||||
return new_ref;
|
return new_ref;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -717,7 +719,7 @@ QModelIndex RsPostedPostsModel::getIndexOfMessage(const RsGxsMessageId& mid) con
|
|||||||
|
|
||||||
RsGxsMessageId postId = mid;
|
RsGxsMessageId postId = mid;
|
||||||
|
|
||||||
for(uint32_t i=0;i<mFilteredPosts.size();++i)
|
for(uint32_t i=mDisplayedStartIndex;i<mDisplayedStartIndex+mDisplayedNbPosts;++i)
|
||||||
{
|
{
|
||||||
// First look into msg versions, in case the msg is a version of an existing message
|
// First look into msg versions, in case the msg is a version of an existing message
|
||||||
|
|
||||||
|
@ -57,6 +57,8 @@
|
|||||||
// Filter Str | | X | X (updated because FilteredList may change)
|
// Filter Str | | X | X (updated because FilteredList may change)
|
||||||
// Chunk chng | | X | X
|
// Chunk chng | | X | X
|
||||||
//
|
//
|
||||||
|
// In the model, indexes internal refs are pointer casts of the index in the mFilteredPosts tab. Another possible choice
|
||||||
|
// was to use indexes in the tab of displayed indices, but this leads to a more complex impleemntation.
|
||||||
|
|
||||||
typedef uint32_t PostedPostsModelIndex;
|
typedef uint32_t PostedPostsModelIndex;
|
||||||
|
|
||||||
@ -155,6 +157,8 @@ public:
|
|||||||
// Helper functions
|
// Helper functions
|
||||||
|
|
||||||
bool getPostData(const QModelIndex& i,RsPostedPost& fmpe) const ;
|
bool getPostData(const QModelIndex& i,RsPostedPost& fmpe) const ;
|
||||||
|
uint32_t postsCount() const { return mPosts.size() ; }
|
||||||
|
uint32_t displayedStartPostIndex() const { return mDisplayedStartIndex ; }
|
||||||
void clear() ;
|
void clear() ;
|
||||||
|
|
||||||
// AbstractItemModel functions.
|
// AbstractItemModel functions.
|
||||||
|
Loading…
Reference in New Issue
Block a user