moved to QueuedConnection to update the feed count

This commit is contained in:
csoler 2019-12-19 21:04:18 +01:00
parent 93cd6a5df1
commit 856d1b62a7
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
5 changed files with 21 additions and 25 deletions

View file

@ -18,7 +18,6 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#include <QTimer>
#include <QDateTime> #include <QDateTime>
#include "NewsFeed.h" #include "NewsFeed.h"
@ -91,7 +90,7 @@ NewsFeed::NewsFeed(QWidget *parent) : MainPage(parent), ui(new Ui::NewsFeed)
connect(ui->sortComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(sortChanged(int))); connect(ui->sortComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(sortChanged(int)));
connect(ui->removeAllButton, SIGNAL(clicked()), ui->feedWidget, SLOT(clear())); connect(ui->removeAllButton, SIGNAL(clicked()), ui->feedWidget, SLOT(clear()));
connect(ui->feedWidget, SIGNAL(feedCountChanged()), this, SLOT(sendNewsFeedChanged())); connect(ui->feedWidget, SIGNAL(feedCountChanged()), this, SLOT(sendNewsFeedChanged()),Qt::QueuedConnection);
connect(ui->feedOptionsButton, SIGNAL(clicked()), this, SLOT(feedoptions())); connect(ui->feedOptionsButton, SIGNAL(clicked()), this, SLOT(feedoptions()));
ui->feedOptionsButton->hide(); // (csoler) Hidden until we repare the system to display a specific settings page. ui->feedOptionsButton->hide(); // (csoler) Hidden until we repare the system to display a specific settings page.

View file

@ -392,9 +392,20 @@ void RSFeedWidget::removeFeedItem(FeedItem *feedItem)
QTreeWidgetItem *treeItem = findTreeWidgetItem(feedItem); QTreeWidgetItem *treeItem = findTreeWidgetItem(feedItem);
feedRemoved(feedItem); feedRemoved(feedItem);
if (treeItem) {
if (treeItem)
{
int treeItem_index = ui->treeWidget->indexOfTopLevelItem(treeItem);
if(treeItem_index < 0)
{
std::cerr << "(EE) Cannot remove designated item \"" << feedItem->uniqueIdentifier() << "\": not found!" << std::endl;
return ;
}
ui->treeWidget->takeTopLevelItem(treeItem_index);
delete(treeItem); delete(treeItem);
} }
if (!mCountChangedDisabled) { if (!mCountChangedDisabled) {
emit feedCountChanged(); emit feedCountChanged();
@ -498,6 +509,9 @@ FeedItem *RSFeedWidget::findFeedItem(const std::string& identifier)
std::string id = feedItem->uniqueIdentifier(); std::string id = feedItem->uniqueIdentifier();
std::cerr << "Comparing \"" << id << "\"";
std::cerr << " to " << identifier << "\"" << " pthread_t = " << pthread_self() << std::endl;
if (id == identifier) if (id == identifier)
return feedItem; return feedItem;
} }

View file

@ -183,6 +183,7 @@ void GxsChannelPostItem::setup()
connect(ui->downloadButton, SIGNAL(clicked()), this, SLOT(download())); connect(ui->downloadButton, SIGNAL(clicked()), this, SLOT(download()));
// HACK FOR NOW. // HACK FOR NOW.
ui->commentButton->hide();// hidden until properly enabled.
connect(ui->commentButton, SIGNAL(clicked()), this, SLOT(loadComments())); connect(ui->commentButton, SIGNAL(clicked()), this, SLOT(loadComments()));
connect(ui->playButton, SIGNAL(clicked()), this, SLOT(play(void))); connect(ui->playButton, SIGNAL(clicked()), this, SLOT(play(void)));

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1140</width> <width>1359</width>
<height>342</height> <height>342</height>
</rect> </rect>
</property> </property>
@ -57,18 +57,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>82</width>
<height>108</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>156</width>
<height>107</height>
</size>
</property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
@ -138,12 +126,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>60</height>
</size>
</property>
<property name="text"> <property name="text">
<string notr="true">Short Description</string> <string notr="true">Short Description</string>
</property> </property>
@ -570,8 +552,8 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/> <include location="../icons.qrc"/>
<include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View file

@ -26,7 +26,7 @@ NewsFeedUserNotify::NewsFeedUserNotify(NewsFeed *newsFeed, QObject *parent) :
{ {
mNewFeedCount = 0; mNewFeedCount = 0;
connect(newsFeed, SIGNAL(newsFeedChanged(int)), this, SLOT(newsFeedChanged(int))); connect(newsFeed, SIGNAL(newsFeedChanged(int)), this, SLOT(newsFeedChanged(int)),Qt::QueuedConnection);
} }
void NewsFeedUserNotify::newsFeedChanged(int count) void NewsFeedUserNotify::newsFeedChanged(int count)