diff --git a/src/chat/chat_msg.c b/src/chat/chat_msg.c index f44fe5a1..20f71fba 100644 --- a/src/chat/chat_msg.c +++ b/src/chat/chat_msg.c @@ -97,6 +97,9 @@ static void chat_core_submit_media_message(struct chat_msg_submit* req) { CC_ID, req->channel_id, req->content_type, req->media_dt, req->media_basename, req->media_ext, req->media_num_blocks); + DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: db_path='%s' initialized=%d", + CC_ID, g_cc.db_path, g_cc.initialized); + struct DB_SYNC_INSTANCE* si = si_find(req->channel_id); if (!si) { DEBUG_ERROR(DEBUG_CATEGORY_DB_SYNC, "%s: no db_sync instance for ch=%s", CC_ID, req->channel_id); return; } @@ -112,6 +115,9 @@ static void chat_core_submit_media_message(struct chat_msg_submit* req) { snprintf(media_dir, sizeof(media_dir), "%s/media/%s", g_cc.db_path, req->channel_id); } + DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: media_dir='%s' dt='%s' stem='%s' ext='%s'", + CC_ID, media_dir, req->media_dt, req->media_basename, req->media_ext); + uint32_t num_blocks = req->media_num_blocks; uint64_t block_size = 0; uint64_t file_size = 0; diff --git a/tools/chatgui/resources/chatgui.qrc b/tools/chatgui/resources/chatgui.qrc index 24f828e8..dcda5edc 100644 --- a/tools/chatgui/resources/chatgui.qrc +++ b/tools/chatgui/resources/chatgui.qrc @@ -5,5 +5,10 @@ animations/greeting.tgs animations/stop.tgs animations/robot.tgs + icons/attach.png + icons/emoji.png + icons/mic.png + icons/send.png + bg.jpg diff --git a/tools/chatgui/resources/icons/attach.png b/tools/chatgui/resources/icons/attach.png new file mode 100644 index 00000000..7c8d545e Binary files /dev/null and b/tools/chatgui/resources/icons/attach.png differ diff --git a/tools/chatgui/resources/icons/emoji.png b/tools/chatgui/resources/icons/emoji.png new file mode 100644 index 00000000..686ba3fd Binary files /dev/null and b/tools/chatgui/resources/icons/emoji.png differ diff --git a/tools/chatgui/resources/icons/mic.png b/tools/chatgui/resources/icons/mic.png new file mode 100644 index 00000000..d5b72063 Binary files /dev/null and b/tools/chatgui/resources/icons/mic.png differ diff --git a/tools/chatgui/resources/icons/send.png b/tools/chatgui/resources/icons/send.png new file mode 100644 index 00000000..5c1f97e6 Binary files /dev/null and b/tools/chatgui/resources/icons/send.png differ diff --git a/tools/chatgui/src/inputbar.cpp b/tools/chatgui/src/inputbar.cpp index b22b72fa..a6ae5496 100644 --- a/tools/chatgui/src/inputbar.cpp +++ b/tools/chatgui/src/inputbar.cpp @@ -18,15 +18,18 @@ #include #include #include +#include #include -static QPushButton *makeIconBtn(const QString &text, const QString &tooltip, QWidget *parent) { - auto *btn = new QPushButton(text, parent); +static QPushButton *makeIconBtn(const QIcon& icon, const QString &tooltip, QWidget *parent) { + auto *btn = new QPushButton(parent); + btn->setIcon(icon); + btn->setIconSize(QSize(20, 20)); btn->setFixedSize(34, 34); btn->setCursor(Qt::PointingHandCursor); btn->setToolTip(tooltip); btn->setStyleSheet( - "QPushButton { border: none; border-radius: 4px; font-size: 18px; background: transparent; }" + "QPushButton { border: none; border-radius: 4px; background: transparent; }" "QPushButton:hover { background: palette(light); }" ); return btn; @@ -54,7 +57,7 @@ InputBar::InputBar(EmojiPanel *emojiPanel, AudioRecorder *recorder, QWidget *par layout->setContentsMargins(8, 4, 8, 4); layout->setSpacing(4); - m_attachBtn = makeIconBtn(QString::fromUtf8("\xF0\x9F\x93\x8E"), + m_attachBtn = makeIconBtn(QIcon(":/icons/attach.png"), QString::fromUtf8("Прикрепить"), this); connect(m_attachBtn, &QPushButton::clicked, this, &InputBar::onAttachClicked); layout->addWidget(wrapBottomBtn(m_attachBtn, 3), 0, Qt::AlignBottom); @@ -72,18 +75,18 @@ InputBar::InputBar(EmojiPanel *emojiPanel, AudioRecorder *recorder, QWidget *par m_input->setFixedHeight(fm.lineSpacing() + 12); layout->addWidget(m_input, 1); - m_emojiBtn = makeIconBtn(QString::fromUtf8("\xF0\x9F\x99\x82"), + m_emojiBtn = makeIconBtn(QIcon(":/icons/emoji.png"), QString::fromUtf8("Смайлики"), this); layout->addWidget(wrapBottomBtn(m_emojiBtn, 3), 0, Qt::AlignBottom); - m_pttBtn = makeIconBtn(QString::fromUtf8("\xF0\x9F\x8E\xA4"), + m_pttBtn = makeIconBtn(QIcon(":/icons/mic.png"), QString::fromUtf8("Голосовое сообщение (удерживайте)"), this); layout->addWidget(wrapBottomBtn(m_pttBtn, 3), 0, Qt::AlignBottom); - auto *sendBtn = makeIconBtn(QString::fromUtf8("\xE2\x9E\xA4"), + auto *sendBtn = makeIconBtn(QIcon(":/icons/send.png"), QString::fromUtf8("Отправить"), this); sendBtn->setStyleSheet(sendBtn->styleSheet() + - "QPushButton { color: palette(highlight); font-weight: bold; }"); + "QPushButton { border: 1px solid palette(highlight); }"); layout->addWidget(sendBtn, 0, Qt::AlignBottom); connect(m_input, &QTextEdit::textChanged, this, &InputBar::adjustInputHeight); @@ -203,7 +206,7 @@ void InputBar::onPttPressed() { m_recorder->startRecording(); m_pttActive = true; m_pttBtn->setStyleSheet(m_pttBtn->styleSheet() + - "QPushButton { background: #e74c3c; color: white; border-radius: 4px; }"); + "QPushButton { background: #e74c3c; border-radius: 4px; }"); } void InputBar::onPttReleased() { @@ -211,7 +214,7 @@ void InputBar::onPttReleased() { m_pttActive = false; m_recorder->stopRecording(); m_pttBtn->setStyleSheet( - "QPushButton { border: none; border-radius: 4px; font-size: 18px; background: transparent; }" + "QPushButton { border: none; border-radius: 4px; background: transparent; }" "QPushButton:hover { background: palette(light); }"); int durationMs = m_recorder->durationMs();