Merge remote-tracking branch 'upstream/master' into v0.6-BugFixing_6

This commit is contained in:
csoler 2021-01-21 18:15:08 +01:00
commit 95fc1a56c8
9 changed files with 61 additions and 22 deletions

View File

@ -2519,7 +2519,7 @@ void RsGenExchange::processGroupUpdatePublish()
{
GroupUpdatePublish& gup = *vit;
const RsGxsGroupId& groupId = gup.grpItem->meta.mGroupId;
grpMeta.insert(std::make_pair(groupId, (RsGxsGrpMetaData*)(NULL)));
grpMeta.insert(std::make_pair(groupId, std::make_shared<RsGxsGrpMetaData>()));
}
if(grpMeta.empty())
@ -2985,7 +2985,7 @@ bool RsGenExchange::getGroupKeys(const RsGxsGroupId &grpId, RsTlvSecurityKeySet
RS_STACK_MUTEX(mGenMtx) ;
RsGxsGrpMetaTemporaryMap grpMeta;
grpMeta[grpId] = NULL;
grpMeta[grpId] = std::make_shared<RsGxsGrpMetaData>();
mDataStore->retrieveGxsGrpMetaData(grpMeta);
if(grpMeta.empty())
@ -3078,7 +3078,7 @@ void RsGenExchange::processRecvdMessages()
}
else
{
grpMetas.insert(std::make_pair(pend_it->second.mItem->grpId, (RsGxsGrpMetaData*)NULL));
grpMetas.insert(std::make_pair(pend_it->second.mItem->grpId, std::make_shared<RsGxsGrpMetaData>()));
++pend_it;
}
}

View File

@ -766,7 +766,12 @@ void RsGxsNetTunnelService::threadTick()
}
#endif
rstime::rs_usleep(1*1000*1000) ; // 1 sec
for(uint32_t i=0;i<2;++i)
{
if(shouldStop())
return;
rstime::rs_usleep(500*1000) ; // 1 sec
}
}
const Bias20Bytes& RsGxsNetTunnelService::locked_randomBias()

View File

