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 "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->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()));
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);
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);
}
}
if (!mCountChangedDisabled) {
emit feedCountChanged();
@ -498,6 +509,9 @@ FeedItem *RSFeedWidget::findFeedItem(const std::string& identifier)
std::string id = feedItem->uniqueIdentifier();
std::cerr << "Comparing \"" << id << "\"";
std::cerr << " to " << identifier << "\"" << " pthread_t = " << pthread_self() << std::endl;
if (id == identifier)
return feedItem;
}

View File

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

View File

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

View File

@ -26,7 +26,7 @@ NewsFeedUserNotify::NewsFeedUserNotify(NewsFeed *newsFeed, QObject *parent) :
{
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)