Enable original file attachments in the desktop PM composer
This commit is contained in:
1 parent
00f5fd2fe0
commit
bc6065f4ec
2 files changed
+21
-1
No files matched your search
@@ -273,10 +273,17 @@ void InputBar::onSendClicked() {
|
||||
}
|
||||
|
||||
void InputBar::setRecordingContext(const QString& mediaDirBase, const QString& channelId) {
|
||||
if (m_channelIdForRecord != channelId) clearPendingAttachment();
|
||||
m_mediaDirBase = mediaDirBase;
|
||||
m_channelIdForRecord = channelId;
|
||||
}
|
||||
|
||||
void InputBar::setDmMode(bool enabled) {
|
||||
m_dmMode = enabled;
|
||||
m_pttBtn->setEnabled(!enabled);
|
||||
m_attachBtn->setEnabled(true);
|
||||
}
|
||||
|
||||
void InputBar::setMediaEnabled(bool enabled) {
|
||||
if (m_pttBtn) m_pttBtn->setEnabled(enabled);
|
||||
if (m_attachBtn) m_attachBtn->setEnabled(enabled);
|
||||
@@ -353,6 +360,17 @@ void InputBar::onAttachClicked() {
|
||||
if (srcPath.isEmpty()) return;
|
||||
|
||||
QFileInfo fi(srcPath);
|
||||
if (m_dmMode) {
|
||||
m_pendingAttachSrc = srcPath;
|
||||
m_pendingAttachDest = srcPath;
|
||||
m_pendingAttachName = fi.fileName();
|
||||
m_pendingAttachSize = fi.size();
|
||||
m_pendingAttachAsVideo = m_pendingAttachAsImage = false;
|
||||
m_attachPreviewLabel->setText(QString::fromUtf8("📎 %1 (%2)").arg(fi.fileName(), formatFileSize(fi.size())));
|
||||
m_attachPreview->show();
|
||||
GUI_INFO("InputBar: PM attachment selected name=%s bytes=%lld", qPrintable(fi.fileName()), (long long)fi.size());
|
||||
return;
|
||||
}
|
||||
if (fi.size() == 0) { DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "InputBar::onAttachClicked: empty file"); return; }
|
||||
|
||||
QString mediaPath = m_mediaDirBase + "/" + m_channelIdForRecord;
|
||||
|
||||
@@ -18,7 +18,8 @@ public:
|
||||
|
||||
void setRecordingContext(const QString& mediaDirBase, const QString& channelId);
|
||||
|
||||
/* Включить/выключить медиа-кнопки (PTT/attach). Для DM (text-only) — выключить. */
|
||||
/* DM использует прикрепление оригинального файла без канальной подготовки. */
|
||||
void setDmMode(bool enabled);
|
||||
void setMediaEnabled(bool enabled);
|
||||
|
||||
signals:
|
||||
@@ -65,6 +66,7 @@ private:
|
||||
QLabel *m_attachPreviewLabel = nullptr;
|
||||
QPushButton *m_attachClearBtn = nullptr;
|
||||
bool m_pttActive = false;
|
||||
bool m_dmMode = false;
|
||||
QString m_voiceFilePath;
|
||||
QString m_mediaDirBase;
|
||||
QString m_channelIdForRecord;
|
||||
|
||||
Reference in new issue
Block a user