@ -141,8 +141,6 @@ void BroadcastDiscoveryService::updatePublishedData()
void BroadcastDiscoveryService::threadTick()
{
auto nextRunAt = std::chrono::system_clock::now() + std::chrono::seconds(5);
if( mUdcParameters.can_discover() &&
!mRsPeers.isHiddenNode(mRsPeers.getOwnId()) )
{
@ -200,7 +198,13 @@ void BroadcastDiscoveryService::threadTick()
if( mUdcParameters.can_be_discovered() &&
!mRsPeers.isHiddenNode(mRsPeers.getOwnId()) ) updatePublishedData();
std::this_thread::sleep_until(nextRunAt);
// This avoids waiting 5 secs when the thread should actually terminate (when RS closes).
for(uint32_t i=0;i<10;++i)
{
if(shouldStop())
return;
rstime::rs_usleep(500*1000); // sleep for 0.5 sec.
}
}
RsBroadcastDiscoveryResult BroadcastDiscoveryService::createResult(

View File

@ -93,13 +93,17 @@ p3GxsChannels::p3GxsChannels(
mLastDistantSearchNotificationTS = 0;
mCommentService = new p3GxsCommentService(this, RS_SERVICE_GXS_TYPE_CHANNELS);
RsTickEvent::schedule_in(CHANNEL_PROCESS, 0);
// This is not needed since it just loads all channel data ever 5 mins which takes a lot
// of useless CPU/memory.
//
// RsTickEvent::schedule_in(CHANNEL_PROCESS, 0);
//
// Test Data disabled in repo.
//RsTickEvent::schedule_in(CHANNEL_TESTEVENT_DUMMYDATA, DUMMYDATA_PERIOD);
//
// RsTickEvent::schedule_in(CHANNEL_TESTEVENT_DUMMYDATA, DUMMYDATA_PERIOD);
mGenToken = 0;
mGenCount = 0;
}

View File

@ -643,6 +643,7 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
case RsGxsNotify::TYPE_PROCESSED: break ; // Happens when the group is subscribed. This is triggered by RsGenExchange::subscribeToGroup, so better not
// call it again from here!!
case RsGxsNotify::TYPE_UPDATED:
case RsGxsNotify::TYPE_PUBLISHED:
{
auto ev = std::make_shared<RsGxsIdentityEvent>();

View File

@ -20,6 +20,7 @@
#include <QBuffer>
#include <QMessageBox>
#include <QToolTip>
#include "IdEditDialog.h"
#include "ui_IdEditDialog.h"
@ -100,6 +101,7 @@ IdEditDialog::~IdEditDialog() {}
void IdEditDialog::changeAvatar()
{
#ifdef TODO
AvatarDialog dialog(this);
dialog.setAvatar(mAvatar);
@ -109,6 +111,23 @@ void IdEditDialog::changeAvatar()
setAvatar(newAvatar);
}
#endif
// For now we use a simpler method since AvatarDialog is not finished yet; we use the thumbnail viewer to allow the user to
// select a proper scale/crop of a given image to make his/her avatar.
QString image_filename ;
if(!misc::getOpenFileName(this,RshareSettings::LASTDIR_IMAGES,tr("Import image"), tr("Image files (*.jpg *.png);;All files (*)"),image_filename))
return;
QImage img(image_filename);
ui->avatarLabel->setPicture(QPixmap::fromImage(img));
ui->avatarLabel->setEnableZoom(true);
ui->avatarLabel->setToolTip(tr("Use the mouse to zoom and adjust the image for your avatar."));
// shows the tooltip for a while
QToolTip::showText( ui->avatarLabel->mapToGlobal( QPoint( 0, 0 ) ), ui->avatarLabel->toolTip() );
}
void IdEditDialog::setupNewId(bool pseudo,bool enable_anon)
@ -598,6 +617,8 @@ void IdEditDialog::updateId()
mEditGroup.mMeta.mGroupName = groupname.toUtf8().constData();
mAvatar = ui->avatarLabel->extractCroppedScaledPicture();
if (!mAvatar.isNull())
{
QByteArray ba;

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>542</width>
<height>536</height>
<width>593</width>
<height>604</height>
</rect>
</property>
<property name="sizePolicy">
@ -291,7 +291,7 @@
<item>
<layout class="QVBoxLayout" name="avatarVLayout">
<item>
<widget class="QLabel" name="avatarLabel">
<widget class="ZoomableLabel" name="avatarLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -330,7 +330,7 @@
<item>
<widget class="QPushButton" name="avatarButton">
<property name="text">
<string>Set Avatar</string>
<string>Choose image...</string>
</property>
</widget>
</item>
@ -529,9 +529,13 @@
<header>gui/common/HeaderFrame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ZoomableLabel</class>
<extends>QLabel</extends>
<header>gui/gxschannels/GxsChannelPostThumbnail.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>

View File

@ -376,9 +376,10 @@ MainWindow::~MainWindow()
delete toasterDisable;
delete sysTrayStatus;
delete trayIcon;
delete notifyMenu;//notifyMenu belongs to trayMenu
delete trayMenu;
StatisticsWindow::releaseInstance();
// delete notifyMenu; // already deleted by the deletion of trayMenu
StatisticsWindow::releaseInstance();
#ifdef MESSENGER_WINDOW
MessengerWindow::releaseInstance();
#endif

View File

@ -669,7 +669,6 @@ void GxsChannelPostsWidgetWithModel::download()
for(auto& file:post.mFiles)
{
std::list<RsPeerId> sources;
std::string destination;
// Add possible direct sources.
FileInfo fileInfo;
@ -1318,9 +1317,9 @@ void GxsChannelPostsWidgetWithModel::switchOnlyUnread(bool)
}
void GxsChannelPostsWidgetWithModel::filterChanged(QString s)
{
QStringList ql = s.split(' ',Qt::SkipEmptyParts);
uint32_t count;
mChannelPostsModel->setFilter(ql,ui->showUnread_TB->isChecked(),count);
QStringList ql = s.split(' ',QString::SkipEmptyParts);
uint32_t count;
mChannelPostsModel->setFilter(ql,ui->showUnread_TB->isChecked(),count);
mChannelFilesModel->setFilter(ql,count);
}