diff --git a/AppVeyor/make_installer.sh b/AppVeyor/make_installer.sh
index 77e80de..55941d9 100644
--- a/AppVeyor/make_installer.sh
+++ b/AppVeyor/make_installer.sh
@@ -35,6 +35,7 @@ addFile /c/Qt/5.9/mingw53_32/bin/Qt5Network.dll
addFile /c/Qt/5.9/mingw53_32/bin/Qt5Gui.dll
addFile /c/Qt/5.9/mingw53_32/bin/Qt5Widgets.dll
addFile /c/Qt/5.9/mingw53_32/bin/Qt5WinExtras.dll
+addFile /c/Qt/5.9/mingw53_32/bin/Qt5Multimedia.dll
addFileIn /c/Qt/5.9/mingw53_32/plugins/platforms/qwindows.dll platforms
diff --git a/README.md b/README.md
index f6037d0..ba3dbc2 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,7 @@ Please note that KShare is not compatiable with Wayland due to some permission i
* Qt 5 Widgets
* Qt 5 GUI
* Qt 5 Network
+* Qt 5 Multimedia
* Qt 5 X11Extras | Winextras
* [QHotkey](https://github.com/Skycoder42/QHotkey)
* libavformat
diff --git a/src/sounds.qrc b/src/sounds.qrc
new file mode 100644
index 0000000..882c4d7
--- /dev/null
+++ b/src/sounds.qrc
@@ -0,0 +1,7 @@
+
+
+ sounds/CaptureSound.wav
+ sounds/ErrorSound.wav
+ sounds/TaskCompletedSound.wav
+
+
diff --git a/src/sounds/CaptureSound.wav b/src/sounds/CaptureSound.wav
new file mode 100644
index 0000000..20191c9
Binary files /dev/null and b/src/sounds/CaptureSound.wav differ
diff --git a/src/sounds/ErrorSound.wav b/src/sounds/ErrorSound.wav
new file mode 100644
index 0000000..3877d07
Binary files /dev/null and b/src/sounds/ErrorSound.wav differ
diff --git a/src/sounds/TaskCompletedSound.wav b/src/sounds/TaskCompletedSound.wav
new file mode 100644
index 0000000..e19a75e
Binary files /dev/null and b/src/sounds/TaskCompletedSound.wav differ
diff --git a/src/src.pro b/src/src.pro
index 8a3e680..75fb9d3 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -4,7 +4,7 @@
#
#-------------------------------------------------
-QT += core gui network widgets svg
+QT += core gui network widgets svg multimedia
TARGET = kshare
TEMPLATE = app
@@ -191,6 +191,7 @@ FORMS += mainwindow.ui \
RESOURCES += \
icon.qrc \
+ sounds.qrc \
translations.qrc
QMAKE_CFLAGS_DEBUG += -g
diff --git a/src/uploaders/uploadersingleton.cpp b/src/uploaders/uploadersingleton.cpp
index 0b4426a..f12b21d 100644
--- a/src/uploaders/uploadersingleton.cpp
+++ b/src/uploaders/uploadersingleton.cpp
@@ -12,6 +12,7 @@
#include
#include
#include
+#include "mainwindow.hpp"
UploaderSingleton::UploaderSingleton() : QObject() {
updateSaveSettings();
@@ -68,6 +69,7 @@ void UploaderSingleton::upload(QPixmap pixmap) {
file = new QTemporaryFile();
}
if (file->open(QFile::ReadWrite)) {
+ playSound();
pixmap.save(file, format.toLocal8Bit().constData(), settings::settings().value("imageQuality", -1).toInt());
file->seek(0);
u->doUpload(file->readAll(), format);
@@ -88,6 +90,7 @@ void UploaderSingleton::upload(QByteArray img, QString format) {
file = new QTemporaryFile();
}
if (file->open(QFile::WriteOnly)) {
+ playSound();
file->write(img);
file->close();
}
@@ -101,6 +104,7 @@ void UploaderSingleton::upload(QFile &img, QString format) {
if (!saveImages || img.rename(saveDir.absoluteFilePath(
formatter::format(settings::settings().value("fileFormat", "Screenshot %(yyyy-MM-dd HH-mm-ss)date.%ext").toString(),
format.toLower())))) {
+ playSound();
if (img.open(QFile::ReadWrite))
uploaders.value(uploader)->doUpload(img.readAll(), format);
else
@@ -168,3 +172,14 @@ void UploaderSingleton::updateSaveSettings() {
}
}
}
+
+void UploaderSingleton::playSound() {
+ mediaPlayer = new QMediaPlayer(MainWindow::inst());
+ mediaPlayer->setMedia(QUrl("qrc:/capturesound.wav"));
+ mediaPlayer->setVolume(50);
+ mediaPlayer->play();
+
+ if(mediaPlayer->error() != QMediaPlayer::NoError && mediaPlayer->error() != QMediaPlayer::ServiceMissingError)
+ notifications::notify(QString::number(mediaPlayer->error()), mediaPlayer->errorString(), QSystemTrayIcon::Warning);
+
+}
diff --git a/src/uploaders/uploadersingleton.hpp b/src/uploaders/uploadersingleton.hpp
index 003c365..f138979 100644
--- a/src/uploaders/uploadersingleton.hpp
+++ b/src/uploaders/uploadersingleton.hpp
@@ -4,6 +4,7 @@
#include "uploader.hpp"
#include
#include
+#include
class UploaderSingleton : public QObject {
Q_OBJECT
@@ -30,10 +31,12 @@ signals:
private:
void updateSaveSettings();
+ void playSound();
QDir saveDir;
bool saveImages = true;
QMap uploaders;
QString uploader = "imgur";
+ QMediaPlayer *mediaPlayer;
QList errs;
UploaderSingleton();
};