1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Merge remote-tracking branch 'bitok/fix_performance_issues'

This commit is contained in:
agilob 2015-10-21 19:12:15 +01:00
commit ecbda91764
No known key found for this signature in database
GPG Key ID: 296F0B764741106C
10 changed files with 19 additions and 16 deletions

View File

@ -81,21 +81,24 @@ void OfflineMsgEngine::deliverOfflineMsgs()
QMap<int, MsgPtr> msgs = undeliveredMsgs;
removeAllReciepts();
for (auto iter = msgs.begin(); iter != msgs.end(); iter++)
{
if (iter.value().timestamp.msecsTo(QDateTime::currentDateTime()) < offlineTimeout)
for (auto iter = msgs.begin(); iter != msgs.end(); ++iter)
{
auto val = iter.value();
auto key = iter.key();
if (val.timestamp.msecsTo(QDateTime::currentDateTime()) < offlineTimeout)
{
registerReceipt(iter.value().receipt, iter.key(), iter.value().msg, iter.value().timestamp);
registerReceipt(val.receipt, key, val.msg, val.timestamp);
continue;
}
QString messageText = iter.value().msg->toString();
QString messageText = val.msg->toString();
int rec;
if (iter.value().msg->isAction())
if (val.msg->isAction())
rec = Core::getInstance()->sendAction(f->getFriendID(), messageText);
else
rec = Core::getInstance()->sendMessage(f->getFriendID(), messageText);
registerReceipt(rec, iter.key(), iter.value().msg);
registerReceipt(rec, key, val.msg);
}
}

View File

@ -40,7 +40,7 @@ QMutex CameraDevice::openDeviceLock, CameraDevice::iformatLock;
AVInputFormat* CameraDevice::iformat{nullptr};
AVInputFormat* CameraDevice::idesktopFormat{nullptr};
CameraDevice::CameraDevice(const QString devName, AVFormatContext *context)
CameraDevice::CameraDevice(const QString &devName, AVFormatContext *context)
: devName{devName}, context{context}, refcount{1}
{
}

View File

@ -66,7 +66,7 @@ public:
static QString getDefaultDeviceName();
private:
CameraDevice(const QString devName, AVFormatContext *context);
CameraDevice(const QString &devName, AVFormatContext *context);
static CameraDevice* open(QString devName, AVDictionary** options);
static bool getDefaultInputFormat(); ///< Sets CameraDevice::iformat, returns success/failure
static QVector<QPair<QString, QString> > getRawDeviceListGeneric(); ///< Uses avdevice_list_devices

View File

@ -91,7 +91,7 @@ void TabCompleter::complete()
// remember charcount to delete next time and advance to next completion
lastCompletionLength = nextCompletion->length();
nextCompletion++;
++nextCompletion;
// we're completing the first word of the line
if (msgEdit->textCursor().position() == lastCompletionLength)

View File

@ -81,7 +81,7 @@ void MaskablePixmapWidget::setClickable(bool clickable)
unsetCursor();
}
void MaskablePixmapWidget::setPixmap(const QPixmap &pmap, QColor background)
void MaskablePixmapWidget::setPixmap(const QPixmap &pmap, const QColor &background)
{
if (!pmap.isNull())
{

View File

@ -30,7 +30,7 @@ public:
~MaskablePixmapWidget();
void autopickBackground();
void setClickable(bool clickable);
void setPixmap(const QPixmap &pmap, QColor background);
void setPixmap(const QPixmap &pmap, const QColor &background);
void setPixmap(const QPixmap &pmap);
QPixmap getPixmap() const;
void setSize(QSize size);

View File

@ -179,7 +179,7 @@ void Style::setThemeColor(int color)
setThemeColor(themeColorColors[color]);
}
void Style::setThemeColor(QColor color)
void Style::setThemeColor(const QColor &color)
{
if (!color.isValid())
{

View File

@ -65,7 +65,7 @@ public:
static QString resolve(QString qss);
static void repolish(QWidget* w);
static void setThemeColor(int color);
static void setThemeColor(QColor color); ///< Pass an invalid QColor to reset to defaults
static void setThemeColor(const QColor &color); ///< Pass an invalid QColor to reset to defaults
static void applyTheme(); ///< Reloads some CCS
static QPixmap scaleSvgImage(const QString& path, uint32_t width, uint32_t height);

View File

@ -685,7 +685,7 @@ void Widget::onTransferClicked()
}
}
void Widget::confirmExecutableOpen(const QFileInfo file)
void Widget::confirmExecutableOpen(const QFileInfo &file)
{
static const QStringList dangerousExtensions = { "app", "bat", "com", "cpl", "dmg", "exe", "hta", "jar", "js", "jse", "lnk", "msc", "msh", "msh1", "msh1xml", "msh2", "msh2xml", "mshxml", "msi", "msp", "pif", "ps1", "ps1xml", "ps2", "ps2xml", "psc1", "psc2", "py", "reg", "scf", "sh", "src", "vb", "vbe", "vbs", "ws", "wsc", "wsf", "wsh" };

View File

@ -85,7 +85,7 @@ public:
ContentDialog* createContentDialog() const;
ContentLayout* createContentDialog(DialogType type);
static void confirmExecutableOpen(const QFileInfo file);
static void confirmExecutableOpen(const QFileInfo &file);
void clearAllReceipts();
void reloadHistory();