Task#152997 子 音效播放方式统一替换成使用SDK接口 / 音效播放方式统一替换成使用SDK接口

This commit is contained in:
HeMeihong 2023-06-26 03:09:20 +00:00 committed by Yue-Lan
parent 717ea9ceca
commit 7bbd04104c
8 changed files with 90 additions and 10 deletions

View File

@ -40,3 +40,8 @@ exists("/usr/include/libkyudfburn/udfburn_global.h") {
exists("/usr/include/ukui-search/libsearch_global.h") {
DEFINES += KY_UKUI_SEARCH
}
exists("/usr/include/kysdk/desktop/kysdk-soundeffects_global.h") {
DEFINES += KY_SDK_SOUND_EFFECTS
PKGCONFIG += kysdk-soundeffects
}

View File

@ -42,6 +42,9 @@
#include "file-untrash-operation.h"
#include "file-delete-operation.h"
#include "sound-effect.h"
#ifdef KY_SDK_SOUND_EFFECTS
#include "ksoundeffects.h"
#endif
#include "file-utils.h"
#include "bookmark-manager.h"
@ -76,6 +79,9 @@
#include <QDebug>
using namespace Peony;
#ifdef KY_SDK_SOUND_EFFECTS
using namespace kdk;
#endif
DirectoryViewMenu::DirectoryViewMenu(DirectoryViewWidget *directoryView, QWidget *parent) : QMenu(parent)
{
@ -1128,15 +1134,23 @@ const QList<QAction *> DirectoryViewMenu::constructTrashActions()
if (m_selections.count() == 1) {
auto untrashop = FileOperationUtils::restore(m_selections.first());
if(untrashop){
connect(untrashop,&Peony::FileUntrashOperation::operationFinished,[=](){
Peony::SoundEffect::getInstance()->copyOrMoveSucceedMusic();
untrashop->connect(untrashop,&Peony::FileUntrashOperation::operationFinished,[=](){
//Peony::SoundEffect::getInstance()->copyOrMoveSucceedMusic();
//Task#152997, use sdk play sound
#ifdef KY_SDK_SOUND_EFFECTS
kdk::KSoundEffects::playSound(SoundType::OPERATION_FILE);
#endif
});
}
} else {
auto untrashop = FileOperationUtils::restore(m_selections);
if(untrashop){
connect(untrashop,&Peony::FileUntrashOperation::operationFinished,[=](){
Peony::SoundEffect::getInstance()->copyOrMoveSucceedMusic();
untrashop->connect(untrashop,&Peony::FileUntrashOperation::operationFinished,[=](){
//Peony::SoundEffect::getInstance()->copyOrMoveSucceedMusic();
//Task#152997, use sdk play sound
#ifdef KY_SDK_SOUND_EFFECTS
kdk::KSoundEffects::playSound(SoundType::OPERATION_FILE);
#endif
});
}
}

View File

@ -25,11 +25,17 @@
#include "file-node.h"
#include "file-node-reporter.h"
#include "sound-effect.h"
#ifdef KY_SDK_SOUND_EFFECTS
#include "ksoundeffects.h"
#endif
#include <QApplication>
#include <QStandardPaths>
#include <QProcess>
using namespace Peony;
#ifdef KY_SDK_SOUND_EFFECTS
using namespace kdk;
#endif
FileDeleteOperation::FileDeleteOperation(QStringList sourceUris, QObject *parent) : FileOperation(parent)
{
@ -204,7 +210,11 @@ void FileDeleteOperation::run()
qApp->property("clearTrash");
if(true == qApp->property("clearTrash").toBool()){
Peony::SoundEffect::getInstance()->recycleBinClearMusic();
//Peony::SoundEffect::getInstance()->recycleBinClearMusic();
//Task#152997, use sdk play sound
#ifdef KY_SDK_SOUND_EFFECTS
kdk::KSoundEffects::playSound(SoundType::TRASH_EMPTY);
#endif
}
}

View File

@ -25,11 +25,17 @@
#include "gerror-wrapper.h"
#include "sound-effect.h"
#ifdef KY_SDK_SOUND_EFFECTS
#include "ksoundeffects.h"
#endif
#include <QUrl>
#include <QProcess>
using namespace Peony;
#ifdef KY_SDK_SOUND_EFFECTS
using namespace kdk;
#endif
FileLinkOperation::FileLinkOperation(QString srcUri, QString destDirUri, QObject *parent) : FileOperation (parent)
{
@ -96,7 +102,11 @@ retry:
}
}
else{
SoundEffect::getInstance()->copyOrMoveSucceedMusic();
//SoundEffect::getInstance()->copyOrMoveSucceedMusic();
//Task#152997, use sdk play sound
#ifdef KY_SDK_SOUND_EFFECTS
kdk::KSoundEffects::playSound(SoundType::OPERATION_FILE);
#endif
}
g_file_set_display_name(destFile.get()->get(), QUrl::fromPercentEncoding(m_dest_uri.split("/").last().toUtf8()).toUtf8().constData(), nullptr, nullptr);

View File

@ -31,9 +31,16 @@
#include <file-utils.h>
#include <QStyleOptionViewItem>
#include "sound-effect.h"
#ifdef KY_SDK_SOUND_EFFECTS
#include "ksoundeffects.h"
#endif
#include "file-operation-dialog/kyfiledialogrename.h"
#ifdef KY_SDK_SOUND_EFFECTS
using namespace kdk;
#endif
static QPixmap drawSymbolicColoredPixmap (const QPixmap& source);
static QString formatGerrorString (const Peony::FileOperationError* error);
@ -221,7 +228,11 @@ Peony::FileOperationErrorDialogWarning::~FileOperationErrorDialogWarning()
void Peony::FileOperationErrorDialogWarning::handle(Peony::FileOperationError &error)
{
m_error = &error;
SoundEffect::getInstance()->copyOrMoveFailedMusic();
//SoundEffect::getInstance()->copyOrMoveFailedMusic();
//Task#152997, use sdk play sound
#ifdef KY_SDK_SOUND_EFFECTS
kdk::KSoundEffects::playSound(SoundType::OPERATION_UNSUPPORTED);
#endif
QStyleOptionViewItem opt;
if (nullptr != m_error->errorStr) {
auto errorText = m_error->errorStr;

View File

@ -48,6 +48,9 @@
#include "properties-window.h"
#include "sound-effect.h"
#ifdef KY_SDK_SOUND_EFFECTS
#include "ksoundeffects.h"
#endif
#include <QVector4D>
@ -55,6 +58,9 @@
#include <unistd.h>
using namespace Peony;
#ifdef KY_SDK_SOUND_EFFECTS
using namespace kdk;
#endif
static FileOperationManager *global_instance = nullptr;
@ -511,7 +517,11 @@ start:
//fix bug#162024, play sound when operation finished
if (info->operationType() == FileOperationInfo::Copy ||
info->operationType() == FileOperationInfo::Move){
SoundEffect::getInstance()->copyOrMoveSucceedMusic();
//SoundEffect::getInstance()->copyOrMoveSucceedMusic();
//Task#152997, use sdk play sound
#ifdef KY_SDK_SOUND_EFFECTS
kdk::KSoundEffects::playSound(SoundType::OPERATION_FILE);
#endif
}
m_undo_stack.push(info);

View File

@ -38,6 +38,9 @@
#include "emblem-provider.h"
#include "sound-effect.h"
#ifdef KY_SDK_SOUND_EFFECTS
#include "ksoundeffects.h"
#endif
#include <QIcon>
#include <QMimeData>
@ -49,6 +52,9 @@
#include <QGSettings>
using namespace Peony;
#ifdef KY_SDK_SOUND_EFFECTS
using namespace kdk;
#endif
FileItemModel::FileItemModel(QObject *parent) : QAbstractItemModel (parent)
{
@ -669,7 +675,11 @@ bool FileItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action, i
auto op = FileOperationUtils::moveWithAction(srcUris, destDirUri, addHistory, action);
connect(op, &FileOperation::operationFinished, this, [=](){
Peony::SoundEffect::getInstance()->copyOrMoveSucceedMusic();
//Peony::SoundEffect::getInstance()->copyOrMoveSucceedMusic();
//Task#152997, use sdk play sound
#ifdef KY_SDK_SOUND_EFFECTS
kdk::KSoundEffects::playSound(SoundType::OPERATION_FILE);
#endif
auto opInfo = op->getOperationInfo();
auto targetUris = opInfo.get()->dests();
Q_EMIT this->selectRequest(targetUris);

View File

@ -41,6 +41,9 @@
#include "desktop-icon-view.h"
#include "global-settings.h"
#include "sound-effect.h"
#ifdef KY_SDK_SOUND_EFFECTS
#include "ksoundeffects.h"
#endif
#include "desktop-icon-view-delegate.h"
#include "desktop-menu-plugin-manager.h"
#include "emblem-provider.h"
@ -58,6 +61,9 @@
#include <QDebug>
using namespace Peony;
#ifdef KY_SDK_SOUND_EFFECTS
using namespace kdk;
#endif
DesktopItemModel::DesktopItemModel(QObject *parent)
: QAbstractListModel(parent)
@ -956,7 +962,11 @@ bool DesktopItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action
auto op = FileOperationUtils::moveWithAction(srcUris, destDirUri, true, action);
op->connect(op, &FileOperation::operationFinished, this, [=](){
Peony::SoundEffect::getInstance()->copyOrMoveSucceedMusic();
//Peony::SoundEffect::getInstance()->copyOrMoveSucceedMusic();
//Task#152997, use sdk play sound
#ifdef KY_SDK_SOUND_EFFECTS
kdk::KSoundEffects::playSound(SoundType::OPERATION_FILE);
#endif
});
}