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

Merge branch 'pr1616'

Improve logging

Closes #1601
This commit is contained in:
tux3 2015-05-11 15:40:48 +02:00
commit f5f73539b2
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
29 changed files with 265 additions and 259 deletions

View File

@ -51,6 +51,7 @@ DEFINES += GIT_VERSION=\"\\\"$$quote($$GIT_VERSION)\\\"\"
TIMESTAMP = $$system($1 2>null||echo 0||a;rm null;date +%s||echo 0) # I'm so sorry
DEFINES += TIMESTAMP=$$TIMESTAMP
DEFINES += LOG_TO_FILE
DEFINES += QT_MESSAGELOGCONTEXT
android {
ANDROID_TOOLCHAIN=/opt/android/toolchain-r9d-17/

View File

@ -43,13 +43,6 @@ ALCcontext* Audio::alContext{nullptr};
ALuint Audio::alMainSource{0};
float Audio::outputVolume{1.0};
void audioDebugLog(QString msg)
{
#if (AUDIO_DEBUG)
qDebug()<<"Audio: "<<msg;
#endif
}
Audio& Audio::getInstance()
{
if (!instance)
@ -82,16 +75,16 @@ void Audio::suscribeInput()
{
if (!alInDev)
{
qWarning()<<"Audio::suscribeInput: input device is closed";
qWarning()<<"input device is closed";
return;
}
audioDebugLog("suscribing");
qDebug() << "suscribing input";
QMutexLocker lock(audioInLock);
if (!userCount++ && alInDev)
{
#if (!FIX_SND_PCM_PREPARE_BUG)
audioDebugLog("starting capture");
qDebug() << "starting capture";
alcCaptureStart(alInDev);
#endif
}
@ -101,16 +94,16 @@ void Audio::unsuscribeInput()
{
if (!alInDev)
{
qWarning()<<"Audio::unsuscribeInput: input device is closed";
qWarning()<<"input device is closed";
return;
}
audioDebugLog("unsuscribing");
qDebug() << "unsuscribing input";
QMutexLocker lock(audioInLock);
if (!--userCount && alInDev)
{
#if (!FIX_SND_PCM_PREPARE_BUG)
audioDebugLog("stopping capture");
qDebug() << "stopping capture";
alcCaptureStop(alInDev);
#endif
}
@ -118,7 +111,7 @@ void Audio::unsuscribeInput()
void Audio::openInput(const QString& inDevDescr)
{
audioDebugLog("Trying to open input "+inDevDescr);
qDebug() << "Trying to open input "+inDevDescr;
QMutexLocker lock(audioInLock);
auto* tmp = alInDev;
alInDev = nullptr;
@ -135,9 +128,9 @@ void Audio::openInput(const QString& inDevDescr)
(av_DefaultSettings.audio_frame_duration * av_DefaultSettings.audio_sample_rate * 4)
/ 1000 * av_DefaultSettings.audio_channels);
if (!alInDev)
qWarning() << "Audio: Cannot open input audio device";
qWarning() << "Cannot open input audio device " + inDevDescr;
else
qDebug() << "Audio: Opening audio input "<<inDevDescr;
qDebug() << "Opening audio input "<<inDevDescr;
Core::getInstance()->resetCallSources(); // Force to regen each group call's sources
@ -157,7 +150,7 @@ void Audio::openInput(const QString& inDevDescr)
void Audio::openOutput(const QString& outDevDescr)
{
audioDebugLog("Trying to open output "+outDevDescr);
qDebug() << "Trying to open output " + outDevDescr;
QMutexLocker lock(audioOutLock);
auto* tmp = alOutDev;
alOutDev = nullptr;
@ -168,7 +161,7 @@ void Audio::openOutput(const QString& outDevDescr)
if (!alOutDev)
{
qWarning() << "Audio: Cannot open output audio device";
qWarning() << "Cannot open output audio device " + outDevDescr;
}
else
{
@ -181,7 +174,7 @@ void Audio::openOutput(const QString& outDevDescr)
alContext=alcCreateContext(alOutDev,nullptr);
if (!alcMakeContextCurrent(alContext))
{
qWarning() << "Audio: Cannot create output audio context";
qWarning() << "Cannot create output audio context";
alcCloseDevice(alOutDev);
}
else
@ -190,7 +183,7 @@ void Audio::openOutput(const QString& outDevDescr)
}
qDebug() << "Audio: Opening audio output "<<outDevDescr;
qDebug() << "Opening audio output " + outDevDescr;
}
Core::getInstance()->resetCallSources(); // Force to regen each group call's sources
@ -198,7 +191,7 @@ void Audio::openOutput(const QString& outDevDescr)
void Audio::closeInput()
{
audioDebugLog("Closing input");
qDebug() << "Closing input";
QMutexLocker lock(audioInLock);
if (alInDev)
{
@ -209,14 +202,14 @@ void Audio::closeInput()
}
else
{
qWarning() << "Audio: Failed to close input";
qWarning() << "Failed to close input";
}
}
}
void Audio::closeOutput()
{
audioDebugLog("Closing output");
qDebug() << "Closing output";
QMutexLocker lock(audioOutLock);
if (alContext && alcMakeContextCurrent(nullptr) == ALC_TRUE)
alcDestroyContext(alContext);
@ -226,7 +219,7 @@ void Audio::closeOutput()
if (alcCloseDevice(alOutDev) == ALC_TRUE)
alOutDev = nullptr;
else
qWarning() << "Audio: Failed to close output";
qWarning() << "Failed to close output";
}
}
@ -299,7 +292,7 @@ void Audio::playAudioBuffer(ALuint alSource, const int16_t *data, int samples, u
}
else
{
qDebug() << "Audio: Dropped frame";
qDebug() << "Dropped frame";
return;
}

View File

@ -101,7 +101,7 @@ AutoUpdater::VersionInfo AutoUpdater::getUpdateVersion()
if (reply->error() != QNetworkReply::NoError)
{
qWarning() << "AutoUpdater: getUpdateVersion: network error: "<<reply->errorString();
qWarning() << "getUpdateVersion: network error: " + reply->errorString();
reply->deleteLater();
manager->deleteLater();
return versionInfo;
@ -116,7 +116,7 @@ AutoUpdater::VersionInfo AutoUpdater::getUpdateVersion()
// Check updater protocol version
if ((int)data[0] != '2')
{
qWarning() << "AutoUpdater: getUpdateVersion: Bad version "<<(uint8_t)data[0];
qWarning() << "getUpdateVersion: Bad version " << (uint8_t)data[0];
return versionInfo;
}
@ -128,7 +128,7 @@ AutoUpdater::VersionInfo AutoUpdater::getUpdateVersion()
if (crypto_sign_verify_detached(sig, msg, msgData.size(), key) != 0)
{
qCritical() << "AutoUpdater: getUpdateVersion: RECEIVED FORGED VERSION FILE FROM "<<updateServer;
qCritical() << "getUpdateVersion: RECEIVED FORGED VERSION FILE FROM "<<updateServer;
return versionInfo;
}
@ -147,14 +147,14 @@ QList<AutoUpdater::UpdateFileMeta> AutoUpdater::parseFlist(QByteArray flistData)
if (flistData.isEmpty())
{
qWarning() << "AutoUpdater::parseflist: Empty data";
qWarning() << "parseflist: Empty data";
return flist;
}
// Check version
if (flistData[0] != '1')
{
qWarning() << "AutoUpdater: parseflist: Bad version "<<(uint8_t)flistData[0];
qWarning() << "parseflist: Bad version "<<(uint8_t)flistData[0];
return flist;
}
flistData = flistData.mid(1);
@ -162,7 +162,7 @@ QList<AutoUpdater::UpdateFileMeta> AutoUpdater::parseFlist(QByteArray flistData)
// Check signature
if (flistData.size() < (int)(crypto_sign_BYTES))
{
qWarning() << "AutoUpdater::parseflist: Truncated data";
qWarning() << "parseflist: Truncated data";
return flist;
}
else
@ -171,7 +171,7 @@ QList<AutoUpdater::UpdateFileMeta> AutoUpdater::parseFlist(QByteArray flistData)
unsigned char* msg = (unsigned char*)msgData.data();
if (crypto_sign_verify_detached((unsigned char*)flistData.data(), msg, msgData.size(), key) != 0)
{
qCritical() << "AutoUpdater: parseflist: FORGED FLIST FILE";
qCritical() << "parseflist: FORGED FLIST FILE";
return flist;
}
flistData = flistData.mid(crypto_sign_BYTES);
@ -211,7 +211,7 @@ QByteArray AutoUpdater::getUpdateFlist()
if (reply->error() != QNetworkReply::NoError)
{
qWarning() << "AutoUpdater: getUpdateFlist: network error: "<<reply->errorString();
qWarning() << "getUpdateFlist: network error: " + reply->errorString();
reply->deleteLater();
manager->deleteLater();
return flist;
@ -231,7 +231,7 @@ QByteArray AutoUpdater::getLocalFlist()
QFile flistFile("flist");
if (!flistFile.open(QIODevice::ReadOnly))
{
qWarning() << "AutoUpdater::getLocalFlist: Can't open local flist";
qWarning() << "getLocalFlist: Can't open local flist";
return flist;
}
@ -269,7 +269,7 @@ AutoUpdater::UpdateFile AutoUpdater::getUpdateFile(UpdateFileMeta fileMeta)
if (reply->error() != QNetworkReply::NoError)
{
qWarning() << "AutoUpdater: getUpdateFile: network error: "<<reply->errorString();
qWarning() << "getUpdateFile: network error: " + reply->errorString();
reply->deleteLater();
manager->deleteLater();
return file;
@ -304,7 +304,7 @@ bool AutoUpdater::downloadUpdate()
return false;
}
qDebug() << "AutoUpdater: Need to update "<<diff.size()<<" files";
qDebug() << "Need to update " << diff.size() << " files";
// Create an empty directory to download updates into
QString updateDirStr = Settings::getInstance().getSettingsDirPath() + "/update/";
@ -314,7 +314,7 @@ bool AutoUpdater::downloadUpdate()
updateDir = QDir(updateDirStr);
if (!updateDir.exists())
{
qWarning() << "AutoUpdater::downloadUpdate: Can't create update directory, aborting...";
qWarning() << "downloadUpdate: Can't create update directory, aborting...";
isDownloadingUpdate = false;
return false;
}
@ -323,7 +323,7 @@ bool AutoUpdater::downloadUpdate()
QFile newFlistFile(updateDirStr+"flist");
if (!newFlistFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
{
qWarning() << "AutoUpdater::downloadUpdate: Can't save new flist file, aborting...";
qWarning() << "downloadUpdate: Can't save new flist file, aborting...";
isDownloadingUpdate = false;
return false;
}
@ -343,12 +343,12 @@ bool AutoUpdater::downloadUpdate()
QFile fileFile(updateDirStr+fileMeta.installpath);
if (fileFile.open(QIODevice::ReadOnly) && fileFile.size() == (qint64)fileMeta.size)
{
qDebug() << "AutoUpdater: Skipping already downloaded file '"+fileMeta.installpath+"'";
qDebug() << "Skipping already downloaded file '" + fileMeta.installpath+ "'";
fileFile.close();
continue;
}
qDebug() << "AutoUpdater: Downloading '"+fileMeta.installpath+"' ...";
qDebug() << "Downloading '" + fileMeta.installpath + "' ...";
// Create subdirs if necessary
QString fileDirStr{QFileInfo(updateDirStr+fileMeta.installpath).absolutePath()};
@ -364,7 +364,7 @@ bool AutoUpdater::downloadUpdate()
}
if (file.data.isNull())
{
qWarning() << "AutoUpdater::downloadUpdate: Error downloading a file, aborting...";
qCritical() << "downloadUpdate: Error downloading a file, aborting...";
isDownloadingUpdate = false;
return false;
}
@ -373,7 +373,7 @@ bool AutoUpdater::downloadUpdate()
if (crypto_sign_verify_detached(file.metadata.sig, (unsigned char*)file.data.data(),
file.data.size(), key) != 0)
{
qCritical() << "AutoUpdater: downloadUpdate: RECEIVED FORGED FILE, aborting...";
qCritical() << "downloadUpdate: RECEIVED FORGED FILE, aborting...";
isDownloadingUpdate = false;
return false;
}
@ -381,7 +381,7 @@ bool AutoUpdater::downloadUpdate()
// Save
if (!fileFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
{
qWarning() << "AutoUpdater::downloadUpdate: Can't save new update file, aborting...";
qCritical() << "downloadUpdate: Can't save new update file, aborting...";
isDownloadingUpdate = false;
return false;
}
@ -389,7 +389,7 @@ bool AutoUpdater::downloadUpdate()
fileFile.close();
}
qDebug() << "AutoUpdater::downloadUpdate: The update is ready, it'll be installed on the next restart";
qDebug() << "downloadUpdate: The update is ready, it'll be installed on the next restart";
isDownloadingUpdate = false;
return true;
@ -436,14 +436,14 @@ bool AutoUpdater::isLocalUpdateReady()
void AutoUpdater::installLocalUpdate()
{
qDebug() << "AutoUpdater: About to start the qTox updater to install a local update";
qDebug() << "About to start the qTox updater to install a local update";
// Delete the update if we fail so we don't fail again.
// Updates only for supported platforms.
if (platform.isEmpty())
{
qCritical() << "AutoUpdater: Failed to start the qTox updater, removing the update and exiting";
qCritical() << "Failed to start the qTox updater, removing the update and exiting";
QString updateDirStr = Settings::getInstance().getSettingsDirPath() + "/update/";
QDir(updateDirStr).removeRecursively();
exit(-1);
@ -471,7 +471,7 @@ void AutoUpdater::installLocalUpdate()
// Centralized error handling
fail:
qCritical() << "AutoUpdater: Failed to start the qTox updater, removing the update and exiting";
qCritical() << "Failed to start the qTox updater, removing the update and exiting";
QString updateDirStr = Settings::getInstance().getSettingsDirPath() + "/update/";
QDir(updateDirStr).removeRecursively();
exit(-1);

View File

@ -28,7 +28,7 @@ void AvatarBroadcaster::sendAvatarTo(uint32_t friendId)
return;
if (!Core::getInstance()->isFriendOnline(friendId))
return;
qDebug() << "AvatarBroadcaster: Sending avatar to "<<friendId;
qDebug() << "Sending avatar to " << friendId;
Core::getInstance()->sendAvatarFile(friendId, avatarData);
friendsSentTo[friendId] = true;
}

View File

@ -121,7 +121,7 @@ void FileTransferWidget::autoAcceptTransfer(const QString &path)
if (Nexus::tryRemoveFile(filepath))
Core::getInstance()->acceptFileRecvRequest(fileInfo.friendId, fileInfo.fileNum, filepath);
else
qWarning() << "Warning: Cannot write to " << filepath;
qWarning() << "Cannot write to " << filepath;
}
void FileTransferWidget::acceptTransfer(const QString &filepath)

View File

@ -55,7 +55,7 @@ QThread* Core::coreThread{nullptr};
Core::Core(Camera* cam, QThread *CoreThread, QString loadPath) :
tox(nullptr), toxav(nullptr), camera(cam), loadPath(loadPath), ready{false}
{
qDebug() << "Core: loading Tox from" << loadPath;
qDebug() << "loading Tox from" << loadPath;
coreThread = CoreThread;
@ -160,11 +160,11 @@ void Core::make_tox(QByteArray savedata)
if (proxyAddr.length() > 255)
{
qWarning() << "Core: proxy address" << proxyAddr << "is too long";
qWarning() << "proxy address" << proxyAddr << "is too long";
}
else if (proxyAddr != "" && proxyPort > 0)
{
qDebug() << "Core: using proxy" << proxyAddr << ":" << proxyPort;
qDebug() << "using proxy" << proxyAddr << ":" << proxyPort;
// protection against changings in TOX_PROXY_TYPE enum
if (proxyType == ProxyType::ptSOCKS5)
toxOptions.proxy_type = TOX_PROXY_TYPE_SOCKS5;
@ -191,7 +191,7 @@ void Core::make_tox(QByteArray savedata)
{
if (toxOptions.proxy_type != TOX_PROXY_TYPE_NONE)
{
qCritical() << "Core: bad proxy! no toxcore!";
qCritical() << "bad proxy! no toxcore!";
emit badProxy();
}
else
@ -230,7 +230,7 @@ void Core::make_tox(QByteArray savedata)
void Core::start()
{
qDebug() << "Core: Starting up";
qDebug() << "Starting up";
QByteArray savedata = loadToxSave(loadPath);
@ -310,7 +310,7 @@ void Core::start()
}
else
{
qDebug() << "Core: Error loading self avatar";
qDebug() << "Error loading self avatar";
}
ready = true;
@ -374,15 +374,15 @@ bool Core::checkConnection()
if (toxConnected && !isConnected)
{
qDebug() << "Core: Connected to DHT";
qDebug() << "Connected to DHT";
emit connected();
isConnected = true;
//if (count) qDebug() << "Core: disconnect count:" << count;
//if (count) qDebug() << "disconnect count:" << count;
//count = 0;
}
else if (!toxConnected && isConnected)
{
qDebug() << "Core: Disconnected to DHT";
qDebug() << "Disconnected to DHT";
emit disconnected();
isConnected = false;
//count++;
@ -398,12 +398,12 @@ void Core::bootstrapDht()
int listSize = dhtServerList.size();
if (listSize == 0)
{
qDebug() << "Settings: no bootstrap list?!?";
qDebug() << "no bootstrap list?!?";
return;
}
static int j = qrand() % listSize;
qDebug() << "Core: Bootstrapping to the DHT ...";
qDebug() << "Bootstrapping to the DHT ...";
int i=0;
while (i < 2) // i think the more we bootstrap, the more we jitter because the more we overwrite nodes
@ -412,12 +412,13 @@ void Core::bootstrapDht()
if (tox_bootstrap(tox, dhtServer.address.toLatin1().data(),
dhtServer.port, CUserId(dhtServer.userId).data(), nullptr) == 1)
{
qDebug() << QString("Core: Bootstrapping from ")+dhtServer.name+QString(", addr ")+dhtServer.address.toLatin1().data()
+QString(", port ")+QString().setNum(dhtServer.port);
qDebug() << "Bootstrapping from " + dhtServer.name
+ ", addr " + dhtServer.address.toLatin1().data()
+ ", port " + QString().setNum(dhtServer.port);
}
else
{
qDebug() << "Core: Error bootstrapping from "+dhtServer.name;
qDebug() << "Error bootstrapping from "+dhtServer.name;
}
j++;
@ -498,17 +499,17 @@ void Core::onGroupInvite(Tox*, int32_t friendNumber, uint8_t type, const uint8_t
QByteArray pk((char*)data, length);
if (type == TOX_GROUPCHAT_TYPE_TEXT)
{
qDebug() << QString("Core: Text group invite by %1").arg(friendNumber);
qDebug() << QString("Text group invite by %1").arg(friendNumber);
emit static_cast<Core*>(core)->groupInviteReceived(friendNumber,type,pk);
}
else if (type == TOX_GROUPCHAT_TYPE_AV)
{
qDebug() << QString("Core: AV group invite by %1").arg(friendNumber);
qDebug() << QString("AV group invite by %1").arg(friendNumber);
emit static_cast<Core*>(core)->groupInviteReceived(friendNumber,type,pk);
}
else
{
qWarning() << "Core: Group invite with unknown type "<<type;
qWarning() << "Group invite with unknown type "<<type;
}
}
@ -520,13 +521,13 @@ void Core::onGroupMessage(Tox*, int groupnumber, int peernumber, const uint8_t *
void Core::onGroupNamelistChange(Tox*, int groupnumber, int peernumber, uint8_t change, void *core)
{
qDebug() << QString("Core: Group namelist change %1:%2 %3").arg(groupnumber).arg(peernumber).arg(change);
qDebug() << QString("Group namelist change %1:%2 %3").arg(groupnumber).arg(peernumber).arg(change);
emit static_cast<Core*>(core)->groupNamelistChanged(groupnumber, peernumber, change);
}
void Core::onGroupTitleChange(Tox*, int groupnumber, int peernumber, const uint8_t* title, uint8_t len, void* _core)
{
qDebug() << "Core: group" << groupnumber << "title changed by" << peernumber;
qDebug() << "group" << groupnumber << "title changed by" << peernumber;
Core* core = static_cast<Core*>(_core);
QString author;
if (peernumber >= 0)
@ -572,7 +573,7 @@ void Core::requestFriendship(const QString& friendAddress, const QString& messag
}
else
{
qDebug() << "Core: requesting friendship of "+friendAddress;
qDebug() << "requesting friendship of "+friendAddress;
CString cMessage(message);
uint32_t friendId = tox_friend_add(tox, CFriendAddress(friendAddress).data(),
@ -877,7 +878,7 @@ QByteArray Core::loadToxSave(QString path)
}
QFile configurationFile(path);
qDebug() << "Core::loadConfiguration: reading from " << path;
qDebug() << "loadConfiguration: reading from " << path;
if (!configurationFile.exists())
{
@ -972,9 +973,9 @@ void Core::switchConfiguration(const QString& _profile)
}
if (profile.isEmpty())
qDebug() << "Core: creating new Id";
qDebug() << "creating new Id";
else
qDebug() << "Core: switching from" << Settings::getInstance().getCurrentProfile() << "to" << profile;
qDebug() << "switching from" << Settings::getInstance().getCurrentProfile() << "to" << profile;
saveConfiguration();
saveCurrentInformation(); // part of a hack, see core.h
@ -1070,7 +1071,7 @@ QString Core::getGroupPeerName(int groupId, int peerId) const
int length = tox_group_peername(tox, groupId, peerId, nameArray);
if (length == -1)
{
qWarning() << "Core::getGroupPeerName: Unknown error";
qWarning() << "getGroupPeerName: Unknown error";
return name;
}
name = CString::toString(nameArray, length);
@ -1085,7 +1086,7 @@ ToxID Core::getGroupPeerToxID(int groupId, int peerId) const
int res = tox_group_peer_pubkey(tox, groupId, peerId, rawID);
if (res == -1)
{
qWarning() << "Core::getGroupPeerToxID: Unknown error";
qWarning() << "getGroupPeerToxID: Unknown error";
return peerToxID;
}
@ -1099,7 +1100,7 @@ QList<QString> Core::getGroupPeerNames(int groupId) const
int nPeers = getGroupNumberPeers(groupId);
if (nPeers == -1)
{
qWarning() << "Core::getGroupPeerNames: Unable to get number of peers";
qWarning() << "getGroupPeerNames: Unable to get number of peers";
return names;
}
uint8_t namesArray[nPeers][TOX_MAX_NAME_LENGTH];
@ -1107,7 +1108,7 @@ QList<QString> Core::getGroupPeerNames(int groupId) const
int result = tox_group_get_names(tox, groupId, namesArray, lengths, nPeers);
if (result != nPeers)
{
qWarning() << "Core::getGroupPeerNames: Unexpected result";
qWarning() << "getGroupPeerNames: Unexpected result";
return names;
}
for (int i=0; i<nPeers; i++)
@ -1131,7 +1132,7 @@ int Core::joinGroupchat(int32_t friendnumber, uint8_t type, const uint8_t* frien
}
else
{
qWarning() << "Core::joinGroupchat: Unknown groupchat type "<<type;
qWarning() << "joinGroupchat: Unknown groupchat type "<<type;
return -1;
}
}
@ -1158,7 +1159,7 @@ void Core::createGroup(uint8_t type)
}
else
{
qWarning() << "Core::createGroup: Unknown type "<<type;
qWarning() << "createGroup: Unknown type "<<type;
}
}
@ -1221,7 +1222,7 @@ QString Core::getFriendAddress(uint32_t friendNumber) const
uint8_t rawid[TOX_PUBLIC_KEY_SIZE];
if (!tox_friend_get_public_key(tox, friendNumber, rawid, nullptr))
{
qWarning() << "Core::getFriendAddress: Getting public key failed";
qWarning() << "getFriendAddress: Getting public key failed";
return QString();
}
QByteArray data((char*)rawid,TOX_PUBLIC_KEY_SIZE);
@ -1239,7 +1240,7 @@ QString Core::getFriendUsername(uint32_t friendnumber) const
size_t namesize = tox_friend_get_name_size(tox, friendnumber, nullptr);
if (namesize == SIZE_MAX)
{
qWarning() << "Core::getFriendUsername: Failed to get name size for friend "<<friendnumber;
qWarning() << "getFriendUsername: Failed to get name size for friend "<<friendnumber;
return QString();
}
uint8_t* name = new uint8_t[namesize];
@ -1286,21 +1287,21 @@ QString Core::getPeerName(const ToxID& id) const
uint32_t friendId = tox_friend_by_public_key(tox, (uint8_t*)cid.data(), nullptr);
if (friendId == std::numeric_limits<uint32_t>::max())
{
qWarning() << "Core::getPeerName: No such peer "+id.toString();
qWarning() << "getPeerName: No such peer "+id.toString();
return name;
}
const size_t nameSize = tox_friend_get_name_size(tox, friendId, nullptr);
if (nameSize == SIZE_MAX)
{
//qDebug() << "Core::getPeerName: Can't get name of friend "+QString().setNum(friendId)+" ("+id.toString()+")";
//qDebug() << "getPeerName: Can't get name of friend "+QString().setNum(friendId)+" ("+id.toString()+")";
return name;
}
uint8_t* cname = new uint8_t[nameSize<TOX_MAX_NAME_LENGTH ? TOX_MAX_NAME_LENGTH : nameSize];
if (tox_friend_get_name(tox, friendId, cname, nullptr) == false)
{
qWarning() << "Core::getPeerName: Can't get name of friend "+QString().setNum(friendId)+" ("+id.toString()+")";
qWarning() << "getPeerName: Can't get name of friend "+QString().setNum(friendId)+" ("+id.toString()+")";
delete[] cname;
return name;
}

View File

@ -43,7 +43,7 @@ bool Core::anyActiveCalls()
void Core::prepareCall(uint32_t friendId, int32_t callId, ToxAv* toxav, bool videoEnabled)
{
qDebug() << QString("Core: preparing call %1").arg(callId);
qDebug() << QString("preparing call %1").arg(callId);
if (!videobuf)
videobuf = new uint8_t[videobufsize];
@ -105,7 +105,7 @@ void Core::onAvMediaChange(void* toxav, int32_t callId, void* core)
if (friendId < 0)
goto fail;
qDebug() << "Core: Received media change from friend "<<friendId;
qDebug() << "Received media change from friend "<<friendId;
if (cap == (av_VideoEncoding|av_VideoDecoding)) // Video call
{
@ -125,7 +125,7 @@ void Core::onAvMediaChange(void* toxav, int32_t callId, void* core)
return;
fail: // Centralized error handling
qWarning() << "Core: Toxcore error while receiving media change on call "<<callId;
qWarning() << "Toxcore error while receiving media change on call "<<callId;
return;
}
@ -134,7 +134,7 @@ void Core::answerCall(int32_t callId)
int friendId = toxav_get_peer_id(toxav, callId, 0);
if (friendId < 0)
{
qWarning() << "Core: Received invalid AV answer peer ID";
qWarning() << "Received invalid AV answer peer ID";
return;
}
@ -142,19 +142,19 @@ void Core::answerCall(int32_t callId)
int err = toxav_get_peer_csettings(toxav, callId, 0, transSettings);
if (err != av_ErrorNone)
{
qWarning() << "Core::answerCall: error getting call settings";
qWarning() << "answerCall: error getting call settings";
delete transSettings;
return;
}
if (transSettings->call_type == av_TypeVideo)
{
qDebug() << QString("Core: answering call %1 with video").arg(callId);
qDebug() << QString("answering call %1 with video").arg(callId);
toxav_answer(toxav, callId, transSettings);
}
else
{
qDebug() << QString("Core: answering call %1 without video").arg(callId);
qDebug() << QString("answering call %1 without video").arg(callId);
toxav_answer(toxav, callId, transSettings);
}
@ -163,14 +163,14 @@ void Core::answerCall(int32_t callId)
void Core::hangupCall(int32_t callId)
{
qDebug() << QString("Core: hanging up call %1").arg(callId);
qDebug() << QString("hanging up call %1").arg(callId);
calls[callId].active = false;
toxav_hangup(toxav, callId);
}
void Core::rejectCall(int32_t callId)
{
qDebug() << QString("Core: rejecting call %1").arg(callId);
qDebug() << QString("rejecting call %1").arg(callId);
calls[callId].active = false;
toxav_reject(toxav, callId, nullptr);
}
@ -183,7 +183,7 @@ void Core::startCall(uint32_t friendId, bool video)
cSettings.max_video_height = TOXAV_MAX_VIDEO_HEIGHT;
if (video)
{
qDebug() << QString("Core: Starting new call with %1 with video").arg(friendId);
qDebug() << QString("Starting new call with %1 with video").arg(friendId);
cSettings.call_type = av_TypeVideo;
if (toxav_call(toxav, &callId, friendId, &cSettings, TOXAV_RINGING_TIME) == 0)
{
@ -191,14 +191,14 @@ void Core::startCall(uint32_t friendId, bool video)
}
else
{
qWarning() << QString("Core: Failed to start new video call with %1").arg(friendId);
qWarning() << QString("Failed to start new video call with %1").arg(friendId);
emit avCallFailed(friendId);
return;
}
}
else
{
qDebug() << QString("Core: Starting new call with %1 without video").arg(friendId);
qDebug() << QString("Starting new call with %1 without video").arg(friendId);
cSettings.call_type = av_TypeAudio;
if (toxav_call(toxav, &callId, friendId, &cSettings, TOXAV_RINGING_TIME) == 0)
{
@ -206,7 +206,7 @@ void Core::startCall(uint32_t friendId, bool video)
}
else
{
qWarning() << QString("Core: Failed to start new audio call with %1").arg(friendId);
qWarning() << QString("Failed to start new audio call with %1").arg(friendId);
emit avCallFailed(friendId);
return;
}
@ -215,14 +215,14 @@ void Core::startCall(uint32_t friendId, bool video)
void Core::cancelCall(int32_t callId, uint32_t friendId)
{
qDebug() << QString("Core: Cancelling call with %1").arg(friendId);
qDebug() << QString("Cancelling call with %1").arg(friendId);
calls[callId].active = false;
toxav_cancel(toxav, callId, friendId, nullptr);
}
void Core::cleanupCall(int32_t callId)
{
qDebug() << QString("Core: cleaning up call %1").arg(callId);
qDebug() << QString("cleaning up call %1").arg(callId);
calls[callId].active = false;
disconnect(calls[callId].sendAudioTimer,0,0,0);
calls[callId].sendAudioTimer->stop();
@ -296,13 +296,13 @@ void Core::sendCallAudio(int32_t callId, ToxAv* toxav)
int r;
if ((r = toxav_prepare_audio_frame(toxav, callId, dest, framesize*2, (int16_t*)buf, framesize)) < 0)
{
qDebug() << "Core: toxav_prepare_audio_frame error";
qDebug() << "toxav_prepare_audio_frame error";
calls[callId].sendAudioTimer->start();
return;
}
if ((r = toxav_send_audio(toxav, callId, dest, r)) < 0)
qDebug() << "Core: toxav_send_audio error";
qDebug() << "toxav_send_audio error";
}
calls[callId].sendAudioTimer->start();
}
@ -328,20 +328,20 @@ void Core::sendCallVideo(int32_t callId)
int result;
if ((result = toxav_prepare_video_frame(toxav, callId, videobuf, videobufsize, &frame)) < 0)
{
qDebug() << QString("Core: toxav_prepare_video_frame: error %1").arg(result);
qDebug() << QString("toxav_prepare_video_frame: error %1").arg(result);
vpx_img_free(&frame);
calls[callId].sendVideoTimer->start();
return;
}
if ((result = toxav_send_video(toxav, callId, (uint8_t*)videobuf, result)) < 0)
qDebug() << QString("Core: toxav_send_video error: %1").arg(result);
qDebug() << QString("toxav_send_video error: %1").arg(result);
vpx_img_free(&frame);
}
else
{
qDebug("Core::sendCallVideo: Invalid frame (bad camera ?)");
qDebug("sendCallVideo: Invalid frame (bad camera ?)");
}
calls[callId].sendVideoTimer->start();
@ -369,10 +369,10 @@ void Core::onAvCancel(void* _toxav, int32_t callId, void* core)
int friendId = toxav_get_peer_id(toxav, callId, 0);
if (friendId < 0)
{
qWarning() << "Core: Received invalid AV cancel";
qWarning() << "Received invalid AV cancel";
return;
}
qDebug() << QString("Core: AV cancel from %1").arg(friendId);
qDebug() << QString("AV cancel from %1").arg(friendId);
calls[callId].active = false;
@ -394,11 +394,11 @@ void Core::onAvReject(void* _toxav, int32_t callId, void* core)
int friendId = toxav_get_peer_id(toxav, callId, 0);
if (friendId < 0)
{
qWarning() << "Core: Received invalid AV reject";
qWarning() << "Received invalid AV reject";
return;
}
qDebug() << QString("Core: AV reject from %1").arg(friendId);
qDebug() << QString("AV reject from %1").arg(friendId);
emit static_cast<Core*>(core)->avRejected(friendId, callId);
}
@ -410,10 +410,10 @@ void Core::onAvEnd(void* _toxav, int32_t call_index, void* core)
int friendId = toxav_get_peer_id(toxav, call_index, 0);
if (friendId < 0)
{
qWarning() << "Core: Received invalid AV end";
qWarning() << "Received invalid AV end";
return;
}
qDebug() << QString("Core: AV end from %1").arg(friendId);
qDebug() << QString("AV end from %1").arg(friendId);
cleanupCall(call_index);
@ -427,18 +427,18 @@ void Core::onAvRinging(void* _toxav, int32_t call_index, void* core)
int friendId = toxav_get_peer_id(toxav, call_index, 0);
if (friendId < 0)
{
qWarning() << "Core: Received invalid AV ringing";
qWarning() << "Received invalid AV ringing";
return;
}
if (calls[call_index].videoEnabled)
{
qDebug() << QString("Core: AV ringing with %1 with video").arg(friendId);
qDebug() << QString("AV ringing with %1 with video").arg(friendId);
emit static_cast<Core*>(core)->avRinging(friendId, call_index, true);
}
else
{
qDebug() << QString("Core: AV ringing with %1 without video").arg(friendId);
qDebug() << QString("AV ringing with %1 without video").arg(friendId);
emit static_cast<Core*>(core)->avRinging(friendId, call_index, false);
}
}
@ -450,10 +450,10 @@ void Core::onAvRequestTimeout(void* _toxav, int32_t call_index, void* core)
int friendId = toxav_get_peer_id(toxav, call_index, 0);
if (friendId < 0)
{
qWarning() << "Core: Received invalid AV request timeout";
qWarning() << "Received invalid AV request timeout";
return;
}
qDebug() << QString("Core: AV request timeout with %1").arg(friendId);
qDebug() << QString("AV request timeout with %1").arg(friendId);
cleanupCall(call_index);
@ -467,10 +467,10 @@ void Core::onAvPeerTimeout(void* _toxav, int32_t call_index, void* core)
int friendId = toxav_get_peer_id(toxav, call_index, 0);
if (friendId < 0)
{
qWarning() << "Core: Received invalid AV peer timeout";
qWarning() << "Received invalid AV peer timeout";
return;
}
qDebug() << QString("Core: AV peer timeout with %1").arg(friendId);
qDebug() << QString("AV peer timeout with %1").arg(friendId);
cleanupCall(call_index);
@ -485,7 +485,7 @@ void Core::onAvInvite(void* _toxav, int32_t call_index, void* core)
int friendId = toxav_get_peer_id(toxav, call_index, 0);
if (friendId < 0)
{
qWarning() << "Core: Received invalid AV invite";
qWarning() << "Received invalid AV invite";
return;
}
@ -493,19 +493,19 @@ void Core::onAvInvite(void* _toxav, int32_t call_index, void* core)
int err = toxav_get_peer_csettings(toxav, call_index, 0, transSettings);
if (err != av_ErrorNone)
{
qWarning() << "Core::onAvInvite: error getting call type";
qWarning() << "onAvInvite: error getting call type";
delete transSettings;
return;
}
if (transSettings->call_type == av_TypeVideo)
{
qDebug() << QString("Core: AV invite from %1 with video").arg(friendId);
qDebug() << QString("AV invite from %1 with video").arg(friendId);
emit static_cast<Core*>(core)->avInvite(friendId, call_index, true);
}
else
{
qDebug() << QString("Core: AV invite from %1 without video").arg(friendId);
qDebug() << QString("AV invite from %1 without video").arg(friendId);
emit static_cast<Core*>(core)->avInvite(friendId, call_index, false);
}
@ -519,7 +519,7 @@ void Core::onAvStart(void* _toxav, int32_t call_index, void* core)
int friendId = toxav_get_peer_id(toxav, call_index, 0);
if (friendId < 0)
{
qWarning() << "Core: Received invalid AV start";
qWarning() << "Received invalid AV start";
return;
}
@ -527,20 +527,20 @@ void Core::onAvStart(void* _toxav, int32_t call_index, void* core)
int err = toxav_get_peer_csettings(toxav, call_index, 0, transSettings);
if (err != av_ErrorNone)
{
qWarning() << "Core::onAvStart: error getting call type";
qWarning() << "onAvStart: error getting call type";
delete transSettings;
return;
}
if (transSettings->call_type == av_TypeVideo)
{
qDebug() << QString("Core: AV start from %1 with video").arg(friendId);
qDebug() << QString("AV start from %1 with video").arg(friendId);
prepareCall(friendId, call_index, toxav, true);
emit static_cast<Core*>(core)->avStart(friendId, call_index, true);
}
else
{
qDebug() << QString("Core: AV start from %1 without video").arg(friendId);
qDebug() << QString("AV start from %1 without video").arg(friendId);
prepareCall(friendId, call_index, toxav, false);
emit static_cast<Core*>(core)->avStart(friendId, call_index, false);
}
@ -553,7 +553,7 @@ void Core::playAudioBuffer(ALuint alSource, const int16_t *data, int samples, un
{
if (!channels || channels > 2)
{
qWarning() << "Core::playAudioBuffer: trying to play on "<<channels<<" channels! Giving up.";
qWarning() << "playAudioBuffer: trying to play on "<<channels<<" channels! Giving up.";
return;
}
@ -576,7 +576,7 @@ void Core::playAudioBuffer(ALuint alSource, const int16_t *data, int samples, un
}
else
{
qDebug() << "Core: Dropped audio frame";
qDebug() << "Dropped audio frame";
return;
}
@ -590,7 +590,7 @@ void Core::playAudioBuffer(ALuint alSource, const int16_t *data, int samples, un
if (state != AL_PLAYING)
{
alSourcePlay(alSource);
//qDebug() << "Core: Starting audio source " << (int)alSource;
//qDebug() << "Starting audio source " << (int)alSource;
}
}
@ -601,7 +601,7 @@ VideoSource *Core::getVideoSourceFromCall(int callNumber)
void Core::joinGroupCall(int groupId)
{
qDebug() << QString("Core: Joining group call %1").arg(groupId);
qDebug() << QString("Joining group call %1").arg(groupId);
groupCalls[groupId].groupId = groupId;
groupCalls[groupId].muteMic = false;
groupCalls[groupId].muteVol = false;
@ -628,7 +628,7 @@ void Core::joinGroupCall(int groupId)
void Core::leaveGroupCall(int groupId)
{
qDebug() << QString("Core: Leaving group call %1").arg(groupId);
qDebug() << QString("Leaving group call %1").arg(groupId);
groupCalls[groupId].active = false;
disconnect(groupCalls[groupId].sendAudioTimer,0,0,0);
groupCalls[groupId].sendAudioTimer->stop();
@ -657,7 +657,7 @@ void Core::sendGroupCallAudio(int groupId, ToxAv* toxav)
if (toxav_group_send_audio(toxav_get_tox(toxav), groupId, (int16_t*)buf,
framesize, av_DefaultSettings.audio_channels, av_DefaultSettings.audio_sample_rate) < 0)
{
qDebug() << "Core: toxav_group_send_audio error";
qDebug() << "toxav_group_send_audio error";
groupCalls[groupId].sendAudioTimer->start();
return;
}

View File

@ -112,7 +112,7 @@ QByteArray Core::encryptData(const QByteArray& data, PasswordType passtype)
if (!tox_pass_key_encrypt(reinterpret_cast<const uint8_t*>(data.data()), data.size(),
pwsaltedkeys[passtype], encrypted, nullptr))
{
qWarning() << "Core::encryptData: encryption failed";
qWarning() << "encryptData: encryption failed";
return QByteArray();
}
return QByteArray(reinterpret_cast<char*>(encrypted), data.size() + TOX_PASS_ENCRYPTION_EXTRA_LENGTH);
@ -128,7 +128,7 @@ QByteArray Core::decryptData(const QByteArray& data, PasswordType passtype)
if (!tox_pass_key_decrypt(reinterpret_cast<const uint8_t*>(data.data()), data.size(),
pwsaltedkeys[passtype], decrypted, nullptr))
{
qWarning() << "Core::decryptData: decryption failed";
qWarning() << "decryptData: decryption failed";
return QByteArray();
}
return QByteArray(reinterpret_cast<char*>(decrypted), sz);
@ -147,7 +147,7 @@ QByteArray Core::getSaltFromFile(QString filename)
QFile file(filename);
if (!file.open(QIODevice::ReadOnly))
{
qWarning() << "Core: file" << filename << "doesn't exist";
qWarning() << "file" << filename << "doesn't exist";
return QByteArray();
}
QByteArray data = file.read(TOX_PASS_ENCRYPTION_EXTRA_LENGTH);
@ -156,7 +156,7 @@ QByteArray Core::getSaltFromFile(QString filename)
uint8_t *salt = new uint8_t[TOX_PASS_SALT_LENGTH];
if (!tox_get_salt(reinterpret_cast<uint8_t *>(data.data()), salt))
{
qWarning() << "Core: can't get salt from" << filename << "header";
qWarning() << "can't get salt from" << filename << "header";
return QByteArray();
}
@ -263,7 +263,7 @@ void Core::checkEncryptedHistory()
useOtherPassword(ptHistory);
if (!exists || HistoryKeeper::checkPassword())
{
qDebug() << "Core: using main password for chat history";
qDebug() << "using main password for chat history";
return;
}
clearPassword(ptHistory);
@ -299,7 +299,7 @@ void Core::saveConfiguration(const QString& path)
if (!isReady())
{
qWarning() << "Core::saveConfiguration: Tox not started, aborting!";
qWarning() << "saveConfiguration: Tox not started, aborting!";
return;
}
@ -310,7 +310,7 @@ void Core::saveConfiguration(const QString& path)
return;
}
qDebug() << "Core: writing tox_save to " << path;
qDebug() << "writing tox_save to " << path;
uint32_t fileSize = tox_get_savedata_size(tox);
bool encrypt = Settings::getInstance().getEncryptTox();

View File

@ -24,10 +24,10 @@ void CoreFile::sendAvatarFile(Core* core, uint32_t friendId, const QByteArray& d
nullptr, filename, TOX_HASH_LENGTH, nullptr);
if (fileNum == std::numeric_limits<uint32_t>::max())
{
qWarning() << "CoreFile::sendAvatarFile: Can't create the Tox file sender";
qWarning() << "sendAvatarFile: Can't create the Tox file sender";
return;
}
//qDebug() << QString("CoreFile::sendAvatarFile: Created file sender %1 with friend %2").arg(fileNum).arg(friendId);
//qDebug() << QString("sendAvatarFile: Created file sender %1 with friend %2").arg(fileNum).arg(friendId);
ToxFile file{fileNum, friendId, "", "", ToxFile::SENDING};
file.filesize = filesize;
@ -48,11 +48,11 @@ void CoreFile::sendFile(Core* core, uint32_t friendId, QString Filename, QString
(uint8_t*)fileName.data(), fileName.size(), nullptr);
if (fileNum == std::numeric_limits<uint32_t>::max())
{
qWarning() << "CoreFile::sendFile: Can't create the Tox file sender";
qWarning() << "sendFile: Can't create the Tox file sender";
emit core->fileSendFailed(friendId, Filename);
return;
}
qDebug() << QString("CoreFile::sendFile: Created file sender %1 with friend %2").arg(fileNum).arg(friendId);
qDebug() << QString("sendFile: Created file sender %1 with friend %2").arg(fileNum).arg(friendId);
ToxFile file{fileNum, friendId, fileName, FilePath, ToxFile::SENDING};
file.filesize = filesize;
@ -60,7 +60,7 @@ void CoreFile::sendFile(Core* core, uint32_t friendId, QString Filename, QString
tox_file_get_file_id(core->tox, friendId, fileNum, (uint8_t*)file.resumeFileId.data(), nullptr);
if (!file.open(false))
{
qWarning() << QString("CoreFile::sendFile: Can't open file, error: %1").arg(file.file->errorString());
qWarning() << QString("sendFile: Can't open file, error: %1").arg(file.file->errorString());
}
addFile(friendId, fileNum, file);
@ -72,7 +72,7 @@ void CoreFile::pauseResumeFileSend(Core* core, uint32_t friendId, uint32_t fileI
ToxFile* file = findFile(friendId, fileId);
if (!file)
{
qWarning("CoreFile::pauseResumeFileSend: No such file in queue");
qWarning("pauseResumeFileSend: No such file in queue");
return;
}
if (file->status == ToxFile::TRANSMITTING)
@ -88,7 +88,7 @@ void CoreFile::pauseResumeFileSend(Core* core, uint32_t friendId, uint32_t fileI
tox_file_control(core->tox, file->friendId, file->fileNum, TOX_FILE_CONTROL_RESUME, nullptr);
}
else
qWarning() << "CoreFile::pauseResumeFileSend: File is stopped";
qWarning() << "pauseResumeFileSend: File is stopped";
}
void CoreFile::pauseResumeFileRecv(Core* core, uint32_t friendId, uint32_t fileId)
@ -96,7 +96,7 @@ void CoreFile::pauseResumeFileRecv(Core* core, uint32_t friendId, uint32_t fileI
ToxFile* file = findFile(friendId, fileId);
if (!file)
{
qWarning("CoreFile::cancelFileRecv: No such file in queue");
qWarning("cancelFileRecv: No such file in queue");
return;
}
if (file->status == ToxFile::TRANSMITTING)
@ -112,7 +112,7 @@ void CoreFile::pauseResumeFileRecv(Core* core, uint32_t friendId, uint32_t fileI
tox_file_control(core->tox, file->friendId, file->fileNum, TOX_FILE_CONTROL_RESUME, nullptr);
}
else
qWarning() << "CoreFile::pauseResumeFileRecv: File is stopped or broken";
qWarning() << "pauseResumeFileRecv: File is stopped or broken";
}
void CoreFile::cancelFileSend(Core* core, uint32_t friendId, uint32_t fileId)
@ -120,7 +120,7 @@ void CoreFile::cancelFileSend(Core* core, uint32_t friendId, uint32_t fileId)
ToxFile* file = findFile(friendId, fileId);
if (!file)
{
qWarning("CoreFile::cancelFileSend: No such file in queue");
qWarning("cancelFileSend: No such file in queue");
return;
}
file->status = ToxFile::STOPPED;
@ -135,7 +135,7 @@ void CoreFile::cancelFileRecv(Core* core, uint32_t friendId, uint32_t fileId)
ToxFile* file = findFile(friendId, fileId);
if (!file)
{
qWarning("CoreFile::cancelFileRecv: No such file in queue");
qWarning("cancelFileRecv: No such file in queue");
return;
}
file->status = ToxFile::STOPPED;
@ -149,7 +149,7 @@ void CoreFile::rejectFileRecvRequest(Core* core, uint32_t friendId, uint32_t fil
ToxFile* file = findFile(friendId, fileId);
if (!file)
{
qWarning("CoreFile::rejectFileRecvRequest: No such file in queue");
qWarning("rejectFileRecvRequest: No such file in queue");
return;
}
file->status = ToxFile::STOPPED;
@ -163,13 +163,13 @@ void CoreFile::acceptFileRecvRequest(Core* core, uint32_t friendId, uint32_t fil
ToxFile* file = findFile(friendId, fileId);
if (!file)
{
qWarning("CoreFile::acceptFileRecvRequest: No such file in queue");
qWarning("acceptFileRecvRequest: No such file in queue");
return;
}
file->setFilePath(path);
if (!file->open(true))
{
qWarning() << "CoreFile::acceptFileRecvRequest: Unable to open file";
qWarning() << "acceptFileRecvRequest: Unable to open file";
return;
}
file->status = ToxFile::TRANSMITTING;
@ -182,7 +182,7 @@ ToxFile* CoreFile::findFile(uint32_t friendId, uint32_t fileId)
uint64_t key = ((uint64_t)friendId<<32) + (uint64_t)fileId;
if (!fileMap.contains(key))
{
qWarning() << "CoreFile::findFile: File transfer with ID "<<friendId<<':'<<fileId<<" doesn't exist";
qWarning() << "findFile: File transfer with ID "<<friendId<<':'<<fileId<<" doesn't exist";
return nullptr;
}
else
@ -193,7 +193,7 @@ void CoreFile::addFile(uint32_t friendId, uint32_t fileId, const ToxFile& file)
{
uint64_t key = ((uint64_t)friendId<<32) + (uint64_t)fileId;
if (fileMap.contains(key))
qWarning() << "CoreFile::addFile: Overwriting existing file transfer with same ID "<<friendId<<':'<<fileId;
qWarning() << "addFile: Overwriting existing file transfer with same ID "<<friendId<<':'<<fileId;
fileMap.insert(key, file);
}
@ -202,7 +202,7 @@ void CoreFile::removeFile(uint32_t friendId, uint32_t fileId)
uint64_t key = ((uint64_t)friendId<<32) + (uint64_t)fileId;
if (!fileMap.contains(key))
{
qWarning() << "CoreFile::removeFile: No such file in queue";
qWarning() << "removeFile: No such file in queue";
return;
}
fileMap[key].file->close();
@ -213,7 +213,7 @@ void CoreFile::onFileReceiveCallback(Tox*, uint32_t friendId, uint32_t fileId, u
uint64_t filesize, const uint8_t *fname, size_t fnameLen, void *_core)
{
Core* core = static_cast<Core*>(_core);
qDebug() << QString("CoreFile: Received file request %1:%2 kind %3")
qDebug() << QString("Received file request %1:%2 kind %3")
.arg(friendId).arg(fileId).arg(kind);
if (kind == TOX_FILE_KIND_AVATAR)
@ -256,25 +256,25 @@ void CoreFile::onFileControlCallback(Tox*, uint32_t friendId, uint32_t fileId,
ToxFile* file = findFile(friendId, fileId);
if (!file)
{
qWarning("CoreFile::onFileControlCallback: No such file in queue");
qWarning("onFileControlCallback: No such file in queue");
return;
}
if (control == TOX_FILE_CONTROL_CANCEL)
{
qDebug() << "CoreFile::onFileControlCallback: Received cancel for file "<<friendId<<":"<<fileId;
qDebug() << "onFileControlCallback: Received cancel for file "<<friendId<<":"<<fileId;
emit static_cast<Core*>(core)->fileTransferCancelled(*file);
removeFile(friendId, fileId);
}
else if (control == TOX_FILE_CONTROL_PAUSE)
{
qDebug() << "CoreFile::onFileControlCallback: Received pause for file "<<friendId<<":"<<fileId;
qDebug() << "onFileControlCallback: Received pause for file "<<friendId<<":"<<fileId;
file->status = ToxFile::PAUSED;
emit static_cast<Core*>(core)->fileTransferRemotePausedUnpaused(*file, true);
}
else if (control == TOX_FILE_CONTROL_RESUME)
{
qDebug() << "CoreFile::onFileControlCallback: Received pause for file "<<friendId<<":"<<fileId;
qDebug() << "onFileControlCallback: Received pause for file "<<friendId<<":"<<fileId;
file->status = ToxFile::TRANSMITTING;
emit static_cast<Core*>(core)->fileTransferRemotePausedUnpaused(*file, false);
}
@ -292,14 +292,14 @@ void CoreFile::onFileDataCallback(Tox *tox, uint32_t friendId, uint32_t fileId,
ToxFile* file = findFile(friendId, fileId);
if (!file)
{
qWarning("CoreFile::onFileDataCallback: No such file in queue");
qWarning("onFileDataCallback: No such file in queue");
return;
}
// If we reached EOF, ack and cleanup the transfer
if (!length)
{
//qDebug("CoreFile::onFileDataCallback: File sending completed");
//qDebug("onFileDataCallback: File sending completed");
if (file->fileKind != TOX_FILE_KIND_AVATAR)
emit static_cast<Core*>(core)->fileTransferFinished(*file);
removeFile(friendId, fileId);
@ -321,7 +321,7 @@ void CoreFile::onFileDataCallback(Tox *tox, uint32_t friendId, uint32_t fileId,
nread = file->file->read((char*)data.get(), length);
if (nread <= 0)
{
qWarning("CoreFile::onFileDataCallback: Failed to read from file");
qWarning("onFileDataCallback: Failed to read from file");
emit static_cast<Core*>(core)->fileTransferCancelled(*file);
tox_file_send_chunk(tox, friendId, fileId, pos, nullptr, 0, nullptr);
removeFile(friendId, fileId);
@ -332,7 +332,7 @@ void CoreFile::onFileDataCallback(Tox *tox, uint32_t friendId, uint32_t fileId,
if (!tox_file_send_chunk(tox, friendId, fileId, pos, data.get(), nread, nullptr))
{
qWarning("CoreFile::onFileDataCallback: Failed to send data chunk");
qWarning("onFileDataCallback: Failed to send data chunk");
return;
}
if (file->fileKind != TOX_FILE_KIND_AVATAR)
@ -342,13 +342,13 @@ void CoreFile::onFileDataCallback(Tox *tox, uint32_t friendId, uint32_t fileId,
void CoreFile::onFileRecvChunkCallback(Tox *tox, uint32_t friendId, uint32_t fileId, uint64_t position,
const uint8_t *data, size_t length, void *core)
{
//qDebug() << QString("CoreFile: Received chunk for %1:%2 pos %3 size %4")
//qDebug() << QString("Received chunk for %1:%2 pos %3 size %4")
// .arg(friendId).arg(fileId).arg(position).arg(length);
ToxFile* file = findFile(friendId, fileId);
if (!file)
{
qWarning("CoreFile::onFileRecvChunkCallback: No such file in queue");
qWarning("onFileRecvChunkCallback: No such file in queue");
tox_file_control(tox, friendId, fileId, TOX_FILE_CONTROL_CANCEL, nullptr);
return;
}
@ -356,7 +356,7 @@ void CoreFile::onFileRecvChunkCallback(Tox *tox, uint32_t friendId, uint32_t fil
if (file->bytesSent != position)
{
/// TODO: Allow ooo receiving for non-stream transfers, with very careful checking
qWarning("CoreFile::onFileRecvChunkCallback: Received a chunk out-of-order, aborting transfer");
qWarning("onFileRecvChunkCallback: Received a chunk out-of-order, aborting transfer");
if (file->fileKind != TOX_FILE_KIND_AVATAR)
emit static_cast<Core*>(core)->fileTransferCancelled(*file);
tox_file_control(tox, friendId, fileId, TOX_FILE_CONTROL_CANCEL, nullptr);
@ -372,7 +372,7 @@ void CoreFile::onFileRecvChunkCallback(Tox *tox, uint32_t friendId, uint32_t fil
pic.loadFromData(file->avatarData);
if (!pic.isNull())
{
qDebug() << "Core: Got"<<file->avatarData.size()<<"bytes of avatar data from"
qDebug() << "Got"<<file->avatarData.size()<<"bytes of avatar data from"
<< static_cast<Core*>(core)->getFriendUsername(friendId);
Settings::getInstance().saveAvatar(pic, static_cast<Core*>(core)->getFriendAddress(friendId));
Settings::getInstance().saveAvatarHash(file->fileName, static_cast<Core*>(core)->getFriendAddress(friendId));

View File

@ -28,7 +28,7 @@ Friend* FriendList::addFriend(int friendId, const ToxID& userId)
{
auto friendChecker = friendList.find(friendId);
if (friendChecker != friendList.end())
qWarning() << "FriendList::addFriend: friendId already taken";
qWarning() << "addFriend: friendId already taken";
Friend* newfriend = new Friend(friendId, userId);
friendList[friendId] = newfriend;

View File

@ -47,7 +47,7 @@ Group::~Group()
void Group::addPeer(int peerId, QString name)
{
if (peers.contains(peerId))
qWarning() << "Group::addPeer: peerId already used, overwriting anyway";
qWarning() << "addPeer: peerId already used, overwriting anyway";
if (name.isEmpty())
peers[peerId] = "<Unknown>";
else

View File

@ -25,7 +25,7 @@ Group* GroupList::addGroup(int groupId, const QString& name, bool isAvGroupchat)
{
auto checker = groupList.find(groupId);
if (checker != groupList.end())
qWarning() << "GroupList::addGroup: groupId already taken";
qWarning() << "addGroup: groupId already taken";
Group* newGroup = new Group(groupId, name, isAvGroupchat);
groupList[groupId] = newGroup;

View File

@ -432,9 +432,9 @@ bool HistoryKeeper::removeHistory(int encrypted)
QList<HistoryKeeper::HistMessage> HistoryKeeper::exportMessagesDeleteFile(int encrypted)
{
auto msgs = getInstance()->exportMessages();
qDebug() << "HistoryKeeper: count" << msgs.size() << "messages exported";
qDebug() << "count" << msgs.size() << "messages exported";
if (!removeHistory(encrypted))
qWarning() << "HistoryKeeper: couldn't delete old log file!";
qWarning() << "couldn't delete old log file!";
return msgs;
}

View File

@ -39,10 +39,10 @@ IPC::IPC()
qsrand(time(0));
globalId = ((uint64_t)qrand()) * ((uint64_t)qrand()) * ((uint64_t)qrand());
qDebug() << "IPC: Our global ID is " << globalId;
qDebug() << "Our global ID is " << globalId;
if (globalMemory.create(sizeof(IPCMemory)))
{
qDebug() << "IPC: Creating the global shared memory and taking ownership";
qDebug() << "Creating the global shared memory and taking ownership";
if (globalMemory.lock())
{
IPCMemory* mem = global();
@ -53,16 +53,16 @@ IPC::IPC()
}
else
{
qWarning() << "IPC: Couldn't lock to take ownership";
qWarning() << "Couldn't lock to take ownership";
}
}
else if (globalMemory.attach())
{
qDebug() << "IPC: Attaching to the global shared memory";
qDebug() << "Attaching to the global shared memory";
}
else
{
qDebug() << "IPC: Failed to attach to the global shared memory, giving up";
qDebug() << "Failed to attach to the global shared memory, giving up";
return; // We won't be able to do any IPC without being attached, let's get outta here
}
@ -119,13 +119,13 @@ time_t IPC::postEvent(const QString &name, const QByteArray& data/*=QByteArray()
mem->lastEvent = evt->posted = result = qMax(mem->lastEvent + 1, time(0));
evt->dest = dest;
evt->sender = getpid();
qDebug() << "IPC: postEvent " << name << "to" << dest;
qDebug() << "postEvent " << name << "to" << dest;
}
globalMemory.unlock();
return result;
}
else
qDebug() << "IPC: Failed to lock in postEvent()";
qDebug() << "Failed to lock in postEvent()";
return 0;
}
@ -137,7 +137,7 @@ bool IPC::isCurrentOwner()
void* data = globalMemory.data();
if (!data)
{
qWarning() << "IPC: isCurrentOwner failed to access the memory, returning false";
qWarning() << "isCurrentOwner failed to access the memory, returning false";
globalMemory.unlock();
return false;
}
@ -147,7 +147,7 @@ bool IPC::isCurrentOwner()
}
else
{
qWarning() << "IPC: isCurrentOwner failed to lock, returning false";
qWarning() << "isCurrentOwner failed to lock, returning false";
return false;
}
}
@ -178,7 +178,7 @@ bool IPC::isEventAccepted(time_t time)
}
else
{
qWarning() << "IPC: isEventAccepted failed to lock, returning false";
qWarning() << "isEventAccepted failed to lock, returning false";
}
return result;
}
@ -254,7 +254,7 @@ void IPC::processEvents()
// Only the owner processes events. But if the previous owner's dead, we can take ownership now
if (difftime(time(0), mem->lastProcessed) >= OWNERSHIP_TIMEOUT_S)
{
qDebug() << "IPC: Previous owner timed out, taking ownership" << mem->globalId << "->" << globalId;
qDebug() << "Previous owner timed out, taking ownership" << mem->globalId << "->" << globalId;
// Ignore events that were not meant for this instance
memset(mem, 0, sizeof(IPCMemory));
mem->globalId = globalId;
@ -269,7 +269,7 @@ void IPC::processEvents()
auto it = eventHandlers.find(name);
if (it != eventHandlers.end())
{
qDebug() << "IPC: Processing event: " << name << ":" << evt->posted << "=" << evt->accepted;
qDebug() << "Processing event: " << name << ":" << evt->posted << "=" << evt->accepted;
evt->accepted = runEventHandler(it.value(), evt->data);
if (evt->dest == 0)
{

View File

@ -43,37 +43,53 @@
#define EXIT_UPDATE_MACX_FAIL 216
#ifdef LOG_TO_FILE
static QtMessageHandler dflt;
static QTextStream* logFile {nullptr};
static QMutex mutex;
#endif
void myMessageHandler(QtMsgType type, const QMessageLogContext& ctxt, const QString& msg)
void logMessageHandler(QtMsgType type, const QMessageLogContext& ctxt, const QString& msg)
{
if (!logFile)
return;
// Silence qWarning spam due to bug in QTextBrowser (trying to open a file for base64 images)
if (ctxt.function == QString("virtual bool QFSFileEngine::open(QIODevice::OpenMode)")
&& msg == QString("QFSFileEngine::open: No file name specified"))
return;
QMutexLocker locker(&mutex);
dflt(type, ctxt, msg);
*logFile << QTime::currentTime().toString("HH:mm:ss' '") << msg << '\n';
logFile->flush();
}
#endif
int opencvErrorHandler(int status, const char* func_name, const char* err_msg,
const char* file_name, int line, void*)
QString LogMsg = QString("[%1] %2:%3 : ")
.arg(QTime::currentTime().toString("HH:mm:ss.zzz")).arg(ctxt.file).arg(ctxt.line);
switch (type)
{
qWarning() << "OpenCV: ERROR ("<<status<<") in "
<<file_name<<":"<<line<<":"<<func_name<<": "<<err_msg;
return 0;
case QtDebugMsg:
LogMsg += "Debug";
break;
case QtWarningMsg:
LogMsg += "Warning";
break;
case QtCriticalMsg:
LogMsg += "Critical";
break;
case QtFatalMsg:
LogMsg += "Fatal";
break;
}
LogMsg += ": " + msg + "\n";
QTextStream out(stderr, QIODevice::WriteOnly);
out << LogMsg;
#ifdef LOG_TO_FILE
if (!logFile)
return;
QMutexLocker locker(&mutex);
*logFile << LogMsg;
logFile->flush();
#endif
}
int main(int argc, char *argv[])
{
qInstallMessageHandler(logMessageHandler); // Enable log as early as possible
QApplication a(argc, argv);
a.setApplicationName("qTox");
a.setOrganizationName("Tox");
@ -109,7 +125,7 @@ int main(int argc, char *argv[])
}
else
{
qWarning() << "Error: -p profile" << profile + ".tox" << "doesn't exist";
qCritical() << "-p profile" << profile + ".tox" << "doesn't exist";
return EXIT_FAILURE;
}
}
@ -118,17 +134,15 @@ int main(int argc, char *argv[])
#ifdef LOG_TO_FILE
logFile = new QTextStream;
dflt = qInstallMessageHandler(nullptr);
QFile logfile(QDir(Settings::getSettingsDirPath()).filePath("qtox.log"));
if (logfile.open(QIODevice::Append))
{
logFile->setDevice(&logfile);
*logFile << QDateTime::currentDateTime().toString("\nyyyy-MM-dd HH:mm:ss' file logger starting\n'");
qInstallMessageHandler(myMessageHandler);
}
else
{
fprintf(stderr, "Couldn't open log file!\n");
qWarning() << "Couldn't open log file!\n";
delete logFile;
logFile = nullptr;
}
@ -141,9 +155,6 @@ int main(int argc, char *argv[])
qDebug() << "built on: " << __TIME__ << __DATE__ << "(" << TIMESTAMP << ")";
qDebug() << "commit: " << GIT_VERSION << "\n";
cvSetErrMode(CV_ErrModeParent);
cvRedirectError(opencvErrorHandler);
#if defined(Q_OS_MACX) && defined(QT_RELEASE)
if (qApp->applicationDirPath() != "/Applications/qtox.app/Contents/MacOS") {
qDebug() << "OS X: Not in Applications folder";

View File

@ -33,7 +33,7 @@ EncryptedDb::EncryptedDb(const QString &fname, QList<QString> initList) :
QByteArray fileContent;
if (pullFileContent(fileName, buffer))
{
qDebug() << "EncryptedDb: writing old data";
qDebug() << "writing old data";
encrFile.setFileName(fileName);
encrFile.open(QIODevice::ReadOnly);
fileContent = encrFile.readAll();
@ -78,7 +78,7 @@ bool EncryptedDb::pullFileContent(const QString &fname, QByteArray &buf)
QFile dbFile(fname);
if (!dbFile.open(QIODevice::ReadOnly))
{
qDebug() << "EncryptedDb::pullFileContent: file doesn't exist";
qDebug() << "pullFileContent: file doesn't exist";
buf = QByteArray();
return false;
}
@ -87,7 +87,7 @@ bool EncryptedDb::pullFileContent(const QString &fname, QByteArray &buf)
while (!dbFile.atEnd())
{
QByteArray encrChunk = dbFile.read(encryptedChunkSize);
qDebug() << "EncryptedDb::pullFileContent: got chunk:" << encrChunk.size();
qDebug() << "pullFileContent: got chunk:" << encrChunk.size();
buf = Core::getInstance()->decryptData(encrChunk, Core::ptHistory);
if (buf.size() > 0)
{
@ -95,7 +95,7 @@ bool EncryptedDb::pullFileContent(const QString &fname, QByteArray &buf)
}
else
{
qWarning() << "EncryptedDb::pullFileContent: Encrypted history log is corrupted: can't decrypt, will be deleted";
qWarning() << "pullFileContent: Encrypted history log is corrupted: can't decrypt, will be deleted";
buf = QByteArray();
return false;
}

View File

@ -204,7 +204,7 @@ void Settings::load()
}
}
qDebug() << "Settings: Loading from "<<filePath;
qDebug() << "Loading settings from " + filePath;
QSettings s(filePath, QSettings::IniFormat);
s.beginGroup("DHT Server");
@ -390,7 +390,7 @@ void Settings::save(QString path, bool writePersonal)
void Settings::saveGlobal(QString path)
{
qDebug() << "Settings: Saving in " << path;
qDebug() << "Saving settings in " + path;
QSettings s(path, QSettings::IniFormat);
@ -487,11 +487,11 @@ void Settings::savePersonal(QString path)
{
if (currentProfile.isEmpty())
{
qDebug() << "Settings: could not save personal settings because currentProfile profile is empty";
qDebug() << "could not save personal settings because currentProfile profile is empty";
return;
}
qDebug() << "Settings: Saving personal in " << path;
qDebug() << "Saving personal settings in " << path;
QSettings ps(QFileInfo(path).dir().filePath(currentProfile + ".ini"), QSettings::IniFormat);
ps.beginGroup("Friends");

View File

@ -80,7 +80,7 @@ QString Style::getStylesheet(const QString &filename)
if (file.open(QFile::ReadOnly | QFile::Text))
return resolve(file.readAll());
else
qWarning() << "Style: Stylesheet " << filename << " not found";
qWarning() << "Stylesheet " << filename << " not found";
}
return QString();

View File

@ -42,7 +42,7 @@ void Nexus::start()
if (started)
return;
qDebug() << "Nexus: Starting up";
qDebug() << "Starting up";
// Setup the environment
qRegisterMetaType<Status>("Status");

View File

@ -53,7 +53,7 @@ void ProfileLocker::unlock()
void ProfileLocker::clearAllLocks()
{
qDebug() << "ProfileLocker::clearAllLocks: Wiping out all lock files";
qDebug() << "clearAllLocks: Wiping out all lock files";
if (lockfile)
unlock();
@ -72,7 +72,7 @@ void ProfileLocker::assertLock()
{
if (!lockfile)
{
qCritical() << "ProfileLocker::assertLock: We don't seem to own any lock!";
qCritical() << "assertLock: We don't seem to own any lock!";
deathByBrokenLock();
}
@ -82,11 +82,11 @@ void ProfileLocker::assertLock()
unlock();
if (lock(tmp))
{
qCritical() << "ProfileLocker::assertLock: Lock file was lost, but could be restored";
qCritical() << "assertLock: Lock file was lost, but could be restored";
}
else
{
qCritical() << "ProfileLocker::assertLock: Lock file was lost, and could *NOT* be restored";
qCritical() << "assertLock: Lock file was lost, and could *NOT* be restored";
deathByBrokenLock();
}
}
@ -94,6 +94,6 @@ void ProfileLocker::assertLock()
void ProfileLocker::deathByBrokenLock()
{
qCritical() << "ProfileLocker: Lock is *BROKEN*, exiting immediately";
qCritical() << "Lock is *BROKEN*, exiting immediately";
abort();
}

View File

@ -172,7 +172,7 @@ QString ToxDNS::queryTox3(const tox3_server& server, const QString &record, bool
void* tox_dns3 = tox_dns3_new(server.pubkey);
if (!tox_dns3)
{
qWarning() << "queryTox3: failed to create a tox_dns3 object for "<<server.name<<", using tox1 as a fallback";
qWarning() << "failed to create a tox_dns3 object for "<<server.name<<", using tox1 as a fallback";
goto fallbackOnTox1;
}
uint32_t request_id;
@ -182,7 +182,7 @@ QString ToxDNS::queryTox3(const tox3_server& server, const QString &record, bool
if (dns_string_len < 0) // We can always fallback on tox1 if toxdns3 fails
{
qWarning() << "queryTox3: failed to generate dns3 string for "<<server.name<<", using tox1 as a fallback";
qWarning() << "failed to generate dns3 string for "<<server.name<<", using tox1 as a fallback";
goto fallbackOnTox1;
}
@ -190,7 +190,7 @@ QString ToxDNS::queryTox3(const tox3_server& server, const QString &record, bool
entry = fetchLastTextRecord(realRecord, silent);
if (entry.isEmpty())
{
qWarning() << "queryTox3: Server "<<server.name<<" returned no record, using tox1 as a fallback";
qWarning() << "Server "<<server.name<<" returned no record, using tox1 as a fallback";
goto fallbackOnTox1;
}
@ -205,7 +205,7 @@ QString ToxDNS::queryTox3(const tox3_server& server, const QString &record, bool
QString ver = entry.mid(verx, verend-verx);
if (ver != "tox3")
{
qWarning() << "queryTox3: Server "<<server.name<<" returned a bad version ("<<ver<<"), using tox1 as a fallback";
qWarning() << "Server "<<server.name<<" returned a bad version ("<<ver<<"), using tox1 as a fallback";
goto fallbackOnTox1;
}
}
@ -215,7 +215,7 @@ QString ToxDNS::queryTox3(const tox3_server& server, const QString &record, bool
idx = entry.indexOf("id=");
if (idx < 0)
{
qWarning() << "queryTox3: Server "<<server.name<<" returned an empty id, using tox1 as a fallback";
qWarning() << "Server "<<server.name<<" returned an empty id, using tox1 as a fallback";
goto fallbackOnTox1;
}
@ -225,7 +225,7 @@ QString ToxDNS::queryTox3(const tox3_server& server, const QString &record, bool
toxIdSize = tox_decrypt_dns3_TXT(tox_dns3, toxId, (uint8_t*)id.data(), id.size(), request_id);
if (toxIdSize < 0) // We can always fallback on tox1 if toxdns3 fails
{
qWarning() << "queryTox3: failed to decrypt dns3 reply for "<<server.name<<", using tox1 as a fallback";
qWarning() << "Failed to decrypt dns3 reply for "<<server.name<<", using tox1 as a fallback";
goto fallbackOnTox1;
}

View File

@ -32,7 +32,7 @@ QByteArray Toxme::prepareEncryptedJson(int action, QString payload)
QPair<QByteArray, QByteArray> keypair = Core::getInstance()->getKeypair();
if (keypair.first.isEmpty() || keypair.second.isEmpty())
{
qWarning() << "Toxme::prepareEncryptedJson: Couldn't get our keypair, aborting";
qWarning() << "prepareEncryptedJson: Couldn't get our keypair, aborting";
return QByteArray();
}

View File

@ -50,14 +50,14 @@ void CameraWorker::onStart()
void CameraWorker::_suspend()
{
qDebug() << "CameraWorker: Suspend";
qDebug() << "Suspend";
clock->stop();
unsubscribe();
}
void CameraWorker::_resume()
{
qDebug() << "CameraWorker: Resume";
qDebug() << "Resume";
subscribe();
clock->start();
}
@ -126,7 +126,7 @@ void CameraWorker::_probeResolutions()
unsubscribe();
qDebug() << "CameraWorker: Resolutions" <<resolutions;
qDebug() << "Resolutions" <<resolutions;
}
emit resProbingFinished(resolutions);
@ -156,12 +156,12 @@ void CameraWorker::subscribe()
}
catch( cv::Exception& e )
{
qDebug() << "CameraWorker:" << "OpenCV exception caught: " << e.what();
qDebug() << "OpenCV exception caught: " << e.what();
}
if (!bSuccess)
{
qDebug() << "CameraWorker: Could not open camera";
qDebug() << "Could not open camera";
}
applyProps(); // restore props
}
@ -192,14 +192,14 @@ void CameraWorker::doWork()
}
catch( cv::Exception& e )
{
qDebug() << "CameraWorker:" << "OpenCV exception caught: " << e.what();;
qDebug() << "OpenCV exception caught: " << e.what();;
this->clock->stop(); // prevent log spamming
qDebug() << "CameraWorker: stopped clock";
qDebug() << "stopped clock";
}
if (!bSuccess)
{
qDebug() << "CameraWorker: Cannot read frame";
qDebug() << "Cannot read frame";
return;
}

View File

@ -94,11 +94,11 @@ void AndroidGUI::keyPressEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Back)
{
qDebug() << "AndroidGUI: Back key pressed, quitting";
qDebug() << "Back key pressed, quitting";
qApp->exit(0);
}
else if (event->key() == Qt::Key_Menu)
{
qDebug() << "AndroidGUI: Menu key pressed";
qDebug() << "Menu key pressed";
}
}

View File

@ -360,7 +360,7 @@ void GeneralForm::reloadSmiles()
QList<QStringList> emoticons = SmileyPack::getInstance().getEmoticons();
if (emoticons.isEmpty())
{ // sometimes there are no emoticons available, don't crash in this case
qDebug() << "GeneralForm::reloadSmilies: No emoticons found";
qDebug() << "reloadSmilies: No emoticons found";
return;
}

View File

@ -109,7 +109,7 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
{
dir = QFileDialog::getExistingDirectory(0, tr("Choose an auto accept directory","popup title"), dir);
autoAccept->setChecked(true);
qDebug() << "FriendWidget: setting auto accept dir for" << friendId << "to" << dir;
qDebug() << "setting auto accept dir for" << friendId << "to" << dir;
Settings::getInstance().setAutoAcceptDir(id, dir);
}
}

View File

@ -18,7 +18,7 @@ SystemTrayIcon::SystemTrayIcon()
#ifdef ENABLE_SYSTRAY_UNITY_BACKEND
else if (desktop == "unity")
{
qDebug() << "SystemTrayIcon: Using Unity backend";
qDebug() << "Using Unity backend";
gtk_init(nullptr, nullptr);
QString settingsDir = Settings::getSettingsDirPath();
QFile iconFile(settingsDir+"/icon.png");
@ -44,7 +44,7 @@ SystemTrayIcon::SystemTrayIcon()
#ifdef ENABLE_SYSTRAY_GTK_BACKEND
else if (desktop == "xfce" || desktop.contains("gnome"))
{
qDebug() << "SystemTrayIcon: Using GTK backend";
qDebug() << "Using GTK backend";
backendType = SystrayBackendType::GTK;
gtk_init(nullptr, nullptr);
void (*callbackFreeImage)(guchar*, gpointer) =
@ -80,7 +80,7 @@ SystemTrayIcon::SystemTrayIcon()
else if (desktop == "kde"
&& getenv("KDE_SESSION_VERSION") == QString("5"))
{
qDebug() << "SystemTrayIcon: Using Status Notifier backend";
qDebug() << "Using Status Notifier backend";
backendType = SystrayBackendType::StatusNotifier;
gtk_init(nullptr, nullptr);
snMenu = gtk_menu_new();
@ -105,11 +105,11 @@ SystemTrayIcon::SystemTrayIcon()
&& getenv("KDE_SESSION_VERSION") == QString("5"))
{
backendType = SystrayBackendType::KDE5;
qWarning() << "SystemTrayIcon: Detected a KDE5 session, but we don't have Status Notifier support. Disabling the systray icon";
qWarning() << "Detected a KDE5 session, but we don't have Status Notifier support. Disabling the systray icon";
}
else
{
qDebug() << "SystemTrayIcon: Using the Qt backend";
qDebug() << "Using the Qt backend";
qtIcon = new QSystemTrayIcon;
backendType = SystrayBackendType::Qt;
connect(qtIcon, &QSystemTrayIcon::activated, this, &SystemTrayIcon::activated);

View File

@ -71,7 +71,7 @@ void VideoSurface::setSource(VideoSource *src)
void VideoSurface::initializeGL()
{
QGLWidget::initializeGL();
qDebug() << "VideoSurface: Init";
qDebug() << "Init";
// pbo
pbo[0] = new QOpenGLBuffer(QOpenGLBuffer::PixelUnpackBuffer);
pbo[0]->setUsagePattern(QOpenGLBuffer::StreamDraw);
@ -156,7 +156,7 @@ void VideoSurface::paintGL()
if (pboAllocSize != currFrame.frameData.size())
{
qDebug() << "VideoSurface: Resize pbo " << currFrame.frameData.size() << "(" << currFrame.resolution << ")" << "bytes (before" << pboAllocSize << ")";
qDebug() << "Resize pbo " << currFrame.frameData.size() << "(" << currFrame.resolution << ")" << "bytes (before" << pboAllocSize << ")";
pbo[0]->bind();
pbo[0]->allocate(currFrame.frameData.size());

View File

@ -313,7 +313,7 @@ void Widget::updateIcons()
Widget::~Widget()
{
qDebug() << "Widget: Deleting Widget";
qDebug() << "Deleting Widget";
AutoUpdater::abortUpdates();
if (icon)
icon->hide();
@ -609,7 +609,7 @@ void Widget::reloadHistory()
void Widget::addFriend(int friendId, const QString &userId)
{
//qDebug() << "Widget: Adding friend with id" << userId;
//qDebug() << "Adding friend with id" << userId;
ToxID userToxId = ToxID::fromString(userId);
Friend* newfriend = FriendList::addFriend(friendId, userToxId);
contactListWidget->moveWidget(newfriend->getFriendWidget(),Status::Offline);
@ -654,7 +654,7 @@ void Widget::addFriend(int friendId, const QString &userId)
QPixmap avatar = Settings::getInstance().getSavedAvatar(userId);
if (!avatar.isNull())
{
//qWarning() << "Widget: loadded avatar for id" << userId;
//qWarning() << "loadded avatar for id" << userId;
newfriend->getChatForm()->onAvatarChange(friendId, avatar);
newfriend->getFriendWidget()->onAvatarChange(friendId, avatar);
}
@ -931,14 +931,14 @@ void Widget::onGroupInviteReceived(int32_t friendId, uint8_t type, QByteArray in
int groupId = Nexus::getCore()->joinGroupchat(friendId, type, (uint8_t*)invite.data(), invite.length());
if (groupId < 0)
{
qWarning() << "Widget::onGroupInviteReceived: Unable to accept group invite";
qWarning() << "onGroupInviteReceived: Unable to accept group invite";
return;
}
}
}
else
{
qWarning() << "Widget::onGroupInviteReceived: Unknown groupchat type:"<<type;
qWarning() << "onGroupInviteReceived: Unknown groupchat type:"<<type;
return;
}
}
@ -979,7 +979,7 @@ void Widget::onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t Cha
Group* g = GroupList::findGroup(groupnumber);
if (!g)
{
qDebug() << "Widget::onGroupNamelistChanged: Group "<<groupnumber<<" not found, creating it";
qDebug() << "onGroupNamelistChanged: Group "<<groupnumber<<" not found, creating it";
g = createGroup(groupnumber);
}
@ -1057,7 +1057,7 @@ Group *Widget::createGroup(int groupId)
Group* g = GroupList::findGroup(groupId);
if (g)
{
qWarning() << "Widget::createGroup: Group already exists";
qWarning() << "createGroup: Group already exists";
return g;
}
@ -1129,7 +1129,7 @@ void Widget::onUserAwayCheck()
{
if (autoAwayTime && Platform::getIdleTime() >= autoAwayTime)
{
qDebug() << "Widget: auto away activated at" << QTime::currentTime().toString();
qDebug() << "auto away activated at" << QTime::currentTime().toString();
emit statusSet(Status::Away);
autoAwayActive = true;
}
@ -1138,7 +1138,7 @@ void Widget::onUserAwayCheck()
{
if (autoAwayActive && (!autoAwayTime || Platform::getIdleTime() < autoAwayTime))
{
qDebug() << "Widget: auto away deactivated at" << QTime::currentTime().toString();
qDebug() << "auto away deactivated at" << QTime::currentTime().toString();
emit statusSet(Status::Online);
autoAwayActive = false;
}
@ -1203,7 +1203,7 @@ void Widget::onTryCreateTrayIcon()
disconnect(timer, &QTimer::timeout, this, &Widget::onTryCreateTrayIcon);
if (!icon)
{
qWarning() << "Widget: No system tray detected!";
qWarning() << "No system tray detected!";
show();
}
}