mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-09 03:18:41 -05:00
Merge pull request #2727 from PYRET1C/browse_image
[WIP] This is the gui part of the commit where the wire feed is refreshed
This commit is contained in:
commit
266f84759e
@ -61,13 +61,12 @@
|
|||||||
WireDialog::WireDialog(QWidget *parent)
|
WireDialog::WireDialog(QWidget *parent)
|
||||||
: MainPage(parent), mGroupSet(GROUP_SET_ALL)
|
: MainPage(parent), mGroupSet(GROUP_SET_ALL)
|
||||||
, mAddDialog(nullptr), mGroupSelected(nullptr), mWireQueue(nullptr)
|
, mAddDialog(nullptr), mGroupSelected(nullptr), mWireQueue(nullptr)
|
||||||
, mHistoryIndex(-1)
|
, mHistoryIndex(-1), mEventHandlerId(0)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
connect( ui.toolButton_createAccount, SIGNAL(clicked()), this, SLOT(createGroup()));
|
connect( ui.toolButton_createAccount, SIGNAL(clicked()), this, SLOT(createGroup()));
|
||||||
connect( ui.toolButton_createPulse, SIGNAL(clicked()), this, SLOT(createPulse()));
|
connect( ui.toolButton_createPulse, SIGNAL(clicked()), this, SLOT(createPulse()));
|
||||||
connect( ui.toolButton_refresh, SIGNAL(clicked()), this, SLOT(refreshGroups()));
|
|
||||||
|
|
||||||
connect(ui.comboBox_groupSet, SIGNAL(currentIndexChanged(int)), this, SLOT(selectGroupSet(int)));
|
connect(ui.comboBox_groupSet, SIGNAL(currentIndexChanged(int)), this, SLOT(selectGroupSet(int)));
|
||||||
connect(ui.comboBox_filterTime, SIGNAL(currentIndexChanged(int)), this, SLOT(selectFilterTime(int)));
|
connect(ui.comboBox_filterTime, SIGNAL(currentIndexChanged(int)), this, SLOT(selectFilterTime(int)));
|
||||||
@ -91,6 +90,48 @@ WireDialog::WireDialog(QWidget *parent)
|
|||||||
|
|
||||||
// load settings
|
// load settings
|
||||||
processSettings(true);
|
processSettings(true);
|
||||||
|
|
||||||
|
// Needs to be asynced because this function is called by another thread!
|
||||||
|
rsEvents->registerEventsHandler(
|
||||||
|
[this](std::shared_ptr<const RsEvent> event)
|
||||||
|
{ RsQThreadUtils::postToObject([=]() { handleEvent_main_thread(event); }, this ); },
|
||||||
|
mEventHandlerId, RsEventType::WIRE );
|
||||||
|
}
|
||||||
|
|
||||||
|
void WireDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
const RsWireEvent *e = dynamic_cast<const RsWireEvent*>(event.get());
|
||||||
|
|
||||||
|
if(e)
|
||||||
|
{
|
||||||
|
|
||||||
|
#ifdef GXSWIRE_DEBUG
|
||||||
|
RsDbg() << " Refreshing the feed if there is a matching event. "<< std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// The following switch statements refresh the wire feed whenever there is a new event
|
||||||
|
switch(e->mWireEventCode)
|
||||||
|
{
|
||||||
|
case RsWireEventCode::NEW_POST:
|
||||||
|
|
||||||
|
case RsWireEventCode::NEW_REPLY:
|
||||||
|
|
||||||
|
case RsWireEventCode::NEW_LIKE:
|
||||||
|
|
||||||
|
case RsWireEventCode::NEW_REPUBLISH:
|
||||||
|
|
||||||
|
case RsWireEventCode::POST_UPDATED:
|
||||||
|
|
||||||
|
case RsWireEventCode::NEW_WIRE:
|
||||||
|
|
||||||
|
case RsWireEventCode::FOLLOW_STATUS_CHANGED:
|
||||||
|
|
||||||
|
default:
|
||||||
|
refreshGroups();
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WireDialog::~WireDialog()
|
WireDialog::~WireDialog()
|
||||||
@ -99,7 +140,9 @@ WireDialog::~WireDialog()
|
|||||||
processSettings(false);
|
processSettings(false);
|
||||||
|
|
||||||
clearTwitterView();
|
clearTwitterView();
|
||||||
delete(mWireQueue);
|
delete(mWireQueue);
|
||||||
|
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WireDialog::processSettings(bool load)
|
void WireDialog::processSettings(bool load)
|
||||||
|
@ -164,6 +164,10 @@ private:
|
|||||||
std::map<RsGxsGroupId, RsWireGroup> mAllGroups;
|
std::map<RsGxsGroupId, RsWireGroup> mAllGroups;
|
||||||
std::vector<RsWireGroup> mOwnGroups;
|
std::vector<RsWireGroup> mOwnGroups;
|
||||||
|
|
||||||
|
// This function and variable below it handle the events for the wire
|
||||||
|
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
|
|
||||||
int32_t mHistoryIndex;
|
int32_t mHistoryIndex;
|
||||||
std::vector<WireViewHistory> mHistory;
|
std::vector<WireViewHistory> mHistory;
|
||||||
|
|
||||||
|
@ -100,13 +100,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="toolButton_refresh">
|
|
||||||
<property name="text">
|
|
||||||
<string>Refresh</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="RSComboBox" name="groupChooser"/>
|
<widget class="RSComboBox" name="groupChooser"/>
|
||||||
</item>
|
</item>
|
||||||
@ -189,7 +182,6 @@
|
|||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<pointsize>10</pointsize>
|
<pointsize>10</pointsize>
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
<bold>true</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
@ -208,8 +200,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>220</width>
|
<width>224</width>
|
||||||
<height>444</height>
|
<height>465</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="groupsWidget_VL">
|
<layout class="QVBoxLayout" name="groupsWidget_VL">
|
||||||
@ -387,8 +379,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>521</width>
|
<width>523</width>
|
||||||
<height>437</height>
|
<height>462</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user