|
|
|
@ -379,7 +379,7 @@ void MainWindow::setupSoundFromConfig() { |
|
|
|
m_recorder->configureCompressor(compCfg); |
|
|
|
m_recorder->configureCompressor(compCfg); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "AudioRecorder initialized (opusPreset=%d, compressor=%d)", |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "AudioRecorder initialized (opusPreset=%d, compressor=%d)", |
|
|
|
VoiceEncoder::preset(), |
|
|
|
VoiceEncoder::preset(), |
|
|
|
m_recorder->isCompressorEnabled() ? 1 : 0); |
|
|
|
m_recorder->isCompressorEnabled() ? 1 : 0); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -388,9 +388,13 @@ void MainWindow::setupSoundFromConfig() { |
|
|
|
void MainWindow::setupBridgeCallbacks() { |
|
|
|
void MainWindow::setupBridgeCallbacks() { |
|
|
|
s_mainWindow = this; |
|
|
|
s_mainWindow = this; |
|
|
|
gui_bridge_set_member_files_response_cb([](const uint8_t* data, int length) { |
|
|
|
gui_bridge_set_member_files_response_cb([](const uint8_t* data, int length) { |
|
|
|
|
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "member_files: GUI response route bytes=%d browser=%d", |
|
|
|
|
|
|
|
length, (int)(s_mainWindow && s_mainWindow->m_fileBrowser)); |
|
|
|
if (s_mainWindow && s_mainWindow->m_fileBrowser) s_mainWindow->m_fileBrowser->onResponse(data, length); |
|
|
|
if (s_mainWindow && s_mainWindow->m_fileBrowser) s_mainWindow->m_fileBrowser->onResponse(data, length); |
|
|
|
}); |
|
|
|
}); |
|
|
|
gui_bridge_set_member_files_transfer_cb([](const uint8_t* data, int length) { |
|
|
|
gui_bridge_set_member_files_transfer_cb([](const uint8_t* data, int length) { |
|
|
|
|
|
|
|
DEBUG_TRACE(DEBUG_CATEGORY_DEBUG, "member_files: GUI progress route bytes=%d browser=%d", |
|
|
|
|
|
|
|
length, (int)(s_mainWindow && s_mainWindow->m_fileBrowser)); |
|
|
|
if (s_mainWindow && s_mainWindow->m_fileBrowser) s_mainWindow->m_fileBrowser->onTransfer(data, length); |
|
|
|
if (s_mainWindow && s_mainWindow->m_fileBrowser) s_mainWindow->m_fileBrowser->onTransfer(data, length); |
|
|
|
}); |
|
|
|
}); |
|
|
|
gui_bridge_set_msg_received_cb(onMsgReceivedCallback); |
|
|
|
gui_bridge_set_msg_received_cb(onMsgReceivedCallback); |
|
|
|
@ -664,7 +668,7 @@ void MainWindow::onCallEnded(quint64 callId, uint8_t reason) { |
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::onCallError(quint64 callId, uint8_t err) { |
|
|
|
void MainWindow::onCallError(quint64 callId, uint8_t err) { |
|
|
|
/* пир офлайн / нет маршрута — звонок не состоялся */ |
|
|
|
/* пир офлайн / нет маршрута — звонок не состоялся */ |
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "MainWindow: call error id=%016llx err=%u", (unsigned long long)callId, (unsigned)err); |
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_CALL, "MainWindow: call error id=%016llx err=%u", (unsigned long long)callId, (unsigned)err); |
|
|
|
closeCallWindow(callId); |
|
|
|
closeCallWindow(callId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -927,7 +931,7 @@ void MainWindow::onMessageReceived(const char* ch_id, int ch_id_len, uint64_t au |
|
|
|
m_messageList->refresh(); |
|
|
|
m_messageList->refresh(); |
|
|
|
} else if (m_channelList) { |
|
|
|
} else if (m_channelList) { |
|
|
|
int unread = m_channelList->getChannelUnreadCount(cid) + 1; |
|
|
|
int unread = m_channelList->getChannelUnreadCount(cid) + 1; |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "MainWindow::onMessageReceived increment unread ch=%s %d->%d", |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_CHAT, "MainWindow::onMessageReceived increment unread ch=%s %d->%d", |
|
|
|
qPrintable(cid), unread - 1, unread); |
|
|
|
qPrintable(cid), unread - 1, unread); |
|
|
|
m_channelList->setChannelUnreadCount(cid, unread); |
|
|
|
m_channelList->setChannelUnreadCount(cid, unread); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1009,7 +1013,7 @@ void MainWindow::onCreateGroupRequested() { |
|
|
|
u_free(name_copy); |
|
|
|
u_free(name_copy); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "MainWindow: create group request posted name=%s", qPrintable(name)); |
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_CHAT, "MainWindow: create group request posted name=%s", qPrintable(name)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::showChannelSettings(const QString& channelId) { |
|
|
|
void MainWindow::showChannelSettings(const QString& channelId) { |
|
|
|
@ -1056,7 +1060,7 @@ void MainWindow::autoPlayCheckNewMessage(const QString& channelId) { |
|
|
|
QString fullPath = autoPlayMediaDir() + QStringLiteral("/") + channelId + QStringLiteral("/") + fp; |
|
|
|
QString fullPath = autoPlayMediaDir() + QStringLiteral("/") + channelId + QStringLiteral("/") + fp; |
|
|
|
if (QFile::exists(fullPath)) { |
|
|
|
if (QFile::exists(fullPath)) { |
|
|
|
m_autoPlayQueue.enqueue(item); |
|
|
|
m_autoPlayQueue.enqueue(item); |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "auto-play: enqueue ch=%s msg=%lld file=%s", |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "auto-play: enqueue ch=%s msg=%lld file=%s", |
|
|
|
qPrintable(channelId), (long long)msg.id, qPrintable(fullPath)); |
|
|
|
qPrintable(channelId), (long long)msg.id, qPrintable(fullPath)); |
|
|
|
if (!m_autoPlayTimer->isActive()) |
|
|
|
if (!m_autoPlayTimer->isActive()) |
|
|
|
m_autoPlayTimer->start(200); |
|
|
|
m_autoPlayTimer->start(200); |
|
|
|
@ -1078,7 +1082,7 @@ void MainWindow::autoPlayCheckNewMessage(const QString& channelId) { |
|
|
|
item.downloadStarted = true; |
|
|
|
item.downloadStarted = true; |
|
|
|
m_autoPlayQueue.enqueue(item); |
|
|
|
m_autoPlayQueue.enqueue(item); |
|
|
|
m_autoPlayDownloading.insert(msg.id); |
|
|
|
m_autoPlayDownloading.insert(msg.id); |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "auto-play: download started ch=%s msg=%lld", |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "auto-play: download started ch=%s msg=%lld", |
|
|
|
qPrintable(channelId), (long long)msg.id); |
|
|
|
qPrintable(channelId), (long long)msg.id); |
|
|
|
if (!m_autoPlayTimer->isActive()) |
|
|
|
if (!m_autoPlayTimer->isActive()) |
|
|
|
m_autoPlayTimer->start(200); |
|
|
|
m_autoPlayTimer->start(200); |
|
|
|
@ -1093,7 +1097,7 @@ void MainWindow::autoPlayTimerTick() { |
|
|
|
|
|
|
|
|
|
|
|
MessageRow msg = m_db->getMessageById(item.channelId, item.msgId); |
|
|
|
MessageRow msg = m_db->getMessageById(item.channelId, item.msgId); |
|
|
|
if (msg.id == 0) { |
|
|
|
if (msg.id == 0) { |
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "auto-play: msg %lld not found in DB, removing from queue", |
|
|
|
DEBUG_WARN(DEBUG_CATEGORY_MEDIA, "auto-play: msg %lld not found in DB, removing from queue", |
|
|
|
(long long)item.msgId); |
|
|
|
(long long)item.msgId); |
|
|
|
m_autoPlayQueue.dequeue(); |
|
|
|
m_autoPlayQueue.dequeue(); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
@ -1110,7 +1114,7 @@ void MainWindow::autoPlayTimerTick() { |
|
|
|
float dur = item.durationSec; |
|
|
|
float dur = item.durationSec; |
|
|
|
m_autoPlayQueue.dequeue(); |
|
|
|
m_autoPlayQueue.dequeue(); |
|
|
|
m_autoPlayDownloading.remove(msgId); |
|
|
|
m_autoPlayDownloading.remove(msgId); |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "auto-play: playing ch=%s msg=%lld file=%s dur=%.1fs", |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "auto-play: playing ch=%s msg=%lld file=%s dur=%.1fs", |
|
|
|
qPrintable(chId), (long long)msgId, qPrintable(fullPath), (double)dur); |
|
|
|
qPrintable(chId), (long long)msgId, qPrintable(fullPath), (double)dur); |
|
|
|
MessageDelegate::stopAllAutoPlay(); |
|
|
|
MessageDelegate::stopAllAutoPlay(); |
|
|
|
VoicePlayer::playOpusFile(fullPath, this, [fullPath](float actualDur, uint64_t playbackId) { |
|
|
|
VoicePlayer::playOpusFile(fullPath, this, [fullPath](float actualDur, uint64_t playbackId) { |
|
|
|
@ -1131,7 +1135,7 @@ void MainWindow::autoPlayTimerTick() { |
|
|
|
gui_bridge_post_uasync_fn(chat_core_attachment_download_trampoline, req); |
|
|
|
gui_bridge_post_uasync_fn(chat_core_attachment_download_trampoline, req); |
|
|
|
item.downloadStarted = true; |
|
|
|
item.downloadStarted = true; |
|
|
|
m_autoPlayDownloading.insert(item.msgId); |
|
|
|
m_autoPlayDownloading.insert(item.msgId); |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "auto-play: download started ch=%s msg=%lld (from queue)", |
|
|
|
DEBUG_DEBUG(DEBUG_CATEGORY_MEDIA, "auto-play: download started ch=%s msg=%lld (from queue)", |
|
|
|
qPrintable(item.channelId), (long long)item.msgId); |
|
|
|
qPrintable(item.channelId), (long long)item.msgId); |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
|
|