mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Code style improvements
This commit is contained in:
parent
66314bc38d
commit
92f3b6a20f
@ -72,6 +72,7 @@ Audio::~Audio()
|
|||||||
audioThread->wait();
|
audioThread->wait();
|
||||||
if (audioThread->isRunning())
|
if (audioThread->isRunning())
|
||||||
audioThread->terminate();
|
audioThread->terminate();
|
||||||
|
|
||||||
delete audioThread;
|
delete audioThread;
|
||||||
delete audioInLock;
|
delete audioInLock;
|
||||||
delete audioOutLock;
|
delete audioOutLock;
|
||||||
@ -123,6 +124,7 @@ void Audio::openInput(const QString& inDevDescr)
|
|||||||
alInDev = nullptr;
|
alInDev = nullptr;
|
||||||
if (tmp)
|
if (tmp)
|
||||||
alcCaptureCloseDevice(tmp);
|
alcCaptureCloseDevice(tmp);
|
||||||
|
|
||||||
int stereoFlag = av_DefaultSettings.audio_channels==1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
|
int stereoFlag = av_DefaultSettings.audio_channels==1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16;
|
||||||
if (inDevDescr.isEmpty())
|
if (inDevDescr.isEmpty())
|
||||||
alInDev = alcCaptureOpenDevice(nullptr,av_DefaultSettings.audio_sample_rate, stereoFlag,
|
alInDev = alcCaptureOpenDevice(nullptr,av_DefaultSettings.audio_sample_rate, stereoFlag,
|
||||||
@ -163,6 +165,7 @@ void Audio::openOutput(const QString& outDevDescr)
|
|||||||
alOutDev = alcOpenDevice(nullptr);
|
alOutDev = alcOpenDevice(nullptr);
|
||||||
else
|
else
|
||||||
alOutDev = alcOpenDevice(outDevDescr.toStdString().c_str());
|
alOutDev = alcOpenDevice(outDevDescr.toStdString().c_str());
|
||||||
|
|
||||||
if (!alOutDev)
|
if (!alOutDev)
|
||||||
{
|
{
|
||||||
qWarning() << "Audio: Cannot open output audio device";
|
qWarning() << "Audio: Cannot open output audio device";
|
||||||
@ -171,8 +174,10 @@ void Audio::openOutput(const QString& outDevDescr)
|
|||||||
{
|
{
|
||||||
if (alContext && alcMakeContextCurrent(nullptr) == ALC_TRUE)
|
if (alContext && alcMakeContextCurrent(nullptr) == ALC_TRUE)
|
||||||
alcDestroyContext(alContext);
|
alcDestroyContext(alContext);
|
||||||
|
|
||||||
if (tmp)
|
if (tmp)
|
||||||
alcCloseDevice(tmp);
|
alcCloseDevice(tmp);
|
||||||
|
|
||||||
alContext=alcCreateContext(alOutDev,nullptr);
|
alContext=alcCreateContext(alOutDev,nullptr);
|
||||||
if (!alcMakeContextCurrent(alContext))
|
if (!alcMakeContextCurrent(alContext))
|
||||||
{
|
{
|
||||||
@ -180,7 +185,9 @@ void Audio::openOutput(const QString& outDevDescr)
|
|||||||
alcCloseDevice(alOutDev);
|
alcCloseDevice(alOutDev);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
alGenSources(1, &alMainSource);
|
alGenSources(1, &alMainSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
qDebug() << "Audio: Opening audio output "<<outDevDescr;
|
qDebug() << "Audio: Opening audio output "<<outDevDescr;
|
||||||
@ -217,13 +224,9 @@ void Audio::closeOutput()
|
|||||||
if (alOutDev)
|
if (alOutDev)
|
||||||
{
|
{
|
||||||
if (alcCloseDevice(alOutDev) == ALC_TRUE)
|
if (alcCloseDevice(alOutDev) == ALC_TRUE)
|
||||||
{
|
|
||||||
alOutDev = nullptr;
|
alOutDev = nullptr;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
qWarning() << "Audio: Failed to close output";
|
qWarning() << "Audio: Failed to close output";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,9 @@ FileTransferWidget::FileTransferWidget(QWidget *parent, ToxFile file)
|
|||||||
ui->progressLabel->setText(tr("Waiting to send...", "file transfer widget"));
|
ui->progressLabel->setText(tr("Waiting to send...", "file transfer widget"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
ui->progressLabel->setText(tr("Accept to receive this file", "file transfer widget"));
|
ui->progressLabel->setText(tr("Accept to receive this file", "file transfer widget"));
|
||||||
|
}
|
||||||
|
|
||||||
setFixedHeight(78);
|
setFixedHeight(78);
|
||||||
}
|
}
|
||||||
@ -187,6 +189,7 @@ void FileTransferWidget::paintEvent(QPaintEvent *)
|
|||||||
// draw background
|
// draw background
|
||||||
if(drawButtonAreaNeeded())
|
if(drawButtonAreaNeeded())
|
||||||
painter.setClipRect(QRect(0,0,width()-buttonFieldWidth,height()));
|
painter.setClipRect(QRect(0,0,width()-buttonFieldWidth,height()));
|
||||||
|
|
||||||
painter.setBrush(QBrush(backgroundColor));
|
painter.setBrush(QBrush(backgroundColor));
|
||||||
painter.drawRoundRect(geometry(), r * ratio, r);
|
painter.drawRoundRect(geometry(), r * ratio, r);
|
||||||
|
|
||||||
|
@ -457,7 +457,8 @@ void Core::onStatusMessageChanged(Tox*/* tox*/, uint32_t friendId, const uint8_t
|
|||||||
void Core::onUserStatusChanged(Tox*/* tox*/, uint32_t friendId, TOX_USER_STATUS userstatus, void* core)
|
void Core::onUserStatusChanged(Tox*/* tox*/, uint32_t friendId, TOX_USER_STATUS userstatus, void* core)
|
||||||
{
|
{
|
||||||
Status status;
|
Status status;
|
||||||
switch (userstatus) {
|
switch (userstatus)
|
||||||
|
{
|
||||||
case TOX_USER_STATUS_NONE:
|
case TOX_USER_STATUS_NONE:
|
||||||
status = Status::Online;
|
status = Status::Online;
|
||||||
break;
|
break;
|
||||||
@ -611,6 +612,7 @@ void Core::requestFriendship(const QString& friendAddress, const QString& messag
|
|||||||
QString inviteStr = tr("/me offers friendship.");
|
QString inviteStr = tr("/me offers friendship.");
|
||||||
if (message.length())
|
if (message.length())
|
||||||
inviteStr = tr("/me offers friendship, \"%1\"").arg(message);
|
inviteStr = tr("/me offers friendship, \"%1\"").arg(message);
|
||||||
|
|
||||||
HistoryKeeper::getInstance()->addChatEntry(userId, inviteStr, getSelfId().publicKey, QDateTime::currentDateTime(), true);
|
HistoryKeeper::getInstance()->addChatEntry(userId, inviteStr, getSelfId().publicKey, QDateTime::currentDateTime(), true);
|
||||||
emit friendAdded(friendId, userId);
|
emit friendAdded(friendId, userId);
|
||||||
}
|
}
|
||||||
@ -826,7 +828,8 @@ void Core::setStatusMessage(const QString& message)
|
|||||||
{
|
{
|
||||||
CString cMessage(message);
|
CString cMessage(message);
|
||||||
|
|
||||||
if (tox_self_set_status_message(tox, cMessage.data(), cMessage.size(), nullptr) == false) {
|
if (tox_self_set_status_message(tox, cMessage.data(), cMessage.size(), nullptr) == false)
|
||||||
|
{
|
||||||
emit failedToSetStatusMessage(message);
|
emit failedToSetStatusMessage(message);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -900,7 +903,8 @@ QByteArray Core::loadToxSave(QString path)
|
|||||||
if (fileSize > 0)
|
if (fileSize > 0)
|
||||||
{
|
{
|
||||||
data = configurationFile.readAll();
|
data = configurationFile.readAll();
|
||||||
if (tox_is_data_encrypted((uint8_t*)data.data())) {
|
if (tox_is_data_encrypted((uint8_t*)data.data()))
|
||||||
|
{
|
||||||
if (!loadEncryptedSave(data))
|
if (!loadEncryptedSave(data))
|
||||||
{
|
{
|
||||||
configurationFile.close();
|
configurationFile.close();
|
||||||
|
@ -34,8 +34,10 @@ uint8_t* Core::videobuf;
|
|||||||
bool Core::anyActiveCalls()
|
bool Core::anyActiveCalls()
|
||||||
{
|
{
|
||||||
for (auto& call : calls)
|
for (auto& call : calls)
|
||||||
|
{
|
||||||
if (call.active)
|
if (call.active)
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,6 +95,7 @@ void Core::onAvMediaChange(void* toxav, int32_t callId, void* core)
|
|||||||
int friendId;
|
int friendId;
|
||||||
if (toxav_get_peer_csettings((ToxAv*)toxav, callId, 0, &settings) < 0)
|
if (toxav_get_peer_csettings((ToxAv*)toxav, callId, 0, &settings) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
friendId = toxav_get_peer_id((ToxAv*)toxav, callId, 0);
|
friendId = toxav_get_peer_id((ToxAv*)toxav, callId, 0);
|
||||||
if (friendId < 0)
|
if (friendId < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
@ -220,6 +223,7 @@ void Core::cleanupCall(int32_t callId)
|
|||||||
calls[callId].sendVideoTimer->stop();
|
calls[callId].sendVideoTimer->stop();
|
||||||
if (calls[callId].videoEnabled)
|
if (calls[callId].videoEnabled)
|
||||||
Camera::getInstance()->unsubscribe();
|
Camera::getInstance()->unsubscribe();
|
||||||
|
|
||||||
Audio::unsuscribeInput();
|
Audio::unsuscribeInput();
|
||||||
toxav_kill_transmission(Core::getInstance()->toxav, callId);
|
toxav_kill_transmission(Core::getInstance()->toxav, callId);
|
||||||
}
|
}
|
||||||
@ -286,9 +290,7 @@ void Core::sendCallAudio(int32_t callId, ToxAv* toxav)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((r = toxav_send_audio(toxav, callId, dest, r)) < 0)
|
if ((r = toxav_send_audio(toxav, callId, dest, r)) < 0)
|
||||||
{
|
|
||||||
qDebug() << "Core: toxav_send_audio error";
|
qDebug() << "Core: toxav_send_audio error";
|
||||||
}
|
|
||||||
}
|
}
|
||||||
calls[callId].sendAudioTimer->start();
|
calls[callId].sendAudioTimer->start();
|
||||||
}
|
}
|
||||||
@ -336,9 +338,7 @@ void Core::sendCallVideo(int32_t callId)
|
|||||||
void Core::micMuteToggle(int32_t callId)
|
void Core::micMuteToggle(int32_t callId)
|
||||||
{
|
{
|
||||||
if (calls[callId].active)
|
if (calls[callId].active)
|
||||||
{
|
|
||||||
calls[callId].muteMic = !calls[callId].muteMic;
|
calls[callId].muteMic = !calls[callId].muteMic;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::volMuteToggle(int32_t callId)
|
void Core::volMuteToggle(int32_t callId)
|
||||||
|
@ -190,7 +190,9 @@ bool Core::loadEncryptedSave(QByteArray& data)
|
|||||||
dialogtxt = tr("The profile password failed. Please try another?", "used only when pw set before load() doesn't work");
|
dialogtxt = tr("The profile password failed. Please try another?", "used only when pw set before load() doesn't work");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
dialogtxt = a;
|
dialogtxt = a;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t salt[TOX_PASS_SALT_LENGTH];
|
uint8_t salt[TOX_PASS_SALT_LENGTH];
|
||||||
tox_get_salt(reinterpret_cast<uint8_t *>(data.data()), salt);
|
tox_get_salt(reinterpret_cast<uint8_t *>(data.data()), salt);
|
||||||
@ -205,7 +207,9 @@ bool Core::loadEncryptedSave(QByteArray& data)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
setPassword(pw, ptMain, salt);
|
setPassword(pw, ptMain, salt);
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray newData(fileSize-TOX_PASS_ENCRYPTION_EXTRA_LENGTH, 0);
|
QByteArray newData(fileSize-TOX_PASS_ENCRYPTION_EXTRA_LENGTH, 0);
|
||||||
error = !tox_pass_key_decrypt((uint8_t*)data.data(), data.size(), pwsaltedkeys[ptMain],
|
error = !tox_pass_key_decrypt((uint8_t*)data.data(), data.size(), pwsaltedkeys[ptMain],
|
||||||
@ -248,7 +252,9 @@ void Core::checkEncryptedHistory()
|
|||||||
dialogtxt = tr("The chat history password failed. Please try another?", "used only when pw set before load() doesn't work");
|
dialogtxt = tr("The chat history password failed. Please try another?", "used only when pw set before load() doesn't work");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
dialogtxt = a;
|
dialogtxt = a;
|
||||||
|
}
|
||||||
|
|
||||||
dialogtxt += "\n" + c;
|
dialogtxt += "\n" + c;
|
||||||
|
|
||||||
@ -341,7 +347,9 @@ void Core::saveConfiguration(const QString& path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
tox_get_savedata(tox, data);
|
tox_get_savedata(tox, data);
|
||||||
|
}
|
||||||
|
|
||||||
configurationFile.write(reinterpret_cast<char *>(data), fileSize);
|
configurationFile.write(reinterpret_cast<char *>(data), fileSize);
|
||||||
configurationFile.commit();
|
configurationFile.commit();
|
||||||
|
@ -87,6 +87,7 @@ QString Friend::getDisplayedName() const
|
|||||||
{
|
{
|
||||||
if (userAlias.size() == 0)
|
if (userAlias.size() == 0)
|
||||||
return userName;
|
return userName;
|
||||||
|
|
||||||
return userAlias;
|
return userAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ void Group::regeneratePeerList()
|
|||||||
ToxID id = Core::getInstance()->getGroupPeerToxID(groupId, i);
|
ToxID id = Core::getInstance()->getGroupPeerToxID(groupId, i);
|
||||||
if (id.isMine())
|
if (id.isMine())
|
||||||
selfPeerNum = i;
|
selfPeerNum = i;
|
||||||
|
|
||||||
QString toxid = id.publicKey;
|
QString toxid = id.publicKey;
|
||||||
toxids[toxid] = peers[i];
|
toxids[toxid] = peers[i];
|
||||||
Friend *f = FriendList::findFriend(id);
|
Friend *f = FriendList::findFriend(id);
|
||||||
@ -177,9 +178,7 @@ QString Group::resolveToxID(const ToxID &id) const
|
|||||||
auto it = toxids.find(key);
|
auto it = toxids.find(key);
|
||||||
|
|
||||||
if (it != toxids.end())
|
if (it != toxids.end())
|
||||||
{
|
|
||||||
return *it;
|
return *it;
|
||||||
}
|
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,9 @@ HistoryKeeper *HistoryKeeper::getInstance()
|
|||||||
|
|
||||||
historyInstance = new HistoryKeeper(dbIntf);
|
historyInstance = new HistoryKeeper(dbIntf);
|
||||||
return historyInstance;
|
return historyInstance;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
path = getHistoryPath();
|
path = getHistoryPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,9 +113,7 @@ HistoryKeeper::HistoryKeeper(GenericDdInterface *db_) :
|
|||||||
QSqlQuery ret = db->exec("SELECT seq FROM sqlite_sequence WHERE name=\"sent_status\";");
|
QSqlQuery ret = db->exec("SELECT seq FROM sqlite_sequence WHERE name=\"sent_status\";");
|
||||||
int idCur = 0;
|
int idCur = 0;
|
||||||
if (ret.first())
|
if (ret.first())
|
||||||
{
|
|
||||||
idCur = ret.value(0).toInt();
|
idCur = ret.value(0).toInt();
|
||||||
}
|
|
||||||
|
|
||||||
if (idCur != idMax)
|
if (idCur != idMax)
|
||||||
{
|
{
|
||||||
@ -145,6 +145,7 @@ qint64 HistoryKeeper::addChatEntry(const QString& chat, const QString& message,
|
|||||||
db->exec("BEGIN TRANSACTION;");
|
db->exec("BEGIN TRANSACTION;");
|
||||||
for (auto &it : cmds)
|
for (auto &it : cmds)
|
||||||
db->exec(it);
|
db->exec(it);
|
||||||
|
|
||||||
db->exec("COMMIT TRANSACTION;");
|
db->exec("COMMIT TRANSACTION;");
|
||||||
|
|
||||||
messageID++;
|
messageID++;
|
||||||
@ -167,7 +168,9 @@ QList<HistoryKeeper::HistMessage> HistoryKeeper::getChatHistory(HistoryKeeper::C
|
|||||||
dbAnswer = db->exec(QString("SELECT history.id, timestamp, user_id, message, status FROM history LEFT JOIN sent_status ON history.id = sent_status.id ") +
|
dbAnswer = db->exec(QString("SELECT history.id, timestamp, user_id, message, status FROM history LEFT JOIN sent_status ON history.id = sent_status.id ") +
|
||||||
QString("INNER JOIN aliases ON history.sender = aliases.id AND timestamp BETWEEN %1 AND %2 AND chat_id = %3;")
|
QString("INNER JOIN aliases ON history.sender = aliases.id AND timestamp BETWEEN %1 AND %2 AND chat_id = %3;")
|
||||||
.arg(time64_from).arg(time64_to).arg(chat_id));
|
.arg(time64_from).arg(time64_to).arg(chat_id));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// no groupchats yet
|
// no groupchats yet
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,7 +375,8 @@ void HistoryKeeper::setSyncType(Db::syncType sType)
|
|||||||
{
|
{
|
||||||
QString syncCmd;
|
QString syncCmd;
|
||||||
|
|
||||||
switch (sType) {
|
switch (sType)
|
||||||
|
{
|
||||||
case Db::syncType::stFull:
|
case Db::syncType::stFull:
|
||||||
syncCmd = "FULL";
|
syncCmd = "FULL";
|
||||||
break;
|
break;
|
||||||
@ -413,5 +417,6 @@ QList<HistoryKeeper::HistMessage> HistoryKeeper::exportMessagesDeleteFile(int en
|
|||||||
qDebug() << "HistoryKeeper: count" << msgs.size() << "messages exported";
|
qDebug() << "HistoryKeeper: count" << msgs.size() << "messages exported";
|
||||||
if (!removeHistory(encrypted))
|
if (!removeHistory(encrypted))
|
||||||
qWarning() << "HistoryKeeper: couldn't delete old log file!";
|
qWarning() << "HistoryKeeper: couldn't delete old log file!";
|
||||||
|
|
||||||
return msgs;
|
return msgs;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,9 @@ EncryptedDb::EncryptedDb(const QString &fname, QList<QString> initList) :
|
|||||||
encrFile.close();
|
encrFile.close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
chunkPosition = 0;
|
chunkPosition = 0;
|
||||||
|
}
|
||||||
|
|
||||||
encrFile.setFileName(fileName);
|
encrFile.setFileName(fileName);
|
||||||
|
|
||||||
@ -90,7 +92,9 @@ bool EncryptedDb::pullFileContent(const QString &fname, QByteArray &buf)
|
|||||||
if (buf.size() > 0)
|
if (buf.size() > 0)
|
||||||
{
|
{
|
||||||
fileContent += buf;
|
fileContent += buf;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
qWarning() << "EncryptedDb::pullFileContent: Encrypted history log is corrupted: can't decrypt, will be deleted";
|
qWarning() << "EncryptedDb::pullFileContent: Encrypted history log is corrupted: can't decrypt, will be deleted";
|
||||||
buf = QByteArray();
|
buf = QByteArray();
|
||||||
return false;
|
return false;
|
||||||
@ -108,9 +112,8 @@ bool EncryptedDb::pullFileContent(const QString &fname, QByteArray &buf)
|
|||||||
|
|
||||||
PlainDb::exec("BEGIN TRANSACTION;");
|
PlainDb::exec("BEGIN TRANSACTION;");
|
||||||
for (auto line : sqlCmds)
|
for (auto line : sqlCmds)
|
||||||
{
|
|
||||||
QSqlQuery r = PlainDb::exec(line);
|
QSqlQuery r = PlainDb::exec(line);
|
||||||
}
|
|
||||||
PlainDb::exec("COMMIT TRANSACTION;");
|
PlainDb::exec("COMMIT TRANSACTION;");
|
||||||
|
|
||||||
dbFile.close();
|
dbFile.close();
|
||||||
@ -144,9 +147,8 @@ void EncryptedDb::appendToEncrypted(const QString &sql)
|
|||||||
|
|
||||||
QByteArray encr = Core::getInstance()->encryptData(buffer, Core::ptHistory);
|
QByteArray encr = Core::getInstance()->encryptData(buffer, Core::ptHistory);
|
||||||
if (encr.size() > 0)
|
if (encr.size() > 0)
|
||||||
{
|
|
||||||
encrFile.write(encr);
|
encrFile.write(encr);
|
||||||
}
|
|
||||||
encrFile.flush();
|
encrFile.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,10 +163,10 @@ bool EncryptedDb::check(const QString &fname)
|
|||||||
QByteArray encrChunk = file.read(encryptedChunkSize);
|
QByteArray encrChunk = file.read(encryptedChunkSize);
|
||||||
QByteArray buf = Core::getInstance()->decryptData(encrChunk, Core::ptHistory);
|
QByteArray buf = Core::getInstance()->decryptData(encrChunk, Core::ptHistory);
|
||||||
if (buf.size() == 0)
|
if (buf.size() == 0)
|
||||||
{
|
|
||||||
state = false;
|
state = false;
|
||||||
}
|
}
|
||||||
} else {
|
else
|
||||||
|
{
|
||||||
file.close();
|
file.close();
|
||||||
file.open(QIODevice::WriteOnly);
|
file.open(QIODevice::WriteOnly);
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ Settings& Settings::getInstance()
|
|||||||
{
|
{
|
||||||
if (!settings)
|
if (!settings)
|
||||||
settings = new Settings();
|
settings = new Settings();
|
||||||
|
|
||||||
return *settings;
|
return *settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +93,9 @@ QString Settings::detectProfile()
|
|||||||
{
|
{
|
||||||
profile = askProfiles();
|
profile = askProfiles();
|
||||||
if (profile.isEmpty())
|
if (profile.isEmpty())
|
||||||
|
{
|
||||||
return "";
|
return "";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switchProfile(profile);
|
switchProfile(profile);
|
||||||
@ -101,7 +104,9 @@ QString Settings::detectProfile()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
return path;
|
return path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QString> Settings::searchProfiles()
|
QList<QString> Settings::searchProfiles()
|
||||||
@ -112,6 +117,7 @@ QList<QString> Settings::searchProfiles()
|
|||||||
dir.setNameFilters(QStringList("*.tox"));
|
dir.setNameFilters(QStringList("*.tox"));
|
||||||
for (QFileInfo file : dir.entryInfoList())
|
for (QFileInfo file : dir.entryInfoList())
|
||||||
out += file.completeBaseName();
|
out += file.completeBaseName();
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +160,9 @@ void Settings::load()
|
|||||||
ps.endGroup();
|
ps.endGroup();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
makeToxPortable = false;
|
makeToxPortable = false;
|
||||||
|
}
|
||||||
|
|
||||||
QDir dir(getSettingsDirPath());
|
QDir dir(getSettingsDirPath());
|
||||||
QString filePath = dir.filePath(FILENAME);
|
QString filePath = dir.filePath(FILENAME);
|
||||||
@ -178,7 +186,8 @@ void Settings::load()
|
|||||||
useCustomDhtList = true;
|
useCustomDhtList = true;
|
||||||
qDebug() << "Using custom bootstrap nodes list";
|
qDebug() << "Using custom bootstrap nodes list";
|
||||||
int serverListSize = s.beginReadArray("dhtServerList");
|
int serverListSize = s.beginReadArray("dhtServerList");
|
||||||
for (int i = 0; i < serverListSize; i ++) {
|
for (int i = 0; i < serverListSize; i ++)
|
||||||
|
{
|
||||||
s.setArrayIndex(i);
|
s.setArrayIndex(i);
|
||||||
DhtServer server;
|
DhtServer server;
|
||||||
server.name = s.value("name").toString();
|
server.name = s.value("name").toString();
|
||||||
@ -190,7 +199,9 @@ void Settings::load()
|
|||||||
s.endArray();
|
s.endArray();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
useCustomDhtList=false;
|
useCustomDhtList=false;
|
||||||
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("General");
|
s.beginGroup("General");
|
||||||
@ -228,9 +239,9 @@ void Settings::load()
|
|||||||
|
|
||||||
s.beginGroup("Widgets");
|
s.beginGroup("Widgets");
|
||||||
QList<QString> objectNames = s.childKeys();
|
QList<QString> objectNames = s.childKeys();
|
||||||
for (const QString& name : objectNames) {
|
for (const QString& name : objectNames)
|
||||||
widgetSettings[name] = s.value(name).toByteArray();
|
widgetSettings[name] = s.value(name).toByteArray();
|
||||||
}
|
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("GUI");
|
s.beginGroup("GUI");
|
||||||
@ -283,7 +294,8 @@ void Settings::load()
|
|||||||
QSettings rcs(":/conf/settings.ini", QSettings::IniFormat);
|
QSettings rcs(":/conf/settings.ini", QSettings::IniFormat);
|
||||||
rcs.beginGroup("DHT Server");
|
rcs.beginGroup("DHT Server");
|
||||||
int serverListSize = rcs.beginReadArray("dhtServerList");
|
int serverListSize = rcs.beginReadArray("dhtServerList");
|
||||||
for (int i = 0; i < serverListSize; i ++) {
|
for (int i = 0; i < serverListSize; i ++)
|
||||||
|
{
|
||||||
rcs.setArrayIndex(i);
|
rcs.setArrayIndex(i);
|
||||||
DhtServer server;
|
DhtServer server;
|
||||||
server.name = rcs.value("name").toString();
|
server.name = rcs.value("name").toString();
|
||||||
@ -357,7 +369,8 @@ void Settings::saveGlobal(QString path)
|
|||||||
s.beginGroup("DHT Server");
|
s.beginGroup("DHT Server");
|
||||||
s.setValue("useCustomList", useCustomDhtList);
|
s.setValue("useCustomList", useCustomDhtList);
|
||||||
s.beginWriteArray("dhtServerList", dhtServerList.size());
|
s.beginWriteArray("dhtServerList", dhtServerList.size());
|
||||||
for (int i = 0; i < dhtServerList.size(); i ++) {
|
for (int i = 0; i < dhtServerList.size(); i ++)
|
||||||
|
{
|
||||||
s.setArrayIndex(i);
|
s.setArrayIndex(i);
|
||||||
s.setValue("name", dhtServerList[i].name);
|
s.setValue("name", dhtServerList[i].name);
|
||||||
s.setValue("userId", dhtServerList[i].userId);
|
s.setValue("userId", dhtServerList[i].userId);
|
||||||
@ -398,9 +411,9 @@ void Settings::saveGlobal(QString path)
|
|||||||
|
|
||||||
s.beginGroup("Widgets");
|
s.beginGroup("Widgets");
|
||||||
const QList<QString> widgetNames = widgetSettings.keys();
|
const QList<QString> widgetNames = widgetSettings.keys();
|
||||||
for (const QString& name : widgetNames) {
|
for (const QString& name : widgetNames)
|
||||||
s.setValue(name, widgetSettings.value(name));
|
s.setValue(name, widgetSettings.value(name));
|
||||||
}
|
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup("GUI");
|
s.beginGroup("GUI");
|
||||||
@ -505,12 +518,15 @@ QPixmap Settings::getSavedAvatar(const QString &ownerId)
|
|||||||
QString filePath = dir.filePath("avatar_"+ownerId.left(64));
|
QString filePath = dir.filePath("avatar_"+ownerId.left(64));
|
||||||
if (!QFileInfo(filePath).exists()) // try without truncation, for old self avatars
|
if (!QFileInfo(filePath).exists()) // try without truncation, for old self avatars
|
||||||
filePath = dir.filePath("avatar_"+ownerId);
|
filePath = dir.filePath("avatar_"+ownerId);
|
||||||
|
|
||||||
pic.load(filePath);
|
pic.load(filePath);
|
||||||
saveAvatar(pic, ownerId);
|
saveAvatar(pic, ownerId);
|
||||||
QFile::remove(filePath);
|
QFile::remove(filePath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pic.load(filePath);
|
pic.load(filePath);
|
||||||
|
}
|
||||||
return pic;
|
return pic;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,6 +546,7 @@ void Settings::saveAvatarHash(const QByteArray& hash, const QString& ownerId)
|
|||||||
QFile file(dir.filePath("avatars/"+ownerId.left(64)+".hash"));
|
QFile file(dir.filePath("avatars/"+ownerId.left(64)+".hash"));
|
||||||
if (!file.open(QIODevice::WriteOnly))
|
if (!file.open(QIODevice::WriteOnly))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
file.write(hash);
|
file.write(hash);
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
@ -541,6 +558,7 @@ QByteArray Settings::getAvatarHash(const QString& ownerId)
|
|||||||
QFile file(dir.filePath("avatars/"+ownerId.left(64)+".hash"));
|
QFile file(dir.filePath("avatars/"+ownerId.left(64)+".hash"));
|
||||||
if (!file.open(QIODevice::ReadOnly))
|
if (!file.open(QIODevice::ReadOnly))
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
|
||||||
QByteArray out = file.readAll();
|
QByteArray out = file.readAll();
|
||||||
file.close();
|
file.close();
|
||||||
return out;
|
return out;
|
||||||
@ -840,6 +858,7 @@ void Settings::setAutoAwayTime(int newValue)
|
|||||||
{
|
{
|
||||||
if (newValue < 0)
|
if (newValue < 0)
|
||||||
newValue = 10;
|
newValue = 10;
|
||||||
|
|
||||||
autoAwayTime = newValue;
|
autoAwayTime = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -849,9 +868,7 @@ QString Settings::getAutoAcceptDir(const ToxID& id) const
|
|||||||
|
|
||||||
auto it = friendLst.find(key);
|
auto it = friendLst.find(key);
|
||||||
if (it != friendLst.end())
|
if (it != friendLst.end())
|
||||||
{
|
|
||||||
return it->autoAcceptDir;
|
return it->autoAcceptDir;
|
||||||
}
|
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
@ -1110,9 +1127,7 @@ QString Settings::getFriendAdress(const QString &publicKey) const
|
|||||||
QString key = ToxID::fromString(publicKey).publicKey;
|
QString key = ToxID::fromString(publicKey).publicKey;
|
||||||
auto it = friendLst.find(key);
|
auto it = friendLst.find(key);
|
||||||
if (it != friendLst.end())
|
if (it != friendLst.end())
|
||||||
{
|
|
||||||
return it->addr;
|
return it->addr;
|
||||||
}
|
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
@ -1124,7 +1139,9 @@ void Settings::updateFriendAdress(const QString &newAddr)
|
|||||||
if (it != friendLst.end())
|
if (it != friendLst.end())
|
||||||
{
|
{
|
||||||
it->addr = newAddr;
|
it->addr = newAddr;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
friendProp fp;
|
friendProp fp;
|
||||||
fp.addr = newAddr;
|
fp.addr = newAddr;
|
||||||
fp.alias = "";
|
fp.alias = "";
|
||||||
@ -1138,9 +1155,7 @@ QString Settings::getFriendAlias(const ToxID &id) const
|
|||||||
QString key = id.publicKey;
|
QString key = id.publicKey;
|
||||||
auto it = friendLst.find(key);
|
auto it = friendLst.find(key);
|
||||||
if (it != friendLst.end())
|
if (it != friendLst.end())
|
||||||
{
|
|
||||||
return it->alias;
|
return it->alias;
|
||||||
}
|
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
@ -1152,7 +1167,9 @@ void Settings::setFriendAlias(const ToxID &id, const QString &alias)
|
|||||||
if (it != friendLst.end())
|
if (it != friendLst.end())
|
||||||
{
|
{
|
||||||
it->alias = alias;
|
it->alias = alias;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
friendProp fp;
|
friendProp fp;
|
||||||
fp.addr = key;
|
fp.addr = key;
|
||||||
fp.alias = alias;
|
fp.alias = alias;
|
||||||
|
@ -40,6 +40,7 @@ void Nexus::start()
|
|||||||
{
|
{
|
||||||
if (started)
|
if (started)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qDebug() << "Nexus: Starting up";
|
qDebug() << "Nexus: Starting up";
|
||||||
|
|
||||||
// Setup the environment
|
// Setup the environment
|
||||||
@ -139,6 +140,7 @@ Nexus& Nexus::getInstance()
|
|||||||
{
|
{
|
||||||
if (!nexus)
|
if (!nexus)
|
||||||
nexus = new Nexus;
|
nexus = new Nexus;
|
||||||
|
|
||||||
return *nexus;
|
return *nexus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,6 +170,7 @@ QString Nexus::getSupportedImageFilter()
|
|||||||
QString res;
|
QString res;
|
||||||
for (auto type : QImageReader::supportedImageFormats())
|
for (auto type : QImageReader::supportedImageFormats())
|
||||||
res += QString("*.%1 ").arg(QString(type));
|
res += QString("*.%1 ").arg(QString(type));
|
||||||
|
|
||||||
return tr("Images (%1)", "filetype filter").arg(res.left(res.size()-1));
|
return tr("Images (%1)", "filetype filter").arg(res.left(res.size()-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +91,7 @@ void OfflineMsgEngine::deliverOfflineMsgs()
|
|||||||
rec = Core::getInstance()->sendAction(f->getFriendID(), messageText);
|
rec = Core::getInstance()->sendAction(f->getFriendID(), messageText);
|
||||||
else
|
else
|
||||||
rec = Core::getInstance()->sendMessage(f->getFriendID(), messageText);
|
rec = Core::getInstance()->sendMessage(f->getFriendID(), messageText);
|
||||||
|
|
||||||
registerReceipt(rec, iter.key(), iter.value().msg);
|
registerReceipt(rec, iter.key(), iter.value().msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,16 +69,19 @@ ToxID Toxme::lookup(QString address)
|
|||||||
const int index = response.indexOf(pattern);
|
const int index = response.indexOf(pattern);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
response = response.mid(index+pattern.size());
|
response = response.mid(index+pattern.size());
|
||||||
|
|
||||||
const int idStart = response.indexOf('"');
|
const int idStart = response.indexOf('"');
|
||||||
if (idStart == -1)
|
if (idStart == -1)
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
response = response.mid(idStart+1);
|
response = response.mid(idStart+1);
|
||||||
|
|
||||||
const int idEnd = response.indexOf('"');
|
const int idEnd = response.indexOf('"');
|
||||||
if (idEnd == -1)
|
if (idEnd == -1)
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
response.truncate(idEnd);
|
response.truncate(idEnd);
|
||||||
|
|
||||||
id = ToxID::fromString(response);
|
id = ToxID::fromString(response);
|
||||||
@ -93,17 +96,20 @@ int Toxme::extractError(QString json)
|
|||||||
const int index = json.indexOf(pattern);
|
const int index = json.indexOf(pattern);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
return INT_MIN;
|
return INT_MIN;
|
||||||
|
|
||||||
json = json.mid(index+pattern.size());
|
json = json.mid(index+pattern.size());
|
||||||
|
|
||||||
const int end = json.indexOf('}');
|
const int end = json.indexOf('}');
|
||||||
if (end == -1)
|
if (end == -1)
|
||||||
return INT_MIN;
|
return INT_MIN;
|
||||||
|
|
||||||
json.truncate(end);
|
json.truncate(end);
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
int r = json.toInt(&ok);
|
int r = json.toInt(&ok);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
return INT_MIN;
|
return INT_MIN;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,16 +87,22 @@ void AddFriendForm::onSendTriggered()
|
|||||||
{
|
{
|
||||||
QString id = toxId.text().trimmed();
|
QString id = toxId.text().trimmed();
|
||||||
|
|
||||||
if (id.isEmpty()) {
|
if (id.isEmpty())
|
||||||
|
{
|
||||||
GUI::showWarning(tr("Couldn't add friend"), tr("Please fill in a valid Tox ID","Tox ID of the friend you're sending a friend request to"));
|
GUI::showWarning(tr("Couldn't add friend"), tr("Please fill in a valid Tox ID","Tox ID of the friend you're sending a friend request to"));
|
||||||
} else if (ToxID::isToxId(id)) {
|
}
|
||||||
|
else if (ToxID::isToxId(id))
|
||||||
|
{
|
||||||
if (id.toUpper() == Core::getInstance()->getSelfId().toString().toUpper())
|
if (id.toUpper() == Core::getInstance()->getSelfId().toString().toUpper())
|
||||||
GUI::showWarning(tr("Couldn't add friend"), tr("You can't add yourself as a friend!","When trying to add your own Tox ID as friend"));
|
GUI::showWarning(tr("Couldn't add friend"), tr("You can't add yourself as a friend!","When trying to add your own Tox ID as friend"));
|
||||||
else
|
else
|
||||||
emit friendRequested(id, getMessage());
|
emit friendRequested(id, getMessage());
|
||||||
|
|
||||||
this->toxId.clear();
|
this->toxId.clear();
|
||||||
this->message.clear();
|
this->message.clear();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (Settings::getInstance().getProxyType() != ProxyType::ptNone)
|
if (Settings::getInstance().getProxyType() != ProxyType::ptNone)
|
||||||
{
|
{
|
||||||
QMessageBox::StandardButton btn = QMessageBox::warning(main, "qTox", tr("qTox needs to use the Tox DNS, but can't do it through a proxy.\n\
|
QMessageBox::StandardButton btn = QMessageBox::warning(main, "qTox", tr("qTox needs to use the Tox DNS, but can't do it through a proxy.\n\
|
||||||
@ -123,7 +129,8 @@ void AddFriendForm::setIdFromClipboard()
|
|||||||
{
|
{
|
||||||
QClipboard* clipboard = QApplication::clipboard();
|
QClipboard* clipboard = QApplication::clipboard();
|
||||||
QString id = clipboard->text().trimmed();
|
QString id = clipboard->text().trimmed();
|
||||||
if (Core::getInstance()->isReady() && !id.isEmpty() && ToxID::isToxId(id)) {
|
if (Core::getInstance()->isReady() && !id.isEmpty() && ToxID::isToxId(id))
|
||||||
|
{
|
||||||
if (!ToxID::fromString(id).isMine())
|
if (!ToxID::fromString(id).isMine())
|
||||||
toxId.setText(id);
|
toxId.setText(id);
|
||||||
}
|
}
|
||||||
|
@ -157,6 +157,7 @@ void ChatForm::onTextEditChanged()
|
|||||||
{
|
{
|
||||||
if (isTyping)
|
if (isTyping)
|
||||||
Core::getInstance()->sendTyping(f->getFriendID(), false);
|
Core::getInstance()->sendTyping(f->getFriendID(), false);
|
||||||
|
|
||||||
isTyping = false;
|
isTyping = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -178,6 +179,7 @@ void ChatForm::onAttachClicked()
|
|||||||
QStringList paths = QFileDialog::getOpenFileNames(0,tr("Send a file"));
|
QStringList paths = QFileDialog::getOpenFileNames(0,tr("Send a file"));
|
||||||
if (paths.isEmpty())
|
if (paths.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (QString path : paths)
|
for (QString path : paths)
|
||||||
{
|
{
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
@ -269,6 +271,7 @@ void ChatForm::onAvInvite(uint32_t FriendId, int CallId, bool video)
|
|||||||
callConfirm = new CallConfirmWidget(videoButton);
|
callConfirm = new CallConfirmWidget(videoButton);
|
||||||
if (isVisible())
|
if (isVisible())
|
||||||
callConfirm->show();
|
callConfirm->show();
|
||||||
|
|
||||||
connect(callConfirm, &CallConfirmWidget::accepted, this, &ChatForm::onAnswerCallTriggered);
|
connect(callConfirm, &CallConfirmWidget::accepted, this, &ChatForm::onAnswerCallTriggered);
|
||||||
connect(callConfirm, &CallConfirmWidget::rejected, this, &ChatForm::onRejectCallTriggered);
|
connect(callConfirm, &CallConfirmWidget::rejected, this, &ChatForm::onRejectCallTriggered);
|
||||||
|
|
||||||
@ -283,6 +286,7 @@ void ChatForm::onAvInvite(uint32_t FriendId, int CallId, bool video)
|
|||||||
callConfirm = new CallConfirmWidget(callButton);
|
callConfirm = new CallConfirmWidget(callButton);
|
||||||
if (isVisible())
|
if (isVisible())
|
||||||
callConfirm->show();
|
callConfirm->show();
|
||||||
|
|
||||||
connect(callConfirm, &CallConfirmWidget::accepted, this, &ChatForm::onAnswerCallTriggered);
|
connect(callConfirm, &CallConfirmWidget::accepted, this, &ChatForm::onAnswerCallTriggered);
|
||||||
connect(callConfirm, &CallConfirmWidget::rejected, this, &ChatForm::onRejectCallTriggered);
|
connect(callConfirm, &CallConfirmWidget::rejected, this, &ChatForm::onRejectCallTriggered);
|
||||||
|
|
||||||
@ -534,13 +538,9 @@ void ChatForm::onAvMediaChange(uint32_t FriendId, int CallId, bool video)
|
|||||||
qDebug() << "onAvMediaChange";
|
qDebug() << "onAvMediaChange";
|
||||||
|
|
||||||
if (video)
|
if (video)
|
||||||
{
|
|
||||||
netcam->show(Core::getInstance()->getVideoSourceFromCall(CallId), f->getDisplayedName());
|
netcam->show(Core::getInstance()->getVideoSourceFromCall(CallId), f->getDisplayedName());
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
netcam->hide();
|
netcam->hide();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onAnswerCallTriggered()
|
void ChatForm::onAnswerCallTriggered()
|
||||||
@ -564,10 +564,8 @@ void ChatForm::onHangupCallTriggered()
|
|||||||
|
|
||||||
//Fixes an OS X bug with ending a call while in full screen
|
//Fixes an OS X bug with ending a call while in full screen
|
||||||
if(netcam->isFullScreen())
|
if(netcam->isFullScreen())
|
||||||
{
|
|
||||||
netcam->showNormal();
|
netcam->showNormal();
|
||||||
}
|
|
||||||
|
|
||||||
audioInputFlag = false;
|
audioInputFlag = false;
|
||||||
audioOutputFlag = false;
|
audioOutputFlag = false;
|
||||||
emit hangupCall(callId);
|
emit hangupCall(callId);
|
||||||
@ -588,9 +586,8 @@ void ChatForm::onRejectCallTriggered()
|
|||||||
audioInputFlag = false;
|
audioInputFlag = false;
|
||||||
audioOutputFlag = false;
|
audioOutputFlag = false;
|
||||||
emit rejectCall(callId);
|
emit rejectCall(callId);
|
||||||
|
|
||||||
enableCallButtons();
|
enableCallButtons();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatForm::onCallTriggered()
|
void ChatForm::onCallTriggered()
|
||||||
@ -631,7 +628,7 @@ void ChatForm::onAvCallFailed(uint32_t FriendId)
|
|||||||
void ChatForm::onCancelCallTriggered()
|
void ChatForm::onCancelCallTriggered()
|
||||||
{
|
{
|
||||||
qDebug() << "onCancelCallTriggered";
|
qDebug() << "onCancelCallTriggered";
|
||||||
|
|
||||||
enableCallButtons();
|
enableCallButtons();
|
||||||
|
|
||||||
netcam->hide();
|
netcam->hide();
|
||||||
@ -806,6 +803,7 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
|
|||||||
{
|
{
|
||||||
if (earliestMessage < since)
|
if (earliestMessage < since)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (earliestMessage < now)
|
if (earliestMessage < now)
|
||||||
{
|
{
|
||||||
now = earliestMessage;
|
now = earliestMessage;
|
||||||
|
@ -366,7 +366,9 @@ QString GenericChatForm::resolveToxID(const ToxID &id)
|
|||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
return f->getDisplayedName();
|
return f->getDisplayedName();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for (auto it : GroupList::getAllGroups())
|
for (auto it : GroupList::getAllGroups())
|
||||||
{
|
{
|
||||||
QString res = it->resolveToxID(id);
|
QString res = it->resolveToxID(id);
|
||||||
|
@ -110,10 +110,14 @@ void GroupChatForm::onSendTriggered()
|
|||||||
emit sendAction(group->getGroupId(), msg);
|
emit sendAction(group->getGroupId(), msg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
emit sendMessage(group->getGroupId(), msg);
|
emit sendMessage(group->getGroupId(), msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
addSelfMessage(msg, msg.startsWith("/me "), QDateTime::currentDateTime(), true);
|
addSelfMessage(msg, msg.startsWith("/me "), QDateTime::currentDateTime(), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupChatForm::onUserListChanged()
|
void GroupChatForm::onUserListChanged()
|
||||||
@ -150,6 +154,7 @@ void GroupChatForm::onUserListChanged()
|
|||||||
QLabel* label = orderizer[names[i]];
|
QLabel* label = orderizer[names[i]];
|
||||||
if (i != nNames - 1)
|
if (i != nNames - 1)
|
||||||
label->setText(label->text() + ", ");
|
label->setText(label->text() + ", ");
|
||||||
|
|
||||||
namesListLayout->addWidget(label);
|
namesListLayout->addWidget(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ void ProfileForm::refreshProfiles()
|
|||||||
bodyUI->profiles->clear();
|
bodyUI->profiles->clear();
|
||||||
for (QString profile : Settings::getInstance().searchProfiles())
|
for (QString profile : Settings::getInstance().searchProfiles())
|
||||||
bodyUI->profiles->addItem(profile);
|
bodyUI->profiles->addItem(profile);
|
||||||
|
|
||||||
QString current = Settings::getInstance().getCurrentProfile();
|
QString current = Settings::getInstance().getCurrentProfile();
|
||||||
if (current != "")
|
if (current != "")
|
||||||
bodyUI->profiles->setCurrentText(current);
|
bodyUI->profiles->setCurrentText(current);
|
||||||
@ -194,6 +195,7 @@ void ProfileForm::onAvatarClicked()
|
|||||||
Nexus::getSupportedImageFilter());
|
Nexus::getSupportedImageFilter());
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
file.open(QIODevice::ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
if (!file.isOpen())
|
if (!file.isOpen())
|
||||||
@ -254,6 +256,7 @@ void ProfileForm::onRenameClicked()
|
|||||||
Settings::getInstance().setCurrentProfile(name);
|
Settings::getInstance().setCurrentProfile(name);
|
||||||
if (resetAutorun)
|
if (resetAutorun)
|
||||||
Settings::getInstance().setAutorun(true); // fixes -p flag in autostart command line
|
Settings::getInstance().setAutorun(true); // fixes -p flag in autostart command line
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (true);
|
} while (true);
|
||||||
|
@ -52,6 +52,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
|||||||
bodyUI->cbEnableIPv6->setChecked(Settings::getInstance().getEnableIPv6());
|
bodyUI->cbEnableIPv6->setChecked(Settings::getInstance().getEnableIPv6());
|
||||||
for (int i = 0; i < langs.size(); i++)
|
for (int i = 0; i < langs.size(); i++)
|
||||||
bodyUI->transComboBox->insertItem(i, langs[i]);
|
bodyUI->transComboBox->insertItem(i, langs[i]);
|
||||||
|
|
||||||
bodyUI->transComboBox->setCurrentIndex(locales.indexOf(Settings::getInstance().getTranslation()));
|
bodyUI->transComboBox->setCurrentIndex(locales.indexOf(Settings::getInstance().getTranslation()));
|
||||||
bodyUI->cbAutorun->setChecked(Settings::getInstance().getAutorun());
|
bodyUI->cbAutorun->setChecked(Settings::getInstance().getAutorun());
|
||||||
#if defined(__APPLE__) && defined(__MACH__)
|
#if defined(__APPLE__) && defined(__MACH__)
|
||||||
@ -69,7 +70,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
|||||||
bodyUI->minimizeToTray->setEnabled(showSystemTray);
|
bodyUI->minimizeToTray->setEnabled(showSystemTray);
|
||||||
bodyUI->lightTrayIcon->setChecked(Settings::getInstance().getLightTrayIcon());
|
bodyUI->lightTrayIcon->setChecked(Settings::getInstance().getLightTrayIcon());
|
||||||
bodyUI->lightTrayIcon->setEnabled(showSystemTray);
|
bodyUI->lightTrayIcon->setEnabled(showSystemTray);
|
||||||
|
|
||||||
bodyUI->statusChanges->setChecked(Settings::getInstance().getStatusChangeNotificationEnabled());
|
bodyUI->statusChanges->setChecked(Settings::getInstance().getStatusChangeNotificationEnabled());
|
||||||
bodyUI->useEmoticons->setChecked(Settings::getInstance().getUseEmoticons());
|
bodyUI->useEmoticons->setChecked(Settings::getInstance().getUseEmoticons());
|
||||||
bodyUI->autoacceptFiles->setChecked(Settings::getInstance().getAutoSaveEnabled());
|
bodyUI->autoacceptFiles->setChecked(Settings::getInstance().getAutoSaveEnabled());
|
||||||
@ -83,9 +84,8 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
|||||||
bodyUI->cbGroupchatPosition->setChecked(Settings::getInstance().getGroupchatPosition());
|
bodyUI->cbGroupchatPosition->setChecked(Settings::getInstance().getGroupchatPosition());
|
||||||
|
|
||||||
for (auto entry : SmileyPack::listSmileyPacks())
|
for (auto entry : SmileyPack::listSmileyPacks())
|
||||||
{
|
|
||||||
bodyUI->smileyPackBrowser->addItem(entry.first, entry.second);
|
bodyUI->smileyPackBrowser->addItem(entry.first, entry.second);
|
||||||
}
|
|
||||||
bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack()));
|
bodyUI->smileyPackBrowser->setCurrentIndex(bodyUI->smileyPackBrowser->findData(Settings::getInstance().getSmileyPack()));
|
||||||
reloadSmiles();
|
reloadSmiles();
|
||||||
bodyUI->smileyPackBrowser->setEnabled(bodyUI->useEmoticons->isChecked());
|
bodyUI->smileyPackBrowser->setEnabled(bodyUI->useEmoticons->isChecked());
|
||||||
@ -99,6 +99,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
|||||||
|
|
||||||
for (QString color : Style::themeColorNames)
|
for (QString color : Style::themeColorNames)
|
||||||
bodyUI->themeColorCBox->addItem(color);
|
bodyUI->themeColorCBox->addItem(color);
|
||||||
|
|
||||||
bodyUI->themeColorCBox->setCurrentIndex(Settings::getInstance().getThemeColor());
|
bodyUI->themeColorCBox->setCurrentIndex(Settings::getInstance().getThemeColor());
|
||||||
|
|
||||||
bodyUI->emoticonSize->setValue(Settings::getInstance().getEmojiFontPointSize());
|
bodyUI->emoticonSize->setValue(Settings::getInstance().getEmojiFontPointSize());
|
||||||
@ -174,7 +175,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
|||||||
connect(bodyUI->cbFauxOfflineMessaging, &QCheckBox::stateChanged, this, &GeneralForm::onFauxOfflineMessaging);
|
connect(bodyUI->cbFauxOfflineMessaging, &QCheckBox::stateChanged, this, &GeneralForm::onFauxOfflineMessaging);
|
||||||
connect(bodyUI->cbCompactLayout, &QCheckBox::stateChanged, this, &GeneralForm::onCompactLayout);
|
connect(bodyUI->cbCompactLayout, &QCheckBox::stateChanged, this, &GeneralForm::onCompactLayout);
|
||||||
connect(bodyUI->cbGroupchatPosition, &QCheckBox::stateChanged, this, &GeneralForm::onGroupchatPositionChanged);
|
connect(bodyUI->cbGroupchatPosition, &QCheckBox::stateChanged, this, &GeneralForm::onGroupchatPositionChanged);
|
||||||
|
|
||||||
// prevent stealing mouse whell scroll
|
// prevent stealing mouse whell scroll
|
||||||
// scrolling event won't be transmitted to comboboxes or qspinboxes when scrolling
|
// scrolling event won't be transmitted to comboboxes or qspinboxes when scrolling
|
||||||
// you can scroll through general settings without accidentially chaning theme/skin/icons etc.
|
// you can scroll through general settings without accidentially chaning theme/skin/icons etc.
|
||||||
@ -331,11 +332,9 @@ void GeneralForm::onProxyAddrEdited()
|
|||||||
void GeneralForm::onProxyPortEdited(int port)
|
void GeneralForm::onProxyPortEdited(int port)
|
||||||
{
|
{
|
||||||
if (port > 0)
|
if (port > 0)
|
||||||
{
|
|
||||||
Settings::getInstance().setProxyPort(port);
|
Settings::getInstance().setProxyPort(port);
|
||||||
} else {
|
else
|
||||||
Settings::getInstance().setProxyPort(-1);
|
Settings::getInstance().setProxyPort(-1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralForm::onUseProxyUpdated()
|
void GeneralForm::onUseProxyUpdated()
|
||||||
|
@ -115,8 +115,10 @@ bool PrivacyForm::setChatLogsPassword()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (GUI::askQuestion(tr("Old encrypted chat history", "popup title"), tr("There is currently an unused encrypted chat history, but the password you just entered doesn't match.\n\nIf you don't care about the old history, you may delete it and use the password you just entered.\nOtherwise, hit Cancel to try again.", "This happens when enabling encryption after previously \"Disabling History\""), tr("Delete"), tr("Cancel")))
|
if (GUI::askQuestion(tr("Old encrypted chat history", "popup title"), tr("There is currently an unused encrypted chat history, but the password you just entered doesn't match.\n\nIf you don't care about the old history, you may delete it and use the password you just entered.\nOtherwise, hit Cancel to try again.", "This happens when enabling encryption after previously \"Disabling History\""), tr("Delete"), tr("Cancel")))
|
||||||
|
{
|
||||||
if (GUI::askQuestion(tr("Old encrypted chat history", "popup title"), tr("Are you absolutely sure you want to lose the unused encrypted chat history?", "secondary popup"), tr("Delete"), tr("Cancel")))
|
if (GUI::askQuestion(tr("Old encrypted chat history", "popup title"), tr("Are you absolutely sure you want to lose the unused encrypted chat history?", "secondary popup"), tr("Delete"), tr("Cancel")))
|
||||||
haveEncHist = false; // logically this is really just a `break`, but conceptually this is more accurate
|
haveEncHist = false; // logically this is really just a `break`, but conceptually this is more accurate
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (haveEncHist);
|
} while (haveEncHist);
|
||||||
|
|
||||||
|
@ -54,8 +54,10 @@ void TabCompleter::buildCompletionList()
|
|||||||
QRegExp regex(QString("^[-_\\[\\]{}|`^.\\\\]*").append(QRegExp::escape(tabAbbrev)), Qt::CaseInsensitive);
|
QRegExp regex(QString("^[-_\\[\\]{}|`^.\\\\]*").append(QRegExp::escape(tabAbbrev)), Qt::CaseInsensitive);
|
||||||
|
|
||||||
for (auto name : group->getPeerList())
|
for (auto name : group->getPeerList())
|
||||||
|
{
|
||||||
if (regex.indexIn(name) > -1)
|
if (regex.indexIn(name) > -1)
|
||||||
completionMap[name.toLower()] = name;
|
completionMap[name.toLower()] = name;
|
||||||
|
}
|
||||||
|
|
||||||
nextCompletion = completionMap.begin();
|
nextCompletion = completionMap.begin();
|
||||||
lastCompletionLength = tabAbbrev.length();
|
lastCompletionLength = tabAbbrev.length();
|
||||||
@ -64,12 +66,14 @@ void TabCompleter::buildCompletionList()
|
|||||||
|
|
||||||
void TabCompleter::complete()
|
void TabCompleter::complete()
|
||||||
{
|
{
|
||||||
if (!enabled) {
|
if (!enabled)
|
||||||
|
{
|
||||||
buildCompletionList();
|
buildCompletionList();
|
||||||
enabled = true;
|
enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextCompletion != completionMap.end()) {
|
if (nextCompletion != completionMap.end())
|
||||||
|
{
|
||||||
// clear previous completion
|
// clear previous completion
|
||||||
auto cur = msgEdit->textCursor();
|
auto cur = msgEdit->textCursor();
|
||||||
cur.setPosition(cur.selectionEnd());
|
cur.setPosition(cur.selectionEnd());
|
||||||
@ -85,13 +89,16 @@ void TabCompleter::complete()
|
|||||||
nextCompletion++;
|
nextCompletion++;
|
||||||
|
|
||||||
// we're completing the first word of the line
|
// we're completing the first word of the line
|
||||||
if (msgEdit->textCursor().position() == lastCompletionLength) {
|
if (msgEdit->textCursor().position() == lastCompletionLength)
|
||||||
|
{
|
||||||
msgEdit->insertPlainText(nickSuffix);
|
msgEdit->insertPlainText(nickSuffix);
|
||||||
lastCompletionLength += nickSuffix.length();
|
lastCompletionLength += nickSuffix.length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // we're at the end of the list -> start over again
|
else
|
||||||
if (!completionMap.isEmpty()) {
|
{ // we're at the end of the list -> start over again
|
||||||
|
if (!completionMap.isEmpty())
|
||||||
|
{
|
||||||
nextCompletion = completionMap.begin();
|
nextCompletion = completionMap.begin();
|
||||||
complete();
|
complete();
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,9 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent * event)
|
|||||||
if (selectedItem)
|
if (selectedItem)
|
||||||
{
|
{
|
||||||
if (selectedItem == quitGroup)
|
if (selectedItem == quitGroup)
|
||||||
|
{
|
||||||
emit removeGroup(groupId);
|
emit removeGroup(groupId);
|
||||||
|
}
|
||||||
else if (selectedItem == setTitle)
|
else if (selectedItem == setTitle)
|
||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
@ -77,7 +79,7 @@ void GroupWidget::contextMenuEvent(QContextMenuEvent * event)
|
|||||||
* element - title, the rest of the widget stays in the same CSS as it
|
* element - title, the rest of the widget stays in the same CSS as it
|
||||||
* was on mouse over. Repainting whole widget fixes style problem.”
|
* was on mouse over. Repainting whole widget fixes style problem.”
|
||||||
*/
|
*/
|
||||||
this->repaint();
|
this->repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,9 +42,7 @@ bool handleToxSave(const QString& path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (!core->isReady())
|
while (!core->isReady())
|
||||||
{
|
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
}
|
|
||||||
|
|
||||||
QFileInfo info(path);
|
QFileInfo info(path);
|
||||||
if (!info.exists())
|
if (!info.exists())
|
||||||
|
@ -51,9 +51,7 @@ bool handleToxURI(const QString &toxURI)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (!core->isReady())
|
while (!core->isReady())
|
||||||
{
|
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
}
|
|
||||||
|
|
||||||
QString toxaddr;
|
QString toxaddr;
|
||||||
if (toxURI.startsWith("tox://"))
|
if (toxURI.startsWith("tox://"))
|
||||||
|
@ -72,6 +72,7 @@ bool toxActivateEventHandler(const QByteArray&)
|
|||||||
{
|
{
|
||||||
if (!Widget::getInstance()->isActiveWindow())
|
if (!Widget::getInstance()->isActiveWindow())
|
||||||
Widget::getInstance()->forceShow();
|
Widget::getInstance()->forceShow();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,17 +133,17 @@ void Widget::init()
|
|||||||
ui->mainHead->layout()->setSpacing(0);
|
ui->mainHead->layout()->setSpacing(0);
|
||||||
|
|
||||||
ui->tooliconsZone->setStyleSheet(Style::resolve("QPushButton{background-color:@themeDark;border:none;}QPushButton:hover{background-color:@themeMediumDark;border:none;}"));
|
ui->tooliconsZone->setStyleSheet(Style::resolve("QPushButton{background-color:@themeDark;border:none;}QPushButton:hover{background-color:@themeMediumDark;border:none;}"));
|
||||||
|
|
||||||
if (QStyleFactory::keys().contains(Settings::getInstance().getStyle())
|
if (QStyleFactory::keys().contains(Settings::getInstance().getStyle())
|
||||||
&& Settings::getInstance().getStyle() != "None")
|
&& Settings::getInstance().getStyle() != "None")
|
||||||
{
|
{
|
||||||
ui->mainHead->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
|
ui->mainHead->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
|
||||||
ui->mainContent->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
|
ui->mainContent->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css"));
|
ui->mainHead->setStyleSheet(Style::getStylesheet(":ui/settings/mainHead.css"));
|
||||||
ui->mainContent->setStyleSheet(Style::getStylesheet(":ui/settings/mainContent.css"));
|
ui->mainContent->setStyleSheet(Style::getStylesheet(":ui/settings/mainContent.css"));
|
||||||
|
|
||||||
ui->statusHead->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css"));
|
ui->statusHead->setStyleSheet(Style::getStylesheet(":/ui/window/statusPanel.css"));
|
||||||
|
|
||||||
contactListWidget = new FriendListWidget(0, Settings::getInstance().getGroupchatPosition());
|
contactListWidget = new FriendListWidget(0, Settings::getInstance().getGroupchatPosition());
|
||||||
@ -171,7 +172,7 @@ void Widget::init()
|
|||||||
Style::setThemeColor(Settings::getInstance().getThemeColor());
|
Style::setThemeColor(Settings::getInstance().getThemeColor());
|
||||||
reloadTheme();
|
reloadTheme();
|
||||||
updateIcons();
|
updateIcons();
|
||||||
|
|
||||||
filesForm = new FilesForm();
|
filesForm = new FilesForm();
|
||||||
addFriendForm = new AddFriendForm;
|
addFriendForm = new AddFriendForm;
|
||||||
profileForm = new ProfileForm();
|
profileForm = new ProfileForm();
|
||||||
@ -265,7 +266,9 @@ void Widget::updateIcons()
|
|||||||
|
|
||||||
QString status;
|
QString status;
|
||||||
if (eventIcon)
|
if (eventIcon)
|
||||||
|
{
|
||||||
status = "event";
|
status = "event";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = ui->statusButton->property("status").toString();
|
status = ui->statusButton->property("status").toString();
|
||||||
@ -291,6 +294,7 @@ Widget::~Widget()
|
|||||||
AutoUpdater::abortUpdates();
|
AutoUpdater::abortUpdates();
|
||||||
if (icon)
|
if (icon)
|
||||||
icon->hide();
|
icon->hide();
|
||||||
|
|
||||||
hideMainForms();
|
hideMainForms();
|
||||||
delete profileForm;
|
delete profileForm;
|
||||||
delete settingsWidget;
|
delete settingsWidget;
|
||||||
@ -313,6 +317,7 @@ Widget* Widget::getInstance()
|
|||||||
|
|
||||||
if (!instance)
|
if (!instance)
|
||||||
instance = new Widget();
|
instance = new Widget();
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,9 +342,7 @@ void Widget::changeEvent(QEvent *event)
|
|||||||
if (event->type() == QEvent::WindowStateChange)
|
if (event->type() == QEvent::WindowStateChange)
|
||||||
{
|
{
|
||||||
if (isMinimized() && Settings::getInstance().getMinimizeToTray())
|
if (isMinimized() && Settings::getInstance().getMinimizeToTray())
|
||||||
{
|
|
||||||
this->hide();
|
this->hide();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +451,7 @@ void Widget::confirmExecutableOpen(const QFileInfo file)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The user wants to run this file, so make it executable and run it
|
// The user wants to run this file, so make it executable and run it
|
||||||
QFile(file.filePath()).setPermissions(file.permissions() | QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther);
|
QFile(file.filePath()).setPermissions(file.permissions() | QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther);
|
||||||
QProcess::startDetached(file.filePath());
|
QProcess::startDetached(file.filePath());
|
||||||
@ -531,13 +534,12 @@ void Widget::hideMainForms()
|
|||||||
QLayoutItem* item;
|
QLayoutItem* item;
|
||||||
while ((item = ui->mainHead->layout()->takeAt(0)) != 0)
|
while ((item = ui->mainHead->layout()->takeAt(0)) != 0)
|
||||||
item->widget()->hide();
|
item->widget()->hide();
|
||||||
|
|
||||||
while ((item = ui->mainContent->layout()->takeAt(0)) != 0)
|
while ((item = ui->mainContent->layout()->takeAt(0)) != 0)
|
||||||
item->widget()->hide();
|
item->widget()->hide();
|
||||||
|
|
||||||
if (activeChatroomWidget != nullptr)
|
if (activeChatroomWidget != nullptr)
|
||||||
{
|
|
||||||
activeChatroomWidget->setAsInactiveChatroom();
|
activeChatroomWidget->setAsInactiveChatroom();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::onUsernameChanged(const QString& newUsername, const QString& oldUsername)
|
void Widget::onUsernameChanged(const QString& newUsername, const QString& oldUsername)
|
||||||
@ -649,24 +651,21 @@ void Widget::onFriendStatusChanged(int friendId, Status status)
|
|||||||
if (isActualChange)
|
if (isActualChange)
|
||||||
{
|
{
|
||||||
if (f->getStatus() == Status::Offline)
|
if (f->getStatus() == Status::Offline)
|
||||||
{
|
|
||||||
contactListWidget->moveWidget(f->getFriendWidget(), Status::Online);
|
contactListWidget->moveWidget(f->getFriendWidget(), Status::Online);
|
||||||
}
|
|
||||||
else if (status == Status::Offline)
|
else if (status == Status::Offline)
|
||||||
{
|
|
||||||
contactListWidget->moveWidget(f->getFriendWidget(), Status::Offline);
|
contactListWidget->moveWidget(f->getFriendWidget(), Status::Offline);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
f->setStatus(status);
|
f->setStatus(status);
|
||||||
f->getFriendWidget()->updateStatusLight();
|
f->getFriendWidget()->updateStatusLight();
|
||||||
|
|
||||||
//won't print the message if there were no messages before
|
//won't print the message if there were no messages before
|
||||||
if (!f->getChatForm()->isEmpty()
|
if (!f->getChatForm()->isEmpty()
|
||||||
&& Settings::getInstance().getStatusChangeNotificationEnabled())
|
&& Settings::getInstance().getStatusChangeNotificationEnabled())
|
||||||
{
|
{
|
||||||
QString fStatus = "";
|
QString fStatus = "";
|
||||||
switch(f->getStatus()){
|
switch(f->getStatus())
|
||||||
|
{
|
||||||
case Status::Away:
|
case Status::Away:
|
||||||
fStatus = tr("away", "contact status"); break;
|
fStatus = tr("away", "contact status"); break;
|
||||||
case Status::Busy:
|
case Status::Busy:
|
||||||
@ -716,9 +715,8 @@ void Widget::onChatroomWidgetClicked(GenericChatroomWidget *widget)
|
|||||||
hideMainForms();
|
hideMainForms();
|
||||||
widget->setChatForm(*ui);
|
widget->setChatForm(*ui);
|
||||||
if (activeChatroomWidget != nullptr)
|
if (activeChatroomWidget != nullptr)
|
||||||
{
|
|
||||||
activeChatroomWidget->setAsInactiveChatroom();
|
activeChatroomWidget->setAsInactiveChatroom();
|
||||||
}
|
|
||||||
activeChatroomWidget = widget;
|
activeChatroomWidget = widget;
|
||||||
widget->setAsActiveChatroom();
|
widget->setAsActiveChatroom();
|
||||||
setWindowTitle(widget->getName());
|
setWindowTitle(widget->getName());
|
||||||
@ -757,6 +755,7 @@ void Widget::newMessageAlert(GenericChatroomWidget* chat)
|
|||||||
bool inactiveWindow = isMinimized() || !isActiveWindow();
|
bool inactiveWindow = isMinimized() || !isActiveWindow();
|
||||||
if (!inactiveWindow && activeChatroomWidget != nullptr && chat == activeChatroomWidget)
|
if (!inactiveWindow && activeChatroomWidget != nullptr && chat == activeChatroomWidget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ui->statusButton->property("status").toString() == "busy")
|
if (ui->statusButton->property("status").toString() == "busy")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -792,6 +791,7 @@ void Widget::playRingtone()
|
|||||||
{
|
{
|
||||||
if (ui->statusButton->property("status").toString() == "busy")
|
if (ui->statusButton->property("status").toString() == "busy")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QApplication::alert(this);
|
QApplication::alert(this);
|
||||||
|
|
||||||
static QFile sndFile1(":audio/ToxicIncomingCall.pcm"); // for whatever reason this plays slower/downshifted from what any other program plays the file as... but whatever
|
static QFile sndFile1(":audio/ToxicIncomingCall.pcm"); // for whatever reason this plays slower/downshifted from what any other program plays the file as... but whatever
|
||||||
@ -932,7 +932,9 @@ void Widget::onGroupNamelistChanged(int groupnumber, int peernumber, uint8_t Cha
|
|||||||
// g->getChatForm()->addSystemInfoMessage(tr("%1 has left the chat").arg(name), "white", QDateTime::currentDateTime());
|
// g->getChatForm()->addSystemInfoMessage(tr("%1 has left the chat").arg(name), "white", QDateTime::currentDateTime());
|
||||||
}
|
}
|
||||||
else if (change == TOX_CHAT_CHANGE_PEER_NAME) // core overwrites old name before telling us it changed...
|
else if (change == TOX_CHAT_CHANGE_PEER_NAME) // core overwrites old name before telling us it changed...
|
||||||
|
{
|
||||||
g->updatePeer(peernumber,Nexus::getCore()->getGroupPeerName(groupnumber, peernumber));
|
g->updatePeer(peernumber,Nexus::getCore()->getGroupPeerName(groupnumber, peernumber));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::onGroupTitleChanged(int groupnumber, const QString& author, const QString& title)
|
void Widget::onGroupTitleChanged(int groupnumber, const QString& author, const QString& title)
|
||||||
@ -1064,7 +1066,9 @@ void Widget::onUserAwayCheck()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (autoAwayActive)
|
else if (autoAwayActive)
|
||||||
|
{
|
||||||
autoAwayActive = false;
|
autoAwayActive = false;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1107,10 +1111,14 @@ void Widget::onTryCreateTrayIcon()
|
|||||||
setHidden(Settings::getInstance().getAutostartInTray());
|
setHidden(Settings::getInstance().getAutostartInTray());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
show();
|
show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!isVisible())
|
else if (!isVisible())
|
||||||
|
{
|
||||||
show();
|
show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1163,6 +1171,7 @@ void Widget::onFriendTypingChanged(int friendId, bool isTyping)
|
|||||||
Friend* f = FriendList::findFriend(friendId);
|
Friend* f = FriendList::findFriend(friendId);
|
||||||
if (!f)
|
if (!f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
f->getChatForm()->setFriendTyping(isTyping);
|
f->getChatForm()->setFriendTyping(isTyping);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1196,9 +1205,7 @@ void Widget::processOfflineMsgs()
|
|||||||
{
|
{
|
||||||
QList<Friend*> frnds = FriendList::getAllFriends();
|
QList<Friend*> frnds = FriendList::getAllFriends();
|
||||||
for (Friend *f : frnds)
|
for (Friend *f : frnds)
|
||||||
{
|
|
||||||
f->getChatForm()->getOfflineMsgEngine()->deliverOfflineMsgs();
|
f->getChatForm()->getOfflineMsgEngine()->deliverOfflineMsgs();
|
||||||
}
|
|
||||||
|
|
||||||
OfflineMsgEngine::globalMutex.unlock();
|
OfflineMsgEngine::globalMutex.unlock();
|
||||||
}
|
}
|
||||||
@ -1208,9 +1215,7 @@ void Widget::clearAllReceipts()
|
|||||||
{
|
{
|
||||||
QList<Friend*> frnds = FriendList::getAllFriends();
|
QList<Friend*> frnds = FriendList::getAllFriends();
|
||||||
for (Friend *f : frnds)
|
for (Friend *f : frnds)
|
||||||
{
|
|
||||||
f->getChatForm()->getOfflineMsgEngine()->removeAllReciepts();
|
f->getChatForm()->getOfflineMsgEngine()->removeAllReciepts();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::reloadTheme()
|
void Widget::reloadTheme()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user