mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-24 15:09:33 -05:00
Merge pull request #2765 from PYRET1C/new_token_service
[WIP] Added the new token service in this file
This commit is contained in:
commit
267ffc99af
@ -25,6 +25,7 @@
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "gui/common/FilesDefs.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include "PulseAddDialog.h"
|
||||
|
||||
@ -98,11 +99,31 @@ void PulseAddDialog::setGroup(RsWireGroup &group)
|
||||
// set ReplyWith Group.
|
||||
void PulseAddDialog::setGroup(const RsGxsGroupId &grpId)
|
||||
{
|
||||
/* fetch in the background */
|
||||
if(grpId.isNull()){
|
||||
return;
|
||||
}
|
||||
|
||||
RsThread::async([this,grpId](){
|
||||
|
||||
RsWireGroupSPtr pGroup;
|
||||
rsWire->getWireGroup(grpId, pGroup);
|
||||
if(!rsWire->getWireGroup(grpId,pGroup))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve wire group info for wire id: " << grpId << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
RsQThreadUtils::postToObject( [pGroup,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete, note that
|
||||
* Qt::QueuedConnection is important!
|
||||
*/
|
||||
|
||||
setGroup(*pGroup);
|
||||
}, this );
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
void PulseAddDialog::cleanup()
|
||||
@ -236,20 +257,24 @@ void PulseAddDialog::setReplyTo(const RsWirePulse &pulse, RsWirePulseSPtr pPulse
|
||||
|
||||
void PulseAddDialog::setReplyTo(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, uint32_t replyType)
|
||||
{
|
||||
if(grpId.isNull()){
|
||||
return;
|
||||
}
|
||||
/* fetch in the background */
|
||||
|
||||
RsThread::async([this,grpId,msgId,replyType](){
|
||||
|
||||
RsWireGroupSPtr pGroup;
|
||||
if (!rsWire->getWireGroup(grpId, pGroup))
|
||||
RsWirePulseSPtr pPulse;
|
||||
if(!rsWire->getWireGroup(grpId,pGroup))
|
||||
{
|
||||
std::cerr << "PulseAddDialog::setRplyTo() failed to fetch group";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << __PRETTY_FUNCTION__ << "PulseAddDialog::setRplyTo() failed to fetch group id: " << grpId << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
RsWirePulseSPtr pPulse;
|
||||
if (!rsWire->getWirePulse(grpId, msgId, pPulse))
|
||||
{
|
||||
std::cerr << "PulseAddDialog::setRplyTo() failed to fetch pulse";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "PulseAddDialog::setRplyTo() failed to fetch pulse of group id: " << grpId << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -259,7 +284,19 @@ void PulseAddDialog::setReplyTo(const RsGxsGroupId &grpId, const RsGxsMessageId
|
||||
pPulse->mGroupPtr = pGroup;
|
||||
}
|
||||
|
||||
RsQThreadUtils::postToObject( [pGroup,this,pPulse,replyType]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete, note that
|
||||
* Qt::QueuedConnection is important!
|
||||
*/
|
||||
|
||||
setReplyTo(*pPulse, pPulse, pGroup->mMeta.mGroupName, replyType);
|
||||
}, this );
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void PulseAddDialog::addURL()
|
||||
@ -319,7 +356,8 @@ void PulseAddDialog::postOriginalPulse()
|
||||
pPulse->mImage3 = mImage3;
|
||||
pPulse->mImage4 = mImage4;
|
||||
|
||||
// this should be in async thread, so doesn't block UI thread.
|
||||
RsThread::async([this,pPulse](){
|
||||
|
||||
if (!rsWire->createOriginalPulse(mGroup.mMeta.mGroupId, pPulse))
|
||||
{
|
||||
std::cerr << "PulseAddDialog::postOriginalPulse() FAILED";
|
||||
@ -327,8 +365,20 @@ void PulseAddDialog::postOriginalPulse()
|
||||
return;
|
||||
}
|
||||
|
||||
RsQThreadUtils::postToObject( [this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete, note that
|
||||
* Qt::QueuedConnection is important!
|
||||
*/
|
||||
|
||||
clearDialog();
|
||||
hide();
|
||||
}, this );
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
uint32_t PulseAddDialog::toPulseSentiment(int index)
|
||||
@ -380,7 +430,8 @@ void PulseAddDialog::postReplyPulse()
|
||||
pPulse->mImage4 = mReplyToPulse.mImage4;
|
||||
}
|
||||
|
||||
// this should be in async thread, so doesn't block UI thread.
|
||||
RsThread::async([this, pPulse](){
|
||||
|
||||
if (!rsWire->createReplyPulse(mReplyToPulse.mMeta.mGroupId,
|
||||
mReplyToPulse.mMeta.mOrigMsgId,
|
||||
mGroup.mMeta.mGroupId,
|
||||
@ -392,8 +443,20 @@ void PulseAddDialog::postReplyPulse()
|
||||
return;
|
||||
}
|
||||
|
||||
RsQThreadUtils::postToObject( [this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete, note that
|
||||
* Qt::QueuedConnection is important!
|
||||
*/
|
||||
|
||||
clearDialog();
|
||||
hide();
|
||||
}, this );
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void PulseAddDialog::clearDialog()
|
||||
|
@ -140,6 +140,7 @@ WireDialog::~WireDialog()
|
||||
processSettings(false);
|
||||
|
||||
clearTwitterView();
|
||||
std::cerr << "WireDialog::~WireDialog()" << std::endl;
|
||||
delete(mWireQueue);
|
||||
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
@ -688,6 +689,7 @@ void WireDialog::PVHrate(const RsGxsId &authorId)
|
||||
void WireDialog::postTestTwitterView()
|
||||
{
|
||||
clearTwitterView();
|
||||
std::cerr << "WireDialog::postTestTwitterView()" << std::endl;
|
||||
|
||||
addTwitterView(new PulseTopLevel(NULL,RsWirePulseSPtr()));
|
||||
addTwitterView(new PulseReply(NULL,RsWirePulseSPtr()));
|
||||
@ -844,6 +846,7 @@ void WireDialog::requestPulseFocus(const RsGxsGroupId groupId, const RsGxsMessag
|
||||
void WireDialog::showPulseFocus(const RsGxsGroupId groupId, const RsGxsMessageId msgId)
|
||||
{
|
||||
clearTwitterView();
|
||||
std::cerr << "WireDialog::showPulseFocus()" << std::endl;
|
||||
|
||||
// background thread for loading.
|
||||
RsThread::async([this, groupId, msgId]()
|
||||
@ -873,6 +876,8 @@ void WireDialog::showPulseFocus(const RsGxsGroupId groupId, const RsGxsMessageId
|
||||
void WireDialog::postPulseFocus(RsWirePulseSPtr pPulse)
|
||||
{
|
||||
clearTwitterView();
|
||||
std::cerr << "WireDialog::postPulseFocus()" << std::endl;
|
||||
|
||||
if (!pPulse)
|
||||
{
|
||||
std::cerr << "WireDialog::postPulseFocus() Invalid pulse";
|
||||
@ -945,7 +950,7 @@ void WireDialog::requestGroupFocus(const RsGxsGroupId groupId)
|
||||
void WireDialog::showGroupFocus(const RsGxsGroupId groupId)
|
||||
{
|
||||
clearTwitterView();
|
||||
|
||||
std::cerr << "WireDialog::showGroupFocus()" << std::endl;
|
||||
// background thread for loading.
|
||||
RsThread::async([this, groupId]()
|
||||
{
|
||||
@ -1022,6 +1027,7 @@ void WireDialog::requestGroupsPulses(const std::list<RsGxsGroupId>& groupIds)
|
||||
void WireDialog::showGroupsPulses(const std::list<RsGxsGroupId>& groupIds)
|
||||
{
|
||||
clearTwitterView();
|
||||
std::cerr << "WireDialog::showGroupPulses()" << std::endl;
|
||||
|
||||
// background thread for loading.
|
||||
RsThread::async([this, groupIds]()
|
||||
|
Loading…
Reference in New Issue
Block a user