Skip to content

Commit 4fe3873

Browse files
committed
- Play a bell sound when the Terminal tab is asking for the user
password.
1 parent d984e11 commit 4fe3873

File tree

6 files changed

+22
-1
lines changed

6 files changed

+22
-1
lines changed

CHANGELOG

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
0.17 (dev)
22
BugFix: Code for EndeavourOS news was incomplete (thanks to LegitGreenBoi).
33
BugFix: Help msg for newer packages was wrong because they're not installed.
4+
Play a bell sound when the Terminal tab is asking for the user password.
45
Improvement: Show a "Collecting transaction data..." msg before presenting the transaction
56
dialog, as it can be quite slow on some systems (thanks to Valdir).
67
Updated translations.

octopi.pro

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
#-------------------------------------------------
66

7-
QT += core gui network xml widgets
7+
QT += core gui network xml widgets multimedia
88
DEFINES += OCTOPI_EXTENSIONS ALPM_BACKEND
99

1010
# Disable automatic string conversions

resources.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,6 @@
9898
<file>resources/translations/octopi_zh-Hans.qm</file>
9999
<file>resources/translations/octopi_zh_CN.qm</file>
100100
<file>resources/translations/octopi_ko.qm</file>
101+
<file>resources/sounds/bell.wav</file>
101102
</qresource>
102103
</RCC>

resources/sounds/bell.wav

346 KB
Binary file not shown.

src/termwidget.cpp

+18
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <QMessageBox>
2929
#include <QAbstractButton>
3030
#include <QRegularExpression>
31+
#include <QSoundEffect>
3132
//#include <QDebug>
3233

3334
/*
@@ -142,6 +143,10 @@ void TermWidget::parseOutput(QString str)
142143
{
143144
emit onKeyQuit();
144145
}
146+
else if (str.contains(QLatin1String("password for ") + QLatin1String(qgetenv("USER")) + QLatin1String(":")))
147+
{
148+
playBellSound();
149+
}
145150
}
146151

147152
/*
@@ -214,6 +219,19 @@ void TermWidget::onZoomOut()
214219
if (m_zoomFactor != 0) SettingsManager::setConsoleFontSize(m_zoomFactor);
215220
}
216221

222+
/*
223+
* Plays a bell sound which is encoded in the resource file
224+
*/
225+
void TermWidget::playBellSound()
226+
{
227+
QSoundEffect *se = new QSoundEffect(this);
228+
se->setSource(QUrl::fromLocalFile(QLatin1String(":/resources/sounds/bell.wav")));
229+
se->setLoopCount(3);
230+
se->setMuted(false);
231+
se->setVolume(1.0f);
232+
se->play();
233+
}
234+
217235
/*
218236
* Paste code extracted from project "lxqt/qterminal"
219237
*/

src/termwidget.h

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ private slots:
5353

5454
public:
5555
explicit TermWidget(QWidget *parent);
56+
void playBellSound();
5657
void execute(QString command);
5758
void enter();
5859

0 commit comments

Comments
 (0)