chatgui/chatgui-android: просмотр изображений с зумом + инфо о медиа
- chatgui: просмотрщик изображений (ImageViewerWindow) с зумом/поворотом - chatgui: отправка картинок как image с определением разрешения и типа - chatgui: у видео-пузыря строка info (res·size·bitrate) и бейдж только длительность - chatgui: контекстное меню медиа (сохранить в файл/скачать) - chatgui-android: большие emoji-only сообщения, битрейт/разрешение у видео - chatgui-android: сохранение неактивных интерфейсов как закомментированные секции - chatgui-android: отправка картинок по расширению (jpg/png/gif/bmp/webp) - photo_sender: content-type и расширение по типу файла
This commit is contained in:
1 parent
ca16b46404
commit
c474c37284
17 files changed
+854
-66
No files matched your search
@@ -28,6 +28,12 @@ extern "C" {
|
||||
#include "video/video.h"
|
||||
}
|
||||
|
||||
static bool isImageFile(const QString& suffix) {
|
||||
QString s = suffix.toLower();
|
||||
return s == "jpg" || s == "jpeg" || s == "png" || s == "gif" ||
|
||||
s == "bmp" || s == "webp";
|
||||
}
|
||||
|
||||
static QPushButton *makeIconBtn(const QIcon& icon, const QString &tooltip, QWidget *parent) {
|
||||
auto *btn = new QPushButton(parent);
|
||||
btn->setIcon(icon);
|
||||
@@ -236,7 +242,11 @@ void InputBar::onSendClicked() {
|
||||
if (!hasAttach && text.isEmpty()) return;
|
||||
|
||||
if (hasAttach) {
|
||||
if (m_pendingAttachAsVideo) {
|
||||
if (m_pendingAttachAsImage) {
|
||||
GUI_INFO("send: image=%s name=%s", qPrintable(m_pendingAttachSrc), qPrintable(m_pendingAttachName));
|
||||
emit sendImageAttachment(m_pendingAttachSrc, m_pendingAttachDest, m_pendingAttachName);
|
||||
m_attachPreview->hide();
|
||||
} else if (m_pendingAttachAsVideo) {
|
||||
GUI_INFO("send: video=%s name=%s", qPrintable(m_pendingAttachSrc), qPrintable(m_pendingAttachName));
|
||||
emit sendVideoAttachment(m_pendingAttachSrc, m_pendingAttachDest, m_pendingAttachName);
|
||||
m_attachPreviewLabel->setText(QString::fromUtf8("\xF0\x9F\x8E\xAC Перекодирование… 0%"));
|
||||
@@ -252,6 +262,7 @@ void InputBar::onSendClicked() {
|
||||
m_pendingAttachName.clear();
|
||||
m_pendingAttachSize = 0;
|
||||
m_pendingAttachAsVideo = false;
|
||||
m_pendingAttachAsImage = false;
|
||||
}
|
||||
if (!text.isEmpty()) {
|
||||
emit sendMessage(text);
|
||||
@@ -347,8 +358,9 @@ void InputBar::onAttachClicked() {
|
||||
QString ts = now.toString("yyyyMMdd-HHmmss");
|
||||
int rnd = rand() & 0xFFFF;
|
||||
|
||||
bool asImage = isImageFile(fi.suffix());
|
||||
bool asVideo = false;
|
||||
if (video_probe(srcPath.toUtf8().constData())) {
|
||||
if (!asImage && video_probe(srcPath.toUtf8().constData())) {
|
||||
QMessageBox box(this);
|
||||
box.setWindowTitle(QString::fromUtf8("Отправить видео"));
|
||||
box.setText(QString::fromUtf8("Файл содержит видео. Как отправить?"));
|
||||
@@ -378,14 +390,15 @@ void InputBar::onAttachClicked() {
|
||||
m_pendingAttachName = fi.fileName();
|
||||
m_pendingAttachSize = fi.size();
|
||||
m_pendingAttachAsVideo = asVideo;
|
||||
m_pendingAttachAsImage = asImage;
|
||||
|
||||
QString labelText = QString::fromUtf8("\xF0\x9F\x93\x8E %1 (%2)")
|
||||
.arg(fi.fileName(), formatFileSize(fi.size()));
|
||||
m_attachPreviewLabel->setText(labelText);
|
||||
m_attachPreview->show();
|
||||
|
||||
GUI_INFO("InputBar::onAttachClicked: pending %s size=%lld video=%d",
|
||||
qPrintable(srcPath), (long long)fi.size(), asVideo ? 1 : 0);
|
||||
GUI_INFO("InputBar::onAttachClicked: pending %s size=%lld video=%d image=%d",
|
||||
qPrintable(srcPath), (long long)fi.size(), asVideo ? 1 : 0, asImage ? 1 : 0);
|
||||
}
|
||||
|
||||
void InputBar::clearPendingAttachment() {
|
||||
@@ -394,6 +407,7 @@ void InputBar::clearPendingAttachment() {
|
||||
m_pendingAttachName.clear();
|
||||
m_pendingAttachSize = 0;
|
||||
m_pendingAttachAsVideo = false;
|
||||
m_pendingAttachAsImage = false;
|
||||
m_videoProgressTimer->stop();
|
||||
m_attachPreview->hide();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user