Skip to content

Commit 5e1565b

Browse files
committed
Got nudge to work
1 parent 1a0cfc5 commit 5e1565b

File tree

8 files changed

+80
-41
lines changed

8 files changed

+80
-41
lines changed

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ build/
44
*.autosave
55
*.user
66

7-
# ========================== Bash
8-
*.sh
7+
# ========================== Project Root folder
8+
/*.bat
9+
/*.sh
10+
/*.lnk
11+

resources/#scripts/ZipRelease.bat

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@echo off
2+
set "sevenzip=C:\Program Files\7-Zip\7z.exe"
3+
set "windeployqt=C:\Qt\6.10.1\mingw_64\bin\windeployqt.exe"
4+
set "openssl=C:\Qt\Tools\OpenSSL-Win64"
5+
set "projectdir=E:\_qtprojects\LanMessenger"
6+
7+
8+
if not exist "%projectdir%\build\Release\LanMessenger.exe" (
9+
echo Error: Source executable not found.
10+
pause
11+
exit /b 1
12+
)
13+
14+
:: Build and Zip
15+
del /q /s "%projectdir%\build\Deployment\*" 2>nul
16+
copy /y "%projectdir%\build\Release\LanMessenger.exe" "%projectdir%\build\Deployment\LanMessenger.exe"
17+
if not exist "%projectdir%\build\Deployment" mkdir "%projectdir%\build\Deployment"
18+
"%windeployqt%" "%projectdir%\build\Deployment\LanMessenger.exe"
19+
if exist "%projectdir%\build\Deployment\translations" rd /s /q "%projectdir%\build\Deployment\translations"
20+
if exist "%projectdir%\build\Win64.zip" del "%projectdir%\build\Win64.zip"
21+
copy /y "%openssl%\libcrypto-3-x64.dll" "%projectdir%\build\Deployment\"
22+
copy /y "%openssl%\libssl-3-x64.dll" "%projectdir%\build\Deployment\"
23+
24+
"%sevenzip%" a "%projectdir%\build\Win64.zip" "%projectdir%\build\Deployment\"
25+
26+
27+
pause

sources/aformchat.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,16 @@ void lmFormChat::receiveMessage(MessageType type, QString* lpszUserId, MessageXm
166166
QString data;
167167

168168
switch(type) {
169-
case MT_Message:
169+
case MT_Message:{
170170
appendMessageLog(type, lpszUserId, &senderName, pMessage);
171+
bool isNudge = (pMessage->data(XN_NUDGE) == LM_TRUE);
171172
if(isHidden() || !isActiveWindow()) {
172-
pSoundPlayer->play(SE_NewMessage);
173+
if (!isNudge) pSoundPlayer->play(SE_NewMessage);
173174
title = tr("%1 says...");
174175
setWindowTitle(title.arg(senderName));
175176
}
176-
break;
177+
if (isNudge){ QTimer::singleShot(50, this, [this]() { nudge(); });} //Giving some time for the window to appear. otherwise it might spawn at 0,0
178+
break;}
177179
case MT_Broadcast:
178180
appendMessageLog(type, lpszUserId, &senderName, pMessage);
179181
if(isHidden() || !isActiveWindow()) {
@@ -569,6 +571,7 @@ void lmFormChat::nudge(bool send) {
569571
xmlMessage.addHeader(XN_TIME, QString::number(QDateTime::currentDateTime().toMSecsSinceEpoch()));
570572
xmlMessage.addData(XN_FONT, font.toString());
571573
xmlMessage.addData(XN_COLOR, messageColor.name());
574+
xmlMessage.addData(XN_NUDGE, LM_TRUE); //Sending Nudge Command within xml
572575
if(groupMode) {
573576
xmlMessage.addData(XN_THREAD, threadId);
574577
xmlMessage.addData(XN_GROUPMESSAGE, szMessage);
@@ -582,9 +585,6 @@ void lmFormChat::nudge(bool send) {
582585
QString userId = index.value();
583586
emit messageSent(type, &userId, &xmlMessage);
584587
index++;
585-
586-
//Nudge Command NEED2TEST Nudge
587-
588588
}
589589
}
590590
}

sources/aformsettings.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ void lmFormSettings::init(void) {
9494
pListItem->setCheckState(IDS_SOUNDEVENT_VAL);
9595
}
9696

97+
//=========================================================NEED2TEST Temporary
98+
ui.cboMicDevice->addItem("Default Communication Device",
99+
QVariant::fromValue(QMediaDevices::defaultAudioInput()));
100+
101+
const auto devices = QMediaDevices::audioInputs();
102+
for (const QAudioDevice &device : devices) {
103+
ui.cboMicDevice->addItem(device.description(), QVariant::fromValue(device));
104+
}
105+
106+
QCameraDevice defaultCam = QMediaDevices::defaultVideoInput();
107+
ui.cboCamDevice->addItem("Default Camera", QVariant::fromValue(defaultCam));
108+
109+
for (const QCameraDevice &camera : QMediaDevices::videoInputs()) {
110+
ui.cboCamDevice->addItem(camera.description(), QVariant::fromValue(camera));
111+
}
112+
//=========================================================
113+
97114
Themes themes = lmTheme::availableThemes();
98115
for(int index = 0; index < themes.count(); index++)
99116
ui.cboTheme->addItem(themes.at(index).name, themes.at(index).path);
@@ -108,7 +125,6 @@ void lmFormSettings::init(void) {
108125

109126
setWindowIcon(QIcon(IDR_APPICON));
110127

111-
112128
ui.lvCategories->setIconSize(QSize(32, 32));
113129
ui.lvCategories->item(0)->setIcon(ChatHelper::renderEmoji(Icons::GeneralSet,32));
114130
ui.lvCategories->item(1)->setIcon(ChatHelper::renderEmoji(Icons::AccountSet,32));

sources/aformsettings.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
#ifndef AFORMSETTINGS_H
2222
#define AFORMSETTINGS_H
2323

24+
#include <QMediaDevices>
25+
#include <QAudioDevice>
26+
#include <QCameraDevice>
27+
2428
#include <QRegularExpression>
2529
#include <QRegularExpressionValidator>
2630
#include <QDialog>
@@ -39,6 +43,7 @@
3943
#include "theme.h"
4044
#include "soundplayer.h"
4145

46+
4247
class lmFormSettings : public QDialog {
4348
Q_OBJECT
4449

sources/aformsettings.ui

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
<enum>QFrame::Shadow::Plain</enum>
116116
</property>
117117
<property name="currentIndex">
118-
<number>2</number>
118+
<number>3</number>
119119
</property>
120120
<widget class="QWidget" name="pageGeneral">
121121
<layout class="QVBoxLayout" name="verticalLayout_5">
@@ -968,6 +968,21 @@
968968
<height>0</height>
969969
</size>
970970
</property>
971+
<item>
972+
<property name="text">
973+
<string>Continuous Transmission</string>
974+
</property>
975+
</item>
976+
<item>
977+
<property name="text">
978+
<string>Push to Talk</string>
979+
</property>
980+
</item>
981+
<item>
982+
<property name="text">
983+
<string>Voice Activity Threshold</string>
984+
</property>
985+
</item>
971986
</widget>
972987
</item>
973988
<item row="2" column="0" colspan="2">
@@ -997,34 +1012,6 @@
9971012
</item>
9981013
</layout>
9991014
</item>
1000-
<item row="3" column="0">
1001-
<widget class="QCheckBox" name="chkAttenuation">
1002-
<property name="text">
1003-
<string>Attenuation</string>
1004-
</property>
1005-
</widget>
1006-
</item>
1007-
<item row="3" column="1">
1008-
<widget class="QCheckBox" name="chkCancellation">
1009-
<property name="text">
1010-
<string>Echo cancellation</string>
1011-
</property>
1012-
</widget>
1013-
</item>
1014-
<item row="4" column="0">
1015-
<widget class="QCheckBox" name="chkDenoise">
1016-
<property name="text">
1017-
<string>Denoise</string>
1018-
</property>
1019-
</widget>
1020-
</item>
1021-
<item row="4" column="1">
1022-
<widget class="QCheckBox" name="chkDucking">
1023-
<property name="text">
1024-
<string>Ducking</string>
1025-
</property>
1026-
</widget>
1027-
</item>
10281015
</layout>
10291016
</widget>
10301017
</item>
@@ -1082,8 +1069,8 @@
10821069
<widget class="QPushButton" name="pushButton_2">
10831070
<property name="minimumSize">
10841071
<size>
1085-
<width>320</width>
1086-
<height>180</height>
1072+
<width>300</width>
1073+
<height>169</height>
10871074
</size>
10881075
</property>
10891076
<property name="text">

sources/messagexml.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
#define XN_RELPATH "relpath"
8282
#define XN_FILECOUNT "filecount"
8383

84+
#define XN_NUDGE "nudge"
85+
8486
class MessageXml : public QDomDocument
8587
{
8688
public:

sources/theme.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ const Themes lmTheme::availableThemes(void) {
5252
/*
5353
themeData.inMsg = "/Content.html";
5454
themeData.inNextMsg = "/NextContent.html";
55-
5655
themeData.pubMsg = "/Broadcast.html";
5756
themeData.sysMsg = "/Status.html";
5857
themeData.stateMsg = "/Status.html";

0 commit comments

Comments
 (0)