ukui-media/ 0000775 0001750 0001750 00000000000 15170054730 011534 5 ustar feng feng ukui-media/Makefile.am 0000664 0001750 0001750 00000001552 15170052044 013567 0 ustar feng feng NULL =
SUBDIRS = data po man
DISTCHECK_CONFIGURE_FLAGS = \
--enable-more-warnings \
--enable-compile-warnings=maximum \
--enable-deprecated
DIST_SUBDIRS = \
data \
po \
man \
$(NULL)
EXTRA_DIST = \
.version \
autogen.sh \
configure \
ChangeLog \
COPYING \
COPYING-DOCS \
build-aux/git-version-gen \
$(INTLTOOL_BUILT:=.in) \
$(NULL)
DISTCLEANFILES = \
po/.intltool-merge-cache \
$(NULL)
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
# see build-aux/git-version-get for details
BUILT_SOURCES = $(top_srcdir)/.version
$(top_srcdir)/.version:
echo $(VERSION) > $@-t && mv $@-t $@
# Build ChangeLog from GIT history
ChangeLog:
$(AM_V_GEN) if test -d $(top_srcdir)/.git; then \
GIT_DIR="$(top_srcdir)/.git" git log --stat > $@; \
fi
dist: ChangeLog
.PHONY: ChangeLog
-include $(top_srcdir)/git.mk
ukui-media/sound-theme-player/ 0000775 0001750 0001750 00000000000 15170054730 015256 5 ustar feng feng ukui-media/sound-theme-player/sound-theme-player.pro 0000664 0001750 0001750 00000002447 15170054730 021531 0 ustar feng feng #-------------------------------------------------
#
# Project created by QtCreator 2021-01-03T20:04:12
#
#-------------------------------------------------
QT += core gui dbus xml
#greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = sound-theme-player
TEMPLATE = app
include(dbus-adaptor/dbus-adaptor.pri)
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
LIBS += -lukui-log4qt
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
target.path = /usr/bin
CONFIG += \
c++11 \
no_keywords link_pkgconfig debug\
PKGCONFIG += \
glib-2.0 \
gio-2.0 \
dconf \
gsettings-qt6 \
libxml-2.0 \
libcanberra \
libpulse
SOURCES += \
main.cpp \
sound_theme_player.cpp
HEADERS += \
sound_theme_player.h
INSTALLS += \
target
ukui-media/sound-theme-player/dbus-adaptor/ 0000775 0001750 0001750 00000000000 15170054730 017643 5 ustar feng feng ukui-media/sound-theme-player/dbus-adaptor/org.ukui.soundthemeplayer.xml 0000664 0001750 0001750 00000000554 15170054730 025523 0 ustar feng feng
ukui-media/sound-theme-player/dbus-adaptor/dbus-adaptor.pri 0000664 0001750 0001750 00000000151 15170054730 022741 0 ustar feng feng INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/dbus-adaptor.h \
SOURCES += \
$$PWD/dbus-adaptor.cpp \
ukui-media/sound-theme-player/dbus-adaptor/dbus-adaptor.h 0000664 0001750 0001750 00000002515 15170054730 022404 0 ustar feng feng /*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp org.ukui.soundthemeplayer.xml -i sound_theme_player.h -a dbus-adaptor
*
* qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#ifndef DBUS_ADAPTOR_H
#define DBUS_ADAPTOR_H
#include
#include
#include "sound_theme_player.h"
QT_BEGIN_NAMESPACE
class QByteArray;
template class QList;
template class QMap;
class QString;
class QVariant;
QT_END_NAMESPACE
/*
* Adaptor class for interface org.ukui.sound.theme.player
*/
class PlayerAdaptor: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.ukui.sound.theme.player")
Q_CLASSINFO("D-Bus Introspection", ""
" \n"
" \n"
" \n"
" \n"
" \n"
" \n"
"")
public:
PlayerAdaptor(QObject *parent);
virtual ~PlayerAdaptor();
public: // PROPERTIES
public Q_SLOTS: // METHODS
bool playAlertSound(const QString &soundEvent);
Q_SIGNALS: // SIGNALS
};
#endif
ukui-media/sound-theme-player/dbus-adaptor/dbus-adaptor.cpp 0000664 0001750 0001750 00000002047 15170054730 022737 0 ustar feng feng /*
* This file was generated by qdbusxml2cpp version 0.8
* Command line was: qdbusxml2cpp org.ukui.soundthemeplayer.xml -i sound_theme_player.h -a dbus-adaptor
*
* qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
#include "dbus-adaptor.h"
#include
#include
#include
#include
#include
#include
#include
/*
* Implementation of adaptor class PlayerAdaptor
*/
PlayerAdaptor::PlayerAdaptor(QObject *parent)
: QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
}
PlayerAdaptor::~PlayerAdaptor()
{
// destructor
}
bool PlayerAdaptor::playAlertSound(const QString &soundEvent)
{
// handle method call org.ukui.sound.theme.player.playAlertSound
bool out0;
QMetaObject::invokeMethod(parent(), "playAlertSound", Q_RETURN_ARG(bool, out0), Q_ARG(QString, soundEvent));
return out0;
}
ukui-media/sound-theme-player/main.cpp 0000664 0001750 0001750 00000002245 15170054730 016711 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "sound_theme_player.h"
#include
#include
#include
#include "dbus-adaptor.h"
#include
int main(int argc, char *argv[])
{
initUkuiLog4qt("ukui-media");
QCoreApplication a(argc, argv);
SoundThemePlayer player;
return a.exec();
}
ukui-media/sound-theme-player/sound_theme_player.cpp 0000664 0001750 0001750 00000020664 15170054730 021660 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "sound_theme_player.h"
#include
#include
SoundThemePlayer::SoundThemePlayer()
{
createCaContext();//注册
UkmediaPlayerDbusRegister();
initGSettings();
addSoundFileList();
}
/**
* @brief create for the libcanberra context
* @return create successfully or not
*/
bool SoundThemePlayer::createCaContext()
{
if (nullptr != m_caContext)
{
ca_context_cancel(m_caContext, 0);
ca_context_destroy(m_caContext);
}
return (ca_context_create(&m_caContext) == 0) ? true : false;
}
/**
* @brief Register for the dbus service
*/
void SoundThemePlayer::UkmediaPlayerDbusRegister()
{
QDBusConnection con = QDBusConnection::sessionBus();
if (!con.registerService("org.ukui.sound.theme.player"))
qDebug() << "registerService failed" << con.lastError().message();
if (!con.registerObject("/org/ukui/sound/theme/player", this, QDBusConnection::ExportAllSlots | QDBusConnection::ExportAllSignals))
qDebug() << "registerObject failed" << con.lastError().message();
}
/**
* @brief Play the corresponding sound effects
*
* @param soundEvent Application sound type
* @return Play successfully or not
*/
bool SoundThemePlayer::playAlertSound(QString soundEvent)
{
bool soundSwitch;
if (m_pSoundSettings->keys().contains("eventSounds"))
soundSwitch = m_pSoundSettings->get(EVENT_SOUNDS_KEY).toBool();
if (!soundSwitch)
return false;
gint retval;
QByteArray ba;
const gchar *eventId;
const gchar *desc = "Sound Theme Player";
if (m_pSoundFileList.contains(soundEvent))
ba = soundEvent.toLatin1();
else {
QString theme = m_pSoundSettings->get(SOUND_THEME_KEY).toString();
if (isFileExist(theme, soundEvent))
ba = soundEvent.toLatin1();
else
ba = NOTIFICATION_GENERAL;
}
eventId = ba.data();
if (ba == AUDIO_VOLUME_CHANGE && m_pSoundSettings->get(SOUND_CUSTOM_THEME_KEY).toBool()) {
QString soundPath = m_pSoundSettings->get(AUDIO_VOLUME_CHANGE).toString();
retval = playCustomAlertSound(soundPath);
return retval;
}
else if (ba == NOTIFICATION_GENERAL && m_pSoundSettings->get(SOUND_CUSTOM_THEME_KEY).toBool()) {
QString soundPath = m_pSoundSettings->get(NOTIFICATION_GENERAL).toString();
retval = playCustomAlertSound(soundPath);
return retval;
}
if (createCaContext()) {
retval = ca_context_play(m_caContext, 0,
CA_PROP_EVENT_ID, eventId,
CA_PROP_EVENT_DESCRIPTION, desc,
CA_PROP_CANBERRA_VOLUME, m_dBValue,
NULL);
}
qDebug() << __func__ << soundEvent << eventId << retval;
return (retval == 0 ? 1 : 0);
}
/**
* @brief Find the sound file according to the sound type
*
* @param action Application sound type
* @return Sound file
*/
QString SoundThemePlayer::readJson(QString action)
{
QFile file("/usr/share/ukui-media/sounds/audio.json");
if (!file.open(QFile::ReadOnly | QFile::Text)) {
qDebug() << "can't open error!";
return "";
}
// 读取文件的全部内容
QTextStream stream(&file);
stream.setEncoding(QStringConverter::Utf8); // 设置读取编码是UTF8
QString str = stream.readAll();
file.close();
// QJsonParseError类用于在JSON解析期间报告错误。
QJsonParseError jsonError;
// 将json解析为UTF-8编码的json文档,并从中创建一个QJsonDocument。
// 如果解析成功,返回QJsonDocument对象,否则返回null
QJsonDocument doc = QJsonDocument::fromJson(str.toUtf8(), &jsonError);
// 判断是否解析失败
if (jsonError.error != QJsonParseError::NoError && !doc.isNull()) {
qDebug() << "Json格式错误!" << jsonError.error;
return "";
}
QJsonObject rootObj = doc.object();
//获取键值对
QJsonValue card = rootObj.value(action);
if (card.toString().isEmpty())
return NOTIFICATION_GENERAL;
return card.toString();
}
bool SoundThemePlayer::playCustomAlertSound(QString soundPath)
{
int retval = 1;
if (createCaContext()) {
retval = ca_context_play(m_caContext, 0,
CA_PROP_APPLICATION_NAME, "Sound Theme Player",
CA_PROP_MEDIA_FILENAME, soundPath.toLatin1().data(),
CA_PROP_EVENT_DESCRIPTION, "Testing event sound",
CA_PROP_CANBERRA_CACHE_CONTROL, "never",
CA_PROP_APPLICATION_ID, "org.ukui.VolumeControl",
CA_PROP_CANBERRA_VOLUME, m_dBValue,
#ifdef CA_PROP_CANBERRA_ENABLE
CA_PROP_CANBERRA_ENABLE, "1",
#endif
NULL);
qDebug() << __func__ << soundPath << retval;
}
return (retval == 0 ? 1 : 0);
}
bool SoundThemePlayer::isFileExist(QString theme, QString soundTye)
{
QString path = SOUND_FILE_PATH;
path.replace("xxxTheme", theme);
path.replace("xxxFile", soundTye);
QFileInfo fileInfo(path);
path.replace("ogg", "oga");
QFileInfo fileInfoOga(path);
if (fileInfo.isFile())
return true;
else if (fileInfoOga.isFile())
return true;
else
return false;
}
void SoundThemePlayer::addSoundFileList()
{
m_pSoundFileList << "audio-volume-change"
<< "battery-low"
<< "complete"
<< "device-added-failed"
<< "device-added"
<< "device-removed"
<< "dialog-error"
<< "dialog-warning"
<< "notification-general"
<< "notification-special"
<< "operation-file"
<< "operation-unsupported"
<< "power-plug"
<< "screen-capture"
<< "screen-record"
<< "start-up"
<< "trash-empty" ;
}
void SoundThemePlayer::initGSettings()
{
if (QGSettings::isSchemaInstalled(KEY_SOUNDS_SCHEMA)) {
m_pSoundSettings = new QGSettings(KEY_SOUNDS_SCHEMA);
}
if (nullptr == m_pSoundSettings) {
qDebug() << "m_pSoundSettings create fail";
return;
}
if (m_pSoundSettings->keys().contains("alertVolume")) {
int n_AlertVolume = m_pSoundSettings->get(ALERT_VOLUME).toInt();
m_dBValue = alertVolumeTodB(n_AlertVolume);
}
connect(m_pSoundSettings, &QGSettings::changed, this, &SoundThemePlayer::onSettingChanged);
}
void SoundThemePlayer::onSettingChanged(const QString &key)
{
if (key == "alertVolume") {
int n_AlertVolume = m_pSoundSettings->get(ALERT_VOLUME).toInt();
m_dBValue = alertVolumeTodB(n_AlertVolume);
qDebug() << "The alert volume is changed, now is" << n_AlertVolume << m_dBValue;
}
}
char *SoundThemePlayer::alertVolumeTodB(int value)
{
if (value < 0 || value > 100)
value = 100;
pa_volume_t volume = value / 100.0 * 65536.0;
double dBValue = pa_sw_volume_to_dB(volume);
QByteArray byteArray = QByteArray::number(dBValue, 'f', 2);
if (m_dBValue) {
delete[] m_dBValue;
m_dBValue = nullptr;
}
m_dBValue = new char[byteArray.size() + 1];
snprintf(m_dBValue, byteArray.size() + 1, "%s", byteArray.constData());
return m_dBValue;
}
SoundThemePlayer::~SoundThemePlayer()
{
}
ukui-media/sound-theme-player/sound_theme_player.h 0000664 0001750 0001750 00000004726 15170054730 021326 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef SOUND_THEME_PLAYER_H
#define SOUND_THEME_PLAYER_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
extern "C" {
#include
#include
}
#define KEY_SOUNDS_SCHEMA "org.ukui.sound"
#define EVENT_SOUNDS_KEY "event-sounds"
#define SOUND_THEME_KEY "theme-name"
#define SOUND_CUSTOM_THEME_KEY "custom-theme"
#define AUDIO_VOLUME_CHANGE "audio-volume-change"
#define NOTIFICATION_GENERAL "notification-general"
#define ALERT_VOLUME "alert-volume"
#define SOUND_FILE_PATH "/usr/share/sounds/xxxTheme/stereo/xxxFile.ogg"
class SoundThemePlayer : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface","org.ukui.sound.theme.player")
public:
SoundThemePlayer();
~SoundThemePlayer();
bool createCaContext();
void UkmediaPlayerDbusRegister();
QString readJson(QString action);
void addSoundFileList();
bool playCustomAlertSound(QString soundPath);
bool isFileExist(QString theme, QString soundTye);
void initGSettings();
void onSettingChanged(const QString &key);
char *alertVolumeTodB(int value);
public Q_SLOTS: //METHODS
bool playAlertSound(QString soundEvent);
private:
ca_context *m_caContext = nullptr;
QGSettings *m_pSoundSettings = nullptr;
QStringList m_pSoundFileList;
char *m_dBValue = nullptr;
};
#endif // SOUND_THEME_PLAYER_H
ukui-media/ukui-login-sound/ 0000775 0001750 0001750 00000000000 15170054730 014745 5 ustar feng feng ukui-media/ukui-login-sound/main.cpp 0000664 0001750 0001750 00000013053 15170054730 016377 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include
#include
#include
#include
#include
#include "ukui_login_sound_user_config.h"
#include "ukui_login_sound.h"
/* define hw sound card dirvers */
#define HI3XXX_HI6405 "hi3xxx_hi6405"
#define HI3XXX_DA_COMBINE_V5 "hi3xxx_DA_combine_v5"
#define DA_COMBINE_V5_MACHINE "da_combine_v5_machine"
#define HW_AUDIO_SERVICE "/usr/share/hw-audio/hwaudioservice"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
if (QFile(SOUND_EFFECT_JSON).exists())
{
syslog(LOG_INFO, "this is not first time longin to the system, so the stratup sound effect will not play.");
return 0;
}
std::shared_ptr info = std::make_shared();
QString autoLoginUser = std::dynamic_pointer_cast(info)->getAutoLoginUser();
QString lastLoginUser = std::dynamic_pointer_cast(info)->getLastLoginUser();
syslog(LOG_DEBUG, "autoLoginUser:%s, lastLoginUser:%s", autoLoginUser.toLatin1().data(), lastLoginUser.toLatin1().data());
// 1. 正常装机或者OEM装机时第一次登录,使用默认设备播放开机音效
if ("oem" == autoLoginUser || ("" == autoLoginUser && "" == lastLoginUser))
{
if (QFile::exists(HW_AUDIO_SERVICE)) {
system("/usr/share/hw-audio/hwaudioservice -o");
}
syslog(LOG_INFO, "when you first enter the system, use the default output device to play startup sound effect.");
QString defaultOutputDev = DEFAULT_AUDIO_CARD_VALUE;
defaultOutputDev = UkuiLoginSound::getInstance().checkPcm(defaultOutputDev.toLatin1().data());
UkuiLoginSound::getInstance().aplayMain(PLAY_STARTUP_WAV, defaultOutputDev.toLatin1().data());
}
else
{
// 2.当系统设置自动登录时,使用自动登录用户记录的设备信息进行播放,没有设置自动登录用户时,使用上一次登录用户记录的设备信息进行播放
bool status = info->getValueFromJson(info->getJsonByType(std::dynamic_pointer_cast(info)->getJsonMap(),
JsonType::JSON_TYPE_USERINFO), AUDIO_STRATUP_SOUNDEFFECT_KEY).toBool();
bool mute = info->getValueFromJson(info->getJsonByType(std::dynamic_pointer_cast(info)->getJsonMap(),
JsonType::JSON_TYPE_USERINFO), AUDIO_MUTE_KEY).toBool();
int volume = info->getValueFromJson(info->getJsonByType(std::dynamic_pointer_cast(info)->getJsonMap(),
JsonType::JSON_TYPE_USERINFO), AUDIO_VOLUME_KEY).toInt();
/* Do not play the boot sound effect when the user is closed when the boot sound effect,
* the mute state, and the volume value are 0 */
if (!status || mute || !volume) {
syslog(LOG_DEBUG, "%s user has turned off the system boot sound or it is in mute mode, status: %d, muted: %d, volume: %d.",
autoLoginUser == "" ? lastLoginUser.toLatin1().data() : autoLoginUser.toLatin1().data(), status, mute, volume);
return 0;
}
int cardId = info->getValueFromJson(info->getJsonByType(std::dynamic_pointer_cast(info)->getJsonMap(),
JsonType::JSON_TYPE_USERINFO), AUDIO_CARDID_KEY).toInt();
QString audioDEV = info->getValueFromJson(info->getJsonByType(std::dynamic_pointer_cast(info)->getJsonMap(),
JsonType::JSON_TYPE_USERINFO), AUDIO_CARD_KEY).toString();
/* Check whether the PCM device is valid before playing the boot sound */
audioDEV = UkuiLoginSound::getInstance().checkPcm(audioDEV.toLatin1().data());
bool support = UkuiLoginSound::getInstance().isSupportHardwareVolumeControl(QString("hw:%1").arg(cardId).toLatin1().data());
syslog(LOG_INFO, "play system sound effects on the device:%s at volume:%d.", audioDEV.toLatin1().data(), volume);
if (!mute && QFile::exists(HW_AUDIO_SERVICE)) {
system("/usr/share/hw-audio/hwaudioservice -o");
}
/* When the driver does not support hardware volume control, modify the volume of
* the audio file of the boot sound effect through FFMPEG */
if (!support && !UkuiLoginSound::getInstance().wav_convert(volume)) {
UkuiLoginSound::getInstance().aplayMain(TMP_STARTUP_WAV_PATH, audioDEV.toLatin1().data());
}
else {
UkuiLoginSound::getInstance().aplayMain(PLAY_STARTUP_WAV, audioDEV.toLatin1().data());
}
}
return 0;
}
ukui-media/ukui-login-sound/ukui-login-sound.pro 0000664 0001750 0001750 00000002646 15170054730 020710 0 ustar feng feng QT += core gui
#greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TEMPLATE = app
TARGET = ukui-login-sound
target.path = /usr/bin
CONFIG += \
c++17 \
no_keywords link_pkgconfig debug\
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
../common/user_config.cpp \
main.cpp \
ukui_login_sound.cpp \
../common/sound_effect_json.cpp \
../common/user_info_json.cpp \
ukui_login_sound_user_config.cpp
HEADERS += \
formats.h \
ukui_login_sound.h \
../common/json.h \
../common/sound_effect_json.h \
../common/user_info_json.h \
../common/user_config.h \
ukui_login_sound_user_config.h
PKGCONFIG += alsa
# Default rules for deployment.
#qnx: target.path = /tmp/$${TARGET}/bin
#else: unix:!android: target.path = /opt/$${TARGET}/bin
#!isEmpty(target.path): INSTALLS += target
INSTALLS += target \
ukui-media/ukui-login-sound/ukui_login_sound.h 0000664 0001750 0001750 00000015715 15170054730 020504 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef APLAYPLAY_H
#define APLAYPLAY_H
//#include "aconfig.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "formats.h"
#include
#include
#include
#include
#define BUFFER_LEN 1024
//开机音乐播放路径
#define PLAY_STARTUP_WAV "/usr/share/ukui/ukui-session-manager/startup.wav"
#define TMP_STARTUP_WAV_PATH "/tmp/startup.wav"
#define NORMAL_VOLUME 100.0
#define MIN_VOLUME 0.0
#define ABS(a) (a) < 0 ? -(a) : (a)
#ifdef SND_CHMAP_API_VERSION
#define CONFIG_SUPPORT_CHMAP 1
#endif
#ifndef LLONG_MAX
#define LLONG_MAX 9223372036854775807LL
#endif
#ifndef le16toh
#include
#define le16toh(x) __le16_to_cpu(x)
#define be16toh(x) __be16_to_cpu(x)
#define le32toh(x) __le32_to_cpu(x)
#define be32toh(x) __be32_to_cpu(x)
#endif
#define DEFAULT_FORMAT SND_PCM_FORMAT_U8
#define DEFAULT_SPEED 8000
#define FORMAT_DEFAULT -1
#define FORMAT_RAW 0
#define FORMAT_VOC 1
#define FORMAT_WAVE 2
#define FORMAT_AU 3
/* global data */
static snd_pcm_sframes_t (*readi_func)(snd_pcm_t *handle, void *buffer, snd_pcm_uframes_t size);
static snd_pcm_sframes_t (*writei_func)(snd_pcm_t *handle, const void *buffer, snd_pcm_uframes_t size);
static snd_pcm_sframes_t (*readn_func)(snd_pcm_t *handle, void **bufs, snd_pcm_uframes_t size);
static snd_pcm_sframes_t (*writen_func)(snd_pcm_t *handle, void **bufs, snd_pcm_uframes_t size);
enum {
VUMETER_NONE,
VUMETER_MONO,
VUMETER_STEREO
};
static snd_pcm_t *handle;
static struct {
snd_pcm_format_t format;
unsigned int channels;
unsigned int rate;
} hwparams, rhwparams;
static int timelimit = 0;
static int sampleslimit = 0;
static int quiet_mode = 0;
static int file_type = FORMAT_DEFAULT;
static int open_mode = 0;
static snd_pcm_stream_t stream = SND_PCM_STREAM_PLAYBACK;
static int mmap_flag = 0;
static int interleaved = 1;
static int nonblock = 0;
static volatile sig_atomic_t in_aborting = 0;
static u_char *audiobuf = NULL;
static snd_pcm_uframes_t chunk_size = 0;
static unsigned period_time = 0;
static unsigned buffer_time = 0;
static snd_pcm_uframes_t period_frames = 0;
static snd_pcm_uframes_t buffer_frames = 0;
static int avail_min = -1;
static int start_delay = 0;
static int stop_delay = 0;
static int monotonic = 0;
static int interactive = 0;
static int can_pause = 0;
static int fatal_errors = 0;
static int verbose = 0;
static int vumeter = VUMETER_NONE;
static int buffer_pos = 0;
static size_t significant_bits_per_sample, bits_per_sample, bits_per_frame;
static size_t chunk_bytes;
static int test_position = 0;
static int test_coef = 8;
static int test_nowait = 0;
static snd_output_t *snd_log;
static long long max_file_size = 0;
static int max_file_time = 0;
static int use_strftime = 0;
volatile static int recycle_capture_file = 0;
static long term_c_lflag = -1;
static int dump_hw_params = 0;
static int fd = -1;
static off64_t pbrec_count = LLONG_MAX, fdcount;
static int vocmajor, vocminor;
static char *pidfile_name = NULL;
//FILE *pidf = NULL;
static int pidfile_written = 0;
#ifdef CONFIG_SUPPORT_CHMAP
static snd_pcm_chmap_t *channel_map = NULL; /* chmap to override */
static unsigned int *hw_map = NULL; /* chmap to follow */
#endif
//extern "C"{
/* needed prototypes */
class UkuiLoginSound
{
public:
static UkuiLoginSound& getInstance();
int aplayMain(char *filename,char *playdev);
char* checkPcm(char *name);
bool isSupportHardwareVolumeControl(char *name);
int wav_convert(int volume);
private:
UkuiLoginSound();
UkuiLoginSound(const UkuiLoginSound&) = delete;
UkuiLoginSound(UkuiLoginSound&&) = delete;
UkuiLoginSound operator=(const UkuiLoginSound&) = delete;
UkuiLoginSound operator=(UkuiLoginSound&&) = delete;
~UkuiLoginSound() = default;
static void check_wavefile_space(u_char *buffer,u_int len, size_t blimit);
static void device_list();
static void pcm_list(void);
static void prg_exit(int code);
static void signal_handler(int sig);
static void signal_handler_recycle (int sig);
static ssize_t safe_read(int fd, void *buf, size_t count);
static size_t test_wavefile_read(int fd, u_char *buffer, size_t *size, size_t reqsize, int line);
static ssize_t test_wavefile(int fd, u_char *_buffer, size_t size);
static void show_available_sample_formats(snd_pcm_hw_params_t* params);
static int setup_chmap(void);
static void set_params(void);
static void init_stdin(void);
static void done_stdin(void);
static void do_pause(void);
static void check_stdin(void);
static void xrun(void);
static void suspend(void);
static void print_vu_meter_mono(int perc, int maxperc);
static void print_vu_meter_stereo(int *perc, int *maxperc);
static void print_vu_meter(signed int *perc, signed int *maxperc);
static void compute_max_peak(u_char *data, size_t count);
static void do_test_position(void);
static u_char *remap_data(u_char *data, size_t count);
static u_char **remap_datav(u_char **data, size_t count);
static ssize_t pcm_write(u_char *data, size_t count);
static ssize_t pcm_writev(u_char **data, unsigned int channels, size_t count);
static ssize_t pcm_read(u_char *data, size_t rcount);
static ssize_t pcm_readv(u_char **data, unsigned int channels, size_t rcount);
static ssize_t voc_pcm_write(u_char *data, size_t count);
static void init_raw_data(void);
static off64_t calc_count(void);
static void header(int rtype, char *name);
static void playback_go(int fd, size_t loaded, off64_t count, int rtype, char *name);
static int read_header(int *loaded, int header_size);
static int playback_wave(char *name, int *loaded);
static int playback_raw(char *name, int *loaded);
static void playback(char *name);
};
#endif // APLAYPLAY_H
ukui-media/ukui-login-sound/ukui_login_sound_user_config.cpp 0000664 0001750 0001750 00000005560 15170054730 023417 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "ukui_login_sound_user_config.h"
UkuiLoginSoundUserConfig::UkuiLoginSoundUserConfig()
{
initSettings();
initJsonMap();
}
void UkuiLoginSoundUserConfig::initSettings()
{
m_pAutoLoginSetting = std::make_unique(LIGHTDM_CONF_FILE, QSettings::IniFormat);
m_pLastLoginSetting = std::make_unique(UKUI_GREETER_CONF_FILE, QSettings::IniFormat);
}
void UkuiLoginSoundUserConfig::initJsonMap()
{
for (const auto& [k, v] : m_keys) {
std::shared_ptr json = nullptr;
switch (k) {
case JsonType::JSON_TYPE_SOUNDEFFECT: {
json = std::make_shared(v());
json->init();
break;
}
case JsonType::JSON_TYPE_USERINFO: {
json = std::make_shared(v());
break;
}
default:
break;
}
if (json) {
m_jsonMap.emplace(k, json);
}
}
}
const QString UkuiLoginSoundUserConfig::getAutoLoginUser() const
{
return m_pAutoLoginSetting->value(LIGHTDM_CONF_KEY).toString();
}
const QString UkuiLoginSoundUserConfig::getLastLoginUser() const
{
return m_pLastLoginSetting->value(UKUI_GREETER_CONF_KEY).toString();
}
std::unordered_map> UkuiLoginSoundUserConfig::getJsonMap() const
{
return m_jsonMap;
}
QString UkuiLoginSoundUserConfig::getSoundEffectFullPath()
{
return SOUND_EFFECT_JSON;
}
QString UkuiLoginSoundUserConfig::getUserInfoFullPath()
{
QString path = DEFAULT_PATH;
QString autoLoginUser = getAutoLoginUser();
QString lastLoginUser = getLastLoginUser();
if ("" == autoLoginUser && "" == lastLoginUser) {
path = INVAILD_PATH;
}
else {
autoLoginUser == "" ? path.append(lastLoginUser) : path.append(autoLoginUser);
}
path == INVAILD_PATH ? path : path.append(AUDIO_JSON);
syslog(LOG_DEBUG, "usr info file path: %s.", path.toLatin1().data());
return path;
}
UkuiLoginSoundUserConfig::~UkuiLoginSoundUserConfig()
{
}
ukui-media/ukui-login-sound/formats.h 0000664 0001750 0001750 00000010761 15170054730 016576 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef FORMATS_H
#define FORMATS_H 1
#include
#include
/* Definitions for .VOC files */
#define VOC_MAGIC_STRING "Creative Voice File\x1A"
#define VOC_ACTUAL_VERSION 0x010A
#define VOC_SAMPLESIZE 8
#define VOC_MODE_MONO 0
#define VOC_MODE_STEREO 1
#define VOC_DATALEN(bp) ((u_long)(bp->datalen) | \
((u_long)(bp->datalen_m) << 8) | \
((u_long)(bp->datalen_h) << 16) )
typedef struct voc_header {
u_char magic[20]; /* must be MAGIC_STRING */
u_short headerlen; /* Headerlength, should be 0x1A */
u_short version; /* VOC-file version */
u_short coded_ver; /* 0x1233-version */
} VocHeader;
typedef struct voc_blocktype {
u_char type;
u_char datalen; /* low-byte */
u_char datalen_m; /* medium-byte */
u_char datalen_h; /* high-byte */
} VocBlockType;
typedef struct voc_voice_data {
u_char tc;
u_char pack;
} VocVoiceData;
typedef struct voc_ext_block {
u_short tc;
u_char pack;
u_char mode;
} VocExtBlock;
/* Definitions for Microsoft WAVE format */
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define COMPOSE_ID(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24))
#define LE_SHORT(v) (v)
#define LE_INT(v) (v)
#define BE_SHORT(v) bswap_16(v)
#define BE_INT(v) bswap_32(v)
#elif __BYTE_ORDER == __BIG_ENDIAN
#define COMPOSE_ID(a,b,c,d) ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24))
#define LE_SHORT(v) bswap_16(v)
#define LE_INT(v) bswap_32(v)
#define BE_SHORT(v) (v)
#define BE_INT(v) (v)
#else
#error "Wrong endian"
#endif
/* Note: the following macros evaluate the parameter v twice */
#define TO_CPU_SHORT(v, be) \
((be) ? BE_SHORT(v) : LE_SHORT(v))
#define TO_CPU_INT(v, be) \
((be) ? BE_INT(v) : LE_INT(v))
#define WAV_RIFF COMPOSE_ID('R','I','F','F')
#define WAV_RIFX COMPOSE_ID('R','I','F','X')
#define WAV_WAVE COMPOSE_ID('W','A','V','E')
#define WAV_FMT COMPOSE_ID('f','m','t',' ')
#define WAV_DATA COMPOSE_ID('d','a','t','a')
/* WAVE fmt block constants from Microsoft mmreg.h header */
#define WAV_FMT_PCM 0x0001
#define WAV_FMT_IEEE_FLOAT 0x0003
#define WAV_FMT_DOLBY_AC3_SPDIF 0x0092
#define WAV_FMT_EXTENSIBLE 0xfffe
/* Used with WAV_FMT_EXTENSIBLE format */
#define WAV_GUID_TAG "\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71"
/* it's in chunks like .voc and AMIGA iff, but my source say there
are in only in this combination, so I combined them in one header;
it works on all WAVE-file I have
*/
typedef struct {
u_int magic; /* 'RIFF' */
u_int length; /* filelen */
u_int type; /* 'WAVE' */
} WaveHeader;
typedef struct {
u_short format; /* see WAV_FMT_* */
u_short channels;
u_int sample_fq; /* frequence of sample */
u_int byte_p_sec;
u_short byte_p_spl; /* samplesize; 1 or 2 bytes */
u_short bit_p_spl; /* 8, 12 or 16 bit */
} WaveFmtBody;
typedef struct {
WaveFmtBody format;
u_short ext_size;
u_short bit_p_spl;
u_int channel_mask;
u_short guid_format; /* WAV_FMT_* */
u_char guid_tag[14]; /* WAV_GUID_TAG */
} WaveFmtExtensibleBody;
typedef struct {
u_int type; /* 'data' */
u_int length; /* samplecount */
} WaveChunkHeader;
/* Definitions for Sparc .au header */
#define AU_MAGIC COMPOSE_ID('.','s','n','d')
#define AU_FMT_ULAW 1
#define AU_FMT_LIN8 2
#define AU_FMT_LIN16 3
typedef struct au_header {
u_int magic; /* '.snd' */
u_int hdr_size; /* size of header (min 24) */
u_int data_size; /* size of data */
u_int encoding; /* see to AU_FMT_XXXX */
u_int sample_rate; /* sample rate */
u_int channels; /* number of channels (voices) */
} AuHeader;
#endif /* FORMATS */
ukui-media/ukui-login-sound/ukui_login_sound.cpp 0000664 0001750 0001750 00000154554 15170054730 021044 0 ustar feng feng /*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see = 0) {
char name[32];
// sprintf(name, "hw:%d", card);
snprintf(name, sizeof(name), "hw:%d", card);
if ((err = snd_ctl_open(&handle, name, 0)) < 0) {
printf("control open (%i): %s", card, snd_strerror(err));
goto next_card;
}
if ((err = snd_ctl_card_info(handle, info)) < 0) {
printf("control hardware info (%i): %s", card, snd_strerror(err));
snd_ctl_close(handle);
goto next_card;
}
dev = -1;
while (1) {
unsigned int count;
if (snd_ctl_pcm_next_device(handle, &dev)<0)
printf("snd_ctl_pcm_next_device");
if (dev < 0)
break;
snd_pcm_info_set_device(pcminfo, dev);
snd_pcm_info_set_subdevice(pcminfo, 0);
snd_pcm_info_set_stream(pcminfo, stream);
if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) {
if (err != -ENOENT)
printf("control digital audio info (%i): %s", card, snd_strerror(err));
continue;
}
printf(("card %i: %s [%s], device %i: %s [%s]\n"),
card, snd_ctl_card_info_get_id(info), snd_ctl_card_info_get_name(info),
dev,
snd_pcm_info_get_id(pcminfo),
snd_pcm_info_get_name(pcminfo));
count = snd_pcm_info_get_subdevices_count(pcminfo);
printf((" Subdevices: %i/%i\n"),
snd_pcm_info_get_subdevices_avail(pcminfo), count);
for (idx = 0; idx < (int)count; idx++) {
snd_pcm_info_set_subdevice(pcminfo, idx);
if ((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) {
printf("control digital audio playback info (%i): %s", card, snd_strerror(err));
} else {
printf((" Subdevice #%i: %s\n"),
idx, snd_pcm_info_get_subdevice_name(pcminfo));
}
}
}
snd_ctl_close(handle);
next_card:
if (snd_card_next(&card) < 0) {
printf("snd_card_next");
break;
}
}
}
void UkuiLoginSound::pcm_list(void)
{
void **hints, **n;
char *name, *descr, *descr1, *io;
const char *filter;
if (snd_device_name_hint(-1, "pcm", &hints) < 0)
return;
n = hints;
filter = stream == SND_PCM_STREAM_CAPTURE ? "Input" : "Output";
while (*n != NULL) {
name = snd_device_name_get_hint(*n, "NAME");
descr = snd_device_name_get_hint(*n, "DESC");
io = snd_device_name_get_hint(*n, "IOID");
if (io != NULL && strcmp(io, filter) != 0)
goto __end;
printf("%s\n", name);
if ((descr1 = descr) != NULL) {
printf(" ");
while (*descr1) {
if (*descr1 == '\n')
printf("\n ");
else
putchar(*descr1);
descr1++;
}
putchar('\n');
}
__end:
if (name != NULL)
free(name);
if (descr != NULL)
free(descr);
if (io != NULL)
free(io);
n++;
}
snd_device_name_free_hint(hints);
}
/*
* Subroutine to clean up before exit.
*/
void UkuiLoginSound::prg_exit(int code)
{
done_stdin();
if (handle)
snd_pcm_close(handle);
if (pidfile_written)
remove (pidfile_name);
exit(code);
}
void UkuiLoginSound::signal_handler(int sig)
{
if (in_aborting)
return;
in_aborting = 1;
if (verbose==2)
putchar('\n');
if (!quiet_mode)
{
syslog (LOG_INFO,"sig: %d quiet_mode: %d.", sig, quiet_mode);
fprintf(stderr, ("Aborted by signal %s...\n"), strsignal(sig));
}
if (handle)
snd_pcm_abort(handle);
if (sig == SIGABRT) {
/* do not call snd_pcm_close() and abort immediately */
handle = NULL;
prg_exit(EXIT_FAILURE);
}
signal(sig, SIG_DFL);
}
/* call on SIGUSR1 signal. */
void UkuiLoginSound::signal_handler_recycle ([[maybe_unused]] int sig)
{
/* flag the capture loop to start a new output file */
recycle_capture_file = 1;
}
int UkuiLoginSound::aplayMain(char *filename, char *playdev)
{
// int duration_or_sample = 0;
// int option_index;
// static const char short_options[] = "hnlLD:qt:c:f:r:d:s:MNF:A:R:T:B:vV:IPCi"
#ifdef CONFIG_SUPPORT_CHMAP
"m:"
#endif
;
char *pcm_name = playdev;
int err;
int do_device_list = 0, do_pcm_list = 0;
snd_pcm_info_t *info;
#ifdef ENABLE_NLS
setlocale(LC_ALL, "");
textdomain(PACKAGE);
#endif
snd_pcm_info_alloca(&info);
err = snd_output_stdio_attach(&snd_log, stderr, 0);
assert(err >= 0);
file_type = FORMAT_DEFAULT;
stream = SND_PCM_STREAM_PLAYBACK;
chunk_size = -1;
rhwparams.format = DEFAULT_FORMAT;
rhwparams.rate = DEFAULT_SPEED;
rhwparams.channels = 1;
if (do_device_list) {
if (do_pcm_list)
pcm_list();
device_list();
goto __end;
} else if (do_pcm_list) {
pcm_list();
goto __end;
}
err = snd_pcm_open(&handle, playdev, stream, open_mode);
syslog (LOG_INFO, "start open %s device...", pcm_name);
if (err < 0) {
printf(("audio open error: %s"), snd_strerror(err));
return 1;
}
if ((err = snd_pcm_info(handle, info)) < 0) {
printf(("info error: %s"), snd_strerror(err));
return 1;
}
if (nonblock) {
err = snd_pcm_nonblock(handle, 1);
if (err < 0) {
printf(("nonblock setting error: %s"), snd_strerror(err));
return 1;
}
}
chunk_size = 1024;
hwparams = rhwparams;
audiobuf = (u_char *)malloc(1024);
if (audiobuf == NULL) {
printf(("not enough memory"));
return 1;
}
if (mmap_flag) {
writei_func = snd_pcm_mmap_writei;
readi_func = snd_pcm_mmap_readi;
writen_func = snd_pcm_mmap_writen;
readn_func = snd_pcm_mmap_readn;
} else {
writei_func = snd_pcm_writei;
readi_func = snd_pcm_readi;
writen_func = snd_pcm_writen;
readn_func = snd_pcm_readn;
}
if (pidfile_name) {
errno = 0;
pidf = fopen (pidfile_name, "w");
if (pidf) {
(void)fprintf (pidf, "%d\n", getpid());
fclose(pidf);
pidfile_written = 1;
} else {
printf(("Cannot create process ID file %s: %s"),
pidfile_name, strerror (errno));
return 1;
}
}
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGABRT, signal_handler);
signal(SIGUSR1, signal_handler_recycle);
if (interleaved) {
if (stream == SND_PCM_STREAM_PLAYBACK)
{
playback(filename);
}
}
if (verbose==2)
putchar('\n');
snd_pcm_close(handle);
handle = NULL;
free(audiobuf);
__end:
snd_output_close(snd_log);
snd_config_update_free_global();
prg_exit(EXIT_SUCCESS);
/* avoid warning */
return EXIT_SUCCESS;
}
/*
* Safe read (for pipes)
*/
ssize_t UkuiLoginSound::safe_read(int fd, void *buf, size_t count)
{
ssize_t result = 0, res;
while (count > 0 && !in_aborting) {
if ((res = read(fd, buf, count)) == 0)
break;
if (res < 0)
return result > 0 ? result : res;
count -= res;
result += res;
buf = (char *)buf + res;
}
return result;
}
/*
* helper for test_wavefile
*/
size_t UkuiLoginSound::test_wavefile_read(int fd, u_char *buffer, size_t *size, size_t reqsize, int line)
{
if (*size >= reqsize)
return *size;
if ((size_t)safe_read(fd, buffer + *size, reqsize - *size) != reqsize - *size) {
printf(("read error (called from line %i)"), line);
prg_exit(EXIT_FAILURE);
}
return *size = reqsize;
}
#define check_wavefile_space(buffer, len, blimit) \
if (len > blimit) { \
blimit = len; \
if ((buffer = (u_char *)realloc(buffer, blimit)) == NULL) { \
printf(("not enough memory")); \
prg_exit(EXIT_FAILURE); \
} \
}
/*
* test, if it's a .WAV file, > 0 if ok (and set the speed, stereo etc.)
* == 0 if not
* Value returned is bytes to be discarded.
*/
ssize_t UkuiLoginSound::test_wavefile(int fd, u_char *_buffer, size_t size)
{
WaveHeader *h = (WaveHeader *)_buffer;
u_char *buffer = NULL;
size_t blimit = 0;
WaveFmtBody *f;
WaveChunkHeader *c;
u_int type, len;
unsigned short format, channels;
int big_endian, native_format;
if (size < sizeof(WaveHeader))
return -1;
if (h->magic == WAV_RIFF)
big_endian = 0;
else if (h->magic == WAV_RIFX)
big_endian = 1;
else
return -1;
if (h->type != WAV_WAVE)
return -1;
if (size > sizeof(WaveHeader)) {
check_wavefile_space(buffer, size - sizeof(WaveHeader), blimit);
memcpy(buffer, (_buffer + (sizeof(WaveHeader))), size - sizeof(WaveHeader));
}
size -= sizeof(WaveHeader);
while (1) {
check_wavefile_space(buffer, sizeof(WaveChunkHeader), blimit);
test_wavefile_read(fd, buffer, &size, sizeof(WaveChunkHeader), __LINE__);
c = (WaveChunkHeader*)buffer;
type = c->type;
len = TO_CPU_INT(c->length, big_endian);
len += len % 2;
if (size > sizeof(WaveChunkHeader))
memmove(buffer, buffer + sizeof(WaveChunkHeader), size - sizeof(WaveChunkHeader));
size -= sizeof(WaveChunkHeader);
if (type == WAV_FMT)
break;
check_wavefile_space(buffer, len, blimit);
test_wavefile_read(fd, buffer, &size, len, __LINE__);
if (size > len)
memmove(buffer, buffer + len, size - len);
size -= len;
}
if (len < sizeof(WaveFmtBody)) {
printf(("unknown length of 'fmt ' chunk (read %u, should be %u at least)"),
len, (u_int)sizeof(WaveFmtBody));
prg_exit(EXIT_FAILURE);
}
check_wavefile_space(buffer, len, blimit);
test_wavefile_read(fd, buffer, &size, len, __LINE__);
f = (WaveFmtBody*) buffer;
format = TO_CPU_SHORT(f->format, big_endian);
if (format == WAV_FMT_EXTENSIBLE) {
WaveFmtExtensibleBody *fe = (WaveFmtExtensibleBody*)buffer;
if (len < sizeof(WaveFmtExtensibleBody)) {
printf(("unknown length of extensible 'fmt ' chunk (read %u, should be %u at least)"),
len, (u_int)sizeof(WaveFmtExtensibleBody));
prg_exit(EXIT_FAILURE);
}
if (memcmp(fe->guid_tag, WAV_GUID_TAG, 14) != 0) {
printf(("wrong format tag in extensible 'fmt ' chunk"));
prg_exit(EXIT_FAILURE);
}
format = TO_CPU_SHORT(fe->guid_format, big_endian);
}
if (format != WAV_FMT_PCM &&
format != WAV_FMT_IEEE_FLOAT) {
printf(("can't play WAVE-file format 0x%04x which is not PCM or FLOAT encoded"), format);
prg_exit(EXIT_FAILURE);
}
channels = TO_CPU_SHORT(f->channels, big_endian);
if (channels < 1) {
printf(("can't play WAVE-files with %d tracks"), channels);
prg_exit(EXIT_FAILURE);
}
hwparams.channels = channels;
switch (TO_CPU_SHORT(f->bit_p_spl, big_endian)) {
case 8:
if (hwparams.format != DEFAULT_FORMAT &&
hwparams.format != SND_PCM_FORMAT_U8)
fprintf(stderr, ("Warning: format is changed to U8\n"));
hwparams.format = SND_PCM_FORMAT_U8;
break;
case 16:
if (big_endian)
native_format = SND_PCM_FORMAT_S16_BE;
else
native_format = SND_PCM_FORMAT_S16_LE;
if (hwparams.format != DEFAULT_FORMAT &&
hwparams.format != native_format)
fprintf(stderr, ("Warning: format is changed to %s\n"),
snd_pcm_format_name((snd_pcm_format_t)native_format));
hwparams.format = (snd_pcm_format_t)native_format;
break;
case 24:
switch (TO_CPU_SHORT(f->byte_p_spl, big_endian) / hwparams.channels) {
case 3:
if (big_endian)
native_format = SND_PCM_FORMAT_S24_3BE;
else
native_format = SND_PCM_FORMAT_S24_3LE;
if (hwparams.format != DEFAULT_FORMAT &&
hwparams.format != native_format)
fprintf(stderr, ("Warning: format is changed to %s\n"),
snd_pcm_format_name((snd_pcm_format_t)native_format));
hwparams.format = (snd_pcm_format_t)native_format;
break;
case 4:
if (big_endian)
native_format = SND_PCM_FORMAT_S24_BE;
else
native_format = SND_PCM_FORMAT_S24_LE;
if (hwparams.format != DEFAULT_FORMAT &&
hwparams.format != native_format)
fprintf(stderr, ("Warning: format is changed to %s\n"),
snd_pcm_format_name((snd_pcm_format_t)native_format));
hwparams.format = (snd_pcm_format_t)native_format;
break;
default:
printf((" can't play WAVE-files with sample %d bits in %d bytes wide (%d channels)"),
TO_CPU_SHORT(f->bit_p_spl, big_endian),
TO_CPU_SHORT(f->byte_p_spl, big_endian),
hwparams.channels);
prg_exit(EXIT_FAILURE);
}
break;
case 32:
if (format == WAV_FMT_PCM) {
if (big_endian)
native_format = SND_PCM_FORMAT_S32_BE;
else
native_format = SND_PCM_FORMAT_S32_LE;
hwparams.format = (snd_pcm_format_t)native_format;
} else if (format == WAV_FMT_IEEE_FLOAT) {
if (big_endian)
native_format = SND_PCM_FORMAT_FLOAT_BE;
else
native_format = SND_PCM_FORMAT_FLOAT_LE;
hwparams.format = (snd_pcm_format_t)native_format;
}
break;
default:
printf((" can't play WAVE-files with sample %d bits wide"),
TO_CPU_SHORT(f->bit_p_spl, big_endian));
prg_exit(EXIT_FAILURE);
}
hwparams.rate = TO_CPU_INT(f->sample_fq, big_endian);
if (size > len)
memmove(buffer, buffer + len, size - len);
size -= len;
while (1) {
u_int type, len;
check_wavefile_space(buffer, sizeof(WaveChunkHeader), blimit);
test_wavefile_read(fd, buffer, &size, sizeof(WaveChunkHeader), __LINE__);
c = (WaveChunkHeader*)buffer;
type = c->type;
len = TO_CPU_INT(c->length, big_endian);
if (size > sizeof(WaveChunkHeader))
memmove(buffer, buffer + sizeof(WaveChunkHeader), size - sizeof(WaveChunkHeader));
size -= sizeof(WaveChunkHeader);
if (type == WAV_DATA) {
if (len < pbrec_count && len < 0x7ffffffe)
pbrec_count = len;
if (size > 0)
memcpy(_buffer, buffer, size);
free(buffer);
return size;
}
len += len % 2;
check_wavefile_space(buffer, len, blimit);
test_wavefile_read(fd, buffer, &size, len, __LINE__);
if (size > len)
memmove(buffer, buffer + len, size - len);
size -= len;
}
/* shouldn't be reached */
return -1;
}
void UkuiLoginSound::show_available_sample_formats(snd_pcm_hw_params_t* params)
{
// snd_pcm_format_t format;
int format;
fprintf(stderr, "Available formats:\n");
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
if (snd_pcm_hw_params_test_format(handle, params, (snd_pcm_format_t)format) == 0)
fprintf(stderr, "- %s\n", snd_pcm_format_name((snd_pcm_format_t)format));
}
}
#ifdef CONFIG_SUPPORT_CHMAP
int UkuiLoginSound::setup_chmap(void)
{
snd_pcm_chmap_t *chmap = channel_map;
char mapped[hwparams.channels];
snd_pcm_chmap_t *hw_chmap;
unsigned int ch, i;
int err;
if (!chmap)
return 0;
if (chmap->channels != hwparams.channels) {
printf(("Channel numbers don't match between hw_params and channel map"));
return -1;
}
err = snd_pcm_set_chmap(handle, chmap);
if (!err)
return 0;
hw_chmap = snd_pcm_get_chmap(handle);
if (!hw_chmap) {
fprintf(stderr, ("Warning: unable to get channel map\n"));
return 0;
}
if (hw_chmap->channels == chmap->channels &&
!memcmp(hw_chmap, chmap, 4 * (chmap->channels + 1))) {
/* maps are identical, so no need to convert */
free(hw_chmap);
return 0;
}
hw_map = (unsigned int *)calloc(hwparams.channels, sizeof(int));
if (!hw_map) {
printf(("not enough memory"));
free(hw_chmap);
return -1;
}
memset(mapped, 0, sizeof(mapped));
for (ch = 0; ch < hw_chmap->channels; ch++) {
if (chmap->pos[ch] == hw_chmap->pos[ch]) {
mapped[ch] = 1;
hw_map[ch] = ch;
continue;
}
for (i = 0; i < hw_chmap->channels; i++) {
if (!mapped[i] && chmap->pos[ch] == hw_chmap->pos[i]) {
mapped[i] = 1;
hw_map[ch] = i;
break;
}
}
if (i >= hw_chmap->channels) {
char buf[256];
printf(("Channel %d doesn't match with hw_parmas"), ch);
snd_pcm_chmap_print(hw_chmap, sizeof(buf), buf);
fprintf(stderr, "hardware chmap = %s\n", buf);
free(hw_chmap);
return -1;
}
}
free(hw_chmap);
return 0;
}
#else
#define setup_chmap() 0
#endif
void UkuiLoginSound::set_params(void)
{
snd_pcm_hw_params_t *params;
snd_pcm_sw_params_t *swparams;
snd_pcm_uframes_t buffer_size;
int err;
size_t n;
unsigned int rate;
snd_pcm_uframes_t start_threshold, stop_threshold;
snd_pcm_hw_params_alloca(¶ms);
snd_pcm_sw_params_alloca(&swparams);
err = snd_pcm_hw_params_any(handle, params);
if (err < 0) {
printf(("Broken configuration for this PCM: no configurations available"));
prg_exit(EXIT_FAILURE);
}
if (dump_hw_params) {
fprintf(stderr, ("HW Params of device \"%s\":\n"),
snd_pcm_name(handle));
fprintf(stderr, "--------------------\n");
snd_pcm_hw_params_dump(params, snd_log);
fprintf(stderr, "--------------------\n");
}
if (mmap_flag) {
snd_pcm_access_mask_t *mask = (snd_pcm_access_mask_t *)alloca(snd_pcm_access_mask_sizeof());
snd_pcm_access_mask_none(mask);
snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_INTERLEAVED);
snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
snd_pcm_access_mask_set(mask, SND_PCM_ACCESS_MMAP_COMPLEX);
err = snd_pcm_hw_params_set_access_mask(handle, params, mask);
} else if (interleaved)
err = snd_pcm_hw_params_set_access(handle, params,
SND_PCM_ACCESS_RW_INTERLEAVED);
else
err = snd_pcm_hw_params_set_access(handle, params,
SND_PCM_ACCESS_RW_NONINTERLEAVED);
if (err < 0) {
printf(("Access type not available"));
prg_exit(EXIT_FAILURE);
}
err = snd_pcm_hw_params_set_format(handle, params, hwparams.format);
if (err < 0) {
printf(("Sample format non available"));
show_available_sample_formats(params);
prg_exit(EXIT_FAILURE);
}
err = snd_pcm_hw_params_set_channels(handle, params, hwparams.channels);
if (err < 0) {
printf(("Channels count non available"));
prg_exit(EXIT_FAILURE);
}
#if 0
err = snd_pcm_hw_params_set_periods_min(handle, params, 2);
assert(err >= 0);
#endif
rate = hwparams.rate;
err = snd_pcm_hw_params_set_rate_near(handle, params, &hwparams.rate, 0);
assert(err >= 0);
if ((float)rate * 1.05 < hwparams.rate || (float)rate * 0.95 > hwparams.rate) {
if (!quiet_mode) {
char plugex[64];
const char *pcmname = snd_pcm_name(handle);
fprintf(stderr, ("Warning: rate is not accurate (requested = %iHz, got = %iHz)\n"), rate, hwparams.rate);
if (! pcmname || strchr(snd_pcm_name(handle), ':'))
*plugex = 0;
else
snprintf(plugex, sizeof(plugex), "(-Dplug:%s)",
snd_pcm_name(handle));
fprintf(stderr, (" please, try the plug plugin %s\n"),
plugex);
}
}
rate = hwparams.rate;
if (buffer_time == 0 && buffer_frames == 0) {
err = snd_pcm_hw_params_get_buffer_time_max(params,
&buffer_time, 0);
assert(err >= 0);
if (buffer_time > 500000)
buffer_time = 500000;
}
if (period_time == 0 && period_frames == 0) {
if (buffer_time > 0)
period_time = buffer_time / 4;
else
period_frames = buffer_frames / 4;
}
if (period_time > 0)
err = snd_pcm_hw_params_set_period_time_near(handle, params,
&period_time, 0);
else
err = snd_pcm_hw_params_set_period_size_near(handle, params,
&period_frames, 0);
assert(err >= 0);
if (buffer_time > 0) {
err = snd_pcm_hw_params_set_buffer_time_near(handle, params,
&buffer_time, 0);
} else {
err = snd_pcm_hw_params_set_buffer_size_near(handle, params,
&buffer_frames);
}
assert(err >= 0);
monotonic = snd_pcm_hw_params_is_monotonic(params);
can_pause = snd_pcm_hw_params_can_pause(params);
err = snd_pcm_hw_params(handle, params);
if (err < 0) {
printf(("Unable to install hw params:"));
snd_pcm_hw_params_dump(params, snd_log);
prg_exit(EXIT_FAILURE);
}
snd_pcm_hw_params_get_period_size(params, &chunk_size, 0);
snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
if (chunk_size == buffer_size) {
printf(("Can't use period equal to buffer size (%lu == %lu)"),
chunk_size, buffer_size);
prg_exit(EXIT_FAILURE);
}
err = snd_pcm_sw_params_current(handle, swparams);
if (err < 0) {
printf(("Unable to get current sw params."));
prg_exit(EXIT_FAILURE);
}
if (avail_min < 0)
n = chunk_size;
else
n = (double) rate * avail_min / 1000000;
err = snd_pcm_sw_params_set_avail_min(handle, swparams, n);
/* round up to closest transfer boundary */
n = buffer_size;
if (start_delay <= 0) {
start_threshold = n + (double) rate * start_delay / 1000000;
} else
start_threshold = (double) rate * start_delay / 1000000;
if (start_threshold < 1)
start_threshold = 1;
if (start_threshold > n)
start_threshold = n;
err = snd_pcm_sw_params_set_start_threshold(handle, swparams, start_threshold);
assert(err >= 0);
if (stop_delay <= 0)
stop_threshold = buffer_size + (double) rate * stop_delay / 1000000;
else
stop_threshold = (double) rate * stop_delay / 1000000;
err = snd_pcm_sw_params_set_stop_threshold(handle, swparams, stop_threshold);
assert(err >= 0);
if (snd_pcm_sw_params(handle, swparams) < 0) {
printf(("unable to install sw params:"));
snd_pcm_sw_params_dump(swparams, snd_log);
prg_exit(EXIT_FAILURE);
}
if (setup_chmap())
prg_exit(EXIT_FAILURE);
if (verbose)
snd_pcm_dump(handle, snd_log);
bits_per_sample = snd_pcm_format_physical_width(hwparams.format);
significant_bits_per_sample = snd_pcm_format_width(hwparams.format);
bits_per_frame = bits_per_sample * hwparams.channels;
chunk_bytes = chunk_size * bits_per_frame / 8;
audiobuf = (u_char *)realloc(audiobuf, chunk_bytes);
if (audiobuf == NULL) {
printf(("not enough memory"));
prg_exit(EXIT_FAILURE);
}
// fprintf(stderr, "real chunk_size = %i, frags = %i, total = %i\n", chunk_size, setup.buf.block.frags, setup.buf.block.frags * chunk_size);
/* stereo VU-meter isn't always available... */
if (vumeter == VUMETER_STEREO) {
if (hwparams.channels != 2 || !interleaved || verbose > 2)
vumeter = VUMETER_MONO;
}
/* show mmap buffer arragment */
if (mmap_flag && verbose) {
const snd_pcm_channel_area_t *areas;
snd_pcm_uframes_t offset, size = chunk_size;
int i;
err = snd_pcm_mmap_begin(handle, &areas, &offset, &size);
if (err < 0) {
printf(("snd_pcm_mmap_begin problem: %s"), snd_strerror(err));
prg_exit(EXIT_FAILURE);
}
for (i = 0; i < hwparams.channels; i++)
fprintf(stderr, "mmap_area[%i] = %p,%u,%u (%u)\n", i, areas[i].addr, areas[i].first, areas[i].step, snd_pcm_format_physical_width(hwparams.format));
/* not required, but for sure */
snd_pcm_mmap_commit(handle, offset, 0);
}
buffer_frames = buffer_size; /* for position test */
}
void UkuiLoginSound::init_stdin(void)
{
struct termios term;
long flags;
if (!interactive)
return;
if (!isatty(fileno(stdin))) {
interactive = 0;
return;
}
tcgetattr(fileno(stdin), &term);
term_c_lflag = term.c_lflag;
if (fd == fileno(stdin))
return;
flags = fcntl(fileno(stdin), F_GETFL);
if (flags < 0 || fcntl(fileno(stdin), F_SETFL, flags|O_NONBLOCK) < 0)
fprintf(stderr, ("stdin O_NONBLOCK flag setup failed\n"));
term.c_lflag &= ~ICANON;
tcsetattr(fileno(stdin), TCSANOW, &term);
}
void UkuiLoginSound::done_stdin(void)
{
struct termios term;
if (!interactive)
return;
if (fd == fileno(stdin) || term_c_lflag == -1)
return;
tcgetattr(fileno(stdin), &term);
term.c_lflag = term_c_lflag;
tcsetattr(fileno(stdin), TCSANOW, &term);
}
void UkuiLoginSound::do_pause(void)
{
int err;
unsigned char b;
if (!can_pause) {
fprintf(stderr, ("\rPAUSE command ignored (no hw support)\n"));
return;
}
if (snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED)
suspend();
err = snd_pcm_pause(handle, 1);
if (err < 0) {
printf(("pause push error: %s"), snd_strerror(err));
return;
}
while (1) {
while (read(fileno(stdin), &b, 1) != 1);
if (b == ' ' || b == '\r') {
while (read(fileno(stdin), &b, 1) == 1);
if (snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED)
suspend();
err = snd_pcm_pause(handle, 0);
if (err < 0)
printf(("pause release error: %s"), snd_strerror(err));
return;
}
}
}
void UkuiLoginSound::check_stdin(void)
{
unsigned char b;
if (!interactive)
return;
if (fd != fileno(stdin)) {
while (read(fileno(stdin), &b, 1) == 1) {
if (b == ' ' || b == '\r') {
while (read(fileno(stdin), &b, 1) == 1);
fprintf(stderr, ("\r=== PAUSE === "));
fflush(stderr);
do_pause();
fprintf(stderr, " \r");
fflush(stderr);
}
}
}
}
#ifndef timersub
#define timersub(a, b, result) \
do { \
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
if ((result)->tv_usec < 0) { \
--(result)->tv_sec; \
(result)->tv_usec += 1000000; \
} \
} while (0)
#endif
#ifndef timermsub
#define timermsub(a, b, result) \
do { \
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
(result)->tv_nsec = (a)->tv_nsec - (b)->tv_nsec; \
if ((result)->tv_nsec < 0) { \
--(result)->tv_sec; \
(result)->tv_nsec += 1000000000L; \
} \
} while (0)
#endif
/* I/O error handler */
void UkuiLoginSound::xrun(void)
{
snd_pcm_status_t *status;
int res;
snd_pcm_status_alloca(&status);
if ((res = snd_pcm_status(handle, status))<0) {
printf(("status error: %s"), snd_strerror(res));
prg_exit(EXIT_FAILURE);
}
if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
if (fatal_errors) {
printf(("fatal %s: %s"),
stream == SND_PCM_STREAM_PLAYBACK ? ("underrun") : ("overrun"),
snd_strerror(res));
prg_exit(EXIT_FAILURE);
}
if (monotonic) {
#ifdef HAVE_CLOCK_GETTIME
struct timespec now, diff, tstamp;
clock_gettime(CLOCK_MONOTONIC, &now);
snd_pcm_status_get_trigger_htstamp(status, &tstamp);
timermsub(&now, &tstamp, &diff);
fprintf(stderr, _("%s!!! (at least %.3f ms long)\n"),
stream == SND_PCM_STREAM_PLAYBACK ? _("underrun") : _("overrun"),
diff.tv_sec * 1000 + diff.tv_nsec / 1000000.0);
#else
fprintf(stderr, "%s !!!\n", ("underrun"));
#endif
} else {
struct timeval now, diff, tstamp;
gettimeofday(&now, 0);
snd_pcm_status_get_trigger_tstamp(status, &tstamp);
timersub(&now, &tstamp, &diff);
fprintf(stderr, ("%s!!! (at least %.3f ms long)\n"),
stream == SND_PCM_STREAM_PLAYBACK ? ("underrun") : ("overrun"),
diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
}
if (verbose) {
fprintf(stderr, ("Status:\n"));
snd_pcm_status_dump(status, snd_log);
}
if ((res = snd_pcm_prepare(handle))<0) {
printf(("xrun: prepare error: %s"), snd_strerror(res));
prg_exit(EXIT_FAILURE);
}
return; /* ok, data should be accepted again */
} if (snd_pcm_status_get_state(status) == SND_PCM_STATE_DRAINING) {
if (verbose) {
fprintf(stderr, ("Status(DRAINING):\n"));
snd_pcm_status_dump(status, snd_log);
}
if (stream == SND_PCM_STREAM_CAPTURE) {
fprintf(stderr, ("capture stream format change? attempting recover...\n"));
if ((res = snd_pcm_prepare(handle))<0) {
printf(("xrun(DRAINING): prepare error: %s"), snd_strerror(res));
prg_exit(EXIT_FAILURE);
}
return;
}
}
if (verbose) {
fprintf(stderr, ("Status(R/W):\n"));
snd_pcm_status_dump(status, snd_log);
}
printf(("read/write error, state = %s"), snd_pcm_state_name(snd_pcm_status_get_state(status)));
prg_exit(EXIT_FAILURE);
}
/* I/O suspend handler */
void UkuiLoginSound::suspend(void)
{
int res;
if (!quiet_mode) {
fprintf(stderr, ("Suspended. Trying resume. ")); fflush(stderr);
}
while ((res = snd_pcm_resume(handle)) == -EAGAIN)
sleep(1); /* wait until suspend flag is released */
if (res < 0) {
if (!quiet_mode) {
fprintf(stderr, ("Failed. Restarting stream. ")); fflush(stderr);
}
if ((res = snd_pcm_prepare(handle)) < 0) {
printf(("suspend: prepare error: %s"), snd_strerror(res));
prg_exit(EXIT_FAILURE);
}
}
if (!quiet_mode)
fprintf(stderr, ("Done.\n"));
}
void UkuiLoginSound::print_vu_meter_mono(int perc, int maxperc)
{
const int bar_length = 50;
char line[80];
int val;
for (val = 0; val <= perc * bar_length / 100 && val < bar_length; val++)
line[val] = '#';
for (; val <= maxperc * bar_length / 100 && val < bar_length; val++)
line[val] = ' ';
line[val] = '+';
for (++val; val <= bar_length; val++)
line[val] = ' ';
// if (maxperc > 99)
// sprintf(line + val, "| MAX");
// else
// sprintf(line + val, "| %02i%%", maxperc);
if (maxperc > 99)
snprintf(line + val, sizeof(line) - val, "| MAX");
else
snprintf(line + val, sizeof(line) - val, "| %02i%%", maxperc);
fputs(line, stderr);
if (perc > 100)
fprintf(stderr, (" !clip "));
}
void UkuiLoginSound::print_vu_meter_stereo(int *perc, int *maxperc)
{
const int bar_length = 35;
char line[80];
int c;
memset(line, ' ', sizeof(line) - 1);
line[bar_length + 3] = '|';
for (c = 0; c < 2; c++) {
int p = perc[c] * bar_length / 100;
char tmp[4];
if (p > bar_length)
p = bar_length;
if (c)
memset(line + bar_length + 6 + 1, '#', p);
else
memset(line + bar_length - p - 1, '#', p);
p = maxperc[c] * bar_length / 100;
if (p > bar_length)
p = bar_length;
if (c)
line[bar_length + 6 + 1 + p] = '+';
else
line[bar_length - p - 1] = '+';
// if (ABS(maxperc[c]) > 99)
// sprintf(tmp, "MAX");
// else
// sprintf(tmp, "%02d%%", maxperc[c]);
if (ABS(maxperc[c]) > 99)
snprintf(tmp, sizeof(tmp), "MAX");
else
snprintf(tmp, sizeof(tmp), "%02d%%", maxperc[c]);
if (c)
memcpy(line + bar_length + 3 + 1, tmp, 3);
else
memcpy(line + bar_length, tmp, 3);
}
line[bar_length * 2 + 6 + 2] = 0;
fputs(line, stderr);
}
void UkuiLoginSound::print_vu_meter(signed int *perc, signed int *maxperc)
{
if (vumeter == VUMETER_STEREO)
print_vu_meter_stereo(perc, maxperc);
else
print_vu_meter_mono(*perc, *maxperc);
}
/* peak handler */
void UkuiLoginSound::compute_max_peak(u_char *data, size_t count)
{
signed int val, max, perc[2], max_peak[2];
static int run = 0;
size_t ocount = count;
int format_little_endian = snd_pcm_format_little_endian(hwparams.format);
int ichans, c;
if (vumeter == VUMETER_STEREO)
ichans = 2;
else
ichans = 1;
memset(max_peak, 0, sizeof(max_peak));
switch (bits_per_sample) {
case 8: {
signed char *valp = (signed char *)data;
signed char mask = snd_pcm_format_silence(hwparams.format);
c = 0;
while (count-- > 0) {
val = *valp++ ^ mask;
val = abs(val);
if (max_peak[c] < val)
max_peak[c] = val;
if (vumeter == VUMETER_STEREO)
c = !c;
}
break;
}
case 16: {
signed short *valp = (signed short *)data;
signed short mask = snd_pcm_format_silence_16(hwparams.format);
signed short sval;
count /= 2;
c = 0;
while (count-- > 0) {
if (format_little_endian)
sval = le16toh(*valp);
else
sval = be16toh(*valp);
sval = abs(sval) ^ mask;
if (max_peak[c] < sval)
max_peak[c] = sval;
valp++;
if (vumeter == VUMETER_STEREO)
c = !c;
}
break;
}
case 24: {
unsigned char *valp = data;
signed int mask = snd_pcm_format_silence_32(hwparams.format);
count /= 3;
c = 0;
while (count-- > 0) {
if (format_little_endian) {
val = valp[0] | (valp[1]<<8) | (valp[2]<<16);
} else {
val = (valp[0]<<16) | (valp[1]<<8) | valp[2];
}
/* Correct signed bit in 32-bit value */
if (val & (1<<(bits_per_sample-1))) {
val |= 0xff<<24; /* Negate upper bits too */
}
val = abs(val) ^ mask;
if (max_peak[c] < val)
max_peak[c] = val;
valp += 3;
if (vumeter == VUMETER_STEREO)
c = !c;
}
break;
}
case 32: {
signed int *valp = (signed int *)data;
signed int mask = snd_pcm_format_silence_32(hwparams.format);
count /= 4;
c = 0;
while (count-- > 0) {
if (format_little_endian)
val = le32toh(*valp);
else
val = be32toh(*valp);
val = abs(val) ^ mask;
if (max_peak[c] < val)
max_peak[c] = val;
valp++;
if (vumeter == VUMETER_STEREO)
c = !c;
}
break;
}
default:
if (run == 0) {
fprintf(stderr, ("Unsupported bit size %d.\n"), (int)bits_per_sample);
run = 1;
}
return;
}
max = 1 << (significant_bits_per_sample-1);
if (max <= 0)
max = 0x7fffffff;
for (c = 0; c < ichans; c++) {
if (bits_per_sample > 16)
perc[c] = max_peak[c] / (max / 100);
else
perc[c] = max_peak[c] * 100 / max;
}
if (interleaved && verbose <= 2) {
static int maxperc[2];
static time_t t=0;
const time_t tt=time(NULL);
if(tt>t) {
t=tt;
maxperc[0] = 0;
maxperc[1] = 0;
}
for (c = 0; c < ichans; c++)
if (perc[c] > maxperc[c])
maxperc[c] = perc[c];
putc('\r', stderr);
print_vu_meter(perc, maxperc);
fflush(stderr);
}
else if(verbose==3) {
fprintf(stderr, ("Max peak (%li samples): 0x%08x "), (long)ocount, max_peak[0]);
for (val = 0; val < 20; val++)
if (val <= perc[0] / 5)
putc('#', stderr);
else
putc(' ', stderr);
fprintf(stderr, " %i%%\n", perc[0]);
fflush(stderr);
}
}
void UkuiLoginSound::do_test_position(void)
{
static long counter = 0;
static time_t tmr = -1;
time_t now;
static float availsum, delaysum, samples;
static snd_pcm_sframes_t maxavail, maxdelay;
static snd_pcm_sframes_t minavail, mindelay;
static snd_pcm_sframes_t badavail = 0, baddelay = 0;
snd_pcm_sframes_t outofrange;
snd_pcm_sframes_t avail, delay;
int err;
err = snd_pcm_avail_delay(handle, &avail, &delay);
if (err < 0)
return;
outofrange = (test_coef * (snd_pcm_sframes_t)buffer_frames) / 2;
if (avail > outofrange || avail < -outofrange ||
delay > outofrange || delay < -outofrange) {
badavail = avail; baddelay = delay;
availsum = delaysum = samples = 0;
maxavail = maxdelay = 0;
minavail = mindelay = buffer_frames * 16;
fprintf(stderr, ("Suspicious buffer position (%li total): "
"avail = %li, delay = %li, buffer = %li\n"),
++counter, (long)avail, (long)delay, (long)buffer_frames);
} else if (verbose) {
time(&now);
if (tmr == (time_t) -1) {
tmr = now;
availsum = delaysum = samples = 0;
maxavail = maxdelay = 0;
minavail = mindelay = buffer_frames * 16;
}
if (avail > maxavail)
maxavail = avail;
if (delay > maxdelay)
maxdelay = delay;
if (avail < minavail)
minavail = avail;
if (delay < mindelay)
mindelay = delay;
availsum += avail;
delaysum += delay;
samples++;
if (avail != 0 && now != tmr) {
fprintf(stderr, "BUFPOS: avg%li/%li "
"min%li/%li max%li/%li (%li) (%li:%li/%li)\n",
(long)(availsum / samples),
(long)(delaysum / samples),
(long)minavail, (long)mindelay,
(long)maxavail, (long)maxdelay,
(long)buffer_frames,
counter, badavail, baddelay);
tmr = now;
}
}
}
/*
*/
#ifdef CONFIG_SUPPORT_CHMAP
u_char * UkuiLoginSound::remap_data(u_char *data, size_t count)
{
static u_char *tmp, *src, *dst;
static size_t tmp_size;
size_t sample_bytes = bits_per_sample / 8;
size_t step = bits_per_frame / 8;
size_t chunk_bytes;
unsigned int ch, i;
if (!hw_map)
return data;
chunk_bytes = count * bits_per_frame / 8;
if (tmp_size < chunk_bytes) {
free(tmp);
tmp = (u_char *)malloc(chunk_bytes);
if (!tmp) {
printf(("not enough memory"));
exit(1);
}
tmp_size = count;
}
src = data;
dst = tmp;
for (i = 0; i < count; i++) {
for (ch = 0; ch < hwparams.channels; ch++) {
memcpy(dst, src + sample_bytes * hw_map[ch],
sample_bytes);
dst += sample_bytes;
}
src += step;
}
return tmp;
}
u_char ** UkuiLoginSound::remap_datav(u_char **data, [[maybe_unused]] size_t count)
{
static u_char **tmp;
unsigned int ch;
if (!hw_map)
return data;
if (!tmp) {
tmp = (u_char **)malloc(sizeof(*tmp) * hwparams.channels);
if (!tmp) {
printf(("not enough memory"));
exit(1);
}
for (ch = 0; ch < hwparams.channels; ch++)
tmp[ch] = data[hw_map[ch]];
}
return tmp;
}
#else
#define remap_data(data, count) (data)
#define remap_datav(data, count) (data)
#endif
/*
* write function
*/
ssize_t UkuiLoginSound::pcm_write(u_char *data, size_t count)
{
ssize_t r;
ssize_t result = 0;
if (count < chunk_size) {
snd_pcm_format_set_silence(hwparams.format, data + count * bits_per_frame / 8, (chunk_size - count) * hwparams.channels);
count = chunk_size;
}
data = remap_data(data, count);
while (count > 0 && !in_aborting) {
if (test_position)
do_test_position();
check_stdin();
r = writei_func(handle, data, count);
if (test_position)
do_test_position();
if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
if (!test_nowait)
snd_pcm_wait(handle, 100);
} else if (r == -EPIPE) {
xrun();
} else if (r == -ESTRPIPE) {
suspend();
} else if (r < 0) {
printf(("write error: %s"), snd_strerror(r));
prg_exit(EXIT_FAILURE);
}
if (r > 0) {
if (vumeter)
compute_max_peak(data, r * hwparams.channels);
result += r;
count -= r;
data += r * bits_per_frame / 8;
}
}
return result;
}
ssize_t UkuiLoginSound::pcm_writev(u_char **data, unsigned int channels, size_t count)
{
ssize_t r;
size_t result = 0;
if (count != chunk_size) {
unsigned int channel;
size_t offset = count;
size_t remaining = chunk_size - count;
for (channel = 0; channel < channels; channel++)
snd_pcm_format_set_silence(hwparams.format, data[channel] + offset * bits_per_sample / 8, remaining);
count = chunk_size;
}
data = remap_datav(data, count);
while (count > 0 && !in_aborting) {
unsigned int channel;
void *bufs[channels];
size_t offset = result;
for (channel = 0; channel < channels; channel++)
bufs[channel] = data[channel] + offset * bits_per_sample / 8;
if (test_position)
do_test_position();
check_stdin();
r = writen_func(handle, bufs, count);
if (test_position)
do_test_position();
if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
if (!test_nowait)
snd_pcm_wait(handle, 100);
} else if (r == -EPIPE) {
xrun();
} else if (r == -ESTRPIPE) {
suspend();
} else if (r < 0) {
printf(("writev error: %s"), snd_strerror(r));
prg_exit(EXIT_FAILURE);
}
if (r > 0) {
if (vumeter) {
for (channel = 0; channel < channels; channel++)
compute_max_peak(data[channel], r);
}
result += r;
count -= r;
}
}
return result;
}
/*
* read function
*/
ssize_t UkuiLoginSound::pcm_read(u_char *data, size_t rcount)
{
ssize_t r;
size_t result = 0;
size_t count = rcount;
if (count != chunk_size) {
count = chunk_size;
}
while (count > 0 && !in_aborting) {
if (test_position)
do_test_position();
check_stdin();
r = readi_func(handle, data, count);
if (test_position)
do_test_position();
if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
if (!test_nowait)
snd_pcm_wait(handle, 100);
} else if (r == -EPIPE) {
xrun();
} else if (r == -ESTRPIPE) {
suspend();
} else if (r < 0) {
printf(("read error: %s"), snd_strerror(r));
prg_exit(EXIT_FAILURE);
}
if (r > 0) {
if (vumeter)
compute_max_peak(data, r * hwparams.channels);
result += r;
count -= r;
data += r * bits_per_frame / 8;
}
}
return rcount;
}
ssize_t UkuiLoginSound::pcm_readv(u_char **data, unsigned int channels, size_t rcount)
{
ssize_t r;
size_t result = 0;
size_t count = rcount;
if (count != chunk_size) {
count = chunk_size;
}
while (count > 0 && !in_aborting) {
unsigned int channel;
void *bufs[channels];
size_t offset = result;
for (channel = 0; channel < channels; channel++)
bufs[channel] = data[channel] + offset * bits_per_sample / 8;
if (test_position)
do_test_position();
check_stdin();
r = readn_func(handle, bufs, count);
if (test_position)
do_test_position();
if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) {
if (!test_nowait)
snd_pcm_wait(handle, 100);
} else if (r == -EPIPE) {
xrun();
} else if (r == -ESTRPIPE) {
suspend();
} else if (r < 0) {
printf(("readv error: %s"), snd_strerror(r));
prg_exit(EXIT_FAILURE);
}
if (r > 0) {
if (vumeter) {
for (channel = 0; channel < channels; channel++)
compute_max_peak(data[channel], r);
}
result += r;
count -= r;
}
}
return rcount;
}
/* setting the globals for playing raw data */
void UkuiLoginSound::init_raw_data(void)
{
hwparams = rhwparams;
}
/* calculate the data count to read from/to dsp */
off64_t UkuiLoginSound::calc_count(void)
{
off64_t count;
if (timelimit == 0)
if (sampleslimit == 0)
count = pbrec_count;
else
count = snd_pcm_format_size(hwparams.format, sampleslimit * hwparams.channels);
else {
count = snd_pcm_format_size(hwparams.format, hwparams.rate * hwparams.channels);
count *= (off64_t)timelimit;
}
return count < pbrec_count ? count : pbrec_count;
}
void UkuiLoginSound::header(int rtype, char *name)
{
if (!quiet_mode) {
if (! name)
name = (char *)((stream == SND_PCM_STREAM_PLAYBACK) ? "stdout" : "stdin");
fprintf(stderr, "%s, ", snd_pcm_format_description(hwparams.format));
fprintf(stderr, ("Rate %d Hz, "), hwparams.rate);
if (hwparams.channels == 1)
fprintf(stderr, ("Mono"));
else if (hwparams.channels == 2)
fprintf(stderr, ("Stereo"));
else
fprintf(stderr, ("Channels %i"), hwparams.channels);
fprintf(stderr, "\n");
}
}
/* playing raw data */
void UkuiLoginSound::playback_go(int fd, size_t loaded, off64_t count, int rtype, char *name)
{
int l, r;
off64_t written = 0;
off64_t c;
header(rtype, name);
set_params();
while (loaded > chunk_bytes && written < count && !in_aborting) {
if (pcm_write(audiobuf + written, chunk_size) <= 0)
return;
written += chunk_bytes;
loaded -= chunk_bytes;
}
if (written > 0 && loaded > 0)
memmove(audiobuf, audiobuf + written, loaded);
l = loaded;
while (written < count && !in_aborting) {
do {
c = count - written;
if (c > chunk_bytes)
c = chunk_bytes;
/* c < l, there is more data loaded
* then we actually need to write
*/
if (c < l)
l = c;
c -= l;
if (c == 0)
break;
r = safe_read(fd, audiobuf + l, c);
if (r < 0) {
perror(name);
prg_exit(EXIT_FAILURE);
}
fdcount += r;
if (r == 0)
break;
l += r;
} while ((size_t)l < chunk_bytes);
l = l * 8 / bits_per_frame;
r = pcm_write(audiobuf, l);
if (r != l)
break;
r = r * bits_per_frame / 8;
written += r;
l = 0;
}
snd_pcm_nonblock(handle, 0);
snd_pcm_drain(handle);
snd_pcm_nonblock(handle, nonblock);
}
int UkuiLoginSound::read_header(int *loaded, int header_size)
{
int ret;
struct stat buf;
ret = fstat(fd, &buf);
if (ret < 0) {
perror("fstat");
prg_exit(EXIT_FAILURE);
}
/* don't be adventurous, get out if file size is smaller than
* requested header size */
if ((buf.st_mode & S_IFMT) == S_IFREG &&
buf.st_size < header_size)
return -1;
if (*loaded < header_size) {
header_size -= *loaded;
ret = safe_read(fd, audiobuf + *loaded, header_size);
if (ret != header_size) {
printf(("read error"));
prg_exit(EXIT_FAILURE);
}
*loaded += header_size;
}
return 0;
}
int UkuiLoginSound::playback_wave(char *name, int *loaded)
{
ssize_t dtawave;
syslog (LOG_INFO, "start play %s file...", name);
if (read_header(loaded, sizeof(WaveHeader)) < 0)
return -1;
if ((dtawave = test_wavefile(fd, audiobuf, *loaded)) < 0)
return -1;
pbrec_count = calc_count();
playback_go(fd, dtawave, pbrec_count, FORMAT_WAVE, name);
return 0;
}
int UkuiLoginSound::playback_raw(char *name, int *loaded)
{
syslog (LOG_INFO, "start play %s file...", name);
init_raw_data();
pbrec_count = calc_count();
playback_go(fd, *loaded, pbrec_count, FORMAT_RAW, name);
return 0;
}
/*
* let's play or capture it (capture_type says VOC/WAVE/raw)
*/
void UkuiLoginSound::playback(char *name)
{
int loaded = 0;
pbrec_count = LLONG_MAX;
fdcount = 0;
if (!name || !strcmp(name, "-")) {
fd = fileno(stdin);
name = "stdin";
} else {
init_stdin();
if ((fd = open(name, O_RDONLY, 0)) == -1) {
perror(name);
prg_exit(EXIT_FAILURE);
}
}
/* parse the file header */
if (playback_wave(name, &loaded) < 0)
playback_raw(name, &loaded); /* should be raw data */
if (fd != fileno(stdin))
close(fd);
}
UkuiLoginSound::UkuiLoginSound()
{
}
int UkuiLoginSound::wav_convert(int volume)
{
if (volume > NORMAL_VOLUME) {
volume = NORMAL_VOLUME;
}
float volume_factor = volume/NORMAL_VOLUME;
QString cmd = "ffmpeg -i ";
cmd += PLAY_STARTUP_WAV;
cmd += " ";
cmd += QString("-filter:a volume=%1 ").arg(volume_factor);
cmd += TMP_STARTUP_WAV_PATH;
int err = system(cmd.toLatin1().data());
if(err)
{
syslog(LOG_ERR, "file convert error, err:%d.", err);
return -1;
}
return 0;
}
char* UkuiLoginSound::checkPcm(char *pcmName)
{
void **hints, **n;
char *name, *defaultPcmName;
defaultPcmName = "default";
if (snd_device_name_hint(-1, "pcm", &hints) < 0)
return "default";
n = hints;
/* If the configuration file does not specify or does not exist,
* the PCM device list is traversed to find the last PCM device
* as the output device to play the system sound effect. */
while (*n != NULL) {
name = snd_device_name_get_hint(*n, "NAME");
if (strcmp(pcmName, name) == 0) {
return pcmName;
}
else if (strstr(name, "sysdefault")) {
defaultPcmName = name;
}
n++;
}
snd_device_name_free_hint(hints);
if (name != NULL)
free(name);
syslog(LOG_INFO, "system does not have %s device, so the device from %s changed to %s device", pcmName, pcmName, defaultPcmName);
return defaultPcmName;
}
bool UkuiLoginSound::isSupportHardwareVolumeControl(char *card)
{
int err;
snd_hctl_t* handle;
snd_hctl_elem_t* elem;
snd_ctl_elem_info_t* info;
snd_ctl_elem_id_t* id;
snd_ctl_elem_info_alloca(&info);
snd_ctl_elem_id_alloca(&id);
bool ret = false;
if ((err = snd_hctl_open(&handle, card, 0)) < 0) {
syslog(LOG_ERR, "control %s open error: %s", card, snd_strerror(err));
return ret;
}
if ((err = snd_hctl_load(handle)) < 0) {
syslog(LOG_ERR, "control %s local error: %s", card, snd_strerror(err));
return ret;
}
for (elem = snd_hctl_first_elem(handle); elem; elem = snd_hctl_elem_next(elem)) {
if ((err = snd_hctl_elem_info(elem, info)) < 0) {
syslog(LOG_ERR, "Control %s snd_hctl_elem_info error: %s", card, snd_strerror(err));
return ret;
}
snd_hctl_elem_get_id(elem, id);
char* str = snd_ctl_ascii_elem_id_get(id);
if (strstr(str, "Volume")) {
ret = true;
break;
}
}
syslog(LOG_INFO, "card %s %s hardware volume control.", card, ret ? "support" : "unsupport");
return ret;
}
ukui-media/ukui-login-sound/ukui_login_sound_user_config.h 0000664 0001750 0001750 00000004001 15170054730 023051 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef UKUILOGINSOUNDUSERCONFIG_H
#define UKUILOGINSOUNDUSERCONFIG_H
#include
#include
#include
#include
#include
#include
#include
#include "../common/user_config.h"
#include "../common/user_info_json.h"
#include "../common/sound_effect_json.h"
class UkuiLoginSoundUserConfig : public UserConfig
{
public:
UkuiLoginSoundUserConfig();
~UkuiLoginSoundUserConfig();
public:
const QString getAutoLoginUser() const;
const QString getLastLoginUser() const;
std::unordered_map> getJsonMap() const;
virtual void initJsonMap() override;
private:
void initSettings();
QString getSoundEffectFullPath();
QString getUserInfoFullPath();
private:
std::unordered_map> m_keys {
{JsonType::JSON_TYPE_SOUNDEFFECT, [this](){ return getSoundEffectFullPath();}},
{JsonType::JSON_TYPE_USERINFO, [this](){ return getUserInfoFullPath(); }},
};
std::unique_ptr m_pLastLoginSetting;
std::unique_ptr m_pAutoLoginSetting;
};
#endif // UKUILOGINSOUNDUSERCONFIG_H
ukui-media/AUTHORS 0000664 0001750 0001750 00000001332 15170052044 012577 0 ustar feng feng UKUI:
Hao Lee
MATE:
Perberos
Steve Zesch
Stefano Karapetsas
Michal Ratajsky
GNOME Maintainers:
Marc-Andre Lureau
Bastien Nocera
GNOME Authors:
Andreas Hyden (grecord)
Seth Nickell (gst-mixer)
Ronald Bultje (gst-mixer)
Thomas Vander Stichele (profiles)
William Jon McCann (mate-volume-control)
ukui-media/ukui-media-control-led/ 0000775 0001750 0001750 00000000000 15170054730 016006 5 ustar feng feng ukui-media/ukui-media-control-led/ukui_media_control_led.h 0000664 0001750 0001750 00000002370 15170054730 022661 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef MATE_MEDIA_CONTROL_LED_H
#define MATE_MEDIA_CONTROL_LED_H
#include
#include
#include
class UkuiMediaControlLed : public QObject
{
Q_OBJECT
public:
UkuiMediaControlLed();
~UkuiMediaControlLed();
private slots:
void outputMuteChanged(QString str);
void inputMuteChanged(QString str);
private:
};
#endif // MATE_MEDIA_CONTROL_LED_H
ukui-media/ukui-media-control-led/ukui_media_control_led.cpp 0000664 0001750 0001750 00000005010 15170054730 023206 0 ustar feng feng /*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see
#include
#include
#include
#include
#include
#include
#include
UkuiMediaControlLed::UkuiMediaControlLed()
{
QDBusConnection::systemBus().connect(QString(),"/","org.ukui.media","systemOutputVolumeIsMute",this,SLOT(outputMuteChanged(QString)));
QDBusConnection::systemBus().connect(QString(),"/","org.ukui.media","systemInputVolumeIsMute",this,SLOT(inputMuteChanged(QString)));
}
void UkuiMediaControlLed::outputMuteChanged(QString str)
{
QFile file("/sys/class/leds/platform::mute/brightness");
if(!file.exists()){
qDebug() << " THE DIRECTORY OR FILE IS NOT EXIST ";
return;
}
qDebug() << "sink muted" << str;
if (strstr(str.toLatin1().data(),"mute")) {
qDebug() << "输出音量静音";
system("echo 1 > /sys/class/leds/platform::mute/brightness");
}
else if (strstr(str.toLatin1().data(),"no")) {
qDebug() << "输出音量取消静音";
system("echo 0 > /sys/class/leds/platform::mute/brightness");
}
}
void UkuiMediaControlLed::inputMuteChanged(QString str)
{
QFile file("/sys/class/leds/platform::micmute/brightness");
if(!file.exists()){
qDebug() << " THE DIRECTORY OR FILE IS NOT EXIST ";
return;
}
qDebug() << "source muted" << str;
if (strstr(str.toLatin1().data(),"mute")) {
qDebug() << "输入音量静音";
system("echo 1 > /sys/class/leds/platform::micmute/brightness");
}
else if (strstr(str.toLatin1().data(),"no")) {
qDebug() << "输入音量取消静音";
system("echo 0 > /sys/class/leds/platform::micmute/brightness");
}
}
UkuiMediaControlLed::~UkuiMediaControlLed()
{
}
ukui-media/ukui-media-control-led/main.cpp 0000664 0001750 0001750 00000002103 15170054730 017432 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "ukui_media_control_led.h"
//#include
#include
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
UkuiMediaControlLed control;
return a.exec();
}
ukui-media/ukui-media-control-led/ukui-media-control-led.pro 0000664 0001750 0001750 00000002065 15170052044 023001 0 ustar feng feng #-------------------------------------------------
#
# Project created by QtCreator 2021-01-03T20:04:12
#
#-------------------------------------------------
QT += core gui dbus
#greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = ukui-media-control-led
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
target.path = /usr/bin
SOURCES += \
main.cpp \
ukui_media_control_led.cpp
HEADERS += \
ukui_media_control_led.h
INSTALLS += \
target
ukui-media/man/ 0000775 0001750 0001750 00000000000 15170054730 012307 5 ustar feng feng ukui-media/man/Makefile.am 0000664 0001750 0001750 00000000170 15170052044 014335 0 ustar feng feng man_MANS = ukui-volume-control.1 ukui-volume-control-applet.1 ukui-volume-control-applet-qt.1
EXTRA_DIST = $(man_MANS)
ukui-media/man/ukui-media-control-led.1 0000664 0001750 0001750 00000002061 15170052044 016636 0 ustar feng feng .\" Man Page for ukui-volume-control-applet-qt
.TH UKUI-MEDIA-CONTROL-LED 1 "20 February 2019" "UKUI Desktop Environment"
.\" Please adjust this date when revising the manpage.
.\"
.SH "NAME"
\fBukui-media-control-led\fR \- The UKUI Volume Control Applet(Qt)
.SH "SYNOPSIS"
.B ukui-media-control-led [OPTIONS]
.SH "DESCRIPTION"
The UKUI Volume Control Applet is used for adjusting audio levels from the notification area.
.SH "OPTIONS"
.TP
\fB\-v, \-\-version\fR
Output version information and exit.
.TP
\fB\-d, \-\-debug\fR
Enable debugging code.
.TP
\fB\-\-display=DISPLAY\fR
X display to use.
.TP
\fB\-?, \-h, \-\-help\fR
Print standard command line options.
.TP
\fB\-\-help\-all\fR
Print all command line options.
.SH "BUGS"
.SS Should you encounter any bugs, they may be reported at:
http://github.com/ukui/ukui-media/issues
.SH "AUTHORS"
.SS This Manual Page has been written for the UKUI Desktop Environment by:
Adam Erdman (2014)
.SH "SEE ALSO"
.SS Further information may also be available at: http://ukui.org
.BR ukui-media-control-led (1)
ukui-media/man/sound-theme-player.1 0000664 0001750 0001750 00000000661 15170054730 016116 0 ustar feng feng .TH sound-theme-player 1 "UKUI Media"
.SH NAME
sound-theme-player \- 播放 UKUI 声音主题的命令行工具
.SH SYNOPSIS
.B sound-theme-player
[
.I options
]
.SH DESCRIPTION
.B sound-theme-player
用于根据 UKUI 声音主题配置播放启动、关机等提示音。
.SH OPTIONS
无特定命令行参数。运行后按默认主题播放指定声音。
.SH SEE ALSO
.BR ukui-login-sound (1)
.SH AUTHOR
Kylin Software Co., Ltd.
ukui-media/man/ukui-login-sound.1 0000664 0001750 0001750 00000000604 15170054730 015602 0 ustar feng feng .TH ukui-login-sound 1 "UKUI Media"
.SH NAME
ukui-login-sound \- 在登录会话时播放提示音
.SH SYNOPSIS
.B ukui-login-sound
[
.I options
]
.SH DESCRIPTION
.B ukui-login-sound
在用户登录桌面会话时播放登录提示音,用于桌面环境启动反馈。
.SH OPTIONS
无特定命令行参数。
.SH SEE ALSO
.BR sound-theme-player (1)
.SH AUTHOR
Kylin Software Co., Ltd.
ukui-media/man/ukui-volume-control-applet-qt.1 0000664 0001750 0001750 00000002074 15170052044 020235 0 ustar feng feng .\" Man Page for ukui-volume-control-applet-qt
.TH UKUI-VOLUME-CONTROL-APPLET-QT 1 "20 February 2019" "UKUI Desktop Environment"
.\" Please adjust this date when revising the manpage.
.\"
.SH "NAME"
\fBukui-volume-control-applet-qt\fR \- The UKUI Volume Control Applet(Qt)
.SH "SYNOPSIS"
.B ukui-volume-control-qt [OPTIONS]
.SH "DESCRIPTION"
The UKUI Volume Control Applet is used for adjusting audio levels from the notification area.
.SH "OPTIONS"
.TP
\fB\-v, \-\-version\fR
Output version information and exit.
.TP
\fB\-d, \-\-debug\fR
Enable debugging code.
.TP
\fB\-\-display=DISPLAY\fR
X display to use.
.TP
\fB\-?, \-h, \-\-help\fR
Print standard command line options.
.TP
\fB\-\-help\-all\fR
Print all command line options.
.SH "BUGS"
.SS Should you encounter any bugs, they may be reported at:
http://github.com/ukui/ukui-media/issues
.SH "AUTHORS"
.SS This Manual Page has been written for the UKUI Desktop Environment by:
Adam Erdman (2014)
.SH "SEE ALSO"
.SS Further information may also be available at: http://ukui.org
.BR ukui-volume-control (1)
ukui-media/COPYING 0000664 0001750 0001750 00000043254 15170052044 012573 0 ustar feng feng GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
ukui-media/audio/ 0000775 0001750 0001750 00000000000 15170054730 012635 5 ustar feng feng ukui-media/audio/ukmedia_settings_widget.cpp 0000664 0001750 0001750 00000012104 15170054730 020241 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "ukmedia_settings_widget.h"
#include
UkmediaSettingsWidget::UkmediaSettingsWidget(QWidget *parent) : QWidget(parent)
{
m_pAdvancedSettingsWidget = new QFrame(this);
m_pEquipmentControlWidget = new QFrame(m_pAdvancedSettingsWidget);
m_pAppSoundCtrlWidget = new QFrame(m_pAdvancedSettingsWidget);
m_pAdvancedSettingsWidget->setFrameShape(QFrame::Shape::Box);
m_pEquipmentControlWidget->setFrameShape(QFrame::Shape::Box);
m_pAppSoundCtrlWidget->setFrameShape(QFrame::Shape::Box);
//高级设置标签
//~ contents_path /Audio/Advanced Settings
m_pAdvancedSettingsLabel = new TitleLabel(this);
m_pAdvancedSettingsLabel->setText(tr("Advanced Settings"));
m_pAdvancedSettingsLabel->setContentsMargins(16,0,16,0);
m_pAdvancedSettingsLabel->setStyleSheet("QLabel{color: palette(windowText);}");
//声音设备管理标签
//~ contents_path /Audio/Sound Equipment Control
m_pEquipmentControlLabel = new QLabel(tr("Sound Equipment Control"), m_pEquipmentControlWidget);
m_pDevControlDetailsBtn = new QPushButton(m_pEquipmentControlWidget);
m_pDevControlDetailsBtn->setText(tr("Details"));
m_pDevControlDetailsBtn->setProperty("useButtonPalette",true);
//应用声音标签
//~ contents_path /Audio/App Sound Control
m_pAppSoundLabel = new QLabel(tr("App Sound Control"), m_pAppSoundCtrlWidget);
m_pAppSoundDetailsBtn = new QPushButton(m_pAppSoundCtrlWidget);
m_pAppSoundDetailsBtn->setText(tr("Details"));
m_pAppSoundDetailsBtn->setProperty("useButtonPalette", true);
//设置大小
m_pAdvancedSettingsWidget->setMinimumSize(550,0);
m_pAdvancedSettingsWidget->setMaximumSize(16777215,240);
m_pEquipmentControlWidget->setMinimumSize(550,60);
m_pEquipmentControlWidget->setMaximumSize(16777215,60);
m_pAppSoundCtrlWidget->setMinimumSize(550,60);
m_pAppSoundCtrlWidget->setMaximumSize(16777215,60);
//声音设备管控
QHBoxLayout *EquipmentControlLayout = new QHBoxLayout(m_pEquipmentControlWidget);
EquipmentControlLayout->addItem(new QSpacerItem(16,20,QSizePolicy::Fixed));
EquipmentControlLayout->addWidget(m_pEquipmentControlLabel);
EquipmentControlLayout->addItem(new QSpacerItem(16,20,QSizePolicy::Expanding));
EquipmentControlLayout->addWidget(m_pDevControlDetailsBtn);
EquipmentControlLayout->addItem(new QSpacerItem(16,20,QSizePolicy::Fixed));
EquipmentControlLayout->setSpacing(0);
m_pEquipmentControlWidget->setLayout(EquipmentControlLayout);
m_pEquipmentControlWidget->layout()->setContentsMargins(0,0,0,0);
//应用声音
QHBoxLayout *AppSoundLayout = new QHBoxLayout(m_pAppSoundCtrlWidget);
AppSoundLayout->addItem(new QSpacerItem(16,20,QSizePolicy::Fixed));
AppSoundLayout->addWidget(m_pAppSoundLabel);
AppSoundLayout->addItem(new QSpacerItem(16,20,QSizePolicy::Expanding));
AppSoundLayout->addWidget(m_pAppSoundDetailsBtn);
AppSoundLayout->addItem(new QSpacerItem(16,20,QSizePolicy::Fixed));
AppSoundLayout->setSpacing(0);
m_pAppSoundCtrlWidget->setLayout(AppSoundLayout);
m_pAppSoundCtrlWidget->layout()->setContentsMargins(0,0,0,0);
//设备管控和应用声音添加布局
QVBoxLayout *m_pVlayout1 = new QVBoxLayout(m_pAdvancedSettingsWidget);
m_pVlayout1->setContentsMargins(0,0,0,0);
m_pVlayout1->addWidget(m_pEquipmentControlWidget);
m_pVlayout1->addWidget(myLine());
m_pVlayout1->addWidget(m_pAppSoundCtrlWidget);
m_pVlayout1->setSpacing(0);
m_pAdvancedSettingsWidget->setLayout(m_pVlayout1);
m_pAdvancedSettingsWidget->layout()->setContentsMargins(0,0,0,0);
//整体布局
QVBoxLayout *vLayout1 = new QVBoxLayout(this);
vLayout1->addWidget(m_pAdvancedSettingsLabel);
vLayout1->addItem(new QSpacerItem(16,4,QSizePolicy::Fixed));
vLayout1->addWidget(m_pAdvancedSettingsWidget);
this->setLayout(vLayout1);
this->layout()->setContentsMargins(0,0,0,0);
}
QFrame* UkmediaSettingsWidget::myLine()
{
QFrame *line = new QFrame(this);
line->setMinimumSize(QSize(0, 1));
line->setMaximumSize(QSize(16777215, 1));
line->setLineWidth(0);
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
return line;
}
UkmediaSettingsWidget::~UkmediaSettingsWidget()
{
}
ukui-media/audio/ukmedia_output_widget.h 0000664 0001750 0001750 00000005355 15170054730 017420 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef UKMEDIAOUTPUTWIDGET_H
#define UKMEDIAOUTPUTWIDGET_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "ukui_custom_style.h"
#include "ukui_list_widget_item.h"
#include "customstyle.h"
#include
#include
#include "kswitchbutton.h"
#include
using namespace kdk;
class UkmediaOutputWidget : public QWidget
{
Q_OBJECT
public:
explicit UkmediaOutputWidget(QWidget *parent = nullptr);
~UkmediaOutputWidget();
void setVolumeSliderRange(bool status);
friend class UkmediaMainWidget;
Q_SIGNALS:
public Q_SLOTS:
void onPaletteChanged();
private:
void setLabelAlignment(Qt::Alignment alignment);
QFrame* myLine();
private:
QFrame *m_pOutputWidget;
QFrame *m_pMasterVolumeWidget;
QFrame *m_pVolumeIncreaseWidget;
QWidget *VolumeIncreaseTipsWidget;
QFrame *m_pAudioBlanceWidget; //monoAudio
QFrame *m_pMonoAudioWidget;
QFrame *m_pChannelBalanceWidget;
QFrame *m_pMonoLine;
QWidget *MonoAudioTipsWidget;
FixLabel *m_pMonoAudioLabel;
FixLabel *MonoAudioTipsLabel;
KSwitchButton *m_pMonoAudioButton;
TitleLabel *m_pOutputLabel;
FixLabel *m_pOutputDeviceLabel;
FixLabel *m_pOpVolumeLabel;
QLabel *m_pOpVolumePercentLabel;
FixLabel *m_pOpBalanceLabel;
FixLabel *VolumeIncreaseTipsLabel;
FixLabel *m_pLeftBalanceLabel;
FixLabel *m_pRightBalanceLabel;
FixLabel *m_pVolumeIncreaseLabel;
QComboBox *m_pDeviceSelectBox;
QFrame *m_pOutputSlectWidget;
UkuiButtonDrawSvg *m_pOutputIconBtn;
AudioSlider *m_pOpVolumeSlider;
UkmediaVolumeSlider *m_pOpBalanceSlider;
KSwitchButton *m_pVolumeIncreaseButton;
QVBoxLayout *m_pVlayout;
QString sliderQss;
};
#endif // UKMEDIAOUTPUTWIDGET_H
ukui-media/audio/audio.cpp 0000664 0001750 0001750 00000004631 15170052044 014442 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "audio.h"
#include "ui_audio.h"
#include
#include
#include
Audio::Audio() : mFirstLoad(true)
{
#ifndef QT_NO_TRANSLATION
QString translatorFileName = QLatin1String("qt_");
translatorFileName += QLocale::system().name();
QTranslator *pTranslator = new QTranslator();
if (pTranslator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
QApplication::installTranslator(pTranslator);
#endif
QTranslator *translator = new QTranslator(this);
translator->load("/usr/share/ukui-media/translations/audio/" + QLocale::system().name());
QApplication::installTranslator(translator);
pluginName = tr("Audio");
pluginType = SYSTEM;
}
Audio::~Audio()
{
}
QString Audio::plugini18nName()
{
return pluginName;
}
int Audio::pluginTypes()
{
return pluginType;
}
QWidget *Audio::pluginUi()
{
if (mFirstLoad) {
mFirstLoad = false;
widget = new UkmediaMainWidget;
}
return widget;
}
bool Audio::isEnable() const
{
return true;
}
const QString Audio::name() const
{
return QStringLiteral("Audio");
}
bool Audio::isShowOnHomePage() const
{
return true;
}
QIcon Audio::icon() const
{
return QIcon::fromTheme("audio-volume-high-symbolic");
}
QString Audio::translationPath() const
{
return "/usr/share/ukui-media/translations/audio/%1.ts";
}
void Audio::initSearchText()
{
//~ contents_path /UkccPlugin/UkccPlugin
tr("UkccPlugin");
//~ contents_path /UkccPlugin/ukccplugin test
tr("ukccplugin test");
}
ukui-media/audio/customstyle.cpp 0000664 0001750 0001750 00000036375 15170054730 015752 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "customstyle.h"
#include
#include
#include
#include
CustomStyle::CustomStyle(const QString &proxyStyleName, QObject *parent) : QProxyStyle (proxyStyleName)
{
Q_UNUSED(parent);
m_helpTip = new SliderTipLabelHelper(this);
}
CustomStyle::~CustomStyle()
{
}
void CustomStyle::drawComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
{
if(control == CC_ToolButton)
{
/// 我们需要获取ToolButton的详细信息,通过qstyleoption_cast可以得到
/// 对应的option,通过拷贝构造函数得到一份备份用于绘制子控件
/// 我们一般不用在意option是怎么得到的,大部分的Qt控件都能够提供了option的init方法
}
return QProxyStyle::drawComplexControl(control, option, painter, widget);
}
void CustomStyle::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
switch (element) {
case CE_ProgressBar:
{
if (const QStyleOptionProgressBar *pb = qstyleoption_cast(option)) {
QStyleOptionProgressBar subopt = *pb;
subopt.rect = subElementRect(SE_ProgressBarGroove, pb, widget);
proxy()->drawControl(CE_ProgressBarGroove, &subopt, painter, widget);
subopt.rect = subElementRect(SE_ProgressBarContents, pb, widget);
proxy()->drawControl(CE_ProgressBarContents, &subopt, painter, widget);
//这是这个控件的当前进度的文字,你那边看情况是否需要绘制
// if (pb->textVisible) {
// subopt.rect = subElementRect(SE_ProgressBarLabel, pb, widget);
// proxy()->drawControl(CE_ProgressBarLabel, &subopt, painter, widget);
// }
return;
}
break;
}
case CE_ProgressBarGroove:
{
//这是这个控件的背景,你那边看情况是否绘制
return;
if (const QStyleOptionProgressBar *pbg = qstyleoption_cast(option)) {
const bool enable = pbg->state &State_Enabled;
painter->save();
painter->setRenderHint(QPainter::Antialiasing, true);
painter->setPen(Qt::NoPen);
painter->setBrush(pbg->palette.brush(enable ? QPalette::Active : QPalette::Disabled, QPalette::Window));
painter->drawRect(pbg->rect);
painter->restore();
return;
}
break;
}
case CE_ProgressBarContents:
{
if (const QStyleOptionProgressBar *bar = qstyleoption_cast(option)) {
if (bar->progress == bar->maximum)
return;
const bool enable = bar->state & QStyle::State_Enabled;
bool vertical = false;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (widget) {
const QProgressBar *progressBar = qobject_cast(widget);
if (progressBar) {
vertical = (progressBar->orientation() == Qt::Vertical);
}
}
#else
vertical = (bar->orientation == Qt::Vertical);
#endif
const bool inverted = bar->invertedAppearance;
qint64 minimum = qint64(bar->minimum);
qint64 maximum = qint64(bar->maximum);
qint64 progress = qint64(bar->progress);
qint64 totalSteps = qMax(Q_INT64_C(1), maximum - minimum);
qint64 progressSteps = progress - bar->minimum;
qint64 progressBarWidth = progressSteps * (vertical ? bar->rect.height() : bar->rect.width()) / totalSteps;
int ProgressBarItem_Width = 4;
int ProgressBarItem_Distance = 16;
int distance = ProgressBarItem_Distance + ProgressBarItem_Width;
int num = progressBarWidth / distance;
int totalnum = (vertical ? bar->rect.height() : bar->rect.width()) / distance;
bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical;
if (inverted)
reverse = !reverse;
int ProgressBarItem_Hight = 16;
QRect drawRect(bar->rect);
if (vertical) {
drawRect.setWidth(ProgressBarItem_Hight);
} else {
drawRect.setHeight(ProgressBarItem_Hight);
}
drawRect.moveCenter(bar->rect.center());
QRect itemRect(drawRect);
painter->save();
painter->setPen(Qt::NoPen);
painter->setRenderHints(QPainter::Antialiasing, true);
for (int var = 0; var < totalnum; ++var) {
if (var < num) {
if (enable)
painter->setBrush(bar->palette.brush(QPalette::Active, QPalette::Highlight));
else {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
painter->setBrush(bar->palette.color(QPalette::Active, QPalette::Highlight).lighter(150));
#else
painter->setBrush(bar->palette.color(QPalette::Active, QPalette::Highlight).light(150));
#endif
}
} else {
painter->setBrush(bar->palette.brush(enable ? QPalette::Active : QPalette::Disabled, QPalette::Button));
}
if (vertical)
itemRect.setRect(drawRect.left(), !reverse ? drawRect.top() + var * distance : drawRect.bottom() - ProgressBarItem_Width - var * distance,
drawRect.width(), ProgressBarItem_Width);
else
itemRect.setRect(reverse ? drawRect.right() - ProgressBarItem_Width - var * distance : drawRect.left() + var * distance, drawRect.top(),
ProgressBarItem_Width, drawRect.height());
painter->drawRoundedRect(itemRect, ProgressBarItem_Width/2, ProgressBarItem_Width/2);
}
painter->restore();;
return;
}
break;
}
default:
break;
}
return QProxyStyle::drawControl(element, option, painter, widget);
}
void CustomStyle::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::drawItemPixmap(painter, rectangle, alignment, pixmap);
}
void CustomStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const
{
return QProxyStyle::drawItemText(painter, rectangle, alignment, palette, enabled, text, textRole);
}
//绘制简单的颜色圆角等
void CustomStyle::drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
{
switch (element) {
//绘制 ToolButton
case PE_PanelButtonTool:{
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
painter->setBrush(QColor(0xff,0xff,0xff,0x00));
painter->drawRoundedRect(option->rect,4,4);
if (option->state & State_MouseOver) {
if (option->state & State_Sunken) {
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
painter->setBrush(QColor(0xff,0xff,0xff,0x14));
painter->drawRoundedRect(option->rect,4,4);
qDebug() << " 点击按钮";
} else {
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
painter->setBrush(QColor(0xff,0xff,0xff,0x1f));
painter->drawRoundedRect(option->rect,4,4);
qDebug() << "悬停按钮";
}
}
painter->restore();
return;
}
case PE_PanelTipLabel:{
painter->save();
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
painter->setBrush(QColor(0xff,0xff,0x00,0xff));
painter->drawRoundedRect(option->rect,4,4);
painter->restore();
return;
}break;
case PE_PanelButtonCommand:{
painter->save();
painter->setRenderHint(QPainter::TextAntialiasing,true);
painter->setPen(Qt::NoPen);
painter->setBrush(QColor(0xff,0xff,0xff,0x00));
if (option->state & State_MouseOver) {
if (option->state & State_Sunken) {
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
painter->setBrush(QColor(0x3d,0x6b,0xe5,0xff));
painter->drawRoundedRect(option->rect,4,4);
} else {
painter->setRenderHint(QPainter::Antialiasing,true);
painter->setPen(Qt::NoPen);
painter->setBrush(QColor(0xff,0xff,0xff,0x1f));
painter->drawRoundedRect(option->rect.adjusted(2,2,-2,-2),4,4);
}
}
painter->restore();
return;
}break;
}
return QProxyStyle::drawPrimitive(element, option, painter, widget);
}
QPixmap CustomStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const
{
return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option);
}
QStyle::SubControl CustomStyle::hitTestComplexControl(QStyle::ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget) const
{
return QProxyStyle::hitTestComplexControl(control, option, position, widget);
}
QRect CustomStyle::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const
{
return QProxyStyle::itemPixmapRect(rectangle, alignment, pixmap);
}
QRect CustomStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const
{
return QProxyStyle::itemTextRect(metrics, rectangle, alignment, enabled, text);
}
//
int CustomStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
switch (metric){
case PM_ProgressBarChunkWidth:
{
int ProgressBarItem_Width = 4;
int ProgressBarItem_Distance = 16;
return ProgressBarItem_Width + ProgressBarItem_Distance;
}
case PM_ToolBarIconSize:{
return (int)48*qApp->devicePixelRatio();
}
default:
break;
}
return QProxyStyle::pixelMetric(metric, option, widget);
}
//
void CustomStyle::polish(QWidget *widget)
{
if (widget) {
if (widget->inherits("QTipLabel")) {
widget->setAttribute(Qt::WA_TranslucentBackground);
QPainterPath path;
auto rect = widget->rect();
rect.adjust(0,0,0,0);
path.addRoundedRect(rect,6,6);
widget->setProperty("blurRegion",QRegion(path.toFillPolygon().toPolygon()));
}
}
if (widget) {
if (widget->inherits("QLable")) {
const_cast (widget)->setAttribute(Qt::WA_TranslucentBackground);
widget->setAttribute(Qt::WA_TranslucentBackground);
QPainterPath path;
auto rect = widget->rect();
rect.adjust(0,0,0,0);
path.addRoundedRect(rect,6,6);
widget->setProperty("blurRegion",QRegion(path.toFillPolygon().toPolygon()));
}
}
if (widget){
widget->setAttribute(Qt::WA_Hover);
widget->inherits("QSlider");
m_helpTip->registerWidget(widget);
widget->installEventFilter(this);
}
return QProxyStyle::polish(widget);
}
void CustomStyle::polish(QApplication *application)
{
return QProxyStyle::polish(application);
}
//
void CustomStyle::polish(QPalette &palette)
{
// return QProxyStyle::polish(palette);
// QProxyStyle::polish(palette);
// palette.setBrush(QPalette::Foreground, Qt::black);
QColor lightBlue(200, 0, 0);
palette.setBrush(QPalette::Highlight, lightBlue);
}
void CustomStyle::unpolish(QWidget *widget)
{
return QProxyStyle::unpolish(widget);
}
void CustomStyle::unpolish(QApplication *application)
{
return QProxyStyle::unpolish(application);
}
QSize CustomStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
{
QSize newSize = contentsSize;
switch (type) {
case CT_ProgressBar:
{
qDebug()<pixelMetric(QStyle::PM_ProgressBarChunkWidth, option, widget);
newSize.setWidth(cw * ProgressBarItem_Num);
return newSize;
}
default:
break;
}
return QProxyStyle::sizeFromContents(type, option, contentsSize, widget);
}
QIcon CustomStyle::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
{
return QProxyStyle::standardIcon(standardIcon, option, widget);
}
QPalette CustomStyle::standardPalette() const
{
return QProxyStyle::standardPalette();
}
//如果需要背景透明也许需要用到这个函数
int CustomStyle::styleHint(QStyle::StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
{
switch (hint) {
/// 让ScrollView viewport的绘制区域包含scrollbar和corner widget
/// 这个例子中没有什么作用,如果我们需要绘制一个背景透明的滚动条
/// 这个style hint对我们的意义应该很大,因为我们希望视图能够帮助
/// 我们填充滚动条的背景区域,否则当背景透明时底下会出现明显的分割
case SH_ScrollView_FrameOnlyAroundContents: {
return false;
}
default:
break;
}
return QProxyStyle::styleHint(hint, option, widget, returnData);
}
QRect CustomStyle::subControlRect(QStyle::ComplexControl control, const QStyleOptionComplex *option, QStyle::SubControl subControl, const QWidget *widget) const
{
return QProxyStyle::subControlRect(control, option, subControl, widget);
}
QRect CustomStyle::subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const
{
switch (element) {
case SE_ProgressBarGroove:
case SE_ProgressBarContents:
return option->rect;
default:
break;
}
return QProxyStyle::subElementRect(element, option, widget);
}
ukui-media/audio/translations/ 0000775 0001750 0001750 00000000000 15170054730 015356 5 ustar feng feng ukui-media/audio/translations/ky.ts 0000664 0001750 0001750 00000073546 15170054730 016370 0 ustar feng feng
AudioAudioدووشUkccPluginukccplugin سىنىعى/UkccPlugin/UkccPluginukccplugin testukccplugin سىنىعى/UkccPlugin/ukccplugin testInputDevWidgetInput Devicesكىرگىزۉۉ جابدۇۇلار.Confirmالبەتتە.OutputDevWidgetOutput Devicesۅندۉرۉش جابدۇۇلار.Confirmالبەتتە.QObjectpa_context_get_server_info() failedpa_context_get_server_info() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇCard callback failureكارتوچكا قايتارۇۇ جەڭىلۉۉ بولدۇSink callback failureقايتما ۅندۉرۉش جەڭىلۉۉ بولۇشSource callback failureقايتما كىرگىزۉۉ جەڭىلۉۉ بولدۇSink input callback failureچۅگۉپ باراتات. قايتما كىرگىزۉۉ جەڭىلۉۉ بولدۇSource output callback failureكەلۉۉ جەر جانى ۅندۉرۉش قايتما تەڭشۅۅ جەڭىلۉۉ بولدۇClient callback failureتىرمىنال قايتما تەڭشەگى جەڭىلۉۉ بولدۇServer info callback failureمۇلازىمەتىر قايتما تەڭشەگى جەڭىلۉۉ بولدۇFailed to initialize stream_restore extension: %sstream_restore نى چەچۉۉ جەڭىلۉۉ بولدۇ : ٪spa_ext_stream_restore_read() failedpa_ext_stream_restore_read() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇFailed to initialize device manager extension: %sشايمان باشقارعىچتى كەڭەيتۉۉنۉ العاچىنا كەتىرىش جەڭىلۉۉ بولدۇ : ٪spa_ext_device_manager_read() failedpa_ext_device_manager_read() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_get_sink_info_by_index() failedpa_context_get_sink_info_by_index() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_get_source_info_by_index() failedpa_context_get_source_info_by_index() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_get_sink_input_info() failedpa_context_get_sink_input_info() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_get_client_info() failedpa_context_get_client_info() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_get_card_info_by_index() failedpa_context_get_card_info_by_index() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_subscribe() failedpa_context_subscribe() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_client_info_list() failedpa_context_client_info_list() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_get_card_info_list() failedpa_context_get_card_info_list() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_get_sink_info_list() failedpa_context_get_sink_info_list() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_get_source_info_list() failedpa_context_get_source_info_list() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_get_sink_input_info_list() failedpa_context_get_sink_input_info_list() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_get_source_output_info_list() failedpa_context_get_source_output_info_list() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇUkui Media Volume ControlUkui Media دووش كونتىرول جاسوو ،اتقارۇۇUkmediaAppCtrlWidgetApp Sound Controlتىركەمە دووش تىزگىندۅۅ جاسوو ،اتقارۇۇ پىروگىرامماسىNoneجوقSystem Volumeساامالىق وبونۇUkmediaAppItemWidgetApplicationپراگرامماOutput Volumeۅندۉرۉش ۅلچۅمۉInput DeviceكىيىرگىچThis case does not support setting the input deviceبۇل تۉر مۇرۇن .جاعداي كىرگىزگىچتى تەڭشەشتى قولدوبويتOutput Deviceۅندۉرۉش جابدۇۇسۇن تانداشThis case does not support setting the output deviceبۇل تۉر مۇرۇن .جاعداي ۅندۉرۉش جابدۇۇسۇن تەڭشەشتى قولدوبويتConfirmالبەتتە.UkmediaDevControlWidgetaudio device control声音设备管理output device输出设备input device输入设备Sound Equipment Controlدووش جابدۇۇلار. تىزگىندۅۅ جاسوو ،اتقارۇۇOutput Devicesۅندۉرۉش جابدۇۇلار.Input Devicesكىرگىزۉۉ جابدۇۇلار.UkmediaInputWidgetInputكىرگىز/Audio/InputInput Deviceكىيىرگىچ/Audio/Input DeviceVolumeكۅلۅمۉ/Audio/VolumeInput Levelكىرگىزۉۉ ئنكاسى/Audio/Input LevelNoise Reductionىزى-چۇۇ اپتوماتتىك تۅمۅندۅتۉۉ/Audio/Noise ReductionVoice Monitorدووش كۉزۅتكۉچ/audio/Voice Monitor(None Device)(شايمان جوق)You can hear your voice in the output device of your choiceسىز ۅزۉڭۉز تاندالعان ۅندۉرۉش اسپابىنان ابازىڭىزدى ۇعا الاسىزUkmediaMainWidgetLight-Seeking寻光HeYin和印Customۅزۉ بەكىتۉۉNoneجوقUkmediaOutputWidgetOutputچىعۇۇ/Audio/OutputOutput Deviceۅندۉرۉش جابدۇۇسۇن تانداش/Audio/Output DeviceMaster Volumeدووش/Audio/Master VolumeBalanceجارىقتىق تەڭپۇڭلۇقىنى تەڭشۅۅ/Audio/BalanceLeftسولعوRightوڭ تاراپVolume Increaseدووشتۇ جوعورۇلاتۇۇVolume above 100% can cause sound distortion and damage your speakers.وبونۇ ٪100 تىن جوعورۇ دووش بۇرۇلۇش كەلىترىپ چىعارات، قانايعا زىيان جەتگۉزۉلەت.Mono Audioمونو دوبۇشIt merges the left and right channels into one channel.ال وڭ-سول قانالدار بىر لەشتىرىپ بىر قانالعا الماشتىرات .UkmediaSettingsWidgetAdvanced Settingsجوعورۇ تەڭشەكتەرSound Equipment Controlدووش جابدۇۇلار. تىزگىندۅۅ جاسوو ،اتقارۇۇ/Audio/Sound Equipment ControlDetailsىچكەلەي ، قۇنت قويۇپ ماتىرىيالApp Sound Controlتىركەمە دووش تىزگىندۅۅ جاسوو ،اتقارۇۇ پىروگىرامماسى/Audio/App Sound ControlUkmediaSoundEffectsWidgetSystem Soundساامالىق دووش ۅنۉمۉSound Themeدووش تەماسى/Audio/Sound ThemeBeep Switchەسكەرتۉۉ وبونۇ/Audio/Beep SwitchPoweroff Musicبەكىتىش/Audio/Poweroff MusicStartup Musicاچۇۇ/Audio/Startup MusicWakeup Musicويعونۇۇ./Audio/Wakeup MusicNotification Soundۇقتۇرۇۇ وبونۇ/Audio/Notification SoundVolume Control Soundدووشتۇ تىزگىندۅۅ جاسوو ،اتقارۇۇ وبونۇ/Audio/Volume Control SoundLogout Musicتىزىمدىكىتىن ۅچۉرۉۉ/Audio/Logout MusicUkmediaVolumeControlpa_context_set_sink_volume_by_index() failedpa_context_set_sink_volume_by_index() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_set_sink_mute_by_index() failedpa_context_set_sink_mute_by_index() جەڭىلۉۉ بولدۇpa_context_set_source_mute_by_index() failedpa_context_set_source_mute_by_index() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_set_source_volume_by_index() failedpa_context_set_source_volume_by_index() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_set_source_output_volume() failedpa_context_set_source_output_volume() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_set_source_output_mute() failedpa_context_set_source_output_mute() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_set_card_profile_by_index() failedpa_context_set_card_profile_by_index() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_set_default_sink() failedpa_context_set_default_sink() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_set_default_source() failedpa_context_set_default_source() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_set_sink_port_by_name() failedpa_context_set_sink_port_by_name() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇpa_context_set_source_port_by_name() failedpa_context_set_source_port_by_name() اتقارماق جاسوو ،اتقارۇۇ جەڭىلۉۉ بولدۇ (plugged in) ( قاتىشقان) (unavailable) (ىشتەتكەلى بولبويت ) (unplugged) ۇلانبادىFailed to read data from streamاعىمدان ساندۇۇ باياندامالاردى وقۇۇ جەڭىلۉۉ بولدۇPeak detectچوقۇ نارق تەكشەرىشFailed to create monitoring streamكۉزۅتۉۉ اعىمى قۇرۇۇ جەڭىلۉۉ بولدۇFailed to connect monitoring streamكۉزۅتۉۉ اعىمدى ۇلوو جەڭىلۉۉ بولدۇIgnoring sink-input due to it being designated as an event and thus handled by the Event widgetچۅگۉپ باراتات. نارق كىرگىزۉۉ نازاردان ساق اتقارىلدى ، انتكەنى ال بىر وقۇيالۇۇ دەپ بەكىتىلدى، وشوعو وقۇيالۇۇنىڭ كىچىك بۅلۅگۉ ووردۇندا بىر تەرەپ اتقارىلدىpa_context_kill_source_output() failedpa_context_kill_source_output() جەڭىلۉۉ بولدۇEstablishing connection to PulseAudio. Please wait...PulseAudio نىڭ ۇلانۇۇسۇ قۇرۇلۇپ جاتات، سەل ساقتاپ تۇرۇڭ
ukui-media/audio/translations/zh_CN.ts 0000664 0001750 0001750 00000062363 15170054730 016741 0 ustar feng feng
AudioAudio声音UkccPlugin/UkccPlugin/UkccPluginukccplugin test/UkccPlugin/ukccplugin testInputDevWidgetInput Devices输入设备Confirm确认OutputDevWidgetOutput Devices输出设备Confirm确认QObjectpa_context_get_server_info() failedCard callback failureSink callback failureSource callback failureSink input callback failureSource output callback failureClient callback failureServer info callback failureFailed to initialize stream_restore extension: %spa_ext_stream_restore_read() failedFailed to initialize device manager extension: %spa_ext_device_manager_read() failedpa_context_get_sink_info_by_index() failedpa_context_get_source_info_by_index() failedpa_context_get_sink_input_info() failedpa_context_get_client_info() failedpa_context_get_card_info_by_index() failedpa_context_subscribe() failedpa_context_client_info_list() failedpa_context_get_card_info_list() failedpa_context_get_sink_info_list() failedpa_context_get_source_info_list() failedpa_context_get_sink_input_info_list() failedpa_context_get_source_output_info_list() failedUkui Media Volume ControlUkmediaAppCtrlWidgetApp Sound Control应用声音None无System Volume系统UkmediaAppItemWidgetApplication应用Output Volume输出音量Input Device输入设备This case does not support setting the input device该情况不支持设置输入设备Output Device输出设备This case does not support setting the output device该情况不支持设置输出设备Confirm确认UkmediaDevControlWidgetaudio device control声音设备管理output device输出设备input device输入设备Sound Equipment Control声音设备管理Output Devices输出设备Input Devices输入设备UkmediaInputWidgetInput输入/Audio/InputInput Device选择输入设备/Audio/Input DeviceVolume音量/Audio/VolumeInput Level音量反馈/Audio/Input LevelNoise Reduction智能降噪/Audio/Noise ReductionVoice Monitor侦听此设备/audio/Voice Monitor(None Device)(无设备)You can hear your voice in the output device of your choice可在所选输出设备中听到自己的声音UkmediaMainWidgetLight-Seeking寻光HeYin和印Custom自定义None无UkmediaOutputWidgetOutput输出/Audio/OutputOutput Device选择输出设备/Audio/Output DeviceMaster Volume音量/Audio/Master VolumeBalance声道平衡/Audio/BalanceLeft左Right右Volume Increase音量增强Volume above 100% can cause sound distortion and damage your speakers.音量超过100%时可能会导致音效失真并损害你的扬声器。Mono Audio单声道音频It merges the left and right channels into one channel.会将左声道和右声道合并成一个声道UkmediaSettingsWidgetAdvanced Settings高级设置Sound Equipment Control声音设备管理/Audio/Sound Equipment ControlDetails详情App Sound Control应用声音/Audio/App Sound ControlUkmediaSoundEffectsWidgetSystem Sound系统音效Sound Theme音效主题/Audio/Sound ThemeBeep Switch提示音/Audio/Beep SwitchPoweroff Music关机/Audio/Poweroff MusicStartup Music开机/Audio/Startup MusicWakeup Music唤醒/Audio/Wakeup MusicNotification Sound接收通知/Audio/Notification SoundVolume Control Sound音量调节/Audio/Volume Control SoundLogout Music注销/Audio/Logout MusicUkmediaVolumeControlpa_context_set_sink_volume_by_index() failedpa_context_set_sink_mute_by_index() failedpa_context_set_source_mute_by_index() failedpa_context_set_source_volume_by_index() failedpa_context_set_source_output_volume() failedpa_context_set_source_output_mute() failedpa_context_set_card_profile_by_index() failedpa_context_set_default_sink() failedpa_context_set_default_source() failedpa_context_set_sink_port_by_name() failedpa_context_set_source_port_by_name() failed (plugged in) (unavailable) (unplugged)Failed to read data from streamPeak detectFailed to create monitoring streamFailed to connect monitoring streamIgnoring sink-input due to it being designated as an event and thus handled by the Event widgetpa_context_kill_source_output() failedEstablishing connection to PulseAudio. Please wait...
ukui-media/audio/translations/kk.ts 0000664 0001750 0001750 00000071623 15170054730 016344 0 ustar feng feng
AudioAudioۇنUkccPluginمىندەتتى ستونى/UkccPlugin/UkccPluginukccplugin testukccplugin سىنىعى/UkccPlugin/ukccplugin testInputDevWidgetInput Devicesكىرگىزۋ اسباپتارىConfirmتۇراقتاندىرۋOutputDevWidgetOutput Devicesجاريالاۋ اسباپتارىConfirmتۇراقتاندىرۋQObjectpa_context_get_server_info() failedpa_context_get_server_info() اتقار ەتۋ جەڭىلىپ قالدىCard callback failureقاريتا قايتارىپ ەتۋ جەڭىلىپ قالدىSink callback failureقايتتما جاريالاۋ جەڭىلىپ بولۋSource callback failureقايتتما كىرگىزۋ جەڭىلىپ قالدىSink input callback failureچۆكمە قايتتما كىرگىزۋ جەڭىلىپ قالدىSource output callback failureقاينار جاريالاۋ قايتتما تەڭشەۋ جەڭىلىپ قالدىClient callback failureسوڭعٸ ۇشٸ قايتتما تەڭگەرگٸش جەڭىلىپ قالدىServer info callback failureقىزىمەت وتەۋ اسبابى قايتتما تەڭگەرگٸش جەڭىلىس قالدىFailed to initialize stream_restore extension: %sstream_restore نى جايۋ جەڭىلىس قالدى: ٪spa_ext_stream_restore_read() failedpa_ext_stream_restore_read() اتقار ەتۋ جەڭىلىپ قالدىFailed to initialize device manager extension: %sاسباب باسقارۋشنى كەڭەيتۋدى قالپىنا قايتارۋ جەڭىلىپ قالدى: ٪spa_ext_device_manager_read() failedpa_ext_device_manager_read() اتقار ەتۋ جەڭىلىپ قالدىpa_context_get_sink_info_by_index() failedpa_context_get_sink_info_by_index() اتقار ەتۋ جەڭىلىپ قالدىpa_context_get_source_info_by_index() failedpa_context_get_source_info_by_index() اتقار ەتۋ جەڭىلىپ قالدىpa_context_get_sink_input_info() failedpa_context_get_sink_input_info() اتقار ەتۋ جەڭىلىپ قالدىpa_context_get_client_info() failedpa_context_get_client_info() اتقار ەتۋ جەڭىلىپ قالدىpa_context_get_card_info_by_index() failedpa_context_get_card_info_by_index() اتقار ەتۋ جەڭىلىپ قالدىpa_context_subscribe() failedpa_context_subscribe() اتقار ەتۋ جەڭىلىپ قالدىpa_context_client_info_list() failedpa_context_client_info_list() اتقار ەتۋ جەڭىلىپ قالدىpa_context_get_card_info_list() failedpa_context_get_card_info_list() اتقار ەتۋ جەڭىلىپ قالدىpa_context_get_sink_info_list() failedpa_context_get_sink_info_list() اتقار ەتۋ جەڭىلىپ قالدىpa_context_get_source_info_list() failedpa_context_get_source_info_list() اتقار ەتۋ جەڭىلىپ قالدىpa_context_get_sink_input_info_list() failedpa_context_get_sink_input_info_list() اتقار ەتۋ جەڭىلىپ قالدىpa_context_get_source_output_info_list() failedpa_context_get_source_output_info_list() اتقار ەتۋ جەڭىلىپ قالدىUkui Media Volume ControlUkui Media اۋا كونتىرول ەتۋUkmediaAppCtrlWidgetApp Sound Controlجيۋ اۋا مەڭگەرۋ ەتۋ پٸروگٸرامماسٸNoneجوقSystem Volumeسەستيما داۋىسىUkmediaAppItemWidgetApplicationقولدانعىشOutput Volumeجاريالاۋ كولەمىInput Deviceكىرگىزۋ اسپابٸThis case does not support setting the input deviceنۇ ٴتۇر احاۋل كىرگىزۋ اسپابىن تەڭشەۋدٸ قولدامايدىOutput Deviceجاريالاۋ اسبابٸن تالداۋThis case does not support setting the output deviceنۇ ٴتۇر احاۋل جاريالاۋ اسبابٸن تەڭشەۋدٸ قولدامايدىConfirmتۇراقتاندىرۋUkmediaDevControlWidgetaudio device control声音设备管理output device输出设备input device输入设备Sound Equipment Controlاۋا جابدىقتارىن مەڭگەرۋ ەتۋOutput Devicesجاريالاۋ اسباپتارىInput Devicesكىرگىزۋ اسباپتارىUkmediaInputWidgetInputكىرگىزۋ/Audio/InputInput Deviceكىرگىزۋ اسپابٸ/Audio/Input DeviceVolumeكولەمى/Audio/VolumeInput Levelكىرگىزۋ جاۋاب قايتارۋٸ/Audio/Input LevelNoise Reductionشۋىل اۆتوماتتى تومەندەتۋ/Audio/Noise ReductionVoice Monitorاۋا كۇزەتۋشى/audio/Voice Monitor(None Device)(اسباب جوق)You can hear your voice in the output device of your choiceٴسىز ٶزٸڭٸز تالداعان جاريالاۋ اسپابىنان داۋسىڭىزدى ئاڭلىيالايٴسىزUkmediaMainWidgetLight-Seeking寻光HeYin和印Customٶزى بەلگٸلەۋNoneجوقUkmediaOutputWidgetOutputجاريالاۋ/Audio/OutputOutput Deviceجاريالاۋ اسبابٸن تالداۋ/Audio/Output DeviceMaster Volumeاۋا/Audio/Master VolumeBalanceجارىقتىق تەپە-تەڭدىك تەڭشەۋ/Audio/BalanceLeftسولRightوڭ جاقVolume Increaseدٸبٸستٸ جوعارتىلۋVolume above 100% can cause sound distortion and damage your speakers.داۋىسى ٪100 تىن جوعارعى اۋا بۇرىلۋ كەتىرىپ شٸعارادٸ، كانايگا زيان جەتكىزەدى.Mono Audioمونو ۇنIt merges the left and right channels into one channel.ول وڭ-سول كانالداردى بٸرلەستٸرٸپ بٸر كانالعا ايلاندٸرادٸ.UkmediaSettingsWidgetAdvanced Settingsجوعارى تەڭشەۋلەرSound Equipment Controlاۋا جابدىقتارىن مەڭگەرۋ ەتۋ/Audio/Sound Equipment ControlDetailsناقتى مازمۇنىApp Sound Controlجيۋ اۋا مەڭگەرۋ ەتۋ پٸروگٸرامماسٸ/Audio/App Sound ControlUkmediaSoundEffectsWidgetSystem Soundسەستيما اۋا ٶنىمىSound Themeاۋا تەمەسى/Audio/Sound ThemeBeep Switchەسكەرتپەۋ داۋىسى/Audio/Beep SwitchPoweroff Musicتاقاۋ/Audio/Poweroff MusicStartup Musicٸشٸۋ/Audio/Startup MusicWakeup Musicويانۋ/Audio/Wakeup MusicNotification Soundۇقتٸرۋ داۋىسى/Audio/Notification SoundVolume Control Soundدٸبٸستٸ مەڭگەرۋ ەتۋ داۋىسى/Audio/Volume Control SoundLogout Musicتٸزٸمدەن ٴوشىرۋ/Audio/Logout MusicUkmediaVolumeControlpa_context_set_sink_volume_by_index() failedpa_context_set_sink_volume_by_index() اتقار ەتۋ جەڭىلىپ قالدىpa_context_set_sink_mute_by_index() failedpa_context_set_sink_mute_by_index() جەڭىلىپ قالدىpa_context_set_source_mute_by_index() failedpa_context_set_source_mute_by_index() اتقار ەتۋ جەڭىلىپ قالدىpa_context_set_source_volume_by_index() failedpa_context_set_source_volume_by_index() اتقار ەتۋ جەڭىلىپ قالدىpa_context_set_source_output_volume() failedpa_context_set_source_output_volume() اتقار ەتۋ جەڭىلىپ قالدىpa_context_set_source_output_mute() failedpa_context_set_source_output_mute() اتقار ەتۋ جەڭىلىپ قالدىpa_context_set_card_profile_by_index() failedpa_context_set_card_profile_by_index() اتقار ەتۋ جەڭىلىپ قالدىpa_context_set_default_sink() failedpa_context_set_default_sink() اتقار ەتۋ جەڭىلىپ قالدىpa_context_set_default_source() failedpa_context_set_default_source() اتقار ەتۋ جەڭىلىپ قالدىpa_context_set_sink_port_by_name() failedpa_context_set_sink_port_by_name() اتقار ەتۋ جەڭىلىپ قالدىpa_context_set_source_port_by_name() failedpa_context_set_source_port_by_name() اتقار ەتۋ جەڭىلىپ قالدى (plugged in) (شارپىلدى) (unavailable) (ٸستەتكەلٸ بولمايدى) (unplugged) جالعاۋنبادٸFailed to read data from streamاعىمنان ساندىق مالىمەتتەردى وقۋ جەڭىلىپ قالدىPeak detectشوقى ٴمان تەكسەرۋFailed to create monitoring streamكۇزەتۋگە اعٸمٸ قۇرۋ جەڭىلىپ قالدىFailed to connect monitoring streamكۇزەتۋگە مەنى اۋلاۋ جەڭىلىپ قالدىIgnoring sink-input due to it being designated as an event and thus handled by the Event widgetچۆكمە ٴمان كىرگىزۋ نازاردان ساقتانۋ قىلىندى، ۇيتكەنٸ ول بٸر ۋاقىيعالىقتى دوپ بەكٸتٸلدٸ، سوندىقتان ۋاقىيعالىقتىنىڭ كشكەنە بولەك ورٸندا بٸرتەرەپ قىلىندىpa_context_kill_source_output() failedpa_context_kill_source_output() جەڭىلىپ قالدىEstablishing connection to PulseAudio. Please wait...PulseAudio نىڭ ورنالاسٸۋٸ جاسالىپ جاتىر، سەل ساقتاپ تۇر
ukui-media/audio/translations/ms.ts 0000664 0001750 0001750 00000062724 15170054730 016360 0 ustar feng feng
AudioAudioUkccPlugin/UkccPlugin/UkccPluginukccplugin test/UkccPlugin/ukccplugin testInputDevWidgetInput DevicesConfirmOutputDevWidgetOutput DevicesConfirmQObjectpa_context_get_server_info() failedCard callback failureSink callback failureSource callback failureSink input callback failureSource output callback failureClient callback failureServer info callback failureFailed to initialize stream_restore extension: %spa_ext_stream_restore_read() failedFailed to initialize device manager extension: %spa_ext_device_manager_read() failedpa_context_get_sink_info_by_index() failedpa_context_get_source_info_by_index() failedpa_context_get_sink_input_info() failedpa_context_get_client_info() failedpa_context_get_card_info_by_index() failedpa_context_subscribe() failedpa_context_client_info_list() failedpa_context_get_card_info_list() failedpa_context_get_sink_info_list() failedpa_context_get_source_info_list() failedpa_context_get_sink_input_info_list() failedpa_context_get_source_output_info_list() failedUkui Media Volume ControlUkmediaAppCtrlWidgetApp Sound ControlNoneSystem VolumeUkmediaAppItemWidgetApplicationOutput VolumeInput DeviceThis case does not support setting the input deviceOutput DeviceThis case does not support setting the output deviceConfirmUkmediaDevControlWidgetaudio device control声音设备管理output device输出设备input device输入设备Sound Equipment ControlOutput DevicesInput DevicesUkmediaInputWidgetInput/Audio/InputInput Device/Audio/Input DeviceVolume/Audio/VolumeInput Level/Audio/Input LevelNoise Reduction/Audio/Noise ReductionVoice Monitor/audio/Voice Monitor(None Device)You can hear your voice in the output device of your choiceUkmediaMainWidgetLight-Seeking寻光HeYin和印CustomNoneUkmediaOutputWidgetOutput/Audio/OutputOutput Device/Audio/Output DeviceMaster Volume/Audio/Master VolumeBalance/Audio/BalanceLeftRightVolume IncreaseVolume above 100% can cause sound distortion and damage your speakers.Mono AudioIt merges the left and right channels into one channel.UkmediaSettingsWidgetAdvanced SettingsSound Equipment Control/Audio/Sound Equipment ControlDetailsApp Sound Control/Audio/App Sound ControlUkmediaSoundEffectsWidgetSystem SoundSound Theme/Audio/Sound ThemeBeep Switch/Audio/Beep SwitchPoweroff Music/Audio/Poweroff MusicStartup Music/Audio/Startup MusicWakeup Music/Audio/Wakeup MusicNotification Sound/Audio/Notification SoundVolume Control Sound/Audio/Volume Control SoundLogout Music/Audio/Logout MusicUkmediaVolumeControlpa_context_set_sink_volume_by_index() failedpa_context_set_sink_mute_by_index() failedpa_context_set_source_mute_by_index() failedpa_context_set_source_volume_by_index() failedpa_context_set_source_output_volume() failedpa_context_set_source_output_mute() failedpa_context_set_card_profile_by_index() failedpa_context_set_default_sink() failedpa_context_set_default_source() failedpa_context_set_sink_port_by_name() failedpa_context_set_source_port_by_name() failed (plugged in) (unavailable) (unplugged)Failed to read data from streamPeak detectFailed to create monitoring streamFailed to connect monitoring streamIgnoring sink-input due to it being designated as an event and thus handled by the Event widgetpa_context_kill_source_output() failedEstablishing connection to PulseAudio. Please wait...
ukui-media/audio/translations/tr.ts 0000664 0001750 0001750 00000060553 15170054730 016364 0 ustar feng feng
AudioAudioUkccPlugin/UkccPlugin/UkccPluginukccplugin test/UkccPlugin/ukccplugin testInputDevWidgetInput DevicesconfirmOutputDevWidgetOutput DevicesConfirmQObjectpa_context_get_server_info() failedCard callback failureSink callback failureSource callback failureSink input callback failureSource output callback failureClient callback failureServer info callback failureFailed to initialize stream_restore extension: %spa_ext_stream_restore_read() failedFailed to initialize device manager extension: %spa_ext_device_manager_read() failedpa_context_get_sink_info_by_index() failedpa_context_get_source_info_by_index() failedpa_context_get_sink_input_info() failedpa_context_get_client_info() failedpa_context_get_card_info_by_index() failedpa_context_subscribe() failedpa_context_client_info_list() failedpa_context_get_card_info_list() failedpa_context_get_sink_info_list() failedpa_context_get_source_info_list() failedpa_context_get_sink_input_info_list() failedpa_context_get_source_output_info_list() failedConnection failed, attempting reconnectUkui Media Volume ControlUkmediaAppCtrlWidgetApp Sound ControlNoneSystem VolumeUkmediaAppItemWidgetApplicationOutput VolumeInput DeviceOutput DeviceConfirmUkmediaDevControlWidgetSound Equipment ControlOutput DevicesInput DevicesUkmediaInputWidgetInput/Audio/InputInput Device/Audio/Input DeviceVolume/Audio/VolumeInput Level/Audio/Input LevelNoise Reduction/audio/NoiseVoice Monitor/audio/Voice Monitor(None Device)You can hear your voice in the output device of your choiceUkmediaMainWidgetCustomNoneUkmediaOutputWidgetOutput/Audio/OutputOutput Device/Audio/Output DeviceMaster Volume/Audio/Master VolumeBalance/Audio/BalanceLeftRightVolume IncreaseVolume above 100% can cause sound distortion and damage your speakers.Mono AudioIt merges the left and right channels into one channel.UkmediaSettingsWidgetAdvanced SettingsSound Equipment ControlDetailsApp Sound ControlUkmediaSoundEffectsWidgetSystem SoundSound Theme/Audio/Sound ThemeBeep Switch/Audio/Beep SwitchPoweroff Music/Audio/Poweroff MusicStartup Music/Audio/Startup MusicWakeup Music/Audio/Wakeup MusicLogout Music/Audio/Logout MusicNotification Sound/Audio/Notification SoundVolume Control Sound/Audio/Volume Control SoundUkmediaVolumeControlpa_context_set_sink_volume_by_index() failedpa_context_set_source_mute_by_index() failedpa_context_set_source_volume_by_index() failedpa_context_set_source_output_volume() failedpa_context_set_source_output_mute() failedpa_context_set_card_profile_by_index() failedpa_context_set_default_sink() failedpa_context_set_default_source() failedpa_context_set_sink_port_by_name() failedpa_context_set_source_port_by_name() failed (plugged in) (unavailable) (unplugged)Failed to read data from streamPeak detectFailed to create monitoring streamFailed to connect monitoring streamIgnoring sink-input due to it being designated as an event and thus handled by the Event widgetpa_context_kill_source_output() failedEstablishing connection to PulseAudio. Please wait...
ukui-media/audio/translations/ug.ts 0000664 0001750 0001750 00000071534 15170054730 016353 0 ustar feng feng
AudioAudioئۈن ـ سىنUkccPluginukccplugin سىنىقى/UkccPlugin/UkccPluginukccplugin testukccplugin سىنىقى/UkccPlugin/ukccplugin testInputDevWidgetInput Devicesئۈسكۈنە كىرگۈزۈشConfirmجەزىملەشتۈرۈشOutputDevWidgetOutput Devicesچىقىرىش ئۈسكۈنىلىرىConfirmجەزىملەشتۈرۈشQObjectpa_context_get_server_info() failedpa_context_get_server_info() ئىجرا قىلىش مەغلۇپ بولدىCard callback failureكارتا قايتۇرۇۋېتىش مەغلۇپ بولدىSink callback failureقايتما چىقىرىش مەغلۇپ بولۇشSource callback failureقايتما كىرگۈزۈش مەغلۇپ بولدىSink input callback failureچۆكمە قايتما كىرگۈزۈش مەغلۇپ بولدىSource output callback failureمەنبە چىقىرىش قايتما تەڭشەش مەغلۇپ بولدىClient callback failureتېرمىنال قايتما تەڭشىكى مەغلۇپ بولدىServer info callback failureمۇلازىمىتېر قايتما تەڭشىكى مەغلۇب بولدىFailed to initialize stream_restore extension: %sstream_restore ئۇزارتىشنى باشلىمىدى: s%pa_ext_stream_restore_read() failedpa_ext_stream_restore_read() ئىجرا قىلىش مەغلۇپ بولدىFailed to initialize device manager extension: %sئۈسكۈنە باشقۇرغۇچنى ئۇزارتىشنى قوزغىتىش مەغلۇپ بولدى: s%pa_ext_device_manager_read() failedpa_ext_device_manager_read() ئىجرا قىلىش مەغلۇپ بولدىpa_context_get_sink_info_by_index() failedpa_context_get_sink_info_by_index() ئىجرا قىلىش مەغلۇپ بولدىpa_context_get_source_info_by_index() failedpa_context_get_source_info_by_index() ئىجرا قىلىش مەغلۇپ بولدىpa_context_get_sink_input_info() failedpa_context_get_sink_input_info() ئىجرا قىلىش مەغلۇپ بولدىpa_context_get_client_info() failedpa_context_get_client_info() ئىجرا قىلىش مەغلۇپ بولدىpa_context_get_card_info_by_index() failedpa_context_get_card_info_by_index() ئىجرا قىلىش مەغلۇپ بولدىpa_context_subscribe() failedpa_context_subscribe() ئىجرا قىلىش مەغلۇپ بولدىpa_context_client_info_list() failedpa_context_client_info_list() ئىجرا قىلىش مەغلۇپ بولدىpa_context_get_card_info_list() failedpa_context_get_card_info_list() ئىجرا قىلىش مەغلۇپ بولدىpa_context_get_sink_info_list() failedpa_context_get_sink_info_list() ئىجرا قىلىش مەغلۇپ بولدىpa_context_get_source_info_list() failedpa_context_get_source_info_list() ئىجرا قىلىش مەغلۇپ بولدىpa_context_get_sink_input_info_list() failedpa_context_get_sink_input_info_list() ئىجرا قىلىش مەغلۇپ بولدىpa_context_get_source_output_info_list() failedpa_context_get_source_output_info_list() ئىجرا قىلىش مەغلۇپ بولدىUkui Media Volume ControlUkui Media ئاۋاز كونتىرول قىلىشUkmediaAppCtrlWidgetApp Sound Controlئەپ ئاۋاز كونتىرول قىلىشNoneيوقSystem Volumeسىستېما ئاۋازىUkmediaAppItemWidgetApplicationئەپOutput Volumeچىقىرىش ھەجىمىInput Deviceكىرگۈزۈش ئۈسكۈنىسىThis case does not support setting the input deviceبۇ دېلو كىرگۈزۈش ئۈسكۈنىسىنى تەڭشەشنى قوللىمايدۇOutput Deviceچىقىرىش ئۈسكۈنىسىنى تاللاشThis case does not support setting the output deviceبۇ دېلودا چىقىرىش ئۈسكۈنىسىنى تەڭشەش قوللىمايدۇConfirmجەزىملەشتۈرۈشUkmediaDevControlWidgetaudio device control声音设备管理output device输出设备input device输入设备Sound Equipment Controlئاۋاز ئۈسكۈنىلىرىنى كونتىرول قىلىشOutput Devicesچىقىرىش ئۈسكۈنىلىرىInput Devicesئۈسكۈنە كىرگۈزۈشUkmediaInputWidgetInputكىرگۈزۈش/Audio/InputInput Deviceكىرگۈزۈش ئۈسكۈنىسى/Audio/Input DeviceVolumeئاۋاز/Audio/VolumeInput Levelكىرگۈزۈش ئىنكاسى/Audio/Input LevelNoise Reductionشاۋقۇننى ئاپتوماتىك تۆۋەنلىتىش/Audio/Noise ReductionVoice Monitorئاۋاز كۆزەتكۈچ/audio/Voice Monitor(None Device)(ھېچنىمە ئۈسكۈنىسى)You can hear your voice in the output device of your choiceئاۋازىڭىزنى ئۆزىڭىز تاللىغان چىقىرىش ئۈسكۈنىسىدىن ئاڭلىيالايسىزUkmediaMainWidgetLight-Seeking寻光HeYin和印Customئۆرپ-ئادەتNoneيوقUkmediaOutputWidgetOutputچىقىرىش/Audio/OutputOutput Deviceچىقىرىش ئۈسكۈنىسىنى تاللاش/Audio/Output DeviceMaster Volumeئاۋاز/Audio/Master VolumeBalanceئاۋاز يولى تەڭپۇڭلۇقى/Audio/BalanceLeftسولRightئوڭVolume Increaseئاۋازنى يۇقىرىلىتىشVolume above 100% can cause sound distortion and damage your speakers.100% تىن يۇقىرى ھەجىملىك ئاۋازنىڭ بۇرمىلىنىشىنى كەلتۈرۈپ چىقىرىدۇ ۋە كانايىڭىزنى زەخىملەندۈرىدۇ.Mono AudioMono AudioIt merges the left and right channels into one channel.ئۇ سول ۋە ئوڭ يوللارنى بىر قانالغا بىرلەشتۈرىدۇ.UkmediaSettingsWidgetAdvanced Settingsئىلغار تەڭشەكلەرSound Equipment Controlئاۋاز ئۈسكۈنىلىرىنى كونتىرول قىلىش/Audio/Sound Equipment ControlDetailsتەپسىلىي ئۇچۇرى:App Sound Controlئەپ ئاۋاز كونتىرول قىلىش/Audio/App Sound ControlUkmediaSoundEffectsWidgetSystem Soundسىستېما ئاۋاز ئۈنىمىSound Themeئاۋاز تېمىسى/Audio/Sound ThemeBeep Switchئەسكەرتىش ئاۋازى/Audio/Beep SwitchPoweroff Musicتاقاش/Audio/Poweroff MusicStartup Musicئېچىش/Audio/Startup MusicWakeup Musicئويغىنىش/Audio/Wakeup MusicNotification Soundئۇقتۇرۇش ئاۋازى/Audio/Notification SoundVolume Control Soundئاۋاز مىقدارىنى كونترول قىلىش ئاۋازى/Audio/Volume Control SoundLogout Musicتىزىمدىن ئۆچۈرۈش/Audio/Logout MusicUkmediaVolumeControlpa_context_set_sink_volume_by_index() failedpa_context_set_sink_volume_by_index() ئىجرا قىلىش مەغلۇپ بولدىpa_context_set_sink_mute_by_index() failedpa_context_set_source_mute_by_index() failedpa_context_set_source_mute_by_index() ئىجرا قىلىش مەغلۇپ بولدىpa_context_set_source_volume_by_index() failedpa_context_set_source_volume_by_index() ئىجرا قىلىش مەغلۇپ بولدىpa_context_set_source_output_volume() failedpa_context_set_source_output_volume() ئىجرا قىلىش مەغلۇپ بولدىpa_context_set_source_output_mute() failedpa_context_set_source_output_mute() ئىجرا قىلىش مەغلۇپ بولدىpa_context_set_card_profile_by_index() failedpa_context_set_card_profile_by_index() ئىجرا قىلىش مەغلۇپ بولدىpa_context_set_default_sink() failedpa_context_set_default_sink() ئىجرا قىلىش مەغلۇپ بولدىpa_context_set_default_source() failedpa_context_set_default_source() ئىجرا قىلىش مەغلۇپ بولدىpa_context_set_sink_port_by_name() failedpa_context_set_sink_port_by_name() ئىجرا قىلىش مەغلۇپ بولدىpa_context_set_source_port_by_name() failedpa_context_set_source_port_by_name() ئىجرا قىلىش مەغلۇپ بولدى (plugged in) (چېتىلدى) (unavailable) (ئىشلەتكىلى بولمايدۇ) (unplugged) ئۇلانمىدىFailed to read data from streamئېقىمدىن سانلىق مەلۇماتلارنى ئوقۇش مەغلۇپ بولدىPeak detectچوققا قىممەت تەكشۈرۈشFailed to create monitoring streamكۆزىتىش ئېقىمى قۇرۇش مەغلۇپ بولدىFailed to connect monitoring streamكۆزىتىش ئېقىمىنى ئۇلاش مەغلۇپ بولدىIgnoring sink-input due to it being designated as an event and thus handled by the Event widgetچۆكمە قىممەت كىرگۈزۈش نەزەردىن ساقىت قىلىندى، چۈنكى ئۇ بىر ۋەقەلىك دەپ بېكىتىلدى، شۇڭا ۋەقەلىكنىڭ كىچىك قىسمى ئورنىدا بىرتەرەپ قىلىندىpa_context_kill_source_output() failedEstablishing connection to PulseAudio. Please wait...PulseAudio نىڭ ئۇلىنىشى قۇرۇلىۋاتىدۇ، سەل ساقلاپ تۇرۇڭ
ukui-media/audio/translations/bo_CN.ts 0000664 0001750 0001750 00000076543 15170054730 016725 0 ustar feng feng
AudioAudioསྒྲ་ཕབ།UkccPluginཚོད་ལྟའི་ལྷུ་ལག།/UkccPlugin/UkccPluginukccplugin testལྷུ་ལག་ཡིག་སྒྱུར་ཚོད་ལྟ།/UkccPlugin/ukccplugin testInputDevWidgetInput Devicesནང་འཇུག་སྒྲིག་ཆས།Confirmཐག་ཆོད།OutputDevWidgetOutput Devicesཕྱིར་གཏོང་སྒྲིག་ཆས།Confirmཐག་ཆོད།QObjectpa_context_get_server_info() failedpa_context_get_server_info()ཕམ་ཉེས་བྱུང་བ།Card callback failureབྱང་བུ་ཕྱིར་སློག་བྱེད་མ་ཐུབ་པ།Sink callback failureཕྱིར་ལྡོག་བྱེད་པར་ཕམ་ཉེས་བྱུང་བ།Source callback failureའབྱུང་ཁུངས་ཕྱིར་ལྡོག་བྱེད་མ་ཐུབ་པ།Sink input callback failureམ་དངུལ་འཇོག་པའི་ཕྱིར་ལྡོག་ལ་ཕམ་ཉེས་བྱུངSource output callback failureའབྱུང་ཁུངས་ཕྱིར་ལྡོག་བྱེད་པར་ཕམ་ཉེས་བྱུང་བ།Client callback failureམངགས་བཅོལ་བྱེད་མཁན་གྱིས་ཕྱིར་སློག་Server info callback failureཞབས་ཞུའི་ཡོ་བྱད་ཀྱི་ཆ་འཕྲིན་ཕྱིར་ལྡོག་བྱེད་མ་ཐུབFailed to initialize stream_restore extension: %sstream_restore་རིང་དུ་གཏོང་བའི་ཐོག་མའི་དུས་ཚོད་ལ་སླེབས་མ་ཐུབ་པ། %spa_ext_stream_restore_read() failedpa_ext_stream_restore_read()ཕམ་ཁ་བྱུང་བ་རེད།Failed to initialize device manager extension: %sསྒྲིག་ཆས་དོ་དམ་གྱི་དུས་འགྱངས་ལ་ཐོག་མའི་དུས་འགྱངས་བྱེད་མ་ཐུབ་པ། %spa_ext_device_manager_read() failedpa_ext_device_manager_read()ཕམ་ཉེས་བྱུང་བ།pa_context_get_sink_info_by_index() failedpa_context_get_sink_info_by_index()ཕམ་ཁ་བྱུང་བ་རེད།pa_context_get_source_info_by_index() failedpa_context_get_source_info_by_index()ཕམ་ཁ་བྱུང་བ་རེད།pa_context_get_sink_input_info() failedpa_context_get_sink_input_info()ཕམ་ཁ་བྱུང་བ་རེད།pa_context_get_client_info() failedpa_context_get_client_info()ཕམ་ཉེས་བྱུང་བ།pa_context_get_card_info_by_index() failedpa_context_get_card_info_by_index()ཕམ་ཉེས་བྱུང་བ།pa_context_subscribe() failedpa_context_subscribe()ཕམ་ཁ་བྱུང་བ་རེད།pa_context_client_info_list() failedpa_context_client_info_list()ཕམ་ཉེས་བྱུང་བ།pa_context_get_card_info_list() failedpa_context_get_card_info_list()ཕམ་ཉེས་བྱུང་བ།pa_context_get_sink_info_list() failedpa_context_get_sink_info_list()ཕམ་ཉེས་བྱུང་བ།pa_context_get_source_info_list() failedpa_context_get_source_info_list()ཕམ་ཁ་བྱུང་བ་རེད།pa_context_get_sink_input_info_list() failedpa_context_get_sink_input_info_list()ཕམ་ཉེས་བྱུང་བ།pa_context_get_source_output_info_list() failedpa_context_get_source_output_info_list()ཕམ་ཁ་བྱུང་བ་རེད།Connection failed, attempting reconnectའབྲེལ་མཐུད་བྱེད་མ་ཐུབ་པར་ཡང་བསྐྱར་འབྲེལ་མཐུད་བྱེད་རྩིས་བྱས།Ukui Media Volume Controlཝུའུ་ཁི་ལན་གྱི་སྨྱན་སྦྱོར་གྱི་བོངས་UkmediaAppCtrlWidgetApp Sound Controlཉེར་སྤྱོད་སྒྲ།Noneགཅིག་ཀྱང་མེད།System Volumeམ་ལགUkmediaAppItemWidgetApplicationཉེར་སྤྱོད་བྱ་རིམ།Output Volumeཕྱིར་གཏོང་གི་སྒྲ་ཚད།Input Deviceནང་འཇུག་སྒྲིག་ཆས།This case does not support setting the input deviceགནས་ཚུལ་འདིར་ནང་འཇུག་སྒྲིག་ཆས་ལ་རྒྱབ་སྐྱོར་བྱེད་མི་ཐུབ།Output Deviceཕྱིར་གཏོང་སྒྲིག་ཆས།This case does not support setting the output deviceགནས་ཚུལ་འདིར་ཕྱིར་གཏོང་སྒྲིག་ཆས་ལ་རྒྱབ་སྐྱོར་མི་བྱེད་པ་།Confirmཐག་ཆོད།UkmediaDevControlWidgetSound Equipment Controlསྒྲའི་སྒྲིག་ཆས་དོ་དམ།Output Devicesཕྱིར་གཏོང་སྒྲིག་ཆས།Input Devicesནང་འཇུག་སྒྲིག་ཆས།UkmediaInputWidgetInputམ་དངུལ་འཇོག་པ།/Audio/InputInput Deviceནང་འཇུག་སྒྲིག་ཆས།/Audio/Input DeviceVolumeསྐད་སྒྲ།/Audio/VolumeInput Levelསྒྲ་ཚད་ཕྱིར་ལན།/Audio/Input LevelNoise Reductionརིག་ནུས་ཀྱི་འཛེར་སྒྲ་གཅོག་པ།/Audio/Noise ReductionVoice Monitorསྒྲིག་ཆས་འདི་ལ་ཉན་ཞིབ་།/audio/Voice MonitorYou can hear your voice in the output device of your choiceའོན་ཀྱང་བདམས་པའི་ཕྱིར་འདོན་སྒྲིག་ཆས་ནང་ནས་རང་ཉིད་ཀྱི་སྐད་ཐོས་།(None Device)(སྒྲིག་ཆས་མེད་པ་)UkmediaMainWidgetCustomམཚན་ཉིད་རང་འཇོག།Noneགཅིག་ཀྱང་མེད།UkmediaOutputWidgetOutputཐོན་ཚད།/Audio/OutputOutput Deviceཕྱིར་གཏོང་སྒྲིག་ཆས།/Audio/Output DeviceMaster Volumeསྒྲ་ཚད།/Audio/Master VolumeBalanceདོ་མཉམ།/Audio/BalanceLeftགཡོན་ཕྱོགས།Rightགཡས་གཡོན།Volume Increaseསྒྲ་ཚད་ཇེ་དྲག་ཏུ།Volume above 100% can cause sound distortion and damage your speakers.སྒྲ་ཚད་བརྒྱ་ཆ་༡༠༠ལས་བརྒལ་ན་སྒྲ་ནུས་དངོས་མིན་དང་ཁྱོད་ཀྱི་སྒྲ་སྐྱེད་ཆས་ལ་གནོད་པ་ཐེབས་སྲིད།Mono Audioསྒྲ་ལམ་རྐྱང་པའི་སྒྲ་ཟློས།It merges the left and right channels into one channel.སྒྲ་ལམ་གཡོན་དང་སྒྲ་ལམ་གཡས་ཟླ་སྒྲིལ་བྱས་ནས་སྒྲ་ལམ་གཅིག་ཏུ་གྱུར།UkmediaSettingsWidgetAdvanced Settingsམཐོ་རིམ་སྒྲིག་འགོད།Sound Equipment Controlསྒྲའི་སྒྲིག་ཆས་དོ་དམ།/Audio/Sound Equipment ControlDetailsགནས་ཚུལ་ཞིབ་ཕྲ།App Sound Controlཉེར་སྤྱོད་སྒྲ།/Audio/App Sound ControlUkmediaSoundEffectsWidgetSystem Soundམ་ལག་སྒྲ་ནུས།Sound Themeསྒྲ་ནུས་ཀྱི་བརྗོད་བྱ།/Audio/Sound ThemeAlert Soundཉེན་བརྡའི་སྒྲ་/Audio/Alert SoundBeep Switchསྣེ་སྟོན་པའི་སྒྲ།/Audio/Beep SwitchPoweroff Musicགླུ་དབྱངས་སྒོ་བརྒྱབ་པ།/Audio/Poweroff MusicStartup Musicརོལ་དབྱངས་ཁ་ཕྱེ་བ།/Audio/Startup MusicWakeup Musicའབོད་སློང་།/Audio/Wakeup MusicNotification Soundབསྡུ་ལེན་བརྡ་ཐོ།/Audio/Notification SoundVolume Control Soundསྒྲ་ཚད་སྙོམ་སྒྲིག/Audio/Volume Control SoundVolume Changeསྒྲ་གདངས་འགྱུར་ལྡོག/Audio/Volume ChangeLogout Musicརོལ་དབྱངས་མེད་པར་བཟོ་བ།/Audio/Logout MusicUkmediaVolumeControlpa_context_set_sink_volume_by_index() failedpa_context_set_sink_volume_by_index()ཕམ་ཁ་བྱུང་བ་རེད།pa_context_set_sink_mute_by_index() failedt_sink_mute_by_index() failedpa_context_set_source_mute_by_index() failedpa_context_set_source_mute_by_index()ཕམ་ཁ་བྱུང་བ་རེད།pa_context_set_source_volume_by_index() failedpa_context_set_source_volume_by_index()ཕམ་ཁ་བྱུང་བ་རེད།pa_context_set_source_output_volume() failedpa_context_set_source_output_volume()ཕམ་ཁ་བྱུང་བ་རེད།pa_context_set_source_output_mute() failedpa_context_set_source_output_mute()ཕམ་ཁ་བྱུང་བ་རེད།pa_context_set_card_profile_by_index() failedpa_context_set_card_profile_by_index()ཕམ་ཉེས་བྱུང་བ།pa_context_set_default_sink() failedpa_context_set_default_sink()ཕམ་ཁ་བྱུང་བ་རེད།pa_context_set_default_source() failedpa_context_set_default_source()ཕམ་ཉེས་བྱུང་བ།pa_context_set_sink_port_by_name() failedpa_context_set_sink_port_by_name()ཕམ་ཁ་བྱུང་བ་རེད།pa_context_set_source_port_by_name() failedpa_context_set_source_port_by_name()ཕམ་ཉེས་བྱུང་བ། (plugged in) (ནང་དུ་བཅུག་པ་)། (unavailable) (སྤྱོད་གོ་མི་ཆོད་པ)། (unplugged) (ཁ་ཐོར་ཡ་བྲལ་དུ་སོང་བ་)།Failed to read data from streamཆུ་ཕྲན་ནས་གཞི་གྲངས་ཀློག་མ་ཐུབ་པ།Peak detectཡང་རྩེར་ཞིབ་དཔྱད་ཚད་ལེནFailed to create monitoring streamལྟ་ཞིབ་ཚད་ལེན་གྱི་ཆུ་ཕྲན་གསར་སྐྲུན་བྱེད་མ་ཐུབ་པFailed to connect monitoring streamལྟ་ཞིབ་ཚད་ལེན་གྱི་ཆུ་ཕྲན་སྦྲེལ་མཐུད་བྱེད་མ་ཐུབ་པIgnoring sink-input due to it being designated as an event and thus handled by the Event widgetདོན་རྐྱེན་ཞིག་ཏུ་བརྩིས་ནས་དོན་རྐྱེན་ཆུང་ཆུང་ཞིག་ཏུ་བརྩིས་ནས་ཐག་གཅོད་བྱས་པའི་རྐྱེན་གྱིས་ཆུ་ནང་དུ་འཛུལ་བར་སྣང་མེད་བྱས་པ་རེད།pa_context_kill_source_output() failed_output() failedEstablishing connection to PulseAudio. Please wait...ཕུའུ་ལུའུ་ཧྲི་ཨོ་ཏོ་དང་འབྲེལ་བ་བཙུགས་པ་རེད། སྐུ་མཁྱེན་སྒུག་རོགས།...
ukui-media/audio/translations/vi.ts 0000664 0001750 0001750 00000067162 15170054730 016360 0 ustar feng feng
AudioAudioThiết bị âm thanhUkccPluginPlugin Ukcc/UkccPlugin/UkccPluginukccplugin testKiểm tra ukccplugin/UkccPlugin/ukccplugin testInputDevWidgetInput DevicesThiết bị đầu vàoConfirmLưu sửa đổiOutputDevWidgetOutput DevicesThiết bị đầu raConfirmLưu sửa đổiQObjectpa_context_get_server_info() failedPa_context_get_server_info() thất bạiCard callback failureLỗi gọi lại thẻSink callback failureLỗi gọi lại Sink thất bạiSource callback failureLỗi gọi lại Nguồn thất bạiSink input callback failureLỗi callback đầu vào sinkSource output callback failureLỗi phản hồi đầu ra nguồnClient callback failureLỗi gọi lại từ khách hàngServer info callback failureLỗi callback thông tin máy chủFailed to initialize stream_restore extension: %sKhởi tạo phần mở rộng stream_restore thất bại: %spa_ext_stream_restore_read() failedĐọc pa_ext_stream_restore thất bạiFailed to initialize device manager extension: %sKhởi tạo phần mở rộng quản lý thiết bị thất bại: %spa_ext_device_manager_read() failedĐọc pa_ext_device_manager thất bạipa_context_get_sink_info_by_index() failedLấy thông tin thiết bị xuất âm bằng chỉ mục trong ngữ cảnh PulseAudio thất bạipa_context_get_source_info_by_index() failedLấy thông tin về source (đầu vào âm thanh) bằng chỉ mục thất bạipa_context_get_sink_input_info() failedPa_context_get_sink_input_info() thất bạipa_context_get_client_info() failedPa context lấy thông tin khách hàng() thất bạipa_context_get_card_info_by_index() failedLấy thông tin về card âm thanh theo chỉ số thất bạipa_context_subscribe() failedĐăng ký ngữ cảnh PA không thành côngpa_context_client_info_list() failedHàm pa_context_client_info_list() thực thi thất bạipa_context_get_card_info_list() failedLỗi khi lấy danh sách thông tin card âm thanh của ngữ cảnh PulseAudiopa_context_get_sink_info_list() failedLỗi khi lấy danh sách thông tin đầu ra âm thanh (sink) từ ngữ cảnh PulseAudiopa_context_get_source_info_list() failedLỗi khi lấy danh sách thông tin nguồn âm thanh từ ngữ cảnh PulseAudiopa_context_get_sink_input_info_list() failedHàm pa_context_get_sink_input_info_list() thực thi thất bạipa_context_get_source_output_info_list() failedHàm pa_context_get_source_output_info_list() thực thi thất bạiUkui Media Volume ControlBộ điều khiển âm lượng đa phương tiện UkuiUkmediaAppCtrlWidgetApp Sound ControlÂm thanh ứng dụngNoneSử dùng settings hiện tại của máy inSystem VolumeÂm lượng hệ thốngUkmediaAppItemWidgetApplicationỨng dụngOutput VolumeÂm lượng đầu raInput DeviceThiết bị đầu vàoThis case does not support setting the input deviceTình huống này không hỗ trợ cài đặt thiết bị đầu vàoOutput DeviceChọn thiết bị đầu raThis case does not support setting the output deviceTình huống này không hỗ trợ cài đặt thiết bị đầu raConfirmLưu sửa đổiUkmediaDevControlWidgetaudio device control声音设备管理output device输出设备input device输入设备Sound Equipment ControlQuảy lý thiết bị âm thanhOutput DevicesThiết bị đầu raInput DevicesThiết bị đầu vàoUkmediaInputWidgetInputĐầu vào/Audio/InputInput DeviceThiết bị đầu vào/Audio/Input DeviceVolumeÂm thanh/Audio/VolumeInput LevelPhản hồi âm lượng/Audio/Input LevelNoise ReductionGiảm ồn thông minh/Audio/Noise ReductionVoice MonitorLắng nghe thiết bị này/audio/Voice Monitor(None Device)(Không có thiết bị)You can hear your voice in the output device of your choiceCó thể nghe lại giọng nói của mình qua thiết bị đầu ra đã chọnUkmediaMainWidgetLight-Seeking寻光HeYin和印CustomĐịnh dạng khácNoneSử dùng settings hiện tại của máy inUkmediaOutputWidgetOutputĐầu ra/Audio/OutputOutput DeviceChọn thiết bị đầu ra/Audio/Output DeviceMaster VolumeÂm lượng/Audio/Master VolumeBalanceCân bằng/Audio/BalanceLeftCó sẵnRightPhía phảiVolume IncreaseTăng cường âm lượngVolume above 100% can cause sound distortion and damage your speakers.Khi âm lượng vượt quá 100%, có thể gây méo âm và làm hỏng loa của bạn.Mono AudioÂm thanh đơn kênh âm thanhIt merges the left and right channels into one channel.Gộp kênh âm thanh trái và phải thành một kênh âm thanh đơn.UkmediaSettingsWidgetAdvanced SettingsCài đặt cao cấpSound Equipment ControlQuảy lý thiết bị âm thanh/Audio/Sound Equipment ControlDetailsMô tả chi tiếtApp Sound ControlÂm thanh ứng dụng/Audio/App Sound ControlUkmediaSoundEffectsWidgetSystem SoundHiệu ứng âm thanh hệ thốngSound ThemeChủ đề hiệu ứng âm thanh/Audio/Sound ThemeBeep SwitchÂm thanh thông báo/Audio/Beep SwitchPoweroff MusicTắt máy/Audio/Poweroff MusicStartup MusicKhởi động/Audio/Startup MusicWakeup MusicĐánh thức/Audio/Wakeup MusicNotification SoundNhận thông báo/Audio/Notification SoundVolume Control SoundĐiều chỉnh âm lượng/Audio/Volume Control SoundLogout MusicĐăng xuất/Audio/Logout MusicUkmediaVolumeControlpa_context_set_sink_volume_by_index() failedHàm pa_context_set_sink_volume_by_index() thực thi thất bạipa_context_set_sink_mute_by_index() failedHàm pa_context_set_sink_mute_by_index() thực thi thất bạipa_context_set_source_mute_by_index() failedHàm pa_context_set_source_mute_by_index() thực thi thất bạipa_context_set_source_volume_by_index() failedHàm pa_context_set_source_volume_by_index() thực thi thất bạipa_context_set_source_output_volume() failedHàm pa_context_set_source_output_volume() thực thi thất bạipa_context_set_source_output_mute() failedHàm pa_context_set_source_output_mute() thực thi thất bạipa_context_set_card_profile_by_index() failedHàm pa_context_set_card_profile_by_index() thực thi thất bạipa_context_set_default_sink() failedHàm pa_context_set_default_sink() thực thi thất bạipa_context_set_default_source() failedHàm pa_context_set_default_source() thực thi thất bạipa_context_set_sink_port_by_name() failedHàm pa_context_set_sink_port_by_name() thực thi thất bạipa_context_set_source_port_by_name() failedHàm pa_context_set_source_port_by_name() thực thi thất bại (plugged in) (đã cắm) (unavailable) (không khả dụng) (unplugged) (đã ngắt kết nối)Failed to read data from streamKhông thể đọc dữ liệu từ luồngPeak detectPhát hiện đỉnhFailed to create monitoring streamKhông thể tạo luồng giám sátFailed to connect monitoring streamKhông thể kết nối luồng giám sátIgnoring sink-input due to it being designated as an event and thus handled by the Event widgetBỏ qua sink-input do được chỉ định là sự kiện (event) và sẽ được xử lý bởi widget Sự kiệnpa_context_kill_source_output() failedpa_context_kill_source_output() không thành côngEstablishing connection to PulseAudio. Please wait...Đang thiết lập kết nối tới PulseAudio. Vui lòng chờ...
ukui-media/audio/translations/ab.ts 0000664 0001750 0001750 00000061164 15170054730 016320 0 ustar feng feng
AudioAudioUkccPlugin/UkccPlugin/UkccPluginukccplugin test/UkccPlugin/ukccplugin testInputDevWidgetInput DevicesConfirmOutputDevWidgetOutput DevicesConfirmQObjectpa_context_get_server_info() failedCard callback failureSink callback failureSource callback failureSink input callback failureSource output callback failureClient callback failureServer info callback failureFailed to initialize stream_restore extension: %spa_ext_stream_restore_read() failedFailed to initialize device manager extension: %spa_ext_device_manager_read() failedpa_context_get_sink_info_by_index() failedpa_context_get_source_info_by_index() failedpa_context_get_sink_input_info() failedpa_context_get_client_info() failedpa_context_get_card_info_by_index() failedpa_context_subscribe() failedpa_context_client_info_list() failedpa_context_get_card_info_list() failedpa_context_get_sink_info_list() failedpa_context_get_source_info_list() failedpa_context_get_sink_input_info_list() failedpa_context_get_source_output_info_list() failedUkui Media Volume ControlUkmediaAppCtrlWidgetApp Sound ControlNoneSystem VolumeUkmediaAppItemWidgetApplicationOutput VolumeInput DeviceThis case does not support setting the input deviceOutput DeviceThis case does not support setting the output deviceConfirmUkmediaDevControlWidgetaudio device control声音设备管理output device输出设备input device输入设备Sound Equipment ControlOutput DevicesInput DevicesUkmediaInputWidgetInput/Audio/InputInput Device/Audio/Input DeviceVolume/Audio/VolumeInput Level/Audio/Input LevelNoise Reduction/Audio/Noise ReductionVoice Monitor/audio/Voice Monitor(None Device)You can hear your voice in the output device of your choiceUkmediaMainWidgetLight-Seeking寻光HeYin和印CustomNoneUkmediaOutputWidgetOutput/Audio/OutputOutput Device/Audio/Output DeviceMaster Volume/Audio/Master VolumeBalance/Audio/BalanceLeftRightVolume IncreaseVolume above 100% can cause sound distortion and damage your speakers.Mono AudioIt merges the left and right channels into one channel.UkmediaSettingsWidgetAdvanced SettingsSound Equipment Control/Audio/Sound Equipment ControlDetailsApp Sound Control/Audio/App Sound ControlUkmediaSoundEffectsWidgetSystem SoundSound Theme/Audio/Sound ThemeBeep Switch/Audio/Beep SwitchPoweroff Music/Audio/Poweroff MusicStartup Music/Audio/Startup MusicWakeup Music/Audio/Wakeup MusicNotification Sound/Audio/Notification SoundVolume Control Sound/Audio/Volume Control SoundLogout Music/Audio/Logout MusicUkmediaVolumeControlpa_context_set_sink_volume_by_index() failedpa_context_set_sink_mute_by_index() failedpa_context_set_source_mute_by_index() failedpa_context_set_source_volume_by_index() failedpa_context_set_source_output_volume() failedpa_context_set_source_output_mute() failedpa_context_set_card_profile_by_index() failedpa_context_set_default_sink() failedpa_context_set_default_source() failedpa_context_set_sink_port_by_name() failedpa_context_set_source_port_by_name() failed (plugged in) (unavailable) (unplugged)Failed to read data from streamPeak detectFailed to create monitoring streamFailed to connect monitoring streamIgnoring sink-input due to it being designated as an event and thus handled by the Event widgetpa_context_kill_source_output() failedEstablishing connection to PulseAudio. Please wait...
ukui-media/audio/translations/mn_MN.ts 0000664 0001750 0001750 00000101250 15170054730 016731 0 ustar feng feng
AudioAudioᠠᠦ᠋ᠳᠢᠤ᠋UkccPluginUkccc ᠵᠠᠯᠭᠠᠰᠤ/UkccPlugin/UkccPluginukccplugin testᠤᠭᠯᠠᠭᠤᠷᠭᠠ ᠲᠣᠨᠣᠭᠤ᠋ᠨ ᠰᠣᠷᠢᠯᠲᠠ/UkccPlugin/ukccplugin testInputDevWidgetInput Devicesᠣᠷᠣᠭᠤᠯᠬᠤ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢConfirmᠲᠣᠭᠲᠠᠭᠠᠬᠤOutputDevWidgetOutput Devicesᠭᠠᠷᠭᠠᠬᠤ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢConfirmᠲᠣᠭᠲᠠᠭᠠᠬᠤQObjectpa_context_get_server_info() failedpa_context_get_server_info() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢCard callback failureᠺᠠᠷᠲ ᠢ᠋ ᠡᠬᠡᠬᠦᠯᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠦᠬᠡᠢSink callback failureᠡᠬᠡᠬᠦᠯᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢSource callback failureᠡᠬᠦᠰᠬᠡᠭᠴᠢ ᠵᠢ ᠡᠬᠡᠬᠦᠯᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢSink input callback failureSink input ᠢ᠋\ ᠵᠢ ᠡᠬᠡᠬᠦᠯᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢSource output callback failureᠡᠬᠦᠰᠬᠡᠭᠴᠢ ᠵᠢᠨ ᠭᠠᠷᠭᠠᠯᠳᠠ ᠵᠢ ᠡᠬᠡᠬᠦᠯᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢClient callback failureᠬᠡᠷᠡᠭᠯᠡᠭᠴᠢ ᠵᠢᠨ ᠦᠵᠦᠬᠦᠷ ᠢ᠋ ᠡᠬᠡᠬᠦᠯᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢServer info callback failureᠦᠢᠯᠡᠴᠢᠯᠡᠬᠦᠷ ᠢ᠋ ᠡᠬᠡᠬᠦᠯᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢFailed to initialize stream_restore extension: %sstream_restore ᠵᠢ/ ᠢ᠋ ᠠᠨᠭᠬᠠᠵᠢᠭᠤᠯᠵᠤ ᠦᠷᠬᠡᠳᠬᠡᠬᠦ ᠢᠯᠠᠭᠳᠠᠪᠠ᠄%spa_ext_stream_restore_read() failedpa_ext_stream_restore_read() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢFailed to initialize device manager extension: %sᠳᠦᠬᠦᠬᠡᠷᠦᠮᠵᠢ ᠵᠢᠨ ᠬᠠᠮᠢᠶᠠᠷᠤᠯᠳᠠ ᠵᠢᠨ ᠪᠠᠭᠠᠵᠢ ᠵᠢ ᠠᠨᠭᠬᠠᠵᠢᠭᠤᠯᠵᠤ ᠦᠷᠬᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢ᠄%spa_ext_device_manager_read() failedpa_ext_device_manager_read() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_get_sink_info_by_index() failedpa_context_get_sink_info_by_index() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_get_source_info_by_index() failedpa_context_get_source_info_by_index() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_get_sink_input_info() failedpa_context_get_sink_input_info() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_get_client_info() failedpa_context_get_client_info() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_get_card_info_by_index() failedpa_context_get_card_info_by_index() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_subscribe() failedpa_context_subscribe() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_client_info_list() failedpa_context_client_info_list() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_get_card_info_list() failedpa_context_get_card_info_list() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_get_sink_info_list() failedpa_context_get_sink_info_list() ᠵᠢ/ ᠢ᠋ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_get_source_info_list() failedpa_context_get_source_info_list() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_get_sink_input_info_list() failedpa_context_get_sink_input_info_list() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_get_source_output_info_list() failedpa_context_get_source_output_info_list() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢConnection failed, attempting reconnectᠴᠦᠷᠬᠡᠯᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠦᠬᠡᠢ᠂ ᠰᠢᠨᠡ ᠪᠡᠷ ᠴᠦᠷᠬᠡᠯᠡᠬᠦ ᠵᠢ ᠳᠤᠷᠰᠢᠵᠤ ᠪᠠᠢᠨᠠUkui Media Volume ControlUkui ᠮᠸᠳᠢᠶᠠ ᠵᠢᠨ ᠳᠠᠭᠤ ᠵᠢ ᠡᠵᠡᠮᠳᠡᠬᠦUkmediaAppCtrlWidgetApp Sound Controlᠬᠡᠷᠡᠭᠯᠡᠭᠡᠨᠦ᠌ ᠳᠠᠭᠤNoneᠦᠬᠡᠢSystem VolumeᠰᠢᠰᠲᠸᠮUkmediaAppItemWidgetApplicationᠬᠡᠷᠡᠭᠯᠡᠭᠡOutput Volumeᠭᠠᠷᠭᠠᠬᠤ ᠳᠠᠭᠤInput Deviceᠶᠠᠷᠢᠶᠠᠨᠳ᠋ᠤ᠌ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ ᠪᠤᠶᠤ ᠰᠢᠩᠭᠡᠭᠡᠵᠦ ᠦᠢᠯᠡᠳᠬᠦ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢᠶ᠋ᠢ ᠰᠣᠩᠭᠣᠬᠤThis case does not support setting the input deviceᠲᠤᠰ ᠪᠠᠢᠳᠠᠯ ᠨᠢ ᠣᠷᠣᠭᠤᠯᠬᠤ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢ ᠪᠠᠢᠭᠤᠯᠬᠤᠶ᠋ᠢ ᠳᠡᠮᠵᠢᠬᠦ ᠦᠭᠡᠢOutput Deviceᠳᠠᠭᠤ ᠨᠡᠪᠲᠡᠷᠡᠭᠦᠯᠬᠦ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢᠶ᠋ᠢ ᠰᠣᠩᠭᠣᠬᠤThis case does not support setting the output deviceᠲᠤᠰ ᠪᠠᠢᠳᠠᠯ ᠨᠢ ᠭᠠᠷᠭᠠᠬᠤ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢ ᠲᠣᠬᠢᠷᠠᠭᠤᠯᠬᠤᠶ᠋ᠢ ᠳᠡᠮᠵᠢᠬᠦ ᠦᠭᠡᠢConfirmᠲᠣᠭᠲᠠᠭᠠᠬᠤUkmediaDevControlWidgetSound Equipment Controlᠳᠠᠭᠤᠨᠤ᠋ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢᠶ᠋ᠢᠨ ᠬᠠᠮᠢᠶᠠᠷᠤᠯᠲᠠOutput Devicesᠭᠠᠷᠭᠠᠬᠤ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢInput Devicesᠣᠷᠣᠭᠤᠯᠬᠤ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢUkmediaInputWidgetInputᠣᠷᠣᠭᠤᠯᠬᠤ/Audio/InputInput Deviceᠶᠠᠷᠢᠶᠠᠨᠳ᠋ᠤ᠌ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ ᠪᠤᠶᠤ ᠰᠢᠩᠭᠡᠭᠡᠵᠦ ᠦᠢᠯᠡᠳᠬᠦ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢᠶ᠋ᠢ ᠰᠣᠩᠭᠣᠬᠤ/Audio/Input DeviceVolumeᠡᠪᠬᠡᠮᠡᠯ/Audio/VolumeInput Levelᠳᠠᠭᠤᠨᠤ᠋ ᠬᠡᠮᠵᠢᠶᠡᠶ᠋ᠢᠨ ᠪᠤᠴᠠᠯᠲᠠ/Audio/Input LevelNoise Reductionᠣᠶᠤᠨᠲᠤ ᠪᠡᠷ ᠱᠤᠤᠭᠢᠶᠠᠨ ᠪᠠᠭᠤᠷᠠᠭᠤᠯᠬᠤ/Audio/Noise ReductionVoice Monitorᠲᠤᠰ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢᠶ᠋ᠢ ᠲᠠᠩᠨᠠᠨ ᠰᠣᠨᠣᠰᠬᠤ/audio/Voice Monitor(None Device)(ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢ ᠦᠭᠡᠢ )You can hear your voice in the output device of your choiceᠰᠣᠩᠭᠣᠵᠤ ᠭᠠᠷᠭᠠᠭᠰᠠᠨ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢ ᠳᠣᠲᠣᠷᠠ ᠥᠪᠡᠷᠦ᠋ᠨ ᠳᠠᠭᠤᠶ᠋ᠢ ᠣᠯᠵᠤ ᠰᠣᠨᠣᠰᠤᠨᠠUkmediaMainWidgetCustomᠦᠪᠡᠷᠳᠡᠬᠡᠨ ᠳᠤᠭᠳᠠᠭᠠᠬᠤNoneᠦᠬᠡᠢUkmediaOutputWidgetOutputᠭᠠᠷᠭᠠᠯᠲᠠ/Audio/OutputOutput Deviceᠳᠠᠭᠤ ᠨᠡᠪᠲᠡᠷᠡᠭᠦᠯᠬᠦ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢᠶ᠋ᠢ ᠰᠣᠩᠭᠣᠬᠤ/Audio/Output DeviceMaster Volumeᠳᠠᠭᠤ/Audio/Master VolumeBalanceᠭᠡᠷᠡᠯᠲᠦᠴᠡᠶ᠋ᠢᠨ ᠲᠡᠩᠴᠡᠭᠦᠷᠢᠶ᠋ᠢᠨ ᠲᠣᠬᠢᠷᠠᠭᠤᠯᠭᠠ/Audio/BalanceLeftᠵᠡᠬᠦᠨRightᠪᠠᠷᠠᠭᠤᠨVolume Increaseᠳᠠᠭᠤᠨᠤ᠋ ᠬᠡᠮᠵᠢᠶᠡ ᠴᠢᠩᠭᠠᠷᠠᠬᠤVolume above 100% can cause sound distortion and damage your speakers.ᠳᠠᠭᠤᠨᠤ᠋ ᠬᠡᠮᠵᠢᠶᠡ 100% ᠶ᠋ᠢ ᠳᠠᠪᠠᠬᠤ ᠦᠶᠡᠰ ᠳᠠᠭᠤᠨᠤ᠋ ᠬᠦᠴᠦᠨ ᠰᠣᠯᠢᠭᠳᠠᠵᠤ ᠂ ᠳᠠᠭᠤᠨᠤ᠋ ᠰᠦᠷ ᠮᠠᠨᠳᠤᠭᠤᠯᠤᠭᠴᠢ ᠪᠠᠷᠤᠭ ᠬᠣᠬᠢᠷᠠᠯ ᠭᠠᠷᠤᠨᠠ.Mono Audioᠳᠠᠩ ᠳᠠᠭᠤᠨ ᠵᠠᠮᠤ᠋ᠨ ᠳᠠᠭᠤᠨ ᠳᠠᠪᠲᠠᠮᠵᠢIt merges the left and right channels into one channel.ᠵᠡᠭᠦᠨ ᠳᠠᠭᠤᠨ ᠪᠠ ᠪᠠᠷᠠᠭᠤᠨ ᠳᠠᠭᠤᠨ ᠵᠠᠮᠢ᠋ ᠨᠢᠭᠡ ᠳᠠᠭᠤᠨ ᠵᠠᠮ ᠪᠣᠯᠭᠠᠨ ᠨᠡᠢᠯᠡᠭᠦᠯᠦᠨᠡ.UkmediaSettingsWidgetAdvanced Settingsᠳᠡᠭᠡᠳᠦ ᠵᠡᠷᠭᠡᠶ᠋ᠢᠨ ᠲᠣᠬᠢᠷᠠᠭᠤᠯᠤᠯSound Equipment Controlᠳᠠᠭᠤᠨᠤ᠋ ᠲᠥᠬᠥᠭᠡᠷᠦᠮᠵᠢᠶ᠋ᠢᠨ ᠬᠠᠮᠢᠶᠠᠷᠤᠯᠲᠠ/Audio/Sound Equipment ControlDetailsᠨᠠᠷᠢᠨ ᠵᠠᠩᠭᠢApp Sound Controlᠬᠡᠷᠡᠭᠯᠡᠭᠡᠨᠦ᠌ ᠳᠠᠭᠤ/Audio/App Sound ControlUkmediaSoundEffectsWidgetSystem Soundᠰᠢᠰᠲ᠋ᠧᠮᠦ᠋ᠨ ᠳᠠᠭᠤᠨ ᠦᠢᠯᠡᠳᠦᠯSound Themeᠳᠠᠭᠤᠨᠤ᠋ ᠭᠣᠣᠯ ᠰᠡᠳᠦᠪ/Audio/Sound ThemeAlert Soundᠮᠡᠳᠡᠭᠳᠡᠯ/Audio/Alert SoundBeep Switchᠰᠠᠨᠠᠭᠤᠯᠤᠮᠵᠢ/Audio/Beep SwitchPoweroff Musicᠬᠠᠭᠠᠬᠤ/Audio/Poweroff MusicStartup Musicᠨᠡᠬᠡᠬᠦ/Audio/Startup MusicWakeup Musicᠳᠠᠭᠤᠳᠠᠨ ᠰᠡᠷᠭᠦᠭᠡᠬᠦ/Audio/Wakeup MusicNotification Soundᠮᠡᠳᠡᠭᠳᠡᠯ ᠬᠦᠯᠢᠶᠡᠨ ᠠᠪᠬᠤ/Audio/Notification SoundVolume Control Soundᠳᠠᠭᠤ ᠲᠣᠬᠢᠷᠠᠭᠤᠯᠬᠤ/Audio/Volume Control SoundVolume Changeᠳᠠᠭᠤᠨ ᠤ᠋ ᠬᠡᠮᠵᠢᠶᠡ ᠵᠢ ᠳᠤᠬᠢᠷᠠᠭᠤᠯᠬᠤ/Audio/Volume ChangeLogout Musicᠳᠠᠩᠰᠠᠠ᠋ᠴᠠ ᠬᠠᠰᠤᠬᠤ/Audio/Logout MusicUkmediaVolumeControlpa_context_set_sink_volume_by_index() failedpa_context_set_sink_volume_by_index() ᠵᠢ/ ᠢ᠋ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_set_sink_mute_by_index() failedpa_context_set_sink_mute_by_index ()ᠢᠯᠠᠭᠳᠠᠵᠠᠢpa_context_set_source_mute_by_index() failedpa_context_set_source_mute_by_index () ᠢ᠋\ ᠵᠢ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_set_source_volume_by_index() failedpa_context_set_source_volume_by_index () ᠢ᠋\ ᠵᠢ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_set_source_output_volume() failedpa_context_set_source_output_volume() ᠢ᠋\ ᠵᠢ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_set_source_output_mute() failedpa_context_set_source_output_mute() ᠢ᠋\ ᠵᠢ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_set_card_profile_by_index() failedpa_context_set_card_profile_by_index() ᠢ᠋\ ᠵᠢ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_set_default_sink() failedpa_context_set_default_sink() ᠢ᠋\ ᠵᠢ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_set_default_source() failedpa_context_set_default_source() ᠢ᠋\ ᠵᠢ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_set_sink_port_by_name() failedpa_context_set_sink_port_by_name() ᠢ᠋\ ᠵᠢ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢpa_context_set_source_port_by_name() failedpa_context_set_source_port_by_name() ᠢ᠋\ ᠵᠢ ᠬᠦᠢᠴᠡᠳᠬᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠥᠬᠡᠢ (plugged in) ( ᠴᠡᠨᠡᠯᠡᠭᠰᠡᠨ ᠪᠠᠢᠨᠠ) (unavailable) ( ᠬᠡᠷᠡᠭᠯᠡᠵᠦ ᠪᠤᠯᠬᠤ ᠦᠬᠡᠢ) (unplugged) ( ᠴᠡᠨᠡᠭᠯᠡᠭᠰᠡᠨ ᠥᠬᠡᠢ)Failed to read data from streamᠳ᠋ᠠᠢᠲ᠋ᠠ ᠵᠢ ᠤᠩᠰᠢᠬᠤ ᠵᠢᠨ ᠠᠷᠭᠠ ᠥᠬᠡᠢPeak detectᠣᠷᠭᠢᠯ ᠬᠡᠮᠵᠢᠭᠳᠡᠯ ᠦ᠋ᠨ ᠪᠠᠢᠴᠠᠭᠠᠯᠲᠠFailed to create monitoring streamᠬᠢᠨᠠᠨ ᠬᠡᠮᠵᠢᠬᠦ ᠤᠷᠤᠰᠬᠠᠯ ᠢ᠋ ᠪᠠᠢᠭᠤᠯᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠦᠬᠡᠢFailed to connect monitoring streamᠬᠢᠨᠠᠨ ᠬᠡᠮᠵᠢᠬᠦ ᠤᠷᠤᠰᠬᠠᠯ ᠢ᠋ ᠴᠦᠷᠬᠡᠯᠡᠵᠤ ᠴᠢᠳᠠᠭᠰᠠᠨ ᠦᠬᠡᠢIgnoring sink-input due to it being designated as an event and thus handled by the Event widgetsink-input ᠢ᠋\ ᠵᠢ ᠤᠮᠳᠤᠭᠠᠢᠯᠠᠨᠠ᠂ ᠤᠴᠢᠷ ᠨᠢ ᠳᠡᠬᠦᠨ ᠢ᠋ ᠶᠠᠪᠤᠳᠠᠯ ᠵᠢᠨᠷ ᠳᠤᠭᠳᠠᠭᠠᠭᠰᠠᠨ᠂ ᠡᠢᠮᠤ ᠡᠴᠡ Event widget ᠵᠢᠡᠷ\ ᠪᠡᠷ ᠰᠢᠢᠳᠪᠦᠷᠢᠯᠡᠬᠦ ᠬᠡᠷᠡᠭᠳᠡᠢpa_context_kill_source_output() failedpa_context_kill_source_output () ᠢᠯᠠᠭᠳᠠᠬᠤEstablishing connection to PulseAudio. Please wait...PulseAudio ᠳ᠋ᠤ᠌/ ᠲᠤ᠌ ᠴᠦᠷᠬᠡᠯᠡᠵᠦ ᠪᠠᠢᠨᠠ᠂ ᠳᠦᠷ ᠬᠦᠯᠢᠶᠡᠬᠡᠷᠡᠢ···
ukui-media/audio/translations/en_US.ts 0000664 0001750 0001750 00000061472 15170054730 016751 0 ustar feng feng
AudioAudioUkccPlugin/UkccPlugin/UkccPluginukccplugin test/UkccPlugin/ukccplugin testInputDevWidgetInput DevicesConfirmOutputDevWidgetOutput DevicesConfirmQObjectpa_context_get_server_info() failedCard callback failureSink callback failureSource callback failureSink input callback failureSource output callback failureClient callback failureServer info callback failureFailed to initialize stream_restore extension: %spa_ext_stream_restore_read() failedFailed to initialize device manager extension: %spa_ext_device_manager_read() failedpa_context_get_sink_info_by_index() failedpa_context_get_source_info_by_index() failedpa_context_get_sink_input_info() failedpa_context_get_client_info() failedpa_context_get_card_info_by_index() failedpa_context_subscribe() failedpa_context_client_info_list() failedpa_context_get_card_info_list() failedpa_context_get_sink_info_list() failedpa_context_get_source_info_list() failedpa_context_get_sink_input_info_list() failedpa_context_get_source_output_info_list() failedUkui Media Volume ControlUkmediaAppCtrlWidgetApp Sound ControlNoneSystem VolumeUkmediaAppItemWidgetApplicationOutput VolumeInput DeviceThis case does not support setting the input deviceOutput DeviceThis case does not support setting the output deviceConfirmUkmediaDevControlWidgetSound Equipment ControlOutput DevicesInput DevicesUkmediaInputWidgetInput/Audio/InputInput Device/Audio/Input DeviceVolume/Audio/VolumeInput Level/Audio/Input LevelNoise Reduction/Audio/Noise ReductionVoice Monitor/audio/Voice Monitor(None Device)You can hear your voice in the output device of your choiceUkmediaMainWidgetCustomNoneUkmediaOutputWidgetOutput/Audio/OutputOutput Device/Audio/Output DeviceMaster Volume/Audio/Master VolumeBalance/Audio/BalanceLeftRightVolume IncreaseVolume above 100% can cause sound distortion and damage your speakers.Mono AudioIt merges the left and right channels into one channel.UkmediaSettingsWidgetAdvanced SettingsSound Equipment Control/Audio/Sound Equipment ControlDetailsApp Sound Control/Audio/App Sound ControlUkmediaSoundEffectsWidgetSystem SoundSound Theme/Audio/Sound ThemeBeep Switch/Audio/Beep SwitchPoweroff Music/Audio/Poweroff MusicStartup Music/Audio/Startup MusicWakeup Music/Audio/Wakeup MusicLogout Music/Audio/Logout MusicNotification Sound/Audio/Notification SoundVolume Control Sound/Audio/Volume Control SoundUkmediaVolumeControlpa_context_set_sink_volume_by_index() failedpa_context_set_sink_mute_by_index() failedpa_context_set_source_mute_by_index() failedpa_context_set_source_volume_by_index() failedpa_context_set_source_output_volume() failedpa_context_set_source_output_mute() failedpa_context_set_card_profile_by_index() failedpa_context_set_default_sink() failedpa_context_set_default_source() failedpa_context_set_sink_port_by_name() failedpa_context_set_source_port_by_name() failed (plugged in) (unavailable) (unplugged)Failed to read data from streamPeak detectFailed to create monitoring streamFailed to connect monitoring streamIgnoring sink-input due to it being designated as an event and thus handled by the Event widgetpa_context_kill_source_output() failedEstablishing connection to PulseAudio. Please wait...
ukui-media/audio/translations/zh_HK.ts 0000664 0001750 0001750 00000064332 15170054730 016741 0 ustar feng feng
AudioAudio聲音UkccPluginUkcc外掛程式/UkccPlugin/UkccPluginukccplugin testukcc外掛程式 測試/UkccPlugin/ukccplugin testInputDevWidgetInput Devices輸入裝置Confirm確認OutputDevWidgetOutput Devices輸出裝置Confirm確認QObjectpa_context_get_server_info() failedpa_context_get_server_info() 執行失敗Card callback failure卡片回調失敗Sink callback failure輸出回調失敗Source callback failure輸入回調失敗Sink input callback failure水槽輸入回調失敗Source output callback failuresource-ouput回調失敗Client callback failure用戶端回調失敗Server info callback failure服務端回調錯誤Failed to initialize stream_restore extension: %s初始化stream_restore擴展失敗:%spa_ext_stream_restore_read() failedpa_ext_stream_restore_read() 執行失敗Failed to initialize device manager extension: %s初始化設備管理器擴展失敗:%spa_ext_device_manager_read() failedpa_ext_device_manager_read() 執行失敗pa_context_get_sink_info_by_index() failedpa_context_get_sink_info_by_index() 執行失敗pa_context_get_source_info_by_index() failedpa_context_get_source_info_by_index() 執行失敗pa_context_get_sink_input_info() failedpa_context_get_sink_input_info() 執行失敗pa_context_get_client_info() failedpa_context_get_client_info() 執行失敗pa_context_get_card_info_by_index() failedpa_context_get_card_info_by_index() 執行失敗pa_context_subscribe() failedpa_context_subscribe() 執行失敗pa_context_client_info_list() failedpa_context_client_info_list() 執行失敗pa_context_get_card_info_list() failedpa_context_get_card_info_list() 執行失敗pa_context_get_sink_info_list() failedpa_context_get_sink_info_list() 執行失敗pa_context_get_source_info_list() failedpa_context_get_source_info_list() 執行失敗pa_context_get_sink_input_info_list() failedpa_context_get_sink_input_info_list() 執行失敗pa_context_get_source_output_info_list() failedpa_context_get_source_output_info_list() 執行失敗Connection failed, attempting reconnect連接失敗,嘗試重新連接中Ukui Media Volume ControlUKUI 媒體音量控制UkmediaAppCtrlWidgetApp Sound Control應用程式聲音控制None空System Volume系統音量UkmediaAppItemWidgetApplication應用Output Volume輸出音量Input Device選擇輸入設備This case does not support setting the input device本案例不支援設定輸入設備Output Device選擇輸出設備This case does not support setting the output device本案例不支援設定輸出設備Confirm確認UkmediaDevControlWidgetSound Equipment Control音響設備控制Output Devices輸出裝置Input Devices輸入裝置UkmediaInputWidgetInput輸入/Audio/InputInput Device選擇輸入設備/Audio/Input DeviceVolume音量/Audio/VolumeInput Level輸入反饋/Audio/Input LevelNoise Reduction智慧降噪/Audio/Noise ReductionVoice Monitor語音監聽/audio/Voice Monitor(None Device)(無裝置)You can hear your voice in the output device of your choice您可以在您選擇的輸出裝置中聽到您的聲音UkmediaMainWidgetCustom自定義None空UkmediaOutputWidgetOutput輸出/Audio/OutputOutput Device選擇輸出設備/Audio/Output DeviceMaster Volume音量/Audio/Master VolumeBalance聲道平衡/Audio/BalanceLeft左Right右Volume Increase音量增強Volume above 100% can cause sound distortion and damage your speakers.音量超過 100% 可能會導致聲音失真並損壞揚聲器。Mono Audio單聲道音訊It merges the left and right channels into one channel.它將左右通道合併為一個通道。UkmediaSettingsWidgetAdvanced Settings進階設定Sound Equipment Control音響設備控制/Audio/Sound Equipment ControlDetails細節App Sound Control應用程式聲音控制/Audio/App Sound ControlUkmediaSoundEffectsWidgetSystem Sound系統音效Sound Theme音效主題/Audio/Sound ThemeAlert Sound通知/Audio/Alert SoundBeep Switch提示音/Audio/Beep SwitchPoweroff Music關機/Audio/Poweroff MusicStartup Music開機/Audio/Startup MusicWakeup Music喚醒/Audio/Wakeup MusicNotification Sound通知音效/Audio/Notification SoundVolume Control Sound音量調整音效/Audio/Volume Control SoundVolume Change音量調節/Audio/Volume ChangeLogout Music註銷/Audio/Logout MusicUkmediaVolumeControlpa_context_set_sink_volume_by_index() failedpa_context_set_sink_volume_by_index() 執行失敗pa_context_set_sink_mute_by_index() failedpa_context_set_source_mute_by_index() failedpa_context_set_source_mute_by_index() 執行失敗pa_context_set_source_volume_by_index() failedpa_context_set_source_volume_by_index() 執行失敗pa_context_set_source_output_volume() failedpa_context_set_source_output_volume() 執行失敗pa_context_set_source_output_mute() failedpa_context_set_source_output_mute() 執行失敗pa_context_set_card_profile_by_index() failedpa_context_set_card_profile_by_index() 執行失敗pa_context_set_default_sink() failedpa_context_set_default_sink() 執行失敗pa_context_set_default_source() failedpa_context_set_default_source() 執行失敗pa_context_set_sink_port_by_name() failedpa_context_set_sink_port_by_name() 執行失敗pa_context_set_source_port_by_name() failedpa_context_set_source_port_by_name() 執行失敗 (plugged in) (插上了) (unavailable) ( 不可用 ) (unplugged) 沒有連接Failed to read data from stream從流中讀取數據失敗Peak detect峰值檢測Failed to create monitoring stream創建監控流失敗Failed to connect monitoring stream連接監控流失敗Ignoring sink-input due to it being designated as an event and thus handled by the Event widget忽略沉降輸入,因為它被指定為事件,因此由事件小部件處理pa_context_kill_source_output() failedEstablishing connection to PulseAudio. Please wait...正在建立與PulseAudio的連接。 請等待...
ukui-media/audio/app-device-control/ 0000775 0001750 0001750 00000000000 15170054730 016330 5 ustar feng feng ukui-media/audio/app-device-control/ukmedia_app_item_widget.h 0000664 0001750 0001750 00000005335 15170054730 023347 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef UKMEDIA_ITEM_WIDGET_H
#define UKMEDIA_ITEM_WIDGET_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "kslider.h"
#include "../../audio/ukui_custom_style.h"
#include "../../common/ukmedia_common.h"
using namespace kdk;
class UkmediaAppItemWidget : public QWidget
{
Q_OBJECT
public:
UkmediaAppItemWidget(QWidget *parent = nullptr);
~UkmediaAppItemWidget();
friend class UkmediaAppCtrlWidget;
void initUI();
void addInputCombobox(QString port);
void addOutputCombobox(QString port);
void setSliderValue(int value);
void outputVolumeDarkThemeImage(int value, bool status);
void setTitleName(QString name); //设置应用标题名
void setChildObjectName(QString name); //设置控件object name
void setInputHintWidgetShow(bool status);
void setOutputHintWidgetShow(bool status);
private:
QFrame* myLine();
// QFrame *line1;
// QFrame *line2;
QFrame *m_pAppWidget;
QFrame *m_pInputWidget;
QFrame *m_pOutputWidget;
QFrame *m_pVolumeWidget;
QFrame *m_pCheckWidget;
FixLabel *m_pAppLabel;
FixLabel *m_pVolumeLabel;
FixLabel *m_pInputDevLabel;
FixLabel *m_pOutputDevLabel;
FixLabel *m_pVolumeNumLabel;
QLabel *m_pInputHintIcon;
QLabel *m_pOutputHintIcon;
QFrame *m_pInputHintWidget;
QFrame *m_pOutputHintWidget;
FixLabel *m_pInputHintLabel;
FixLabel *m_pOutputHintLabel;
KSlider *m_pVolumeSlider;
QComboBox *m_pInputCombobox;
QComboBox *m_pOutputCombobox;
QPushButton *m_pConfirmBtn;
UkuiButtonDrawSvg *m_pVolumeBtn;
QString mThemeName;
void onPaletteChanged();
};
#endif //UKMEDIA_ITEM_WIDGET_H
ukui-media/audio/app-device-control/ukmedia_app_device_ctrl.h 0000664 0001750 0001750 00000006630 15170054730 023330 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef UKMEDIA_APP_DEVICE_CTRL_H
#define UKMEDIA_APP_DEVICE_CTRL_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "kwidget.h"
#include "knavigationbar.h"
#include "ukmedia_app_item_widget.h"
#include "../../common/ukmedia_common.h"
using namespace kdk;
class UkmediaAppCtrlWidget : public KWidget
{
Q_OBJECT
public:
explicit UkmediaAppCtrlWidget(QWidget *parent = nullptr);
~UkmediaAppCtrlWidget();
void initUI();
void initData();
void dealSlot();
void addItem(QString appName);
int getSystemVolume();
bool getSystemMuteState();
int getAppVolume(QString app);
bool getAppMuteState(QString app);
void getAppList();
void getAllPortInfo();
void getRecordAppInfo();
void getPlaybackAppInfo();
QStringList getAllInputPort();
QStringList getAllOutputPort();
QString getSystemInputDevice();
QString getSystemOutputDevice();
QString getAppInputDevice(QString app);
QString getAppOutputDevice(QString app);
private:
KNavigationBar* m_pAppSoundCtrlBar;
QStackedWidget* stackWidget;
QStringList appList; //获取当前存在的应用名单
QStringList sinkPortList;
QStringList sourcePortList;
QList recordAppInfoList;
QList playbackAppInfoList;
QMap portInfoMap;
QDBusInterface* interface;
bool setSystemVolume(int value);
bool setSystemInputDevice(QString portLabel);
bool setSystemOutputDevice(QString portLabel);
int findAppDirection(QString appName);
#ifdef PA_PROP_APPLICATION_MOVE
bool checkAppMoveStatus(int appType, QString appName);
#endif
int indexOfItemCombobox(QString port, QComboBox *box);
QString getAppName(QString appName);
QString getAppIcon(QString appName);
QString AppDesktopFileAdaption(QString appName);
private Q_SLOTS:
void updatePort();
void updateAppItem(QString appName);
void removeAppItem(QString appName);
void updateSystemVolume(int value);
void updateSystemMuteState(bool state);
void updateAppMuteState(QString app, bool state);
// void appVolumeChangedSlot(QString app, QString appId, int volume);
bool setAppMuteState();
bool setAppVolume(int value);
bool setAppInputDevice(QString portLabel);
bool setAppOutputDevice(QString portLabel);
};
#endif // UKMEDIA_APP_DEVICE_CTRL_H
ukui-media/audio/app-device-control/app-device-control.pri 0000664 0001750 0001750 00000000317 15170054730 022540 0 ustar feng feng INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/ukmedia_app_item_widget.h \
$$PWD/ukmedia_app_device_ctrl.h \
SOURCES += \
$$PWD/ukmedia_app_item_widget.cpp \
$$PWD/ukmedia_app_device_ctrl.cpp \
ukui-media/audio/app-device-control/ukmedia_app_device_ctrl.cpp 0000664 0001750 0001750 00000105270 15170054730 023663 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "ukmedia_app_device_ctrl.h"
#include
UkmediaAppCtrlWidget::UkmediaAppCtrlWidget(QWidget *parent)
: KWidget(parent)
{
initData();
initUI();
dealSlot();
}
void UkmediaAppCtrlWidget::initData()
{
interface = new QDBusInterface(UKUI_MEDIA_SERVICE,
UKUI_MEDIA_PATH,
UKUI_MEDIA_INTERFACE,
QDBusConnection::sessionBus());
if (!interface->isValid())
return;
//1.获取app列表
getAppList();
//2.获取所有可用端口信息
getAllPortInfo();
//3.获取可用输出端口
getAllOutputPort();
//4.获取可用输入端口
getAllInputPort();
}
void UkmediaAppCtrlWidget::initUI()
{
setWidgetName(tr("App Sound Control"));
setIcon(QIcon::fromTheme("ukui-control-center"));
setWindowFlags(Qt::Dialog);
stackWidget = new QStackedWidget(this);
stackWidget->setFixedSize(560, 520);
m_pAppSoundCtrlBar = new KNavigationBar(this);
m_pAppSoundCtrlBar->setFixedSize(188,520);
QBoxLayout *vLayout = new QVBoxLayout();
vLayout->addWidget(m_pAppSoundCtrlBar);
sideBar()->setLayout(vLayout);
vLayout = new QVBoxLayout;
vLayout->addWidget(stackWidget);
baseBar()->setLayout(vLayout);
this->setLayoutType(HorizontalType);
// 添加应用到导航栏
for (QString appName : appList)
addItem(appName);
// 初始化UI 默认选中第一项
QStandardItemModel* m_mode = m_pAppSoundCtrlBar->model(); //获取mode
if (m_mode->item(0,0))
m_pAppSoundCtrlBar->listview()->setCurrentIndex(m_mode->item(0,0)->index());
}
void UkmediaAppCtrlWidget::addItem(QString appName)
{
// 获取应用 name
QString iconName = getAppIcon(appName);
QString pAppName = getAppName(appName);
// 1.左边导航栏增加标题
QStandardItem *item = new QStandardItem(QIcon::fromTheme(iconName), pAppName);
m_pAppSoundCtrlBar->addItem(item);
// 2.右边添加窗口
UkmediaAppItemWidget* widget = new UkmediaAppItemWidget();
widget->setTitleName(pAppName);
widget->setChildObjectName(appName);
widget->setAttribute(Qt::WA_DeleteOnClose);
stackWidget->addWidget(widget);
// 3.设置app对应音量滑动条值
widget->setSliderValue(getAppVolume(appName));
widget->outputVolumeDarkThemeImage(getAppVolume(appName), getAppMuteState(appName));
// 4.设置app对应输出输入设备
for (QString sinkPortLabel : sinkPortList)
widget->addOutputCombobox(sinkPortLabel);
for (QString sourcePortLabel : sourcePortList)
widget->addInputCombobox(sourcePortLabel);
QString defaultInPort = getAppInputDevice(appName);
QString defaultOutPort = getAppOutputDevice(appName);
widget->m_pOutputCombobox->setCurrentText(defaultOutPort);
widget->m_pInputCombobox->setCurrentText(defaultInPort);
// 5.slots
connect(widget->m_pVolumeSlider, &KSlider::valueChanged, this, &UkmediaAppCtrlWidget::setAppVolume);
connect(widget->m_pVolumeBtn, &UkuiButtonDrawSvg::clicked, this, &UkmediaAppCtrlWidget::setAppMuteState);
connect(widget->m_pInputCombobox, QOverload::of(&QComboBox::currentIndexChanged), this, [this](int index) {
QComboBox *comboBox = qobject_cast(sender());
if (comboBox) {
QString text = comboBox->itemText(index);
setAppInputDevice(text);
}
});
connect(widget->m_pOutputCombobox, QOverload::of(&QComboBox::currentIndexChanged), this, [this](int index) {
QComboBox *comboBox = qobject_cast(sender());
if (comboBox) {
QString text = comboBox->itemText(index);
setAppOutputDevice(text);
}
});
connect(widget->m_pConfirmBtn, &QPushButton::clicked, this, [=](){
this->close();
});
//需求31268待2501再合入
#if 1
if (appName.compare(QString(SYSTEM_VOLUME_CTRL)) == 0) {
if (!sinkPortList.isEmpty()) {
if (QString(sinkPortList.at(0)).compare(QString(tr("None"))) == 0) {
widget->m_pVolumeSlider->setEnabled(false);
widget->m_pVolumeBtn->setEnabled(false);
} else {
widget->m_pVolumeSlider->setEnabled(true);
widget->m_pVolumeBtn->setEnabled(true);
}
}
}
#endif
// 6.区分App类型
int appType = findAppDirection(appName);
switch (appType) {
case PA_STREAM_PLAYBACK:
item->setData(PA_STREAM_PLAYBACK);
widget->m_pInputCombobox->setDisabled(true);
break;
case PA_STREAM_RECORD:
item->setData(PA_STREAM_RECORD);
widget->m_pVolumeWidget->hide();
widget->m_pOutputCombobox->setDisabled(true);
break;
default:
item->setData(PA_STREAM_NODIRECTION);
break;
}
#ifdef PA_PROP_APPLICATION_MOVE
widget->setInputHintWidgetShow(checkAppMoveStatus(PA_STREAM_RECORD, appName));
widget->setOutputHintWidgetShow(checkAppMoveStatus(PA_STREAM_PLAYBACK, appName));
#endif
qDebug() << __func__ << "Application:" << appName << "Type:" << item->data().toInt();
}
void UkmediaAppCtrlWidget::removeAppItem(QString appName)
{
int index = -1;
for (int i = 0; i < appList.count(); i++) {
if (appList.at(i) == appName) {
index = i;
appList.removeAt(i);
break;
}
}
if (index == -1)
return;
QWidget* w = stackWidget->widget(index);
stackWidget->removeWidget(w);
w->close();
delete w;
m_pAppSoundCtrlBar->model()->removeRow(index);
stackWidget->setCurrentIndex(m_pAppSoundCtrlBar->listview()->currentIndex().row());
qDebug() << __func__ << appName << "stackWidget:" << stackWidget->children();
}
void UkmediaAppCtrlWidget::dealSlot()
{
// 导航栏点击应用切换对应窗口slot
connect(m_pAppSoundCtrlBar->listview(), &QListView::clicked, this, [=](const QModelIndex modelIndex) {
int index = m_pAppSoundCtrlBar->listview()->currentIndex().row();
stackWidget->setCurrentIndex(index);
});;
QDBusConnection::sessionBus().connect(QString(),
UKUI_MEDIA_CONTROL_PATH,
UKUI_MEDIA_SERVICE,
"updatePortSignal",
this,
SLOT(updatePort()));
QDBusConnection::sessionBus().connect(QString(),
UKUI_MEDIA_CONTROL_PATH,
UKUI_MEDIA_SERVICE,
"updateMute",
this,
SLOT(updateSystemMuteState(bool)));
QDBusConnection::sessionBus().connect(QString(),
UKUI_MEDIA_CONTROL_PATH,
UKUI_MEDIA_SERVICE,
"updateVolume",
this,
SLOT(updateSystemVolume(int)));
QDBusConnection::sessionBus().connect(QString(),
UKUI_MEDIA_CONTROL_PATH,
UKUI_MEDIA_SERVICE,
"updateApp",
this,
SLOT(updateAppItem(QString)));
QDBusConnection::sessionBus().connect(QString(),
UKUI_MEDIA_CONTROL_PATH,
UKUI_MEDIA_SERVICE,
"removeSinkInputSignal",
this,
SLOT(removeAppItem(QString)));
// QDBusConnection::sessionBus().connect(QString(),
// UKUI_MEDIA_CONTROL_PATH,
// UKUI_MEDIA_SERVICE,
// "sinkInputVolumeChangedSignal",
// this,
// SLOT(appVolumeChangedSlot(QString, QString, int)));
}
// 获取运行应用名单
void UkmediaAppCtrlWidget::getAppList()
{
// 首先添加系统音量
appList << SYSTEM_VOLUME_CTRL;
QDBusReply reply = interface->call("getAppList");
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return;
}
appList << reply.value();
getPlaybackAppInfo();
getRecordAppInfo();
}
void UkmediaAppCtrlWidget::getPlaybackAppInfo()
{
qRegisterMetaType("appInfo");
qDBusRegisterMetaType();
QDBusReply> reply = interface->call("getPlaybackAppInfo");
QList list = reply.value();
for (int i = 0; i < list.count(); i++) {
const QDBusArgument &dbusArgs = list.at(i).value();
while (!dbusArgs.atEnd()) {
appInfo info;
dbusArgs.beginStructure();
dbusArgs >> info.index;
dbusArgs >> info.volume;
dbusArgs >> info.channel;
dbusArgs >> info.mute;
dbusArgs >> info.direction;
#ifdef PA_PROP_APPLICATION_MOVE
dbusArgs >> info.move;
#endif
dbusArgs >> info.name;
dbusArgs >> info.masterIndex;
dbusArgs >> info.masterDevice;
playbackAppInfoList.push_back(info);
dbusArgs.endStructure();
qDebug() << __func__ << info.index << info.name << info.volume << info.masterDevice;
}
}
}
void UkmediaAppCtrlWidget::getRecordAppInfo()
{
qRegisterMetaType("appInfo");
qDBusRegisterMetaType();
QDBusReply> reply = interface->call("getRecordAppInfo");
QList list = reply.value();
for (int i = 0; i < list.count(); i++) {
const QDBusArgument &dbusArgs = list.at(i).value();
while (!dbusArgs.atEnd()) {
appInfo info;
dbusArgs.beginStructure();
dbusArgs >> info.index;
dbusArgs >> info.volume;
dbusArgs >> info.channel;
dbusArgs >> info.mute;
dbusArgs >> info.direction;
#ifdef PA_PROP_APPLICATION_MOVE
dbusArgs >> info.move;
#endif
dbusArgs >> info.name;
dbusArgs >> info.masterIndex;
dbusArgs >> info.masterDevice;
recordAppInfoList.push_back(info);
dbusArgs.endStructure();
qDebug() << __func__ << info.index << info.name << info.volume << info.masterDevice << info.direction;
}
}
}
void UkmediaAppCtrlWidget::getAllPortInfo()
{
// 注册自定义结构体类型
qRegisterMetaType("pa_device_port_info");
qDBusRegisterMetaType();
QDBusConnection bus = QDBusConnection::sessionBus();
if (!bus.isConnected()) {
qDebug() << "Cannot connect to D-Bus.";
return ;
}
QDBusMessage message = QDBusMessage::createMethodCall(PULSEAUDIO_DEVICECONTROL_SERVICE,
PULSEAUDIO_DEVICECONTROL_PATH,
PULSEAUDIO_DEVICECONTROL_INTERFACE,
"GetAllDeviceInfo");
QDBusMessage reply = bus.call(message);
const QDBusArgument &dbusArgs = reply.arguments().at(0).value().variant().value();
QList devsInfo;
dbusArgs.beginArray();
while (!dbusArgs.atEnd()) {
pa_device_port_info info;
dbusArgs.beginStructure();
dbusArgs >> info.card;
dbusArgs >> info.direction;
dbusArgs >> info.available;
dbusArgs >> info.plugged_stauts;
dbusArgs >> info.name;
dbusArgs >> info.description;
dbusArgs >> info.device_description;
dbusArgs >> info.device_product_name;
devsInfo.push_back(info);
dbusArgs.endStructure();
}
dbusArgs.endArray();
// 添加端口至portInfoMap
int count = 0;
for (pa_device_port_info &info : devsInfo) {
if (info.available == PA_PORT_AVAILABLE_YES || info.available == PA_PORT_AVAILABLE_UNKNOWN) {
QString portLabel = info.description + "(" + info.device_description + ")";
info.description = portLabel;
portInfoMap.insert(count, info);
count++;
}
}
}
// 获取所有可用输出端口
QStringList UkmediaAppCtrlWidget::getAllOutputPort()
{
QMap::iterator it;
for (it = portInfoMap.begin(); it != portInfoMap.end(); it++) {
if (it.value().direction == PA_DIRECTION_OUTPUT) {
sinkPortList << it.value().description;
// Usb声卡和蓝牙声卡存在多种配置文件,保留声卡当前选择的配置文件端口
QDBusReply reply = interface->call("isPortHidingNeeded", SoundType::SINK, it.value().card, it.value().description);
if (reply.value())
sinkPortList.removeAll(it.value().description);
}
}
if (sinkPortList.isEmpty())
sinkPortList.append(tr("None"));
return sinkPortList;
}
// 获取所有可用输入端口
QStringList UkmediaAppCtrlWidget::getAllInputPort()
{
QMap::iterator it;
for (it = portInfoMap.begin(); it != portInfoMap.end(); it++) {
if (it.value().direction == PA_DIRECTION_INPUT) {
sourcePortList << it.value().description;
QDBusReply reply = interface->call("isPortHidingNeeded", SoundType::SOURCE, it.value().card, it.value().description);
if (reply.value())
sourcePortList.removeAll(it.value().description);
}
}
if (sourcePortList.isEmpty())
sourcePortList.append(tr("None"));
return sourcePortList;
}
// 获取系统音量
int UkmediaAppCtrlWidget::getSystemVolume()
{
QDBusReply reply = interface->call("getDefaultOutputVolume");
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return 0;
}
return reply.value();
}
// 获取应用音量
int UkmediaAppCtrlWidget::getAppVolume(QString app)
{
if (app == SYSTEM_VOLUME_CTRL)
return getSystemVolume();
QDBusReply reply = interface->call("getAppVolume", app);
if(!reply.isValid()) {
qWarning() << __func__ << "failed";
return 0;
}
return reply.value();
}
bool UkmediaAppCtrlWidget::getSystemMuteState()
{
QDBusReply reply = interface->call("getDefaultOutputMuteState");
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return false;
}
return reply.value();
}
// 获取应用静音状态
bool UkmediaAppCtrlWidget::getAppMuteState(QString app)
{
if (app == SYSTEM_VOLUME_CTRL)
return getSystemMuteState();
QDBusReply reply = interface->call("getAppMuteState", app);
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return false;
}
return reply.value();
}
// 获取系统默认输出设备
QString UkmediaAppCtrlWidget::getSystemOutputDevice()
{
QDBusReply reply = interface->call("getSystemOutputDevice");
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return "";
}
return reply.value();
}
// 获取系统默认输入设备
QString UkmediaAppCtrlWidget::getSystemInputDevice()
{
QDBusReply reply = interface->call("getSystemInputDevice");
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return "";
}
return reply.value();
}
// 获取应用默认输出设备
QString UkmediaAppCtrlWidget::getAppOutputDevice(QString app)
{
if (app == SYSTEM_VOLUME_CTRL)
return getSystemOutputDevice();
QDBusReply reply = interface->call("getAppOutputDevice", app);
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return "";
}
return reply.value();
}
// 获取应用默认输入设备
QString UkmediaAppCtrlWidget::getAppInputDevice(QString app)
{
if (app == SYSTEM_VOLUME_CTRL)
return getSystemInputDevice();
QDBusReply reply = interface->call("getAppInputDevice", app);
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return "";
}
return reply.value();
}
// 设置系统音量
bool UkmediaAppCtrlWidget::setSystemVolume(int value)
{
QDBusReply reply = interface->call("setDefaultOutputVolume", value);
if (!reply.isValid())
return false;
return reply.value();
}
// 设置应用音量
bool UkmediaAppCtrlWidget::setAppVolume(int value)
{
QSlider *slider = qobject_cast(sender());
if (slider == nullptr)
return false;
QString app = slider->objectName();
UkmediaAppItemWidget *w = stackWidget->findChild(app);
w->outputVolumeDarkThemeImage(value, getAppMuteState(app));
if (app == SYSTEM_VOLUME_CTRL)
return setSystemVolume(value);
QDBusReply reply = interface->call("setAppVolume", app, value);
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return false;
}
return reply.value();
}
// 设置应用静音
bool UkmediaAppCtrlWidget::setAppMuteState()
{
UkuiButtonDrawSvg *btn = qobject_cast(sender());
if (btn == nullptr)
return false;
QString app = btn->objectName();
// 1.系统静音设置
if (app == SYSTEM_VOLUME_CTRL) {
QDBusReply reply1 = interface->call("getDefaultOutputMuteState");
if (!reply1.isValid())
return false;
bool state = reply1.value();
QDBusReply reply2 = interface->call("setDefaultOutputMuteState", !state);
if (!reply2.isValid())
return false;
btn->outputVolumeDarkThemeImage(getAppVolume(app), !state);
return reply2.value();
}
// 2.应用静音设置
QDBusReply reply1 = interface->call("getAppMuteState", app);
if (!reply1.isValid())
return false;
bool state = reply1.value();
QDBusReply reply = interface->call("setAppMuteState", app, !state);
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return false;
}
btn->outputVolumeDarkThemeImage(getAppVolume(app), !state);
return reply.value();
}
// 设置系统输入设备
bool UkmediaAppCtrlWidget::setSystemInputDevice(QString portLabel)
{
QDBusReply reply = interface->call("setSystemInputDevice", portLabel);
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return false;
}
return reply.value();
}
// 设置系统输出设备
bool UkmediaAppCtrlWidget::setSystemOutputDevice(QString portLabel)
{
QDBusReply reply = interface->call("setSystemOutputDevice", portLabel);
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return false;
}
return reply.value();
}
// 设置应用输出设备
bool UkmediaAppCtrlWidget::setAppOutputDevice(QString portLabel)
{
QComboBox *combobox = qobject_cast(sender());
if (combobox == nullptr)
return false;
QString app = combobox->objectName().split("-output").at(0);
if (app == SYSTEM_VOLUME_CTRL)
return setSystemOutputDevice(portLabel);
int cardIndex = -1;
QString sinkPortName;
QMap::iterator it;
for (it = portInfoMap.begin(); it != portInfoMap.end(); it++) {
pa_device_port_info info = it.value();
if (portLabel == info.description && info.direction == 1) {
cardIndex = info.card;
sinkPortName = info.name;
}
}
QDBusReply reply = interface->call("setAppOutputDevice", app, cardIndex, sinkPortName);
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return false;
}
if (!reply.value()) {
combobox->blockSignals(true);
combobox->setCurrentText(getAppOutputDevice(app));
combobox->blockSignals(false);
qDebug() << __func__ << "failed";
return false;
}
return reply.value();
}
// 设置应用输入设备
bool UkmediaAppCtrlWidget::setAppInputDevice(QString portLabel)
{
QComboBox *combobox = qobject_cast(sender());
if (combobox == nullptr)
return false;
QString app = combobox->objectName().split("-input").at(0);
if (app == SYSTEM_VOLUME_CTRL)
return setSystemInputDevice(portLabel);
int cardIndex = -1;
QString sourcePortName;
QMap::iterator it;
for (it = portInfoMap.begin(); it != portInfoMap.end(); it++) {
pa_device_port_info info = it.value();
if (portLabel == info.description && info.direction == 2) {
cardIndex = info.card;
sourcePortName = info.name;
}
}
QDBusReply reply = interface->call("setAppInputDevice", app, cardIndex, sourcePortName);
if (!reply.isValid()) {
qWarning() << __func__ << "failed";
return false;
}
if (!reply.value()) {
combobox->blockSignals(true);
combobox->setCurrentText(getAppInputDevice(app));
combobox->blockSignals(false);
qDebug() << __func__ << "failed";
return false;
}
return reply.value();
}
void UkmediaAppCtrlWidget::updateAppItem(QString appName)
{
playbackAppInfoList.clear();
recordAppInfoList.clear();
getPlaybackAppInfo();
getRecordAppInfo();
if (!appList.contains(appName)) {
appList << appName;
addItem(appName);
return;
}
else {
UkmediaAppItemWidget *w = stackWidget->findChild(appName);
w->setSliderValue(getAppVolume(appName));
w->outputVolumeDarkThemeImage(getAppVolume(appName), getAppMuteState(appName));
int appType = findAppDirection(appName);
switch (appType) {
case PA_STREAM_PLAYBACK:
w->m_pVolumeWidget->show();
w->m_pInputCombobox->setDisabled(true);
w->m_pOutputCombobox->setDisabled(false);
qDebug() << __func__ << appName << "PA_STREAM_PLAYBACK";
break;
case PA_STREAM_RECORD:
w->m_pVolumeWidget->hide();
w->m_pInputCombobox->setDisabled(false);
w->m_pOutputCombobox->setDisabled(true);
qDebug() << __func__ << appName << "PA_STREAM_RECORD";
break;
default:
w->m_pVolumeWidget->show();
w->m_pInputCombobox->setDisabled(false);
w->m_pOutputCombobox->setDisabled(false);
qDebug() << __func__ << appName << "PA_STREAM_NODIRECTION";
break;
}
#ifdef PA_PROP_APPLICATION_MOVE
w->setInputHintWidgetShow(checkAppMoveStatus(PA_STREAM_RECORD, appName));
w->setOutputHintWidgetShow(checkAppMoveStatus(PA_STREAM_PLAYBACK, appName));
#endif
}
}
// 同步系统音量
void UkmediaAppCtrlWidget::updateSystemVolume(int value)
{
UkmediaAppItemWidget *w = stackWidget->findChild(SYSTEM_VOLUME_CTRL);
int mediaVolume = UkmediaCommon::getInstance().paVolumeToMediaVolume(value);
w->setSliderValue(mediaVolume);
w->outputVolumeDarkThemeImage(mediaVolume, getSystemMuteState());
for (int i = 0; i < appList.count(); i++) {
QString appName = appList.at(i);
UkmediaAppItemWidget *w = stackWidget->findChild(appName);
w->m_pOutputCombobox->blockSignals(true);
w->m_pOutputCombobox->setCurrentText(getAppOutputDevice(appName));
w->m_pOutputCombobox->blockSignals(false);
w->m_pInputCombobox->blockSignals(true);
w->m_pInputCombobox->setCurrentText(getAppInputDevice(appName));
w->m_pInputCombobox->blockSignals(false);
}
}
// 同步应用音量
//void UkmediaAppCtrlWidget::appVolumeChangedSlot(QString app, QString appId, int volume)
//{
// QSlider *slider = stackWidget->findChild(app);
// QLabel *sliderLabel = stackWidget->findChild(app+"-label");
// if (slider == nullptr || sliderLabel == nullptr)
// return;
// int mediaVolume = UkmediaCommon::getInstance().paVolumeToMediaVolume(volume);
// slider->blockSignals(true);
// slider->setValue(mediaVolume);
// slider->blockSignals(false);
// QString percent = QString::number(mediaVolume);
// sliderLabel->setText(percent+"%");
// for (QString appName : appList) {
// QComboBox *outputBox = stackWidget->findChild(appName + "-output");
// QComboBox *inputBox = stackWidget->findChild(appName + "-output");
// inputBox->blockSignals(true);
// outputBox->blockSignals(true);
// QString defaultOutPort = getAppOutputDevice(appName);
// QString defaultInPort = getAppInputDevice(appName);
// inputBox->setCurrentText(defaultInPort);
// outputBox->setCurrentText(defaultOutPort);
// outputBox->blockSignals(false);
// inputBox->blockSignals(false);
// }
// qDebug() << __func__ << app << volume << stackWidget->children();
//}
// 同步系统静音状态
void UkmediaAppCtrlWidget::updateSystemMuteState(bool state)
{
UkuiButtonDrawSvg *btn = stackWidget->findChild(SYSTEM_VOLUME_CTRL);
btn->outputVolumeDarkThemeImage(getSystemVolume(), state);
}
// 同步应用静音状态
void UkmediaAppCtrlWidget::updateAppMuteState(QString app, bool state)
{
UkuiButtonDrawSvg *btn = stackWidget->findChild(app);
btn->outputVolumeDarkThemeImage(getAppVolume(app), state);
}
void UkmediaAppCtrlWidget::updatePort()
{
qDebug() << __func__ << sinkPortList;
QStringList currentSinkPortList = sinkPortList;
QStringList currentSourcePortList = sourcePortList;
portInfoMap.clear();
sinkPortList.clear();
sourcePortList.clear();
getAllPortInfo();
getAllInputPort();
getAllOutputPort();
// 1. 删除不可用输出端口
for (int i = 0; i < currentSinkPortList.count(); i++) {
QString port = currentSinkPortList.at(i);
if (!sinkPortList.contains(port)) {
for (int a = 0; a < appList.count(); a++) {
QString appName = appList.at(a);
UkmediaAppItemWidget *w = stackWidget->findChild(appName);
int index = indexOfItemCombobox(port, w->m_pOutputCombobox);
w->m_pOutputCombobox->blockSignals(true);
w->m_pOutputCombobox->removeItem(index);
w->m_pOutputCombobox->blockSignals(false);
}
}
}
// 2. 删除不可用输入端口
for (int i = 0; i < currentSourcePortList.count(); i++) {
QString port = currentSourcePortList.at(i);
if (!sourcePortList.contains(port)) {
for (int a = 0; a < appList.count(); a++) {
QString appName = appList.at(a);
UkmediaAppItemWidget *w = stackWidget->findChild(appName);
int index = indexOfItemCombobox(port, w->m_pInputCombobox);
w->m_pInputCombobox->blockSignals(true);
w->m_pInputCombobox->removeItem(index);
w->m_pInputCombobox->blockSignals(false);
}
}
}
// 3. 增加可用输出端口
for (int i = 0; i < sinkPortList.count(); i++) {
QString port = sinkPortList.at(i);
if (!currentSinkPortList.contains(port)) {
for (int a = 0; a < appList.count(); a++) {
QString appName = appList.at(a);
UkmediaAppItemWidget *w = stackWidget->findChild(appName);
w->m_pOutputCombobox->blockSignals(true);
w->m_pOutputCombobox->addItem(port);
w->m_pOutputCombobox->blockSignals(false);
}
}
}
// 4. 增加可用输入端口
for (int i = 0; i < sourcePortList.count(); i++) {
QString port = sourcePortList.at(i);
if (!currentSourcePortList.contains(port)) {
for (int a = 0; a < appList.count(); a++) {
QString appName = appList.at(a);
UkmediaAppItemWidget *w = stackWidget->findChild(appName);
w->m_pInputCombobox->blockSignals(true);
w->m_pInputCombobox->addItem(port);
w->m_pInputCombobox->blockSignals(false);
}
}
}
// 5. 选择默认输出设备
for (int i = 0; i < appList.count(); i++) {
QString appName = appList.at(i);
UkmediaAppItemWidget *w = stackWidget->findChild(appName);
w->m_pOutputCombobox->blockSignals(true);
w->m_pOutputCombobox->setCurrentText(getAppOutputDevice(appName));
w->m_pOutputCombobox->blockSignals(false);
w->m_pInputCombobox->blockSignals(true);
w->m_pInputCombobox->setCurrentText(getAppInputDevice(appName));
w->m_pInputCombobox->blockSignals(false);
//需求31268待2501再合入
#if 1
if (appName.compare(QString(SYSTEM_VOLUME_CTRL)) == 0) {
if (!sinkPortList.isEmpty()) {
if (QString(sinkPortList.at(0)).compare(QString(tr("None"))) == 0) {
w->m_pVolumeSlider->setEnabled(false);
w->m_pVolumeBtn->setEnabled(false);
} else {
w->m_pVolumeSlider->setEnabled(true);
w->m_pVolumeBtn->setEnabled(true);
}
}
}
#endif
}
}
int UkmediaAppCtrlWidget::indexOfItemCombobox(QString port, QComboBox *box)
{
for (int index = 0; index < box->count(); ++index)
{
QString textport = box->itemText(index);
if (textport == port) {
return index;
}
}
return -1;
}
QString UkmediaAppCtrlWidget::getAppName(QString appName)
{
GError* error = nullptr;
GKeyFileFlags flag = G_KEY_FILE_NONE;
GKeyFile* keyfile = g_key_file_new();
appName = AppDesktopFileAdaption(appName);
QString path = "/usr/share/applications/";
path.append(appName);
path.append(".desktop");
/* Some applications desktop file exist in /etc/xdg/autostart/ path */
QFileInfo file(path);
if (!file.exists()) {
path = "/etc/xdg/autostart/";
path.append(appName);
path.append(".desktop");
}
QByteArray fpbyte = path.toLocal8Bit();
char* filepath = fpbyte.data();
if (!g_key_file_load_from_file(keyfile, filepath, flag, &error))
qDebug() << "g_key_file_load_from_file() failed" << error->message;
char* name= g_key_file_get_locale_string(keyfile, "Desktop Entry", "Name", nullptr, nullptr);
QString namestr=QString::fromLocal8Bit(name);
g_key_file_free(keyfile);
if (appName == SYSTEM_VOLUME_CTRL)
namestr = tr("System Volume");
namestr = (namestr != "") ? namestr : appName;
return namestr;
}
QString UkmediaAppCtrlWidget::getAppIcon(QString appName)
{
GError** error=nullptr;
GKeyFileFlags flags=G_KEY_FILE_NONE;
GKeyFile* keyfile=g_key_file_new ();
appName = AppDesktopFileAdaption(appName);
QString path = "/usr/share/applications/";
path.append(appName);
path.append(".desktop");
/* Some applications desktop file exist in /etc/xdg/autostart/ path */
QFileInfo file(path);
if (!file.exists()) {
path = "/etc/xdg/autostart/";
path.append(appName);
path.append(".desktop");
}
QByteArray fpbyte=path.toLocal8Bit();
char* filepath=fpbyte.data();
g_key_file_load_from_file(keyfile,filepath,flags,error);
char* name=g_key_file_get_locale_string(keyfile,"Desktop Entry","Icon", nullptr, nullptr);
QString namestr=QString::fromLocal8Bit(name);
g_key_file_free(keyfile);
if (appName == SYSTEM_VOLUME_CTRL)
namestr = SYSTEM_VOLUME_CTRL;
/* If we can't find the app icon
* we need to set a default icon for it */
namestr = (namestr != "") ? namestr : "application-x-desktop";
return namestr;
}
int UkmediaAppCtrlWidget::findAppDirection(QString appName)
{
int stream = PA_STREAM_NODIRECTION;
for (appInfo info : playbackAppInfoList) {
if (info.name == appName) {
stream = PA_STREAM_PLAYBACK;
break;
}
}
for (appInfo info : recordAppInfoList) {
if (info.name == appName) {
if (stream == PA_STREAM_PLAYBACK)
stream = PA_STREAM_NODIRECTION;
else
stream = PA_STREAM_RECORD;
break;
}
}
return stream;
}
#ifdef PA_PROP_APPLICATION_MOVE
bool UkmediaAppCtrlWidget::checkAppMoveStatus(int appType, QString appName)
{
bool moveStatus = false;
if (appName == SYSTEM_VOLUME_CTRL)
return true;
if (appType == PA_STREAM_PLAYBACK) {
//start #227383
if ((appName == "kylin-recorder") && (findAppDirection(appName) == PA_STREAM_NODIRECTION)) {
return false;
}
//end
for (appInfo info : playbackAppInfoList) {
if (info.name == appName) {
moveStatus = (info.move == "yes") ? true : false;
break;
}
}
}
else {
for (appInfo info : recordAppInfoList) {
// #214516 Circumvention deals with kylin-recorder
if (appName == "kylin-recorder")
return false;
if (info.name == appName) {
moveStatus = (info.move == "yes") ? true : false;
break;
}
}
}
return moveStatus;
}
#endif
QString UkmediaAppCtrlWidget::AppDesktopFileAdaption(QString appName)
{
//某些第三方应用获取到appName与它的desktop文件名不一致,需手动适配
if (appName.contains("qaxbrowser"))
appName = "qaxbrowser-safe";
return appName;
}
UkmediaAppCtrlWidget::~UkmediaAppCtrlWidget()
{
}
ukui-media/audio/app-device-control/ukmedia_app_item_widget.cpp 0000664 0001750 0001750 00000030630 15170054730 023676 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "ukmedia_app_item_widget.h"
UkmediaAppItemWidget::UkmediaAppItemWidget(QWidget *parent)
: QWidget(parent)
{
if (QGSettings::isSchemaInstalled("org.ukui.style")) {
QGSettings *nThemeSetting = new QGSettings("org.ukui.style");
if (nThemeSetting->keys().contains("styleName")) {
mThemeName = nThemeSetting->get("style-name").toString();
}
}
initUI();
onPaletteChanged();
}
void UkmediaAppItemWidget::initUI()
{
this->setFixedSize(560,477);
m_pAppLabel = new FixLabel(tr("Application"), this);
m_pAppLabel->setContentsMargins(17,0,0,0);
m_pAppWidget = new QFrame(this);
m_pInputWidget = new QFrame(m_pAppWidget);
m_pOutputWidget = new QFrame(m_pAppWidget);
m_pVolumeWidget = new QFrame(m_pAppWidget);
m_pCheckWidget = new QFrame(m_pAppWidget);
m_pAppWidget->setFrameShape(QFrame::Shape::Box);
m_pInputWidget->setFrameShape(QFrame::Shape::Box);
m_pOutputWidget->setFrameShape(QFrame::Shape::Box);
m_pVolumeWidget->setFrameShape(QFrame::Shape::Box);
m_pCheckWidget->setFrameShape(QFrame::Shape::Box);
m_pInputWidget->setObjectName("InputWidget");
m_pOutputWidget->setObjectName("OutputWidget");
m_pVolumeWidget->setObjectName("VolumeWidget");
m_pAppWidget->setFixedSize(512, 415);
m_pInputWidget->setFixedSize(512, 90);
m_pOutputWidget->setFixedSize(512, 90);
m_pVolumeWidget->setFixedSize(512, 60);
m_pCheckWidget->setFixedSize(512, 36);
//应用音量布局
m_pVolumeLabel = new FixLabel(tr("Output Volume"), m_pVolumeWidget);
m_pVolumeBtn = new UkuiButtonDrawSvg(m_pVolumeWidget);
m_pVolumeSlider = new KSlider(m_pVolumeWidget);
m_pVolumeSlider->setRange(0,100);
m_pVolumeSlider->setSliderType(SmoothSlider);
m_pVolumeSlider->setNodeVisible(false);
m_pVolumeNumLabel = new FixLabel("0%", m_pVolumeWidget);
m_pVolumeBtn->setFixedSize(24,24);
m_pVolumeSlider->setFixedSize(260,55);
m_pVolumeLabel->setFixedSize(120,20);
m_pVolumeNumLabel->setFixedSize(55,20);
m_pVolumeSlider->setOrientation(Qt::Horizontal);
m_pVolumeNumLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
QHBoxLayout *volumeLayout = new QHBoxLayout(m_pVolumeWidget);
volumeLayout->addItem(new QSpacerItem(17,20,QSizePolicy::Fixed));
volumeLayout->addWidget(m_pVolumeLabel);
volumeLayout->addItem(new QSpacerItem(12,20,QSizePolicy::Expanding));
volumeLayout->addWidget(m_pVolumeBtn);
volumeLayout->addItem(new QSpacerItem(10,20,QSizePolicy::Fixed));
volumeLayout->addWidget(m_pVolumeSlider);
// volumeLayout->addItem(new QSpacerItem(14,20,QSizePolicy::Fixed));
volumeLayout->addWidget(m_pVolumeNumLabel);
volumeLayout->addItem(new QSpacerItem(16,20,QSizePolicy::Fixed));
volumeLayout->setSpacing(0);
m_pVolumeWidget->setLayout(volumeLayout);
m_pVolumeWidget->layout()->setContentsMargins(0,0,0,0);
//输入设备布局
m_pInputDevLabel = new FixLabel(tr("Input Device"), m_pInputWidget);
m_pInputCombobox = new QComboBox(m_pInputWidget);
m_pInputDevLabel->setFixedSize(120, 36);
m_pInputCombobox->setFixedSize(347, 36);
m_pInputHintIcon = new QLabel(m_pInputWidget);
m_pInputHintIcon->setFixedSize(16, 16);
m_pInputHintIcon->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(QSize(16, 16)));
m_pInputHintLabel = new FixLabel(tr("This case does not support setting the input device"), m_pInputWidget);
m_pInputHintWidget = new QFrame(m_pInputWidget);
QHBoxLayout *lay = new QHBoxLayout(m_pInputHintWidget);
lay->addWidget(m_pInputHintIcon);
lay->addWidget(m_pInputHintLabel);
lay->setSpacing(3);
m_pInputHintWidget->setLayout(lay);
m_pInputHintWidget->layout()->setContentsMargins(0, 0, 0, 0);
QGridLayout *gridLayout = new QGridLayout(m_pInputWidget);
gridLayout->addWidget(m_pInputDevLabel, 0, 0);
gridLayout->addWidget(m_pInputCombobox, 0, 1);
gridLayout->addItem(new QSpacerItem(132, 20, QSizePolicy::Fixed), 1, 0);
gridLayout->addWidget(m_pInputHintWidget);
gridLayout->setSpacing(0);
m_pInputWidget->setLayout(gridLayout);
m_pInputWidget->layout()->setContentsMargins(17, 11, 16, 0);
//输出设备布局
m_pOutputDevLabel = new FixLabel(tr("Output Device"), m_pOutputWidget);
m_pOutputCombobox = new QComboBox(m_pOutputWidget);
m_pOutputDevLabel->setFixedSize(120, 36);
m_pOutputCombobox->setFixedSize(347, 36);
m_pOutputHintIcon = new QLabel(m_pOutputWidget);
m_pOutputHintIcon->setFixedSize(16, 16);
m_pOutputHintIcon->setPixmap(QIcon::fromTheme("dialog-warning").pixmap(QSize(16, 16)));
m_pOutputHintLabel = new FixLabel(tr("This case does not support setting the output device"), m_pOutputWidget);
m_pOutputHintWidget = new QFrame(m_pOutputWidget);
QHBoxLayout *outputLay = new QHBoxLayout(m_pOutputHintWidget);
outputLay->addWidget(m_pOutputHintIcon);
outputLay->addWidget(m_pOutputHintLabel);
outputLay->setSpacing(3);
m_pOutputHintWidget->setLayout(outputLay);
m_pOutputHintWidget->layout()->setContentsMargins(0, 0, 0, 0);
QGridLayout *outputGridLayout = new QGridLayout(m_pOutputWidget);
outputGridLayout->addWidget(m_pOutputDevLabel, 0, 0);
outputGridLayout->addWidget(m_pOutputCombobox, 0, 1);
outputGridLayout->addItem(new QSpacerItem(132, 20, QSizePolicy::Fixed), 1, 0);
outputGridLayout->addWidget(m_pOutputHintWidget);
outputGridLayout->setSpacing(0);
m_pOutputWidget->setLayout(outputGridLayout);
m_pOutputWidget->layout()->setContentsMargins(17, 11, 16, 0);
// check Btn
m_pConfirmBtn = new QPushButton(tr("Confirm"), m_pCheckWidget);
m_pConfirmBtn->setFixedSize(96, 36);
m_pConfirmBtn->setProperty("isImportant", true);
QHBoxLayout *checkLayout = new QHBoxLayout(m_pCheckWidget);
checkLayout->addStretch();
checkLayout->addWidget(m_pConfirmBtn);
checkLayout->setSpacing(0);
m_pCheckWidget->setLayout(checkLayout);
m_pCheckWidget->layout()->setContentsMargins(0,0,0,0);
// line1 = myLine();
// line2 = myLine();
QVBoxLayout *vlayout = new QVBoxLayout(m_pAppWidget);
vlayout->addWidget(m_pVolumeWidget);
vlayout->addSpacing(1);
vlayout->addWidget(m_pOutputWidget);
vlayout->addSpacing(1);
vlayout->addWidget(m_pInputWidget);
vlayout->addItem(new QSpacerItem(16,197,QSizePolicy::Fixed));
vlayout->addStretch();
vlayout->addWidget(m_pCheckWidget);
vlayout->setSpacing(0);
vlayout->setContentsMargins(0,0,0,0);
//整体布局
QVBoxLayout *appLayout = new QVBoxLayout(this);
appLayout->addItem(new QSpacerItem(16,8,QSizePolicy::Fixed));
appLayout->addWidget(m_pAppLabel);
appLayout->addItem(new QSpacerItem(16,8,QSizePolicy::Fixed));
appLayout->addWidget(m_pAppWidget);
appLayout->addItem(new QSpacerItem(16,24,QSizePolicy::Fixed));
appLayout->addStretch();
appLayout->setSpacing(0);
this->setLayout(appLayout);
this->layout()->setContentsMargins(25,0,23,0);
}
void UkmediaAppItemWidget::setInputHintWidgetShow(bool status)
{
if (status) {
m_pInputHintWidget->hide();
m_pInputWidget->setFixedSize(512, 60);
m_pInputCombobox->setDisabled(false);
} else {
m_pInputHintWidget->show();
m_pInputWidget->setFixedSize(512, 90);
m_pInputCombobox->setDisabled(true);
}
}
void UkmediaAppItemWidget::setOutputHintWidgetShow(bool status)
{
if (status) {
m_pOutputHintWidget->hide();
m_pOutputWidget->setFixedSize(512, 60);
m_pOutputCombobox->setDisabled(false);
} else {
m_pOutputHintWidget->show();
m_pOutputWidget->setFixedSize(512, 90);
m_pOutputCombobox->setDisabled(true);
}
}
// 设置窗口应用标题
void UkmediaAppItemWidget::setTitleName(QString name)
{
m_pAppLabel->setText(name);
}
void UkmediaAppItemWidget::setChildObjectName(QString name)
{
m_pVolumeNumLabel->setObjectName(name+"-label");
m_pVolumeBtn->setObjectName(name);
m_pVolumeSlider->setObjectName(name);
m_pInputCombobox->setObjectName(name+"-input");
m_pOutputCombobox->setObjectName(name+"-output");
this->setObjectName(name);
}
void UkmediaAppItemWidget::setSliderValue(int value)
{
if (m_pVolumeSlider->objectName() == "kylin-settings-system") {
if (QGSettings::isSchemaInstalled("org.ukui.sound")) {
QGSettings *nThemeSetting = new QGSettings("org.ukui.sound");
if (nThemeSetting->keys().contains("volumeIncrease")) {
if (nThemeSetting->get("volumeIncrease").toBool())
m_pVolumeSlider->setRange(0, 125);
}
}
}
m_pVolumeSlider->blockSignals(true);
m_pVolumeSlider->setValue(value);
m_pVolumeSlider->blockSignals(false);
QString percent = QString::number(value);
m_pVolumeNumLabel->setText(percent+"%");
}
void UkmediaAppItemWidget::addInputCombobox(QString port)
{
m_pInputCombobox->blockSignals(true);
m_pInputCombobox->addItem(port);
m_pInputCombobox->blockSignals(false);
}
void UkmediaAppItemWidget::addOutputCombobox(QString port)
{
m_pOutputCombobox->blockSignals(true);
m_pOutputCombobox->addItem(port);
m_pOutputCombobox->blockSignals(false);
}
void UkmediaAppItemWidget::onPaletteChanged()
{
QPalette palette = m_pInputHintLabel->palette();
QColor color = palette.color(QPalette::PlaceholderText);
palette.setColor(QPalette::Text, color);
m_pInputHintLabel->setPalette(palette);
palette = m_pOutputHintLabel->palette();
color = palette.color(QPalette::PlaceholderText);
palette.setColor(QPalette::Text, color);
m_pOutputHintLabel->setPalette(palette);
if (mThemeName == UKUI_THEME_LIGHT || mThemeName == UKUI_THEME_DEFAULT) {
m_pInputWidget->setStyleSheet("#InputWidget{border-radius: 6px; background-color: #F5F5F5;}");
m_pOutputWidget->setStyleSheet("#OutputWidget{border-radius: 6px; background-color: #F5F5F5;}");
m_pVolumeWidget->setStyleSheet("#VolumeWidget{border-radius: 6px; background-color: #F5F5F5;}");
}
else if (mThemeName == UKUI_THEME_DARK) {
m_pInputWidget->setStyleSheet("#InputWidget{border-radius: 6px; background-color: #333333;}");
m_pOutputWidget->setStyleSheet("#OutputWidget{border-radius: 6px; background-color: #333333;}");
m_pVolumeWidget->setStyleSheet("#VolumeWidget{border-radius: 6px; background-color: #333333;}");
}
}
// 更新音量图标
void UkmediaAppItemWidget::outputVolumeDarkThemeImage(int value, bool status)
{
QImage image;
QColor color = QColor(0,0,0,216);
if (mThemeName == UKUI_THEME_LIGHT || mThemeName == UKUI_THEME_DEFAULT)
color = QColor(0,0,0,216);
else if (mThemeName == UKUI_THEME_DARK)
color = QColor(255,255,255,216);
if (status) {
image = QIcon::fromTheme("audio-volume-muted-symbolic").pixmap(24,24).toImage();
}
else if (value <= 0) {
image = QIcon::fromTheme("audio-volume-muted-symbolic").pixmap(24,24).toImage();
}
else if (value > 0 && value <= 33) {
image = QIcon::fromTheme("audio-volume-low-symbolic").pixmap(24,24).toImage();
}
else if (value >33 && value <= 66) {
image = QIcon::fromTheme("audio-volume-medium-symbolic").pixmap(24,24).toImage();
}
else {
image = QIcon::fromTheme("audio-volume-high-symbolic").pixmap(24,24).toImage();
}
m_pVolumeBtn->refreshIcon(image, color);
}
QFrame* UkmediaAppItemWidget::myLine()
{
QFrame *line = new QFrame(this);
line->setFixedSize(512, 1);
line->setLineWidth(0);
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
return line;
}
UkmediaAppItemWidget::~UkmediaAppItemWidget()
{
}
ukui-media/audio/titlelabel.cpp 0000664 0001750 0001750 00000003034 15170052044 015456 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "titlelabel.h"
#include
#include
#include
#include
TitleLabel::TitleLabel(QWidget *parent):
QLabel(parent)
{
/*初始化字体*/
// QFont font;
// QGSettings *m_fontSetting = new QGSettings("org.ukui.style");
// font.setFamily(m_fontSetting->get("systemFont").toString());
// font.setPixelSize(m_fontSetting->get("systemFontSize").toInt() * 18 / 11); //设置的是pt,按照公式计算为px,标题默认字为18px
// font.setWeight(QFont::Medium);
// this->setFont(font);
this ->setContentsMargins(16,0,0,0);
// delete m_fontSetting;
// m_fontSetting = nullptr;
}
TitleLabel::~TitleLabel()
{
}
ukui-media/audio/ukui_list_widget_item.h 0000664 0001750 0001750 00000004054 15170054730 017402 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef UKUILISTWIDGETITEM_H
#define UKUILISTWIDGETITEM_H
#include
#include
#include
#include
#include
#include
#include
#include
class UkuiListWidget : public QListWidget
{
Q_OBJECT
public:
UkuiListWidget(QWidget *parent = nullptr);
~UkuiListWidget();
protected:
void paintEvent(QPaintEvent*event) {
int i;
for (i = 0 ;i < this->count();i++) {
QListWidgetItem *item = this->item(i);
// item->setTextColor(QColor(0,0,0,0));
delete item;
}
QListWidget::paintEvent(event);
}
};
class UkuiListWidgetItem : public QWidget
{
Q_OBJECT
public:
UkuiListWidgetItem(QWidget *parent = 0);
~UkuiListWidgetItem();
public:
void setLabelText(QString portText,QString deviceLabel);
// void setLabelTextIsWhite(bool selected);
void setSelected(bool selected);
// QString text();
QString portName;
QLabel * portLabel;
QLabel * deviceLabel;
protected:
// void paintEvent(QPaintEvent *event);
void mousePressEvent(QMouseEvent *ev);
private:
QWidget * widget;
};
#endif // UKUILISTWIDGETITEM_H
ukui-media/audio/ukmedia_input_widget.h 0000664 0001750 0001750 00000004612 15170054730 017212 0 ustar feng feng /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef UKMEDIAINPUTWIDGET_H
#define UKMEDIAINPUTWIDGET_H
#include