Browse Source

icons: replace emoji text with PNG resources + add media_dir debug logs

topo_upd
evgeny 2 months ago
parent
commit
3c75c8f687
  1. 6
      src/chat/chat_msg.c
  2. 5
      tools/chatgui/resources/chatgui.qrc
  3. BIN
      tools/chatgui/resources/icons/attach.png
  4. BIN
      tools/chatgui/resources/icons/emoji.png
  5. BIN
      tools/chatgui/resources/icons/mic.png
  6. BIN
      tools/chatgui/resources/icons/send.png
  7. 23
      tools/chatgui/src/inputbar.cpp

6
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;

5
tools/chatgui/resources/chatgui.qrc

@ -5,5 +5,10 @@
<file>animations/greeting.tgs</file>
<file>animations/stop.tgs</file>
<file>animations/robot.tgs</file>
<file>icons/attach.png</file>
<file>icons/emoji.png</file>
<file>icons/mic.png</file>
<file>icons/send.png</file>
<file>bg.jpg</file>
</qresource>
</RCC>

BIN
tools/chatgui/resources/icons/attach.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 B

BIN
tools/chatgui/resources/icons/emoji.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

BIN
tools/chatgui/resources/icons/mic.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

BIN
tools/chatgui/resources/icons/send.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

23
tools/chatgui/src/inputbar.cpp

@ -18,15 +18,18 @@
#include <QResizeEvent>
#include <QDir>
#include <QProgressBar>
#include <QIcon>
#include <cmath>
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();

Loading…
Cancel
Save