replaced usleep() by rstime::rs_usleep() which accepts times >= 1 sec. Should fix problems on windows

This commit is contained in:
csoler 2018-01-27 20:22:31 +01:00
parent c1fccef53b
commit d0039241d3
28 changed files with 134 additions and 100 deletions

View file

@ -7,6 +7,7 @@
#include <QGraphicsDropShadowEffect>
#include <iostream>
#include "util/rstime.h"
#include "TorControlWindow.h"
#include "TorManager.h"
@ -152,7 +153,7 @@ TorControlDialog::TorStatus TorControlDialog::checkForTor()
{
switch(mTorManager->control()->torStatus())
{
case Tor::TorControl::TorReady: usleep(1*1000*1000);return TOR_STATUS_OK ;
case Tor::TorControl::TorReady: rstime::rs_usleep(1*1000*1000);return TOR_STATUS_OK ;
default:
return TOR_STATUS_UNKNOWN ;
}

View file

@ -46,7 +46,8 @@
#include "util/HandleRichText.h"
#include "util/QtVersion.h"
#include <retroshare/rsnotify.h>
#include "retroshare/rsnotify.h"
#include "util/rstime.h"
#include <time.h>
#include <unistd.h>
@ -339,7 +340,7 @@ void ChatLobbyDialog::init(const ChatId &/*id*/, const QString &/*title*/)
if(rsIdentity->getIdDetails(gxs_id,details))
break ;
else
usleep(1000*300) ;
rstime::rs_usleep(1000*300) ;
ui.chatWidget->setName(QString::fromUtf8(details.mNickname.c_str()));
//ui.chatWidget->addToolsAction(ui.actionChangeNickname);

View file

@ -46,6 +46,7 @@
#include "lang/languagesupport.h"
#include "util/RsGxsUpdateBroadcast.h"
#include "util/rsdir.h"
#include "util/rstime.h"
#ifdef RETROTOR
#include "TorControl/TorManager.h"
@ -371,7 +372,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
while(tcd.checkForTor() != TorControlDialog::TOR_STATUS_OK || tcd.checkForHiddenService() != TorControlDialog::HIDDEN_SERVICE_STATUS_OK) // runs until some status is reached: either tor works, or it fails.
{
QCoreApplication::processEvents();
usleep(0.2*1000*1000) ;
rstime::rs_usleep(0.2*1000*1000) ;
}
tcd.hide();

View file

@ -36,7 +36,7 @@
#include "gui/RetroShareLink.h"
#include "util/ObjectPainter.h"
#include "util/imageutil.h"
#include "util/rsscopetimer.h"
#include "util/rstime.h"
#include <iostream>
@ -1151,7 +1151,7 @@ bool RsHtml::makeEmbeddedImage(const QString &fileName, QString &embeddedImage,
/** Converts image to embedded image HTML fragment **/
bool RsHtml::makeEmbeddedImage(const QImage &originalImage, QString &embeddedImage, const int maxPixels, const int maxBytes)
{
RsScopeTimer s("Embed image");
rstime::RsScopeTimer s("Embed image");
QImage opt;
return ImageUtil::optimizeSize(embeddedImage, originalImage, opt, maxPixels, maxBytes);
}

View file

@ -1,6 +1,6 @@
#include "imageutil.h"
#include "util/misc.h"
#include "util/rsscopetimer.h"
#include "util/rstime.h"
#include <QApplication>
#include <QByteArray>
@ -113,7 +113,7 @@ bool ImageUtil::optimizeSize(QString &html, const QImage& original, QImage &opti
int ImageUtil::checkSize(QString &embeddedImage, const QImage &img, int maxBytes)
{
RsScopeTimer st("Check size");
rstime::RsScopeTimer st("Check size");
QByteArray bytearray;
QBuffer buffer(&bytearray);
@ -166,7 +166,7 @@ void ImageUtil::quantization(const QImage &img, QVector<QRgb> &palette)
int bits = 4; // bits/pixel
int samplesize = 100000; //only take this many color samples
RsScopeTimer st("Quantization");
rstime::RsScopeTimer st("Quantization");
QSet<QRgb> colors;
//collect color information